Skip to content

Commit

Permalink
props exports
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrepreneur committed Jan 19, 2023
1 parent e7d55cf commit 51b5fa9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@raidguild/design-system",
"version": "0.4.32",
"version": "0.4.33",
"license": "MIT",
"author": "Raid Guild",
"module": "dist/design-system.esm.js",
Expand Down
17 changes: 11 additions & 6 deletions src/components/chakra/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// EXPORT AS CHAKRACOMPONENT IF THERE'S A NATIVE COMPONENT
export {
Accordion,
AccordionItem,
Expand Down Expand Up @@ -152,21 +153,26 @@ export {
createStandaloneToast,
ToastProvider,
} from '@chakra-ui/react';
// EXPORT DEFAULT COMPONENT TYPES AS [CHAKRACOMPONENTTYPE] SO THERE ISN'T CONFUSION
export type {
ToastId,
CreateToastFnReturn,
AvatarProps,
AlertDialogProps as ChakraAlertDialogProps,
AlertStatus as ChakraAlertStatus,
BadgeProps as ChakraBadgeProps,
BoxProps as ChakraBoxProps,
ButtonProps,
ButtonProps as ChakraButtonProps,
ButtonGroupProps as ChakraButtonGroupProps,
ChakraProps,
CheckboxProps as ChakraCheckboxProps,
DrawerProps,
FlexProps,
DrawerProps as ChakraDrawerProps,
FlexProps as ChakraFlexProps,
HeadingProps as ChakraHeadingProps,
HTMLChakraProps,
InputProps as ChakraInputProps,
ListProps as ChakraListProps,
LinkProps as ChakraLinkProps,
ModalProps as ChakraModalProps,
RadioProps as ChakraRadioProps,
RadioGroupProps,
Expand All @@ -177,8 +183,7 @@ export type {
TagProps as ChakraTagProps,
TextProps as ChakraTextProps,
TextareaProps as ChakraTextareaProps,
TooltipProps as ChakraTooltipProps,
WrapProps,
AlertStatus,
ToastProps as ChakraToastProps,
TooltipProps as ChakraTooltipProps,
WrapProps as ChakraWrapProps,
} from '@chakra-ui/react';
18 changes: 9 additions & 9 deletions src/hooks/useToast.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useRef } from 'react';
import _ from 'lodash';
import {
useToast as useChakraToast,
AlertStatus,
useChakraToast,
ChakraAlertStatus,
ToastId,
CreateToastFnReturn,
} from '@chakra-ui/react';
} from '../components/chakra';
import { Toast, ToastProps } from '../components/atoms';

const ToastBase = ({
Expand All @@ -19,7 +19,7 @@ const ToastBase = ({
closeToast,
...props // gets the rest of the original Chakra Toast props (such as isClosable)
}: ToastProps & {
status: AlertStatus;
status: ChakraAlertStatus;
toast: Partial<CreateToastFnReturn>;
}) => {
return toast({
Expand Down Expand Up @@ -57,7 +57,7 @@ const useCustomToast = () => {
success(props: Omit<ToastProps, 'status'>) {
toastIdRef.current = ToastBase({
...props,
status: 'success',
status: 'success' as ChakraAlertStatus,
closeToast,
isClosable: props.isClosable ?? true,
toast,
Expand All @@ -66,7 +66,7 @@ const useCustomToast = () => {
error(props: Omit<ToastProps, 'status'>) {
toastIdRef.current = ToastBase({
...props,
status: 'error',
status: 'error' as ChakraAlertStatus,
closeToast,
isClosable: props.isClosable ?? true,
toast,
Expand All @@ -75,7 +75,7 @@ const useCustomToast = () => {
warning(props: Omit<ToastProps, 'status'>) {
toastIdRef.current = ToastBase({
...props,
status: 'warning',
status: 'warning' as ChakraAlertStatus,
closeToast,
isClosable: props.isClosable ?? true,
toast,
Expand All @@ -84,7 +84,7 @@ const useCustomToast = () => {
loading(props: Omit<ToastProps, 'status'>) {
toastIdRef.current = ToastBase({
...props,
status: 'loading',
status: 'loading' as ChakraAlertStatus,
closeToast,
isClosable: props.isClosable ?? true,
toast,
Expand All @@ -93,7 +93,7 @@ const useCustomToast = () => {
info(props: Omit<ToastProps, 'status'>) {
toastIdRef.current = ToastBase({
...props,
status: 'info',
status: 'info' as ChakraAlertStatus,
closeToast,
isClosable: props.isClosable ?? true,
toast,
Expand Down

0 comments on commit 51b5fa9

Please sign in to comment.