@vaneui/ui 0.0.13 → 0.0.15
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/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/package.json +26 -15
- package/dist/all.css +0 -813
- 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
|
@@ -0,0 +1,1827 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Base Theme class that all theme types will extend
|
|
8
|
+
*/
|
|
9
|
+
class BaseTheme {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const MODE_KEYS = ['base', 'hover', 'active'];
|
|
13
|
+
const SIZE_KEYS = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
14
|
+
const VARIANT_KEYS = ['filled', 'outline'];
|
|
15
|
+
const APPEARANCE_KEYS = ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info', 'transparent'];
|
|
16
|
+
const TEXT_APPEARANCE_KEYS = [...APPEARANCE_KEYS, 'muted', 'link'];
|
|
17
|
+
const FONT_FAMILY_KEYS = ['sans', 'serif', 'mono'];
|
|
18
|
+
const FONT_WEIGHT_KEYS = ['thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black'];
|
|
19
|
+
const FONT_STYLE_KEYS = ['italic', 'notItalic'];
|
|
20
|
+
const TEXT_DECORATION_KEYS = ['underline', 'lineThrough', 'noUnderline', 'overline'];
|
|
21
|
+
const TEXT_TRANSFORM_KEYS = ['uppercase', 'lowercase', 'capitalize', 'normalCase'];
|
|
22
|
+
const TEXT_ALIGN_KEYS = ['textLeft', 'textCenter', 'textRight', 'textJustify'];
|
|
23
|
+
const BORDER_KEYS = ['border', 'noBorder'];
|
|
24
|
+
const SHADOW_KEYS = ['shadow', 'noShadow'];
|
|
25
|
+
const RING_KEYS = ['ring', 'noRing'];
|
|
26
|
+
const PADDING_KEYS = ['padding', 'noPadding'];
|
|
27
|
+
const BREAKPOINT_KEYS = ['xsCol', 'smCol', 'mdCol', 'lgCol', 'xlCol'];
|
|
28
|
+
const HIDE_KEYS = ['xsHide', 'smHide', 'mdHide', 'lgHide', 'xlHide'];
|
|
29
|
+
const POSITION_KEYS = ['relative', 'absolute', 'fixed', 'sticky', 'static'];
|
|
30
|
+
const DIRECTION_REVERSE_KEYS = ['reverse'];
|
|
31
|
+
const GAP_KEYS = ['gap', 'noGap'];
|
|
32
|
+
const PILL_KEYS = ['pill'];
|
|
33
|
+
const SHARP_KEYS = ['sharp'];
|
|
34
|
+
const ROUNDED_KEYS = ['rounded'];
|
|
35
|
+
const SHAPE_KEYS = [...PILL_KEYS, ...SHARP_KEYS, ...ROUNDED_KEYS];
|
|
36
|
+
const FLEX_DIRECTION_KEYS = ['row', 'column', 'rowReverse', 'columnReverse'];
|
|
37
|
+
const ITEMS_KEYS = ['itemsStart', 'itemsEnd', 'itemsCenter', 'itemsBaseline', 'itemsStretch'];
|
|
38
|
+
const JUSTIFY_KEYS = ['justifyStart', 'justifyEnd', 'justifyCenter', 'justifyBetween', 'justifyAround', 'justifyEvenly', 'justifyStretch', 'justifyBaseline'];
|
|
39
|
+
const WRAP_KEYS = ['flexWrap', 'flexNoWrap', 'flexWrapReverse'];
|
|
40
|
+
// A master list of all groups where only one key can be 'true' at a time.
|
|
41
|
+
const EXCLUSIVE_KEY_GROUPS = [
|
|
42
|
+
MODE_KEYS,
|
|
43
|
+
SIZE_KEYS,
|
|
44
|
+
TEXT_APPEARANCE_KEYS,
|
|
45
|
+
VARIANT_KEYS,
|
|
46
|
+
FONT_FAMILY_KEYS,
|
|
47
|
+
FONT_WEIGHT_KEYS,
|
|
48
|
+
FONT_STYLE_KEYS,
|
|
49
|
+
TEXT_DECORATION_KEYS,
|
|
50
|
+
TEXT_TRANSFORM_KEYS,
|
|
51
|
+
TEXT_ALIGN_KEYS,
|
|
52
|
+
BORDER_KEYS,
|
|
53
|
+
SHADOW_KEYS,
|
|
54
|
+
RING_KEYS,
|
|
55
|
+
PADDING_KEYS,
|
|
56
|
+
BREAKPOINT_KEYS,
|
|
57
|
+
HIDE_KEYS,
|
|
58
|
+
POSITION_KEYS,
|
|
59
|
+
DIRECTION_REVERSE_KEYS,
|
|
60
|
+
GAP_KEYS,
|
|
61
|
+
SHAPE_KEYS,
|
|
62
|
+
FLEX_DIRECTION_KEYS,
|
|
63
|
+
ITEMS_KEYS,
|
|
64
|
+
JUSTIFY_KEYS,
|
|
65
|
+
WRAP_KEYS,
|
|
66
|
+
];
|
|
67
|
+
// Base component keys
|
|
68
|
+
const BASE_COMPONENT_KEYS = [
|
|
69
|
+
...SIZE_KEYS,
|
|
70
|
+
...HIDE_KEYS,
|
|
71
|
+
...POSITION_KEYS
|
|
72
|
+
];
|
|
73
|
+
// Font keys
|
|
74
|
+
const FONT_KEYS = [
|
|
75
|
+
...FONT_WEIGHT_KEYS,
|
|
76
|
+
...FONT_STYLE_KEYS,
|
|
77
|
+
...TEXT_DECORATION_KEYS,
|
|
78
|
+
...TEXT_TRANSFORM_KEYS,
|
|
79
|
+
...FONT_FAMILY_KEYS,
|
|
80
|
+
...TEXT_APPEARANCE_KEYS,
|
|
81
|
+
...TEXT_ALIGN_KEYS
|
|
82
|
+
];
|
|
83
|
+
// Typography component keys
|
|
84
|
+
const TYPOGRAPHY_COMPONENT_KEYS = [
|
|
85
|
+
...BASE_COMPONENT_KEYS,
|
|
86
|
+
...FONT_KEYS
|
|
87
|
+
];
|
|
88
|
+
// Button keys
|
|
89
|
+
[
|
|
90
|
+
...TYPOGRAPHY_COMPONENT_KEYS,
|
|
91
|
+
...SHAPE_KEYS,
|
|
92
|
+
...BORDER_KEYS,
|
|
93
|
+
...SHADOW_KEYS,
|
|
94
|
+
...RING_KEYS,
|
|
95
|
+
...GAP_KEYS,
|
|
96
|
+
...PADDING_KEYS,
|
|
97
|
+
...VARIANT_KEYS,
|
|
98
|
+
...ITEMS_KEYS,
|
|
99
|
+
...APPEARANCE_KEYS
|
|
100
|
+
];
|
|
101
|
+
// Grid keys
|
|
102
|
+
[
|
|
103
|
+
...BASE_COMPONENT_KEYS,
|
|
104
|
+
...GAP_KEYS,
|
|
105
|
+
...APPEARANCE_KEYS
|
|
106
|
+
];
|
|
107
|
+
// Row keys
|
|
108
|
+
[
|
|
109
|
+
...BASE_COMPONENT_KEYS,
|
|
110
|
+
...WRAP_KEYS,
|
|
111
|
+
...GAP_KEYS,
|
|
112
|
+
...DIRECTION_REVERSE_KEYS,
|
|
113
|
+
...ITEMS_KEYS,
|
|
114
|
+
...BREAKPOINT_KEYS,
|
|
115
|
+
...JUSTIFY_KEYS,
|
|
116
|
+
...APPEARANCE_KEYS
|
|
117
|
+
];
|
|
118
|
+
// Col keys
|
|
119
|
+
[
|
|
120
|
+
...BASE_COMPONENT_KEYS,
|
|
121
|
+
...WRAP_KEYS,
|
|
122
|
+
...GAP_KEYS,
|
|
123
|
+
...DIRECTION_REVERSE_KEYS,
|
|
124
|
+
...ITEMS_KEYS,
|
|
125
|
+
...JUSTIFY_KEYS,
|
|
126
|
+
...APPEARANCE_KEYS
|
|
127
|
+
];
|
|
128
|
+
// Card keys
|
|
129
|
+
[
|
|
130
|
+
...GAP_KEYS,
|
|
131
|
+
...ITEMS_KEYS,
|
|
132
|
+
...SHARP_KEYS,
|
|
133
|
+
...ROUNDED_KEYS,
|
|
134
|
+
...BREAKPOINT_KEYS,
|
|
135
|
+
...APPEARANCE_KEYS,
|
|
136
|
+
...BORDER_KEYS,
|
|
137
|
+
...RING_KEYS,
|
|
138
|
+
...SHADOW_KEYS,
|
|
139
|
+
...PADDING_KEYS,
|
|
140
|
+
...FLEX_DIRECTION_KEYS,
|
|
141
|
+
...TYPOGRAPHY_COMPONENT_KEYS,
|
|
142
|
+
...DIRECTION_REVERSE_KEYS,
|
|
143
|
+
...JUSTIFY_KEYS,
|
|
144
|
+
...WRAP_KEYS
|
|
145
|
+
];
|
|
146
|
+
// Stack keys
|
|
147
|
+
[
|
|
148
|
+
...BASE_COMPONENT_KEYS,
|
|
149
|
+
...WRAP_KEYS,
|
|
150
|
+
...GAP_KEYS,
|
|
151
|
+
...DIRECTION_REVERSE_KEYS,
|
|
152
|
+
...ITEMS_KEYS,
|
|
153
|
+
...BREAKPOINT_KEYS,
|
|
154
|
+
...JUSTIFY_KEYS,
|
|
155
|
+
...APPEARANCE_KEYS,
|
|
156
|
+
...FLEX_DIRECTION_KEYS,
|
|
157
|
+
...PADDING_KEYS
|
|
158
|
+
];
|
|
159
|
+
// Badge keys
|
|
160
|
+
[
|
|
161
|
+
...TYPOGRAPHY_COMPONENT_KEYS,
|
|
162
|
+
...SHAPE_KEYS,
|
|
163
|
+
...VARIANT_KEYS,
|
|
164
|
+
...SHADOW_KEYS,
|
|
165
|
+
...BORDER_KEYS,
|
|
166
|
+
...RING_KEYS,
|
|
167
|
+
...ITEMS_KEYS,
|
|
168
|
+
...GAP_KEYS,
|
|
169
|
+
...PADDING_KEYS,
|
|
170
|
+
...APPEARANCE_KEYS
|
|
171
|
+
];
|
|
172
|
+
// Chip keys
|
|
173
|
+
[
|
|
174
|
+
...TYPOGRAPHY_COMPONENT_KEYS,
|
|
175
|
+
...SHAPE_KEYS,
|
|
176
|
+
...VARIANT_KEYS,
|
|
177
|
+
...SHADOW_KEYS,
|
|
178
|
+
...BORDER_KEYS,
|
|
179
|
+
...RING_KEYS,
|
|
180
|
+
...ITEMS_KEYS,
|
|
181
|
+
...GAP_KEYS,
|
|
182
|
+
...PADDING_KEYS,
|
|
183
|
+
...APPEARANCE_KEYS
|
|
184
|
+
];
|
|
185
|
+
// Divider keys
|
|
186
|
+
[
|
|
187
|
+
...BASE_COMPONENT_KEYS,
|
|
188
|
+
...APPEARANCE_KEYS
|
|
189
|
+
];
|
|
190
|
+
// Container keys
|
|
191
|
+
[
|
|
192
|
+
...BASE_COMPONENT_KEYS,
|
|
193
|
+
...ITEMS_KEYS,
|
|
194
|
+
...APPEARANCE_KEYS,
|
|
195
|
+
...BORDER_KEYS,
|
|
196
|
+
...SHADOW_KEYS,
|
|
197
|
+
...RING_KEYS,
|
|
198
|
+
...GAP_KEYS,
|
|
199
|
+
];
|
|
200
|
+
// Section keys
|
|
201
|
+
[
|
|
202
|
+
...BASE_COMPONENT_KEYS,
|
|
203
|
+
...FLEX_DIRECTION_KEYS,
|
|
204
|
+
...ITEMS_KEYS,
|
|
205
|
+
...APPEARANCE_KEYS,
|
|
206
|
+
...PADDING_KEYS,
|
|
207
|
+
...DIRECTION_REVERSE_KEYS,
|
|
208
|
+
...JUSTIFY_KEYS,
|
|
209
|
+
...WRAP_KEYS,
|
|
210
|
+
...BREAKPOINT_KEYS,
|
|
211
|
+
...GAP_KEYS
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
const rowToColumnBreakpointClasses = {
|
|
215
|
+
xsCol: "max-xs:flex-col",
|
|
216
|
+
smCol: "max-sm:flex-col",
|
|
217
|
+
mdCol: "max-md:flex-col",
|
|
218
|
+
lgCol: "max-lg:flex-col",
|
|
219
|
+
xlCol: "max-xl:flex-col"
|
|
220
|
+
};
|
|
221
|
+
const justifyClasses = {
|
|
222
|
+
justifyStart: "justify-start",
|
|
223
|
+
justifyEnd: "justify-end",
|
|
224
|
+
justifyCenter: "justify-center",
|
|
225
|
+
justifyBetween: "justify-between",
|
|
226
|
+
justifyAround: "justify-around",
|
|
227
|
+
justifyEvenly: "justify-evenly",
|
|
228
|
+
justifyStretch: "justify-stretch",
|
|
229
|
+
justifyBaseline: "justify-baseline",
|
|
230
|
+
};
|
|
231
|
+
const wrapClasses = {
|
|
232
|
+
flexWrap: "flex-wrap",
|
|
233
|
+
flexNoWrap: "flex-nowrap",
|
|
234
|
+
flexWrapReverse: "flex-wrap-reverse"
|
|
235
|
+
};
|
|
236
|
+
const roundedClasses = {
|
|
237
|
+
xs: "rounded-sm",
|
|
238
|
+
sm: "rounded-md",
|
|
239
|
+
md: "rounded-lg",
|
|
240
|
+
lg: "rounded-xl",
|
|
241
|
+
xl: "rounded-2xl",
|
|
242
|
+
};
|
|
243
|
+
const hideClasses = {
|
|
244
|
+
xsHide: "max-xs:hidden",
|
|
245
|
+
smHide: "max-sm:hidden",
|
|
246
|
+
mdHide: "max-md:hidden",
|
|
247
|
+
lgHide: "max-lg:hidden",
|
|
248
|
+
xlHide: "max-xl:hidden"
|
|
249
|
+
};
|
|
250
|
+
const positionClasses = {
|
|
251
|
+
relative: "relative",
|
|
252
|
+
absolute: "absolute",
|
|
253
|
+
fixed: "fixed",
|
|
254
|
+
sticky: "sticky",
|
|
255
|
+
static: "static"
|
|
256
|
+
};
|
|
257
|
+
const shadowClasses = {
|
|
258
|
+
xs: "shadow-xs",
|
|
259
|
+
sm: "shadow-sm",
|
|
260
|
+
md: "shadow-md",
|
|
261
|
+
lg: "shadow-lg",
|
|
262
|
+
xl: "shadow-xl"
|
|
263
|
+
};
|
|
264
|
+
const hoverShadowClasses = {
|
|
265
|
+
xs: "hover:shadow-sm",
|
|
266
|
+
sm: "hover:shadow-md",
|
|
267
|
+
md: "hover:shadow-lg",
|
|
268
|
+
lg: "hover:shadow-xl",
|
|
269
|
+
xl: "hover:shadow-2xl"
|
|
270
|
+
};
|
|
271
|
+
const activeShadowClasses = {
|
|
272
|
+
xs: "active:shadow-sm",
|
|
273
|
+
sm: "active:shadow-md",
|
|
274
|
+
md: "active:shadow-lg",
|
|
275
|
+
lg: "active:shadow-xl",
|
|
276
|
+
xl: "active:shadow-2xl"
|
|
277
|
+
};
|
|
278
|
+
const noRingModeClasses = {
|
|
279
|
+
base: "ring-0",
|
|
280
|
+
hover: "hover:ring-0",
|
|
281
|
+
active: "active:ring-0",
|
|
282
|
+
};
|
|
283
|
+
const ringModeClasses = {
|
|
284
|
+
base: "ring ring-inset",
|
|
285
|
+
hover: "hover:ring hover:ring-inset",
|
|
286
|
+
active: "active:ring active:ring-inset",
|
|
287
|
+
};
|
|
288
|
+
const noShadowModeClasses = {
|
|
289
|
+
base: "shadow-none",
|
|
290
|
+
hover: "hover:shadow-none",
|
|
291
|
+
active: "active:shadow-none",
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
function pickFirstKeyOptional(props, keys, fallback = undefined) {
|
|
295
|
+
for (const k of keys) {
|
|
296
|
+
if (props[k])
|
|
297
|
+
return k;
|
|
298
|
+
}
|
|
299
|
+
return fallback;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Pick the first truthy key from props, then from defaults, then fallback.
|
|
303
|
+
*/
|
|
304
|
+
function pickKey(props, defaults, keys, fallback) {
|
|
305
|
+
// 1) explicit user prop
|
|
306
|
+
const explicit = pickFirstKeyOptional(props, keys);
|
|
307
|
+
if (explicit)
|
|
308
|
+
return explicit;
|
|
309
|
+
// 2) component‐level default
|
|
310
|
+
const def = pickFirstKeyOptional(defaults, keys);
|
|
311
|
+
if (def)
|
|
312
|
+
return def;
|
|
313
|
+
// 3) built‐in fallback
|
|
314
|
+
return fallback;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
class HideTheme extends BaseTheme {
|
|
318
|
+
constructor(initialConfig) {
|
|
319
|
+
super();
|
|
320
|
+
HIDE_KEYS.forEach((key) => {
|
|
321
|
+
var _a;
|
|
322
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : HideTheme.defaultClasses[key];
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
getClasses(props, defaults) {
|
|
326
|
+
const key = pickKey(props, defaults, HIDE_KEYS);
|
|
327
|
+
return [key ? this[key] : ''];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
HideTheme.defaultClasses = hideClasses;
|
|
331
|
+
|
|
332
|
+
const isObject = (item) => {
|
|
333
|
+
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
334
|
+
};
|
|
335
|
+
const deepMerge = (target, source) => {
|
|
336
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
337
|
+
for (const key in source) {
|
|
338
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
339
|
+
const sourceValue = source[key];
|
|
340
|
+
const targetValue = output[key];
|
|
341
|
+
if (sourceValue === undefined) {
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
345
|
+
if (key === 'defaults' &&
|
|
346
|
+
isObject(targetValue) &&
|
|
347
|
+
isObject(sourceValue)) {
|
|
348
|
+
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
349
|
+
}
|
|
350
|
+
// For all other objects, use the standard recursive deep merge.
|
|
351
|
+
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
352
|
+
output[key] = deepMerge(targetValue, sourceValue);
|
|
353
|
+
}
|
|
354
|
+
// For non-object values, just assign the value from the source.
|
|
355
|
+
else {
|
|
356
|
+
output[key] = sourceValue;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return output;
|
|
361
|
+
};
|
|
362
|
+
const deepClone = (source) => {
|
|
363
|
+
if (!isObject(source)) {
|
|
364
|
+
return source;
|
|
365
|
+
}
|
|
366
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
367
|
+
for (const key in output) {
|
|
368
|
+
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
369
|
+
output[key] = deepClone(output[key]);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return output;
|
|
373
|
+
};
|
|
374
|
+
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
375
|
+
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
376
|
+
const finalDefaults = { ...baseDefaults };
|
|
377
|
+
// Iterate over the override keys to apply them.
|
|
378
|
+
for (const key in overrideDefaults) {
|
|
379
|
+
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
380
|
+
const overrideValue = overrideDefaults[key];
|
|
381
|
+
// If the override is setting a key to true...
|
|
382
|
+
if (overrideValue) {
|
|
383
|
+
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
384
|
+
const group = findGroup(key);
|
|
385
|
+
// If the key is part of an exclusive group...
|
|
386
|
+
if (group) {
|
|
387
|
+
// ...set all other keys in that group to false.
|
|
388
|
+
group.forEach(groupKey => {
|
|
389
|
+
if (groupKey !== key) {
|
|
390
|
+
finalDefaults[groupKey] = false;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
finalDefaults[key] = overrideValue;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return finalDefaults;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
class ItemsTheme extends BaseTheme {
|
|
402
|
+
constructor(initialConfig) {
|
|
403
|
+
super();
|
|
404
|
+
ITEMS_KEYS.forEach((key) => {
|
|
405
|
+
var _a;
|
|
406
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : ItemsTheme.defaultClasses[key];
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
getClasses(props, defaults) {
|
|
410
|
+
const pickedKey = pickKey(props, defaults, ITEMS_KEYS);
|
|
411
|
+
return [pickedKey && this[pickedKey] ? this[pickedKey] : ''];
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
ItemsTheme.defaultClasses = {
|
|
415
|
+
itemsStart: "items-start",
|
|
416
|
+
itemsEnd: "items-end",
|
|
417
|
+
itemsCenter: "items-center",
|
|
418
|
+
itemsBaseline: "items-baseline",
|
|
419
|
+
itemsStretch: "items-stretch",
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
class JustifyTheme extends BaseTheme {
|
|
423
|
+
constructor(initialConfig) {
|
|
424
|
+
super();
|
|
425
|
+
JUSTIFY_KEYS.forEach((key) => {
|
|
426
|
+
var _a;
|
|
427
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : JustifyTheme.defaultClasses[key];
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
getClasses(props, defaults) {
|
|
431
|
+
const key = pickKey(props, defaults, JUSTIFY_KEYS);
|
|
432
|
+
return [key ? this[key] : ''];
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
JustifyTheme.defaultClasses = justifyClasses;
|
|
436
|
+
|
|
437
|
+
class PositionTheme extends BaseTheme {
|
|
438
|
+
constructor(initialConfig) {
|
|
439
|
+
super();
|
|
440
|
+
POSITION_KEYS.forEach((key) => {
|
|
441
|
+
var _a;
|
|
442
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : PositionTheme.defaultClasses[key];
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
getClasses(props, defaults) {
|
|
446
|
+
const key = pickKey(props, defaults, POSITION_KEYS);
|
|
447
|
+
return [key ? this[key] : ''];
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
PositionTheme.defaultClasses = positionClasses;
|
|
451
|
+
|
|
452
|
+
const fontWeightClasses = {
|
|
453
|
+
thin: "font-thin",
|
|
454
|
+
extralight: "font-extralight",
|
|
455
|
+
light: "font-light",
|
|
456
|
+
normal: "font-normal",
|
|
457
|
+
medium: "font-medium",
|
|
458
|
+
semibold: "font-semibold",
|
|
459
|
+
bold: "font-bold",
|
|
460
|
+
extrabold: "font-extrabold",
|
|
461
|
+
black: "font-black",
|
|
462
|
+
};
|
|
463
|
+
const fontStyleClasses = {
|
|
464
|
+
italic: "italic",
|
|
465
|
+
notItalic: "not-italic",
|
|
466
|
+
};
|
|
467
|
+
const fontFamilyClasses = {
|
|
468
|
+
sans: "font-sans",
|
|
469
|
+
serif: "font-serif",
|
|
470
|
+
mono: "font-mono",
|
|
471
|
+
};
|
|
472
|
+
const textDecorationClasses = {
|
|
473
|
+
underline: "underline",
|
|
474
|
+
lineThrough: "line-through",
|
|
475
|
+
noUnderline: "no-underline",
|
|
476
|
+
overline: "overline",
|
|
477
|
+
};
|
|
478
|
+
const textTransformClasses = {
|
|
479
|
+
uppercase: "uppercase",
|
|
480
|
+
lowercase: "lowercase",
|
|
481
|
+
capitalize: "capitalize",
|
|
482
|
+
normalCase: "normal-case",
|
|
483
|
+
};
|
|
484
|
+
const textAlignClasses = {
|
|
485
|
+
textLeft: "text-left",
|
|
486
|
+
textCenter: "text-center",
|
|
487
|
+
textRight: "text-right",
|
|
488
|
+
textJustify: "text-justify",
|
|
489
|
+
};
|
|
490
|
+
// Text appearance classes for filled buttons (all white text)
|
|
491
|
+
const filledTextAppearanceClasses = {
|
|
492
|
+
default: "text-white",
|
|
493
|
+
primary: "text-white",
|
|
494
|
+
secondary: "text-white",
|
|
495
|
+
tertiary: "text-white",
|
|
496
|
+
muted: "text-white",
|
|
497
|
+
link: "text-white",
|
|
498
|
+
accent: "text-white",
|
|
499
|
+
success: "text-white",
|
|
500
|
+
danger: "text-white",
|
|
501
|
+
warning: "text-white",
|
|
502
|
+
info: "text-white",
|
|
503
|
+
transparent: "text-transparent",
|
|
504
|
+
};
|
|
505
|
+
// Default text appearance classes (for non-button components)
|
|
506
|
+
const textAppearanceClasses = {
|
|
507
|
+
default: "text-(--text-color-default)",
|
|
508
|
+
primary: "text-(--text-color-primary)",
|
|
509
|
+
secondary: "text-(--text-color-secondary)",
|
|
510
|
+
tertiary: "text-(--text-color-tertiary)",
|
|
511
|
+
muted: "text-(--text-color-muted)",
|
|
512
|
+
link: "text-(--text-color-link)",
|
|
513
|
+
accent: "text-(--text-color-accent)",
|
|
514
|
+
success: "text-(--text-color-success)",
|
|
515
|
+
danger: "text-(--text-color-danger)",
|
|
516
|
+
warning: "text-(--text-color-warning)",
|
|
517
|
+
info: "text-(--text-color-info)",
|
|
518
|
+
transparent: "text-transparent",
|
|
519
|
+
};
|
|
520
|
+
// Text size classes
|
|
521
|
+
const textSizeClasses = {
|
|
522
|
+
xs: "text-xs",
|
|
523
|
+
sm: "text-sm",
|
|
524
|
+
md: "text-base",
|
|
525
|
+
lg: "text-lg",
|
|
526
|
+
xl: "text-xl",
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
class FontFamilyTheme extends BaseTheme {
|
|
530
|
+
constructor(initial) {
|
|
531
|
+
super();
|
|
532
|
+
FONT_FAMILY_KEYS.forEach((key) => {
|
|
533
|
+
var _a;
|
|
534
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontFamilyTheme.defaultClasses[key];
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
getClasses(props, defaults) {
|
|
538
|
+
const key = pickKey(props, defaults, FONT_FAMILY_KEYS);
|
|
539
|
+
return [this[key !== null && key !== void 0 ? key : 'sans'] || ''];
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
FontFamilyTheme.defaultClasses = fontFamilyClasses;
|
|
543
|
+
|
|
544
|
+
class FontWeightTheme extends BaseTheme {
|
|
545
|
+
constructor(initial) {
|
|
546
|
+
super();
|
|
547
|
+
FONT_WEIGHT_KEYS.forEach((key) => {
|
|
548
|
+
var _a;
|
|
549
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontWeightTheme.defaultClasses[key];
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
getClasses(props, defaults) {
|
|
553
|
+
const key = pickKey(props, defaults, FONT_WEIGHT_KEYS);
|
|
554
|
+
return [this[key !== null && key !== void 0 ? key : 'normal'] || '']; // Default to 'normal' if no key is provided
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
FontWeightTheme.defaultClasses = fontWeightClasses;
|
|
558
|
+
|
|
559
|
+
class FontStyleTheme extends BaseTheme {
|
|
560
|
+
constructor(initial) {
|
|
561
|
+
super();
|
|
562
|
+
FONT_STYLE_KEYS.forEach((key) => {
|
|
563
|
+
var _a;
|
|
564
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
getClasses(props, defaults) {
|
|
568
|
+
const key = pickKey(props, defaults, FONT_STYLE_KEYS);
|
|
569
|
+
return [key ? this[key] : '']; // No default for font style
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
FontStyleTheme.defaultClasses = fontStyleClasses;
|
|
573
|
+
|
|
574
|
+
class TextDecorationTheme extends BaseTheme {
|
|
575
|
+
constructor(initial) {
|
|
576
|
+
super();
|
|
577
|
+
TEXT_DECORATION_KEYS.forEach((key) => {
|
|
578
|
+
var _a;
|
|
579
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextDecorationTheme.defaultClasses[key];
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
getClasses(props, defaults) {
|
|
583
|
+
const key = pickKey(props, defaults, TEXT_DECORATION_KEYS);
|
|
584
|
+
return [key ? this[key] : '']; // No default for text decoration
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
TextDecorationTheme.defaultClasses = textDecorationClasses;
|
|
588
|
+
|
|
589
|
+
class TextTransformTheme extends BaseTheme {
|
|
590
|
+
constructor(initial) {
|
|
591
|
+
super();
|
|
592
|
+
TEXT_TRANSFORM_KEYS.forEach((key) => {
|
|
593
|
+
var _a;
|
|
594
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextTransformTheme.defaultClasses[key];
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
getClasses(props, defaults) {
|
|
598
|
+
const key = pickKey(props, defaults, TEXT_TRANSFORM_KEYS);
|
|
599
|
+
return [key ? this[key] : '']; // No default for text transform
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
TextTransformTheme.defaultClasses = textTransformClasses;
|
|
603
|
+
|
|
604
|
+
class TextAlignTheme extends BaseTheme {
|
|
605
|
+
constructor(initial) {
|
|
606
|
+
super();
|
|
607
|
+
TEXT_ALIGN_KEYS.forEach((key) => {
|
|
608
|
+
var _a;
|
|
609
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : TextAlignTheme.defaultClasses[key];
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
getClasses(props, defaults) {
|
|
613
|
+
const key = pickKey(props, defaults, TEXT_ALIGN_KEYS);
|
|
614
|
+
return [key ? this[key] : '']; // No default for text align
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
TextAlignTheme.defaultClasses = textAlignClasses;
|
|
618
|
+
|
|
619
|
+
class ComponentTheme {
|
|
620
|
+
constructor(tag, base, subThemes, defaults = {}) {
|
|
621
|
+
this.tag = tag;
|
|
622
|
+
this.base = base;
|
|
623
|
+
this.defaults = defaults;
|
|
624
|
+
const defaultInternalThemes = {
|
|
625
|
+
layout: {
|
|
626
|
+
hide: new HideTheme(),
|
|
627
|
+
items: new ItemsTheme(),
|
|
628
|
+
justify: new JustifyTheme(),
|
|
629
|
+
position: new PositionTheme(),
|
|
630
|
+
},
|
|
631
|
+
typography: {
|
|
632
|
+
fontFamily: new FontFamilyTheme(),
|
|
633
|
+
fontWeight: new FontWeightTheme(),
|
|
634
|
+
fontStyle: new FontStyleTheme(),
|
|
635
|
+
textDecoration: new TextDecorationTheme(),
|
|
636
|
+
textTransform: new TextTransformTheme(),
|
|
637
|
+
textAlign: new TextAlignTheme()
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
this.themes = deepMerge(defaultInternalThemes, subThemes);
|
|
641
|
+
}
|
|
642
|
+
getClasses(props, defaults = this.defaults) {
|
|
643
|
+
const user = props;
|
|
644
|
+
const defs = defaults;
|
|
645
|
+
const classes = [];
|
|
646
|
+
if (this.base) {
|
|
647
|
+
classes.push(...this.base.split(/\s+/));
|
|
648
|
+
}
|
|
649
|
+
const walk = (map) => {
|
|
650
|
+
for (const key of Object.keys(map)) {
|
|
651
|
+
const node = map[key];
|
|
652
|
+
if (node instanceof BaseTheme) {
|
|
653
|
+
classes.push(...node.getClasses(user, defs));
|
|
654
|
+
}
|
|
655
|
+
else if (node && typeof node === "object" && !Array.isArray(node)) {
|
|
656
|
+
walk(node);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
walk(this.themes);
|
|
661
|
+
return classes.filter(Boolean);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
class SizeTheme extends BaseTheme {
|
|
666
|
+
constructor(initial) {
|
|
667
|
+
super();
|
|
668
|
+
SIZE_KEYS.forEach((key) => {
|
|
669
|
+
var _a;
|
|
670
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : SizeTheme.defaultClasses[key];
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
getClasses(props, defaults) {
|
|
674
|
+
const size = pickKey(props, defaults, SIZE_KEYS);
|
|
675
|
+
return [this[size !== null && size !== void 0 ? size : 'md'] || ''];
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
SizeTheme.defaultClasses = {
|
|
679
|
+
xs: '',
|
|
680
|
+
sm: '',
|
|
681
|
+
md: '',
|
|
682
|
+
lg: '',
|
|
683
|
+
xl: ''
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
class GapTheme extends BaseTheme {
|
|
687
|
+
constructor(initial) {
|
|
688
|
+
super();
|
|
689
|
+
GAP_KEYS.forEach((key) => {
|
|
690
|
+
var _a;
|
|
691
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : GapTheme.defaultClasses[key];
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
getClasses(props, defaults) {
|
|
695
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
696
|
+
const key = pickKey(props, defaults, GAP_KEYS) || 'noGap';
|
|
697
|
+
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
GapTheme.defaultClasses = {
|
|
701
|
+
gap: {
|
|
702
|
+
xs: 'gap-2',
|
|
703
|
+
sm: 'gap-3',
|
|
704
|
+
md: 'gap-4',
|
|
705
|
+
lg: 'gap-5',
|
|
706
|
+
xl: 'gap-6',
|
|
707
|
+
},
|
|
708
|
+
noGap: "gap-0"
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
class RadiusTheme extends BaseTheme {
|
|
712
|
+
constructor(initial) {
|
|
713
|
+
super();
|
|
714
|
+
SHAPE_KEYS.forEach((key) => {
|
|
715
|
+
var _a;
|
|
716
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : RadiusTheme.defaultClasses[key];
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
getClasses(props, defaults) {
|
|
720
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
721
|
+
const shape = pickKey(props, defaults, SHAPE_KEYS) || 'rounded';
|
|
722
|
+
return [typeof this[shape] === 'string' ? this[shape] : this[shape][size]];
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
RadiusTheme.defaultClasses = {
|
|
726
|
+
pill: "rounded-full",
|
|
727
|
+
sharp: "rounded-none",
|
|
728
|
+
rounded: roundedClasses
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
class ShadowTheme extends BaseTheme {
|
|
732
|
+
constructor(initial) {
|
|
733
|
+
super();
|
|
734
|
+
SHADOW_KEYS.forEach((key) => {
|
|
735
|
+
var _a;
|
|
736
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : ShadowTheme.defaultClasses[key];
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
getClasses(props, defaults) {
|
|
740
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
741
|
+
const key = pickKey(props, defaults, SHADOW_KEYS);
|
|
742
|
+
if (key === undefined) {
|
|
743
|
+
return [];
|
|
744
|
+
}
|
|
745
|
+
const isModeStringMap = MODE_KEYS.every(m => typeof this[key][m] === "string");
|
|
746
|
+
return MODE_KEYS.map(mode => isModeStringMap
|
|
747
|
+
? this[key][mode]
|
|
748
|
+
: this[key][mode][size]);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
ShadowTheme.defaultClasses = {
|
|
752
|
+
shadow: {
|
|
753
|
+
base: shadowClasses,
|
|
754
|
+
hover: hoverShadowClasses,
|
|
755
|
+
active: activeShadowClasses,
|
|
756
|
+
},
|
|
757
|
+
noShadow: noShadowModeClasses
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
class BorderTheme extends BaseTheme {
|
|
761
|
+
constructor(initial) {
|
|
762
|
+
super();
|
|
763
|
+
BORDER_KEYS.forEach((key) => {
|
|
764
|
+
this[key] = {
|
|
765
|
+
...BorderTheme.defaultClasses[key],
|
|
766
|
+
...((initial === null || initial === void 0 ? void 0 : initial[key]) || {}),
|
|
767
|
+
};
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
getClasses(props, defaults) {
|
|
771
|
+
const key = pickKey(props, defaults, BORDER_KEYS);
|
|
772
|
+
if (!key || !this[key]) {
|
|
773
|
+
return MODE_KEYS.map(() => '');
|
|
774
|
+
}
|
|
775
|
+
return MODE_KEYS.map(mode => this[key][mode] || '');
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
BorderTheme.defaultClasses = {
|
|
779
|
+
border: {
|
|
780
|
+
base: "border",
|
|
781
|
+
hover: "hover:border",
|
|
782
|
+
active: "active:border",
|
|
783
|
+
},
|
|
784
|
+
noBorder: {
|
|
785
|
+
base: "border-none",
|
|
786
|
+
hover: "hover:border-none",
|
|
787
|
+
active: "active:border-none",
|
|
788
|
+
},
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
class RingTheme extends BaseTheme {
|
|
792
|
+
constructor(initial) {
|
|
793
|
+
super();
|
|
794
|
+
RING_KEYS.forEach((key) => {
|
|
795
|
+
this[key] = {
|
|
796
|
+
...RingTheme.defaultClasses[key],
|
|
797
|
+
...((initial === null || initial === void 0 ? void 0 : initial[key]) || {}),
|
|
798
|
+
};
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
getClasses(props, defaults) {
|
|
802
|
+
const key = pickKey(props, defaults, RING_KEYS);
|
|
803
|
+
if (!key || !this[key]) {
|
|
804
|
+
return MODE_KEYS.map(() => '');
|
|
805
|
+
}
|
|
806
|
+
return MODE_KEYS.map(mode => this[key][mode] || '');
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
RingTheme.defaultClasses = {
|
|
810
|
+
ring: ringModeClasses,
|
|
811
|
+
noRing: noRingModeClasses,
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
class PxTheme extends BaseTheme {
|
|
815
|
+
constructor(initial) {
|
|
816
|
+
super();
|
|
817
|
+
PADDING_KEYS.forEach((key) => {
|
|
818
|
+
var _a;
|
|
819
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : PxTheme.defaultClasses[key];
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
getClasses(props, defaults) {
|
|
823
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
824
|
+
const key = pickKey(props, defaults, PADDING_KEYS) || 'noPadding';
|
|
825
|
+
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
PxTheme.defaultClasses = {
|
|
829
|
+
padding: {
|
|
830
|
+
xs: "px-2",
|
|
831
|
+
sm: "px-4",
|
|
832
|
+
md: "px-6",
|
|
833
|
+
lg: "px-8",
|
|
834
|
+
xl: "px-10"
|
|
835
|
+
},
|
|
836
|
+
noPadding: "px-0"
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
class PyTheme extends BaseTheme {
|
|
840
|
+
constructor(initial) {
|
|
841
|
+
super();
|
|
842
|
+
PADDING_KEYS.forEach((key) => {
|
|
843
|
+
var _a;
|
|
844
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : PyTheme.defaultClasses[key];
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
getClasses(props, defaults) {
|
|
848
|
+
const size = pickKey(props, defaults, SIZE_KEYS) || 'md';
|
|
849
|
+
const key = pickKey(props, defaults, PADDING_KEYS) || 'noPadding';
|
|
850
|
+
return [typeof this[key] === 'string' ? this[key] : this[key][size]];
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
PyTheme.defaultClasses = {
|
|
854
|
+
padding: {
|
|
855
|
+
xs: "py-2",
|
|
856
|
+
sm: "py-4",
|
|
857
|
+
md: "py-6",
|
|
858
|
+
lg: "py-8",
|
|
859
|
+
xl: "py-10"
|
|
860
|
+
},
|
|
861
|
+
noPadding: "py-0"
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
class TextAppearanceTheme extends BaseTheme {
|
|
865
|
+
constructor(initialOverrides) {
|
|
866
|
+
super();
|
|
867
|
+
TEXT_APPEARANCE_KEYS.forEach((textKey) => {
|
|
868
|
+
const defaultModesForKey = TextAppearanceTheme.defaultFullConfig[textKey];
|
|
869
|
+
const overrideModesForKey = initialOverrides === null || initialOverrides === void 0 ? void 0 : initialOverrides[textKey];
|
|
870
|
+
this[textKey] = {
|
|
871
|
+
...defaultModesForKey,
|
|
872
|
+
...(overrideModesForKey || {}),
|
|
873
|
+
};
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
getClasses(props, defaults) {
|
|
877
|
+
const pickedAppearanceKey = pickKey(props, defaults, TEXT_APPEARANCE_KEYS, 'default');
|
|
878
|
+
const modesForAppearance = this[pickedAppearanceKey];
|
|
879
|
+
if (!modesForAppearance) {
|
|
880
|
+
return MODE_KEYS.map(() => '');
|
|
881
|
+
}
|
|
882
|
+
return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
|
|
883
|
+
}
|
|
884
|
+
static createDefaultStyle(src = {}) {
|
|
885
|
+
const initialOverridesForConstructor = {};
|
|
886
|
+
TEXT_APPEARANCE_KEYS.forEach((textKey) => {
|
|
887
|
+
const modesForCurrentTextKey = {};
|
|
888
|
+
let keyHasDataInSrc = false;
|
|
889
|
+
MODE_KEYS.forEach((modeKey) => {
|
|
890
|
+
var _a;
|
|
891
|
+
const classValue = (_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey];
|
|
892
|
+
if (classValue !== undefined) {
|
|
893
|
+
modesForCurrentTextKey[modeKey] = classValue;
|
|
894
|
+
keyHasDataInSrc = true;
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
if (keyHasDataInSrc) {
|
|
898
|
+
initialOverridesForConstructor[textKey] = modesForCurrentTextKey;
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
return new TextAppearanceTheme(initialOverridesForConstructor);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
TextAppearanceTheme.defaultFullConfig = (() => {
|
|
905
|
+
const config = {};
|
|
906
|
+
TEXT_APPEARANCE_KEYS.forEach((key) => {
|
|
907
|
+
config[key] = {
|
|
908
|
+
base: textAppearanceClasses[key] || '',
|
|
909
|
+
hover: '',
|
|
910
|
+
active: '',
|
|
911
|
+
};
|
|
912
|
+
});
|
|
913
|
+
return config;
|
|
914
|
+
})();
|
|
915
|
+
|
|
916
|
+
// Background classes for filled buttons
|
|
917
|
+
const filledBackgroundAppearanceClasses = {
|
|
918
|
+
default: "bg-(--filled-background-color-default)",
|
|
919
|
+
primary: "bg-(--filled-background-color-primary)",
|
|
920
|
+
secondary: "bg-(--filled-background-color-secondary)",
|
|
921
|
+
tertiary: "bg-(--filled-background-color-tertiary)",
|
|
922
|
+
accent: "bg-(--filled-background-color-accent)",
|
|
923
|
+
success: "bg-(--filled-background-color-success)",
|
|
924
|
+
danger: "bg-(--filled-background-color-danger)",
|
|
925
|
+
warning: "bg-(--filled-background-color-warning)",
|
|
926
|
+
info: "bg-(--filled-background-color-info)",
|
|
927
|
+
transparent: "bg-transparent",
|
|
928
|
+
muted: "bg-(--filled-background-color-muted)",
|
|
929
|
+
link: "bg-(--filled-background-color-link)",
|
|
930
|
+
};
|
|
931
|
+
// Hover background classes for filled buttons
|
|
932
|
+
const filledHoverBackgroundAppearanceClasses = {
|
|
933
|
+
default: "hover:bg-(--filled-background-color-hover-default)",
|
|
934
|
+
primary: "hover:bg-(--filled-background-color-hover-primary)",
|
|
935
|
+
secondary: "hover:bg-(--filled-background-color-hover-secondary)",
|
|
936
|
+
tertiary: "hover:bg-(--filled-background-color-hover-tertiary)",
|
|
937
|
+
accent: "hover:bg-(--filled-background-color-hover-accent)",
|
|
938
|
+
success: "hover:bg-(--filled-background-color-hover-success)",
|
|
939
|
+
danger: "hover:bg-(--filled-background-color-hover-danger)",
|
|
940
|
+
warning: "hover:bg-(--filled-background-color-hover-warning)",
|
|
941
|
+
info: "hover:bg-(--filled-background-color-hover-info)",
|
|
942
|
+
transparent: "hover:bg-transparent",
|
|
943
|
+
muted: "hover:bg-(--filled-background-color-hover-muted)",
|
|
944
|
+
link: "hover:bg-(--filled-background-color-hover-link)",
|
|
945
|
+
};
|
|
946
|
+
// Active background classes for filled buttons
|
|
947
|
+
const filledActiveBackgroundAppearanceClasses = {
|
|
948
|
+
default: "active:bg-(--filled-background-color-active-default)",
|
|
949
|
+
primary: "active:bg-(--filled-background-color-active-primary)",
|
|
950
|
+
secondary: "active:bg-(--filled-background-color-active-secondary)",
|
|
951
|
+
tertiary: "active:bg-(--filled-background-color-active-tertiary)",
|
|
952
|
+
accent: "active:bg-(--filled-background-color-active-accent)",
|
|
953
|
+
success: "active:bg-(--filled-background-color-active-success)",
|
|
954
|
+
danger: "active:bg-(--filled-background-color-active-danger)",
|
|
955
|
+
warning: "active:bg-(--filled-background-color-active-warning)",
|
|
956
|
+
info: "active:bg-(--filled-background-color-active-info)",
|
|
957
|
+
transparent: "active:bg-transparent",
|
|
958
|
+
muted: "active:bg-(--filled-background-color-active-muted)",
|
|
959
|
+
link: "active:bg-(--filled-background-color-active-link)",
|
|
960
|
+
};
|
|
961
|
+
// Default background appearance classes (for non-button components)
|
|
962
|
+
const backgroundAppearanceClasses = {
|
|
963
|
+
default: "bg-(--background-color-default)",
|
|
964
|
+
primary: "bg-(--background-color-primary)",
|
|
965
|
+
secondary: "bg-(--background-color-secondary)",
|
|
966
|
+
tertiary: "bg-(--background-color-tertiary)",
|
|
967
|
+
accent: "bg-(--background-color-accent)",
|
|
968
|
+
success: "bg-(--background-color-success)",
|
|
969
|
+
danger: "bg-(--background-color-danger)",
|
|
970
|
+
warning: "bg-(--background-color-warning)",
|
|
971
|
+
info: "bg-(--background-color-info)",
|
|
972
|
+
transparent: "bg-transparent",
|
|
973
|
+
muted: "bg-(--background-color-muted)",
|
|
974
|
+
link: "bg-(--background-color-link)",
|
|
975
|
+
};
|
|
976
|
+
// Hover background appearance classes for outline buttons
|
|
977
|
+
const hoverBackgroundAppearanceClasses = {
|
|
978
|
+
default: "hover:bg-(--background-color-hover-default)",
|
|
979
|
+
primary: "hover:bg-(--background-color-hover-primary)",
|
|
980
|
+
secondary: "hover:bg-(--background-color-hover-secondary)",
|
|
981
|
+
tertiary: "hover:bg-(--background-color-hover-tertiary)",
|
|
982
|
+
accent: "hover:bg-(--background-color-hover-accent)",
|
|
983
|
+
success: "hover:bg-(--background-color-hover-success)",
|
|
984
|
+
danger: "hover:bg-(--background-color-hover-danger)",
|
|
985
|
+
warning: "hover:bg-(--background-color-hover-warning)",
|
|
986
|
+
info: "hover:bg-(--background-color-hover-info)",
|
|
987
|
+
transparent: "hover:bg-transparent",
|
|
988
|
+
muted: "hover:bg-(--background-color-hover-muted)",
|
|
989
|
+
link: "hover:bg-(--background-color-hover-link)",
|
|
990
|
+
};
|
|
991
|
+
// Active background appearance classes for outline buttons
|
|
992
|
+
const activeBackgroundAppearanceClasses = {
|
|
993
|
+
default: "active:bg-(--background-color-active-default)",
|
|
994
|
+
primary: "active:bg-(--background-color-active-primary)",
|
|
995
|
+
secondary: "active:bg-(--background-color-active-secondary)",
|
|
996
|
+
tertiary: "active:bg-(--background-color-active-tertiary)",
|
|
997
|
+
accent: "active:bg-(--background-color-active-accent)",
|
|
998
|
+
success: "active:bg-(--background-color-active-success)",
|
|
999
|
+
danger: "active:bg-(--background-color-active-danger)",
|
|
1000
|
+
warning: "active:bg-(--background-color-active-warning)",
|
|
1001
|
+
info: "active:bg-(--background-color-active-info)",
|
|
1002
|
+
transparent: "active:bg-transparent",
|
|
1003
|
+
muted: "active:bg-(--background-color-active-muted)",
|
|
1004
|
+
link: "active:bg-(--background-color-active-link)",
|
|
1005
|
+
};
|
|
1006
|
+
const layoutBackgroundAppearanceClasses = {
|
|
1007
|
+
default: "bg-(--layout-background-default)",
|
|
1008
|
+
primary: "bg-(--layout-background-primary)",
|
|
1009
|
+
secondary: "bg-(--layout-background-secondary)",
|
|
1010
|
+
tertiary: "bg-(--layout-background-tertiary)",
|
|
1011
|
+
accent: "bg-(--layout-background-accent)",
|
|
1012
|
+
success: "bg-(--layout-background-success)",
|
|
1013
|
+
danger: "bg-(--layout-background-danger)",
|
|
1014
|
+
warning: "bg-(--layout-background-warning)",
|
|
1015
|
+
info: "bg-(--layout-background-info)",
|
|
1016
|
+
transparent: "bg-transparent",
|
|
1017
|
+
};
|
|
1018
|
+
const dividerAppearanceClasses = {
|
|
1019
|
+
default: "bg-(--border-color-default)",
|
|
1020
|
+
primary: "bg-(--border-color-primary)",
|
|
1021
|
+
secondary: "bg-(--border-color-secondary)",
|
|
1022
|
+
tertiary: "bg-(--border-color-tertiary)",
|
|
1023
|
+
accent: "bg-(--border-color-accent)",
|
|
1024
|
+
success: "bg-(--border-color-success)",
|
|
1025
|
+
danger: "bg-(--border-color-danger)",
|
|
1026
|
+
warning: "bg-(--border-color-warning)",
|
|
1027
|
+
info: "bg-(--border-color-info)",
|
|
1028
|
+
transparent: "bg-transparent",
|
|
1029
|
+
muted: "bg-(--border-color-muted)",
|
|
1030
|
+
link: "bg-(--border-color-link)",
|
|
1031
|
+
};
|
|
1032
|
+
const borderAppearanceClasses = {
|
|
1033
|
+
default: "border-(--border-color-default)",
|
|
1034
|
+
primary: "border-(--border-color-primary)",
|
|
1035
|
+
secondary: "border-(--border-color-secondary)",
|
|
1036
|
+
tertiary: "border-(--border-color-tertiary)",
|
|
1037
|
+
accent: "border-(--border-color-accent)",
|
|
1038
|
+
success: "border-(--border-color-success)",
|
|
1039
|
+
danger: "border-(--border-color-danger)",
|
|
1040
|
+
warning: "border-(--border-color-warning)",
|
|
1041
|
+
info: "border-(--border-color-info)",
|
|
1042
|
+
transparent: "border-transparent",
|
|
1043
|
+
muted: "border-(--border-color-muted)",
|
|
1044
|
+
link: "border-(--border-color-link)",
|
|
1045
|
+
};
|
|
1046
|
+
// Border classes for filled elements
|
|
1047
|
+
const filledBorderAppearanceClasses = {
|
|
1048
|
+
default: "border-(--filled-border-color-default)",
|
|
1049
|
+
primary: "border-(--filled-border-color-primary)",
|
|
1050
|
+
secondary: "border-(--filled-border-color-secondary)",
|
|
1051
|
+
tertiary: "border-(--filled-border-color-tertiary)",
|
|
1052
|
+
accent: "border-(--filled-border-color-accent)",
|
|
1053
|
+
success: "border-(--filled-border-color-success)",
|
|
1054
|
+
danger: "border-(--filled-border-color-danger)",
|
|
1055
|
+
warning: "border-(--filled-border-color-warning)",
|
|
1056
|
+
info: "border-(--filled-border-color-info)",
|
|
1057
|
+
transparent: "border-transparent",
|
|
1058
|
+
muted: "border-(--filled-border-color-muted)",
|
|
1059
|
+
link: "border-(--filled-border-color-link)",
|
|
1060
|
+
};
|
|
1061
|
+
const ringAppearanceClasses = {
|
|
1062
|
+
default: "ring-(--border-color-default)",
|
|
1063
|
+
primary: "ring-(--border-color-primary)",
|
|
1064
|
+
secondary: "ring-(--border-color-secondary)",
|
|
1065
|
+
tertiary: "ring-(--border-color-tertiary)",
|
|
1066
|
+
accent: "ring-(--border-color-accent)",
|
|
1067
|
+
success: "ring-(--border-color-success)",
|
|
1068
|
+
danger: "ring-(--border-color-danger)",
|
|
1069
|
+
warning: "ring-(--border-color-warning)",
|
|
1070
|
+
info: "ring-(--border-color-info)",
|
|
1071
|
+
transparent: "ring-transparent",
|
|
1072
|
+
muted: "ring-(--border-color-muted)",
|
|
1073
|
+
link: "ring-(--border-color-link)",
|
|
1074
|
+
};
|
|
1075
|
+
// Ring classes for filled elements
|
|
1076
|
+
const filledRingAppearanceClasses = {
|
|
1077
|
+
default: "ring-(--filled-border-color-default)",
|
|
1078
|
+
primary: "ring-(--filled-border-color-primary)",
|
|
1079
|
+
secondary: "ring-(--filled-border-color-secondary)",
|
|
1080
|
+
tertiary: "ring-(--filled-border-color-tertiary)",
|
|
1081
|
+
accent: "ring-(--filled-border-color-accent)",
|
|
1082
|
+
success: "ring-(--filled-border-color-success)",
|
|
1083
|
+
danger: "ring-(--filled-border-color-danger)",
|
|
1084
|
+
warning: "ring-(--filled-border-color-warning)",
|
|
1085
|
+
info: "ring-(--filled-border-color-info)",
|
|
1086
|
+
transparent: "ring-transparent",
|
|
1087
|
+
muted: "ring-(--filled-border-color-muted)",
|
|
1088
|
+
link: "ring-(--filled-border-color-link)",
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
class VariantTheme extends BaseTheme {
|
|
1092
|
+
constructor(variantInstances = VariantTheme.defaultInstances) {
|
|
1093
|
+
super();
|
|
1094
|
+
VARIANT_KEYS.forEach((variantKey) => {
|
|
1095
|
+
this[variantKey] = variantInstances[variantKey] || VariantTheme.defaultInstances[variantKey];
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
getClasses(props, defaults) {
|
|
1099
|
+
const activeVariantKey = pickKey(props, defaults, VARIANT_KEYS, 'outline');
|
|
1100
|
+
const activeTextAppearanceTheme = this[activeVariantKey];
|
|
1101
|
+
if (!activeTextAppearanceTheme) {
|
|
1102
|
+
return [];
|
|
1103
|
+
}
|
|
1104
|
+
return activeTextAppearanceTheme.getClasses(props, defaults);
|
|
1105
|
+
}
|
|
1106
|
+
static createDefault(initialInstances) {
|
|
1107
|
+
const fullInitialInstances = {
|
|
1108
|
+
...VariantTheme.defaultInstances,
|
|
1109
|
+
...(initialInstances || {})
|
|
1110
|
+
};
|
|
1111
|
+
return new VariantTheme(fullInitialInstances);
|
|
1112
|
+
}
|
|
1113
|
+
static createDefaultBackground() {
|
|
1114
|
+
return this.createDefault({
|
|
1115
|
+
outline: TextAppearanceTheme.createDefaultStyle({
|
|
1116
|
+
base: backgroundAppearanceClasses,
|
|
1117
|
+
hover: hoverBackgroundAppearanceClasses,
|
|
1118
|
+
active: activeBackgroundAppearanceClasses
|
|
1119
|
+
}),
|
|
1120
|
+
filled: TextAppearanceTheme.createDefaultStyle({
|
|
1121
|
+
base: filledBackgroundAppearanceClasses,
|
|
1122
|
+
hover: filledHoverBackgroundAppearanceClasses,
|
|
1123
|
+
active: filledActiveBackgroundAppearanceClasses
|
|
1124
|
+
})
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
static createDefaultText() {
|
|
1128
|
+
return this.createDefault({
|
|
1129
|
+
outline: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
1130
|
+
filled: TextAppearanceTheme.createDefaultStyle({ base: filledTextAppearanceClasses })
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
static createDefaultBorder() {
|
|
1134
|
+
return this.createDefault({
|
|
1135
|
+
outline: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
1136
|
+
filled: TextAppearanceTheme.createDefaultStyle({ base: filledBorderAppearanceClasses })
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
static createDefaultRing() {
|
|
1140
|
+
return this.createDefault({
|
|
1141
|
+
outline: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
1142
|
+
filled: TextAppearanceTheme.createDefaultStyle({ base: filledRingAppearanceClasses })
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
VariantTheme.defaultInstances = Object.fromEntries(VARIANT_KEYS.map(variantKey => [
|
|
1147
|
+
variantKey,
|
|
1148
|
+
new TextAppearanceTheme()
|
|
1149
|
+
]));
|
|
1150
|
+
|
|
1151
|
+
const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-pointer inline-flex items-center justify-center transition-all duration-200 whitespace-nowrap", {
|
|
1152
|
+
size: {
|
|
1153
|
+
px: new PxTheme({
|
|
1154
|
+
padding: {
|
|
1155
|
+
xs: 'px-2',
|
|
1156
|
+
sm: 'px-2.5',
|
|
1157
|
+
md: 'px-3.5',
|
|
1158
|
+
lg: 'px-5',
|
|
1159
|
+
xl: 'px-6',
|
|
1160
|
+
}
|
|
1161
|
+
}),
|
|
1162
|
+
py: new PyTheme({
|
|
1163
|
+
padding: {
|
|
1164
|
+
xs: 'py-1',
|
|
1165
|
+
sm: 'py-1.5',
|
|
1166
|
+
md: 'py-2',
|
|
1167
|
+
lg: 'py-3',
|
|
1168
|
+
xl: 'py-4',
|
|
1169
|
+
}
|
|
1170
|
+
}),
|
|
1171
|
+
gap: new GapTheme({
|
|
1172
|
+
gap: {
|
|
1173
|
+
xs: 'gap-1.5',
|
|
1174
|
+
sm: 'gap-2',
|
|
1175
|
+
md: 'gap-3',
|
|
1176
|
+
lg: 'gap-4',
|
|
1177
|
+
xl: 'gap-5',
|
|
1178
|
+
}
|
|
1179
|
+
}),
|
|
1180
|
+
text: new SizeTheme({
|
|
1181
|
+
xs: 'text-xs/5',
|
|
1182
|
+
sm: 'text-sm/5',
|
|
1183
|
+
md: 'text-base',
|
|
1184
|
+
lg: 'text-lg/6',
|
|
1185
|
+
xl: 'text-xl/6',
|
|
1186
|
+
}),
|
|
1187
|
+
shadow: new ShadowTheme(),
|
|
1188
|
+
},
|
|
1189
|
+
appearance: {
|
|
1190
|
+
background: VariantTheme.createDefaultBackground(),
|
|
1191
|
+
text: VariantTheme.createDefaultText(),
|
|
1192
|
+
border: VariantTheme.createDefaultBorder(),
|
|
1193
|
+
ring: VariantTheme.createDefaultRing(),
|
|
1194
|
+
},
|
|
1195
|
+
layout: {
|
|
1196
|
+
border: new BorderTheme(),
|
|
1197
|
+
ring: new RingTheme(),
|
|
1198
|
+
radius: new RadiusTheme({
|
|
1199
|
+
rounded: {
|
|
1200
|
+
xs: 'rounded-sm',
|
|
1201
|
+
sm: 'rounded-md',
|
|
1202
|
+
md: 'rounded-md',
|
|
1203
|
+
lg: 'rounded-lg',
|
|
1204
|
+
xl: 'rounded-xl',
|
|
1205
|
+
}
|
|
1206
|
+
}),
|
|
1207
|
+
},
|
|
1208
|
+
}, {
|
|
1209
|
+
md: true,
|
|
1210
|
+
outline: true,
|
|
1211
|
+
default: true,
|
|
1212
|
+
rounded: true,
|
|
1213
|
+
sans: true,
|
|
1214
|
+
semibold: true,
|
|
1215
|
+
textCenter: true,
|
|
1216
|
+
noBorder: true,
|
|
1217
|
+
gap: true,
|
|
1218
|
+
padding: true,
|
|
1219
|
+
ring: true,
|
|
1220
|
+
shadow: true,
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit inline-flex transition-all duration-200 whitespace-nowrap", {
|
|
1224
|
+
size: {
|
|
1225
|
+
px: new PxTheme({
|
|
1226
|
+
padding: {
|
|
1227
|
+
xs: "px-2",
|
|
1228
|
+
sm: "px-2.5",
|
|
1229
|
+
md: "px-3.5",
|
|
1230
|
+
lg: "px-5",
|
|
1231
|
+
xl: "px-6"
|
|
1232
|
+
}
|
|
1233
|
+
}),
|
|
1234
|
+
py: new PyTheme({
|
|
1235
|
+
padding: {
|
|
1236
|
+
xs: "py-1",
|
|
1237
|
+
sm: "py-1.5",
|
|
1238
|
+
md: "py-2",
|
|
1239
|
+
lg: "py-3",
|
|
1240
|
+
xl: "py-4"
|
|
1241
|
+
}
|
|
1242
|
+
}),
|
|
1243
|
+
gap: new GapTheme({
|
|
1244
|
+
gap: {
|
|
1245
|
+
xs: "gap-1",
|
|
1246
|
+
sm: "gap-1.5",
|
|
1247
|
+
md: "gap-2",
|
|
1248
|
+
lg: "gap-2.5",
|
|
1249
|
+
xl: "gap-3"
|
|
1250
|
+
}
|
|
1251
|
+
}),
|
|
1252
|
+
text: new SizeTheme({
|
|
1253
|
+
xs: 'text-xs/5',
|
|
1254
|
+
sm: 'text-sm/5',
|
|
1255
|
+
md: 'text-base',
|
|
1256
|
+
lg: 'text-lg/6',
|
|
1257
|
+
xl: 'text-xl/6',
|
|
1258
|
+
}),
|
|
1259
|
+
shadow: new ShadowTheme(),
|
|
1260
|
+
},
|
|
1261
|
+
appearance: {
|
|
1262
|
+
background: VariantTheme.createDefault({
|
|
1263
|
+
outline: TextAppearanceTheme.createDefaultStyle({
|
|
1264
|
+
base: backgroundAppearanceClasses,
|
|
1265
|
+
}),
|
|
1266
|
+
filled: TextAppearanceTheme.createDefaultStyle({
|
|
1267
|
+
base: filledBackgroundAppearanceClasses,
|
|
1268
|
+
})
|
|
1269
|
+
}),
|
|
1270
|
+
text: VariantTheme.createDefaultText(),
|
|
1271
|
+
border: VariantTheme.createDefaultBorder(),
|
|
1272
|
+
ring: VariantTheme.createDefaultRing(),
|
|
1273
|
+
},
|
|
1274
|
+
layout: {
|
|
1275
|
+
border: new BorderTheme(),
|
|
1276
|
+
ring: new RingTheme(),
|
|
1277
|
+
radius: new RadiusTheme({
|
|
1278
|
+
rounded: {
|
|
1279
|
+
xs: "rounded-xs",
|
|
1280
|
+
sm: "rounded-sm",
|
|
1281
|
+
md: "rounded-md",
|
|
1282
|
+
lg: "rounded-lg",
|
|
1283
|
+
xl: "rounded-xl"
|
|
1284
|
+
}
|
|
1285
|
+
}),
|
|
1286
|
+
},
|
|
1287
|
+
}, {
|
|
1288
|
+
md: true,
|
|
1289
|
+
outline: true,
|
|
1290
|
+
pill: true,
|
|
1291
|
+
sans: true,
|
|
1292
|
+
semibold: true,
|
|
1293
|
+
uppercase: true,
|
|
1294
|
+
noShadow: true,
|
|
1295
|
+
itemsCenter: true,
|
|
1296
|
+
padding: true,
|
|
1297
|
+
gap: true,
|
|
1298
|
+
ring: true,
|
|
1299
|
+
});
|
|
1300
|
+
|
|
1301
|
+
const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit inline-flex gap-2 items-center transition-all duration-200 whitespace-nowrap", {
|
|
1302
|
+
size: {
|
|
1303
|
+
px: new PxTheme({
|
|
1304
|
+
padding: {
|
|
1305
|
+
xs: 'px-2',
|
|
1306
|
+
sm: 'px-2.5',
|
|
1307
|
+
md: 'px-3.5',
|
|
1308
|
+
lg: 'px-5',
|
|
1309
|
+
xl: 'px-6',
|
|
1310
|
+
}
|
|
1311
|
+
}),
|
|
1312
|
+
py: new PyTheme({
|
|
1313
|
+
padding: {
|
|
1314
|
+
xs: 'py-1',
|
|
1315
|
+
sm: 'py-1.5',
|
|
1316
|
+
md: 'py-2',
|
|
1317
|
+
lg: 'py-3',
|
|
1318
|
+
xl: 'py-4',
|
|
1319
|
+
}
|
|
1320
|
+
}),
|
|
1321
|
+
text: new SizeTheme({
|
|
1322
|
+
xs: 'text-xs',
|
|
1323
|
+
sm: 'text-sm',
|
|
1324
|
+
md: 'text-sm',
|
|
1325
|
+
lg: 'text-base',
|
|
1326
|
+
xl: 'text-base',
|
|
1327
|
+
}),
|
|
1328
|
+
gap: new GapTheme({
|
|
1329
|
+
gap: {
|
|
1330
|
+
xs: 'gap-1',
|
|
1331
|
+
sm: 'gap-1.5',
|
|
1332
|
+
md: 'gap-2',
|
|
1333
|
+
lg: 'gap-2.5',
|
|
1334
|
+
xl: 'gap-3',
|
|
1335
|
+
}
|
|
1336
|
+
}),
|
|
1337
|
+
shadow: new ShadowTheme(),
|
|
1338
|
+
},
|
|
1339
|
+
appearance: {
|
|
1340
|
+
background: VariantTheme.createDefault({
|
|
1341
|
+
outline: TextAppearanceTheme.createDefaultStyle({
|
|
1342
|
+
base: backgroundAppearanceClasses,
|
|
1343
|
+
}),
|
|
1344
|
+
filled: TextAppearanceTheme.createDefaultStyle({
|
|
1345
|
+
base: filledBackgroundAppearanceClasses,
|
|
1346
|
+
})
|
|
1347
|
+
}),
|
|
1348
|
+
text: VariantTheme.createDefaultText(),
|
|
1349
|
+
border: VariantTheme.createDefaultBorder(),
|
|
1350
|
+
ring: VariantTheme.createDefaultRing(),
|
|
1351
|
+
},
|
|
1352
|
+
layout: {
|
|
1353
|
+
radius: new RadiusTheme({
|
|
1354
|
+
rounded: {
|
|
1355
|
+
xs: 'rounded-sm',
|
|
1356
|
+
sm: 'rounded-md',
|
|
1357
|
+
md: 'rounded-lg',
|
|
1358
|
+
lg: 'rounded-xl',
|
|
1359
|
+
xl: 'rounded-2xl',
|
|
1360
|
+
}
|
|
1361
|
+
}),
|
|
1362
|
+
border: new BorderTheme(),
|
|
1363
|
+
ring: new RingTheme(),
|
|
1364
|
+
},
|
|
1365
|
+
}, {
|
|
1366
|
+
md: true,
|
|
1367
|
+
outline: true,
|
|
1368
|
+
secondary: true,
|
|
1369
|
+
rounded: true,
|
|
1370
|
+
mono: true,
|
|
1371
|
+
normal: true,
|
|
1372
|
+
noShadow: true,
|
|
1373
|
+
padding: true,
|
|
1374
|
+
gap: true,
|
|
1375
|
+
ring: true,
|
|
1376
|
+
});
|
|
1377
|
+
|
|
1378
|
+
const typographyThemeDefaults = {
|
|
1379
|
+
md: true,
|
|
1380
|
+
default: true,
|
|
1381
|
+
sans: true,
|
|
1382
|
+
normal: true,
|
|
1383
|
+
};
|
|
1384
|
+
const createTypographyComponentTheme = (tag, base = "text-balance", textSizeMap = textSizeClasses, defaults = typographyThemeDefaults) => {
|
|
1385
|
+
return new ComponentTheme(tag, base, {
|
|
1386
|
+
size: {
|
|
1387
|
+
text: new SizeTheme(textSizeMap),
|
|
1388
|
+
},
|
|
1389
|
+
appearance: {
|
|
1390
|
+
text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
1391
|
+
}
|
|
1392
|
+
}, defaults);
|
|
1393
|
+
};
|
|
1394
|
+
// Page title specific theme
|
|
1395
|
+
const pageTitleTheme = createTypographyComponentTheme("h1", "text-balance tracking-tighter w-fit", {
|
|
1396
|
+
xs: "text-3xl max-lg:text-2xl max-md:text-xl",
|
|
1397
|
+
sm: "text-4xl max-lg:text-3xl max-md:text-2xl",
|
|
1398
|
+
md: "text-5xl max-lg:text-4xl max-md:text-3xl",
|
|
1399
|
+
lg: "text-6xl max-lg:text-5xl max-md:text-4xl",
|
|
1400
|
+
xl: "text-7xl max-lg:text-6xl max-md:text-5xl",
|
|
1401
|
+
}, { ...typographyThemeDefaults, semibold: true });
|
|
1402
|
+
// Section title specific theme
|
|
1403
|
+
const sectionTitleTheme = createTypographyComponentTheme("h2", "text-balance w-fit", {
|
|
1404
|
+
xs: "text-2xl max-lg:text-xl max-md:text-lg",
|
|
1405
|
+
sm: "text-3xl max-lg:text-2xl max-md:text-xl",
|
|
1406
|
+
md: "text-4xl max-lg:text-3xl max-md:text-2xl",
|
|
1407
|
+
lg: "text-5xl max-lg:text-4xl max-md:text-3xl",
|
|
1408
|
+
xl: "text-6xl max-lg:text-5xl max-md:text-4xl",
|
|
1409
|
+
}, { ...typographyThemeDefaults, semibold: true });
|
|
1410
|
+
// Title specific theme
|
|
1411
|
+
const titleTheme = createTypographyComponentTheme("h3", "text-balance w-fit", {
|
|
1412
|
+
xs: "text-lg",
|
|
1413
|
+
sm: "text-xl",
|
|
1414
|
+
md: "text-2xl",
|
|
1415
|
+
lg: "text-3xl",
|
|
1416
|
+
xl: "text-4xl",
|
|
1417
|
+
}, { ...typographyThemeDefaults, semibold: true });
|
|
1418
|
+
// Text specific theme
|
|
1419
|
+
const textTheme = createTypographyComponentTheme("p", "p-0 m-0 w-fit", textSizeClasses, { ...typographyThemeDefaults, secondary: true });
|
|
1420
|
+
// Link specific theme
|
|
1421
|
+
const linkTheme = createTypographyComponentTheme("a", "hover:underline w-fit", textSizeClasses, { ...typographyThemeDefaults, link: true });
|
|
1422
|
+
// List item specific theme
|
|
1423
|
+
const listItemTheme = createTypographyComponentTheme("li");
|
|
1424
|
+
// List specific theme
|
|
1425
|
+
const listTheme = createTypographyComponentTheme("ul", "list-disc list-inside");
|
|
1426
|
+
|
|
1427
|
+
class DirectionTheme extends BaseTheme {
|
|
1428
|
+
constructor(initial) {
|
|
1429
|
+
super();
|
|
1430
|
+
FLEX_DIRECTION_KEYS.forEach((key) => {
|
|
1431
|
+
this[key] = (initial === null || initial === void 0 ? void 0 : initial[key]) || DirectionTheme.defaultClasses[key];
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
getClasses(props, defaults) {
|
|
1435
|
+
var _a;
|
|
1436
|
+
let direction = (_a = pickKey(props, defaults, FLEX_DIRECTION_KEYS)) !== null && _a !== void 0 ? _a : 'column';
|
|
1437
|
+
const reverse = pickKey(props, defaults, DIRECTION_REVERSE_KEYS);
|
|
1438
|
+
if (reverse) {
|
|
1439
|
+
switch (direction) {
|
|
1440
|
+
case "column":
|
|
1441
|
+
direction = "columnReverse";
|
|
1442
|
+
break;
|
|
1443
|
+
case "row":
|
|
1444
|
+
direction = "rowReverse";
|
|
1445
|
+
break;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
return direction ? [this[direction]] : [];
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
DirectionTheme.defaultClasses = {
|
|
1452
|
+
row: "flex-row",
|
|
1453
|
+
column: "flex-col",
|
|
1454
|
+
rowReverse: "flex-row-reverse",
|
|
1455
|
+
columnReverse: "flex-col-reverse",
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
class WrapTheme extends BaseTheme {
|
|
1459
|
+
constructor(initialConfig) {
|
|
1460
|
+
super();
|
|
1461
|
+
WRAP_KEYS.forEach((key) => {
|
|
1462
|
+
var _a;
|
|
1463
|
+
this[key] = (_a = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig[key]) !== null && _a !== void 0 ? _a : WrapTheme.defaultClasses[key];
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
getClasses(props, defaults) {
|
|
1467
|
+
const key = pickKey(props, defaults, WRAP_KEYS);
|
|
1468
|
+
return key ? [this[key]] : [];
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
WrapTheme.defaultClasses = wrapClasses;
|
|
1472
|
+
|
|
1473
|
+
const commonGaps = {
|
|
1474
|
+
xs: 'gap-2',
|
|
1475
|
+
sm: 'gap-3',
|
|
1476
|
+
md: 'gap-4',
|
|
1477
|
+
lg: 'gap-5',
|
|
1478
|
+
xl: 'gap-6',
|
|
1479
|
+
};
|
|
1480
|
+
|
|
1481
|
+
class LayoutAppearanceTheme extends BaseTheme {
|
|
1482
|
+
constructor(initialOverrides) {
|
|
1483
|
+
super();
|
|
1484
|
+
APPEARANCE_KEYS.forEach((textKey) => {
|
|
1485
|
+
const defaultModesForKey = LayoutAppearanceTheme.defaultFullConfig[textKey];
|
|
1486
|
+
const overrideModesForKey = initialOverrides === null || initialOverrides === void 0 ? void 0 : initialOverrides[textKey];
|
|
1487
|
+
this[textKey] = {
|
|
1488
|
+
...defaultModesForKey,
|
|
1489
|
+
...(overrideModesForKey || {}),
|
|
1490
|
+
};
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
getClasses(props, defaults) {
|
|
1494
|
+
const pickedAppearanceKey = pickKey(props, defaults, APPEARANCE_KEYS, 'default');
|
|
1495
|
+
const modesForAppearance = this[pickedAppearanceKey];
|
|
1496
|
+
if (!modesForAppearance) {
|
|
1497
|
+
return MODE_KEYS.map(() => '');
|
|
1498
|
+
}
|
|
1499
|
+
return MODE_KEYS.map(mode => modesForAppearance[mode] || '');
|
|
1500
|
+
}
|
|
1501
|
+
static createDefaultStyle(src = {}) {
|
|
1502
|
+
const initialOverridesForConstructor = {};
|
|
1503
|
+
APPEARANCE_KEYS.forEach((textKey) => {
|
|
1504
|
+
const modesForCurrentTextKey = {};
|
|
1505
|
+
let keyHasDataInSrc = false;
|
|
1506
|
+
MODE_KEYS.forEach((modeKey) => {
|
|
1507
|
+
var _a;
|
|
1508
|
+
const classValue = (_a = src[modeKey]) === null || _a === void 0 ? void 0 : _a[textKey];
|
|
1509
|
+
if (classValue !== undefined) {
|
|
1510
|
+
modesForCurrentTextKey[modeKey] = classValue;
|
|
1511
|
+
keyHasDataInSrc = true;
|
|
1512
|
+
}
|
|
1513
|
+
});
|
|
1514
|
+
if (keyHasDataInSrc) {
|
|
1515
|
+
initialOverridesForConstructor[textKey] = modesForCurrentTextKey;
|
|
1516
|
+
}
|
|
1517
|
+
});
|
|
1518
|
+
return new LayoutAppearanceTheme(initialOverridesForConstructor);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
LayoutAppearanceTheme.defaultFullConfig = (() => {
|
|
1522
|
+
const config = {};
|
|
1523
|
+
APPEARANCE_KEYS.forEach((key) => {
|
|
1524
|
+
config[key] = {
|
|
1525
|
+
base: textAppearanceClasses[key] || '',
|
|
1526
|
+
hover: '',
|
|
1527
|
+
active: '',
|
|
1528
|
+
};
|
|
1529
|
+
});
|
|
1530
|
+
return config;
|
|
1531
|
+
})();
|
|
1532
|
+
|
|
1533
|
+
class BreakpointTheme extends BaseTheme {
|
|
1534
|
+
constructor(initial) {
|
|
1535
|
+
super();
|
|
1536
|
+
BREAKPOINT_KEYS.forEach((key) => {
|
|
1537
|
+
var _a;
|
|
1538
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : BreakpointTheme.defaultClasses[key];
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
getClasses(props, defaults) {
|
|
1542
|
+
const key = pickKey(props, defaults, BREAKPOINT_KEYS);
|
|
1543
|
+
if (!key)
|
|
1544
|
+
return [];
|
|
1545
|
+
return [this[key] || ''];
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
BreakpointTheme.defaultClasses = rowToColumnBreakpointClasses;
|
|
1549
|
+
|
|
1550
|
+
const defaultCardTheme = new ComponentTheme("div", "flex overflow-hidden", {
|
|
1551
|
+
size: {
|
|
1552
|
+
px: new PxTheme({
|
|
1553
|
+
padding: {
|
|
1554
|
+
xs: 'px-3',
|
|
1555
|
+
sm: 'px-4',
|
|
1556
|
+
md: 'px-5',
|
|
1557
|
+
lg: 'px-6',
|
|
1558
|
+
xl: 'px-8',
|
|
1559
|
+
}
|
|
1560
|
+
}),
|
|
1561
|
+
py: new PyTheme({
|
|
1562
|
+
padding: {
|
|
1563
|
+
xs: 'py-2',
|
|
1564
|
+
sm: 'py-3',
|
|
1565
|
+
md: 'py-4',
|
|
1566
|
+
lg: 'py-5',
|
|
1567
|
+
xl: 'py-6',
|
|
1568
|
+
}
|
|
1569
|
+
}),
|
|
1570
|
+
gap: new GapTheme({ gap: commonGaps }),
|
|
1571
|
+
shadow: new ShadowTheme(),
|
|
1572
|
+
},
|
|
1573
|
+
layout: {
|
|
1574
|
+
border: new BorderTheme(),
|
|
1575
|
+
ring: new RingTheme(),
|
|
1576
|
+
radius: new RadiusTheme({
|
|
1577
|
+
rounded: {
|
|
1578
|
+
xs: "rounded-md",
|
|
1579
|
+
sm: "rounded-lg",
|
|
1580
|
+
md: "rounded-xl",
|
|
1581
|
+
lg: "rounded-2xl",
|
|
1582
|
+
xl: "rounded-3xl"
|
|
1583
|
+
}
|
|
1584
|
+
}),
|
|
1585
|
+
wrap: new WrapTheme(),
|
|
1586
|
+
direction: new DirectionTheme(),
|
|
1587
|
+
breakpoint: new BreakpointTheme(),
|
|
1588
|
+
},
|
|
1589
|
+
appearance: {
|
|
1590
|
+
background: LayoutAppearanceTheme.createDefaultStyle({
|
|
1591
|
+
base: layoutBackgroundAppearanceClasses,
|
|
1592
|
+
}),
|
|
1593
|
+
text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
1594
|
+
border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
1595
|
+
ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
1596
|
+
}
|
|
1597
|
+
}, {
|
|
1598
|
+
md: true,
|
|
1599
|
+
default: true,
|
|
1600
|
+
rounded: true,
|
|
1601
|
+
normal: true,
|
|
1602
|
+
column: true,
|
|
1603
|
+
border: true,
|
|
1604
|
+
gap: true,
|
|
1605
|
+
padding: true,
|
|
1606
|
+
});
|
|
1607
|
+
|
|
1608
|
+
const defaultRowTheme = new ComponentTheme("div", "flex flex-row", {
|
|
1609
|
+
size: {
|
|
1610
|
+
gap: new GapTheme({ gap: commonGaps }),
|
|
1611
|
+
breakpoint: new BreakpointTheme(),
|
|
1612
|
+
},
|
|
1613
|
+
layout: {
|
|
1614
|
+
wrap: new WrapTheme(),
|
|
1615
|
+
},
|
|
1616
|
+
}, {
|
|
1617
|
+
md: true,
|
|
1618
|
+
transparent: true,
|
|
1619
|
+
itemsCenter: true,
|
|
1620
|
+
gap: true,
|
|
1621
|
+
});
|
|
1622
|
+
|
|
1623
|
+
const defaultDividerTheme = new ComponentTheme("div", "h-px w-full", {
|
|
1624
|
+
appearance: {
|
|
1625
|
+
background: TextAppearanceTheme.createDefaultStyle({
|
|
1626
|
+
base: dividerAppearanceClasses,
|
|
1627
|
+
}),
|
|
1628
|
+
}
|
|
1629
|
+
}, {
|
|
1630
|
+
md: true,
|
|
1631
|
+
default: true,
|
|
1632
|
+
});
|
|
1633
|
+
|
|
1634
|
+
const defaultContainerTheme = new ComponentTheme("div", "flex flex-col mx-auto w-full", {
|
|
1635
|
+
size: {
|
|
1636
|
+
gap: new GapTheme({
|
|
1637
|
+
gap: {
|
|
1638
|
+
xs: 'gap-2 max-lg:gap-1',
|
|
1639
|
+
sm: 'gap-4 max-lg:gap-3 max-md:gap-2',
|
|
1640
|
+
md: 'gap-6 max-lg:gap-5 max-md:gap-4',
|
|
1641
|
+
lg: 'gap-8 max-lg:gap-7 max-md:gap-6',
|
|
1642
|
+
xl: 'gap-10 max-lg:gap-9 max-md:gap-8',
|
|
1643
|
+
}
|
|
1644
|
+
}),
|
|
1645
|
+
maxWidth: new SizeTheme({
|
|
1646
|
+
xs: 'max-w-3xl',
|
|
1647
|
+
sm: 'max-w-4xl',
|
|
1648
|
+
md: 'max-w-5xl',
|
|
1649
|
+
lg: 'max-w-6xl',
|
|
1650
|
+
xl: 'max-w-7xl',
|
|
1651
|
+
}),
|
|
1652
|
+
},
|
|
1653
|
+
layout: {
|
|
1654
|
+
border: new BorderTheme(),
|
|
1655
|
+
ring: new RingTheme(),
|
|
1656
|
+
wrap: new WrapTheme(),
|
|
1657
|
+
direction: new DirectionTheme(),
|
|
1658
|
+
},
|
|
1659
|
+
appearance: {
|
|
1660
|
+
background: LayoutAppearanceTheme.createDefaultStyle({
|
|
1661
|
+
base: layoutBackgroundAppearanceClasses,
|
|
1662
|
+
}),
|
|
1663
|
+
text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
1664
|
+
border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
1665
|
+
ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
1666
|
+
}
|
|
1667
|
+
}, {
|
|
1668
|
+
transparent: true,
|
|
1669
|
+
md: true,
|
|
1670
|
+
itemsCenter: true,
|
|
1671
|
+
gap: true,
|
|
1672
|
+
});
|
|
1673
|
+
|
|
1674
|
+
const defaultColTheme = new ComponentTheme("div", "flex flex-col", {
|
|
1675
|
+
size: {
|
|
1676
|
+
gap: new GapTheme({ gap: commonGaps }),
|
|
1677
|
+
},
|
|
1678
|
+
layout: {
|
|
1679
|
+
wrap: new WrapTheme(),
|
|
1680
|
+
direction: new DirectionTheme(),
|
|
1681
|
+
},
|
|
1682
|
+
}, {
|
|
1683
|
+
md: true,
|
|
1684
|
+
transparent: true,
|
|
1685
|
+
gap: true,
|
|
1686
|
+
});
|
|
1687
|
+
|
|
1688
|
+
const defaultStackTheme = new ComponentTheme("div", "flex", {
|
|
1689
|
+
size: {
|
|
1690
|
+
px: new PxTheme({
|
|
1691
|
+
padding: {
|
|
1692
|
+
xs: 'px-2',
|
|
1693
|
+
sm: 'px-3',
|
|
1694
|
+
md: 'px-4',
|
|
1695
|
+
lg: 'px-5',
|
|
1696
|
+
xl: 'px-6',
|
|
1697
|
+
}
|
|
1698
|
+
}),
|
|
1699
|
+
py: new PyTheme({
|
|
1700
|
+
padding: {
|
|
1701
|
+
xs: 'py-2',
|
|
1702
|
+
sm: 'py-3',
|
|
1703
|
+
md: 'py-4',
|
|
1704
|
+
lg: 'py-5',
|
|
1705
|
+
xl: 'py-6',
|
|
1706
|
+
}
|
|
1707
|
+
}),
|
|
1708
|
+
gap: new GapTheme({
|
|
1709
|
+
gap: commonGaps
|
|
1710
|
+
}),
|
|
1711
|
+
},
|
|
1712
|
+
layout: {
|
|
1713
|
+
wrap: new WrapTheme(),
|
|
1714
|
+
direction: new DirectionTheme(),
|
|
1715
|
+
},
|
|
1716
|
+
}, {
|
|
1717
|
+
md: true,
|
|
1718
|
+
transparent: true,
|
|
1719
|
+
column: true,
|
|
1720
|
+
flexWrap: true,
|
|
1721
|
+
gap: true,
|
|
1722
|
+
padding: true,
|
|
1723
|
+
});
|
|
1724
|
+
|
|
1725
|
+
const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
|
|
1726
|
+
size: {
|
|
1727
|
+
px: new PxTheme({
|
|
1728
|
+
padding: {
|
|
1729
|
+
xs: 'px-5 max-lg:px-4 max-md:px-3',
|
|
1730
|
+
sm: 'px-6 max-lg:px-5 max-md:px-4',
|
|
1731
|
+
md: 'px-7 max-lg:px-6 max-md:px-5',
|
|
1732
|
+
lg: 'px-8 max-lg:px-7 max-md:px-6',
|
|
1733
|
+
xl: 'px-9 max-lg:px-8 max-md:px-7',
|
|
1734
|
+
}
|
|
1735
|
+
}),
|
|
1736
|
+
py: new PyTheme({
|
|
1737
|
+
padding: {
|
|
1738
|
+
xs: 'py-3',
|
|
1739
|
+
sm: 'py-5',
|
|
1740
|
+
md: 'py-8 max-md:py-5',
|
|
1741
|
+
lg: 'py-16 max-lg:py-14 max-md:py-12',
|
|
1742
|
+
xl: 'py-20 max-lg:py-16 max-md:py-12',
|
|
1743
|
+
}
|
|
1744
|
+
}),
|
|
1745
|
+
gap: new GapTheme({
|
|
1746
|
+
gap: {
|
|
1747
|
+
xs: 'gap-2',
|
|
1748
|
+
sm: 'gap-4',
|
|
1749
|
+
md: 'gap-6',
|
|
1750
|
+
lg: 'gap-12',
|
|
1751
|
+
xl: 'gap-16',
|
|
1752
|
+
}
|
|
1753
|
+
}),
|
|
1754
|
+
},
|
|
1755
|
+
layout: {
|
|
1756
|
+
wrap: new WrapTheme(),
|
|
1757
|
+
direction: new DirectionTheme(),
|
|
1758
|
+
},
|
|
1759
|
+
}, {
|
|
1760
|
+
md: true,
|
|
1761
|
+
default: true,
|
|
1762
|
+
itemsStart: true,
|
|
1763
|
+
gap: true,
|
|
1764
|
+
padding: true,
|
|
1765
|
+
});
|
|
1766
|
+
|
|
1767
|
+
const gridDefaults = {
|
|
1768
|
+
md: true,
|
|
1769
|
+
gap: true,
|
|
1770
|
+
};
|
|
1771
|
+
const gridSubThemes = {
|
|
1772
|
+
size: {
|
|
1773
|
+
gap: new GapTheme({
|
|
1774
|
+
gap: {
|
|
1775
|
+
xs: "gap-2",
|
|
1776
|
+
sm: "gap-4 max-lg:gap-2",
|
|
1777
|
+
md: "gap-6 max-lg:gap-4",
|
|
1778
|
+
lg: "gap-8 max-lg:gap-6 max-md:gap-4",
|
|
1779
|
+
xl: "gap-10 max-lg:gap-8 max-md:gap-6"
|
|
1780
|
+
}
|
|
1781
|
+
}),
|
|
1782
|
+
},
|
|
1783
|
+
};
|
|
1784
|
+
const defaultGrid3Theme = new ComponentTheme("div", "grid grid-cols-1 md:grid-cols-3", gridSubThemes, gridDefaults);
|
|
1785
|
+
const defaultGrid4Theme = new ComponentTheme("div", "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4", gridSubThemes, gridDefaults);
|
|
1786
|
+
|
|
1787
|
+
const defaultTheme = {
|
|
1788
|
+
button: defaultButtonTheme,
|
|
1789
|
+
badge: defaultBadgeTheme,
|
|
1790
|
+
chip: defaultChipTheme,
|
|
1791
|
+
card: defaultCardTheme,
|
|
1792
|
+
divider: defaultDividerTheme,
|
|
1793
|
+
container: defaultContainerTheme,
|
|
1794
|
+
row: defaultRowTheme,
|
|
1795
|
+
col: defaultColTheme,
|
|
1796
|
+
stack: defaultStackTheme,
|
|
1797
|
+
section: defaultSectionTheme,
|
|
1798
|
+
grid3: defaultGrid3Theme,
|
|
1799
|
+
grid4: defaultGrid4Theme,
|
|
1800
|
+
pageTitle: pageTitleTheme,
|
|
1801
|
+
sectionTitle: sectionTitleTheme,
|
|
1802
|
+
title: titleTheme,
|
|
1803
|
+
text: textTheme,
|
|
1804
|
+
link: linkTheme,
|
|
1805
|
+
listItem: listItemTheme,
|
|
1806
|
+
list: listTheme,
|
|
1807
|
+
};
|
|
1808
|
+
const ThemeContext = createContext(defaultTheme);
|
|
1809
|
+
function ThemeProvider({ children, theme: themeObject = {}, themeOverride }) {
|
|
1810
|
+
const mergedTheme = useMemo(() => {
|
|
1811
|
+
let baseTheme = themeObject
|
|
1812
|
+
? deepMerge(defaultTheme, themeObject)
|
|
1813
|
+
: defaultTheme;
|
|
1814
|
+
if (typeof themeOverride === 'function') {
|
|
1815
|
+
const themeToModify = deepClone(baseTheme);
|
|
1816
|
+
return themeOverride(themeToModify);
|
|
1817
|
+
}
|
|
1818
|
+
return baseTheme;
|
|
1819
|
+
}, [themeObject, themeOverride]);
|
|
1820
|
+
return (jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
|
|
1821
|
+
}
|
|
1822
|
+
function useTheme() {
|
|
1823
|
+
return useContext(ThemeContext);
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
export { ThemeProvider, useTheme };
|
|
1827
|
+
//# sourceMappingURL=index.js.map
|