@vaneui/ui 0.0.16 → 0.0.18
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/dist/complex.css +70 -51
- package/dist/components/theme/components/theme/themeContext.d.ts +8 -4
- package/dist/components/theme/components/ui/props/keys.d.ts +1 -1
- package/dist/components/theme/components/ui/theme/common/ComponentTheme.d.ts +2 -2
- package/dist/components/theme/components/ui/theme/sectionTheme.d.ts +15 -0
- package/dist/components/theme/index.js +198 -154
- package/dist/components/theme/index.js.map +1 -1
- package/dist/components/theme/themeContext.d.ts +8 -4
- package/dist/components/ui/props/keys.d.ts +1 -1
- package/dist/components/ui/theme/common/ComponentTheme.d.ts +2 -2
- package/dist/components/ui/theme/sectionTheme.d.ts +15 -0
- package/dist/index.esm.js +198 -154
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +198 -154
- package/dist/index.js.map +1 -1
- package/dist/ui.css +70 -51
- package/dist/vars.css +139 -0
- package/package.json +9 -3
|
@@ -208,7 +208,11 @@ const TYPOGRAPHY_COMPONENT_KEYS = [
|
|
|
208
208
|
...JUSTIFY_KEYS,
|
|
209
209
|
...WRAP_KEYS,
|
|
210
210
|
...BREAKPOINT_KEYS,
|
|
211
|
-
...GAP_KEYS
|
|
211
|
+
...GAP_KEYS,
|
|
212
|
+
...BORDER_KEYS,
|
|
213
|
+
...SHADOW_KEYS,
|
|
214
|
+
...RING_KEYS,
|
|
215
|
+
...SHAPE_KEYS,
|
|
212
216
|
];
|
|
213
217
|
|
|
214
218
|
const rowToColumnBreakpointClasses = {
|
|
@@ -255,25 +259,25 @@ const positionClasses = {
|
|
|
255
259
|
static: "static"
|
|
256
260
|
};
|
|
257
261
|
const shadowClasses = {
|
|
258
|
-
xs: "shadow-
|
|
259
|
-
sm: "shadow-
|
|
260
|
-
md: "shadow-
|
|
261
|
-
lg: "shadow-
|
|
262
|
-
xl: "shadow-
|
|
262
|
+
xs: "shadow-2xs",
|
|
263
|
+
sm: "shadow-xs",
|
|
264
|
+
md: "shadow-sm",
|
|
265
|
+
lg: "shadow-md",
|
|
266
|
+
xl: "shadow-lg"
|
|
263
267
|
};
|
|
264
268
|
const hoverShadowClasses = {
|
|
265
|
-
xs: "hover:shadow-
|
|
266
|
-
sm: "hover:shadow-
|
|
267
|
-
md: "hover:shadow-
|
|
268
|
-
lg: "hover:shadow-
|
|
269
|
-
xl: "hover:shadow-
|
|
269
|
+
xs: "hover:shadow-xs",
|
|
270
|
+
sm: "hover:shadow-sm",
|
|
271
|
+
md: "hover:shadow-md",
|
|
272
|
+
lg: "hover:shadow-lg",
|
|
273
|
+
xl: "hover:shadow-xl"
|
|
270
274
|
};
|
|
271
275
|
const activeShadowClasses = {
|
|
272
|
-
xs: "active:shadow-
|
|
273
|
-
sm: "active:shadow-
|
|
274
|
-
md: "active:shadow-
|
|
275
|
-
lg: "active:shadow-
|
|
276
|
-
xl: "active:shadow-
|
|
276
|
+
xs: "active:shadow-xs",
|
|
277
|
+
sm: "active:shadow-sm",
|
|
278
|
+
md: "active:shadow-md",
|
|
279
|
+
lg: "active:shadow-lg",
|
|
280
|
+
xl: "active:shadow-xl"
|
|
277
281
|
};
|
|
278
282
|
const noRingModeClasses = {
|
|
279
283
|
base: "ring-0",
|
|
@@ -329,75 +333,6 @@ class HideTheme extends BaseTheme {
|
|
|
329
333
|
}
|
|
330
334
|
HideTheme.defaultClasses = hideClasses;
|
|
331
335
|
|
|
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
336
|
class ItemsTheme extends BaseTheme {
|
|
402
337
|
constructor(initialConfig) {
|
|
403
338
|
super();
|
|
@@ -526,6 +461,21 @@ const textSizeClasses = {
|
|
|
526
461
|
xl: "text-xl",
|
|
527
462
|
};
|
|
528
463
|
|
|
464
|
+
class FontStyleTheme extends BaseTheme {
|
|
465
|
+
constructor(initial) {
|
|
466
|
+
super();
|
|
467
|
+
FONT_STYLE_KEYS.forEach((key) => {
|
|
468
|
+
var _a;
|
|
469
|
+
this[key] = (_a = initial === null || initial === void 0 ? void 0 : initial[key]) !== null && _a !== void 0 ? _a : FontStyleTheme.defaultClasses[key];
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
getClasses(props, defaults) {
|
|
473
|
+
const key = pickKey(props, defaults, FONT_STYLE_KEYS);
|
|
474
|
+
return [key ? this[key] : '']; // No default for font style
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
FontStyleTheme.defaultClasses = fontStyleClasses;
|
|
478
|
+
|
|
529
479
|
class FontFamilyTheme extends BaseTheme {
|
|
530
480
|
constructor(initial) {
|
|
531
481
|
super();
|
|
@@ -556,21 +506,6 @@ class FontWeightTheme extends BaseTheme {
|
|
|
556
506
|
}
|
|
557
507
|
FontWeightTheme.defaultClasses = fontWeightClasses;
|
|
558
508
|
|
|
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
509
|
class TextDecorationTheme extends BaseTheme {
|
|
575
510
|
constructor(initial) {
|
|
576
511
|
super();
|
|
@@ -616,6 +551,75 @@ class TextAlignTheme extends BaseTheme {
|
|
|
616
551
|
}
|
|
617
552
|
TextAlignTheme.defaultClasses = textAlignClasses;
|
|
618
553
|
|
|
554
|
+
const isObject = (item) => {
|
|
555
|
+
return item !== null && typeof item === 'object' && !Array.isArray(item);
|
|
556
|
+
};
|
|
557
|
+
const deepMerge = (target, source) => {
|
|
558
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(target)), target);
|
|
559
|
+
for (const key in source) {
|
|
560
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
561
|
+
const sourceValue = source[key];
|
|
562
|
+
const targetValue = output[key];
|
|
563
|
+
if (sourceValue === undefined) {
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
// Special case: If the key is 'defaults', use the contextual mergeDefaults function.
|
|
567
|
+
if (key === 'defaults' &&
|
|
568
|
+
isObject(targetValue) &&
|
|
569
|
+
isObject(sourceValue)) {
|
|
570
|
+
output[key] = mergeDefaults(targetValue, sourceValue);
|
|
571
|
+
}
|
|
572
|
+
// For all other objects, use the standard recursive deep merge.
|
|
573
|
+
else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
574
|
+
output[key] = deepMerge(targetValue, sourceValue);
|
|
575
|
+
}
|
|
576
|
+
// For non-object values, just assign the value from the source.
|
|
577
|
+
else {
|
|
578
|
+
output[key] = sourceValue;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return output;
|
|
583
|
+
};
|
|
584
|
+
const deepClone = (source) => {
|
|
585
|
+
if (!isObject(source)) {
|
|
586
|
+
return source;
|
|
587
|
+
}
|
|
588
|
+
const output = Object.assign(Object.create(Object.getPrototypeOf(source)), source);
|
|
589
|
+
for (const key in output) {
|
|
590
|
+
if (Object.prototype.hasOwnProperty.call(output, key)) {
|
|
591
|
+
output[key] = deepClone(output[key]);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return output;
|
|
595
|
+
};
|
|
596
|
+
const findGroup = (key) => EXCLUSIVE_KEY_GROUPS.find(group => group.includes(key));
|
|
597
|
+
const mergeDefaults = (baseDefaults, overrideDefaults) => {
|
|
598
|
+
const finalDefaults = { ...baseDefaults };
|
|
599
|
+
// Iterate over the override keys to apply them.
|
|
600
|
+
for (const key in overrideDefaults) {
|
|
601
|
+
if (Object.prototype.hasOwnProperty.call(overrideDefaults, key)) {
|
|
602
|
+
const overrideValue = overrideDefaults[key];
|
|
603
|
+
// If the override is setting a key to true...
|
|
604
|
+
if (overrideValue) {
|
|
605
|
+
// Find the exclusive group this key belongs to (e.g., SIZE_KEYS).
|
|
606
|
+
const group = findGroup(key);
|
|
607
|
+
// If the key is part of an exclusive group...
|
|
608
|
+
if (group) {
|
|
609
|
+
// ...set all other keys in that group to false.
|
|
610
|
+
group.forEach(groupKey => {
|
|
611
|
+
if (groupKey !== key) {
|
|
612
|
+
finalDefaults[groupKey] = false;
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
finalDefaults[key] = overrideValue;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return finalDefaults;
|
|
621
|
+
};
|
|
622
|
+
|
|
619
623
|
class ComponentTheme {
|
|
620
624
|
constructor(tag, base, subThemes, defaults = {}) {
|
|
621
625
|
this.tag = tag;
|
|
@@ -782,10 +786,15 @@ BorderTheme.defaultClasses = {
|
|
|
782
786
|
active: "active:border",
|
|
783
787
|
},
|
|
784
788
|
noBorder: {
|
|
785
|
-
base: "
|
|
786
|
-
hover: "
|
|
787
|
-
active: "
|
|
789
|
+
base: "",
|
|
790
|
+
hover: "",
|
|
791
|
+
active: "",
|
|
788
792
|
},
|
|
793
|
+
//noBorder: {
|
|
794
|
+
// base: "border-none",
|
|
795
|
+
// hover: "hover:border-none",
|
|
796
|
+
// active: "active:border-none",
|
|
797
|
+
//},
|
|
789
798
|
};
|
|
790
799
|
|
|
791
800
|
class RingTheme extends BaseTheme {
|
|
@@ -1153,8 +1162,8 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
1153
1162
|
px: new PxTheme({
|
|
1154
1163
|
padding: {
|
|
1155
1164
|
xs: 'px-2',
|
|
1156
|
-
sm: 'px-
|
|
1157
|
-
md: 'px-
|
|
1165
|
+
sm: 'px-3',
|
|
1166
|
+
md: 'px-4',
|
|
1158
1167
|
lg: 'px-5',
|
|
1159
1168
|
xl: 'px-6',
|
|
1160
1169
|
}
|
|
@@ -1164,25 +1173,25 @@ const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-poin
|
|
|
1164
1173
|
xs: 'py-1',
|
|
1165
1174
|
sm: 'py-1.5',
|
|
1166
1175
|
md: 'py-2',
|
|
1167
|
-
lg: 'py-
|
|
1168
|
-
xl: 'py-
|
|
1176
|
+
lg: 'py-2.5',
|
|
1177
|
+
xl: 'py-3',
|
|
1169
1178
|
}
|
|
1170
1179
|
}),
|
|
1171
1180
|
gap: new GapTheme({
|
|
1172
1181
|
gap: {
|
|
1173
|
-
xs: 'gap-1
|
|
1174
|
-
sm: 'gap-
|
|
1175
|
-
md: 'gap-
|
|
1176
|
-
lg: 'gap-
|
|
1177
|
-
xl: 'gap-
|
|
1182
|
+
xs: 'gap-1',
|
|
1183
|
+
sm: 'gap-1.5',
|
|
1184
|
+
md: 'gap-2',
|
|
1185
|
+
lg: 'gap-2.5',
|
|
1186
|
+
xl: 'gap-3',
|
|
1178
1187
|
}
|
|
1179
1188
|
}),
|
|
1180
1189
|
text: new SizeTheme({
|
|
1181
|
-
xs: 'text-xs
|
|
1182
|
-
sm: 'text-sm
|
|
1190
|
+
xs: 'text-xs',
|
|
1191
|
+
sm: 'text-sm',
|
|
1183
1192
|
md: 'text-base',
|
|
1184
|
-
lg: 'text-lg
|
|
1185
|
-
xl: 'text-xl
|
|
1193
|
+
lg: 'text-lg',
|
|
1194
|
+
xl: 'text-xl',
|
|
1186
1195
|
}),
|
|
1187
1196
|
shadow: new ShadowTheme(),
|
|
1188
1197
|
},
|
|
@@ -1225,36 +1234,36 @@ const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit inline-flex tr
|
|
|
1225
1234
|
px: new PxTheme({
|
|
1226
1235
|
padding: {
|
|
1227
1236
|
xs: "px-2",
|
|
1228
|
-
sm: "px-
|
|
1229
|
-
md: "px-
|
|
1237
|
+
sm: "px-3",
|
|
1238
|
+
md: "px-4",
|
|
1230
1239
|
lg: "px-5",
|
|
1231
1240
|
xl: "px-6"
|
|
1232
1241
|
}
|
|
1233
1242
|
}),
|
|
1234
1243
|
py: new PyTheme({
|
|
1235
1244
|
padding: {
|
|
1236
|
-
xs:
|
|
1237
|
-
sm:
|
|
1238
|
-
md:
|
|
1239
|
-
lg:
|
|
1240
|
-
xl:
|
|
1245
|
+
xs: 'py-1',
|
|
1246
|
+
sm: 'py-1.5',
|
|
1247
|
+
md: 'py-2',
|
|
1248
|
+
lg: 'py-2.5',
|
|
1249
|
+
xl: 'py-3',
|
|
1241
1250
|
}
|
|
1242
1251
|
}),
|
|
1243
1252
|
gap: new GapTheme({
|
|
1244
1253
|
gap: {
|
|
1245
|
-
xs:
|
|
1246
|
-
sm:
|
|
1247
|
-
md:
|
|
1248
|
-
lg:
|
|
1249
|
-
xl:
|
|
1254
|
+
xs: 'gap-1',
|
|
1255
|
+
sm: 'gap-1.5',
|
|
1256
|
+
md: 'gap-2',
|
|
1257
|
+
lg: 'gap-2.5',
|
|
1258
|
+
xl: 'gap-3',
|
|
1250
1259
|
}
|
|
1251
1260
|
}),
|
|
1252
1261
|
text: new SizeTheme({
|
|
1253
|
-
xs: 'text-xs
|
|
1254
|
-
sm: 'text-sm
|
|
1262
|
+
xs: 'text-xs',
|
|
1263
|
+
sm: 'text-sm',
|
|
1255
1264
|
md: 'text-base',
|
|
1256
|
-
lg: 'text-lg
|
|
1257
|
-
xl: 'text-xl
|
|
1265
|
+
lg: 'text-lg',
|
|
1266
|
+
xl: 'text-xl',
|
|
1258
1267
|
}),
|
|
1259
1268
|
shadow: new ShadowTheme(),
|
|
1260
1269
|
},
|
|
@@ -1304,26 +1313,26 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit inline-flex gap
|
|
|
1304
1313
|
padding: {
|
|
1305
1314
|
xs: 'px-2',
|
|
1306
1315
|
sm: 'px-2.5',
|
|
1307
|
-
md: 'px-3
|
|
1308
|
-
lg: 'px-5',
|
|
1309
|
-
xl: 'px-
|
|
1316
|
+
md: 'px-3',
|
|
1317
|
+
lg: 'px-3.5',
|
|
1318
|
+
xl: 'px-4',
|
|
1310
1319
|
}
|
|
1311
1320
|
}),
|
|
1312
1321
|
py: new PyTheme({
|
|
1313
1322
|
padding: {
|
|
1314
|
-
xs: 'py-
|
|
1315
|
-
sm: 'py-1
|
|
1316
|
-
md: 'py-
|
|
1317
|
-
lg: 'py-
|
|
1318
|
-
xl: 'py-
|
|
1323
|
+
xs: 'py-0.5',
|
|
1324
|
+
sm: 'py-1',
|
|
1325
|
+
md: 'py-1.5',
|
|
1326
|
+
lg: 'py-2',
|
|
1327
|
+
xl: 'py-2.5',
|
|
1319
1328
|
}
|
|
1320
1329
|
}),
|
|
1321
1330
|
text: new SizeTheme({
|
|
1322
1331
|
xs: 'text-xs',
|
|
1323
1332
|
sm: 'text-sm',
|
|
1324
|
-
md: 'text-
|
|
1325
|
-
lg: 'text-
|
|
1326
|
-
xl: 'text-
|
|
1333
|
+
md: 'text-base',
|
|
1334
|
+
lg: 'text-lg',
|
|
1335
|
+
xl: 'text-xl',
|
|
1327
1336
|
}),
|
|
1328
1337
|
gap: new GapTheme({
|
|
1329
1338
|
gap: {
|
|
@@ -1735,26 +1744,46 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
|
|
|
1735
1744
|
}),
|
|
1736
1745
|
py: new PyTheme({
|
|
1737
1746
|
padding: {
|
|
1738
|
-
xs: 'py-3',
|
|
1739
|
-
sm: 'py-
|
|
1740
|
-
md: 'py-
|
|
1747
|
+
xs: 'py-4 max-md:py-3',
|
|
1748
|
+
sm: 'py-8 max-md:py-6',
|
|
1749
|
+
md: 'py-12 max-md:py-6',
|
|
1741
1750
|
lg: 'py-16 max-lg:py-14 max-md:py-12',
|
|
1742
1751
|
xl: 'py-20 max-lg:py-16 max-md:py-12',
|
|
1743
1752
|
}
|
|
1744
1753
|
}),
|
|
1745
1754
|
gap: new GapTheme({
|
|
1746
1755
|
gap: {
|
|
1747
|
-
xs: 'gap-
|
|
1748
|
-
sm: 'gap-
|
|
1749
|
-
md: 'gap-
|
|
1756
|
+
xs: 'gap-4',
|
|
1757
|
+
sm: 'gap-6',
|
|
1758
|
+
md: 'gap-8',
|
|
1750
1759
|
lg: 'gap-12',
|
|
1751
1760
|
xl: 'gap-16',
|
|
1752
1761
|
}
|
|
1753
1762
|
}),
|
|
1763
|
+
shadow: new ShadowTheme(),
|
|
1764
|
+
},
|
|
1765
|
+
appearance: {
|
|
1766
|
+
background: LayoutAppearanceTheme.createDefaultStyle({
|
|
1767
|
+
base: layoutBackgroundAppearanceClasses,
|
|
1768
|
+
}),
|
|
1769
|
+
text: TextAppearanceTheme.createDefaultStyle({ base: textAppearanceClasses }),
|
|
1770
|
+
border: TextAppearanceTheme.createDefaultStyle({ base: borderAppearanceClasses }),
|
|
1771
|
+
ring: TextAppearanceTheme.createDefaultStyle({ base: ringAppearanceClasses }),
|
|
1754
1772
|
},
|
|
1755
1773
|
layout: {
|
|
1756
1774
|
wrap: new WrapTheme(),
|
|
1757
1775
|
direction: new DirectionTheme(),
|
|
1776
|
+
border: new BorderTheme(),
|
|
1777
|
+
ring: new RingTheme(),
|
|
1778
|
+
radius: new RadiusTheme({
|
|
1779
|
+
rounded: {
|
|
1780
|
+
xs: 'rounded-md',
|
|
1781
|
+
sm: 'rounded-lg',
|
|
1782
|
+
md: 'rounded-xl',
|
|
1783
|
+
lg: 'rounded-2xl',
|
|
1784
|
+
xl: 'rounded-3xl',
|
|
1785
|
+
}
|
|
1786
|
+
}),
|
|
1758
1787
|
},
|
|
1759
1788
|
}, {
|
|
1760
1789
|
md: true,
|
|
@@ -1762,6 +1791,10 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full flex flex-col", {
|
|
|
1762
1791
|
itemsStart: true,
|
|
1763
1792
|
gap: true,
|
|
1764
1793
|
padding: true,
|
|
1794
|
+
noBorder: true,
|
|
1795
|
+
noRing: true,
|
|
1796
|
+
noShadow: true,
|
|
1797
|
+
sharp: true,
|
|
1765
1798
|
});
|
|
1766
1799
|
|
|
1767
1800
|
const gridDefaults = {
|
|
@@ -1806,16 +1839,27 @@ const defaultTheme = {
|
|
|
1806
1839
|
list: listTheme,
|
|
1807
1840
|
};
|
|
1808
1841
|
const ThemeContext = createContext(defaultTheme);
|
|
1809
|
-
function ThemeProvider({ children, theme: themeObject = {}, themeOverride }) {
|
|
1842
|
+
function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, themeOverride }) {
|
|
1810
1843
|
const mergedTheme = useMemo(() => {
|
|
1811
|
-
let
|
|
1844
|
+
let finalTheme = themeObject
|
|
1812
1845
|
? deepMerge(defaultTheme, themeObject)
|
|
1813
1846
|
: defaultTheme;
|
|
1814
1847
|
if (typeof themeOverride === 'function') {
|
|
1815
|
-
const themeToModify = deepClone(
|
|
1816
|
-
|
|
1848
|
+
const themeToModify = deepClone(finalTheme);
|
|
1849
|
+
finalTheme = themeOverride(themeToModify);
|
|
1850
|
+
}
|
|
1851
|
+
if (themeDefaults !== undefined) {
|
|
1852
|
+
for (const key in themeDefaults) {
|
|
1853
|
+
const componentKey = key;
|
|
1854
|
+
const componentTheme = finalTheme[componentKey];
|
|
1855
|
+
const themeDefault = themeDefaults[componentKey];
|
|
1856
|
+
if (themeDefault !== undefined) {
|
|
1857
|
+
finalTheme[componentKey].defaults =
|
|
1858
|
+
mergeDefaults(componentTheme.defaults, themeDefaults[componentKey]);
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1817
1861
|
}
|
|
1818
|
-
return
|
|
1862
|
+
return finalTheme;
|
|
1819
1863
|
}, [themeObject, themeOverride]);
|
|
1820
1864
|
return (jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
|
|
1821
1865
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -12,9 +12,11 @@ import { ColTheme } from '../ui/theme/colTheme';
|
|
|
12
12
|
import { StackTheme } from '../ui/theme/stackTheme';
|
|
13
13
|
import { SectionTheme } from "../ui/theme/sectionTheme";
|
|
14
14
|
import { GridTheme } from "../ui/theme/gridTheme";
|
|
15
|
-
import {
|
|
15
|
+
import { BadgeProps, ButtonProps, CardProps, ChipProps, ColProps, ContainerProps, DividerProps, GridProps, RowProps, SectionProps, StackProps, TypographyComponentProps } from "../ui/props/props";
|
|
16
16
|
import { DeepPartial } from "../utils/deepPartial";
|
|
17
|
-
export
|
|
17
|
+
export declare const COMPONENT_KEYS: readonly ["button", "badge", "chip", "card", "divider", "row", "col", "stack", "section", "grid3", "grid4", "pageTitle", "sectionTitle", "title", "text", "link", "list", "listItem"];
|
|
18
|
+
export type ComponentKey = typeof COMPONENT_KEYS[number];
|
|
19
|
+
export interface ThemeProps extends Record<ComponentKey, ComponentTheme<object, object>> {
|
|
18
20
|
button: ComponentTheme<ButtonProps, ButtonTheme<ButtonProps>>;
|
|
19
21
|
badge: ComponentTheme<BadgeProps, BadgeTheme<BadgeProps>>;
|
|
20
22
|
chip: ComponentTheme<ChipProps, ChipTheme<ChipProps>>;
|
|
@@ -32,15 +34,17 @@ export interface ThemeProps {
|
|
|
32
34
|
title: ComponentTheme<TypographyComponentProps, TypographyComponentTheme<TypographyComponentProps>>;
|
|
33
35
|
text: ComponentTheme<TypographyComponentProps, TypographyComponentTheme<TypographyComponentProps>>;
|
|
34
36
|
link: ComponentTheme<TypographyComponentProps, TypographyComponentTheme<TypographyComponentProps>>;
|
|
35
|
-
listItem: ComponentTheme<TypographyComponentProps, TypographyComponentTheme<TypographyComponentProps>>;
|
|
36
37
|
list: ComponentTheme<TypographyComponentProps, TypographyComponentTheme<TypographyComponentProps>>;
|
|
38
|
+
listItem: ComponentTheme<TypographyComponentProps, TypographyComponentTheme<TypographyComponentProps>>;
|
|
37
39
|
}
|
|
38
40
|
export type PartialTheme = DeepPartial<ThemeProps>;
|
|
39
41
|
export declare const defaultTheme: ThemeProps;
|
|
42
|
+
export type ThemeDefaults = Partial<Record<ComponentKey, Record<string, boolean>>>;
|
|
40
43
|
export interface ThemeProviderProps {
|
|
41
44
|
children: React.ReactNode;
|
|
42
45
|
theme?: PartialTheme;
|
|
46
|
+
themeDefaults?: ThemeDefaults;
|
|
43
47
|
themeOverride?: (theme: ThemeProps) => ThemeProps;
|
|
44
48
|
}
|
|
45
|
-
export declare function ThemeProvider({ children, theme: themeObject, themeOverride }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare function ThemeProvider({ children, theme: themeObject, themeDefaults, themeOverride }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
46
50
|
export declare function useTheme(): ThemeProps;
|
|
@@ -75,5 +75,5 @@ export declare const DIVIDER_KEYS: readonly ["xs", "sm", "md", "lg", "xl", "xsHi
|
|
|
75
75
|
export type DividerKey = typeof DIVIDER_KEYS[number];
|
|
76
76
|
export declare const CONTAINER_KEYS: readonly ["xs", "sm", "md", "lg", "xl", "xsHide", "smHide", "mdHide", "lgHide", "xlHide", "relative", "absolute", "fixed", "sticky", "static", "itemsStart", "itemsEnd", "itemsCenter", "itemsBaseline", "itemsStretch", "default", "accent", "primary", "secondary", "tertiary", "success", "danger", "warning", "info", "transparent", "border", "noBorder", "shadow", "noShadow", "ring", "noRing", "gap", "noGap"];
|
|
77
77
|
export type ContainerKey = typeof CONTAINER_KEYS[number];
|
|
78
|
-
export declare const SECTION_KEYS: readonly ["xs", "sm", "md", "lg", "xl", "xsHide", "smHide", "mdHide", "lgHide", "xlHide", "relative", "absolute", "fixed", "sticky", "static", "row", "column", "rowReverse", "columnReverse", "itemsStart", "itemsEnd", "itemsCenter", "itemsBaseline", "itemsStretch", "default", "accent", "primary", "secondary", "tertiary", "success", "danger", "warning", "info", "transparent", "padding", "noPadding", "reverse", "justifyStart", "justifyEnd", "justifyCenter", "justifyBetween", "justifyAround", "justifyEvenly", "justifyStretch", "justifyBaseline", "flexWrap", "flexNoWrap", "flexWrapReverse", "xsCol", "smCol", "mdCol", "lgCol", "xlCol", "gap", "noGap"];
|
|
78
|
+
export declare const SECTION_KEYS: readonly ["xs", "sm", "md", "lg", "xl", "xsHide", "smHide", "mdHide", "lgHide", "xlHide", "relative", "absolute", "fixed", "sticky", "static", "row", "column", "rowReverse", "columnReverse", "itemsStart", "itemsEnd", "itemsCenter", "itemsBaseline", "itemsStretch", "default", "accent", "primary", "secondary", "tertiary", "success", "danger", "warning", "info", "transparent", "padding", "noPadding", "reverse", "justifyStart", "justifyEnd", "justifyCenter", "justifyBetween", "justifyAround", "justifyEvenly", "justifyStretch", "justifyBaseline", "flexWrap", "flexNoWrap", "flexWrapReverse", "xsCol", "smCol", "mdCol", "lgCol", "xlCol", "gap", "noGap", "border", "noBorder", "shadow", "noShadow", "ring", "noRing", "pill", "sharp", "rounded"];
|
|
79
79
|
export type SectionKey = typeof SECTION_KEYS[number];
|
|
@@ -4,9 +4,9 @@ import { HideTheme } from "../layout/hideTheme";
|
|
|
4
4
|
import { ItemsTheme } from "../layout/itemsTheme";
|
|
5
5
|
import { JustifyTheme } from "../layout/justifyTheme";
|
|
6
6
|
import { PositionTheme } from "../layout/positionTheme";
|
|
7
|
+
import { FontStyleTheme } from "../typography/fontStyleTheme";
|
|
7
8
|
import { FontFamilyTheme } from "../typography/fontFamilyTheme";
|
|
8
9
|
import { FontWeightTheme } from "../typography/fontWeightTheme";
|
|
9
|
-
import { FontStyleTheme } from "../typography/fontStyleTheme";
|
|
10
10
|
import { TextDecorationTheme } from "../typography/textDecorationTheme";
|
|
11
11
|
import { TextTransformTheme } from "../typography/textTransformTheme";
|
|
12
12
|
import { TextAlignTheme } from "../typography/textAlignTheme";
|
|
@@ -36,8 +36,8 @@ export interface BaseComponentTheme<P> {
|
|
|
36
36
|
export declare class ComponentTheme<P extends object, TThemes extends object> {
|
|
37
37
|
readonly tag: React.ElementType;
|
|
38
38
|
readonly base: string;
|
|
39
|
-
readonly defaults: Partial<P>;
|
|
40
39
|
readonly themes: TThemes;
|
|
40
|
+
defaults: Partial<P>;
|
|
41
41
|
constructor(tag: React.ElementType, base: string, subThemes: DeepPartial<TThemes>, defaults?: Partial<P>);
|
|
42
42
|
getClasses(props: P, defaults?: Partial<P>): string[];
|
|
43
43
|
}
|
|
@@ -5,15 +5,30 @@ import { WrapTheme } from "./layout/wrapTheme";
|
|
|
5
5
|
import { SectionProps } from "../props/props";
|
|
6
6
|
import { PxTheme } from "./size/pxTheme";
|
|
7
7
|
import { PyTheme } from "./size/pyTheme";
|
|
8
|
+
import { VariantTheme } from "./appearance/variantTheme";
|
|
9
|
+
import { BorderTheme } from "./layout/borderTheme";
|
|
10
|
+
import { RingTheme } from "./layout/ringTheme";
|
|
11
|
+
import { RadiusTheme } from "./layout/radiusTheme";
|
|
12
|
+
import { ShadowTheme } from "./layout/shadowTheme";
|
|
8
13
|
export interface SectionTheme<P> extends BaseComponentTheme<P> {
|
|
9
14
|
size: {
|
|
10
15
|
px: PxTheme;
|
|
11
16
|
py: PyTheme;
|
|
12
17
|
gap: GapTheme;
|
|
18
|
+
shadow: ShadowTheme;
|
|
19
|
+
};
|
|
20
|
+
appearance: {
|
|
21
|
+
background: VariantTheme;
|
|
22
|
+
text: VariantTheme;
|
|
23
|
+
border: VariantTheme;
|
|
24
|
+
ring: VariantTheme;
|
|
13
25
|
};
|
|
14
26
|
layout: DefaultLayoutThemes<P> & {
|
|
15
27
|
wrap: WrapTheme;
|
|
16
28
|
direction: DirectionTheme;
|
|
29
|
+
border: BorderTheme;
|
|
30
|
+
ring: RingTheme;
|
|
31
|
+
radius: RadiusTheme;
|
|
17
32
|
};
|
|
18
33
|
}
|
|
19
34
|
export declare const defaultSectionTheme: ComponentTheme<SectionProps, SectionTheme<SectionProps>>;
|