react-native-mantine 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -0
- package/lib/commonjs/components/ActionIcon/ActionIcon.js +1 -1
- package/lib/commonjs/components/ActionIcon/ActionIcon.js.map +1 -1
- package/lib/commonjs/components/Anchor/index.js +3 -4
- package/lib/commonjs/components/Anchor/index.js.map +1 -1
- package/lib/commonjs/components/Avatar/index.js +1 -2
- package/lib/commonjs/components/Avatar/index.js.map +1 -1
- package/lib/commonjs/components/Badge/index.js +54 -24
- package/lib/commonjs/components/Badge/index.js.map +1 -1
- package/lib/commonjs/components/Blockquote/index.js +4 -5
- package/lib/commonjs/components/Blockquote/index.js.map +1 -1
- package/lib/commonjs/components/Button/index.js +7 -1
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Center/index.js.map +1 -1
- package/lib/commonjs/components/Checkbox/index.js +4 -5
- package/lib/commonjs/components/Checkbox/index.js.map +1 -1
- package/lib/commonjs/components/Chip/index.js +40 -21
- package/lib/commonjs/components/Chip/index.js.map +1 -1
- package/lib/commonjs/components/Code/index.js +6 -4
- package/lib/commonjs/components/Code/index.js.map +1 -1
- package/lib/commonjs/components/Grid/index.js +18 -13
- package/lib/commonjs/components/Grid/index.js.map +1 -1
- package/lib/commonjs/components/Highlight/index.js +1 -1
- package/lib/commonjs/components/Highlight/index.js.map +1 -1
- package/lib/commonjs/components/Indicator/index.js +2 -3
- package/lib/commonjs/components/Indicator/index.js.map +1 -1
- package/lib/commonjs/components/LinearGradient/PlatformLinearGradient.js +9 -9
- package/lib/commonjs/components/LinearGradient/PlatformLinearGradient.js.map +1 -1
- package/lib/commonjs/components/Menu/index.js +4 -5
- package/lib/commonjs/components/Menu/index.js.map +1 -1
- package/lib/commonjs/components/MultiSelect/index.js +8 -9
- package/lib/commonjs/components/MultiSelect/index.js.map +1 -1
- package/lib/commonjs/components/NativeSelect/index.js +14 -14
- package/lib/commonjs/components/NativeSelect/index.js.map +1 -1
- package/lib/commonjs/components/NavLink/index.js +43 -20
- package/lib/commonjs/components/NavLink/index.js.map +1 -1
- package/lib/commonjs/components/Notification/index.js +5 -6
- package/lib/commonjs/components/Notification/index.js.map +1 -1
- package/lib/commonjs/components/Pagination/index.js +5 -6
- package/lib/commonjs/components/Pagination/index.js.map +1 -1
- package/lib/commonjs/components/PinInput/index.js +3 -3
- package/lib/commonjs/components/PinInput/index.js.map +1 -1
- package/lib/commonjs/components/Progress/index.js +3 -5
- package/lib/commonjs/components/Progress/index.js.map +1 -1
- package/lib/commonjs/components/Radio/index.js +4 -5
- package/lib/commonjs/components/Radio/index.js.map +1 -1
- package/lib/commonjs/components/Rating/index.js +2 -4
- package/lib/commonjs/components/Rating/index.js.map +1 -1
- package/lib/commonjs/components/RingProgress/index.js +3 -4
- package/lib/commonjs/components/RingProgress/index.js.map +1 -1
- package/lib/commonjs/components/Select/index.js +7 -8
- package/lib/commonjs/components/Select/index.js.map +1 -1
- package/lib/commonjs/components/SimpleGrid/index.js +4 -2
- package/lib/commonjs/components/SimpleGrid/index.js.map +1 -1
- package/lib/commonjs/components/Spoiler/index.js +1 -1
- package/lib/commonjs/components/Spoiler/index.js.map +1 -1
- package/lib/commonjs/components/Stepper/index.js +8 -6
- package/lib/commonjs/components/Stepper/index.js.map +1 -1
- package/lib/commonjs/components/Switch/index.js +4 -5
- package/lib/commonjs/components/Switch/index.js.map +1 -1
- package/lib/commonjs/components/Text/index.js +78 -17
- package/lib/commonjs/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/ThemeIcon/index.js +40 -19
- package/lib/commonjs/components/ThemeIcon/index.js.map +1 -1
- package/lib/commonjs/components/Timeline/index.js +6 -5
- package/lib/commonjs/components/Timeline/index.js.map +1 -1
- package/lib/commonjs/components/Title/index.js +5 -17
- package/lib/commonjs/components/Title/index.js.map +1 -1
- package/lib/commonjs/components/Tooltip/index.js +1 -2
- package/lib/commonjs/components/Tooltip/index.js.map +1 -1
- package/lib/commonjs/components/TransferList/index.js +9 -10
- package/lib/commonjs/components/TransferList/index.js.map +1 -1
- package/lib/commonjs/components/UnstyledButton/UnstyledButton.styles.js +2 -2
- package/lib/commonjs/components/UnstyledButton/UnstyledButton.styles.js.map +1 -1
- package/lib/commonjs/components/index.js +35 -46
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +34 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theme/create-theme.js +114 -25
- package/lib/commonjs/theme/create-theme.js.map +1 -1
- package/lib/commonjs/theme/default-colors.js +103 -0
- package/lib/commonjs/theme/default-colors.js.map +1 -0
- package/lib/commonjs/theme/default-theme.js +144 -128
- package/lib/commonjs/theme/default-theme.js.map +1 -1
- package/lib/commonjs/theme/functions/attach-functions.js +46 -14
- package/lib/commonjs/theme/functions/attach-functions.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/breakpoints.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/color-scheme-value.js +190 -0
- package/lib/commonjs/theme/functions/fns/color-scheme-value.js.map +1 -0
- package/lib/commonjs/theme/functions/fns/dimmed.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/gradient/gradient.js +3 -3
- package/lib/commonjs/theme/functions/fns/gradient/gradient.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/helpers.js +51 -3
- package/lib/commonjs/theme/functions/fns/helpers.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/index.js +151 -6
- package/lib/commonjs/theme/functions/fns/index.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/primary-shade.js +81 -2
- package/lib/commonjs/theme/functions/fns/primary-shade.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/shadow.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/size.js +2 -1
- package/lib/commonjs/theme/functions/fns/size.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/theme-color/color-utils.js +196 -0
- package/lib/commonjs/theme/functions/fns/theme-color/color-utils.js.map +1 -0
- package/lib/commonjs/theme/functions/fns/theme-color/theme-color.js +92 -9
- package/lib/commonjs/theme/functions/fns/theme-color/theme-color.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/variant.js +112 -17
- package/lib/commonjs/theme/functions/fns/variant.js.map +1 -1
- package/lib/commonjs/theme/functions/index.js +172 -0
- package/lib/commonjs/theme/functions/index.js.map +1 -0
- package/lib/commonjs/theme/index.js +116 -14
- package/lib/commonjs/theme/index.js.map +1 -1
- package/lib/commonjs/theme/theme-provider.js +1 -22
- package/lib/commonjs/theme/theme-provider.js.map +1 -1
- package/lib/commonjs/theme/types.js +6 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/theme/utils/withTextWrapper.js +1 -2
- package/lib/commonjs/theme/utils/withTextWrapper.js.map +1 -1
- package/lib/module/components/ActionIcon/ActionIcon.js +1 -1
- package/lib/module/components/ActionIcon/ActionIcon.js.map +1 -1
- package/lib/module/components/Anchor/index.js +3 -4
- package/lib/module/components/Anchor/index.js.map +1 -1
- package/lib/module/components/Avatar/index.js +1 -2
- package/lib/module/components/Avatar/index.js.map +1 -1
- package/lib/module/components/Badge/index.js +54 -24
- package/lib/module/components/Badge/index.js.map +1 -1
- package/lib/module/components/Blockquote/index.js +4 -5
- package/lib/module/components/Blockquote/index.js.map +1 -1
- package/lib/module/components/Button/index.js +7 -1
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Center/index.js.map +1 -1
- package/lib/module/components/Checkbox/index.js +4 -5
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/Chip/index.js +40 -21
- package/lib/module/components/Chip/index.js.map +1 -1
- package/lib/module/components/Code/index.js +6 -4
- package/lib/module/components/Code/index.js.map +1 -1
- package/lib/module/components/Grid/index.js +18 -13
- package/lib/module/components/Grid/index.js.map +1 -1
- package/lib/module/components/Highlight/index.js +1 -1
- package/lib/module/components/Highlight/index.js.map +1 -1
- package/lib/module/components/Indicator/index.js +2 -3
- package/lib/module/components/Indicator/index.js.map +1 -1
- package/lib/module/components/LinearGradient/PlatformLinearGradient.js +9 -9
- package/lib/module/components/LinearGradient/PlatformLinearGradient.js.map +1 -1
- package/lib/module/components/Menu/index.js +4 -5
- package/lib/module/components/Menu/index.js.map +1 -1
- package/lib/module/components/MultiSelect/index.js +8 -9
- package/lib/module/components/MultiSelect/index.js.map +1 -1
- package/lib/module/components/NativeSelect/index.js +14 -14
- package/lib/module/components/NativeSelect/index.js.map +1 -1
- package/lib/module/components/NavLink/index.js +43 -20
- package/lib/module/components/NavLink/index.js.map +1 -1
- package/lib/module/components/Notification/index.js +5 -6
- package/lib/module/components/Notification/index.js.map +1 -1
- package/lib/module/components/Pagination/index.js +5 -6
- package/lib/module/components/Pagination/index.js.map +1 -1
- package/lib/module/components/PinInput/index.js +3 -3
- package/lib/module/components/PinInput/index.js.map +1 -1
- package/lib/module/components/Progress/index.js +3 -5
- package/lib/module/components/Progress/index.js.map +1 -1
- package/lib/module/components/Radio/index.js +4 -5
- package/lib/module/components/Radio/index.js.map +1 -1
- package/lib/module/components/Rating/index.js +2 -4
- package/lib/module/components/Rating/index.js.map +1 -1
- package/lib/module/components/RingProgress/index.js +3 -4
- package/lib/module/components/RingProgress/index.js.map +1 -1
- package/lib/module/components/Select/index.js +7 -8
- package/lib/module/components/Select/index.js.map +1 -1
- package/lib/module/components/SimpleGrid/index.js +4 -2
- package/lib/module/components/SimpleGrid/index.js.map +1 -1
- package/lib/module/components/Spoiler/index.js +1 -1
- package/lib/module/components/Spoiler/index.js.map +1 -1
- package/lib/module/components/Stepper/index.js +8 -6
- package/lib/module/components/Stepper/index.js.map +1 -1
- package/lib/module/components/Switch/index.js +4 -5
- package/lib/module/components/Switch/index.js.map +1 -1
- package/lib/module/components/Text/index.js +78 -17
- package/lib/module/components/Text/index.js.map +1 -1
- package/lib/module/components/ThemeIcon/index.js +40 -19
- package/lib/module/components/ThemeIcon/index.js.map +1 -1
- package/lib/module/components/Timeline/index.js +6 -5
- package/lib/module/components/Timeline/index.js.map +1 -1
- package/lib/module/components/Title/index.js +5 -17
- package/lib/module/components/Title/index.js.map +1 -1
- package/lib/module/components/Tooltip/index.js +1 -2
- package/lib/module/components/Tooltip/index.js.map +1 -1
- package/lib/module/components/TransferList/index.js +9 -10
- package/lib/module/components/TransferList/index.js.map +1 -1
- package/lib/module/components/UnstyledButton/UnstyledButton.styles.js +2 -2
- package/lib/module/components/UnstyledButton/UnstyledButton.styles.js.map +1 -1
- package/lib/module/components/index.js +0 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/theme/create-theme.js +114 -24
- package/lib/module/theme/create-theme.js.map +1 -1
- package/lib/module/theme/default-colors.js +99 -0
- package/lib/module/theme/default-colors.js.map +1 -0
- package/lib/module/theme/default-theme.js +143 -127
- package/lib/module/theme/default-theme.js.map +1 -1
- package/lib/module/theme/functions/attach-functions.js +47 -14
- package/lib/module/theme/functions/attach-functions.js.map +1 -1
- package/lib/module/theme/functions/fns/breakpoints.js.map +1 -1
- package/lib/module/theme/functions/fns/color-scheme-value.js +180 -0
- package/lib/module/theme/functions/fns/color-scheme-value.js.map +1 -0
- package/lib/module/theme/functions/fns/dimmed.js.map +1 -1
- package/lib/module/theme/functions/fns/gradient/gradient.js +2 -2
- package/lib/module/theme/functions/fns/gradient/gradient.js.map +1 -1
- package/lib/module/theme/functions/fns/helpers.js +48 -2
- package/lib/module/theme/functions/fns/helpers.js.map +1 -1
- package/lib/module/theme/functions/fns/index.js +35 -7
- package/lib/module/theme/functions/fns/index.js.map +1 -1
- package/lib/module/theme/functions/fns/primary-shade.js +78 -2
- package/lib/module/theme/functions/fns/primary-shade.js.map +1 -1
- package/lib/module/theme/functions/fns/shadow.js.map +1 -1
- package/lib/module/theme/functions/fns/size.js +2 -1
- package/lib/module/theme/functions/fns/size.js.map +1 -1
- package/lib/module/theme/functions/fns/theme-color/color-utils.js +189 -0
- package/lib/module/theme/functions/fns/theme-color/color-utils.js.map +1 -0
- package/lib/module/theme/functions/fns/theme-color/theme-color.js +91 -9
- package/lib/module/theme/functions/fns/theme-color/theme-color.js.map +1 -1
- package/lib/module/theme/functions/fns/variant.js +112 -17
- package/lib/module/theme/functions/fns/variant.js.map +1 -1
- package/lib/module/theme/functions/index.js +22 -0
- package/lib/module/theme/functions/index.js.map +1 -0
- package/lib/module/theme/index.js +16 -4
- package/lib/module/theme/index.js.map +1 -1
- package/lib/module/theme/theme-provider.js +1 -22
- package/lib/module/theme/theme-provider.js.map +1 -1
- package/lib/module/theme/types.js +4 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/utils/withTextWrapper.js +1 -2
- package/lib/module/theme/utils/withTextWrapper.js.map +1 -1
- package/lib/typescript/commonjs/src/components/Anchor/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Avatar/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Badge/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Blockquote/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Button/Button.styles.d.ts +8 -8
- package/lib/typescript/commonjs/src/components/Button/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Center/index.d.ts +1 -2
- package/lib/typescript/commonjs/src/components/Center/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Checkbox/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Chip/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Code/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ColorSwatch/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/ColorSwatch/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Container/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/Container/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Flex/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/Flex/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Grid/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Highlight/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Indicator/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/LinearGradient/PlatformLinearGradient.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/Mark/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/Mark/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MultiSelect/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/NativeSelect/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/NavLink/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Notification/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Pagination/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/PinInput/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Progress/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Radio/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Rating/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RingProgress/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/SimpleGrid/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Space/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/Space/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Switch/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Text/index.d.ts +54 -7
- package/lib/typescript/commonjs/src/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ThemeIcon/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Timeline/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Title/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/components/Title/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Tooltip/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/TransferList/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UnstyledButton/UnstyledButton.styles.d.ts +2 -2
- package/lib/typescript/commonjs/src/components/UnstyledButton/UnstyledButton.styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/index.d.ts +0 -1
- package/lib/typescript/commonjs/src/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/create-styles.d.ts +1 -1
- package/lib/typescript/commonjs/src/theme/create-styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/create-theme.d.ts +68 -2
- package/lib/typescript/commonjs/src/theme/create-theme.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/default-colors.d.ts +12 -0
- package/lib/typescript/commonjs/src/theme/default-colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/default-theme.d.ts +15 -108
- package/lib/typescript/commonjs/src/theme/default-theme.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/attach-functions.d.ts +20 -1
- package/lib/typescript/commonjs/src/theme/functions/attach-functions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/breakpoints.d.ts +3 -3
- package/lib/typescript/commonjs/src/theme/functions/fns/breakpoints.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/color-scheme-value.d.ts +100 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/color-scheme-value.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/dimmed.d.ts +2 -2
- package/lib/typescript/commonjs/src/theme/functions/fns/dimmed.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/gradient/gradient.d.ts +4 -5
- package/lib/typescript/commonjs/src/theme/functions/fns/gradient/gradient.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/helpers.d.ts +36 -8
- package/lib/typescript/commonjs/src/theme/functions/fns/helpers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/index.d.ts +40 -14
- package/lib/typescript/commonjs/src/theme/functions/fns/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/primary-shade.d.ts +53 -3
- package/lib/typescript/commonjs/src/theme/functions/fns/primary-shade.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/shadow.d.ts +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/shadow.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/size.d.ts +2 -2
- package/lib/typescript/commonjs/src/theme/functions/fns/size.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/theme-color/color-utils.d.ts +50 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/theme-color/color-utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/theme-color/theme-color.d.ts +51 -5
- package/lib/typescript/commonjs/src/theme/functions/fns/theme-color/theme-color.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/variant.d.ts +52 -19
- package/lib/typescript/commonjs/src/theme/functions/fns/variant.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/index.d.ts +19 -0
- package/lib/typescript/commonjs/src/theme/functions/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/index.d.ts +9 -6
- package/lib/typescript/commonjs/src/theme/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/theme-provider.d.ts +1 -1
- package/lib/typescript/commonjs/src/theme/theme-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/types/DefaultProps.d.ts +2 -2
- package/lib/typescript/commonjs/src/theme/types/DefaultProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/types.d.ts +494 -0
- package/lib/typescript/commonjs/src/theme/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/utils/withTextWrapper.d.ts +1 -1
- package/lib/typescript/commonjs/src/theme/utils/withTextWrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Anchor/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Avatar/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Badge/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Blockquote/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Button/Button.styles.d.ts +8 -8
- package/lib/typescript/module/src/components/Button/index.d.ts +1 -1
- package/lib/typescript/module/src/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Center/index.d.ts +1 -2
- package/lib/typescript/module/src/components/Center/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Checkbox/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Chip/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Code/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ColorSwatch/index.d.ts +1 -1
- package/lib/typescript/module/src/components/ColorSwatch/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Container/index.d.ts +2 -2
- package/lib/typescript/module/src/components/Container/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Flex/index.d.ts +2 -2
- package/lib/typescript/module/src/components/Flex/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Grid/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Highlight/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Indicator/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/LinearGradient/PlatformLinearGradient.d.ts +1 -1
- package/lib/typescript/module/src/components/Mark/index.d.ts +1 -1
- package/lib/typescript/module/src/components/Mark/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MultiSelect/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/NativeSelect/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/NavLink/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Notification/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Pagination/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/PinInput/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Progress/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Radio/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Rating/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RingProgress/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/SimpleGrid/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Space/index.d.ts +2 -2
- package/lib/typescript/module/src/components/Space/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Switch/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Text/index.d.ts +54 -7
- package/lib/typescript/module/src/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ThemeIcon/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Timeline/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Title/index.d.ts +1 -0
- package/lib/typescript/module/src/components/Title/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Tooltip/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/TransferList/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UnstyledButton/UnstyledButton.styles.d.ts +2 -2
- package/lib/typescript/module/src/components/UnstyledButton/UnstyledButton.styles.d.ts.map +1 -1
- package/lib/typescript/module/src/components/index.d.ts +0 -1
- package/lib/typescript/module/src/components/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/create-styles.d.ts +1 -1
- package/lib/typescript/module/src/theme/create-styles.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/create-theme.d.ts +68 -2
- package/lib/typescript/module/src/theme/create-theme.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/default-colors.d.ts +12 -0
- package/lib/typescript/module/src/theme/default-colors.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/default-theme.d.ts +15 -108
- package/lib/typescript/module/src/theme/default-theme.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/attach-functions.d.ts +20 -1
- package/lib/typescript/module/src/theme/functions/attach-functions.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/breakpoints.d.ts +3 -3
- package/lib/typescript/module/src/theme/functions/fns/breakpoints.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/color-scheme-value.d.ts +100 -0
- package/lib/typescript/module/src/theme/functions/fns/color-scheme-value.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/functions/fns/dimmed.d.ts +2 -2
- package/lib/typescript/module/src/theme/functions/fns/dimmed.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/gradient/gradient.d.ts +4 -5
- package/lib/typescript/module/src/theme/functions/fns/gradient/gradient.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/helpers.d.ts +36 -8
- package/lib/typescript/module/src/theme/functions/fns/helpers.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/index.d.ts +40 -14
- package/lib/typescript/module/src/theme/functions/fns/index.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/primary-shade.d.ts +53 -3
- package/lib/typescript/module/src/theme/functions/fns/primary-shade.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/shadow.d.ts +1 -1
- package/lib/typescript/module/src/theme/functions/fns/shadow.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/size.d.ts +2 -2
- package/lib/typescript/module/src/theme/functions/fns/size.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/theme-color/color-utils.d.ts +50 -0
- package/lib/typescript/module/src/theme/functions/fns/theme-color/color-utils.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/functions/fns/theme-color/theme-color.d.ts +51 -5
- package/lib/typescript/module/src/theme/functions/fns/theme-color/theme-color.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/variant.d.ts +52 -19
- package/lib/typescript/module/src/theme/functions/fns/variant.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/index.d.ts +19 -0
- package/lib/typescript/module/src/theme/functions/index.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/index.d.ts +9 -6
- package/lib/typescript/module/src/theme/index.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/theme-provider.d.ts +1 -1
- package/lib/typescript/module/src/theme/theme-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/types/DefaultProps.d.ts +2 -2
- package/lib/typescript/module/src/theme/types/DefaultProps.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/types.d.ts +494 -0
- package/lib/typescript/module/src/theme/types.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/utils/withTextWrapper.d.ts +1 -1
- package/lib/typescript/module/src/theme/utils/withTextWrapper.d.ts.map +1 -1
- package/package.json +2 -4
- package/src/components/ActionIcon/ActionIcon.tsx +3 -3
- package/src/components/Anchor/index.tsx +3 -4
- package/src/components/Avatar/index.tsx +1 -2
- package/src/components/Badge/index.tsx +36 -19
- package/src/components/Blockquote/index.tsx +4 -6
- package/src/components/Button/index.tsx +6 -2
- package/src/components/Center/index.tsx +1 -2
- package/src/components/Checkbox/index.tsx +4 -5
- package/src/components/Chip/index.tsx +25 -18
- package/src/components/Code/index.tsx +7 -5
- package/src/components/ColorSwatch/index.tsx +1 -1
- package/src/components/Container/index.tsx +2 -2
- package/src/components/Flex/index.tsx +2 -2
- package/src/components/Grid/index.tsx +16 -10
- package/src/components/Highlight/index.tsx +1 -2
- package/src/components/Indicator/index.tsx +3 -4
- package/src/components/LinearGradient/PlatformLinearGradient.tsx +9 -9
- package/src/components/Mark/index.tsx +1 -1
- package/src/components/Menu/index.tsx +8 -10
- package/src/components/MultiSelect/index.tsx +13 -15
- package/src/components/NativeSelect/index.tsx +34 -21
- package/src/components/NavLink/index.tsx +27 -23
- package/src/components/Notification/index.tsx +5 -6
- package/src/components/Pagination/index.tsx +5 -6
- package/src/components/PinInput/index.tsx +5 -6
- package/src/components/Progress/index.tsx +5 -6
- package/src/components/Radio/index.tsx +4 -5
- package/src/components/Rating/index.tsx +2 -4
- package/src/components/RingProgress/index.tsx +3 -5
- package/src/components/Select/index.tsx +11 -13
- package/src/components/SimpleGrid/index.tsx +5 -2
- package/src/components/Space/index.tsx +2 -2
- package/src/components/Spoiler/index.tsx +1 -1
- package/src/components/Stepper/index.tsx +17 -17
- package/src/components/Switch/index.tsx +5 -6
- package/src/components/Text/index.tsx +125 -28
- package/src/components/ThemeIcon/index.tsx +23 -23
- package/src/components/Timeline/index.tsx +12 -15
- package/src/components/Title/index.tsx +5 -22
- package/src/components/Tooltip/index.tsx +1 -3
- package/src/components/TransferList/index.tsx +16 -18
- package/src/components/UnstyledButton/UnstyledButton.styles.ts +4 -2
- package/src/components/index.tsx +0 -1
- package/src/index.tsx +1 -1
- package/src/theme/create-styles.ts +1 -1
- package/src/theme/create-theme.ts +134 -23
- package/src/theme/default-colors.ts +252 -0
- package/src/theme/default-theme.ts +178 -392
- package/src/theme/functions/attach-functions.ts +57 -10
- package/src/theme/functions/fns/breakpoints.ts +4 -4
- package/src/theme/functions/fns/color-scheme-value.ts +200 -0
- package/src/theme/functions/fns/dimmed.ts +2 -2
- package/src/theme/functions/fns/gradient/gradient.ts +4 -5
- package/src/theme/functions/fns/helpers.ts +50 -9
- package/src/theme/functions/fns/index.ts +63 -3
- package/src/theme/functions/fns/primary-shade.ts +84 -8
- package/src/theme/functions/fns/shadow.ts +1 -1
- package/src/theme/functions/fns/size.ts +4 -3
- package/src/theme/functions/fns/theme-color/color-utils.ts +193 -0
- package/src/theme/functions/fns/theme-color/theme-color.ts +85 -17
- package/src/theme/functions/fns/variant.ts +106 -44
- package/src/theme/functions/index.ts +19 -0
- package/src/theme/index.ts +91 -0
- package/src/theme/theme-provider.tsx +2 -17
- package/src/theme/types/DefaultProps.ts +3 -3
- package/src/theme/types.ts +625 -0
- package/src/theme/utils/withTextWrapper.tsx +2 -3
- package/lib/commonjs/components/Slider/index.js +0 -300
- package/lib/commonjs/components/Slider/index.js.map +0 -1
- package/lib/module/components/Slider/index.js +0 -295
- package/lib/module/components/Slider/index.js.map +0 -1
- package/lib/typescript/commonjs/src/components/Slider/index.d.ts +0 -43
- package/lib/typescript/commonjs/src/components/Slider/index.d.ts.map +0 -1
- package/lib/typescript/module/src/components/Slider/index.d.ts +0 -43
- package/lib/typescript/module/src/components/Slider/index.d.ts.map +0 -1
- package/src/components/Slider/index.tsx +0 -349
- package/src/theme/index.tsx +0 -9
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color utility functions for custom color support
|
|
3
|
+
* Handles detection and manipulation of custom hex/rgb/rgba colors
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Check if a color string is a custom color value (not a palette key)
|
|
8
|
+
*
|
|
9
|
+
* Custom colors include:
|
|
10
|
+
* - Hex colors: #fff, #ffffff
|
|
11
|
+
* - RGB colors: rgb(255, 255, 255)
|
|
12
|
+
* - RGBA colors: rgba(255, 255, 255, 0.5)
|
|
13
|
+
* - HSL colors: hsl(0, 100%, 50%)
|
|
14
|
+
* - HSLA colors: hsla(0, 100%, 50%, 0.5)
|
|
15
|
+
* - CSS named colors like 'transparent', 'currentColor'
|
|
16
|
+
*
|
|
17
|
+
* @param color - Color string to check
|
|
18
|
+
* @returns true if color is a custom value, false if it might be a palette key
|
|
19
|
+
*/
|
|
20
|
+
export function isCustomColor(color: string): boolean {
|
|
21
|
+
if (!color || typeof color !== 'string') {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Check for hex colors
|
|
26
|
+
if (color.startsWith('#')) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Check for rgb/rgba colors
|
|
31
|
+
if (color.startsWith('rgb')) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Check for hsl/hsla colors
|
|
36
|
+
if (color.startsWith('hsl')) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Check for CSS keywords
|
|
41
|
+
if (color === 'transparent' || color === 'currentColor') {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Otherwise, assume it's a palette key or CSS named color
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Generate a lighter shade of a custom color
|
|
51
|
+
* Used when shade 0-5 is requested for custom colors
|
|
52
|
+
*
|
|
53
|
+
* @param color - Base color (hex or rgb) - treated as shade 6
|
|
54
|
+
* @param shadeIndex - Shade index (0-5)
|
|
55
|
+
* @returns Lighter color string
|
|
56
|
+
*/
|
|
57
|
+
export function generateLighterShade(color: string, shadeIndex: number): string {
|
|
58
|
+
// For shades 0-5, lighten the color (base is shade 6)
|
|
59
|
+
// shade 0 = lightest (90% lighter), shade 5 = slightly lighter (15% lighter)
|
|
60
|
+
const lightenAmount = (6 - shadeIndex) * 0.15; // 0.9 to 0.15
|
|
61
|
+
|
|
62
|
+
// Use the lighten algorithm from lighten.ts
|
|
63
|
+
const rgba = parseColorToRgba(color);
|
|
64
|
+
if (!rgba) return color;
|
|
65
|
+
|
|
66
|
+
const { r, g, b, a } = rgba;
|
|
67
|
+
const light = (input: number) => Math.round(input + (255 - input) * lightenAmount);
|
|
68
|
+
|
|
69
|
+
return `rgba(${light(r)}, ${light(g)}, ${light(b)}, ${a})`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generate a darker shade of a custom color
|
|
74
|
+
* Used when shade 7-9 is requested for custom colors
|
|
75
|
+
*
|
|
76
|
+
* @param color - Base color (hex or rgb) - treated as shade 6
|
|
77
|
+
* @param shadeIndex - Shade index (7-9)
|
|
78
|
+
* @returns Darker color string
|
|
79
|
+
*/
|
|
80
|
+
export function generateDarkerShade(color: string, shadeIndex: number): string {
|
|
81
|
+
// For shades 7-9, darken the color (base is shade 6)
|
|
82
|
+
// shade 7 = slightly darker (10% darker), shade 9 = darkest (30% darker)
|
|
83
|
+
const darkenAmount = (shadeIndex - 6) * 0.1; // 0.1 to 0.3
|
|
84
|
+
|
|
85
|
+
// Use the darken algorithm from darken.ts
|
|
86
|
+
const rgba = parseColorToRgba(color);
|
|
87
|
+
if (!rgba) return color;
|
|
88
|
+
|
|
89
|
+
const { r, g, b, a } = rgba;
|
|
90
|
+
const f = 1 - darkenAmount;
|
|
91
|
+
const dark = (input: number) => Math.round(input * f);
|
|
92
|
+
|
|
93
|
+
return `rgba(${dark(r)}, ${dark(g)}, ${dark(b)}, ${a})`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get a shade variation of a custom color
|
|
98
|
+
*
|
|
99
|
+
* For custom colors, we treat shade 6 as the base color (no modification).
|
|
100
|
+
* This aligns with the default primaryShade for light mode.
|
|
101
|
+
* Shades 0-5 are lighter, shades 7-9 are darker.
|
|
102
|
+
*
|
|
103
|
+
* @param color - Base color (hex or rgb)
|
|
104
|
+
* @param shade - Shade index (0-9), where 6 is the base color
|
|
105
|
+
* @returns Color at the requested shade
|
|
106
|
+
*/
|
|
107
|
+
export function getCustomColorShade(color: string, shade: number): string {
|
|
108
|
+
// Shade 6 is treated as the base color (most common primaryShade for light mode)
|
|
109
|
+
if (shade === 6) {
|
|
110
|
+
return color;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Lighter shades (0-5)
|
|
114
|
+
if (shade < 6) {
|
|
115
|
+
return generateLighterShade(color, shade);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Darker shades (7-9)
|
|
119
|
+
return generateDarkerShade(color, shade);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Parse color string to RGBA object
|
|
124
|
+
* Supports hex and rgb/rgba formats
|
|
125
|
+
*/
|
|
126
|
+
interface RGBA {
|
|
127
|
+
r: number;
|
|
128
|
+
g: number;
|
|
129
|
+
b: number;
|
|
130
|
+
a: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function parseColorToRgba(color: string): RGBA | null {
|
|
134
|
+
// Handle hex colors
|
|
135
|
+
if (color.startsWith('#')) {
|
|
136
|
+
return hexToRgba(color);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Handle rgb/rgba colors
|
|
140
|
+
if (color.startsWith('rgb')) {
|
|
141
|
+
return rgbStringToRgba(color);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function isHexColor(hex: string): boolean {
|
|
148
|
+
const HEX_REGEXP = /^#?([0-9A-F]{3}){1,2}$/i;
|
|
149
|
+
return HEX_REGEXP.test(hex);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function hexToRgba(color: string): RGBA | null {
|
|
153
|
+
if (!isHexColor(color)) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let hexString = color.replace('#', '');
|
|
158
|
+
|
|
159
|
+
// Handle shorthand hex (#fff -> #ffffff)
|
|
160
|
+
if (hexString.length === 3) {
|
|
161
|
+
const shorthandHex = hexString.split('');
|
|
162
|
+
hexString = [
|
|
163
|
+
shorthandHex[0],
|
|
164
|
+
shorthandHex[0],
|
|
165
|
+
shorthandHex[1],
|
|
166
|
+
shorthandHex[1],
|
|
167
|
+
shorthandHex[2],
|
|
168
|
+
shorthandHex[2],
|
|
169
|
+
].join('');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const parsed = parseInt(hexString, 16);
|
|
173
|
+
const r = (parsed >> 16) & 255;
|
|
174
|
+
const g = (parsed >> 8) & 255;
|
|
175
|
+
const b = parsed & 255;
|
|
176
|
+
|
|
177
|
+
return { r, g, b, a: 1 };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function rgbStringToRgba(color: string): RGBA | null {
|
|
181
|
+
const parts = color.replace(/[^0-9,.]/g, '').split(',').map(Number);
|
|
182
|
+
|
|
183
|
+
if (parts.length < 3) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const r = parts[0] || 0;
|
|
188
|
+
const g = parts[1] || 0;
|
|
189
|
+
const b = parts[2] || 0;
|
|
190
|
+
const a = parts[3] !== undefined ? parts[3] : 1;
|
|
191
|
+
|
|
192
|
+
return { r, g, b, a };
|
|
193
|
+
}
|
|
@@ -1,38 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Theme color helper function
|
|
3
|
+
* Retrieves colors from theme palette with proper shade handling
|
|
4
|
+
* Aligned with Mantine web's themeColor implementation
|
|
5
|
+
*
|
|
6
|
+
* Now supports custom color values (hex, rgb, rgba) that are not in the theme palette.
|
|
7
|
+
* Custom colors can be shaded on the fly using color manipulation algorithms.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { MantineThemeBase, MantineColor, Shade } from '../../../types';
|
|
3
11
|
import { getPrimaryShade } from '../primary-shade';
|
|
12
|
+
import { isCustomColor, getCustomColorShade } from './color-utils';
|
|
4
13
|
|
|
5
14
|
export interface ThemeColorInput {
|
|
6
|
-
theme:
|
|
15
|
+
theme: MantineThemeBase;
|
|
7
16
|
color: MantineColor;
|
|
8
|
-
shade?:
|
|
17
|
+
shade?: Shade;
|
|
18
|
+
primaryFallback?: boolean;
|
|
9
19
|
}
|
|
10
20
|
|
|
11
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Get a color value from the theme
|
|
23
|
+
*
|
|
24
|
+
* @param theme - Mantine theme object
|
|
25
|
+
* @param color - Color name or CSS color value (now supports hex/rgb/rgba)
|
|
26
|
+
* @param shade - Optional shade (0-9). If not provided, uses primaryShade
|
|
27
|
+
* @param primaryFallback - If true and color not found, falls back to primary color
|
|
28
|
+
* @returns Color string value
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Get blue at primary shade (6 for light mode, 8 for dark mode)
|
|
32
|
+
* themeColor({ theme, color: 'blue' })
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Get blue at specific shade
|
|
36
|
+
* themeColor({ theme, color: 'blue', shade: 5 })
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Pass through CSS color values
|
|
40
|
+
* themeColor({ theme, color: '#ff0000' }) // returns '#ff0000'
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // Use custom hex color with shade
|
|
44
|
+
* themeColor({ theme, color: '#FF5733', shade: 7 }) // returns darker version
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // Use custom rgb color with shade
|
|
48
|
+
* themeColor({ theme, color: 'rgb(255, 87, 51)', shade: 3 }) // returns lighter version
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Use primary color fallback
|
|
52
|
+
* themeColor({ theme, color: 'unknown', primaryFallback: true })
|
|
53
|
+
*/
|
|
54
|
+
export function themeColor({
|
|
55
|
+
theme,
|
|
56
|
+
color,
|
|
57
|
+
shade,
|
|
58
|
+
primaryFallback = false,
|
|
59
|
+
}: ThemeColorInput): string {
|
|
60
|
+
// Handle undefined/null color
|
|
12
61
|
if (!color) {
|
|
13
|
-
return '';
|
|
62
|
+
return primaryFallback ? themeColor({ theme, color: theme.primaryColor, shade }) : '';
|
|
14
63
|
}
|
|
15
64
|
|
|
16
|
-
//
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
65
|
+
// Check if this is a custom color value (hex, rgb, rgba, etc.)
|
|
66
|
+
if (isCustomColor(color)) {
|
|
67
|
+
// If shade is specified, generate a shade variation
|
|
68
|
+
if (shade !== undefined) {
|
|
69
|
+
return getCustomColorShade(color, shade);
|
|
70
|
+
}
|
|
71
|
+
// Otherwise return the color as-is
|
|
22
72
|
return color;
|
|
23
73
|
}
|
|
24
74
|
|
|
25
|
-
// Get from theme
|
|
75
|
+
// Get color palette from theme
|
|
26
76
|
const colorPalette = theme.colors[color];
|
|
27
77
|
|
|
78
|
+
// If color not in palette
|
|
28
79
|
if (!colorPalette) {
|
|
29
|
-
//
|
|
80
|
+
// Try primary fallback if enabled
|
|
81
|
+
if (primaryFallback && color !== theme.primaryColor) {
|
|
82
|
+
return themeColor({ theme, color: theme.primaryColor, shade });
|
|
83
|
+
}
|
|
84
|
+
// Otherwise return the color string as-is (might be a named CSS color)
|
|
30
85
|
return color;
|
|
31
86
|
}
|
|
32
87
|
|
|
33
|
-
//
|
|
88
|
+
// Determine which shade to use
|
|
34
89
|
const colorShade = shade !== undefined ? shade : getPrimaryShade(theme);
|
|
35
90
|
|
|
36
|
-
//
|
|
37
|
-
|
|
91
|
+
// Get the color at the specified shade
|
|
92
|
+
const resolvedColor = colorPalette[colorShade];
|
|
93
|
+
|
|
94
|
+
// Return the color or fall back to first shade
|
|
95
|
+
return resolvedColor || colorPalette[0] || color;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Curried version of themeColor for use with theme.fn
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
export function createThemeColorFunction(theme: MantineThemeBase) {
|
|
103
|
+
return (color: MantineColor, shade?: Shade, primaryFallback?: boolean): string => {
|
|
104
|
+
return themeColor({ theme, color, shade, primaryFallback });
|
|
105
|
+
};
|
|
38
106
|
}
|
|
@@ -1,58 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Variant styles generator
|
|
3
|
+
* Creates component variant styles for React Native
|
|
4
|
+
* Aligned with Mantine web's variant system
|
|
5
|
+
*
|
|
6
|
+
* Now supports custom color values (hex, rgb, rgba) in addition to theme palette colors.
|
|
7
|
+
* Custom colors are automatically shaded using color manipulation algorithms.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { MantineThemeBase, Shade, MantineColor, VariantInput, VariantOutput } from '../../types';
|
|
3
11
|
import { themeColor } from './theme-color/theme-color';
|
|
4
12
|
import { getPrimaryShade } from './primary-shade';
|
|
5
13
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Generate variant styles for components
|
|
16
|
+
*
|
|
17
|
+
* Supports the following variants:
|
|
18
|
+
* - filled: Filled background with primary color
|
|
19
|
+
* - light: Light background with colored text
|
|
20
|
+
* - outline: Transparent background with colored border
|
|
21
|
+
* - subtle: Transparent background with colored text
|
|
22
|
+
* - white: White background (useful for dark mode)
|
|
23
|
+
* - default: Default gray background
|
|
24
|
+
* - gradient: Transparent background for gradient overlays
|
|
25
|
+
* - transparent: Fully transparent
|
|
26
|
+
*
|
|
27
|
+
* @param theme - Mantine theme object
|
|
28
|
+
* @param input - Variant configuration
|
|
29
|
+
* @returns Style object with background, color, border, and optional hover
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Filled variant with blue color
|
|
33
|
+
* variant(theme)({ variant: 'filled', color: 'blue' })
|
|
34
|
+
* // Returns: { background: '#228be6', color: '#fff', border: '#228be6' }
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* // Light variant with red color
|
|
38
|
+
* variant(theme)({ variant: 'light', color: 'red' })
|
|
39
|
+
* // Returns: { background: '#fff5f5', color: '#f03e3e', border: 'transparent' }
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Filled variant with custom hex color
|
|
43
|
+
* variant(theme)({ variant: 'filled', color: '#FF5733' })
|
|
44
|
+
* // Returns: { background: '#FF5733', color: '#fff', border: '#FF5733', hover: darker('#FF5733') }
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // Light variant with custom rgb color
|
|
48
|
+
* variant(theme)({ variant: 'light', color: 'rgb(255, 87, 51)' })
|
|
49
|
+
* // Returns: { background: lighter('rgb(...)'), color: darker('rgb(...)'), border: 'transparent' }
|
|
50
|
+
*/
|
|
51
|
+
export const variant = (theme: MantineThemeBase) => (input: VariantInput): VariantOutput => {
|
|
52
|
+
const { variant, color = theme.primaryColor, primaryFallback = false } = input;
|
|
32
53
|
|
|
33
54
|
const primaryShade = getPrimaryShade(theme);
|
|
34
|
-
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Helper to get color at specific shade
|
|
58
|
+
*/
|
|
59
|
+
const getColor = (c: MantineColor, shade: Shade) =>
|
|
60
|
+
themeColor({ theme, color: c, shade, primaryFallback });
|
|
35
61
|
|
|
36
62
|
switch (variant) {
|
|
63
|
+
// Filled variant - solid background with white text
|
|
37
64
|
case 'filled': {
|
|
38
65
|
const filledColor = getColor(color, primaryShade);
|
|
39
66
|
return {
|
|
40
67
|
background: filledColor,
|
|
41
|
-
color:
|
|
68
|
+
color: theme.white,
|
|
42
69
|
border: filledColor,
|
|
43
|
-
hover: getColor(color, primaryShade
|
|
70
|
+
hover: getColor(color, Math.min(primaryShade + 1, 9) as Shade),
|
|
44
71
|
};
|
|
45
72
|
}
|
|
46
73
|
|
|
74
|
+
// Light variant - light background with colored text
|
|
47
75
|
case 'light': {
|
|
76
|
+
const textShade = primaryShade > 6 ? primaryShade : 7;
|
|
48
77
|
return {
|
|
49
78
|
background: getColor(color, 0),
|
|
50
|
-
color: getColor(color,
|
|
79
|
+
color: getColor(color, textShade),
|
|
51
80
|
border: 'transparent',
|
|
52
81
|
hover: getColor(color, 1),
|
|
53
82
|
};
|
|
54
83
|
}
|
|
55
84
|
|
|
85
|
+
// Outline variant - transparent with colored border and text
|
|
56
86
|
case 'outline': {
|
|
57
87
|
const outlineColor = getColor(color, primaryShade);
|
|
58
88
|
return {
|
|
@@ -63,6 +93,7 @@ export const variant = (theme: MantineTheme) => (input: VariantInput): VariantOu
|
|
|
63
93
|
};
|
|
64
94
|
}
|
|
65
95
|
|
|
96
|
+
// Subtle variant - transparent with colored text
|
|
66
97
|
case 'subtle': {
|
|
67
98
|
return {
|
|
68
99
|
background: 'transparent',
|
|
@@ -72,41 +103,72 @@ export const variant = (theme: MantineTheme) => (input: VariantInput): VariantOu
|
|
|
72
103
|
};
|
|
73
104
|
}
|
|
74
105
|
|
|
106
|
+
// White variant - white background with colored text
|
|
75
107
|
case 'white': {
|
|
76
108
|
return {
|
|
77
|
-
background:
|
|
109
|
+
background: theme.white,
|
|
78
110
|
color: getColor(color, primaryShade),
|
|
79
|
-
border:
|
|
80
|
-
hover: '#f8f9fa',
|
|
111
|
+
border: theme.white,
|
|
112
|
+
hover: theme.colors.gray?.[0] || '#f8f9fa',
|
|
81
113
|
};
|
|
82
114
|
}
|
|
83
115
|
|
|
116
|
+
// Default variant - gray background
|
|
84
117
|
case 'default': {
|
|
118
|
+
const isDark = theme.colorScheme === 'dark';
|
|
119
|
+
|
|
120
|
+
if (isDark) {
|
|
121
|
+
return {
|
|
122
|
+
background: theme.colors.dark?.[6] || '#25262b',
|
|
123
|
+
color: theme.white,
|
|
124
|
+
border: theme.colors.dark?.[4] || '#373A40',
|
|
125
|
+
hover: theme.colors.dark?.[5] || '#2C2E33',
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
85
129
|
return {
|
|
86
|
-
background: theme.
|
|
87
|
-
color: theme.
|
|
130
|
+
background: theme.white,
|
|
131
|
+
color: theme.black,
|
|
88
132
|
border: theme.colors.gray?.[4] || '#ced4da',
|
|
89
133
|
hover: theme.colors.gray?.[0] || '#f8f9fa',
|
|
90
134
|
};
|
|
91
135
|
}
|
|
92
136
|
|
|
137
|
+
// Gradient variant - transparent background for gradient overlays
|
|
138
|
+
// The actual gradient rendering is handled by LinearGradient component
|
|
93
139
|
case 'gradient': {
|
|
94
|
-
// For gradient variant, return transparent background
|
|
95
|
-
// The actual gradient rendering is handled by LinearGradient component
|
|
96
|
-
// We just need to provide the text color and border
|
|
97
140
|
return {
|
|
98
141
|
background: 'transparent',
|
|
99
|
-
color:
|
|
142
|
+
color: theme.white,
|
|
143
|
+
border: 'transparent',
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Transparent variant - fully transparent
|
|
148
|
+
case 'transparent': {
|
|
149
|
+
return {
|
|
150
|
+
background: 'transparent',
|
|
151
|
+
color: getColor(color, primaryShade),
|
|
100
152
|
border: 'transparent',
|
|
101
153
|
};
|
|
102
154
|
}
|
|
103
155
|
|
|
156
|
+
// Default fallback - same as filled variant
|
|
104
157
|
default: {
|
|
158
|
+
const filledColor = getColor(color, primaryShade);
|
|
105
159
|
return {
|
|
106
|
-
background:
|
|
107
|
-
color:
|
|
108
|
-
border:
|
|
160
|
+
background: filledColor,
|
|
161
|
+
color: theme.white,
|
|
162
|
+
border: filledColor,
|
|
109
163
|
};
|
|
110
164
|
}
|
|
111
165
|
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Curried version of variant for use with theme.fn
|
|
170
|
+
* @internal
|
|
171
|
+
*/
|
|
172
|
+
export function createVariantFunction(theme: MantineThemeBase) {
|
|
173
|
+
return variant(theme);
|
|
112
174
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme functions module
|
|
3
|
+
* Exports all theme-related utilities and functions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { attachFunctions } from './attach-functions';
|
|
7
|
+
export * from './fns';
|
|
8
|
+
export * from './fns/primary-shade';
|
|
9
|
+
export * from './fns/theme-color/theme-color';
|
|
10
|
+
export * from './fns/variant';
|
|
11
|
+
export * from './fns/rgba';
|
|
12
|
+
export * from './fns/radius';
|
|
13
|
+
export * from './fns/size';
|
|
14
|
+
export * from './fns/shadow';
|
|
15
|
+
export * from './fns/gradient/gradient';
|
|
16
|
+
export * from './fns/lighten';
|
|
17
|
+
export * from './fns/darken';
|
|
18
|
+
export * from './fns/dimmed';
|
|
19
|
+
export * from './fns/breakpoints';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mantine React Native Theme System
|
|
3
|
+
* Main export file for theme-related types and utilities
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Type exports
|
|
7
|
+
export type {
|
|
8
|
+
// Color types
|
|
9
|
+
Shade,
|
|
10
|
+
MantineColorsTuple,
|
|
11
|
+
DefaultMantineColor,
|
|
12
|
+
MantineColor,
|
|
13
|
+
MantineThemeColors,
|
|
14
|
+
MantinePrimaryShade,
|
|
15
|
+
ColorScheme,
|
|
16
|
+
ColorSchemeValue,
|
|
17
|
+
ResolveColorSchemeValue,
|
|
18
|
+
|
|
19
|
+
// Size types
|
|
20
|
+
MantineSize,
|
|
21
|
+
MantineNumberSize,
|
|
22
|
+
MantineSizes,
|
|
23
|
+
|
|
24
|
+
// Gradient types
|
|
25
|
+
MantineGradient,
|
|
26
|
+
GradientConfig,
|
|
27
|
+
|
|
28
|
+
// Typography types
|
|
29
|
+
FontWeights,
|
|
30
|
+
HeadingStyle,
|
|
31
|
+
MantineHeadings,
|
|
32
|
+
|
|
33
|
+
// Shadow types
|
|
34
|
+
IOSShadow,
|
|
35
|
+
AndroidShadow,
|
|
36
|
+
MantineShadow,
|
|
37
|
+
MantineShadows,
|
|
38
|
+
|
|
39
|
+
// Variant types
|
|
40
|
+
MantineVariant,
|
|
41
|
+
VariantInput,
|
|
42
|
+
VariantOutput,
|
|
43
|
+
|
|
44
|
+
// Theme types
|
|
45
|
+
ThemeComponent,
|
|
46
|
+
MantineThemeComponents,
|
|
47
|
+
MantineThemeFunctions,
|
|
48
|
+
MantineTheme,
|
|
49
|
+
MantineThemeBase,
|
|
50
|
+
MantineThemeOverride,
|
|
51
|
+
|
|
52
|
+
// Utility types
|
|
53
|
+
DeepPartial,
|
|
54
|
+
ThemeableStyleProps,
|
|
55
|
+
SpacingValue,
|
|
56
|
+
Variants,
|
|
57
|
+
DefaultProps,
|
|
58
|
+
} from './types';
|
|
59
|
+
|
|
60
|
+
// Theme exports
|
|
61
|
+
export { DEFAULT_COLORS } from './default-colors';
|
|
62
|
+
export { DEFAULT_THEME, _DEFAULT_THEME } from './default-theme';
|
|
63
|
+
export { createTheme } from './create-theme';
|
|
64
|
+
|
|
65
|
+
// Function exports
|
|
66
|
+
export {
|
|
67
|
+
attachFunctions,
|
|
68
|
+
getPrimaryShade,
|
|
69
|
+
getPrimaryColor,
|
|
70
|
+
themeColor,
|
|
71
|
+
variant,
|
|
72
|
+
rgba,
|
|
73
|
+
radius,
|
|
74
|
+
size,
|
|
75
|
+
shadow,
|
|
76
|
+
gradient,
|
|
77
|
+
lighten,
|
|
78
|
+
darken,
|
|
79
|
+
dimmed,
|
|
80
|
+
largerThan,
|
|
81
|
+
smallerThan,
|
|
82
|
+
colorSchemeValue,
|
|
83
|
+
resolveColorSchemeValue,
|
|
84
|
+
resolveColorSchemeConstants,
|
|
85
|
+
isColorSchemeValue,
|
|
86
|
+
} from './functions';
|
|
87
|
+
|
|
88
|
+
// Utility exports
|
|
89
|
+
export { createStyles } from './create-styles';
|
|
90
|
+
export { filterProps } from './filter-props';
|
|
91
|
+
export { getSize } from './get-size';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { get } from 'lodash-es';
|
|
2
1
|
import React, {
|
|
3
2
|
createContext,
|
|
4
3
|
useContext,
|
|
@@ -13,9 +12,8 @@ import type { ColorSchemeName } from 'react-native';
|
|
|
13
12
|
import type { ReactNode } from 'react';
|
|
14
13
|
|
|
15
14
|
import { Layout } from './constants';
|
|
16
|
-
import type { MantineTheme } from './
|
|
15
|
+
import type { MantineTheme } from './types';
|
|
17
16
|
import { createTheme } from './create-theme';
|
|
18
|
-
import { getPrimaryShade } from './functions/fns/primary-shade';
|
|
19
17
|
|
|
20
18
|
import { filterProps } from './filter-props';
|
|
21
19
|
import useCachedResources from '../hooks/useCachedResources';
|
|
@@ -37,7 +35,6 @@ export const ThemeProvider = ({
|
|
|
37
35
|
theme: MantineTheme;
|
|
38
36
|
forceMode?: 'light' | 'dark';
|
|
39
37
|
}): React.ReactElement => {
|
|
40
|
-
const { colors, primaryColor, secondaryColor } = theme;
|
|
41
38
|
const systemDarkMode = Appearance.getColorScheme();
|
|
42
39
|
const [currentMode, setCurrentMode] = useState<'light' | 'dark'>(
|
|
43
40
|
forceMode || systemDarkMode || 'light'
|
|
@@ -60,21 +57,9 @@ export const ThemeProvider = ({
|
|
|
60
57
|
}, [currentMode]);
|
|
61
58
|
|
|
62
59
|
const memoValue = useMemo(() => {
|
|
63
|
-
const darkTheme = {
|
|
64
|
-
light: theme.dark,
|
|
65
|
-
dark: theme.light,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// Get the primary shade for the current mode
|
|
69
|
-
const themeWithMode = { ...theme, currentMode };
|
|
70
|
-
const shade = getPrimaryShade(themeWithMode);
|
|
71
|
-
|
|
72
60
|
return {
|
|
73
61
|
...theme,
|
|
74
|
-
|
|
75
|
-
primaryBgColor: get(colors, `${primaryColor}.${shade}`),
|
|
76
|
-
secondaryBgColor: get(colors, `${secondaryColor}.0`),
|
|
77
|
-
...(currentMode === 'dark' ? darkTheme : {}),
|
|
62
|
+
colorScheme: currentMode,
|
|
78
63
|
window: Layout.window,
|
|
79
64
|
isSmallDevice: Layout.isSmallDevice,
|
|
80
65
|
screen: Layout.screen,
|