@vaneui/ui 0.0.13 → 0.0.14
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 +144 -1
- package/dist/all.css +1711 -86
- package/dist/complex.css +2697 -3
- package/dist/components/theme/components/theme/index.d.ts +1 -0
- package/dist/components/theme/components/theme/themeContext.d.ts +46 -0
- package/dist/components/theme/components/ui/classes/appearanceClasses.d.ts +13 -0
- package/dist/components/theme/components/ui/classes/layoutClasses.d.ts +13 -0
- package/dist/components/theme/components/ui/classes/spacingClasses.d.ts +2 -0
- package/dist/components/theme/components/ui/classes/typographyClasses.d.ts +10 -0
- package/dist/components/theme/components/ui/props/keys.d.ts +79 -0
- package/dist/components/theme/components/ui/props/props.d.ts +42 -0
- package/dist/components/theme/components/ui/theme/appearance/layoutAppearanceTheme.d.ts +10 -0
- package/dist/components/theme/components/ui/theme/appearance/textAppearanceTheme.d.ts +10 -0
- package/dist/components/theme/components/ui/theme/appearance/variantTheme.d.ts +15 -0
- package/dist/components/theme/components/ui/theme/badgeTheme.d.ts +32 -0
- package/dist/components/theme/components/ui/theme/buttonTheme.d.ts +32 -0
- package/dist/components/theme/components/ui/theme/cardTheme.d.ts +37 -0
- package/dist/components/theme/components/ui/theme/chipTheme.d.ts +32 -0
- package/dist/components/theme/components/ui/theme/colTheme.d.ts +15 -0
- package/dist/components/theme/components/ui/theme/common/ComponentTheme.d.ts +44 -0
- package/dist/components/theme/components/ui/theme/common/baseTheme.d.ts +12 -0
- package/dist/components/theme/components/ui/theme/containerTheme.d.ts +29 -0
- package/dist/components/theme/components/ui/theme/dividerTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/gridTheme.d.ts +10 -0
- package/dist/components/theme/components/ui/theme/layout/borderTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/directionTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/hideTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/itemsTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/justifyTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/positionTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/radiusTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/ringTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/shadowTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/layout/wrapTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/rowTheme.d.ts +15 -0
- package/dist/components/theme/components/ui/theme/sectionTheme.d.ts +19 -0
- package/dist/components/theme/components/ui/theme/size/breakpointTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/size/gapTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/size/pxTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/size/pyTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/size/sizeTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/stackTheme.d.ts +19 -0
- package/dist/components/theme/components/ui/theme/typography/fontFamilyTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/typography/fontStyleTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/typography/fontWeightTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/typography/textAlignTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/typography/textDecorationTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/typography/textTransformTheme.d.ts +9 -0
- package/dist/components/theme/components/ui/theme/typographyComponentTheme.d.ts +22 -0
- package/dist/components/theme/components/utils/componentUtils.d.ts +4 -0
- package/dist/components/theme/components/utils/deepMerge.d.ts +4 -0
- package/dist/components/theme/components/utils/deepPartial.d.ts +3 -0
- package/dist/components/theme/index.d.ts +1 -0
- package/dist/components/theme/index.js +1827 -0
- package/dist/components/theme/index.js.map +1 -0
- package/dist/components/theme/themeContext.d.ts +46 -0
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/button.d.ts +3 -3
- package/dist/components/ui/card.d.ts +3 -0
- package/dist/components/ui/chip.d.ts +3 -3
- package/dist/components/ui/classes/appearanceClasses.d.ts +13 -0
- package/dist/components/ui/classes/layoutClasses.d.ts +13 -0
- package/dist/components/ui/classes/spacingClasses.d.ts +2 -0
- package/dist/components/ui/classes/typographyClasses.d.ts +10 -0
- package/dist/components/ui/col.d.ts +10 -0
- package/dist/components/ui/container.d.ts +3 -0
- package/dist/components/ui/divider.d.ts +3 -3
- package/dist/components/ui/grid.d.ts +4 -0
- package/dist/components/ui/layout.d.ts +7 -8
- package/dist/components/ui/props/keys.d.ts +79 -0
- package/dist/components/ui/props/props.d.ts +41 -107
- package/dist/components/ui/row.d.ts +3 -0
- package/dist/components/ui/section.d.ts +3 -0
- package/dist/components/ui/stack.d.ts +3 -0
- package/dist/components/ui/theme/appearance/layoutAppearanceTheme.d.ts +10 -0
- package/dist/components/ui/theme/appearance/textAppearanceTheme.d.ts +10 -0
- package/dist/components/ui/theme/appearance/variantTheme.d.ts +15 -0
- package/dist/components/ui/theme/badgeTheme.d.ts +32 -0
- package/dist/components/ui/theme/buttonTheme.d.ts +32 -0
- package/dist/components/ui/theme/cardTheme.d.ts +37 -0
- package/dist/components/ui/theme/chipTheme.d.ts +32 -0
- package/dist/components/ui/theme/colTheme.d.ts +15 -0
- package/dist/components/ui/theme/common/ComponentTheme.d.ts +44 -0
- package/dist/components/ui/theme/common/baseTheme.d.ts +12 -0
- package/dist/components/ui/theme/containerTheme.d.ts +29 -0
- package/dist/components/ui/theme/dividerTheme.d.ts +9 -0
- package/dist/components/ui/theme/gridTheme.d.ts +10 -0
- package/dist/components/ui/theme/layout/borderTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/directionTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/hideTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/itemsTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/justifyTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/positionTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/radiusTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/ringTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/shadowTheme.d.ts +9 -0
- package/dist/components/ui/theme/layout/wrapTheme.d.ts +9 -0
- package/dist/components/ui/theme/rowTheme.d.ts +15 -0
- package/dist/components/ui/theme/sectionTheme.d.ts +19 -0
- package/dist/components/ui/theme/size/breakpointTheme.d.ts +9 -0
- package/dist/components/ui/theme/size/gapTheme.d.ts +9 -0
- package/dist/components/ui/theme/size/pxTheme.d.ts +9 -0
- package/dist/components/ui/theme/size/pyTheme.d.ts +9 -0
- package/dist/components/ui/theme/size/sizeTheme.d.ts +9 -0
- package/dist/components/ui/theme/stackTheme.d.ts +19 -0
- package/dist/components/ui/theme/typography/fontFamilyTheme.d.ts +9 -0
- package/dist/components/ui/theme/typography/fontStyleTheme.d.ts +9 -0
- package/dist/components/ui/theme/typography/fontWeightTheme.d.ts +9 -0
- package/dist/components/ui/theme/typography/textAlignTheme.d.ts +9 -0
- package/dist/components/ui/theme/typography/textDecorationTheme.d.ts +9 -0
- package/dist/components/ui/theme/typography/textTransformTheme.d.ts +9 -0
- package/dist/components/ui/theme/typographyComponentTheme.d.ts +22 -0
- package/dist/components/ui/typography.d.ts +9 -9
- package/dist/components/utils/buildComponent.d.ts +8 -0
- package/dist/components/utils/componentUtils.d.ts +4 -0
- package/dist/components/utils/deepMerge.d.ts +4 -0
- package/dist/components/utils/deepPartial.d.ts +3 -0
- package/dist/components/utils/tests/deepMerge.test.d.ts +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +1891 -323
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1894 -322
- package/dist/index.js.map +1 -1
- package/dist/ui.css +2019 -100
- package/dist/vars.css +139 -0
- package/package.json +34 -11
- package/dist/components/ui/props/commonValues.d.ts +0 -45
- package/dist/components/ui/settings.d.ts +0 -30
- package/dist/components/utils/componentBuilder.d.ts +0 -23
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
'use strict';
|
|
2
4
|
|
|
3
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
4
7
|
|
|
5
8
|
const CLASS_PART_SEPARATOR = '-';
|
|
6
9
|
const createClassGroupUtils = config => {
|
|
@@ -520,7 +523,7 @@ const getDefaultConfig = () => {
|
|
|
520
523
|
const scaleGridTemplateColsRows = () => [isInteger, 'none', 'subgrid', isArbitraryVariable, isArbitraryValue];
|
|
521
524
|
const scaleGridColRowStartAndEnd = () => ['auto', {
|
|
522
525
|
span: ['full', isInteger, isArbitraryVariable, isArbitraryValue]
|
|
523
|
-
}, isArbitraryVariable, isArbitraryValue];
|
|
526
|
+
}, isInteger, isArbitraryVariable, isArbitraryValue];
|
|
524
527
|
const scaleGridColRowStartOrEnd = () => [isInteger, 'auto', isArbitraryVariable, isArbitraryValue];
|
|
525
528
|
const scaleGridAutoColsRows = () => ['auto', 'min', 'max', 'fr', isArbitraryVariable, isArbitraryValue];
|
|
526
529
|
const scaleAlignPrimaryAxis = () => ['start', 'end', 'center', 'between', 'around', 'evenly', 'stretch', 'baseline'];
|
|
@@ -528,7 +531,7 @@ const getDefaultConfig = () => {
|
|
|
528
531
|
const scaleMargin = () => ['auto', ...scaleUnambiguousSpacing()];
|
|
529
532
|
const scaleSizing = () => [isFraction, 'auto', 'full', 'dvw', 'dvh', 'lvw', 'lvh', 'svw', 'svh', 'min', 'max', 'fit', ...scaleUnambiguousSpacing()];
|
|
530
533
|
const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
|
|
531
|
-
const scaleGradientStopPosition = () => [isPercent, isArbitraryLength];
|
|
534
|
+
const scaleGradientStopPosition = () => [isPercent, isArbitraryVariableLength, isArbitraryLength];
|
|
532
535
|
const scaleRadius = () => [
|
|
533
536
|
// Deprecated since Tailwind CSS v4.0.0
|
|
534
537
|
'', 'none', 'full', themeRadius, isArbitraryVariable, isArbitraryValue];
|
|
@@ -2713,6 +2716,470 @@ const getDefaultConfig = () => {
|
|
|
2713
2716
|
};
|
|
2714
2717
|
const twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
|
|
2715
2718
|
|
|
2719
|
+
function buildComponent(props, theme, propsToOmit = []) {
|
|
2720
|
+
var _a;
|
|
2721
|
+
const cleanProps = { ...props };
|
|
2722
|
+
for (const k of propsToOmit) {
|
|
2723
|
+
if (k in cleanProps) {
|
|
2724
|
+
delete cleanProps[k];
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
const { className, children, tag, ...other } = cleanProps;
|
|
2728
|
+
const componentTag = (_a = tag !== null && tag !== void 0 ? tag : theme.tag) !== null && _a !== void 0 ? _a : "div";
|
|
2729
|
+
const themeGeneratedClasses = react.useMemo(() => {
|
|
2730
|
+
return theme.getClasses(props);
|
|
2731
|
+
}, [props, theme]);
|
|
2732
|
+
const mergedClasses = twMerge(...themeGeneratedClasses, className);
|
|
2733
|
+
const TagToRender = componentTag;
|
|
2734
|
+
return (jsxRuntime.jsx(TagToRender, { className: mergedClasses, ...other, children: children }));
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
/**
|
|
2738
|
+
* Base Theme class that all theme types will extend
|
|
2739
|
+
*/
|
|
2740
|
+
class BaseTheme {
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
const MODE_KEYS = ['base', 'hover', 'active'];
|
|
2744
|
+
const SIZE_KEYS = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
2745
|
+
const VARIANT_KEYS = ['filled', 'outline'];
|
|
2746
|
+
const APPEARANCE_KEYS = ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info', 'transparent'];
|
|
2747
|
+
const TEXT_APPEARANCE_KEYS = [...APPEARANCE_KEYS, 'muted', 'link'];
|
|
2748
|
+
const FONT_FAMILY_KEYS = ['sans', 'serif', 'mono'];
|
|
2749
|
+
const FONT_WEIGHT_KEYS = ['thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black'];
|
|
2750
|
+
const FONT_STYLE_KEYS = ['italic', 'notItalic'];
|
|
2751
|
+
const TEXT_DECORATION_KEYS = ['underline', 'lineThrough', 'noUnderline', 'overline'];
|
|
2752
|
+
const TEXT_TRANSFORM_KEYS = ['uppercase', 'lowercase', 'capitalize', 'normalCase'];
|
|
2753
|
+
const TEXT_ALIGN_KEYS = ['textLeft', 'textCenter', 'textRight', 'textJustify'];
|
|
2754
|
+
const BORDER_KEYS = ['border', 'noBorder'];
|
|
2755
|
+
const SHADOW_KEYS = ['shadow', 'noShadow'];
|
|
2756
|
+
const RING_KEYS = ['ring', 'noRing'];
|
|
2757
|
+
const PADDING_KEYS = ['padding', 'noPadding'];
|
|
2758
|
+
const BREAKPOINT_KEYS = ['xsCol', 'smCol', 'mdCol', 'lgCol', 'xlCol'];
|
|
2759
|
+
const HIDE_KEYS = ['xsHide', 'smHide', 'mdHide', 'lgHide', 'xlHide'];
|
|
2760
|
+
const POSITION_KEYS = ['relative', 'absolute', 'fixed', 'sticky', 'static'];
|
|
2761
|
+
const DIRECTION_REVERSE_KEYS = ['reverse'];
|
|
2762
|
+
const GAP_KEYS = ['gap', 'noGap'];
|
|
2763
|
+
const PILL_KEYS = ['pill'];
|
|
2764
|
+
const SHARP_KEYS = ['sharp'];
|
|
2765
|
+
const ROUNDED_KEYS = ['rounded'];
|
|
2766
|
+
const SHAPE_KEYS = [...PILL_KEYS, ...SHARP_KEYS, ...ROUNDED_KEYS];
|
|
2767
|
+
const FLEX_DIRECTION_KEYS = ['row', 'column', 'rowReverse', 'columnReverse'];
|
|
2768
|
+
const ITEMS_KEYS = ['itemsStart', 'itemsEnd', 'itemsCenter', 'itemsBaseline', 'itemsStretch'];
|
|
2769
|
+
const JUSTIFY_KEYS = ['justifyStart', 'justifyEnd', 'justifyCenter', 'justifyBetween', 'justifyAround', 'justifyEvenly', 'justifyStretch', 'justifyBaseline'];
|
|
2770
|
+
const WRAP_KEYS = ['flexWrap', 'flexNoWrap', 'flexWrapReverse'];
|
|
2771
|
+
// A master list of all groups where only one key can be 'true' at a time.
|
|
2772
|
+
const EXCLUSIVE_KEY_GROUPS = [
|
|
2773
|
+
MODE_KEYS,
|
|
2774
|
+
SIZE_KEYS,
|
|
2775
|
+
TEXT_APPEARANCE_KEYS,
|
|
2776
|
+
VARIANT_KEYS,
|
|
2777
|
+
FONT_FAMILY_KEYS,
|
|
2778
|
+
FONT_WEIGHT_KEYS,
|
|
2779
|
+
FONT_STYLE_KEYS,
|
|
2780
|
+
TEXT_DECORATION_KEYS,
|
|
2781
|
+
TEXT_TRANSFORM_KEYS,
|
|
2782
|
+
TEXT_ALIGN_KEYS,
|
|
2783
|
+
BORDER_KEYS,
|
|
2784
|
+
SHADOW_KEYS,
|
|
2785
|
+
RING_KEYS,
|
|
2786
|
+
PADDING_KEYS,
|
|
2787
|
+
BREAKPOINT_KEYS,
|
|
2788
|
+
HIDE_KEYS,
|
|
2789
|
+
POSITION_KEYS,
|
|
2790
|
+
DIRECTION_REVERSE_KEYS,
|
|
2791
|
+
GAP_KEYS,
|
|
2792
|
+
SHAPE_KEYS,
|
|
2793
|
+
FLEX_DIRECTION_KEYS,
|
|
2794
|
+
ITEMS_KEYS,
|
|
2795
|
+
JUSTIFY_KEYS,
|
|
2796
|
+
WRAP_KEYS,
|
|
2797
|
+
];
|
|
2798
|
+
// Base component keys
|
|
2799
|
+
const BASE_COMPONENT_KEYS = [
|
|
2800
|
+
...SIZE_KEYS,
|
|
2801
|
+
...HIDE_KEYS,
|
|
2802
|
+
...POSITION_KEYS
|
|
2803
|
+
];
|
|
2804
|
+
// Font keys
|
|
2805
|
+
const FONT_KEYS = [
|
|
2806
|
+
...FONT_WEIGHT_KEYS,
|
|
2807
|
+
...FONT_STYLE_KEYS,
|
|
2808
|
+
...TEXT_DECORATION_KEYS,
|
|
2809
|
+
...TEXT_TRANSFORM_KEYS,
|
|
2810
|
+
...FONT_FAMILY_KEYS,
|
|
2811
|
+
...TEXT_APPEARANCE_KEYS,
|
|
2812
|
+
...TEXT_ALIGN_KEYS
|
|
2813
|
+
];
|
|
2814
|
+
// Typography component keys
|
|
2815
|
+
const TYPOGRAPHY_COMPONENT_KEYS = [
|
|
2816
|
+
...BASE_COMPONENT_KEYS,
|
|
2817
|
+
...FONT_KEYS
|
|
2818
|
+
];
|
|
2819
|
+
// Button keys
|
|
2820
|
+
const BUTTON_KEYS = [
|
|
2821
|
+
...TYPOGRAPHY_COMPONENT_KEYS,
|
|
2822
|
+
...SHAPE_KEYS,
|
|
2823
|
+
...BORDER_KEYS,
|
|
2824
|
+
...SHADOW_KEYS,
|
|
2825
|
+
...RING_KEYS,
|
|
2826
|
+
...GAP_KEYS,
|
|
2827
|
+
...PADDING_KEYS,
|
|
2828
|
+
...VARIANT_KEYS,
|
|
2829
|
+
...ITEMS_KEYS,
|
|
2830
|
+
...APPEARANCE_KEYS
|
|
2831
|
+
];
|
|
2832
|
+
// Grid keys
|
|
2833
|
+
const GRID_KEYS = [
|
|
2834
|
+
...BASE_COMPONENT_KEYS,
|
|
2835
|
+
...GAP_KEYS,
|
|
2836
|
+
...APPEARANCE_KEYS
|
|
2837
|
+
];
|
|
2838
|
+
// Row keys
|
|
2839
|
+
const ROW_KEYS = [
|
|
2840
|
+
...BASE_COMPONENT_KEYS,
|
|
2841
|
+
...WRAP_KEYS,
|
|
2842
|
+
...GAP_KEYS,
|
|
2843
|
+
...DIRECTION_REVERSE_KEYS,
|
|
2844
|
+
...ITEMS_KEYS,
|
|
2845
|
+
...BREAKPOINT_KEYS,
|
|
2846
|
+
...JUSTIFY_KEYS,
|
|
2847
|
+
...APPEARANCE_KEYS
|
|
2848
|
+
];
|
|
2849
|
+
// Col keys
|
|
2850
|
+
const COL_KEYS = [
|
|
2851
|
+
...BASE_COMPONENT_KEYS,
|
|
2852
|
+
...WRAP_KEYS,
|
|
2853
|
+
...GAP_KEYS,
|
|
2854
|
+
...DIRECTION_REVERSE_KEYS,
|
|
2855
|
+
...ITEMS_KEYS,
|
|
2856
|
+
...JUSTIFY_KEYS,
|
|
2857
|
+
...APPEARANCE_KEYS
|
|
2858
|
+
];
|
|
2859
|
+
// Card keys
|
|
2860
|
+
const CARD_KEYS = [
|
|
2861
|
+
...GAP_KEYS,
|
|
2862
|
+
...ITEMS_KEYS,
|
|
2863
|
+
...SHARP_KEYS,
|
|
2864
|
+
...ROUNDED_KEYS,
|
|
2865
|
+
...BREAKPOINT_KEYS,
|
|
2866
|
+
...APPEARANCE_KEYS,
|
|
2867
|
+
...BORDER_KEYS,
|
|
2868
|
+
...RING_KEYS,
|
|
2869
|
+
...SHADOW_KEYS,
|
|
2870
|
+
...PADDING_KEYS,
|
|
2871
|
+
...FLEX_DIRECTION_KEYS,
|
|
2872
|
+
...TYPOGRAPHY_COMPONENT_KEYS,
|
|
2873
|
+
...DIRECTION_REVERSE_KEYS,
|
|
2874
|
+
...JUSTIFY_KEYS,
|
|
2875
|
+
...WRAP_KEYS
|
|
2876
|
+
];
|
|
2877
|
+
// Stack keys
|
|
2878
|
+
const STACK_KEYS = [
|
|
2879
|
+
...BASE_COMPONENT_KEYS,
|
|
2880
|
+
...WRAP_KEYS,
|
|
2881
|
+
...GAP_KEYS,
|
|
2882
|
+
...DIRECTION_REVERSE_KEYS,
|
|
2883
|
+
...ITEMS_KEYS,
|
|
2884
|
+
...BREAKPOINT_KEYS,
|
|
2885
|
+
...JUSTIFY_KEYS,
|
|
2886
|
+
...APPEARANCE_KEYS,
|
|
2887
|
+
...FLEX_DIRECTION_KEYS,
|
|
2888
|
+
...PADDING_KEYS
|
|
2889
|
+
];
|
|
2890
|
+
// Badge keys
|
|
2891
|
+
const BADGE_KEYS = [
|
|
2892
|
+
...TYPOGRAPHY_COMPONENT_KEYS,
|
|
2893
|
+
...SHAPE_KEYS,
|
|
2894
|
+
...VARIANT_KEYS,
|
|
2895
|
+
...SHADOW_KEYS,
|
|
2896
|
+
...BORDER_KEYS,
|
|
2897
|
+
...RING_KEYS,
|
|
2898
|
+
...ITEMS_KEYS,
|
|
2899
|
+
...GAP_KEYS,
|
|
2900
|
+
...PADDING_KEYS,
|
|
2901
|
+
...APPEARANCE_KEYS
|
|
2902
|
+
];
|
|
2903
|
+
// Chip keys
|
|
2904
|
+
const CHIP_KEYS = [
|
|
2905
|
+
...TYPOGRAPHY_COMPONENT_KEYS,
|
|
2906
|
+
...SHAPE_KEYS,
|
|
2907
|
+
...VARIANT_KEYS,
|
|
2908
|
+
...SHADOW_KEYS,
|
|
2909
|
+
...BORDER_KEYS,
|
|
2910
|
+
...RING_KEYS,
|
|
2911
|
+
...ITEMS_KEYS,
|
|
2912
|
+
...GAP_KEYS,
|
|
2913
|
+
...PADDING_KEYS,
|
|
2914
|
+
...APPEARANCE_KEYS
|
|
2915
|
+
];
|
|
2916
|
+
// Divider keys
|
|
2917
|
+
const DIVIDER_KEYS = [
|
|
2918
|
+
...BASE_COMPONENT_KEYS,
|
|
2919
|
+
...APPEARANCE_KEYS
|
|
2920
|
+
];
|
|
2921
|
+
// Container keys
|
|
2922
|
+
const CONTAINER_KEYS = [
|
|
2923
|
+
...BASE_COMPONENT_KEYS,
|
|
2924
|
+
...ITEMS_KEYS,
|
|
2925
|
+
...APPEARANCE_KEYS,
|
|
2926
|
+
...BORDER_KEYS,
|
|
2927
|
+
...SHADOW_KEYS,
|
|
2928
|
+
...RING_KEYS,
|
|
2929
|
+
...GAP_KEYS,
|
|
2930
|
+
];
|
|
2931
|
+
// Section keys
|
|
2932
|
+
const SECTION_KEYS = [
|
|
2933
|
+
...BASE_COMPONENT_KEYS,
|
|
2934
|
+
...FLEX_DIRECTION_KEYS,
|
|
2935
|
+
...ITEMS_KEYS,
|
|
2936
|
+
...APPEARANCE_KEYS,
|
|
2937
|
+
...PADDING_KEYS,
|
|
2938
|
+
...DIRECTION_REVERSE_KEYS,
|
|
2939
|
+
...JUSTIFY_KEYS,
|
|
2940
|
+
...WRAP_KEYS,
|
|
2941
|
+
...BREAKPOINT_KEYS,
|
|
2942
|
+
...GAP_KEYS
|
|
2943
|
+
];
|
|
2944
|
+
|
|
2945
|
+
const rowToColumnBreakpointClasses = {
|
|
2946
|
+
xsCol: "max-xs:flex-col",
|
|
2947
|
+
smCol: "max-sm:flex-col",
|
|
2948
|
+
mdCol: "max-md:flex-col",
|
|
2949
|
+
lgCol: "max-lg:flex-col",
|
|
2950
|
+
xlCol: "max-xl:flex-col"
|
|
2951
|
+
};
|
|
2952
|
+
const justifyClasses = {
|
|
2953
|
+
justifyStart: "justify-start",
|
|
2954
|
+
justifyEnd: "justify-end",
|
|
2955
|
+
justifyCenter: "justify-center",
|
|
2956
|
+
justifyBetween: "justify-between",
|
|
2957
|
+
justifyAround: "justify-around",
|
|
2958
|
+
justifyEvenly: "justify-evenly",
|
|
2959
|
+
justifyStretch: "justify-stretch",
|
|
2960
|
+
justifyBaseline: "justify-baseline",
|
|
2961
|
+
};
|
|
2962
|
+
const wrapClasses = {
|
|
2963
|
+
flexWrap: "flex-wrap",
|
|
2964
|
+
flexNoWrap: "flex-nowrap",
|
|
2965
|
+
flexWrapReverse: "flex-wrap-reverse"
|
|
2966
|
+
};
|
|
2967
|
+
const roundedClasses = {
|
|
2968
|
+
xs: "rounded-sm",
|
|
2969
|
+
sm: "rounded-md",
|
|
2970
|
+
md: "rounded-lg",
|
|
2971
|
+
lg: "rounded-xl",
|
|
2972
|
+
xl: "rounded-2xl",
|
|
2973
|
+
};
|
|
2974
|
+
const hideClasses = {
|
|
2975
|
+
xsHide: "max-xs:hidden",
|
|
2976
|
+
smHide: "max-sm:hidden",
|
|
2977
|
+
mdHide: "max-md:hidden",
|
|
2978
|
+
lgHide: "max-lg:hidden",
|
|
2979
|
+
xlHide: "max-xl:hidden"
|
|
2980
|
+
};
|
|
2981
|
+
const positionClasses = {
|
|
2982
|
+
relative: "relative",
|
|
2983
|
+
absolute: "absolute",
|
|
2984
|
+
fixed: "fixed",
|
|
2985
|
+
sticky: "sticky",
|
|
2986
|
+
static: "static"
|
|
2987
|
+
};
|
|
2988
|
+
const shadowClasses = {
|
|
2989
|
+
xs: "shadow-xs",
|
|
2990
|
+
sm: "shadow-sm",
|
|
2991
|
+
md: "shadow-md",
|
|
2992
|
+
lg: "shadow-lg",
|
|
2993
|
+
xl: "shadow-xl"
|
|
2994
|
+
};
|
|
2995
|
+
const hoverShadowClasses = {
|
|
2996
|
+
xs: "hover:shadow-sm",
|
|
2997
|
+
sm: "hover:shadow-md",
|
|
2998
|
+
md: "hover:shadow-lg",
|
|
2999
|
+
lg: "hover:shadow-xl",
|
|
3000
|
+
xl: "hover:shadow-2xl"
|
|
3001
|
+
};
|
|
3002
|
+
const activeShadowClasses = {
|
|
3003
|
+
xs: "active:shadow-sm",
|
|
3004
|
+
sm: "active:shadow-md",
|
|
3005
|
+
md: "active:shadow-lg",
|
|
3006
|
+
lg: "active:shadow-xl",
|
|
3007
|
+
xl: "active:shadow-2xl"
|
|
3008
|
+
};
|
|
3009
|
+
const noRingModeClasses = {
|
|
3010
|
+
base: "ring-0",
|
|
3011
|
+
hover: "hover:ring-0",
|
|
3012
|
+
active: "active:ring-0",
|
|
3013
|
+
};
|
|
3014
|
+
const ringModeClasses = {
|
|
3015
|
+
base: "ring ring-inset",
|
|
3016
|
+
hover: "hover:ring hover:ring-inset",
|
|
3017
|
+
active: "active:ring active:ring-inset",
|
|
3018
|
+
};
|
|
3019
|
+
const noShadowModeClasses = {
|
|
3020
|
+
base: "shadow-none",
|
|
3021
|
+
hover: "hover:shadow-none",
|
|
3022
|
+
active: "active:shadow-none",
|
|
3023
|
+
};
|
|
3024
|
+
|
|
3025
|
+
function pickFirstKeyOptional(props, keys, fallback = undefined) {
|
|
3026
|
+
for (const k of keys) {
|
|
3027
|
+
if (props[k])
|
|
3028
|
+
return k;
|
|
3029
|
+
}
|
|
3030
|
+
return fallback;
|
|
3031
|
+
}
|
|
3032
|
+
/**
|
|
3033
|
+
* Pick the first truthy key from props, then from defaults, then fallback.
|
|
3034
|
+
*/
|
|
3035
|
+
function pickKey(props, defaults, keys, fallback) {
|
|
3036
|
+
// 1) explicit user prop
|
|
3037
|
+
const explicit = pickFirstKeyOptional(props, keys);
|
|
3038
|
+
if (explicit)
|
|
3039
|
+
return explicit;
|
|
3040
|
+
// 2) component‐level default
|
|
3041
|
+
const def = pickFirstKeyOptional(defaults, keys);
|
|
3042
|
+
if (def)
|
|
3043
|
+
return def;
|
|
3044
|
+
// 3) built‐in fallback
|
|
3045
|
+
return fallback;
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
class HideTheme extends BaseTheme {
|
|
3049
|
+
constructor(initialConfig) {
|
|
3050
|
+
super();
|
|
3051
|
+
HIDE_KEYS.forEach((key) => {
|
|
3052
|
+
var _a;
|
|
3053
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : HideTheme.defaultClasses[key];
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3056
|
+
getClasses(props, defaults) {
|
|
3057
|
+
const key = pickKey(props, defaults, HIDE_KEYS);
|
|
3058
|
+
return [key ? this[key] : ''];
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
HideTheme.defaultClasses = hideClasses;
|
|
3062
|
+
|
|
3063
|
+
const isObject = (item) => {
|
|
3064
|
+
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
3065
|
+
};
|
|
3066
|
+
const deepMerge = (target, source) => {
|
|
3067
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
3068
|
+
for (const key in source) {
|
|
3069
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3070
|
+
const sourceValue = source[key];
|
|
3071
|
+
const targetValue = output[key];
|
|
3072
|
+
if (sourceValue === undefined) {
|
|
3073
|
+
continue;
|
|
3074
|
+
}
|
|
3075
|
+
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
3076
|
+
if (key === 'defaults' &&
|
|
3077
|
+
isObject(targetValue) &&
|
|
3078
|
+
isObject(sourceValue)) {
|
|
3079
|
+
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
3080
|
+
}
|
|
3081
|
+
// For all other objects, use the standard recursive deep merge.
|
|
3082
|
+
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
3083
|
+
output[key] = deepMerge(targetValue, sourceValue);
|
|
3084
|
+
}
|
|
3085
|
+
// For non-object values, just assign the value from the source.
|
|
3086
|
+
else {
|
|
3087
|
+
output[key] = sourceValue;
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
return output;
|
|
3092
|
+
};
|
|
3093
|
+
const deepClone = (source) => {
|
|
3094
|
+
if (!isObject(source)) {
|
|
3095
|
+
return source;
|
|
3096
|
+
}
|
|
3097
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
3098
|
+
for (const key in output) {
|
|
3099
|
+
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
3100
|
+
output[key] = deepClone(output[key]);
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
return output;
|
|
3104
|
+
};
|
|
3105
|
+
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
3106
|
+
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
3107
|
+
const finalDefaults = { ...baseDefaults };
|
|
3108
|
+
// Iterate over the override keys to apply them.
|
|
3109
|
+
for (const key in overrideDefaults) {
|
|
3110
|
+
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
3111
|
+
const overrideValue = overrideDefaults[key];
|
|
3112
|
+
// If the override is setting a key to true...
|
|
3113
|
+
if (overrideValue) {
|
|
3114
|
+
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
3115
|
+
const group = findGroup(key);
|
|
3116
|
+
// If the key is part of an exclusive group...
|
|
3117
|
+
if (group) {
|
|
3118
|
+
// ...set all other keys in that group to false.
|
|
3119
|
+
group.forEach(groupKey => {
|
|
3120
|
+
if (groupKey !== key) {
|
|
3121
|
+
finalDefaults[groupKey] = false;
|
|
3122
|
+
}
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
finalDefaults[key] = overrideValue;
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
return finalDefaults;
|
|
3130
|
+
};
|
|
3131
|
+
|
|
3132
|
+
class ItemsTheme extends BaseTheme {
|
|
3133
|
+
constructor(initialConfig) {
|
|
3134
|
+
super();
|
|
3135
|
+
ITEMS_KEYS.forEach((key) => {
|
|
3136
|
+
var _a;
|
|
3137
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : ItemsTheme.defaultClasses[key];
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
getClasses(props, defaults) {
|
|
3141
|
+
const pickedKey = pickKey(props, defaults, ITEMS_KEYS);
|
|
3142
|
+
return [pickedKey && this[pickedKey] ? this[pickedKey] : ''];
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
ItemsTheme.defaultClasses = {
|
|
3146
|
+
itemsStart: "items-start",
|
|
3147
|
+
itemsEnd: "items-end",
|
|
3148
|
+
itemsCenter: "items-center",
|
|
3149
|
+
itemsBaseline: "items-baseline",
|
|
3150
|
+
itemsStretch: "items-stretch",
|
|
3151
|
+
};
|
|
3152
|
+
|
|
3153
|
+
class JustifyTheme extends BaseTheme {
|
|
3154
|
+
constructor(initialConfig) {
|
|
3155
|
+
super();
|
|
3156
|
+
JUSTIFY_KEYS.forEach((key) => {
|
|
3157
|
+
var _a;
|
|
3158
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : JustifyTheme.defaultClasses[key];
|
|
3159
|
+
});
|
|
3160
|
+
}
|
|
3161
|
+
getClasses(props, defaults) {
|
|
3162
|
+
const key = pickKey(props, defaults, JUSTIFY_KEYS);
|
|
3163
|
+
return [key ? this[key] : ''];
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
JustifyTheme.defaultClasses = justifyClasses;
|
|
3167
|
+
|
|
3168
|
+
class PositionTheme extends BaseTheme {
|
|
3169
|
+
constructor(initialConfig) {
|
|
3170
|
+
super();
|
|
3171
|
+
POSITION_KEYS.forEach((key) => {
|
|
3172
|
+
var _a;
|
|
3173
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : PositionTheme.defaultClasses[key];
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
getClasses(props, defaults) {
|
|
3177
|
+
const key = pickKey(props, defaults, POSITION_KEYS);
|
|
3178
|
+
return [key ? this[key] : ''];
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
PositionTheme.defaultClasses = positionClasses;
|
|
3182
|
+
|
|
2716
3183
|
const fontWeightClasses = {
|
|
2717
3184
|
thin: "font-thin",
|
|
2718
3185
|
extralight: "font-extralight",
|
|
@@ -2745,6 +3212,28 @@ const textTransformClasses = {
|
|
|
2745
3212
|
capitalize: "capitalize",
|
|
2746
3213
|
normalCase: "normal-case",
|
|
2747
3214
|
};
|
|
3215
|
+
const textAlignClasses = {
|
|
3216
|
+
textLeft: "text-left",
|
|
3217
|
+
textCenter: "text-center",
|
|
3218
|
+
textRight: "text-right",
|
|
3219
|
+
textJustify: "text-justify",
|
|
3220
|
+
};
|
|
3221
|
+
// Text appearance classes for filled buttons (all white text)
|
|
3222
|
+
const filledTextAppearanceClasses = {
|
|
3223
|
+
default: "text-white",
|
|
3224
|
+
primary: "text-white",
|
|
3225
|
+
secondary: "text-white",
|
|
3226
|
+
tertiary: "text-white",
|
|
3227
|
+
muted: "text-white",
|
|
3228
|
+
link: "text-white",
|
|
3229
|
+
accent: "text-white",
|
|
3230
|
+
success: "text-white",
|
|
3231
|
+
danger: "text-white",
|
|
3232
|
+
warning: "text-white",
|
|
3233
|
+
info: "text-white",
|
|
3234
|
+
transparent: "text-transparent",
|
|
3235
|
+
};
|
|
3236
|
+
// Default text appearance classes (for non-button components)
|
|
2748
3237
|
const textAppearanceClasses = {
|
|
2749
3238
|
default: "text-(--text-color-default)",
|
|
2750
3239
|
primary: "text-(--text-color-primary)",
|
|
@@ -2757,344 +3246,1424 @@ const textAppearanceClasses = {
|
|
|
2757
3246
|
danger: "text-(--text-color-danger)",
|
|
2758
3247
|
warning: "text-(--text-color-warning)",
|
|
2759
3248
|
info: "text-(--text-color-info)",
|
|
3249
|
+
transparent: "text-transparent",
|
|
3250
|
+
};
|
|
3251
|
+
// Text size classes
|
|
3252
|
+
const textSizeClasses = {
|
|
3253
|
+
xs: "text-xs",
|
|
3254
|
+
sm: "text-sm",
|
|
3255
|
+
md: "text-base",
|
|
3256
|
+
lg: "text-lg",
|
|
3257
|
+
xl: "text-xl",
|
|
2760
3258
|
};
|
|
2761
3259
|
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
3260
|
+
class FontFamilyTheme extends BaseTheme {
|
|
3261
|
+
constructor(initial) {
|
|
3262
|
+
super();
|
|
3263
|
+
FONT_FAMILY_KEYS.forEach((key) => {
|
|
3264
|
+
var _a;
|
|
3265
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontFamilyTheme.defaultClasses[key];
|
|
3266
|
+
});
|
|
3267
|
+
}
|
|
3268
|
+
getClasses(props, defaults) {
|
|
3269
|
+
const key = pickKey(props, defaults, FONT_FAMILY_KEYS);
|
|
3270
|
+
return [this[key !== null && key !== void 0 ? key : 'sans'] || ''];
|
|
2770
3271
|
}
|
|
2771
|
-
return fallbackKey ? (_b = classes[fallbackKey]) !== null && _b !== void 0 ? _b : "" : "";
|
|
2772
3272
|
}
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
const
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
3273
|
+
FontFamilyTheme.defaultClasses = fontFamilyClasses;
|
|
3274
|
+
|
|
3275
|
+
class FontWeightTheme extends BaseTheme {
|
|
3276
|
+
constructor(initial) {
|
|
3277
|
+
super();
|
|
3278
|
+
FONT_WEIGHT_KEYS.forEach((key) => {
|
|
3279
|
+
var _a;
|
|
3280
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontWeightTheme.defaultClasses[key];
|
|
3281
|
+
});
|
|
3282
|
+
}
|
|
3283
|
+
getClasses(props, defaults) {
|
|
3284
|
+
const key = pickKey(props, defaults, FONT_WEIGHT_KEYS);
|
|
3285
|
+
return [this[key !== null && key !== void 0 ? key : 'normal'] || '']; // Default to 'normal' if no key is provided
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
FontWeightTheme.defaultClasses = fontWeightClasses;
|
|
3289
|
+
|
|
3290
|
+
class FontStyleTheme extends BaseTheme {
|
|
3291
|
+
constructor(initial) {
|
|
3292
|
+
super();
|
|
3293
|
+
FONT_STYLE_KEYS.forEach((key) => {
|
|
3294
|
+
var _a;
|
|
3295
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
|
|
3296
|
+
});
|
|
3297
|
+
}
|
|
3298
|
+
getClasses(props, defaults) {
|
|
3299
|
+
const key = pickKey(props, defaults, FONT_STYLE_KEYS);
|
|
3300
|
+
return [key ? this[key] : '']; // No default for font style
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
FontStyleTheme.defaultClasses = fontStyleClasses;
|
|
3304
|
+
|
|
3305
|
+
class TextDecorationTheme extends BaseTheme {
|
|
3306
|
+
constructor(initial) {
|
|
3307
|
+
super();
|
|
3308
|
+
TEXT_DECORATION_KEYS.forEach((key) => {
|
|
3309
|
+
var _a;
|
|
3310
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextDecorationTheme.defaultClasses[key];
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
getClasses(props, defaults) {
|
|
3314
|
+
const key = pickKey(props, defaults, TEXT_DECORATION_KEYS);
|
|
3315
|
+
return [key ? this[key] : '']; // No default for text decoration
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
TextDecorationTheme.defaultClasses = textDecorationClasses;
|
|
3319
|
+
|
|
3320
|
+
class TextTransformTheme extends BaseTheme {
|
|
3321
|
+
constructor(initial) {
|
|
3322
|
+
super();
|
|
3323
|
+
TEXT_TRANSFORM_KEYS.forEach((key) => {
|
|
3324
|
+
var _a;
|
|
3325
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextTransformTheme.defaultClasses[key];
|
|
3326
|
+
});
|
|
3327
|
+
}
|
|
3328
|
+
getClasses(props, defaults) {
|
|
3329
|
+
const key = pickKey(props, defaults, TEXT_TRANSFORM_KEYS);
|
|
3330
|
+
return [key ? this[key] : '']; // No default for text transform
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
TextTransformTheme.defaultClasses = textTransformClasses;
|
|
3334
|
+
|
|
3335
|
+
class TextAlignTheme extends BaseTheme {
|
|
3336
|
+
constructor(initial) {
|
|
3337
|
+
super();
|
|
3338
|
+
TEXT_ALIGN_KEYS.forEach((key) => {
|
|
3339
|
+
var _a;
|
|
3340
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextAlignTheme.defaultClasses[key];
|
|
3341
|
+
});
|
|
3342
|
+
}
|
|
3343
|
+
getClasses(props, defaults) {
|
|
3344
|
+
const key = pickKey(props, defaults, TEXT_ALIGN_KEYS);
|
|
3345
|
+
return [key ? this[key] : '']; // No default for text align
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
TextAlignTheme.defaultClasses = textAlignClasses;
|
|
3349
|
+
|
|
3350
|
+
class ComponentTheme {
|
|
3351
|
+
constructor(tag, base, subThemes, defaults = {}) {
|
|
3352
|
+
this.tag = tag;
|
|
3353
|
+
this.base = base;
|
|
3354
|
+
this.defaults = defaults;
|
|
3355
|
+
const defaultInternalThemes = {
|
|
3356
|
+
layout: {
|
|
3357
|
+
hide: new HideTheme(),
|
|
3358
|
+
items: new ItemsTheme(),
|
|
3359
|
+
justify: new JustifyTheme(),
|
|
3360
|
+
position: new PositionTheme(),
|
|
3361
|
+
},
|
|
3362
|
+
typography: {
|
|
3363
|
+
fontFamily: new FontFamilyTheme(),
|
|
3364
|
+
fontWeight: new FontWeightTheme(),
|
|
3365
|
+
fontStyle: new FontStyleTheme(),
|
|
3366
|
+
textDecoration: new TextDecorationTheme(),
|
|
3367
|
+
textTransform: new TextTransformTheme(),
|
|
3368
|
+
textAlign: new TextAlignTheme()
|
|
3369
|
+
}
|
|
3370
|
+
};
|
|
3371
|
+
this.themes = deepMerge(defaultInternalThemes, subThemes);
|
|
3372
|
+
}
|
|
3373
|
+
getClasses(props, defaults = this.defaults) {
|
|
3374
|
+
const user = props;
|
|
3375
|
+
const defs = defaults;
|
|
3376
|
+
const classes = [];
|
|
3377
|
+
if (this.base) {
|
|
3378
|
+
classes.push(...this.base.split(/\s+/));
|
|
3379
|
+
}
|
|
3380
|
+
const walk = (map) => {
|
|
3381
|
+
for (const key of Object.keys(map)) {
|
|
3382
|
+
const node = map[key];
|
|
3383
|
+
if (node instanceof BaseTheme) {
|
|
3384
|
+
classes.push(...node.getClasses(user, defs));
|
|
3385
|
+
}
|
|
3386
|
+
else if (node && typeof node === "object" && !Array.isArray(node)) {
|
|
3387
|
+
walk(node);
|
|
3388
|
+
}
|
|
2788
3389
|
}
|
|
3390
|
+
};
|
|
3391
|
+
walk(this.themes);
|
|
3392
|
+
return classes.filter(Boolean);
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
class SizeTheme extends BaseTheme {
|
|
3397
|
+
constructor(initial) {
|
|
3398
|
+
super();
|
|
3399
|
+
SIZE_KEYS.forEach((key) => {
|
|
3400
|
+
var _a;
|
|
3401
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : SizeTheme.defaultClasses[key];
|
|
3402
|
+
});
|
|
3403
|
+
}
|
|
3404
|
+
getClasses(props, defaults) {
|
|
3405
|
+
const size = pickKey(props, defaults, SIZE_KEYS);
|
|
3406
|
+
return [this[size !== null && size !== void 0 ? size : 'md'] || ''];
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
SizeTheme.defaultClasses = {
|
|
3410
|
+
xs: '',
|
|
3411
|
+
sm: '',
|
|
3412
|
+
md: '',
|
|
3413
|
+
lg: '',
|
|
3414
|
+
xl: ''
|
|
3415
|
+
};
|
|
3416
|
+
|
|
3417
|
+
class GapTheme extends BaseTheme {
|
|
3418
|
+
constructor(initial) {
|
|
3419
|
+
super();
|
|
3420
|
+
GAP_KEYS.forEach((key) => {
|
|
3421
|
+
var _a;
|
|
3422
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : GapTheme.defaultClasses[key];
|
|
2789
3423
|
});
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
3424
|
+
}
|
|
3425
|
+
getClasses(props, defaults) {
|
|
3426
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3427
|
+
const key = pickKey(props, defaults, GAP_KEYS) || 'noGap';
|
|
3428
|
+
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
GapTheme.defaultClasses = {
|
|
3432
|
+
gap: {
|
|
3433
|
+
xs: 'gap-2',
|
|
3434
|
+
sm: 'gap-3',
|
|
3435
|
+
md: 'gap-4',
|
|
3436
|
+
lg: 'gap-5',
|
|
3437
|
+
xl: 'gap-6',
|
|
3438
|
+
},
|
|
3439
|
+
noGap: "gap-0"
|
|
3440
|
+
};
|
|
3441
|
+
|
|
3442
|
+
class RadiusTheme extends BaseTheme {
|
|
3443
|
+
constructor(initial) {
|
|
3444
|
+
super();
|
|
3445
|
+
SHAPE_KEYS.forEach((key) => {
|
|
3446
|
+
var _a;
|
|
3447
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : RadiusTheme.defaultClasses[key];
|
|
3448
|
+
});
|
|
3449
|
+
}
|
|
3450
|
+
getClasses(props, defaults) {
|
|
3451
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3452
|
+
const shape = pickKey(props, defaults, SHAPE_KEYS) || 'rounded';
|
|
3453
|
+
return [typeof this[shape] === 'string' ? this[shape] : this[shape][size]];
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
RadiusTheme.defaultClasses = {
|
|
3457
|
+
pill: "rounded-full",
|
|
3458
|
+
sharp: "rounded-none",
|
|
3459
|
+
rounded: roundedClasses
|
|
3460
|
+
};
|
|
3461
|
+
|
|
3462
|
+
class ShadowTheme extends BaseTheme {
|
|
3463
|
+
constructor(initial) {
|
|
3464
|
+
super();
|
|
3465
|
+
SHADOW_KEYS.forEach((key) => {
|
|
3466
|
+
var _a;
|
|
3467
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : ShadowTheme.defaultClasses[key];
|
|
3468
|
+
});
|
|
3469
|
+
}
|
|
3470
|
+
getClasses(props, defaults) {
|
|
3471
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3472
|
+
const key = pickKey(props, defaults, SHADOW_KEYS);
|
|
3473
|
+
if (key === undefined) {
|
|
3474
|
+
return [];
|
|
2793
3475
|
}
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
3476
|
+
const isModeStringMap = MODE_KEYS.every(m => typeof this[key][m] === "string");
|
|
3477
|
+
return MODE_KEYS.map(mode => isModeStringMap
|
|
3478
|
+
? this[key][mode]
|
|
3479
|
+
: this[key][mode][size]);
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
ShadowTheme.defaultClasses = {
|
|
3483
|
+
shadow: {
|
|
3484
|
+
base: shadowClasses,
|
|
3485
|
+
hover: hoverShadowClasses,
|
|
3486
|
+
active: activeShadowClasses,
|
|
3487
|
+
},
|
|
3488
|
+
noShadow: noShadowModeClasses
|
|
3489
|
+
};
|
|
3490
|
+
|
|
3491
|
+
class BorderTheme extends BaseTheme {
|
|
3492
|
+
constructor(initial) {
|
|
3493
|
+
super();
|
|
3494
|
+
BORDER_KEYS.forEach((key) => {
|
|
3495
|
+
this[key] = {
|
|
3496
|
+
...BorderTheme.defaultClasses[key],
|
|
3497
|
+
...((initial === null || initial === void 0 ? void 0 : initial[key]) || {}),
|
|
3498
|
+
};
|
|
3499
|
+
});
|
|
3500
|
+
}
|
|
3501
|
+
getClasses(props, defaults) {
|
|
3502
|
+
const key = pickKey(props, defaults, BORDER_KEYS);
|
|
3503
|
+
if (!key || !this[key]) {
|
|
3504
|
+
return MODE_KEYS.map(() => '');
|
|
3505
|
+
}
|
|
3506
|
+
return MODE_KEYS.map(mode => this[key][mode] || '');
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
BorderTheme.defaultClasses = {
|
|
3510
|
+
border: {
|
|
3511
|
+
base: "border",
|
|
3512
|
+
hover: "hover:border",
|
|
3513
|
+
active: "active:border",
|
|
3514
|
+
},
|
|
3515
|
+
noBorder: {
|
|
3516
|
+
base: "border-none",
|
|
3517
|
+
hover: "hover:border-none",
|
|
3518
|
+
active: "active:border-none",
|
|
3519
|
+
},
|
|
3520
|
+
};
|
|
3521
|
+
|
|
3522
|
+
class RingTheme extends BaseTheme {
|
|
3523
|
+
constructor(initial) {
|
|
3524
|
+
super();
|
|
3525
|
+
RING_KEYS.forEach((key) => {
|
|
3526
|
+
this[key] = {
|
|
3527
|
+
...RingTheme.defaultClasses[key],
|
|
3528
|
+
...((initial === null || initial === void 0 ? void 0 : initial[key]) || {}),
|
|
3529
|
+
};
|
|
3530
|
+
});
|
|
3531
|
+
}
|
|
3532
|
+
getClasses(props, defaults) {
|
|
3533
|
+
const key = pickKey(props, defaults, RING_KEYS);
|
|
3534
|
+
if (!key || !this[key]) {
|
|
3535
|
+
return MODE_KEYS.map(() => '');
|
|
3536
|
+
}
|
|
3537
|
+
return MODE_KEYS.map(mode => this[key][mode] || '');
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
RingTheme.defaultClasses = {
|
|
3541
|
+
ring: ringModeClasses,
|
|
3542
|
+
noRing: noRingModeClasses,
|
|
3543
|
+
};
|
|
3544
|
+
|
|
3545
|
+
class PxTheme extends BaseTheme {
|
|
3546
|
+
constructor(initial) {
|
|
3547
|
+
super();
|
|
3548
|
+
PADDING_KEYS.forEach((key) => {
|
|
3549
|
+
var _a;
|
|
3550
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : PxTheme.defaultClasses[key];
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
getClasses(props, defaults) {
|
|
3554
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3555
|
+
const key = pickKey(props, defaults, PADDING_KEYS) || 'noPadding';
|
|
3556
|
+
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
PxTheme.defaultClasses = {
|
|
3560
|
+
padding: {
|
|
3561
|
+
xs: "px-2",
|
|
3562
|
+
sm: "px-4",
|
|
3563
|
+
md: "px-6",
|
|
3564
|
+
lg: "px-8",
|
|
3565
|
+
xl: "px-10"
|
|
3566
|
+
},
|
|
3567
|
+
noPadding: "px-0"
|
|
3568
|
+
};
|
|
3569
|
+
|
|
3570
|
+
class PyTheme extends BaseTheme {
|
|
3571
|
+
constructor(initial) {
|
|
3572
|
+
super();
|
|
3573
|
+
PADDING_KEYS.forEach((key) => {
|
|
3574
|
+
var _a;
|
|
3575
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : PyTheme.defaultClasses[key];
|
|
3576
|
+
});
|
|
3577
|
+
}
|
|
3578
|
+
getClasses(props, defaults) {
|
|
3579
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
3580
|
+
const key = pickKey(props, defaults, PADDING_KEYS) || 'noPadding';
|
|
3581
|
+
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
PyTheme.defaultClasses = {
|
|
3585
|
+
padding: {
|
|
3586
|
+
xs: "py-2",
|
|
3587
|
+
sm: "py-4",
|
|
3588
|
+
md: "py-6",
|
|
3589
|
+
lg: "py-8",
|
|
3590
|
+
xl: "py-10"
|
|
3591
|
+
},
|
|
3592
|
+
noPadding: "py-0"
|
|
3593
|
+
};
|
|
3594
|
+
|
|
3595
|
+
class TextAppearanceTheme extends BaseTheme {
|
|
3596
|
+
constructor(initialOverrides) {
|
|
3597
|
+
super();
|
|
3598
|
+
TEXT_APPEARANCE_KEYS.forEach((textKey) => {
|
|
3599
|
+
const defaultModesForKey = TextAppearanceTheme.defaultFullConfig[textKey];
|
|
3600
|
+
const overrideModesForKey = initialOverrides === null || initialOverrides === void 0 ? void 0 : initialOverrides[textKey];
|
|
3601
|
+
this[textKey] = {
|
|
3602
|
+
...defaultModesForKey,
|
|
3603
|
+
...(overrideModesForKey || {}),
|
|
3604
|
+
};
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3607
|
+
getClasses(props, defaults) {
|
|
3608
|
+
const pickedAppearanceKey = pickKey(props, defaults, TEXT_APPEARANCE_KEYS, 'default');
|
|
3609
|
+
const modesForAppearance = this[pickedAppearanceKey];
|
|
3610
|
+
if (!modesForAppearance) {
|
|
3611
|
+
return MODE_KEYS.map(() => '');
|
|
3612
|
+
}
|
|
3613
|
+
return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
|
|
3614
|
+
}
|
|
3615
|
+
static createDefaultStyle(src = {}) {
|
|
3616
|
+
const initialOverridesForConstructor = {};
|
|
3617
|
+
TEXT_APPEARANCE_KEYS.forEach((textKey) => {
|
|
3618
|
+
const modesForCurrentTextKey = {};
|
|
3619
|
+
let keyHasDataInSrc = false;
|
|
3620
|
+
MODE_KEYS.forEach((modeKey) => {
|
|
3621
|
+
var _a;
|
|
3622
|
+
const classValue = (_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey];
|
|
3623
|
+
if (classValue !== undefined) {
|
|
3624
|
+
modesForCurrentTextKey[modeKey] = classValue;
|
|
3625
|
+
keyHasDataInSrc = true;
|
|
3626
|
+
}
|
|
2847
3627
|
});
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
3628
|
+
if (keyHasDataInSrc) {
|
|
3629
|
+
initialOverridesForConstructor[textKey] = modesForCurrentTextKey;
|
|
3630
|
+
}
|
|
3631
|
+
});
|
|
3632
|
+
return new TextAppearanceTheme(initialOverridesForConstructor);
|
|
3633
|
+
}
|
|
2852
3634
|
}
|
|
3635
|
+
TextAppearanceTheme.defaultFullConfig = (() => {
|
|
3636
|
+
const config = {};
|
|
3637
|
+
TEXT_APPEARANCE_KEYS.forEach((key) => {
|
|
3638
|
+
config[key] = {
|
|
3639
|
+
base: textAppearanceClasses[key] || '',
|
|
3640
|
+
hover: '',
|
|
3641
|
+
active: '',
|
|
3642
|
+
};
|
|
3643
|
+
});
|
|
3644
|
+
return config;
|
|
3645
|
+
})();
|
|
2853
3646
|
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
}
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
}
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
};
|
|
2970
|
-
const
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
})
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3647
|
+
// Background classes for filled buttons
|
|
3648
|
+
const filledBackgroundAppearanceClasses = {
|
|
3649
|
+
default: "bg-(--filled-background-color-default)",
|
|
3650
|
+
primary: "bg-(--filled-background-color-primary)",
|
|
3651
|
+
secondary: "bg-(--filled-background-color-secondary)",
|
|
3652
|
+
tertiary: "bg-(--filled-background-color-tertiary)",
|
|
3653
|
+
accent: "bg-(--filled-background-color-accent)",
|
|
3654
|
+
success: "bg-(--filled-background-color-success)",
|
|
3655
|
+
danger: "bg-(--filled-background-color-danger)",
|
|
3656
|
+
warning: "bg-(--filled-background-color-warning)",
|
|
3657
|
+
info: "bg-(--filled-background-color-info)",
|
|
3658
|
+
transparent: "bg-transparent",
|
|
3659
|
+
muted: "bg-(--filled-background-color-muted)",
|
|
3660
|
+
link: "bg-(--filled-background-color-link)",
|
|
3661
|
+
};
|
|
3662
|
+
// Hover background classes for filled buttons
|
|
3663
|
+
const filledHoverBackgroundAppearanceClasses = {
|
|
3664
|
+
default: "hover:bg-(--filled-background-color-hover-default)",
|
|
3665
|
+
primary: "hover:bg-(--filled-background-color-hover-primary)",
|
|
3666
|
+
secondary: "hover:bg-(--filled-background-color-hover-secondary)",
|
|
3667
|
+
tertiary: "hover:bg-(--filled-background-color-hover-tertiary)",
|
|
3668
|
+
accent: "hover:bg-(--filled-background-color-hover-accent)",
|
|
3669
|
+
success: "hover:bg-(--filled-background-color-hover-success)",
|
|
3670
|
+
danger: "hover:bg-(--filled-background-color-hover-danger)",
|
|
3671
|
+
warning: "hover:bg-(--filled-background-color-hover-warning)",
|
|
3672
|
+
info: "hover:bg-(--filled-background-color-hover-info)",
|
|
3673
|
+
transparent: "hover:bg-transparent",
|
|
3674
|
+
muted: "hover:bg-(--filled-background-color-hover-muted)",
|
|
3675
|
+
link: "hover:bg-(--filled-background-color-hover-link)",
|
|
3676
|
+
};
|
|
3677
|
+
// Active background classes for filled buttons
|
|
3678
|
+
const filledActiveBackgroundAppearanceClasses = {
|
|
3679
|
+
default: "active:bg-(--filled-background-color-active-default)",
|
|
3680
|
+
primary: "active:bg-(--filled-background-color-active-primary)",
|
|
3681
|
+
secondary: "active:bg-(--filled-background-color-active-secondary)",
|
|
3682
|
+
tertiary: "active:bg-(--filled-background-color-active-tertiary)",
|
|
3683
|
+
accent: "active:bg-(--filled-background-color-active-accent)",
|
|
3684
|
+
success: "active:bg-(--filled-background-color-active-success)",
|
|
3685
|
+
danger: "active:bg-(--filled-background-color-active-danger)",
|
|
3686
|
+
warning: "active:bg-(--filled-background-color-active-warning)",
|
|
3687
|
+
info: "active:bg-(--filled-background-color-active-info)",
|
|
3688
|
+
transparent: "active:bg-transparent",
|
|
3689
|
+
muted: "active:bg-(--filled-background-color-active-muted)",
|
|
3690
|
+
link: "active:bg-(--filled-background-color-active-link)",
|
|
3691
|
+
};
|
|
3692
|
+
// Default background appearance classes (for non-button components)
|
|
3693
|
+
const backgroundAppearanceClasses = {
|
|
3694
|
+
default: "bg-(--background-color-default)",
|
|
3695
|
+
primary: "bg-(--background-color-primary)",
|
|
3696
|
+
secondary: "bg-(--background-color-secondary)",
|
|
3697
|
+
tertiary: "bg-(--background-color-tertiary)",
|
|
3698
|
+
accent: "bg-(--background-color-accent)",
|
|
3699
|
+
success: "bg-(--background-color-success)",
|
|
3700
|
+
danger: "bg-(--background-color-danger)",
|
|
3701
|
+
warning: "bg-(--background-color-warning)",
|
|
3702
|
+
info: "bg-(--background-color-info)",
|
|
3703
|
+
transparent: "bg-transparent",
|
|
3704
|
+
muted: "bg-(--background-color-muted)",
|
|
3705
|
+
link: "bg-(--background-color-link)",
|
|
3706
|
+
};
|
|
3707
|
+
// Hover background appearance classes for outline buttons
|
|
3708
|
+
const hoverBackgroundAppearanceClasses = {
|
|
3709
|
+
default: "hover:bg-(--background-color-hover-default)",
|
|
3710
|
+
primary: "hover:bg-(--background-color-hover-primary)",
|
|
3711
|
+
secondary: "hover:bg-(--background-color-hover-secondary)",
|
|
3712
|
+
tertiary: "hover:bg-(--background-color-hover-tertiary)",
|
|
3713
|
+
accent: "hover:bg-(--background-color-hover-accent)",
|
|
3714
|
+
success: "hover:bg-(--background-color-hover-success)",
|
|
3715
|
+
danger: "hover:bg-(--background-color-hover-danger)",
|
|
3716
|
+
warning: "hover:bg-(--background-color-hover-warning)",
|
|
3717
|
+
info: "hover:bg-(--background-color-hover-info)",
|
|
3718
|
+
transparent: "hover:bg-transparent",
|
|
3719
|
+
muted: "hover:bg-(--background-color-hover-muted)",
|
|
3720
|
+
link: "hover:bg-(--background-color-hover-link)",
|
|
3721
|
+
};
|
|
3722
|
+
// Active background appearance classes for outline buttons
|
|
3723
|
+
const activeBackgroundAppearanceClasses = {
|
|
3724
|
+
default: "active:bg-(--background-color-active-default)",
|
|
3725
|
+
primary: "active:bg-(--background-color-active-primary)",
|
|
3726
|
+
secondary: "active:bg-(--background-color-active-secondary)",
|
|
3727
|
+
tertiary: "active:bg-(--background-color-active-tertiary)",
|
|
3728
|
+
accent: "active:bg-(--background-color-active-accent)",
|
|
3729
|
+
success: "active:bg-(--background-color-active-success)",
|
|
3730
|
+
danger: "active:bg-(--background-color-active-danger)",
|
|
3731
|
+
warning: "active:bg-(--background-color-active-warning)",
|
|
3732
|
+
info: "active:bg-(--background-color-active-info)",
|
|
3733
|
+
transparent: "active:bg-transparent",
|
|
3734
|
+
muted: "active:bg-(--background-color-active-muted)",
|
|
3735
|
+
link: "active:bg-(--background-color-active-link)",
|
|
3736
|
+
};
|
|
3737
|
+
const layoutBackgroundAppearanceClasses = {
|
|
3738
|
+
default: "bg-(--layout-background-default)",
|
|
3739
|
+
primary: "bg-(--layout-background-primary)",
|
|
3740
|
+
secondary: "bg-(--layout-background-secondary)",
|
|
3741
|
+
tertiary: "bg-(--layout-background-tertiary)",
|
|
3742
|
+
accent: "bg-(--layout-background-accent)",
|
|
3743
|
+
success: "bg-(--layout-background-success)",
|
|
3744
|
+
danger: "bg-(--layout-background-danger)",
|
|
3745
|
+
warning: "bg-(--layout-background-warning)",
|
|
3746
|
+
info: "bg-(--layout-background-info)",
|
|
3747
|
+
transparent: "bg-transparent",
|
|
3748
|
+
};
|
|
3749
|
+
const dividerAppearanceClasses = {
|
|
3750
|
+
default: "bg-(--border-color-default)",
|
|
3751
|
+
primary: "bg-(--border-color-primary)",
|
|
3752
|
+
secondary: "bg-(--border-color-secondary)",
|
|
3753
|
+
tertiary: "bg-(--border-color-tertiary)",
|
|
3754
|
+
accent: "bg-(--border-color-accent)",
|
|
3755
|
+
success: "bg-(--border-color-success)",
|
|
3756
|
+
danger: "bg-(--border-color-danger)",
|
|
3757
|
+
warning: "bg-(--border-color-warning)",
|
|
3758
|
+
info: "bg-(--border-color-info)",
|
|
3759
|
+
transparent: "bg-transparent",
|
|
3760
|
+
muted: "bg-(--border-color-muted)",
|
|
3761
|
+
link: "bg-(--border-color-link)",
|
|
3762
|
+
};
|
|
3763
|
+
const borderAppearanceClasses = {
|
|
3764
|
+
default: "border-(--border-color-default)",
|
|
3765
|
+
primary: "border-(--border-color-primary)",
|
|
3766
|
+
secondary: "border-(--border-color-secondary)",
|
|
3767
|
+
tertiary: "border-(--border-color-tertiary)",
|
|
3768
|
+
accent: "border-(--border-color-accent)",
|
|
3769
|
+
success: "border-(--border-color-success)",
|
|
3770
|
+
danger: "border-(--border-color-danger)",
|
|
3771
|
+
warning: "border-(--border-color-warning)",
|
|
3772
|
+
info: "border-(--border-color-info)",
|
|
3773
|
+
transparent: "border-transparent",
|
|
3774
|
+
muted: "border-(--border-color-muted)",
|
|
3775
|
+
link: "border-(--border-color-link)",
|
|
3776
|
+
};
|
|
3777
|
+
// Border classes for filled elements
|
|
3778
|
+
const filledBorderAppearanceClasses = {
|
|
3779
|
+
default: "border-(--filled-border-color-default)",
|
|
3780
|
+
primary: "border-(--filled-border-color-primary)",
|
|
3781
|
+
secondary: "border-(--filled-border-color-secondary)",
|
|
3782
|
+
tertiary: "border-(--filled-border-color-tertiary)",
|
|
3783
|
+
accent: "border-(--filled-border-color-accent)",
|
|
3784
|
+
success: "border-(--filled-border-color-success)",
|
|
3785
|
+
danger: "border-(--filled-border-color-danger)",
|
|
3786
|
+
warning: "border-(--filled-border-color-warning)",
|
|
3787
|
+
info: "border-(--filled-border-color-info)",
|
|
3788
|
+
transparent: "border-transparent",
|
|
3789
|
+
muted: "border-(--filled-border-color-muted)",
|
|
3790
|
+
link: "border-(--filled-border-color-link)",
|
|
3791
|
+
};
|
|
3792
|
+
const ringAppearanceClasses = {
|
|
3793
|
+
default: "ring-(--border-color-default)",
|
|
3794
|
+
primary: "ring-(--border-color-primary)",
|
|
3795
|
+
secondary: "ring-(--border-color-secondary)",
|
|
3796
|
+
tertiary: "ring-(--border-color-tertiary)",
|
|
3797
|
+
accent: "ring-(--border-color-accent)",
|
|
3798
|
+
success: "ring-(--border-color-success)",
|
|
3799
|
+
danger: "ring-(--border-color-danger)",
|
|
3800
|
+
warning: "ring-(--border-color-warning)",
|
|
3801
|
+
info: "ring-(--border-color-info)",
|
|
3802
|
+
transparent: "ring-transparent",
|
|
3803
|
+
muted: "ring-(--border-color-muted)",
|
|
3804
|
+
link: "ring-(--border-color-link)",
|
|
3805
|
+
};
|
|
3806
|
+
// Ring classes for filled elements
|
|
3807
|
+
const filledRingAppearanceClasses = {
|
|
3808
|
+
default: "ring-(--filled-border-color-default)",
|
|
3809
|
+
primary: "ring-(--filled-border-color-primary)",
|
|
3810
|
+
secondary: "ring-(--filled-border-color-secondary)",
|
|
3811
|
+
tertiary: "ring-(--filled-border-color-tertiary)",
|
|
3812
|
+
accent: "ring-(--filled-border-color-accent)",
|
|
3813
|
+
success: "ring-(--filled-border-color-success)",
|
|
3814
|
+
danger: "ring-(--filled-border-color-danger)",
|
|
3815
|
+
warning: "ring-(--filled-border-color-warning)",
|
|
3816
|
+
info: "ring-(--filled-border-color-info)",
|
|
3817
|
+
transparent: "ring-transparent",
|
|
3818
|
+
muted: "ring-(--filled-border-color-muted)",
|
|
3819
|
+
link: "ring-(--filled-border-color-link)",
|
|
3820
|
+
};
|
|
3821
|
+
|
|
3822
|
+
class VariantTheme extends BaseTheme {
|
|
3823
|
+
constructor(variantInstances = VariantTheme.defaultInstances) {
|
|
3824
|
+
super();
|
|
3825
|
+
VARIANT_KEYS.forEach((variantKey) => {
|
|
3826
|
+
this[variantKey] = variantInstances[variantKey] || VariantTheme.defaultInstances[variantKey];
|
|
3827
|
+
});
|
|
3828
|
+
}
|
|
3829
|
+
getClasses(props, defaults) {
|
|
3830
|
+
const activeVariantKey = pickKey(props, defaults, VARIANT_KEYS, 'outline');
|
|
3831
|
+
const activeTextAppearanceTheme = this[activeVariantKey];
|
|
3832
|
+
if (!activeTextAppearanceTheme) {
|
|
3833
|
+
return [];
|
|
3834
|
+
}
|
|
3835
|
+
return activeTextAppearanceTheme.getClasses(props, defaults);
|
|
3836
|
+
}
|
|
3837
|
+
static createDefault(initialInstances) {
|
|
3838
|
+
const fullInitialInstances = {
|
|
3839
|
+
...VariantTheme.defaultInstances,
|
|
3840
|
+
...(initialInstances || {})
|
|
3841
|
+
};
|
|
3842
|
+
return new VariantTheme(fullInitialInstances);
|
|
3843
|
+
}
|
|
3844
|
+
static createDefaultBackground() {
|
|
3845
|
+
return this.createDefault({
|
|
3846
|
+
outline: TextAppearanceTheme.createDefaultStyle({
|
|
3847
|
+
base: backgroundAppearanceClasses,
|
|
3848
|
+
hover: hoverBackgroundAppearanceClasses,
|
|
3849
|
+
active: activeBackgroundAppearanceClasses
|
|
3850
|
+
}),
|
|
3851
|
+
filled: TextAppearanceTheme.createDefaultStyle({
|
|
3852
|
+
base: filledBackgroundAppearanceClasses,
|
|
3853
|
+
hover: filledHoverBackgroundAppearanceClasses,
|
|
3854
|
+
active: filledActiveBackgroundAppearanceClasses
|
|
3855
|
+
})
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
static createDefaultText() {
|
|
3859
|
+
return this.createDefault({
|
|
3860
|
+
outline: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
3861
|
+
filled: TextAppearanceTheme.createDefaultStyle({ base: filledTextAppearanceClasses })
|
|
3862
|
+
});
|
|
3863
|
+
}
|
|
3864
|
+
static createDefaultBorder() {
|
|
3865
|
+
return this.createDefault({
|
|
3866
|
+
outline: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
3867
|
+
filled: TextAppearanceTheme.createDefaultStyle({ base: filledBorderAppearanceClasses })
|
|
3868
|
+
});
|
|
3869
|
+
}
|
|
3870
|
+
static createDefaultRing() {
|
|
3871
|
+
return this.createDefault({
|
|
3872
|
+
outline: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
3873
|
+
filled: TextAppearanceTheme.createDefaultStyle({ base: filledRingAppearanceClasses })
|
|
3874
|
+
});
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
VariantTheme.defaultInstances = Object.fromEntries(VARIANT_KEYS.map(variantKey => [
|
|
3878
|
+
variantKey,
|
|
3879
|
+
new TextAppearanceTheme()
|
|
3880
|
+
]));
|
|
3881
|
+
|
|
3882
|
+
const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-pointer inline-flex items-center justify-center transition-all duration-200 whitespace-nowrap", {
|
|
3883
|
+
size: {
|
|
3884
|
+
px: new PxTheme({
|
|
3885
|
+
padding: {
|
|
3886
|
+
xs: 'px-2',
|
|
3887
|
+
sm: 'px-2.5',
|
|
3888
|
+
md: 'px-3.5',
|
|
3889
|
+
lg: 'px-5',
|
|
3890
|
+
xl: 'px-6',
|
|
3891
|
+
}
|
|
3892
|
+
}),
|
|
3893
|
+
py: new PyTheme({
|
|
3894
|
+
padding: {
|
|
3895
|
+
xs: 'py-1',
|
|
3896
|
+
sm: 'py-1.5',
|
|
3897
|
+
md: 'py-2',
|
|
3898
|
+
lg: 'py-3',
|
|
3899
|
+
xl: 'py-4',
|
|
3900
|
+
}
|
|
3901
|
+
}),
|
|
3902
|
+
gap: new GapTheme({
|
|
3903
|
+
gap: {
|
|
3904
|
+
xs: 'gap-1.5',
|
|
3905
|
+
sm: 'gap-2',
|
|
3906
|
+
md: 'gap-3',
|
|
3907
|
+
lg: 'gap-4',
|
|
3908
|
+
xl: 'gap-5',
|
|
3909
|
+
}
|
|
3910
|
+
}),
|
|
3911
|
+
text: new SizeTheme({
|
|
3912
|
+
xs: 'text-xs/5',
|
|
3913
|
+
sm: 'text-sm/5',
|
|
3914
|
+
md: 'text-base',
|
|
3915
|
+
lg: 'text-lg/6',
|
|
3916
|
+
xl: 'text-xl/6',
|
|
3917
|
+
}),
|
|
3918
|
+
shadow: new ShadowTheme(),
|
|
3919
|
+
},
|
|
3920
|
+
appearance: {
|
|
3921
|
+
background: VariantTheme.createDefaultBackground(),
|
|
3922
|
+
text: VariantTheme.createDefaultText(),
|
|
3923
|
+
border: VariantTheme.createDefaultBorder(),
|
|
3924
|
+
ring: VariantTheme.createDefaultRing(),
|
|
3925
|
+
},
|
|
3926
|
+
layout: {
|
|
3927
|
+
border: new BorderTheme(),
|
|
3928
|
+
ring: new RingTheme(),
|
|
3929
|
+
radius: new RadiusTheme({
|
|
3930
|
+
rounded: {
|
|
3931
|
+
xs: 'rounded-sm',
|
|
3932
|
+
sm: 'rounded-md',
|
|
3933
|
+
md: 'rounded-md',
|
|
3934
|
+
lg: 'rounded-lg',
|
|
3935
|
+
xl: 'rounded-xl',
|
|
3936
|
+
}
|
|
3937
|
+
}),
|
|
3938
|
+
},
|
|
3939
|
+
}, {
|
|
3940
|
+
md: true,
|
|
3941
|
+
outline: true,
|
|
3942
|
+
default: true,
|
|
3943
|
+
rounded: true,
|
|
3944
|
+
sans: true,
|
|
3945
|
+
semibold: true,
|
|
3946
|
+
textCenter: true,
|
|
3947
|
+
noBorder: true,
|
|
3948
|
+
gap: true,
|
|
3949
|
+
padding: true,
|
|
3950
|
+
ring: true,
|
|
3951
|
+
shadow: true,
|
|
3952
|
+
});
|
|
3953
|
+
|
|
3954
|
+
const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit inline-flex transition-all duration-200 whitespace-nowrap", {
|
|
3955
|
+
size: {
|
|
3956
|
+
px: new PxTheme({
|
|
3957
|
+
padding: {
|
|
3958
|
+
xs: "px-2",
|
|
3959
|
+
sm: "px-2.5",
|
|
3960
|
+
md: "px-3.5",
|
|
3961
|
+
lg: "px-5",
|
|
3962
|
+
xl: "px-6"
|
|
3963
|
+
}
|
|
3964
|
+
}),
|
|
3965
|
+
py: new PyTheme({
|
|
3966
|
+
padding: {
|
|
3967
|
+
xs: "py-1",
|
|
3968
|
+
sm: "py-1.5",
|
|
3969
|
+
md: "py-2",
|
|
3970
|
+
lg: "py-3",
|
|
3971
|
+
xl: "py-4"
|
|
3972
|
+
}
|
|
3973
|
+
}),
|
|
3974
|
+
gap: new GapTheme({
|
|
3975
|
+
gap: {
|
|
3976
|
+
xs: "gap-1",
|
|
3977
|
+
sm: "gap-1.5",
|
|
3978
|
+
md: "gap-2",
|
|
3979
|
+
lg: "gap-2.5",
|
|
3980
|
+
xl: "gap-3"
|
|
3981
|
+
}
|
|
3982
|
+
}),
|
|
3983
|
+
text: new SizeTheme({
|
|
3984
|
+
xs: 'text-xs/5',
|
|
3985
|
+
sm: 'text-sm/5',
|
|
3986
|
+
md: 'text-base',
|
|
3987
|
+
lg: 'text-lg/6',
|
|
3988
|
+
xl: 'text-xl/6',
|
|
3989
|
+
}),
|
|
3990
|
+
shadow: new ShadowTheme(),
|
|
3991
|
+
},
|
|
3992
|
+
appearance: {
|
|
3993
|
+
background: VariantTheme.createDefault({
|
|
3994
|
+
outline: TextAppearanceTheme.createDefaultStyle({
|
|
3995
|
+
base: backgroundAppearanceClasses,
|
|
3996
|
+
}),
|
|
3997
|
+
filled: TextAppearanceTheme.createDefaultStyle({
|
|
3998
|
+
base: filledBackgroundAppearanceClasses,
|
|
3999
|
+
})
|
|
4000
|
+
}),
|
|
4001
|
+
text: VariantTheme.createDefaultText(),
|
|
4002
|
+
border: VariantTheme.createDefaultBorder(),
|
|
4003
|
+
ring: VariantTheme.createDefaultRing(),
|
|
4004
|
+
},
|
|
4005
|
+
layout: {
|
|
4006
|
+
border: new BorderTheme(),
|
|
4007
|
+
ring: new RingTheme(),
|
|
4008
|
+
radius: new RadiusTheme({
|
|
4009
|
+
rounded: {
|
|
4010
|
+
xs: "rounded-xs",
|
|
4011
|
+
sm: "rounded-sm",
|
|
4012
|
+
md: "rounded-md",
|
|
4013
|
+
lg: "rounded-lg",
|
|
4014
|
+
xl: "rounded-xl"
|
|
4015
|
+
}
|
|
4016
|
+
}),
|
|
4017
|
+
},
|
|
4018
|
+
}, {
|
|
4019
|
+
md: true,
|
|
4020
|
+
outline: true,
|
|
4021
|
+
pill: true,
|
|
4022
|
+
sans: true,
|
|
4023
|
+
semibold: true,
|
|
4024
|
+
uppercase: true,
|
|
4025
|
+
noShadow: true,
|
|
4026
|
+
itemsCenter: true,
|
|
4027
|
+
padding: true,
|
|
4028
|
+
gap: true,
|
|
4029
|
+
ring: true,
|
|
4030
|
+
});
|
|
4031
|
+
|
|
4032
|
+
const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit inline-flex gap-2 items-center transition-all duration-200 whitespace-nowrap", {
|
|
4033
|
+
size: {
|
|
4034
|
+
px: new PxTheme({
|
|
4035
|
+
padding: {
|
|
4036
|
+
xs: 'px-2',
|
|
4037
|
+
sm: 'px-2.5',
|
|
4038
|
+
md: 'px-3.5',
|
|
4039
|
+
lg: 'px-5',
|
|
4040
|
+
xl: 'px-6',
|
|
4041
|
+
}
|
|
4042
|
+
}),
|
|
4043
|
+
py: new PyTheme({
|
|
4044
|
+
padding: {
|
|
4045
|
+
xs: 'py-1',
|
|
4046
|
+
sm: 'py-1.5',
|
|
4047
|
+
md: 'py-2',
|
|
4048
|
+
lg: 'py-3',
|
|
4049
|
+
xl: 'py-4',
|
|
4050
|
+
}
|
|
4051
|
+
}),
|
|
4052
|
+
text: new SizeTheme({
|
|
4053
|
+
xs: 'text-xs',
|
|
4054
|
+
sm: 'text-sm',
|
|
4055
|
+
md: 'text-sm',
|
|
4056
|
+
lg: 'text-base',
|
|
4057
|
+
xl: 'text-base',
|
|
4058
|
+
}),
|
|
4059
|
+
gap: new GapTheme({
|
|
4060
|
+
gap: {
|
|
4061
|
+
xs: 'gap-1',
|
|
4062
|
+
sm: 'gap-1.5',
|
|
4063
|
+
md: 'gap-2',
|
|
4064
|
+
lg: 'gap-2.5',
|
|
4065
|
+
xl: 'gap-3',
|
|
4066
|
+
}
|
|
4067
|
+
}),
|
|
4068
|
+
shadow: new ShadowTheme(),
|
|
4069
|
+
},
|
|
4070
|
+
appearance: {
|
|
4071
|
+
background: VariantTheme.createDefault({
|
|
4072
|
+
outline: TextAppearanceTheme.createDefaultStyle({
|
|
4073
|
+
base: backgroundAppearanceClasses,
|
|
4074
|
+
}),
|
|
4075
|
+
filled: TextAppearanceTheme.createDefaultStyle({
|
|
4076
|
+
base: filledBackgroundAppearanceClasses,
|
|
4077
|
+
})
|
|
4078
|
+
}),
|
|
4079
|
+
text: VariantTheme.createDefaultText(),
|
|
4080
|
+
border: VariantTheme.createDefaultBorder(),
|
|
4081
|
+
ring: VariantTheme.createDefaultRing(),
|
|
4082
|
+
},
|
|
4083
|
+
layout: {
|
|
4084
|
+
radius: new RadiusTheme({
|
|
4085
|
+
rounded: {
|
|
4086
|
+
xs: 'rounded-sm',
|
|
4087
|
+
sm: 'rounded-md',
|
|
4088
|
+
md: 'rounded-lg',
|
|
4089
|
+
lg: 'rounded-xl',
|
|
4090
|
+
xl: 'rounded-2xl',
|
|
4091
|
+
}
|
|
4092
|
+
}),
|
|
4093
|
+
border: new BorderTheme(),
|
|
4094
|
+
ring: new RingTheme(),
|
|
4095
|
+
},
|
|
4096
|
+
}, {
|
|
4097
|
+
md: true,
|
|
4098
|
+
outline: true,
|
|
4099
|
+
secondary: true,
|
|
4100
|
+
rounded: true,
|
|
4101
|
+
mono: true,
|
|
4102
|
+
normal: true,
|
|
4103
|
+
noShadow: true,
|
|
4104
|
+
padding: true,
|
|
4105
|
+
gap: true,
|
|
4106
|
+
ring: true,
|
|
4107
|
+
});
|
|
4108
|
+
|
|
4109
|
+
const typographyThemeDefaults = {
|
|
4110
|
+
md: true,
|
|
4111
|
+
default: true,
|
|
4112
|
+
sans: true,
|
|
4113
|
+
normal: true,
|
|
4114
|
+
};
|
|
4115
|
+
const createTypographyComponentTheme = (tag, base = "text-balance", textSizeMap = textSizeClasses, defaults = typographyThemeDefaults) => {
|
|
4116
|
+
return new ComponentTheme(tag, base, {
|
|
4117
|
+
size: {
|
|
4118
|
+
text: new SizeTheme(textSizeMap),
|
|
4119
|
+
},
|
|
4120
|
+
appearance: {
|
|
4121
|
+
text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
4122
|
+
}
|
|
4123
|
+
}, defaults);
|
|
4124
|
+
};
|
|
4125
|
+
// Page title specific theme
|
|
4126
|
+
const pageTitleTheme = createTypographyComponentTheme("h1", "text-balance tracking-tighter w-fit", {
|
|
4127
|
+
xs: "text-3xl max-lg:text-2xl max-md:text-xl",
|
|
4128
|
+
sm: "text-4xl max-lg:text-3xl max-md:text-2xl",
|
|
4129
|
+
md: "text-5xl max-lg:text-4xl max-md:text-3xl",
|
|
4130
|
+
lg: "text-6xl max-lg:text-5xl max-md:text-4xl",
|
|
4131
|
+
xl: "text-7xl max-lg:text-6xl max-md:text-5xl",
|
|
4132
|
+
}, { ...typographyThemeDefaults, semibold: true });
|
|
4133
|
+
// Section title specific theme
|
|
4134
|
+
const sectionTitleTheme = createTypographyComponentTheme("h2", "text-balance w-fit", {
|
|
4135
|
+
xs: "text-2xl max-lg:text-xl max-md:text-lg",
|
|
4136
|
+
sm: "text-3xl max-lg:text-2xl max-md:text-xl",
|
|
4137
|
+
md: "text-4xl max-lg:text-3xl max-md:text-2xl",
|
|
4138
|
+
lg: "text-5xl max-lg:text-4xl max-md:text-3xl",
|
|
4139
|
+
xl: "text-6xl max-lg:text-5xl max-md:text-4xl",
|
|
4140
|
+
}, { ...typographyThemeDefaults, semibold: true });
|
|
4141
|
+
// Title specific theme
|
|
4142
|
+
const titleTheme = createTypographyComponentTheme("h3", "text-balance w-fit", {
|
|
3041
4143
|
xs: "text-lg",
|
|
3042
4144
|
sm: "text-xl",
|
|
3043
4145
|
md: "text-2xl",
|
|
3044
4146
|
lg: "text-3xl",
|
|
3045
4147
|
xl: "text-4xl",
|
|
3046
|
-
})
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
})
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
4148
|
+
}, { ...typographyThemeDefaults, semibold: true });
|
|
4149
|
+
// Text specific theme
|
|
4150
|
+
const textTheme = createTypographyComponentTheme("p", "p-0 m-0 w-fit", textSizeClasses, { ...typographyThemeDefaults, secondary: true });
|
|
4151
|
+
// Link specific theme
|
|
4152
|
+
const linkTheme = createTypographyComponentTheme("a", "hover:underline w-fit", textSizeClasses, { ...typographyThemeDefaults, link: true });
|
|
4153
|
+
// List item specific theme
|
|
4154
|
+
const listItemTheme = createTypographyComponentTheme("li w-fit");
|
|
4155
|
+
// List specific theme
|
|
4156
|
+
const listTheme = createTypographyComponentTheme("ul w-fit", "list-disc list-inside");
|
|
4157
|
+
|
|
4158
|
+
class DirectionTheme extends BaseTheme {
|
|
4159
|
+
constructor(initial) {
|
|
4160
|
+
super();
|
|
4161
|
+
FLEX_DIRECTION_KEYS.forEach((key) => {
|
|
4162
|
+
this[key] = (initial === null || initial === void 0 ? void 0 : initial[key]) || DirectionTheme.defaultClasses[key];
|
|
4163
|
+
});
|
|
4164
|
+
}
|
|
4165
|
+
getClasses(props, defaults) {
|
|
4166
|
+
var _a;
|
|
4167
|
+
let direction = (_a = pickKey(props, defaults, FLEX_DIRECTION_KEYS)) !== null && _a !== void 0 ? _a : 'column';
|
|
4168
|
+
const reverse = pickKey(props, defaults, DIRECTION_REVERSE_KEYS);
|
|
4169
|
+
if (reverse) {
|
|
4170
|
+
switch (direction) {
|
|
4171
|
+
case "column":
|
|
4172
|
+
direction = "columnReverse";
|
|
4173
|
+
break;
|
|
4174
|
+
case "row":
|
|
4175
|
+
direction = "rowReverse";
|
|
4176
|
+
break;
|
|
4177
|
+
}
|
|
4178
|
+
}
|
|
4179
|
+
return direction ? [this[direction]] : [];
|
|
4180
|
+
}
|
|
4181
|
+
}
|
|
4182
|
+
DirectionTheme.defaultClasses = {
|
|
4183
|
+
row: "flex-row",
|
|
4184
|
+
column: "flex-col",
|
|
4185
|
+
rowReverse: "flex-row-reverse",
|
|
4186
|
+
columnReverse: "flex-col-reverse",
|
|
4187
|
+
};
|
|
4188
|
+
|
|
4189
|
+
class WrapTheme extends BaseTheme {
|
|
4190
|
+
constructor(initialConfig) {
|
|
4191
|
+
super();
|
|
4192
|
+
WRAP_KEYS.forEach((key) => {
|
|
4193
|
+
var _a;
|
|
4194
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : WrapTheme.defaultClasses[key];
|
|
4195
|
+
});
|
|
4196
|
+
}
|
|
4197
|
+
getClasses(props, defaults) {
|
|
4198
|
+
const key = pickKey(props, defaults, WRAP_KEYS);
|
|
4199
|
+
return key ? [this[key]] : [];
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
WrapTheme.defaultClasses = wrapClasses;
|
|
4203
|
+
|
|
4204
|
+
const commonGaps = {
|
|
4205
|
+
xs: 'gap-2',
|
|
4206
|
+
sm: 'gap-3',
|
|
4207
|
+
md: 'gap-4',
|
|
4208
|
+
lg: 'gap-5',
|
|
4209
|
+
xl: 'gap-6',
|
|
4210
|
+
};
|
|
4211
|
+
|
|
4212
|
+
class LayoutAppearanceTheme extends BaseTheme {
|
|
4213
|
+
constructor(initialOverrides) {
|
|
4214
|
+
super();
|
|
4215
|
+
APPEARANCE_KEYS.forEach((textKey) => {
|
|
4216
|
+
const defaultModesForKey = LayoutAppearanceTheme.defaultFullConfig[textKey];
|
|
4217
|
+
const overrideModesForKey = initialOverrides === null || initialOverrides === void 0 ? void 0 : initialOverrides[textKey];
|
|
4218
|
+
this[textKey] = {
|
|
4219
|
+
...defaultModesForKey,
|
|
4220
|
+
...(overrideModesForKey || {}),
|
|
4221
|
+
};
|
|
4222
|
+
});
|
|
4223
|
+
}
|
|
4224
|
+
getClasses(props, defaults) {
|
|
4225
|
+
const pickedAppearanceKey = pickKey(props, defaults, APPEARANCE_KEYS, 'default');
|
|
4226
|
+
const modesForAppearance = this[pickedAppearanceKey];
|
|
4227
|
+
if (!modesForAppearance) {
|
|
4228
|
+
return MODE_KEYS.map(() => '');
|
|
4229
|
+
}
|
|
4230
|
+
return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
|
|
4231
|
+
}
|
|
4232
|
+
static createDefaultStyle(src = {}) {
|
|
4233
|
+
const initialOverridesForConstructor = {};
|
|
4234
|
+
APPEARANCE_KEYS.forEach((textKey) => {
|
|
4235
|
+
const modesForCurrentTextKey = {};
|
|
4236
|
+
let keyHasDataInSrc = false;
|
|
4237
|
+
MODE_KEYS.forEach((modeKey) => {
|
|
4238
|
+
var _a;
|
|
4239
|
+
const classValue = (_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey];
|
|
4240
|
+
if (classValue !== undefined) {
|
|
4241
|
+
modesForCurrentTextKey[modeKey] = classValue;
|
|
4242
|
+
keyHasDataInSrc = true;
|
|
4243
|
+
}
|
|
4244
|
+
});
|
|
4245
|
+
if (keyHasDataInSrc) {
|
|
4246
|
+
initialOverridesForConstructor[textKey] = modesForCurrentTextKey;
|
|
4247
|
+
}
|
|
4248
|
+
});
|
|
4249
|
+
return new LayoutAppearanceTheme(initialOverridesForConstructor);
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
LayoutAppearanceTheme.defaultFullConfig = (() => {
|
|
4253
|
+
const config = {};
|
|
4254
|
+
APPEARANCE_KEYS.forEach((key) => {
|
|
4255
|
+
config[key] = {
|
|
4256
|
+
base: textAppearanceClasses[key] || '',
|
|
4257
|
+
hover: '',
|
|
4258
|
+
active: '',
|
|
4259
|
+
};
|
|
4260
|
+
});
|
|
4261
|
+
return config;
|
|
4262
|
+
})();
|
|
4263
|
+
|
|
4264
|
+
class BreakpointTheme extends BaseTheme {
|
|
4265
|
+
constructor(initial) {
|
|
4266
|
+
super();
|
|
4267
|
+
BREAKPOINT_KEYS.forEach((key) => {
|
|
4268
|
+
var _a;
|
|
4269
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : BreakpointTheme.defaultClasses[key];
|
|
4270
|
+
});
|
|
4271
|
+
}
|
|
4272
|
+
getClasses(props, defaults) {
|
|
4273
|
+
const key = pickKey(props, defaults, BREAKPOINT_KEYS);
|
|
4274
|
+
if (!key)
|
|
4275
|
+
return [];
|
|
4276
|
+
return [this[key] || ''];
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
BreakpointTheme.defaultClasses = rowToColumnBreakpointClasses;
|
|
4280
|
+
|
|
4281
|
+
const defaultCardTheme = new ComponentTheme("div", "flex overflow-hidden", {
|
|
4282
|
+
size: {
|
|
4283
|
+
px: new PxTheme({
|
|
4284
|
+
padding: {
|
|
4285
|
+
xs: 'px-3',
|
|
4286
|
+
sm: 'px-4',
|
|
4287
|
+
md: 'px-5',
|
|
4288
|
+
lg: 'px-6',
|
|
4289
|
+
xl: 'px-8',
|
|
4290
|
+
}
|
|
4291
|
+
}),
|
|
4292
|
+
py: new PyTheme({
|
|
4293
|
+
padding: {
|
|
4294
|
+
xs: 'py-2',
|
|
4295
|
+
sm: 'py-3',
|
|
4296
|
+
md: 'py-4',
|
|
4297
|
+
lg: 'py-5',
|
|
4298
|
+
xl: 'py-6',
|
|
4299
|
+
}
|
|
4300
|
+
}),
|
|
4301
|
+
gap: new GapTheme({ gap: commonGaps }),
|
|
4302
|
+
shadow: new ShadowTheme(),
|
|
4303
|
+
},
|
|
4304
|
+
layout: {
|
|
4305
|
+
border: new BorderTheme(),
|
|
4306
|
+
ring: new RingTheme(),
|
|
4307
|
+
radius: new RadiusTheme({
|
|
4308
|
+
rounded: {
|
|
4309
|
+
xs: "rounded-md",
|
|
4310
|
+
sm: "rounded-lg",
|
|
4311
|
+
md: "rounded-xl",
|
|
4312
|
+
lg: "rounded-2xl",
|
|
4313
|
+
xl: "rounded-3xl"
|
|
4314
|
+
}
|
|
4315
|
+
}),
|
|
4316
|
+
wrap: new WrapTheme(),
|
|
4317
|
+
direction: new DirectionTheme(),
|
|
4318
|
+
breakpoint: new BreakpointTheme(),
|
|
4319
|
+
},
|
|
4320
|
+
appearance: {
|
|
4321
|
+
background: LayoutAppearanceTheme.createDefaultStyle({
|
|
4322
|
+
base: layoutBackgroundAppearanceClasses,
|
|
4323
|
+
}),
|
|
4324
|
+
text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
4325
|
+
border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
4326
|
+
ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
4327
|
+
}
|
|
4328
|
+
}, {
|
|
4329
|
+
md: true,
|
|
4330
|
+
default: true,
|
|
4331
|
+
rounded: true,
|
|
4332
|
+
normal: true,
|
|
4333
|
+
column: true,
|
|
4334
|
+
border: true,
|
|
4335
|
+
gap: true,
|
|
4336
|
+
padding: true,
|
|
4337
|
+
});
|
|
4338
|
+
|
|
4339
|
+
const defaultRowTheme = new ComponentTheme("div", "flex flex-row", {
|
|
4340
|
+
size: {
|
|
4341
|
+
gap: new GapTheme({ gap: commonGaps }),
|
|
4342
|
+
breakpoint: new BreakpointTheme(),
|
|
4343
|
+
},
|
|
4344
|
+
layout: {
|
|
4345
|
+
wrap: new WrapTheme(),
|
|
4346
|
+
},
|
|
4347
|
+
}, {
|
|
4348
|
+
md: true,
|
|
4349
|
+
transparent: true,
|
|
4350
|
+
itemsCenter: true,
|
|
4351
|
+
gap: true,
|
|
4352
|
+
});
|
|
4353
|
+
|
|
4354
|
+
const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
|
|
4355
|
+
appearance: {
|
|
4356
|
+
background: TextAppearanceTheme.createDefaultStyle({
|
|
4357
|
+
base: dividerAppearanceClasses,
|
|
4358
|
+
}),
|
|
4359
|
+
}
|
|
4360
|
+
}, {
|
|
4361
|
+
md: true,
|
|
4362
|
+
default: true,
|
|
4363
|
+
});
|
|
4364
|
+
|
|
4365
|
+
const defaultContainerTheme = new ComponentTheme("div", "flex flex-col mx-auto w-full", {
|
|
4366
|
+
size: {
|
|
4367
|
+
gap: new GapTheme({
|
|
4368
|
+
gap: {
|
|
4369
|
+
xs: 'gap-2 max-lg:gap-1',
|
|
4370
|
+
sm: 'gap-4 max-lg:gap-3 max-md:gap-2',
|
|
4371
|
+
md: 'gap-6 max-lg:gap-5 max-md:gap-4',
|
|
4372
|
+
lg: 'gap-8 max-lg:gap-7 max-md:gap-6',
|
|
4373
|
+
xl: 'gap-10 max-lg:gap-9 max-md:gap-8',
|
|
4374
|
+
}
|
|
4375
|
+
}),
|
|
4376
|
+
maxWidth: new SizeTheme({
|
|
4377
|
+
xs: 'max-w-3xl',
|
|
4378
|
+
sm: 'max-w-4xl',
|
|
4379
|
+
md: 'max-w-5xl',
|
|
4380
|
+
lg: 'max-w-6xl',
|
|
4381
|
+
xl: 'max-w-7xl',
|
|
4382
|
+
}),
|
|
4383
|
+
},
|
|
4384
|
+
layout: {
|
|
4385
|
+
border: new BorderTheme(),
|
|
4386
|
+
ring: new RingTheme(),
|
|
4387
|
+
wrap: new WrapTheme(),
|
|
4388
|
+
direction: new DirectionTheme(),
|
|
4389
|
+
},
|
|
4390
|
+
appearance: {
|
|
4391
|
+
background: LayoutAppearanceTheme.createDefaultStyle({
|
|
4392
|
+
base: layoutBackgroundAppearanceClasses,
|
|
4393
|
+
}),
|
|
4394
|
+
text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
4395
|
+
border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
4396
|
+
ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
4397
|
+
}
|
|
4398
|
+
}, {
|
|
4399
|
+
transparent: true,
|
|
4400
|
+
md: true,
|
|
4401
|
+
itemsCenter: true,
|
|
4402
|
+
gap: true,
|
|
4403
|
+
});
|
|
4404
|
+
|
|
4405
|
+
const defaultColTheme = new ComponentTheme("div", "flex flex-col", {
|
|
4406
|
+
size: {
|
|
4407
|
+
gap: new GapTheme({ gap: commonGaps }),
|
|
4408
|
+
},
|
|
4409
|
+
layout: {
|
|
4410
|
+
wrap: new WrapTheme(),
|
|
4411
|
+
direction: new DirectionTheme(),
|
|
4412
|
+
},
|
|
4413
|
+
}, {
|
|
4414
|
+
md: true,
|
|
4415
|
+
transparent: true,
|
|
4416
|
+
gap: true,
|
|
4417
|
+
});
|
|
4418
|
+
|
|
4419
|
+
const defaultStackTheme = new ComponentTheme("div", "flex", {
|
|
4420
|
+
size: {
|
|
4421
|
+
px: new PxTheme({
|
|
4422
|
+
padding: {
|
|
4423
|
+
xs: 'px-2',
|
|
4424
|
+
sm: 'px-3',
|
|
4425
|
+
md: 'px-4',
|
|
4426
|
+
lg: 'px-5',
|
|
4427
|
+
xl: 'px-6',
|
|
4428
|
+
}
|
|
4429
|
+
}),
|
|
4430
|
+
py: new PyTheme({
|
|
4431
|
+
padding: {
|
|
4432
|
+
xs: 'py-2',
|
|
4433
|
+
sm: 'py-3',
|
|
4434
|
+
md: 'py-4',
|
|
4435
|
+
lg: 'py-5',
|
|
4436
|
+
xl: 'py-6',
|
|
4437
|
+
}
|
|
4438
|
+
}),
|
|
4439
|
+
gap: new GapTheme({
|
|
4440
|
+
gap: commonGaps
|
|
4441
|
+
}),
|
|
4442
|
+
},
|
|
4443
|
+
layout: {
|
|
4444
|
+
wrap: new WrapTheme(),
|
|
4445
|
+
direction: new DirectionTheme(),
|
|
4446
|
+
},
|
|
4447
|
+
}, {
|
|
4448
|
+
md: true,
|
|
4449
|
+
transparent: true,
|
|
4450
|
+
column: true,
|
|
4451
|
+
flexWrap: true,
|
|
4452
|
+
gap: true,
|
|
4453
|
+
padding: true,
|
|
4454
|
+
});
|
|
4455
|
+
|
|
4456
|
+
const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
|
|
4457
|
+
size: {
|
|
4458
|
+
px: new PxTheme({
|
|
4459
|
+
padding: {
|
|
4460
|
+
xs: 'px-5 max-lg:px-4 max-md:px-3',
|
|
4461
|
+
sm: 'px-6 max-lg:px-5 max-md:px-4',
|
|
4462
|
+
md: 'px-7 max-lg:px-6 max-md:px-5',
|
|
4463
|
+
lg: 'px-8 max-lg:px-7 max-md:px-6',
|
|
4464
|
+
xl: 'px-9 max-lg:px-8 max-md:px-7',
|
|
4465
|
+
}
|
|
4466
|
+
}),
|
|
4467
|
+
py: new PyTheme({
|
|
4468
|
+
padding: {
|
|
4469
|
+
xs: 'py-3',
|
|
4470
|
+
sm: 'py-5',
|
|
4471
|
+
md: 'py-8 max-md:py-5',
|
|
4472
|
+
lg: 'py-16 max-lg:py-14 max-md:py-12',
|
|
4473
|
+
xl: 'py-20 max-lg:py-16 max-md:py-12',
|
|
4474
|
+
}
|
|
4475
|
+
}),
|
|
4476
|
+
gap: new GapTheme({
|
|
4477
|
+
gap: {
|
|
4478
|
+
xs: 'gap-2',
|
|
4479
|
+
sm: 'gap-4',
|
|
4480
|
+
md: 'gap-6',
|
|
4481
|
+
lg: 'gap-12',
|
|
4482
|
+
xl: 'gap-16',
|
|
4483
|
+
}
|
|
4484
|
+
}),
|
|
4485
|
+
},
|
|
4486
|
+
layout: {
|
|
4487
|
+
wrap: new WrapTheme(),
|
|
4488
|
+
direction: new DirectionTheme(),
|
|
4489
|
+
},
|
|
4490
|
+
}, {
|
|
4491
|
+
md: true,
|
|
4492
|
+
default: true,
|
|
4493
|
+
itemsStart: true,
|
|
4494
|
+
gap: true,
|
|
4495
|
+
padding: true,
|
|
4496
|
+
});
|
|
4497
|
+
|
|
4498
|
+
const gridDefaults = {
|
|
4499
|
+
md: true,
|
|
4500
|
+
gap: true,
|
|
4501
|
+
};
|
|
4502
|
+
const gridSubThemes = {
|
|
4503
|
+
size: {
|
|
4504
|
+
gap: new GapTheme({
|
|
4505
|
+
gap: {
|
|
4506
|
+
xs: "gap-2",
|
|
4507
|
+
sm: "gap-4 max-lg:gap-2",
|
|
4508
|
+
md: "gap-6 max-lg:gap-4",
|
|
4509
|
+
lg: "gap-8 max-lg:gap-6 max-md:gap-4",
|
|
4510
|
+
xl: "gap-10 max-lg:gap-8 max-md:gap-6"
|
|
4511
|
+
}
|
|
4512
|
+
}),
|
|
4513
|
+
},
|
|
4514
|
+
};
|
|
4515
|
+
const defaultGrid3Theme = new ComponentTheme("div", "grid grid-cols-1 md:grid-cols-3", gridSubThemes, gridDefaults);
|
|
4516
|
+
const defaultGrid4Theme = new ComponentTheme("div", "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4", gridSubThemes, gridDefaults);
|
|
4517
|
+
|
|
4518
|
+
const defaultTheme = {
|
|
4519
|
+
button: defaultButtonTheme,
|
|
4520
|
+
badge: defaultBadgeTheme,
|
|
4521
|
+
chip: defaultChipTheme,
|
|
4522
|
+
card: defaultCardTheme,
|
|
4523
|
+
divider: defaultDividerTheme,
|
|
4524
|
+
container: defaultContainerTheme,
|
|
4525
|
+
row: defaultRowTheme,
|
|
4526
|
+
col: defaultColTheme,
|
|
4527
|
+
stack: defaultStackTheme,
|
|
4528
|
+
section: defaultSectionTheme,
|
|
4529
|
+
grid3: defaultGrid3Theme,
|
|
4530
|
+
grid4: defaultGrid4Theme,
|
|
4531
|
+
pageTitle: pageTitleTheme,
|
|
4532
|
+
sectionTitle: sectionTitleTheme,
|
|
4533
|
+
title: titleTheme,
|
|
4534
|
+
text: textTheme,
|
|
4535
|
+
link: linkTheme,
|
|
4536
|
+
listItem: listItemTheme,
|
|
4537
|
+
list: listTheme,
|
|
4538
|
+
};
|
|
4539
|
+
const ThemeContext = react.createContext(defaultTheme);
|
|
4540
|
+
function ThemeProvider({ children, theme: themeObject = {}, themeOverride }) {
|
|
4541
|
+
const mergedTheme = react.useMemo(() => {
|
|
4542
|
+
let baseTheme = themeObject
|
|
4543
|
+
? deepMerge(defaultTheme, themeObject)
|
|
4544
|
+
: defaultTheme;
|
|
4545
|
+
if (typeof themeOverride === 'function') {
|
|
4546
|
+
const themeToModify = deepClone(baseTheme);
|
|
4547
|
+
return themeOverride(themeToModify);
|
|
4548
|
+
}
|
|
4549
|
+
return baseTheme;
|
|
4550
|
+
}, [themeObject, themeOverride]);
|
|
4551
|
+
return (jsxRuntime.jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
|
|
4552
|
+
}
|
|
4553
|
+
function useTheme() {
|
|
4554
|
+
return react.useContext(ThemeContext);
|
|
4555
|
+
}
|
|
4556
|
+
|
|
4557
|
+
const Button = (props) => {
|
|
4558
|
+
const theme = useTheme();
|
|
4559
|
+
const buttonTheme = theme.button;
|
|
4560
|
+
return buildComponent(props, buttonTheme, BUTTON_KEYS);
|
|
4561
|
+
};
|
|
4562
|
+
|
|
4563
|
+
const Badge = (props) => {
|
|
4564
|
+
const theme = useTheme();
|
|
4565
|
+
const badgeTheme = theme.badge;
|
|
4566
|
+
return buildComponent(props, badgeTheme, BADGE_KEYS);
|
|
4567
|
+
};
|
|
4568
|
+
|
|
4569
|
+
const Divider = (props) => {
|
|
4570
|
+
const theme = useTheme();
|
|
4571
|
+
const dividerTheme = theme.divider;
|
|
4572
|
+
return buildComponent(props, dividerTheme, DIVIDER_KEYS);
|
|
4573
|
+
};
|
|
4574
|
+
|
|
4575
|
+
const Chip = (props) => {
|
|
4576
|
+
const theme = useTheme();
|
|
4577
|
+
const chipTheme = theme.chip;
|
|
4578
|
+
return buildComponent(props, chipTheme, CHIP_KEYS);
|
|
4579
|
+
};
|
|
4580
|
+
|
|
4581
|
+
const Section = (props) => {
|
|
4582
|
+
const theme = useTheme();
|
|
4583
|
+
const sectionTheme = theme.section;
|
|
4584
|
+
return buildComponent(props, sectionTheme, SECTION_KEYS);
|
|
4585
|
+
};
|
|
4586
|
+
|
|
4587
|
+
const Container = (props) => {
|
|
4588
|
+
const theme = useTheme();
|
|
4589
|
+
const containerTheme = theme.container;
|
|
4590
|
+
return buildComponent(props, containerTheme, CONTAINER_KEYS);
|
|
4591
|
+
};
|
|
4592
|
+
|
|
4593
|
+
/**
|
|
4594
|
+
* Column component for vertical layouts.
|
|
4595
|
+
* Supports flex-wrap properties for controlling how items wrap.
|
|
4596
|
+
* @param props.wrap - Allows items to wrap (flex-wrap)
|
|
4597
|
+
* @param props.nowrap - Prevents items from wrapping (flex-nowrap)
|
|
4598
|
+
* @param props.wrapReverse - Wraps items onto multiple lines in reverse (flex-wrap-reverse)
|
|
4599
|
+
*/
|
|
4600
|
+
const Col = (props) => {
|
|
4601
|
+
const theme = useTheme();
|
|
4602
|
+
const colTheme = theme.col;
|
|
4603
|
+
return buildComponent(props, colTheme, COL_KEYS);
|
|
4604
|
+
};
|
|
4605
|
+
|
|
4606
|
+
const Row = (props) => {
|
|
4607
|
+
const theme = useTheme();
|
|
4608
|
+
const rowTheme = theme.row;
|
|
4609
|
+
return buildComponent(props, rowTheme, ROW_KEYS);
|
|
4610
|
+
};
|
|
4611
|
+
|
|
4612
|
+
const Grid3 = (props) => {
|
|
4613
|
+
const theme = useTheme();
|
|
4614
|
+
const grid3Theme = theme.grid3;
|
|
4615
|
+
return buildComponent(props, grid3Theme, GRID_KEYS);
|
|
4616
|
+
};
|
|
4617
|
+
const Grid4 = (props) => {
|
|
4618
|
+
const theme = useTheme();
|
|
4619
|
+
const grid4Theme = theme.grid4;
|
|
4620
|
+
return buildComponent(props, grid4Theme, GRID_KEYS);
|
|
4621
|
+
};
|
|
4622
|
+
|
|
4623
|
+
const Card = (props) => {
|
|
4624
|
+
const theme = useTheme();
|
|
4625
|
+
const cardTheme = theme.card;
|
|
4626
|
+
return buildComponent(props, cardTheme, CARD_KEYS);
|
|
4627
|
+
};
|
|
4628
|
+
|
|
4629
|
+
const Stack = (props) => {
|
|
4630
|
+
const theme = useTheme();
|
|
4631
|
+
const stackTheme = theme.stack;
|
|
4632
|
+
return buildComponent(props, stackTheme, STACK_KEYS);
|
|
4633
|
+
};
|
|
4634
|
+
|
|
4635
|
+
const PageTitle = (props) => {
|
|
4636
|
+
const theme = useTheme();
|
|
4637
|
+
return buildComponent(props, theme.pageTitle, TYPOGRAPHY_COMPONENT_KEYS);
|
|
4638
|
+
};
|
|
4639
|
+
const SectionTitle = (props) => {
|
|
4640
|
+
const theme = useTheme();
|
|
4641
|
+
return buildComponent(props, theme.sectionTitle, TYPOGRAPHY_COMPONENT_KEYS);
|
|
4642
|
+
};
|
|
4643
|
+
const Title = (props) => {
|
|
4644
|
+
const theme = useTheme();
|
|
4645
|
+
return buildComponent(props, theme.title, TYPOGRAPHY_COMPONENT_KEYS);
|
|
4646
|
+
};
|
|
4647
|
+
const Text = (props) => {
|
|
4648
|
+
const theme = useTheme();
|
|
4649
|
+
return buildComponent(props, theme.text, TYPOGRAPHY_COMPONENT_KEYS);
|
|
4650
|
+
};
|
|
4651
|
+
const Link = (props) => {
|
|
4652
|
+
const theme = useTheme();
|
|
4653
|
+
return buildComponent(props, theme.link, TYPOGRAPHY_COMPONENT_KEYS);
|
|
4654
|
+
};
|
|
4655
|
+
const ListItem = (props) => {
|
|
4656
|
+
const theme = useTheme();
|
|
4657
|
+
return buildComponent(props, theme.listItem, TYPOGRAPHY_COMPONENT_KEYS);
|
|
4658
|
+
};
|
|
4659
|
+
const List = (props) => {
|
|
4660
|
+
const theme = useTheme();
|
|
4661
|
+
return buildComponent(props, theme.list, TYPOGRAPHY_COMPONENT_KEYS);
|
|
4662
|
+
};
|
|
3095
4663
|
|
|
3096
4664
|
exports.Badge = Badge;
|
|
3097
4665
|
exports.Button = Button;
|
|
4666
|
+
exports.Card = Card;
|
|
3098
4667
|
exports.Chip = Chip;
|
|
3099
4668
|
exports.Col = Col;
|
|
3100
4669
|
exports.Container = Container;
|
|
@@ -3108,6 +4677,9 @@ exports.PageTitle = PageTitle;
|
|
|
3108
4677
|
exports.Row = Row;
|
|
3109
4678
|
exports.Section = Section;
|
|
3110
4679
|
exports.SectionTitle = SectionTitle;
|
|
4680
|
+
exports.Stack = Stack;
|
|
3111
4681
|
exports.Text = Text;
|
|
4682
|
+
exports.ThemeProvider = ThemeProvider;
|
|
3112
4683
|
exports.Title = Title;
|
|
4684
|
+
exports.useTheme = useTheme;
|
|
3113
4685
|
//# sourceMappingURL=index.js.map
|