diff --git a/.storybook/storybook.config.js b/.storybook/storybook.config.js index 198247b8..2b7e3333 100644 --- a/.storybook/storybook.config.js +++ b/.storybook/storybook.config.js @@ -27,7 +27,8 @@ export default defineConfig({ "@components": resolve(__dirname, "../src/components"), "@hooks": resolve(__dirname, "../src/hooks"), "@themes": resolve(__dirname, "../src/themes"), - "@validators": resolve(__dirname, "../src/validators"), + "@validators": resolve(__dirname, "./src/validators"), + "@types": resolve(__dirname, "../src/types"), }, }, }); diff --git a/src/components/Accordion/Accordion.tsx b/src/components/Accordion/Accordion.tsx index eedacd3c..85b4d254 100644 --- a/src/components/Accordion/Accordion.tsx +++ b/src/components/Accordion/Accordion.tsx @@ -4,7 +4,7 @@ import Flex, { FlexProps } from "@components/Flex"; // Context import { AccordionContextProvider } from "./AccordionContext"; // Types -import { PrismaneWithInternal, PrismaneProps } from "@/types"; +import { PrismaneWithInternal, PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Accordion/AccordionControl/AccordionControl.tsx b/src/components/Accordion/AccordionControl/AccordionControl.tsx index ab37cfb5..2f0deb35 100644 --- a/src/components/Accordion/AccordionControl/AccordionControl.tsx +++ b/src/components/Accordion/AccordionControl/AccordionControl.tsx @@ -6,7 +6,7 @@ import Transition, { TransitionProps } from "@components/Transition"; import { useAccordionContext } from "../AccordionContext"; import { useAccordionItemContext } from "../AccordionItem/AccordionItemContext"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/Accordion/AccordionIcon/AccordionIcon.tsx b/src/components/Accordion/AccordionIcon/AccordionIcon.tsx index e5edfa54..0adb0a8b 100644 --- a/src/components/Accordion/AccordionIcon/AccordionIcon.tsx +++ b/src/components/Accordion/AccordionIcon/AccordionIcon.tsx @@ -7,7 +7,7 @@ import Transition from "@components/Transition"; import { useAccordionContext } from "../AccordionContext"; import { useAccordionItemContext } from "../AccordionItem/AccordionItemContext"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Accordion/AccordionItem/AccordionItem.tsx b/src/components/Accordion/AccordionItem/AccordionItem.tsx index f1f8e0f8..663767a4 100644 --- a/src/components/Accordion/AccordionItem/AccordionItem.tsx +++ b/src/components/Accordion/AccordionItem/AccordionItem.tsx @@ -4,7 +4,7 @@ import Flex, { FlexProps } from "@components/Flex"; // Context import { AccordionItemContextProvider } from "./AccordionItemContext"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Alert/Alert.tsx b/src/components/Alert/Alert.tsx index a23f0b88..cb0aa835 100644 --- a/src/components/Alert/Alert.tsx +++ b/src/components/Alert/Alert.tsx @@ -13,7 +13,7 @@ import CloseButton from "@components/CloseButton"; import useAnimation from "@hooks/useAnimation"; import usePresence from "@hooks/usePresence"; // Types -import { PrismaneActions, PrismaneWithInternal, PrismaneProps } from "@/types"; +import { PrismaneActions, PrismaneWithInternal, PrismaneProps } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Animation/Animation.tsx b/src/components/Animation/Animation.tsx index b3a637d3..fa576249 100644 --- a/src/components/Animation/Animation.tsx +++ b/src/components/Animation/Animation.tsx @@ -8,7 +8,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/AspectRatio/AspectRatio.tsx b/src/components/AspectRatio/AspectRatio.tsx index e446daf8..8cf5c730 100644 --- a/src/components/AspectRatio/AspectRatio.tsx +++ b/src/components/AspectRatio/AspectRatio.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Box, { BoxProps } from "@components/Box"; // Types -import { PrismaneStyles, PrismaneProps } from "@/types"; +import { PrismaneStyles, PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/AutocompleteField/AutocompleteField.tsx b/src/components/AutocompleteField/AutocompleteField.tsx index eb16f884..73ecb12b 100644 --- a/src/components/AutocompleteField/AutocompleteField.tsx +++ b/src/components/AutocompleteField/AutocompleteField.tsx @@ -4,7 +4,7 @@ import SelectField, { SelectFieldProps } from "@components/SelectField"; // Hooks import useDebounce from "@hooks/useDebounce"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Avatar/Avatar.tsx b/src/components/Avatar/Avatar.tsx index e0e0f851..ad161752 100644 --- a/src/components/Avatar/Avatar.tsx +++ b/src/components/Avatar/Avatar.tsx @@ -14,7 +14,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Badge/Badge.tsx b/src/components/Badge/Badge.tsx index 39c53f15..4132e962 100644 --- a/src/components/Badge/Badge.tsx +++ b/src/components/Badge/Badge.tsx @@ -11,7 +11,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Box/Box.tsx b/src/components/Box/Box.tsx index 231e80d4..b9eb4e5d 100644 --- a/src/components/Box/Box.tsx +++ b/src/components/Box/Box.tsx @@ -10,7 +10,7 @@ import { PrismaneVersatile, Versatile, PrismaneVersatileRef, -} from "@/types"; +} from "@types"; // Utils import { strip, dual, fr } from "@/utils"; diff --git a/src/components/Box/useStyling/useStyling.ts b/src/components/Box/useStyling/useStyling.ts index 75b50f24..fb06a9c1 100644 --- a/src/components/Box/useStyling/useStyling.ts +++ b/src/components/Box/useStyling/useStyling.ts @@ -5,7 +5,7 @@ import { usePrismaneTheme } from "@components/PrismaneProvider/PrismaneContext"; // Hooks import useMemoization from "@hooks/useMemoization"; // Types -import { PrismaneTheme } from "@/types"; +import { PrismaneTheme } from "@types"; type StylingProp = | any diff --git a/src/components/Breadcrumb/Breadcrumb.tsx b/src/components/Breadcrumb/Breadcrumb.tsx index 9573c30d..87955572 100644 --- a/src/components/Breadcrumb/Breadcrumb.tsx +++ b/src/components/Breadcrumb/Breadcrumb.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Flex, { FlexProps } from "@components/Flex"; // Types -import { PrismaneWithInternal } from "@/types"; +import { PrismaneWithInternal } from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/Breadcrumb/BreadcrumbItem/BreadcrumbItem.tsx b/src/components/Breadcrumb/BreadcrumbItem/BreadcrumbItem.tsx index b593742b..a4bba998 100644 --- a/src/components/Breadcrumb/BreadcrumbItem/BreadcrumbItem.tsx +++ b/src/components/Breadcrumb/BreadcrumbItem/BreadcrumbItem.tsx @@ -3,7 +3,7 @@ import { forwardRef } from "react"; import Flex, { FlexProps } from "@components/Flex"; import Link from "@components/Link"; // Types -import { Versatile, PrismaneVersatile, PrismaneVersatileRef } from "@/types"; +import { Versatile, PrismaneVersatile, PrismaneVersatileRef } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 0e597ab8..baa5b37e 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -12,7 +12,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx index 35639b33..36a7019c 100644 --- a/src/components/Card/Card.tsx +++ b/src/components/Card/Card.tsx @@ -7,7 +7,7 @@ import { Versatile, PrismaneVersatile, PrismaneVersatileRef, -} from "@/types"; +} from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/Center/Center.tsx b/src/components/Center/Center.tsx index 41d7d6d9..ebe3b1b6 100644 --- a/src/components/Center/Center.tsx +++ b/src/components/Center/Center.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Flex, { FlexProps } from "@components/Flex"; // Types -import { Versatile, PrismaneVersatile, PrismaneVersatileRef } from "@/types"; +import { Versatile, PrismaneVersatile, PrismaneVersatileRef } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Checkbox/Checkbox.tsx b/src/components/Checkbox/Checkbox.tsx index 53f06abd..298178df 100644 --- a/src/components/Checkbox/Checkbox.tsx +++ b/src/components/Checkbox/Checkbox.tsx @@ -7,7 +7,7 @@ import Field, { useFieldProps } from "@components/Field"; import Animation from "@components/Animation"; import Hidden from "@components/Hidden"; // Types -import { PrismaneFieldComponent, PrismaneProps } from "@/types"; +import { PrismaneFieldComponent, PrismaneProps } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Chip/Chip.tsx b/src/components/Chip/Chip.tsx index 66dedd5d..74d40123 100644 --- a/src/components/Chip/Chip.tsx +++ b/src/components/Chip/Chip.tsx @@ -5,7 +5,7 @@ import Transition, { TransitionProps } from "@components/Transition"; import Icon from "@components/Icon"; import Text from "@components/Text"; // Types -import { PrismaneColors, PrismaneBreakpoints, PrismaneProps } from "@/types"; +import { PrismaneColors, PrismaneBreakpoints, PrismaneProps } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Circle/Circle.tsx b/src/components/Circle/Circle.tsx index 08e640ca..6e9a0d8a 100644 --- a/src/components/Circle/Circle.tsx +++ b/src/components/Circle/Circle.tsx @@ -8,7 +8,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Collapse/Collapse.tsx b/src/components/Collapse/Collapse.tsx index 828aced3..d01b54b4 100644 --- a/src/components/Collapse/Collapse.tsx +++ b/src/components/Collapse/Collapse.tsx @@ -3,7 +3,7 @@ import { forwardRef, useRef } from "react"; import Animation, { AnimationProps } from "@components/Animation"; import Box from "@components/Box"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/ColorField/ColorField.tsx b/src/components/ColorField/ColorField.tsx index 05d532ef..174bd1d9 100644 --- a/src/components/ColorField/ColorField.tsx +++ b/src/components/ColorField/ColorField.tsx @@ -9,7 +9,7 @@ import usePrismaneColor from "@components/PrismaneProvider/usePrismaneColor"; // Globals import { PRISMANE_DEFAULT_COLORS_MAP } from "@/constants"; // Types -import { PrismaneColors, PrismaneProps } from "@/types"; +import { PrismaneColors, PrismaneProps } from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/Container/Container.tsx b/src/components/Container/Container.tsx index 14614799..4351a59f 100644 --- a/src/components/Container/Container.tsx +++ b/src/components/Container/Container.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Flex, { FlexProps } from "@components/Flex"; // Types -import { PrismaneBreakpoints, PrismaneProps } from "@/types"; +import { PrismaneBreakpoints, PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Dialog/Dialog.tsx b/src/components/Dialog/Dialog.tsx index 1b2c24a4..3bb3e219 100644 --- a/src/components/Dialog/Dialog.tsx +++ b/src/components/Dialog/Dialog.tsx @@ -11,11 +11,7 @@ import useKeyboardShortcut from "@/hooks/useKeyboardShortcut"; // Context import { DialogContextProvider } from "./DialogContext"; // Types -import { - PrismaneWithInternal, - PrismanePositions, - PrismaneProps, -} from "@/types"; +import { PrismaneWithInternal, PrismanePositions, PrismaneProps } from "@types"; // Utils import { strip, fr, variants } from "@/utils"; diff --git a/src/components/Divider/Divider.tsx b/src/components/Divider/Divider.tsx index e950dca9..6a58b7a3 100644 --- a/src/components/Divider/Divider.tsx +++ b/src/components/Divider/Divider.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Flex, { FlexProps } from "@components/Flex"; // Types -import { PrismaneProps, PrismaneBreakpoints } from "@/types"; +import { PrismaneProps, PrismaneBreakpoints } from "@types"; // Utils import { strip, variants } from "@/utils"; diff --git a/src/components/Drawer/Drawer.tsx b/src/components/Drawer/Drawer.tsx index 9954791f..01df4b59 100644 --- a/src/components/Drawer/Drawer.tsx +++ b/src/components/Drawer/Drawer.tsx @@ -15,7 +15,7 @@ import { PrismaneWithInternal, PrismaneBreakpoints, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip, variants, dual, fr } from "@/utils"; // Internal Components diff --git a/src/components/Field/Field.tsx b/src/components/Field/Field.tsx index fd0f78d1..02710dde 100644 --- a/src/components/Field/Field.tsx +++ b/src/components/Field/Field.tsx @@ -13,7 +13,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Hooks import { usePrismaneColor } from "../PrismaneProvider"; import useFieldProps from "./useFieldProps"; diff --git a/src/components/Field/FieldAddon/FieldAddon.tsx b/src/components/Field/FieldAddon/FieldAddon.tsx index 333b9a33..cc96e416 100644 --- a/src/components/Field/FieldAddon/FieldAddon.tsx +++ b/src/components/Field/FieldAddon/FieldAddon.tsx @@ -3,7 +3,7 @@ import { forwardRef } from "react"; import Transition, { TransitionProps } from "@components/Transition"; import Flex, { FlexProps } from "@components/Flex"; // Types -import { PrismaneBreakpoints, PrismaneProps } from "@/types"; +import { PrismaneBreakpoints, PrismaneProps } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Field/FieldError/FieldError.tsx b/src/components/Field/FieldError/FieldError.tsx index d4d91ff1..b954e6c1 100644 --- a/src/components/Field/FieldError/FieldError.tsx +++ b/src/components/Field/FieldError/FieldError.tsx @@ -3,7 +3,7 @@ import { forwardRef } from "react"; import Flex, { FlexProps } from "@components/Flex"; import Animation, { AnimationProps } from "@components/Animation"; // Types -import { PrismaneBreakpoints, PrismaneProps } from "@/types"; +import { PrismaneBreakpoints, PrismaneProps } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Field/FieldLabel/FieldLabel.tsx b/src/components/Field/FieldLabel/FieldLabel.tsx index f34bb0fa..24b7695f 100644 --- a/src/components/Field/FieldLabel/FieldLabel.tsx +++ b/src/components/Field/FieldLabel/FieldLabel.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Text, { TextProps } from "@components/Text"; // Types -import { PrismaneBreakpoints, PrismaneProps } from "@/types"; +import { PrismaneBreakpoints, PrismaneProps } from "@types"; // Utils import { strip, variants } from "@/utils"; diff --git a/src/components/Field/useFieldProps.ts b/src/components/Field/useFieldProps.ts index bea7ab32..7f03f932 100644 --- a/src/components/Field/useFieldProps.ts +++ b/src/components/Field/useFieldProps.ts @@ -3,7 +3,7 @@ import { useId } from "../../hooks"; // Utils import { splitProps } from "../../utils"; // Types -import { PrismaneFieldComponent } from "../../types"; +import { PrismaneFieldComponent } from "@types"; const useFieldProps = (props: any): [any, PrismaneFieldComponent] => { const [rest, field] = splitProps(props, [ diff --git a/src/components/Flex/Flex.tsx b/src/components/Flex/Flex.tsx index 212721c5..f7dedbf3 100644 --- a/src/components/Flex/Flex.tsx +++ b/src/components/Flex/Flex.tsx @@ -7,7 +7,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip, variants } from "@/utils"; diff --git a/src/components/Gradient/Gradient.tsx b/src/components/Gradient/Gradient.tsx index 660c1bad..aba22050 100644 --- a/src/components/Gradient/Gradient.tsx +++ b/src/components/Gradient/Gradient.tsx @@ -12,7 +12,7 @@ import { PrismaneProps, PrismaneColors, PrismaneShades, -} from "@/types"; +} from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Grid/Grid.tsx b/src/components/Grid/Grid.tsx index 702a10b0..cee6d0da 100644 --- a/src/components/Grid/Grid.tsx +++ b/src/components/Grid/Grid.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Box, { BoxProps } from "@components/Box"; // Types -import { PrismaneProps, PrismaneWithInternal } from "@/types"; +import { PrismaneProps, PrismaneWithInternal } from "@types"; // Utils import { strip, variants } from "@/utils"; diff --git a/src/components/Grid/GridItem/GridItem.tsx b/src/components/Grid/GridItem/GridItem.tsx index b8dd3eda..2b8d0669 100644 --- a/src/components/Grid/GridItem/GridItem.tsx +++ b/src/components/Grid/GridItem/GridItem.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Flex, { FlexProps } from "@components/Flex"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, variants } from "@/utils"; diff --git a/src/components/Hide/Hide.tsx b/src/components/Hide/Hide.tsx index ba2cc0cb..4a65e9c6 100644 --- a/src/components/Hide/Hide.tsx +++ b/src/components/Hide/Hide.tsx @@ -4,7 +4,7 @@ import Box, { BoxProps } from "@components/Box"; // Hooks import useMediaQuery from "@hooks/useMediaQuery"; // Types -import { PrismaneBreakpoints, PrismaneProps } from "@/types"; +import { PrismaneBreakpoints, PrismaneProps } from "@types"; // Utils import { strip, dual, fr } from "@/utils"; diff --git a/src/components/Highlight/Highlight.tsx b/src/components/Highlight/Highlight.tsx index dea6fc8c..cff590d0 100644 --- a/src/components/Highlight/Highlight.tsx +++ b/src/components/Highlight/Highlight.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Box, { BoxProps } from "@components/Box"; // Types -import { Versatile, PrismaneVersatile, PrismaneVersatileRef } from "@/types"; +import { Versatile, PrismaneVersatile, PrismaneVersatileRef } from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/Icon/Icon.tsx b/src/components/Icon/Icon.tsx index c32f22ae..4ccd791a 100644 --- a/src/components/Icon/Icon.tsx +++ b/src/components/Icon/Icon.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Square, { SquareProps } from "@components/Square"; // Types -import { PrismaneBreakpoints, PrismaneProps } from "@/types"; +import { PrismaneBreakpoints, PrismaneProps } from "@types"; // Utils import { strip, dual, fr } from "@/utils"; diff --git a/src/components/Image/Image.tsx b/src/components/Image/Image.tsx index f48a893c..670a5ce9 100644 --- a/src/components/Image/Image.tsx +++ b/src/components/Image/Image.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Box, { BoxProps } from "@components/Box"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Link/Link.tsx b/src/components/Link/Link.tsx index 44cd2497..ac85c0f5 100644 --- a/src/components/Link/Link.tsx +++ b/src/components/Link/Link.tsx @@ -7,7 +7,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/List/List.tsx b/src/components/List/List.tsx index b042f600..37351629 100644 --- a/src/components/List/List.tsx +++ b/src/components/List/List.tsx @@ -7,7 +7,7 @@ import { Versatile, PrismaneVersatile, PrismaneVersatileRef, -} from "@/types"; +} from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Menu/Menu.tsx b/src/components/Menu/Menu.tsx index afcb8b64..091e49ba 100644 --- a/src/components/Menu/Menu.tsx +++ b/src/components/Menu/Menu.tsx @@ -6,7 +6,7 @@ import Animation, { AnimationProps } from "@components/Animation"; import usePresence from "@hooks/usePresence"; import useAnimation from "@hooks/useAnimation"; // Types -import { PrismaneProps, PrismaneWithInternal } from "@/types"; +import { PrismaneProps, PrismaneWithInternal } from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/Menu/MenuItem/MenuItem.tsx b/src/components/Menu/MenuItem/MenuItem.tsx index cd5a97f3..72fea325 100644 --- a/src/components/Menu/MenuItem/MenuItem.tsx +++ b/src/components/Menu/MenuItem/MenuItem.tsx @@ -5,7 +5,7 @@ import Transition, { TransitionProps } from "@components/Transition"; // Utils import { strip, fr } from "@/utils"; // Types -import { PrismaneColors, PrismaneProps } from "@/types"; +import { PrismaneColors, PrismaneProps } from "@types"; export type MenuItemProps = PrismaneProps< { diff --git a/src/components/Menu/MenuLabel/MenuLabel.tsx b/src/components/Menu/MenuLabel/MenuLabel.tsx index 18f6352a..fdd31051 100644 --- a/src/components/Menu/MenuLabel/MenuLabel.tsx +++ b/src/components/Menu/MenuLabel/MenuLabel.tsx @@ -4,7 +4,7 @@ import Flex, { FlexProps } from "@components/Flex"; // Utils import { strip, fr } from "@/utils"; // Types -import { PrismaneColors, PrismaneProps } from "@/types"; +import { PrismaneColors, PrismaneProps } from "@types"; export type MenuLabelProps = PrismaneProps< { color?: PrismaneColors }, diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index e00efdaa..246fefa2 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -11,7 +11,7 @@ import useKeyboardShortcut from "@hooks/useKeyboardShortcut"; // Context import { ModalContextProvider } from "./ModalContext"; // Types -import { PrismaneProps, PrismaneWithInternal } from "@/types"; +import { PrismaneProps, PrismaneWithInternal } from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/NativeSelectField/NativeSelectField.tsx b/src/components/NativeSelectField/NativeSelectField.tsx index 3707db39..c43a4b62 100644 --- a/src/components/NativeSelectField/NativeSelectField.tsx +++ b/src/components/NativeSelectField/NativeSelectField.tsx @@ -3,7 +3,7 @@ import { forwardRef } from "react"; import Field, { FieldProps, useFieldProps } from "@components/Field"; import Text from "@components/Text"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/NumberField/NumberField.tsx b/src/components/NumberField/NumberField.tsx index 72ec6b17..3666c368 100644 --- a/src/components/NumberField/NumberField.tsx +++ b/src/components/NumberField/NumberField.tsx @@ -7,7 +7,7 @@ import Transition from "@components/Transition"; // Hooks import useEmulatedFieldChange from "@hooks/useEmulatedFieldChange"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/Paper/Paper.tsx b/src/components/Paper/Paper.tsx index 72b9fcb0..df89661b 100644 --- a/src/components/Paper/Paper.tsx +++ b/src/components/Paper/Paper.tsx @@ -7,7 +7,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/PinField/PinField.tsx b/src/components/PinField/PinField.tsx index 5f51c81a..af35ac9b 100644 --- a/src/components/PinField/PinField.tsx +++ b/src/components/PinField/PinField.tsx @@ -6,7 +6,7 @@ import Hidden from "@components/Hidden"; // Hooks import useEmulatedFieldChange from "@hooks/useEmulatedFieldChange"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { fr } from "@/utils"; diff --git a/src/components/Popover/Popover.tsx b/src/components/Popover/Popover.tsx index c9153755..0d427f39 100644 --- a/src/components/Popover/Popover.tsx +++ b/src/components/Popover/Popover.tsx @@ -7,11 +7,7 @@ import { PopoverContextProvider } from "./PopoverContext"; // Hooks import useOutsideClick from "@hooks/useOutsideClick"; // Types -import { - PrismanePositions, - PrismaneProps, - PrismaneWithInternal, -} from "@/types"; +import { PrismanePositions, PrismaneProps, PrismaneWithInternal } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Popover/PopoverContext.ts b/src/components/Popover/PopoverContext.ts index e7e356a5..4f50c21f 100644 --- a/src/components/Popover/PopoverContext.ts +++ b/src/components/Popover/PopoverContext.ts @@ -1,6 +1,6 @@ import { createContext, useContext, Dispatch } from "react"; // Types -import { PrismanePositions } from "@/types"; +import { PrismanePositions } from "@types"; export interface PopoverContextValue { open: boolean; diff --git a/src/components/Portal/Portal.tsx b/src/components/Portal/Portal.tsx index 7e5e4f73..318d063a 100644 --- a/src/components/Portal/Portal.tsx +++ b/src/components/Portal/Portal.tsx @@ -3,7 +3,7 @@ import ReactDOM from "react-dom"; // Components import Box, { BoxProps } from "@components/Box"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/PrismaneProvider/PrismaneContext.ts b/src/components/PrismaneProvider/PrismaneContext.ts index 5dbc1452..8cffa56c 100644 --- a/src/components/PrismaneProvider/PrismaneContext.ts +++ b/src/components/PrismaneProvider/PrismaneContext.ts @@ -2,7 +2,7 @@ import { Dispatch, createContext, useContext } from "react"; // Themes import { base } from "@themes/base"; // Types -import { PrismaneTheme } from "@/types"; +import { PrismaneTheme } from "@types"; export interface PrismaneContextValue { theme: PrismaneTheme; diff --git a/src/components/PrismaneProvider/PrismaneProvider.tsx b/src/components/PrismaneProvider/PrismaneProvider.tsx index d921ed51..dd1e8f8e 100644 --- a/src/components/PrismaneProvider/PrismaneProvider.tsx +++ b/src/components/PrismaneProvider/PrismaneProvider.tsx @@ -7,7 +7,7 @@ import { PrismaneContextProvider } from "./PrismaneContext"; import { base } from "@themes/base"; import { createTheme, applyTheme } from "@themes/theme"; // Types -import { PrismaneInputTheme } from "@/types"; +import { PrismaneInputTheme } from "@types"; // Font import "@fontsource/poppins/100.css"; import "@fontsource/poppins/200.css"; diff --git a/src/components/PrismaneProvider/usePrismaneColor/usePrismaneColor.ts b/src/components/PrismaneProvider/usePrismaneColor/usePrismaneColor.ts index ae20db7b..88576a7c 100644 --- a/src/components/PrismaneProvider/usePrismaneColor/usePrismaneColor.ts +++ b/src/components/PrismaneProvider/usePrismaneColor/usePrismaneColor.ts @@ -9,7 +9,7 @@ import { PRISMANE_SHADES_MAP, } from "@/constants"; // Types -import { PrismaneColors, PrismaneShades, PrismaneTheme } from "@/types"; +import { PrismaneColors, PrismaneShades, PrismaneTheme } from "@types"; // Utils import { parse } from "@/utils"; diff --git a/src/components/Progress/Progress.tsx b/src/components/Progress/Progress.tsx index 7d934dbe..ec1e9209 100644 --- a/src/components/Progress/Progress.tsx +++ b/src/components/Progress/Progress.tsx @@ -9,7 +9,7 @@ import { PrismaneProps, PrismaneColors, PrismaneShades, -} from "@/types"; +} from "@types"; // Utils import { strip, fr, dual } from "@/utils"; diff --git a/src/components/Radio/Radio.tsx b/src/components/Radio/Radio.tsx index 9246087e..bedaa069 100644 --- a/src/components/Radio/Radio.tsx +++ b/src/components/Radio/Radio.tsx @@ -10,7 +10,7 @@ import { useRadioContext } from "./RadioContext"; // Hooks import useId from "@hooks/useId"; // Types -import { PrismaneFieldComponent, PrismaneWithInternal } from "@/types"; +import { PrismaneFieldComponent, PrismaneWithInternal } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Radio/RadioContext.ts b/src/components/Radio/RadioContext.ts index 04be454b..ef727a2b 100644 --- a/src/components/Radio/RadioContext.ts +++ b/src/components/Radio/RadioContext.ts @@ -1,5 +1,5 @@ import { createContext, useContext } from "react"; -import { PrismaneFieldComponent } from "@/types"; +import { PrismaneFieldComponent } from "@types"; export type RadioContextValue = PrismaneFieldComponent; diff --git a/src/components/Radio/RadioGroup/RadioGroup.tsx b/src/components/Radio/RadioGroup/RadioGroup.tsx index 8e564d69..efda89a3 100644 --- a/src/components/Radio/RadioGroup/RadioGroup.tsx +++ b/src/components/Radio/RadioGroup/RadioGroup.tsx @@ -6,7 +6,7 @@ import Flex, { FlexProps } from "@components/Flex"; // Context import { RadioContextProvider } from "../RadioContext"; // Types -import { PrismaneFieldComponent } from "@/types"; +import { PrismaneFieldComponent } from "@types"; // Utils import { strip, fr } from "@/utils"; diff --git a/src/components/SegmentedField/SegmentedField.tsx b/src/components/SegmentedField/SegmentedField.tsx index f7624f3c..d46bdacb 100644 --- a/src/components/SegmentedField/SegmentedField.tsx +++ b/src/components/SegmentedField/SegmentedField.tsx @@ -7,7 +7,7 @@ import Text from "@components/Text"; // Hooks import useEmulatedFieldChange from "@hooks/useEmulatedFieldChange"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { variants, fr } from "@/utils"; diff --git a/src/components/SelectField/SelectField.tsx b/src/components/SelectField/SelectField.tsx index 6ae4daa2..70276e13 100644 --- a/src/components/SelectField/SelectField.tsx +++ b/src/components/SelectField/SelectField.tsx @@ -10,7 +10,7 @@ import useKeyboardShortcut from "@hooks/useKeyboardShortcut"; import useEmulatedFieldChange from "@hooks/useEmulatedFieldChange"; import useOutsideClick from "@hooks/useOutsideClick"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Show/Show.tsx b/src/components/Show/Show.tsx index 7e1bef83..88a6d217 100644 --- a/src/components/Show/Show.tsx +++ b/src/components/Show/Show.tsx @@ -4,7 +4,7 @@ import Box, { BoxProps } from "@components/Box"; // Hooks import useMediaQuery from "@hooks/useMediaQuery/useMediaQuery"; // Types -import { PrismaneBreakpoints, PrismaneProps } from "@/types"; +import { PrismaneBreakpoints, PrismaneProps } from "@types"; // Utils import { strip, dual, fr } from "@/utils"; diff --git a/src/components/Spinner/Spinner.tsx b/src/components/Spinner/Spinner.tsx index 7ee7eefd..2ae562f7 100644 --- a/src/components/Spinner/Spinner.tsx +++ b/src/components/Spinner/Spinner.tsx @@ -4,7 +4,7 @@ import * as CSS from "csstype"; // Components import Icon, { IconProps } from "@components/Icon"; // Types -import { PrismaneProps, PrismaneColors, PrismaneShades } from "@/types"; +import { PrismaneProps, PrismaneColors, PrismaneShades } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Square/Square.tsx b/src/components/Square/Square.tsx index 864d27ba..d52b27a0 100644 --- a/src/components/Square/Square.tsx +++ b/src/components/Square/Square.tsx @@ -8,7 +8,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Switch/Switch.tsx b/src/components/Switch/Switch.tsx index 57f753db..db3d61f1 100644 --- a/src/components/Switch/Switch.tsx +++ b/src/components/Switch/Switch.tsx @@ -6,7 +6,7 @@ import Transition, { TransitionProps } from "@components/Transition"; import Field, { useFieldProps } from "@components/Field"; import Hidden from "@components/Hidden"; // Types -import { PrismaneFieldComponent } from "@/types"; +import { PrismaneFieldComponent } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx index 981dcdff..9eee6dfd 100644 --- a/src/components/Table/Table.tsx +++ b/src/components/Table/Table.tsx @@ -8,7 +8,7 @@ import { PrismaneWithInternal, PrismaneProps, PrismaneBreakpoints, -} from "@/types"; +} from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Table/TableCaption/TableCaption.tsx b/src/components/Table/TableCaption/TableCaption.tsx index a16305b7..61e9f6b3 100644 --- a/src/components/Table/TableCaption/TableCaption.tsx +++ b/src/components/Table/TableCaption/TableCaption.tsx @@ -4,7 +4,7 @@ import Box, { BoxProps } from "@components/Box"; // Context import { useTableContext } from "../TableContext"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, fr, variants } from "@/utils"; diff --git a/src/components/Table/TableContext.ts b/src/components/Table/TableContext.ts index 3ecdfed2..442f183b 100644 --- a/src/components/Table/TableContext.ts +++ b/src/components/Table/TableContext.ts @@ -1,6 +1,6 @@ import { createContext, useContext } from "react"; // Types -import { PrismaneBreakpoints } from "@/types"; +import { PrismaneBreakpoints } from "@types"; export interface TableContextValue { lines?: "vertical" | "horizontal" | "both" | "none"; diff --git a/src/components/Tabs/Tabs.tsx b/src/components/Tabs/Tabs.tsx index d6fd7c39..21757a45 100644 --- a/src/components/Tabs/Tabs.tsx +++ b/src/components/Tabs/Tabs.tsx @@ -4,7 +4,7 @@ import Flex, { FlexProps } from "@components/Flex"; // Context import { TabsContextProvider } from "./TabsContext"; // Types -import { PrismaneProps, PrismaneWithInternal } from "@/types"; +import { PrismaneProps, PrismaneWithInternal } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Tabs/TabsPanel/TabsPanel.tsx b/src/components/Tabs/TabsPanel/TabsPanel.tsx index a881475a..dcf09068 100644 --- a/src/components/Tabs/TabsPanel/TabsPanel.tsx +++ b/src/components/Tabs/TabsPanel/TabsPanel.tsx @@ -4,7 +4,7 @@ import Flex, { FlexProps } from "@components/Flex"; // Context import { useTabsContext } from "../TabsContext"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Tabs/TabsTab/TabsTab.tsx b/src/components/Tabs/TabsTab/TabsTab.tsx index 6b0f1983..e7b59070 100644 --- a/src/components/Tabs/TabsTab/TabsTab.tsx +++ b/src/components/Tabs/TabsTab/TabsTab.tsx @@ -5,7 +5,7 @@ import Transition, { TransitionProps } from "@components/Transition"; // Context import { useTabsContext } from "../TabsContext"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Text/Text.tsx b/src/components/Text/Text.tsx index 39262235..cff4446e 100644 --- a/src/components/Text/Text.tsx +++ b/src/components/Text/Text.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Box, { BoxProps } from "@components/Box"; // Types -import { Versatile, PrismaneVersatile, PrismaneVersatileRef } from "@/types"; +import { Versatile, PrismaneVersatile, PrismaneVersatileRef } from "@types"; import { strip } from "@/utils"; export type TextProps = PrismaneVersatile< diff --git a/src/components/TextField/TextField.tsx b/src/components/TextField/TextField.tsx index 8f242da5..e7c648fb 100644 --- a/src/components/TextField/TextField.tsx +++ b/src/components/TextField/TextField.tsx @@ -2,7 +2,7 @@ import { forwardRef } from "react"; // Components import Field, { FieldProps, useFieldProps } from "@components/Field"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, fr, variants } from "@/utils"; diff --git a/src/components/TextareaField/TextareaField.tsx b/src/components/TextareaField/TextareaField.tsx index f0f74ee6..17afe292 100644 --- a/src/components/TextareaField/TextareaField.tsx +++ b/src/components/TextareaField/TextareaField.tsx @@ -3,7 +3,7 @@ import * as CSS from "csstype"; // Components import Field, { FieldProps, useFieldProps } from "@components/Field"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, fr, variants } from "@/utils"; diff --git a/src/components/Toaster/Toast/Toast.tsx b/src/components/Toaster/Toast/Toast.tsx index ce3ffcd8..3522d773 100644 --- a/src/components/Toaster/Toast/Toast.tsx +++ b/src/components/Toaster/Toast/Toast.tsx @@ -7,7 +7,7 @@ import usePresence from "@hooks/usePresence"; // Context import { useToasterContext } from "../ToasterContext"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/components/Toaster/Toaster.tsx b/src/components/Toaster/Toaster.tsx index c00e6b9a..1a078afb 100644 --- a/src/components/Toaster/Toaster.tsx +++ b/src/components/Toaster/Toaster.tsx @@ -5,7 +5,7 @@ import Flex, { FlexProps } from "@components/Flex"; // Context import { ToasterContextProvider } from "./ToasterContext"; // Types -import { PrismaneProps } from "@/types"; +import { PrismaneProps } from "@types"; // Utils import { strip, fr, variants } from "@/utils"; diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx index 16b5bb47..18c2fb66 100644 --- a/src/components/Tooltip/Tooltip.tsx +++ b/src/components/Tooltip/Tooltip.tsx @@ -13,7 +13,7 @@ import { PrismaneBreakpoints, PrismaneColors, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip, variants, fr } from "@/utils"; diff --git a/src/components/Transition/Transition.tsx b/src/components/Transition/Transition.tsx index ab1fe3de..d411b884 100644 --- a/src/components/Transition/Transition.tsx +++ b/src/components/Transition/Transition.tsx @@ -8,7 +8,7 @@ import { PrismaneVersatile, PrismaneVersatileRef, PrismaneProps, -} from "@/types"; +} from "@types"; // Utils import { strip } from "@/utils"; diff --git a/src/themes/base.ts b/src/themes/base.ts index 7fe38777..2fb011c1 100644 --- a/src/themes/base.ts +++ b/src/themes/base.ts @@ -1,4 +1,4 @@ -import { PrismaneTheme } from "../types"; +import { PrismaneTheme } from "@types"; import { PRISMANE_COLORS } from "../constants"; // Utils import { fr } from "../utils"; diff --git a/src/themes/theme.ts b/src/themes/theme.ts index 888fad1e..6ba4a8af 100644 --- a/src/themes/theme.ts +++ b/src/themes/theme.ts @@ -1,9 +1,5 @@ import { base as defaultTheme } from "./base"; -import { - PrismaneTheme, - PrismaneInputTheme, - PrismaneMappedTheme, -} from "../types"; +import { PrismaneTheme, PrismaneInputTheme, PrismaneMappedTheme } from "@types"; // Utils import { mergeDeep } from "../utils"; diff --git a/src/types/actions.type.ts b/src/types/actions.type.ts new file mode 100644 index 00000000..6daa43c7 --- /dev/null +++ b/src/types/actions.type.ts @@ -0,0 +1 @@ +export type PrismaneActions = "error" | "warning" | "success" | "info"; diff --git a/src/types/animations.type.ts b/src/types/animations.type.ts new file mode 100644 index 00000000..4cbbf824 --- /dev/null +++ b/src/types/animations.type.ts @@ -0,0 +1,18 @@ +export type PrismaneAnimations = + | "fade" + | "scale" + | "scale-y" + | "scale-x" + | "skew-up" + | "skew-down" + | "rotate-left" + | "rotate-right" + | "slide-down" + | "slide-up" + | "slide-left" + | "slide-right" + | "roll" + | "pulse" + | "shake" + | "bounce" + | "flip"; diff --git a/src/types/breakpoints.type.ts b/src/types/breakpoints.type.ts new file mode 100644 index 00000000..71f59bff --- /dev/null +++ b/src/types/breakpoints.type.ts @@ -0,0 +1 @@ +export type PrismaneBreakpoints = "xs" | "sm" | "base" | "md" | "lg"; diff --git a/src/types/colors.type.ts b/src/types/colors.type.ts new file mode 100644 index 00000000..720e38a0 --- /dev/null +++ b/src/types/colors.type.ts @@ -0,0 +1,24 @@ +export type PrismaneDefaultColors = + | "slate" + | "gray" + | "coal" + | "sepia" + | "red" + | "orange" + | "copper" + | "yellow" + | "lime" + | "green" + | "emerald" + | "teal" + | "cyan" + | "diamond" + | "blue" + | "amethyst" + | "violet" + | "purple" + | "magenta" + | "pink" + | "ruby"; + +export type PrismaneColors = "primary" | "base" | PrismaneDefaultColors; diff --git a/src/types.ts b/src/types/default.type.ts similarity index 58% rename from src/types.ts rename to src/types/default.type.ts index 97646ddf..eb15b59d 100644 --- a/src/types.ts +++ b/src/types/default.type.ts @@ -1,89 +1,10 @@ -import React from "react"; import * as CSS from "csstype"; - -import type { CSSProperties } from "@stitches/react"; -import type * as Util from "@stitches/react/types/util"; -import type * as Native from "@stitches/react/types/css"; -import type * as Config from "@stitches/react/types/config"; - -export type Versatile = React.ElementType; - -export type PrismaneVersatileRef = - React.ComponentPropsWithRef["ref"]; - -export type AsProp = { - as?: E | React.ElementType; -}; - -export type PropsToOmit = keyof (AsProp & P); - -export type VersatileProps< - E extends Versatile = "div", - P = Record -> = React.PropsWithChildren

