@mantine/core 7.3.2 → 7.4.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/cjs/components/ActionIcon/ActionIcon.cjs +5 -3
- package/cjs/components/ActionIcon/ActionIcon.cjs.map +1 -1
- package/cjs/components/Alert/Alert.cjs +19 -15
- package/cjs/components/Alert/Alert.cjs.map +1 -1
- package/cjs/components/Avatar/Avatar.cjs +4 -2
- package/cjs/components/Avatar/Avatar.cjs.map +1 -1
- package/cjs/components/Badge/Badge.cjs +6 -3
- package/cjs/components/Badge/Badge.cjs.map +1 -1
- package/cjs/components/Button/Button.cjs +5 -3
- package/cjs/components/Button/Button.cjs.map +1 -1
- package/cjs/components/Checkbox/Checkbox.cjs +4 -2
- package/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
- package/cjs/components/Checkbox/CheckboxGroup/CheckboxGroup.cjs.map +1 -1
- package/cjs/components/Chip/Chip.cjs +26 -22
- package/cjs/components/Chip/Chip.cjs.map +1 -1
- package/cjs/components/Chip/ChipGroup/ChipGroup.cjs.map +1 -1
- package/cjs/components/CloseButton/CloseButton.cjs +2 -1
- package/cjs/components/CloseButton/CloseButton.cjs.map +1 -1
- package/cjs/components/Collapse/Collapse.cjs +12 -7
- package/cjs/components/Collapse/Collapse.cjs.map +1 -1
- package/cjs/components/Collapse/use-collapse.cjs +1 -1
- package/cjs/components/Collapse/use-collapse.cjs.map +1 -1
- package/cjs/components/ColorInput/ColorInput.cjs.map +1 -1
- package/cjs/components/ColorPicker/ColorPicker.cjs.map +1 -1
- package/cjs/components/FileInput/FileInput.cjs.map +1 -1
- package/cjs/components/Indicator/Indicator.cjs +3 -1
- package/cjs/components/Indicator/Indicator.cjs.map +1 -1
- package/cjs/components/Input/Input.cjs.map +1 -1
- package/cjs/components/Input/InputLabel/InputLabel.cjs.map +1 -1
- package/cjs/components/Input/InputWrapper/InputWrapper.cjs.map +1 -1
- package/cjs/components/Menu/Menu.cjs +4 -0
- package/cjs/components/Menu/Menu.cjs.map +1 -1
- package/cjs/components/Menu/Menu.context.cjs.map +1 -1
- package/cjs/components/Menu/MenuTarget/MenuTarget.cjs +17 -8
- package/cjs/components/Menu/MenuTarget/MenuTarget.cjs.map +1 -1
- package/cjs/components/NativeSelect/NativeSelect.cjs.map +1 -1
- package/cjs/components/NavLink/NavLink.cjs +4 -2
- package/cjs/components/NavLink/NavLink.cjs.map +1 -1
- package/cjs/components/NumberInput/NumberInput.cjs +54 -8
- package/cjs/components/NumberInput/NumberInput.cjs.map +1 -1
- package/cjs/components/Pagination/Pagination.context.cjs.map +1 -1
- package/cjs/components/Pagination/PaginationRoot/PaginationRoot.cjs +5 -2
- package/cjs/components/Pagination/PaginationRoot/PaginationRoot.cjs.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.cjs.map +1 -1
- package/cjs/components/PinInput/PinInput.cjs.map +1 -1
- package/cjs/components/Progress/Progress.context.cjs.map +1 -1
- package/cjs/components/Progress/ProgressRoot/ProgressRoot.cjs +2 -2
- package/cjs/components/Progress/ProgressRoot/ProgressRoot.cjs.map +1 -1
- package/cjs/components/Progress/ProgressSection/ProgressSection.cjs +3 -1
- package/cjs/components/Progress/ProgressSection/ProgressSection.cjs.map +1 -1
- package/cjs/components/Radio/Radio.cjs +3 -2
- package/cjs/components/Radio/Radio.cjs.map +1 -1
- package/cjs/components/Radio/RadioGroup/RadioGroup.cjs.map +1 -1
- package/cjs/components/Rating/Rating.cjs.map +1 -1
- package/cjs/components/SegmentedControl/SegmentedControl.cjs +3 -1
- package/cjs/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
- package/cjs/components/Select/Select.cjs +5 -4
- package/cjs/components/Select/Select.cjs.map +1 -1
- package/cjs/components/Slider/RangeSlider/RangeSlider.cjs.map +1 -1
- package/cjs/components/Slider/Slider/Slider.cjs.map +1 -1
- package/cjs/components/Stepper/Stepper.cjs +3 -1
- package/cjs/components/Stepper/Stepper.cjs.map +1 -1
- package/cjs/components/Switch/Switch.cjs.map +1 -1
- package/cjs/components/Tabs/Tabs.cjs +5 -2
- package/cjs/components/Tabs/Tabs.cjs.map +1 -1
- package/cjs/components/Text/Text.cjs.map +1 -1
- package/cjs/components/ThemeIcon/ThemeIcon.cjs +4 -3
- package/cjs/components/ThemeIcon/ThemeIcon.cjs.map +1 -1
- package/cjs/components/Timeline/Timeline.cjs +4 -2
- package/cjs/components/Timeline/Timeline.cjs.map +1 -1
- package/cjs/core/Box/style-props/extract-style-props/extract-style-props.cjs +2 -0
- package/cjs/core/Box/style-props/extract-style-props/extract-style-props.cjs.map +1 -1
- package/cjs/core/Box/style-props/resolvers/font-family-resolver/font-family-resolver.cjs +17 -0
- package/cjs/core/Box/style-props/resolvers/font-family-resolver/font-family-resolver.cjs.map +1 -0
- package/cjs/core/Box/style-props/resolvers/index.cjs +3 -1
- package/cjs/core/Box/style-props/resolvers/index.cjs.map +1 -1
- package/cjs/core/Box/style-props/style-props-data.cjs +3 -2
- package/cjs/core/Box/style-props/style-props-data.cjs.map +1 -1
- package/cjs/core/MantineProvider/MantineCssVariables/default-css-variables-resolver.cjs +3 -0
- package/cjs/core/MantineProvider/MantineCssVariables/default-css-variables-resolver.cjs.map +1 -1
- package/cjs/core/MantineProvider/color-functions/darken/darken.cjs +1 -1
- package/cjs/core/MantineProvider/color-functions/darken/darken.cjs.map +1 -1
- package/cjs/core/MantineProvider/color-functions/default-variant-colors-resolver/default-variant-colors-resolver.cjs +7 -4
- package/cjs/core/MantineProvider/color-functions/default-variant-colors-resolver/default-variant-colors-resolver.cjs.map +1 -1
- package/cjs/core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.cjs +25 -0
- package/cjs/core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.cjs.map +1 -0
- package/cjs/core/MantineProvider/color-functions/lighten/lighten.cjs +1 -1
- package/cjs/core/MantineProvider/color-functions/lighten/lighten.cjs.map +1 -1
- package/cjs/core/MantineProvider/color-functions/luminance/luminance.cjs +35 -0
- package/cjs/core/MantineProvider/color-functions/luminance/luminance.cjs.map +1 -0
- package/cjs/core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.cjs +38 -2
- package/cjs/core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.cjs.map +1 -1
- package/cjs/core/MantineProvider/color-functions/rgba/rgba.cjs +15 -3
- package/cjs/core/MantineProvider/color-functions/rgba/rgba.cjs.map +1 -1
- package/cjs/core/MantineProvider/color-functions/to-rgba/to-rgba.cjs +10 -1
- package/cjs/core/MantineProvider/color-functions/to-rgba/to-rgba.cjs.map +1 -1
- package/cjs/core/MantineProvider/default-theme.cjs +2 -0
- package/cjs/core/MantineProvider/default-theme.cjs.map +1 -1
- package/cjs/core/MantineProvider/merge-mantine-theme/merge-mantine-theme.cjs +0 -1
- package/cjs/core/MantineProvider/merge-mantine-theme/merge-mantine-theme.cjs.map +1 -1
- package/cjs/core/utils/deep-merge/deep-merge.cjs +0 -1
- package/cjs/core/utils/deep-merge/deep-merge.cjs.map +1 -1
- package/cjs/index.cjs +7 -2
- package/cjs/index.cjs.map +1 -1
- package/esm/components/ActionIcon/ActionIcon.mjs +5 -3
- package/esm/components/ActionIcon/ActionIcon.mjs.map +1 -1
- package/esm/components/Alert/Alert.mjs +19 -15
- package/esm/components/Alert/Alert.mjs.map +1 -1
- package/esm/components/Avatar/Avatar.mjs +4 -2
- package/esm/components/Avatar/Avatar.mjs.map +1 -1
- package/esm/components/Badge/Badge.mjs +6 -3
- package/esm/components/Badge/Badge.mjs.map +1 -1
- package/esm/components/Button/Button.mjs +5 -3
- package/esm/components/Button/Button.mjs.map +1 -1
- package/esm/components/Checkbox/Checkbox.mjs +4 -2
- package/esm/components/Checkbox/Checkbox.mjs.map +1 -1
- package/esm/components/Checkbox/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
- package/esm/components/Chip/Chip.mjs +26 -22
- package/esm/components/Chip/Chip.mjs.map +1 -1
- package/esm/components/Chip/ChipGroup/ChipGroup.mjs.map +1 -1
- package/esm/components/CloseButton/CloseButton.mjs +2 -1
- package/esm/components/CloseButton/CloseButton.mjs.map +1 -1
- package/esm/components/Collapse/Collapse.mjs +12 -7
- package/esm/components/Collapse/Collapse.mjs.map +1 -1
- package/esm/components/Collapse/use-collapse.mjs +1 -1
- package/esm/components/Collapse/use-collapse.mjs.map +1 -1
- package/esm/components/ColorInput/ColorInput.mjs.map +1 -1
- package/esm/components/ColorPicker/ColorPicker.mjs.map +1 -1
- package/esm/components/FileInput/FileInput.mjs.map +1 -1
- package/esm/components/Indicator/Indicator.mjs +3 -1
- package/esm/components/Indicator/Indicator.mjs.map +1 -1
- package/esm/components/Input/Input.mjs.map +1 -1
- package/esm/components/Input/InputLabel/InputLabel.mjs.map +1 -1
- package/esm/components/Input/InputWrapper/InputWrapper.mjs.map +1 -1
- package/esm/components/Menu/Menu.context.mjs.map +1 -1
- package/esm/components/Menu/Menu.mjs +5 -1
- package/esm/components/Menu/Menu.mjs.map +1 -1
- package/esm/components/Menu/MenuTarget/MenuTarget.mjs +17 -8
- package/esm/components/Menu/MenuTarget/MenuTarget.mjs.map +1 -1
- package/esm/components/NativeSelect/NativeSelect.mjs.map +1 -1
- package/esm/components/NavLink/NavLink.mjs +4 -2
- package/esm/components/NavLink/NavLink.mjs.map +1 -1
- package/esm/components/NumberInput/NumberInput.mjs +56 -10
- package/esm/components/NumberInput/NumberInput.mjs.map +1 -1
- package/esm/components/Pagination/Pagination.context.mjs.map +1 -1
- package/esm/components/Pagination/PaginationRoot/PaginationRoot.mjs +5 -2
- package/esm/components/Pagination/PaginationRoot/PaginationRoot.mjs.map +1 -1
- package/esm/components/PasswordInput/PasswordInput.mjs.map +1 -1
- package/esm/components/PinInput/PinInput.mjs.map +1 -1
- package/esm/components/Progress/Progress.context.mjs.map +1 -1
- package/esm/components/Progress/ProgressRoot/ProgressRoot.mjs +2 -2
- package/esm/components/Progress/ProgressRoot/ProgressRoot.mjs.map +1 -1
- package/esm/components/Progress/ProgressSection/ProgressSection.mjs +3 -1
- package/esm/components/Progress/ProgressSection/ProgressSection.mjs.map +1 -1
- package/esm/components/Radio/Radio.mjs +3 -2
- package/esm/components/Radio/Radio.mjs.map +1 -1
- package/esm/components/Radio/RadioGroup/RadioGroup.mjs.map +1 -1
- package/esm/components/Rating/Rating.mjs.map +1 -1
- package/esm/components/SegmentedControl/SegmentedControl.mjs +3 -1
- package/esm/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/esm/components/Select/Select.mjs +5 -4
- package/esm/components/Select/Select.mjs.map +1 -1
- package/esm/components/Slider/RangeSlider/RangeSlider.mjs.map +1 -1
- package/esm/components/Slider/Slider/Slider.mjs.map +1 -1
- package/esm/components/Stepper/Stepper.mjs +3 -1
- package/esm/components/Stepper/Stepper.mjs.map +1 -1
- package/esm/components/Switch/Switch.mjs.map +1 -1
- package/esm/components/Tabs/Tabs.mjs +5 -2
- package/esm/components/Tabs/Tabs.mjs.map +1 -1
- package/esm/components/Text/Text.mjs.map +1 -1
- package/esm/components/ThemeIcon/ThemeIcon.mjs +4 -3
- package/esm/components/ThemeIcon/ThemeIcon.mjs.map +1 -1
- package/esm/components/Timeline/Timeline.mjs +4 -2
- package/esm/components/Timeline/Timeline.mjs.map +1 -1
- package/esm/core/Box/style-props/extract-style-props/extract-style-props.mjs +2 -0
- package/esm/core/Box/style-props/extract-style-props/extract-style-props.mjs.map +1 -1
- package/esm/core/Box/style-props/resolvers/font-family-resolver/font-family-resolver.mjs +15 -0
- package/esm/core/Box/style-props/resolvers/font-family-resolver/font-family-resolver.mjs.map +1 -0
- package/esm/core/Box/style-props/resolvers/index.mjs +3 -1
- package/esm/core/Box/style-props/resolvers/index.mjs.map +1 -1
- package/esm/core/Box/style-props/style-props-data.mjs +3 -2
- package/esm/core/Box/style-props/style-props-data.mjs.map +1 -1
- package/esm/core/MantineProvider/MantineCssVariables/default-css-variables-resolver.mjs +3 -0
- package/esm/core/MantineProvider/MantineCssVariables/default-css-variables-resolver.mjs.map +1 -1
- package/esm/core/MantineProvider/color-functions/darken/darken.mjs +1 -1
- package/esm/core/MantineProvider/color-functions/darken/darken.mjs.map +1 -1
- package/esm/core/MantineProvider/color-functions/default-variant-colors-resolver/default-variant-colors-resolver.mjs +7 -4
- package/esm/core/MantineProvider/color-functions/default-variant-colors-resolver/default-variant-colors-resolver.mjs.map +1 -1
- package/esm/core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.mjs +22 -0
- package/esm/core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.mjs.map +1 -0
- package/esm/core/MantineProvider/color-functions/lighten/lighten.mjs +1 -1
- package/esm/core/MantineProvider/color-functions/lighten/lighten.mjs.map +1 -1
- package/esm/core/MantineProvider/color-functions/luminance/luminance.mjs +32 -0
- package/esm/core/MantineProvider/color-functions/luminance/luminance.mjs.map +1 -0
- package/esm/core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.mjs +38 -2
- package/esm/core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.mjs.map +1 -1
- package/esm/core/MantineProvider/color-functions/rgba/rgba.mjs +15 -4
- package/esm/core/MantineProvider/color-functions/rgba/rgba.mjs.map +1 -1
- package/esm/core/MantineProvider/color-functions/to-rgba/to-rgba.mjs +10 -1
- package/esm/core/MantineProvider/color-functions/to-rgba/to-rgba.mjs.map +1 -1
- package/esm/core/MantineProvider/default-theme.mjs +2 -0
- package/esm/core/MantineProvider/default-theme.mjs.map +1 -1
- package/esm/core/MantineProvider/merge-mantine-theme/merge-mantine-theme.mjs +0 -1
- package/esm/core/MantineProvider/merge-mantine-theme/merge-mantine-theme.mjs.map +1 -1
- package/esm/core/utils/deep-merge/deep-merge.mjs +0 -1
- package/esm/core/utils/deep-merge/deep-merge.mjs.map +1 -1
- package/esm/index.mjs +3 -2
- package/esm/index.mjs.map +1 -1
- package/lib/components/ActionIcon/ActionIcon.d.ts +2 -0
- package/lib/components/Alert/Alert.d.ts +2 -0
- package/lib/components/Avatar/Avatar.d.ts +2 -0
- package/lib/components/Badge/Badge.d.ts +4 -0
- package/lib/components/Button/Button.d.ts +2 -0
- package/lib/components/Checkbox/Checkbox.d.ts +10 -8
- package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.d.ts +3 -3
- package/lib/components/Chip/Chip.d.ts +8 -6
- package/lib/components/Chip/ChipGroup/ChipGroup.d.ts +2 -2
- package/lib/components/CloseButton/CloseButton.d.ts +2 -0
- package/lib/components/ColorInput/ColorInput.d.ts +2 -2
- package/lib/components/ColorPicker/ColorPicker.d.ts +10 -10
- package/lib/components/FileInput/FileInput.d.ts +6 -4
- package/lib/components/Indicator/Indicator.d.ts +3 -1
- package/lib/components/Input/Input.d.ts +4 -4
- package/lib/components/Input/InputLabel/InputLabel.d.ts +1 -1
- package/lib/components/Input/InputWrapper/InputWrapper.d.ts +6 -6
- package/lib/components/Input/use-input-props.d.ts +3 -3
- package/lib/components/Menu/Menu.context.d.ts +2 -0
- package/lib/components/NativeSelect/NativeSelect.d.ts +1 -1
- package/lib/components/NavLink/NavLink.d.ts +2 -0
- package/lib/components/NumberInput/NumberInput.d.ts +4 -0
- package/lib/components/Pagination/PaginationRoot/PaginationRoot.d.ts +3 -1
- package/lib/components/PasswordInput/PasswordInput.d.ts +3 -3
- package/lib/components/PinInput/PinInput.d.ts +10 -10
- package/lib/components/Progress/Progress.context.d.ts +1 -0
- package/lib/components/Progress/ProgressRoot/ProgressRoot.d.ts +2 -0
- package/lib/components/Radio/Radio.d.ts +7 -5
- package/lib/components/Radio/RadioGroup/RadioGroup.d.ts +2 -2
- package/lib/components/Rating/Rating.d.ts +12 -12
- package/lib/components/SegmentedControl/SegmentedControl.d.ts +2 -0
- package/lib/components/Select/Select.d.ts +2 -2
- package/lib/components/Slider/RangeSlider/RangeSlider.d.ts +1 -1
- package/lib/components/Slider/Slider/Slider.d.ts +1 -1
- package/lib/components/Stepper/Stepper.d.ts +3 -1
- package/lib/components/Switch/Switch.d.ts +6 -6
- package/lib/components/Tabs/Tabs.d.ts +2 -0
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/ThemeIcon/ThemeIcon.d.ts +2 -0
- package/lib/components/Timeline/Timeline.d.ts +3 -1
- package/lib/core/Box/style-props/resolvers/font-family-resolver/font-family-resolver.d.ts +1 -0
- package/lib/core/Box/style-props/resolvers/index.d.ts +2 -0
- package/lib/core/Box/style-props/style-props.types.d.ts +2 -1
- package/lib/core/MantineProvider/color-functions/default-variant-colors-resolver/default-variant-colors-resolver.d.ts +1 -0
- package/lib/core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.d.ts +9 -0
- package/lib/core/MantineProvider/color-functions/index.d.ts +3 -2
- package/lib/core/MantineProvider/color-functions/luminance/luminance.d.ts +2 -0
- package/lib/core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.d.ts +1 -0
- package/lib/core/MantineProvider/color-functions/rgba/rgba.d.ts +1 -0
- package/lib/core/MantineProvider/theme.types.d.ts +10 -0
- package/lib/core/styles-api/styles-api.types.d.ts +1 -2
- package/package.json +3 -3
- package/styles/Badge.css +1 -1
- package/styles/Badge.layer.css +1 -1
- package/styles/Indicator.css +1 -1
- package/styles/Indicator.layer.css +1 -1
- package/styles/Pagination.css +1 -1
- package/styles/Pagination.layer.css +1 -1
- package/styles/Progress.css +1 -1
- package/styles/Progress.layer.css +1 -1
- package/styles/Stepper.css +1 -1
- package/styles/Stepper.layer.css +1 -1
- package/styles/Tabs.css +1 -1
- package/styles/Tabs.layer.css +1 -1
- package/styles/Timeline.css +1 -1
- package/styles/Timeline.layer.css +1 -1
- package/styles/global.css +1 -1
- package/styles/global.layer.css +1 -1
- package/styles.css +2 -2
- package/styles.layer.css +2 -2
- package/cjs/core/MantineProvider/color-functions/is-light-color/is-light-color.cjs +0 -22
- package/cjs/core/MantineProvider/color-functions/is-light-color/is-light-color.cjs.map +0 -1
- package/esm/core/MantineProvider/color-functions/is-light-color/is-light-color.mjs +0 -19
- package/esm/core/MantineProvider/color-functions/is-light-color/is-light-color.mjs.map +0 -1
- package/lib/core/MantineProvider/color-functions/is-light-color/is-light-color.d.ts +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { getPrimaryShade } from '../get-primary-shade/get-primary-shade.mjs';
|
|
3
|
+
import { parseThemeColor } from '../parse-theme-color/parse-theme-color.mjs';
|
|
4
|
+
|
|
5
|
+
function getContrastColor({ color, theme, autoContrast = true }) {
|
|
6
|
+
const _autoContrast = typeof autoContrast === "boolean" ? autoContrast : theme.autoContrast;
|
|
7
|
+
if (!_autoContrast) {
|
|
8
|
+
return "var(--mantine-color-white)";
|
|
9
|
+
}
|
|
10
|
+
const parsed = parseThemeColor({ color: color || theme.primaryColor, theme });
|
|
11
|
+
return parsed.isLight ? "var(--mantine-color-black)" : "var(--mantine-color-white)";
|
|
12
|
+
}
|
|
13
|
+
function getPrimaryContrastColor(theme, colorScheme) {
|
|
14
|
+
return getContrastColor({
|
|
15
|
+
color: theme.colors[theme.primaryColor][getPrimaryShade(theme, colorScheme)],
|
|
16
|
+
theme,
|
|
17
|
+
autoContrast: null
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { getContrastColor, getPrimaryContrastColor };
|
|
22
|
+
//# sourceMappingURL=get-contrast-color.mjs.map
|
package/esm/core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-contrast-color.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.ts"],"sourcesContent":["import type { MantineTheme } from '../../theme.types';\nimport { getPrimaryShade } from '../get-primary-shade/get-primary-shade';\nimport { parseThemeColor } from '../parse-theme-color/parse-theme-color';\n\ninterface GetContrastColorInput {\n color: string | null | undefined;\n theme: MantineTheme;\n autoContrast?: boolean | undefined | null;\n}\n\nexport function getContrastColor({ color, theme, autoContrast = true }: GetContrastColorInput) {\n const _autoContrast = typeof autoContrast === 'boolean' ? autoContrast : theme.autoContrast;\n\n if (!_autoContrast) {\n return 'var(--mantine-color-white)';\n }\n\n const parsed = parseThemeColor({ color: color || theme.primaryColor, theme });\n return parsed.isLight ? 'var(--mantine-color-black)' : 'var(--mantine-color-white)';\n}\n\nexport function getPrimaryContrastColor(theme: MantineTheme, colorScheme: 'light' | 'dark') {\n return getContrastColor({\n color: theme.colors[theme.primaryColor][getPrimaryShade(theme, colorScheme)],\n theme,\n autoContrast: null,\n });\n}\n"],"names":[],"mappings":";;;;AAGO,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,CAAC,CAAA,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CAAI,CAAA,CAAA,CAAA,CAAA,CAAE,CAAE,CAAA,CAAA;AACxE,CAAA,CAAE,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,YAAY,CAAC;AAC9F,CAAE,CAAA,CAAA,CAAA,CAA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E,CAAA,CAAA;AAC5D,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,gBAAgB,CAAC,CAAA;AAC1B,CAAA,CAAA,CAAA,CAAI,KAAK,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,CAAC,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,KAAK,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAC,CAAC,CAAA;AAChF,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA;AACT,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,EAAE,CAAI,CAAA,CAAA,CAAA;AACtB,CAAA,CAAA,CAAG,CAAC,CAAC;AACL,CAAA;;"}
|
|
@@ -2,7 +2,7 @@ import { toRgba } from '../to-rgba/to-rgba.mjs';
|
|
|
2
2
|
|
|
3
3
|
function lighten(color, alpha) {
|
|
4
4
|
if (color.startsWith("var(")) {
|
|
5
|
-
return color
|
|
5
|
+
return `color-mix(in srgb, ${color}, white ${alpha * 100}%)`;
|
|
6
6
|
}
|
|
7
7
|
const { r, g, b, a } = toRgba(color);
|
|
8
8
|
const light = (input) => Math.round(input + (255 - input) * alpha);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lighten.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/lighten/lighten.ts"],"sourcesContent":["import { toRgba } from '../to-rgba/to-rgba';\n\nexport function lighten(color: string, alpha: number) {\n if (color.startsWith('var(')) {\n return color
|
|
1
|
+
{"version":3,"file":"lighten.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/lighten/lighten.ts"],"sourcesContent":["import { toRgba } from '../to-rgba/to-rgba';\n\nexport function lighten(color: string, alpha: number) {\n if (color.startsWith('var(')) {\n return `color-mix(in srgb, ${color}, white ${alpha * 100}%)`;\n }\n\n const { r, g, b, a } = toRgba(color);\n\n const light = (input: number) => Math.round(input + (255 - input) * alpha);\n\n return `rgba(${light(r)}, ${light(g)}, ${light(b)}, ${a})`;\n}\n"],"names":[],"mappings":";;AAEO,SAAS,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE;AACtC,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;AAChC,IAAI,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC;AACjE,GAAG;AACH,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACvC,EAAE,MAAM,KAAK,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC;AACrE,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { toRgba } from '../to-rgba/to-rgba.mjs';
|
|
3
|
+
|
|
4
|
+
function gammaCorrect(c) {
|
|
5
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
6
|
+
}
|
|
7
|
+
function getLightnessFromOklch(oklchColor) {
|
|
8
|
+
const match = oklchColor.match(/oklch\((.*?)%\s/);
|
|
9
|
+
return match ? parseFloat(match[1]) : null;
|
|
10
|
+
}
|
|
11
|
+
function luminance(color) {
|
|
12
|
+
if (color.startsWith("oklch(")) {
|
|
13
|
+
return (getLightnessFromOklch(color) || 0) / 100;
|
|
14
|
+
}
|
|
15
|
+
const { r, g, b } = toRgba(color);
|
|
16
|
+
const sR = r / 255;
|
|
17
|
+
const sG = g / 255;
|
|
18
|
+
const sB = b / 255;
|
|
19
|
+
const rLinear = gammaCorrect(sR);
|
|
20
|
+
const gLinear = gammaCorrect(sG);
|
|
21
|
+
const bLinear = gammaCorrect(sB);
|
|
22
|
+
return 0.2126 * rLinear + 0.7152 * gLinear + 0.0722 * bLinear;
|
|
23
|
+
}
|
|
24
|
+
function isLightColor(color, luminanceThreshold = 0.179) {
|
|
25
|
+
if (color.startsWith("var(")) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return luminance(color) > luminanceThreshold;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { isLightColor, luminance };
|
|
32
|
+
//# sourceMappingURL=luminance.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luminance.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/luminance/luminance.ts"],"sourcesContent":["import { toRgba } from '../to-rgba/to-rgba';\n\nfunction gammaCorrect(c: number) {\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n}\n\nfunction getLightnessFromOklch(oklchColor: string) {\n const match = oklchColor.match(/oklch\\((.*?)%\\s/);\n return match ? parseFloat(match[1]) : null;\n}\n\nexport function luminance(color: string): number {\n if (color.startsWith('oklch(')) {\n return (getLightnessFromOklch(color) || 0) / 100;\n }\n\n const { r, g, b } = toRgba(color);\n\n const sR = r / 255;\n const sG = g / 255;\n const sB = b / 255;\n\n const rLinear = gammaCorrect(sR);\n const gLinear = gammaCorrect(sG);\n const bLinear = gammaCorrect(sB);\n\n return 0.2126 * rLinear + 0.7152 * gLinear + 0.0722 * bLinear;\n}\n\nexport function isLightColor(color: string, luminanceThreshold = 0.179) {\n if (color.startsWith('var(')) {\n return false;\n }\n\n return luminance(color) > luminanceThreshold;\n}\n"],"names":[],"mappings":";;;AAEA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAC,CAAC,CAAE,CAAA,CAAA;AACzB,CAAA,CAAE,OAAO,CAAC,CAAA,CAAA,CAAA,CAAI,OAAO,CAAG,CAAA,CAAA,CAAC,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CAAC,CAAC,CAAC,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,IAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAC;AACjE,CAAC;AACD,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAE,CAAA,CAAA;AAC3C,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAC,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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A,CAAG,KAAK,CAAE,CAAA,CAAA;AAChE,CAAA,CAAE,IAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,UAAU,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAC,CAAE,CAAA,CAAA;AAChC,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAC;AACjB,CAAG,CAAA,CAAA;AACH,CAAA,CAAE,OAAO,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,KAAK,CAAC,CAAA,CAAA,CAAG,kBAAkB,CAAC;AAC/C,CAAA;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { getPrimaryShade } from '../get-primary-shade/get-primary-shade.mjs';
|
|
3
|
+
import { isLightColor } from '../luminance/luminance.mjs';
|
|
3
4
|
|
|
4
5
|
function parseThemeColor({
|
|
5
6
|
color,
|
|
@@ -7,7 +8,35 @@ function parseThemeColor({
|
|
|
7
8
|
colorScheme
|
|
8
9
|
}) {
|
|
9
10
|
if (typeof color !== "string") {
|
|
10
|
-
throw new Error(
|
|
11
|
+
throw new Error(
|
|
12
|
+
`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof color}`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
if (color === "bright") {
|
|
16
|
+
return {
|
|
17
|
+
color,
|
|
18
|
+
value: colorScheme === "dark" ? theme.white : theme.black,
|
|
19
|
+
shade: void 0,
|
|
20
|
+
isThemeColor: false,
|
|
21
|
+
isLight: isLightColor(
|
|
22
|
+
colorScheme === "dark" ? theme.white : theme.black,
|
|
23
|
+
theme.luminanceThreshold
|
|
24
|
+
),
|
|
25
|
+
variable: "--mantine-color-bright"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (color === "dimmed") {
|
|
29
|
+
return {
|
|
30
|
+
color,
|
|
31
|
+
value: colorScheme === "dark" ? theme.colors.dark[2] : theme.colors.gray[7],
|
|
32
|
+
shade: void 0,
|
|
33
|
+
isThemeColor: false,
|
|
34
|
+
isLight: isLightColor(
|
|
35
|
+
colorScheme === "dark" ? theme.colors.dark[2] : theme.colors.gray[6],
|
|
36
|
+
theme.luminanceThreshold
|
|
37
|
+
),
|
|
38
|
+
variable: "--mantine-color-dimmed"
|
|
39
|
+
};
|
|
11
40
|
}
|
|
12
41
|
if (color === "white" || color === "black") {
|
|
13
42
|
return {
|
|
@@ -15,6 +44,10 @@ function parseThemeColor({
|
|
|
15
44
|
value: color === "white" ? theme.white : theme.black,
|
|
16
45
|
shade: void 0,
|
|
17
46
|
isThemeColor: false,
|
|
47
|
+
isLight: isLightColor(
|
|
48
|
+
color === "white" ? theme.white : theme.black,
|
|
49
|
+
theme.luminanceThreshold
|
|
50
|
+
),
|
|
18
51
|
variable: `--mantine-color-${color}`
|
|
19
52
|
};
|
|
20
53
|
}
|
|
@@ -22,11 +55,13 @@ function parseThemeColor({
|
|
|
22
55
|
const colorShade = shade ? Number(shade) : void 0;
|
|
23
56
|
const isThemeColor = _color in theme.colors;
|
|
24
57
|
if (isThemeColor) {
|
|
58
|
+
const colorValue = colorShade !== void 0 ? theme.colors[_color][colorShade] : theme.colors[_color][getPrimaryShade(theme, colorScheme || "light")];
|
|
25
59
|
return {
|
|
26
60
|
color: _color,
|
|
27
|
-
value:
|
|
61
|
+
value: colorValue,
|
|
28
62
|
shade: colorShade,
|
|
29
63
|
isThemeColor,
|
|
64
|
+
isLight: isLightColor(colorValue, theme.luminanceThreshold),
|
|
30
65
|
variable: shade ? `--mantine-color-${_color}-${colorShade}` : `--mantine-color-${_color}-filled`
|
|
31
66
|
};
|
|
32
67
|
}
|
|
@@ -34,6 +69,7 @@ function parseThemeColor({
|
|
|
34
69
|
color,
|
|
35
70
|
value: color,
|
|
36
71
|
isThemeColor,
|
|
72
|
+
isLight: isLightColor(color, theme.luminanceThreshold),
|
|
37
73
|
shade: colorShade,
|
|
38
74
|
variable: void 0
|
|
39
75
|
};
|
package/esm/core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-theme-color.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.ts"],"sourcesContent":["import type { CssVariable } from '../../../Box';\nimport type { MantineColorScheme, MantineColorShade, MantineTheme } from '../../theme.types';\nimport { getPrimaryShade } from '../get-primary-shade/get-primary-shade';\n\ninterface ParseThemeColorOptions {\n color: unknown;\n theme: MantineTheme;\n colorScheme?: MantineColorScheme;\n}\n\ninterface ParseThemeColorResult {\n color: string;\n value: string;\n shade: MantineColorShade | undefined;\n variable: CssVariable | undefined;\n isThemeColor: boolean;\n}\n\nexport function parseThemeColor({\n color,\n theme,\n colorScheme,\n}: ParseThemeColorOptions): ParseThemeColorResult {\n if (typeof color !== 'string') {\n throw new Error(`[@mantine/core] Failed to parse color. Instead got ${typeof color}`);\n }\n\n if (color === 'white' || color === 'black') {\n return {\n color,\n value: color === 'white' ? theme.white : theme.black,\n shade: undefined,\n isThemeColor: false,\n variable: `--mantine-color-${color}`,\n };\n }\n\n const [_color, shade] = color.split('.');\n const colorShade = shade ? (Number(shade) as MantineColorShade) : undefined;\n const isThemeColor = _color in theme.colors;\n\n if (isThemeColor) {\n return {\n color: _color,\n value:\n colorShade !== undefined\n ? theme.colors[_color][colorShade]\n : theme.colors[_color][getPrimaryShade(theme, colorScheme || 'light')],\n shade: colorShade,\n isThemeColor,\n variable: shade\n ? `--mantine-color-${_color}-${colorShade}`\n : `--mantine-color-${_color}-filled`,\n };\n }\n\n return {\n color,\n value: color,\n isThemeColor,\n shade: colorShade,\n variable: undefined,\n };\n}\n"],"names":[],"mappings":";;;AAEO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,eAAe,CAAC,CAAA;AAChC,CAAA,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA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I,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA;AAChB,CAAA,CAAA,CAAA,CAAI,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAChB,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAE,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACrB,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC;AACpB,CAAA,CAAA,CAAG,CAAC;AACJ,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"parse-theme-color.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.ts"],"sourcesContent":["import type { CssVariable } from '../../../Box';\nimport type { MantineColorScheme, MantineColorShade, MantineTheme } from '../../theme.types';\nimport { getPrimaryShade } from '../get-primary-shade/get-primary-shade';\nimport { isLightColor } from '../luminance/luminance';\n\ninterface ParseThemeColorOptions {\n color: unknown;\n theme: MantineTheme;\n colorScheme?: MantineColorScheme;\n}\n\ninterface ParseThemeColorResult {\n color: string;\n value: string;\n shade: MantineColorShade | undefined;\n variable: CssVariable | undefined;\n isThemeColor: boolean;\n isLight: boolean;\n}\n\nexport function parseThemeColor({\n color,\n theme,\n colorScheme,\n}: ParseThemeColorOptions): ParseThemeColorResult {\n if (typeof color !== 'string') {\n throw new Error(\n `[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof color}`\n );\n }\n\n if (color === 'bright') {\n return {\n color,\n value: colorScheme === 'dark' ? theme.white : theme.black,\n shade: undefined,\n isThemeColor: false,\n isLight: isLightColor(\n colorScheme === 'dark' ? theme.white : theme.black,\n theme.luminanceThreshold\n ),\n variable: '--mantine-color-bright',\n };\n }\n\n if (color === 'dimmed') {\n return {\n color,\n value: colorScheme === 'dark' ? theme.colors.dark[2] : theme.colors.gray[7],\n shade: undefined,\n isThemeColor: false,\n isLight: isLightColor(\n colorScheme === 'dark' ? theme.colors.dark[2] : theme.colors.gray[6],\n theme.luminanceThreshold\n ),\n variable: '--mantine-color-dimmed',\n };\n }\n\n if (color === 'white' || color === 'black') {\n return {\n color,\n value: color === 'white' ? theme.white : theme.black,\n shade: undefined,\n isThemeColor: false,\n isLight: isLightColor(\n color === 'white' ? theme.white : theme.black,\n theme.luminanceThreshold\n ),\n variable: `--mantine-color-${color}`,\n };\n }\n\n const [_color, shade] = color.split('.');\n const colorShade = shade ? (Number(shade) as MantineColorShade) : undefined;\n const isThemeColor = _color in theme.colors;\n\n if (isThemeColor) {\n const colorValue =\n colorShade !== undefined\n ? theme.colors[_color][colorShade]\n : theme.colors[_color][getPrimaryShade(theme, colorScheme || 'light')];\n\n return {\n color: _color,\n value: colorValue,\n shade: colorShade,\n isThemeColor,\n isLight: isLightColor(colorValue, theme.luminanceThreshold),\n variable: shade\n ? `--mantine-color-${_color}-${colorShade}`\n : `--mantine-color-${_color}-filled`,\n };\n }\n\n return {\n color,\n value: color,\n isThemeColor,\n isLight: isLightColor(color, theme.luminanceThreshold),\n shade: colorShade,\n variable: undefined,\n };\n}\n"],"names":[],"mappings":";;;;AAGO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,eAAe,CAAC,CAAA;AAChC,CAAA,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA;AACP,CAAA,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA;AACP,CAAA,CAAE,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACb,CAAC,CAAE,CAAA,CAAA;AACH,CAAA,CAAE,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACrB,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC;AACpB,CAAA,CAAA,CAAG,CAAC;AACJ,CAAA;;"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { toRgba } from '../to-rgba/to-rgba.mjs';
|
|
2
2
|
|
|
3
|
-
function rgba(color,
|
|
4
|
-
if (typeof color !== "string" ||
|
|
3
|
+
function rgba(color, alpha2) {
|
|
4
|
+
if (typeof color !== "string" || alpha2 > 1 || alpha2 < 0) {
|
|
5
5
|
return "rgba(0, 0, 0, 1)";
|
|
6
6
|
}
|
|
7
|
+
if (color.startsWith("var(")) {
|
|
8
|
+
const mixPercentage = (1 - alpha2) * 100;
|
|
9
|
+
return `color-mix(in srgb, ${color}, transparent ${mixPercentage}%)`;
|
|
10
|
+
}
|
|
11
|
+
if (color.startsWith("oklch")) {
|
|
12
|
+
if (color.includes("/")) {
|
|
13
|
+
return color.replace(/\/\s*[\d.]+\s*\)/, `/ ${alpha2})`);
|
|
14
|
+
}
|
|
15
|
+
return color.replace(")", ` / ${alpha2})`);
|
|
16
|
+
}
|
|
7
17
|
const { r, g, b } = toRgba(color);
|
|
8
|
-
return `rgba(${r}, ${g}, ${b}, ${
|
|
18
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha2})`;
|
|
9
19
|
}
|
|
20
|
+
const alpha = rgba;
|
|
10
21
|
|
|
11
|
-
export { rgba };
|
|
22
|
+
export { alpha, rgba };
|
|
12
23
|
//# sourceMappingURL=rgba.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rgba.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/rgba/rgba.ts"],"sourcesContent":["import { toRgba } from '../to-rgba/to-rgba';\n\nexport function rgba(color: string, alpha: number) {\n if (typeof color !== 'string' || alpha > 1 || alpha < 0) {\n return 'rgba(0, 0, 0, 1)';\n }\n\n const { r, g, b } = toRgba(color);\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n"],"names":[],"mappings":";;AAEO,SAAS,IAAI,CAAC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"rgba.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/rgba/rgba.ts"],"sourcesContent":["import { toRgba } from '../to-rgba/to-rgba';\n\nexport function rgba(color: string, alpha: number) {\n if (typeof color !== 'string' || alpha > 1 || alpha < 0) {\n return 'rgba(0, 0, 0, 1)';\n }\n\n if (color.startsWith('var(')) {\n const mixPercentage = (1 - alpha) * 100;\n return `color-mix(in srgb, ${color}, transparent ${mixPercentage}%)`;\n }\n\n if (color.startsWith('oklch')) {\n if (color.includes('/')) {\n return color.replace(/\\/\\s*[\\d.]+\\s*\\)/, `/ ${alpha})`);\n }\n\n return color.replace(')', ` / ${alpha})`);\n }\n\n const { r, g, b } = toRgba(color);\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n\nexport const alpha = rgba;\n"],"names":[],"mappings":";;AAEO,SAAS,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE;AACpC,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE;AAC7D,IAAI,OAAO,kBAAkB,CAAC;AAC9B,GAAG;AACH,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;AAChC,IAAI,MAAM,aAAa,GAAG,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,CAAC;AAC7C,IAAI,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,cAAc,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;AACzE,GAAG;AACH,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;AACjC,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC7B,MAAM,OAAO,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/D,KAAK;AACL,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,GAAG;AACH,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACpC,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AACW,MAAC,KAAK,GAAG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function isHexColor(hex) {
|
|
2
|
-
const HEX_REGEXP = /^#?([0-9A-F]{3}){1,2}
|
|
2
|
+
const HEX_REGEXP = /^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i;
|
|
3
3
|
return HEX_REGEXP.test(hex);
|
|
4
4
|
}
|
|
5
5
|
function hexToRgba(color) {
|
|
@@ -15,6 +15,15 @@ function hexToRgba(color) {
|
|
|
15
15
|
shorthandHex[2]
|
|
16
16
|
].join("");
|
|
17
17
|
}
|
|
18
|
+
if (hexString.length === 8) {
|
|
19
|
+
const alpha = parseInt(hexString.slice(6, 8), 16) / 255;
|
|
20
|
+
return {
|
|
21
|
+
r: parseInt(hexString.slice(0, 2), 16),
|
|
22
|
+
g: parseInt(hexString.slice(2, 4), 16),
|
|
23
|
+
b: parseInt(hexString.slice(4, 6), 16),
|
|
24
|
+
a: alpha
|
|
25
|
+
};
|
|
26
|
+
}
|
|
18
27
|
const parsed = parseInt(hexString, 16);
|
|
19
28
|
const r = parsed >> 16 & 255;
|
|
20
29
|
const g = parsed >> 8 & 255;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-rgba.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/to-rgba/to-rgba.ts"],"sourcesContent":["export interface RGBA {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\nfunction isHexColor(hex: string): boolean {\n const HEX_REGEXP = /^#?([0-9A-F]{3}){1,2}
|
|
1
|
+
{"version":3,"file":"to-rgba.mjs","sources":["../../../../../src/core/MantineProvider/color-functions/to-rgba/to-rgba.ts"],"sourcesContent":["export interface RGBA {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\nfunction isHexColor(hex: string): boolean {\n const HEX_REGEXP = /^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i;\n\n return HEX_REGEXP.test(hex);\n}\n\nfunction hexToRgba(color: string): RGBA {\n let hexString = color.replace('#', '');\n\n if (hexString.length === 3) {\n const shorthandHex = hexString.split('');\n hexString = [\n shorthandHex[0],\n shorthandHex[0],\n shorthandHex[1],\n shorthandHex[1],\n shorthandHex[2],\n shorthandHex[2],\n ].join('');\n }\n\n if (hexString.length === 8) {\n const alpha = parseInt(hexString.slice(6, 8), 16) / 255;\n\n return {\n r: parseInt(hexString.slice(0, 2), 16),\n g: parseInt(hexString.slice(2, 4), 16),\n b: parseInt(hexString.slice(4, 6), 16),\n a: alpha,\n };\n }\n\n const parsed = parseInt(hexString, 16);\n const r = (parsed >> 16) & 255;\n const g = (parsed >> 8) & 255;\n const b = parsed & 255;\n\n return {\n r,\n g,\n b,\n a: 1,\n };\n}\n\nfunction rgbStringToRgba(color: string): RGBA {\n const [r, g, b, a] = color\n .replace(/[^0-9,.]/g, '')\n .split(',')\n .map(Number);\n\n return { r, g, b, a: a || 1 };\n}\n\nfunction hslStringToRgba(hslaString: string): RGBA {\n const hslaRegex =\n /^hsla?\\(\\s*(\\d+)\\s*,\\s*(\\d+%)\\s*,\\s*(\\d+%)\\s*(,\\s*(0?\\.\\d+|\\d+(\\.\\d+)?))?\\s*\\)$/i;\n\n const matches = hslaString.match(hslaRegex);\n if (!matches) {\n return {\n r: 0,\n g: 0,\n b: 0,\n a: 1,\n };\n }\n\n const h = parseInt(matches[1], 10);\n const s = parseInt(matches[2], 10) / 100;\n const l = parseInt(matches[3], 10) / 100;\n const a = matches[5] ? parseFloat(matches[5]) : undefined;\n\n const chroma = (1 - Math.abs(2 * l - 1)) * s;\n const huePrime = h / 60;\n const x = chroma * (1 - Math.abs((huePrime % 2) - 1));\n const m = l - chroma / 2;\n\n let r: number;\n let g: number;\n let b: number;\n\n if (huePrime >= 0 && huePrime < 1) {\n r = chroma;\n g = x;\n b = 0;\n } else if (huePrime >= 1 && huePrime < 2) {\n r = x;\n g = chroma;\n b = 0;\n } else if (huePrime >= 2 && huePrime < 3) {\n r = 0;\n g = chroma;\n b = x;\n } else if (huePrime >= 3 && huePrime < 4) {\n r = 0;\n g = x;\n b = chroma;\n } else if (huePrime >= 4 && huePrime < 5) {\n r = x;\n g = 0;\n b = chroma;\n } else {\n r = chroma;\n g = 0;\n b = x;\n }\n\n return {\n r: Math.round((r + m) * 255),\n g: Math.round((g + m) * 255),\n b: Math.round((b + m) * 255),\n a: a || 1,\n };\n}\n\nexport function toRgba(color: string): RGBA {\n if (isHexColor(color)) {\n return hexToRgba(color);\n }\n\n if (color.startsWith('rgb')) {\n return rgbStringToRgba(color);\n }\n\n if (color.startsWith('hsl')) {\n return hslStringToRgba(color);\n }\n\n return {\n r: 0,\n g: 0,\n b: 0,\n a: 1,\n };\n}\n"],"names":[],"mappings":"AACA,SAAS,UAAU,CAAC,GAAG,EAAE;AACzB,EAAE,MAAM,UAAU,GAAG,uCAAuC,CAAC;AAC7D,EAAE,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AACD,SAAS,SAAS,CAAC,KAAK,EAAE;AAC1B,EAAE,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACz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DEFAULT_THEME = {
|
|
|
14
14
|
primaryShade: { light: 6, dark: 8 },
|
|
15
15
|
primaryColor: "blue",
|
|
16
16
|
variantColorResolver: defaultVariantColorsResolver,
|
|
17
|
+
autoContrast: false,
|
|
18
|
+
luminanceThreshold: 0.3,
|
|
17
19
|
fontFamily: DEFAULT_FONT_FAMILY,
|
|
18
20
|
fontFamilyMonospace: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",
|
|
19
21
|
respectReducedMotion: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-theme.mjs","sources":["../../../src/core/MantineProvider/default-theme.ts"],"sourcesContent":["import { rem } from '../utils';\nimport { defaultVariantColorsResolver } from './color-functions';\nimport { DEFAULT_COLORS } from './default-colors';\nimport type { MantineTheme } from './theme.types';\n\nconst DEFAULT_FONT_FAMILY =\n '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji';\n\nexport const DEFAULT_THEME: MantineTheme = {\n scale: 1,\n fontSmoothing: true,\n focusRing: 'auto',\n white: '#fff',\n black: '#000',\n colors: DEFAULT_COLORS,\n primaryShade: { light: 6, dark: 8 },\n primaryColor: 'blue',\n variantColorResolver: defaultVariantColorsResolver,\n fontFamily: DEFAULT_FONT_FAMILY,\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace',\n respectReducedMotion: false,\n cursorType: 'default',\n defaultGradient: { from: 'blue', to: 'cyan', deg: 45 },\n defaultRadius: 'sm',\n activeClassName: 'mantine-active',\n focusClassName: '',\n\n headings: {\n fontFamily: DEFAULT_FONT_FAMILY,\n fontWeight: '700',\n sizes: {\n h1: { fontSize: rem(34), lineHeight: '1.3' },\n h2: { fontSize: rem(26), lineHeight: '1.35' },\n h3: { fontSize: rem(22), lineHeight: '1.4' },\n h4: { fontSize: rem(18), lineHeight: '1.45' },\n h5: { fontSize: rem(16), lineHeight: '1.5' },\n h6: { fontSize: rem(14), lineHeight: '1.5' },\n },\n },\n\n fontSizes: {\n xs: rem(12),\n sm: rem(14),\n md: rem(16),\n lg: rem(18),\n xl: rem(20),\n },\n\n lineHeights: {\n xs: '1.4',\n sm: '1.45',\n md: '1.55',\n lg: '1.6',\n xl: '1.65',\n },\n\n radius: {\n xs: rem(2),\n sm: rem(4),\n md: rem(8),\n lg: rem(16),\n xl: rem(32),\n },\n\n spacing: {\n xs: rem(10),\n sm: rem(12),\n md: rem(16),\n lg: rem(20),\n xl: rem(32),\n },\n\n breakpoints: {\n xs: '36em',\n sm: '48em',\n md: '62em',\n lg: '75em',\n xl: '88em',\n },\n\n shadows: {\n xs: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), 0 ${rem(1)} ${rem(2)} rgba(0, 0, 0, 0.1)`,\n sm: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(10)} ${rem(\n 15\n )} ${rem(-5)}, rgba(0, 0, 0, 0.04) 0 ${rem(7)} ${rem(7)} ${rem(-5)}`,\n md: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(20)} ${rem(\n 25\n )} ${rem(-5)}, rgba(0, 0, 0, 0.04) 0 ${rem(10)} ${rem(10)} ${rem(-5)}`,\n lg: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(28)} ${rem(\n 23\n )} ${rem(-7)}, rgba(0, 0, 0, 0.04) 0 ${rem(12)} ${rem(12)} ${rem(-7)}`,\n xl: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(36)} ${rem(\n 28\n )} ${rem(-7)}, rgba(0, 0, 0, 0.04) 0 ${rem(17)} ${rem(17)} ${rem(-7)}`,\n },\n\n other: {},\n components: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AE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,4CAA4C,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG;AAC1F,MAAM,EAAE;AACR,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,4CAA4C,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG;AAC1F,MAAM,EAAE;AACR,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,GAAG;AACH,EAAE,KAAK,EAAE,EAAE;AACX,EAAE,UAAU,EAAE,EAAE;AAChB;;;;"}
|
|
1
|
+
{"version":3,"file":"default-theme.mjs","sources":["../../../src/core/MantineProvider/default-theme.ts"],"sourcesContent":["import { rem } from '../utils';\nimport { defaultVariantColorsResolver } from './color-functions';\nimport { DEFAULT_COLORS } from './default-colors';\nimport type { MantineTheme } from './theme.types';\n\nconst DEFAULT_FONT_FAMILY =\n '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji';\n\nexport const DEFAULT_THEME: MantineTheme = {\n scale: 1,\n fontSmoothing: true,\n focusRing: 'auto',\n white: '#fff',\n black: '#000',\n colors: DEFAULT_COLORS,\n primaryShade: { light: 6, dark: 8 },\n primaryColor: 'blue',\n variantColorResolver: defaultVariantColorsResolver,\n autoContrast: false,\n luminanceThreshold: 0.3,\n fontFamily: DEFAULT_FONT_FAMILY,\n fontFamilyMonospace:\n 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace',\n respectReducedMotion: false,\n cursorType: 'default',\n defaultGradient: { from: 'blue', to: 'cyan', deg: 45 },\n defaultRadius: 'sm',\n activeClassName: 'mantine-active',\n focusClassName: '',\n\n headings: {\n fontFamily: DEFAULT_FONT_FAMILY,\n fontWeight: '700',\n sizes: {\n h1: { fontSize: rem(34), lineHeight: '1.3' },\n h2: { fontSize: rem(26), lineHeight: '1.35' },\n h3: { fontSize: rem(22), lineHeight: '1.4' },\n h4: { fontSize: rem(18), lineHeight: '1.45' },\n h5: { fontSize: rem(16), lineHeight: '1.5' },\n h6: { fontSize: rem(14), lineHeight: '1.5' },\n },\n },\n\n fontSizes: {\n xs: rem(12),\n sm: rem(14),\n md: rem(16),\n lg: rem(18),\n xl: rem(20),\n },\n\n lineHeights: {\n xs: '1.4',\n sm: '1.45',\n md: '1.55',\n lg: '1.6',\n xl: '1.65',\n },\n\n radius: {\n xs: rem(2),\n sm: rem(4),\n md: rem(8),\n lg: rem(16),\n xl: rem(32),\n },\n\n spacing: {\n xs: rem(10),\n sm: rem(12),\n md: rem(16),\n lg: rem(20),\n xl: rem(32),\n },\n\n breakpoints: {\n xs: '36em',\n sm: '48em',\n md: '62em',\n lg: '75em',\n xl: '88em',\n },\n\n shadows: {\n xs: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), 0 ${rem(1)} ${rem(2)} rgba(0, 0, 0, 0.1)`,\n sm: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(10)} ${rem(\n 15\n )} ${rem(-5)}, rgba(0, 0, 0, 0.04) 0 ${rem(7)} ${rem(7)} ${rem(-5)}`,\n md: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(20)} ${rem(\n 25\n )} ${rem(-5)}, rgba(0, 0, 0, 0.04) 0 ${rem(10)} ${rem(10)} ${rem(-5)}`,\n lg: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(28)} ${rem(\n 23\n )} ${rem(-7)}, rgba(0, 0, 0, 0.04) 0 ${rem(12)} ${rem(12)} ${rem(-7)}`,\n xl: `0 ${rem(1)} ${rem(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${rem(36)} ${rem(\n 28\n )} ${rem(-7)}, rgba(0, 0, 0, 0.04) 0 ${rem(17)} ${rem(17)} ${rem(-7)}`,\n },\n\n other: {},\n components: {},\n};\n"],"names":[],"mappings":";;;;;AAIA,MAAM,mBAAmB,GAAG,sHAAsH,CAAC;AACvI,MAAC,aAAa,GAAG;AAC7B,EAAE,KAAK,EAAE,CAAC;AACV,EAAE,aAAa,EAAE,IAAI;AACrB,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,MAAM,EAAE,cAAc;AACxB,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;AACrC,EAAE,YAAY,EAAE,MAAM;AACtB,EAAE,oBAAoB,EAAE,4BAA4B;AACpD,EAAE,YAAY,EAAE,KAAK;AACrB,EAAE,kBAAkB,EAAE,GAAG;AACzB,EAAE,UAAU,EAAE,mBAAmB;AACjC,EAAE,mBAAmB,EAAE,gGAAgG;AACvH,EAAE,oBAAoB,EAAE,KAAK;AAC7B,EAAE,UAAU,EAAE,SAAS;AACvB,EAAE,eAAe,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GA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AAC,wBAAwB,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,GAAG;AACH,EAAE,KAAK,EAAE,EAAE;AACX,EAAE,UAAU,EAAE,EAAE;AAChB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-mantine-theme.mjs","sources":["../../../../src/core/MantineProvider/merge-mantine-theme/merge-mantine-theme.ts"],"sourcesContent":["import { deepMerge } from '../../utils';\nimport type { MantineTheme, MantineThemeOverride } from '../theme.types';\n\nexport const INVALID_PRIMARY_COLOR_ERROR =\n '[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color';\n\nexport const INVALID_PRIMARY_SHADE_ERROR =\n '[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }';\n\nfunction isValidPrimaryShade(shade: number) {\n if (shade < 0 || shade > 9) {\n return false;\n }\n\n return parseInt(shade.toString(), 10) === shade;\n}\n\nexport function validateMantineTheme(theme: MantineTheme): asserts theme is MantineTheme {\n if (!(theme.primaryColor in theme.colors)) {\n throw new Error(INVALID_PRIMARY_COLOR_ERROR);\n }\n\n if (typeof theme.primaryShade === 'object') {\n if (\n !isValidPrimaryShade(theme.primaryShade.dark) ||\n !isValidPrimaryShade(theme.primaryShade.light)\n ) {\n throw new Error(INVALID_PRIMARY_SHADE_ERROR);\n }\n }\n\n if (typeof theme.primaryShade === 'number' && !isValidPrimaryShade(theme.primaryShade)) {\n throw new Error(INVALID_PRIMARY_SHADE_ERROR);\n }\n}\n\nexport function mergeMantineTheme(\n currentTheme: MantineTheme,\n themeOverride?: MantineThemeOverride\n) {\n if (!themeOverride) {\n validateMantineTheme(currentTheme);\n return currentTheme;\n }\n\n const result = deepMerge(currentTheme, themeOverride);\n\n if (themeOverride.fontFamily && !themeOverride.headings?.fontFamily) {\n result.headings.fontFamily = themeOverride.fontFamily;\n }\n\n validateMantineTheme(result);\n return result;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge-mantine-theme.mjs","sources":["../../../../src/core/MantineProvider/merge-mantine-theme/merge-mantine-theme.ts"],"sourcesContent":["import { deepMerge } from '../../utils';\nimport type { MantineTheme, MantineThemeOverride } from '../theme.types';\n\nexport const INVALID_PRIMARY_COLOR_ERROR =\n '[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color';\n\nexport const INVALID_PRIMARY_SHADE_ERROR =\n '[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }';\n\nfunction isValidPrimaryShade(shade: number) {\n if (shade < 0 || shade > 9) {\n return false;\n }\n\n return parseInt(shade.toString(), 10) === shade;\n}\n\nexport function validateMantineTheme(theme: MantineTheme): asserts theme is MantineTheme {\n if (!(theme.primaryColor in theme.colors)) {\n throw new Error(INVALID_PRIMARY_COLOR_ERROR);\n }\n\n if (typeof theme.primaryShade === 'object') {\n if (\n !isValidPrimaryShade(theme.primaryShade.dark) ||\n !isValidPrimaryShade(theme.primaryShade.light)\n ) {\n throw new Error(INVALID_PRIMARY_SHADE_ERROR);\n }\n }\n\n if (typeof theme.primaryShade === 'number' && !isValidPrimaryShade(theme.primaryShade)) {\n throw new Error(INVALID_PRIMARY_SHADE_ERROR);\n }\n}\n\nexport function mergeMantineTheme(\n currentTheme: MantineTheme,\n themeOverride?: MantineThemeOverride\n) {\n if (!themeOverride) {\n validateMantineTheme(currentTheme);\n return currentTheme;\n }\n\n const result = deepMerge(currentTheme, themeOverride);\n\n if (themeOverride.fontFamily && !themeOverride.headings?.fontFamily) {\n result.headings.fontFamily = themeOverride.fontFamily;\n }\n\n validateMantineTheme(result);\n return result;\n}\n"],"names":[],"mappings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;AACxD,EAAE,IAAI,aAAa,CAAC,UAAU,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE;AACvE,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC;AAC1D,GAAG;AACH,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC/B,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-merge.mjs","sources":["../../../../src/core/utils/deep-merge/deep-merge.ts"],"sourcesContent":["function isObject(item: unknown) {\n return item && typeof item === 'object' && !Array.isArray(item);\n}\n\nexport function deepMerge<T extends object>(target: T, source: any): T {\n const result: Record<string, any> = { ...target };\n const _source: Record<string, any> = source;\n\n if (isObject(target) && isObject(source)) {\n Object.keys(source).forEach((key) => {\n if (isObject(_source[key])) {\n if (!(key in target)) {\n result[key] = _source[key];\n } else {\n result[key] = deepMerge(result[key], _source[key]);\n }\n } else {\n result[key] = _source[key];\n }\n });\n }\n\n return result as T;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deep-merge.mjs","sources":["../../../../src/core/utils/deep-merge/deep-merge.ts"],"sourcesContent":["function isObject(item: unknown) {\n return item && typeof item === 'object' && !Array.isArray(item);\n}\n\nexport function deepMerge<T extends object>(target: T, source: any): T {\n const result: Record<string, any> = { ...target };\n const _source: Record<string, any> = source;\n\n if (isObject(target) && isObject(source)) {\n Object.keys(source).forEach((key) => {\n if (isObject(_source[key])) {\n if (!(key in target)) {\n result[key] = _source[key];\n } else {\n result[key] = deepMerge(result[key], _source[key]);\n }\n } else {\n result[key] = _source[key];\n }\n });\n }\n\n return result as T;\n}\n"],"names":[],"mappings":"AACA,SAAS,QAAQ,CAAC,IAAI,EAAE;AACxB,EAAE,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AACM,SAAS,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE;AAC1C,EAAE,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;AAC/B,EAAE,MAAM,OAAO,GAAG,MAAM,CAAC;AACzB,EAAE,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;AAC5C,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK;AACzC,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE;AAClC,QAAQ,IAAI,EAAE,GAAG,IAAI,MAAM,CAAC,EAAE;AAC9B,UAAU,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AACrC,SAAS,MAAM;AACf,UAAU,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,SAAS;AACT,OAAO,MAAM;AACb,QAAQ,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AACnC,OAAO;AACP,KAAK,CAAC,CAAC;AACP,GAAG;AACH,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/esm/index.mjs
CHANGED
|
@@ -38,10 +38,11 @@ export { getThemeColor } from './core/MantineProvider/color-functions/get-theme-
|
|
|
38
38
|
export { defaultVariantColorsResolver } from './core/MantineProvider/color-functions/default-variant-colors-resolver/default-variant-colors-resolver.mjs';
|
|
39
39
|
export { getGradient } from './core/MantineProvider/color-functions/get-gradient/get-gradient.mjs';
|
|
40
40
|
export { toRgba } from './core/MantineProvider/color-functions/to-rgba/to-rgba.mjs';
|
|
41
|
-
export { rgba } from './core/MantineProvider/color-functions/rgba/rgba.mjs';
|
|
41
|
+
export { alpha, rgba } from './core/MantineProvider/color-functions/rgba/rgba.mjs';
|
|
42
42
|
export { darken } from './core/MantineProvider/color-functions/darken/darken.mjs';
|
|
43
43
|
export { lighten } from './core/MantineProvider/color-functions/lighten/lighten.mjs';
|
|
44
|
-
export { isLightColor } from './core/MantineProvider/color-functions/
|
|
44
|
+
export { isLightColor, luminance } from './core/MantineProvider/color-functions/luminance/luminance.mjs';
|
|
45
|
+
export { getContrastColor, getPrimaryContrastColor } from './core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.mjs';
|
|
45
46
|
export { useMantineColorScheme } from './core/MantineProvider/use-mantine-color-scheme/use-mantine-color-scheme.mjs';
|
|
46
47
|
export { useProviderColorScheme } from './core/MantineProvider/use-mantine-color-scheme/use-provider-color-scheme.mjs';
|
|
47
48
|
export { useComputedColorScheme } from './core/MantineProvider/use-mantine-color-scheme/use-computed-color-scheme.mjs';
|
package/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -26,6 +26,8 @@ export interface ActionIconProps extends BoxProps, StylesApiProps<ActionIconFact
|
|
|
26
26
|
disabled?: boolean;
|
|
27
27
|
/** Icon displayed inside the button */
|
|
28
28
|
children?: React.ReactNode;
|
|
29
|
+
/** Determines whether button text color with filled variant should depend on `background-color`. If luminosity of the `color` prop is less than `theme.luminosityThreshold`, then `theme.white` will be used for text color, otherwise `theme.black`. Overrides `theme.autoContrast`. */
|
|
30
|
+
autoContrast?: boolean;
|
|
29
31
|
}
|
|
30
32
|
export type ActionIconFactory = PolymorphicFactory<{
|
|
31
33
|
props: ActionIconProps;
|
|
@@ -20,6 +20,8 @@ export interface AlertProps extends BoxProps, StylesApiProps<AlertFactory>, Elem
|
|
|
20
20
|
onClose?: () => void;
|
|
21
21
|
/** Close button `aria-label` */
|
|
22
22
|
closeButtonLabel?: string;
|
|
23
|
+
/** Determines whether text color with filled variant should depend on `background-color`. If luminosity of the `color` prop is less than `theme.luminosityThreshold`, then `theme.white` will be used for text color, otherwise `theme.black`. Overrides `theme.autoContrast`. */
|
|
24
|
+
autoContrast?: boolean;
|
|
23
25
|
}
|
|
24
26
|
export type AlertFactory = Factory<{
|
|
25
27
|
props: AlertProps;
|
|
@@ -23,6 +23,8 @@ export interface AvatarProps extends BoxProps, StylesApiProps<AvatarFactory> {
|
|
|
23
23
|
imageProps?: React.ComponentPropsWithoutRef<'img'>;
|
|
24
24
|
/** Avatar placeholder, displayed when `src={null}` or when the image cannot be loaded */
|
|
25
25
|
children?: React.ReactNode;
|
|
26
|
+
/** Determines whether text color with filled variant should depend on `background-color`. If luminosity of the `color` prop is less than `theme.luminosityThreshold`, then `theme.white` will be used for text color, otherwise `theme.black`. Overrides `theme.autoContrast`. */
|
|
27
|
+
autoContrast?: boolean;
|
|
26
28
|
}
|
|
27
29
|
export type AvatarFactory = PolymorphicFactory<{
|
|
28
30
|
props: AvatarProps;
|
|
@@ -8,6 +8,8 @@ export type BadgeCssVariables = {
|
|
|
8
8
|
export interface BadgeProps extends BoxProps, StylesApiProps<BadgeFactory> {
|
|
9
9
|
/** Controls `font-size`, `height` and horizontal `padding`, `'md'` by default */
|
|
10
10
|
size?: MantineSize | (string & {});
|
|
11
|
+
/** If set, badge `min-width` becomes equal to its `height` and horizontal padding is removed */
|
|
12
|
+
circle?: boolean;
|
|
11
13
|
/** Key of `theme.radius` or any valid CSS value to set `border-radius`, `'xl'` by default */
|
|
12
14
|
radius?: MantineRadius;
|
|
13
15
|
/** Key of `theme.colors` or any valid CSS color, `theme.primaryColor` by default */
|
|
@@ -22,6 +24,8 @@ export interface BadgeProps extends BoxProps, StylesApiProps<BadgeFactory> {
|
|
|
22
24
|
fullWidth?: boolean;
|
|
23
25
|
/** Main badge content */
|
|
24
26
|
children?: React.ReactNode;
|
|
27
|
+
/** Determines whether text color with filled variant should depend on `background-color`. If luminosity of the `color` prop is less than `theme.luminosityThreshold`, then `theme.white` will be used for text color, otherwise `theme.black`. Overrides `theme.autoContrast`. */
|
|
28
|
+
autoContrast?: boolean;
|
|
25
29
|
}
|
|
26
30
|
export type BadgeFactory = PolymorphicFactory<{
|
|
27
31
|
props: BadgeProps;
|
|
@@ -33,6 +33,8 @@ export interface ButtonProps extends BoxProps, StylesApiProps<ButtonFactory> {
|
|
|
33
33
|
loading?: boolean;
|
|
34
34
|
/** Props added to the `Loader` component (only visible when `loading` prop is set) */
|
|
35
35
|
loaderProps?: LoaderProps;
|
|
36
|
+
/** Determines whether button text color with filled variant should depend on `background-color`. If luminosity of the `color` prop is less than `theme.luminosityThreshold`, then `theme.white` will be used for text color, otherwise `theme.black`. Overrides `theme.autoContrast`. */
|
|
37
|
+
autoContrast?: boolean;
|
|
36
38
|
}
|
|
37
39
|
export type ButtonFactory = PolymorphicFactory<{
|
|
38
40
|
props: ButtonProps;
|
|
@@ -8,13 +8,13 @@ export type CheckboxCssVariables = {
|
|
|
8
8
|
root: '--checkbox-size' | '--checkbox-radius' | '--checkbox-color' | '--checkbox-icon-color';
|
|
9
9
|
};
|
|
10
10
|
export interface CheckboxProps extends BoxProps, StylesApiProps<CheckboxFactory>, ElementProps<'input', 'size'> {
|
|
11
|
-
/** Id used to
|
|
11
|
+
/** Id used to connect input with the label. If not set, unique id is generated instead. */
|
|
12
12
|
id?: string;
|
|
13
|
-
/**
|
|
13
|
+
/** Content of the `label` associated with the checkbox */
|
|
14
14
|
label?: React.ReactNode;
|
|
15
15
|
/** Key of `theme.colors` or any valid CSS color to set input background color in checked state, `theme.primaryColor` by default */
|
|
16
16
|
color?: MantineColor;
|
|
17
|
-
/** Controls size of
|
|
17
|
+
/** Controls size of the component, `'sm'` by default */
|
|
18
18
|
size?: MantineSize | (string & {});
|
|
19
19
|
/** Key of `theme.radius` or any valid CSS value to set `border-radius,` `theme.defaultRadius` by default */
|
|
20
20
|
radius?: MantineRadius;
|
|
@@ -24,19 +24,21 @@ export interface CheckboxProps extends BoxProps, StylesApiProps<CheckboxFactory>
|
|
|
24
24
|
labelPosition?: 'left' | 'right';
|
|
25
25
|
/** Description displayed below the label */
|
|
26
26
|
description?: React.ReactNode;
|
|
27
|
-
/** Error displayed below the label */
|
|
27
|
+
/** Error message displayed below the label */
|
|
28
28
|
error?: React.ReactNode;
|
|
29
|
-
/** Indeterminate state of checkbox
|
|
29
|
+
/** Indeterminate state of the checkbox. If set, `checked` prop is ignored. */
|
|
30
30
|
indeterminate?: boolean;
|
|
31
|
-
/** Icon
|
|
31
|
+
/** Icon displayed when checkbox is in checked or indeterminate state */
|
|
32
32
|
icon?: React.FC<{
|
|
33
33
|
indeterminate: boolean | undefined;
|
|
34
34
|
className: string;
|
|
35
35
|
}>;
|
|
36
|
-
/** Assigns ref of the root element
|
|
36
|
+
/** Assigns ref of the root element */
|
|
37
37
|
rootRef?: React.ForwardedRef<HTMLDivElement>;
|
|
38
|
-
/** Key of `theme.colors` or any valid CSS color to set icon color, `theme.
|
|
38
|
+
/** Key of `theme.colors` or any valid CSS color to set icon color, by default value depends on `theme.autoContrast` */
|
|
39
39
|
iconColor?: MantineColor;
|
|
40
|
+
/** Determines whether icon color with filled variant should depend on `background-color`. If luminosity of the `color` prop is less than `theme.luminosityThreshold`, then `theme.white` will be used for text color, otherwise `theme.black`. Overrides `theme.autoContrast`. */
|
|
41
|
+
autoContrast?: boolean;
|
|
40
42
|
}
|
|
41
43
|
export type CheckboxFactory = Factory<{
|
|
42
44
|
props: CheckboxProps;
|
|
@@ -3,15 +3,15 @@ import { Factory, MantineSize } from '../../../core';
|
|
|
3
3
|
import { InputWrapperProps, InputWrapperStylesNames } from '../../Input';
|
|
4
4
|
export type CheckboxGroupStylesNames = InputWrapperStylesNames;
|
|
5
5
|
export interface CheckboxGroupProps extends Omit<InputWrapperProps, 'onChange'> {
|
|
6
|
-
/** `Checkbox` components */
|
|
6
|
+
/** `Checkbox` components and any other elements */
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/** Controlled component value */
|
|
9
9
|
value?: string[];
|
|
10
10
|
/** Default value for uncontrolled component */
|
|
11
11
|
defaultValue?: string[];
|
|
12
|
-
/** Called when value changes */
|
|
12
|
+
/** Called with an array of selected checkboxes values when value changes */
|
|
13
13
|
onChange?: (value: string[]) => void;
|
|
14
|
-
/** Props passed down to the `Input.Wrapper` */
|
|
14
|
+
/** Props passed down to the root element (`Input.Wrapper` component) */
|
|
15
15
|
wrapperProps?: Record<string, any>;
|
|
16
16
|
/** Controls size of the `Input.Wrapper`, `'sm'` by default */
|
|
17
17
|
size?: MantineSize | (string & {});
|