> & - Omit, keyof P>; - -export type PrismaneProps = P & Omit; - -export type PrismaneVersatile< - E extends Versatile = "div", - P = Record -> = VersatileProps>> & { - ref?: PrismaneVersatileRef; -}; - -export type PrismaneVersatileComponent> = ( - props: Props -) => any; - -export type PrismaneWithInternal< - Props, - Internal extends Record -> = React.ForwardRefExoticComponent & { - [K in keyof Internal]: React.ForwardRefExoticComponent; -}; - -type PrismaneField = { - id?: string; - error?: string | null; - label?: string; - size?: PrismaneBreakpoints; - variant?: "outlined" | "filled" | "underlined" | "unstyled"; - addons?: React.ReactNode; - icon?: React.ReactNode; - validating?: boolean; -}; - -export type PrismaneFieldComponent = PrismaneField & - Omit; - -type GlobalStyles = "inherit" | "initial" | "revert" | "revert-layer" | "unset"; - -export type PrismaneStyles = - | T - | GlobalStyles - | [T | GlobalStyles, { [pseudo in string]?: T | GlobalStyles }] - | (( - theme: PrismaneTheme - ) => - | T - | GlobalStyles - | [T | GlobalStyles, { [pseudo in string]?: T | GlobalStyles }]); - -type ValueByPropertyName = - PropertyName extends keyof CSSProperties - ? CSSProperties[PropertyName] - : never; - -type SxProp = { - [K in Util.Prefixed<"@", keyof Config.ConfigType.Media>]?: SxProp; -} & { - [K in keyof CSSProperties]?: PrismaneStyles< - ValueByPropertyName | Native.Globals | Util.Index | undefined - >; -} & { - [K: string]: PrismaneStyles; -}; +// Types +import { PrismaneStyles } from "./styles.type"; +import { PrismaneColors } from "./colors.type"; +import { PrismaneShades } from "./shades.type"; +import { PrismaneBreakpoints } from "./breakpoints.type"; +import { SxProp } from "./sx.type"; export interface PrismaneDefault { w?: PrismaneStyles["width"]>; @@ -236,126 +157,3 @@ export interface PrismaneDefault { bs?: PrismaneStyles; sx?: SxProp; } - -export interface PrismaneComponent extends PrismaneDefault { - onClick?: any; - onHover?: any; - onMouseOver?: any; - onScroll?: any; - onChange?: any; - onFocus?: any; - onBlur?: any; - className?: string; - style?: React.CSSProperties; - children?: React.ReactNode | any; -} - -export type PrismaneMappedTheme = { - [key: string]: string; -}; - -export type PrismaneTheme = { - mode: string; - colors: { - primary: { [x in PrismaneShades]: string }; - base: { [x in PrismaneShades]: string }; - }; - spacing: string; - borderRadius: { - xs: string; - sm: string; - base: string; - md: string; - lg: string; - xl: string; - "2xl": string; - }; - fontFamily: string; -}; - -type DeepPartial = { - [P in keyof T]?: DeepPartial; -}; - -export type PrismaneInputTheme = DeepPartial; - -export type PrismaneTransitions = - | "all" - | "colors" - | "opacity" - | "shadow" - | "transform"; - -export type PrismaneAnimations = - | "fade" - | "scale" - | "scale-y" - | "scale-x" - | "skew-up" - | "skew-down" - | "rotate-left" - | "rotate-right" - | "slide-down" - | "slide-up" - | "slide-left" - | "slide-right" - | "roll" - | "pulse" - | "shake" - | "bounce" - | "flip"; - -export type PrismanePositions = - | "top-start" - | "top" - | "top-end" - | "right-start" - | "right" - | "right-end" - | "bottom-end" - | "bottom" - | "bottom-start" - | "left-end" - | "left" - | "left-start"; - -export type PrismaneBreakpoints = "xs" | "sm" | "base" | "md" | "lg"; - -export type PrismaneShades = - | 50 - | 100 - | 200 - | 300 - | 400 - | 500 - | 600 - | 700 - | 800 - | 900; - -export type PrismaneDefaultColors = - | "slate" - | "gray" - | "coal" - | "sepia" - | "red" - | "orange" - | "copper" - | "yellow" - | "lime" - | "green" - | "emerald" - | "teal" - | "cyan" - | "diamond" - | "blue" - | "amethyst" - | "violet" - | "purple" - | "magenta" - | "pink" - | "ruby"; - -export type PrismaneColors = "primary" | "base" | PrismaneDefaultColors; - -export type PrismaneActions = "error" | "warning" | "success" | "info"; diff --git a/src/types/field.type.ts b/src/types/field.type.ts new file mode 100644 index 00000000..270fa8dd --- /dev/null +++ b/src/types/field.type.ts @@ -0,0 +1,16 @@ +// Type +import { PrismaneBreakpoints } from "./breakpoints.type"; + +type PrismaneField = { + id?: string; + error?: string | null; + label?: string; + size?: PrismaneBreakpoints; + variant?: "outlined" | "filled" | "underlined" | "unstyled"; + addons?: React.ReactNode; + icon?: React.ReactNode; + validating?: boolean; +}; + +export type PrismaneFieldComponent = PrismaneField & + Omit; diff --git a/src/types/global.type.ts b/src/types/global.type.ts new file mode 100644 index 00000000..b7bc142e --- /dev/null +++ b/src/types/global.type.ts @@ -0,0 +1,6 @@ +export type GlobalStyles = + | "inherit" + | "initial" + | "revert" + | "revert-layer" + | "unset"; diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 00000000..771d93b3 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,16 @@ +export type * from "./actions.type"; +export type * from "./animations.type"; +export type * from "./breakpoints.type"; +export type * from "./colors.type"; +export type * from "./default.type"; +export type * from "./field.type"; +export type * from "./global.type"; +export type * from "./internal.type"; +export type * from "./positions.type"; +export type * from "./props.type"; +export type * from "./shades.type"; +export type * from "./styles.type"; +export type * from "./sx.type"; +export type * from "./theme.type"; +export type * from "./transitions.type"; +export type * from "./versatile.type"; diff --git a/src/types/internal.type.ts b/src/types/internal.type.ts new file mode 100644 index 00000000..fdd106de --- /dev/null +++ b/src/types/internal.type.ts @@ -0,0 +1,6 @@ +export type PrismaneWithInternal< + Props, + Internal extends Record +> = React.ForwardRefExoticComponent & { + [K in keyof Internal]: React.ForwardRefExoticComponent; +}; diff --git a/src/types/positions.type.ts b/src/types/positions.type.ts new file mode 100644 index 00000000..e8091d40 --- /dev/null +++ b/src/types/positions.type.ts @@ -0,0 +1,13 @@ +export type PrismanePositions = + | "top-start" + | "top" + | "top-end" + | "right-start" + | "right" + | "right-end" + | "bottom-end" + | "bottom" + | "bottom-start" + | "left-end" + | "left" + | "left-start"; diff --git a/src/types/props.type.ts b/src/types/props.type.ts new file mode 100644 index 00000000..d636f8d5 --- /dev/null +++ b/src/types/props.type.ts @@ -0,0 +1 @@ +export type PrismaneProps = P & Omit; diff --git a/src/types/shades.type.ts b/src/types/shades.type.ts new file mode 100644 index 00000000..6ed373ba --- /dev/null +++ b/src/types/shades.type.ts @@ -0,0 +1,11 @@ +export type PrismaneShades = + | 50 + | 100 + | 200 + | 300 + | 400 + | 500 + | 600 + | 700 + | 800 + | 900; diff --git a/src/types/styles.type.ts b/src/types/styles.type.ts new file mode 100644 index 00000000..645e0f05 --- /dev/null +++ b/src/types/styles.type.ts @@ -0,0 +1,14 @@ +// Types +import { GlobalStyles } from "./global.type"; +import { PrismaneTheme } from "./theme.type"; + +export type PrismaneStyles = + | T + | GlobalStyles + | [T | GlobalStyles, { [pseudo in string]?: T | GlobalStyles }] + | (( + theme: PrismaneTheme + ) => + | T + | GlobalStyles + | [T | GlobalStyles, { [pseudo in string]?: T | GlobalStyles }]); diff --git a/src/types/sx.type.ts b/src/types/sx.type.ts new file mode 100644 index 00000000..20492ee4 --- /dev/null +++ b/src/types/sx.type.ts @@ -0,0 +1,21 @@ +import type { CSSProperties } from "@stitches/react"; +import type * as Util from "@stitches/react/types/util"; +import type * as Native from "@stitches/react/types/css"; +import type * as Config from "@stitches/react/types/config"; +// Types +import { PrismaneStyles } from "./styles.type"; + +type ValueByPropertyName = + PropertyName extends keyof CSSProperties + ? CSSProperties[PropertyName] + : never; + +export type SxProp = { + [K in Util.Prefixed<"@", keyof Config.ConfigType.Media>]?: SxProp; +} & { + [K in keyof CSSProperties]?: PrismaneStyles< + ValueByPropertyName | Native.Globals | Util.Index | undefined + >; +} & { + [K: string]: PrismaneStyles; +}; diff --git a/src/types/theme.type.ts b/src/types/theme.type.ts new file mode 100644 index 00000000..719d83a1 --- /dev/null +++ b/src/types/theme.type.ts @@ -0,0 +1,31 @@ +// Types +import { PrismaneShades } from "./shades.type"; + +type DeepPartial = { + [P in keyof T]?: DeepPartial; +}; + +export type PrismaneMappedTheme = { + [key: string]: string; +}; + +export type PrismaneTheme = { + mode: string; + colors: { + primary: { [x in PrismaneShades]: string }; + base: { [x in PrismaneShades]: string }; + }; + spacing: string; + borderRadius: { + xs: string; + sm: string; + base: string; + md: string; + lg: string; + xl: string; + "2xl": string; + }; + fontFamily: string; +}; + +export type PrismaneInputTheme = DeepPartial; diff --git a/src/types/transitions.type.ts b/src/types/transitions.type.ts new file mode 100644 index 00000000..794223ad --- /dev/null +++ b/src/types/transitions.type.ts @@ -0,0 +1,6 @@ +export type PrismaneTransitions = + | "all" + | "colors" + | "opacity" + | "shadow" + | "transform"; diff --git a/src/types/versatile.type.ts b/src/types/versatile.type.ts new file mode 100644 index 00000000..6f8c5380 --- /dev/null +++ b/src/types/versatile.type.ts @@ -0,0 +1,25 @@ +export type Versatile = React.ElementType; + +export type PrismaneVersatileRef = + React.ComponentPropsWithRef["ref"]; + +export type AsProp = { + as?: E | React.ElementType; +}; + +export type VersatileProps< + E extends Versatile = "div", + P = Record +> = React.PropsWithChildren

> & + Omit, keyof P>; + +export type PrismaneVersatile< + E extends Versatile = "div", + P = Record +> = VersatileProps>> & { + ref?: PrismaneVersatileRef; +}; + +export type PrismaneVersatileComponent> = ( + props: Props +) => any; diff --git a/tsconfig.json b/tsconfig.json index dd14081e..2e16f275 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,8 @@ "@components/*": ["src/components/*"], "@hooks/*": ["src/hooks/*"], "@themes/*": ["src/themes/*"], - "@validators/*": ["src/validators/*"] + "@validators/*": ["src/validators/*"], + "@types": ["src/types/index"] } }, "include": ["src", "./custom.d.ts"], diff --git a/vite.config.js b/vite.config.js index f0a550ee..6d7e989e 100644 --- a/vite.config.js +++ b/vite.config.js @@ -71,6 +71,7 @@ export default defineConfig({ "@hooks": resolve(__dirname, "./src/hooks"), "@themes": resolve(__dirname, "./src/themes"), "@validators": resolve(__dirname, "./src/validators"), + "@types": resolve(__dirname, "./src/types"), }, }, }); diff --git a/vitest.config.ts b/vitest.config.ts index 92808e7a..0a91e35a 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -14,6 +14,7 @@ export default defineConfig({ "@hooks": resolve(__dirname, "./src/hooks"), "@themes": resolve(__dirname, "./src/themes"), "@validators": resolve(__dirname, "./src/validators"), + "@types": resolve(__dirname, "./src/types"), }, }, });