asheeui 0.7.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AsheeUIProvider.d.ts.map +1 -1
- package/dist/AsheeUIProvider.js +22 -15
- package/dist/components/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/accordion/Accordion.js +9 -7
- package/dist/components/alert/Alert.d.ts +88 -0
- package/dist/components/alert/Alert.d.ts.map +1 -0
- package/dist/components/alert/Alert.js +61 -0
- package/dist/components/alert/alert-config.d.ts +56 -0
- package/dist/components/alert/alert-config.d.ts.map +1 -0
- package/dist/components/alert/alert-config.js +14 -0
- package/dist/components/alert/alert-styles.d.ts +32 -0
- package/dist/components/alert/alert-styles.d.ts.map +1 -0
- package/dist/components/alert/alert-styles.js +20 -0
- package/dist/components/alert/index.d.ts +3 -0
- package/dist/components/alert/index.d.ts.map +1 -0
- package/dist/components/alert/index.js +3 -0
- package/dist/components/autocomplete/Autocomplete.d.ts +6 -6
- package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js +94 -58
- package/dist/components/autocomplete/autocomplete-config.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.d.ts +87 -0
- package/dist/components/avatar/Avatar.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.js +43 -0
- package/dist/components/avatar/avatar-config.d.ts +48 -0
- package/dist/components/avatar/avatar-config.d.ts.map +1 -0
- package/dist/components/avatar/avatar-config.js +14 -0
- package/dist/components/avatar/avatar-styles.d.ts +21 -0
- package/dist/components/avatar/avatar-styles.d.ts.map +1 -0
- package/dist/components/avatar/avatar-styles.js +13 -0
- package/dist/components/avatar/avatar.helpers.d.ts +19 -0
- package/dist/components/avatar/avatar.helpers.d.ts.map +1 -0
- package/dist/components/avatar/avatar.helpers.js +11 -0
- package/dist/components/avatar/index.d.ts +3 -0
- package/dist/components/avatar/index.d.ts.map +1 -0
- package/dist/components/avatar/index.js +4 -0
- package/dist/components/badge/Badge.d.ts +69 -0
- package/dist/components/badge/Badge.d.ts.map +1 -0
- package/dist/components/badge/Badge.js +39 -0
- package/dist/components/badge/badge-config.d.ts +63 -0
- package/dist/components/badge/badge-config.d.ts.map +1 -0
- package/dist/components/badge/badge-config.js +15 -0
- package/dist/components/badge/badge-styles.d.ts +27 -0
- package/dist/components/badge/badge-styles.d.ts.map +1 -0
- package/dist/components/badge/badge-styles.js +25 -0
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/badge/index.js +3 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +106 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/Breadcrumb.js +52 -0
- package/dist/components/breadcrumb/breadcrumb-config.d.ts +41 -0
- package/dist/components/breadcrumb/breadcrumb-config.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-config.js +10 -0
- package/dist/components/breadcrumb/breadcrumb-styles.d.ts +28 -0
- package/dist/components/breadcrumb/breadcrumb-styles.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-styles.js +17 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -0
- package/dist/components/breadcrumb/index.js +3 -0
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +10 -7
- package/dist/components/{date-picker/DatePicker.d.ts → calendar/Calendar.d.ts} +21 -21
- package/dist/components/calendar/Calendar.d.ts.map +1 -0
- package/dist/components/{date-picker/DatePicker.js → calendar/Calendar.js} +11 -11
- package/dist/components/{date-picker/Calendar.d.ts → calendar/DateGrid.d.ts} +7 -7
- package/dist/components/calendar/DateGrid.d.ts.map +1 -0
- package/dist/components/calendar/DateGrid.js +194 -0
- package/dist/components/calendar/TimeSpinner.d.ts.map +1 -0
- package/dist/components/{date-picker → calendar}/TimeSpinner.js +3 -3
- package/dist/components/{date-picker/date-picker-config.d.ts → calendar/calendar-config.d.ts} +17 -17
- package/dist/components/calendar/calendar-config.d.ts.map +1 -0
- package/dist/components/{date-picker/date-picker-config.js → calendar/calendar-config.js} +3 -3
- package/dist/components/{date-picker/date-picker-styles.d.ts → calendar/calendar-styles.d.ts} +1 -1
- package/dist/components/calendar/calendar-styles.d.ts.map +1 -0
- package/dist/components/{date-picker/date-picker-styles.js → calendar/calendar-styles.js} +1 -1
- package/dist/components/{date-picker/date-picker.helpers.d.ts → calendar/calendar.helpers.d.ts} +9 -9
- package/dist/components/calendar/calendar.helpers.d.ts.map +1 -0
- package/dist/components/{date-picker/date-picker.helpers.js → calendar/calendar.helpers.js} +4 -4
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/calendar/index.d.ts.map +1 -0
- package/dist/components/calendar/index.js +6 -0
- package/dist/components/card/Card.d.ts +6 -6
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +8 -8
- package/dist/components/carousel/Carousel.d.ts.map +1 -1
- package/dist/components/carousel/Carousel.js +85 -83
- package/dist/components/carousel/carousel-styles.d.ts +1 -20
- package/dist/components/carousel/carousel-styles.d.ts.map +1 -1
- package/dist/components/chip/Chip.js +5 -5
- package/dist/components/drawer/Drawer.d.ts +8 -4
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +54 -38
- package/dist/components/{select/Select.d.ts → dropmenu/Dropmenu.d.ts} +21 -21
- package/dist/components/{select/Select.d.ts.map → dropmenu/Dropmenu.d.ts.map} +1 -1
- package/dist/components/dropmenu/Dropmenu.js +102 -0
- package/dist/components/{select/select-config.d.ts → dropmenu/dropmenu-config.d.ts} +8 -8
- package/dist/components/dropmenu/dropmenu-config.d.ts.map +1 -0
- package/dist/components/{select/select-config.js → dropmenu/dropmenu-config.js} +3 -3
- package/dist/components/{select/select-styles.d.ts → dropmenu/dropmenu-styles.d.ts} +1 -1
- package/dist/components/dropmenu/dropmenu-styles.d.ts.map +1 -0
- package/dist/components/{select/select-styles.js → dropmenu/dropmenu-styles.js} +1 -1
- package/dist/components/dropmenu/index.d.ts +3 -0
- package/dist/components/dropmenu/index.d.ts.map +1 -0
- package/dist/components/dropmenu/index.js +3 -0
- package/dist/components/field/FieldShell.d.ts +13 -1
- package/dist/components/field/FieldShell.d.ts.map +1 -1
- package/dist/components/field/FieldShell.js +16 -15
- package/dist/components/form/Form.d.ts +109 -0
- package/dist/components/form/Form.d.ts.map +1 -0
- package/dist/components/form/Form.js +42 -0
- package/dist/components/form/form-config.d.ts +57 -0
- package/dist/components/form/form-config.d.ts.map +1 -0
- package/dist/components/form/form-config.js +12 -0
- package/dist/components/form/form-styles.d.ts +27 -0
- package/dist/components/form/form-styles.d.ts.map +1 -0
- package/dist/components/form/form-styles.js +5 -0
- package/dist/components/form/index.d.ts +3 -0
- package/dist/components/form/index.d.ts.map +1 -0
- package/dist/components/form/index.js +3 -0
- package/dist/components/image/Image.d.ts +4 -5
- package/dist/components/image/Image.d.ts.map +1 -1
- package/dist/components/image/Image.js +5 -5
- package/dist/components/input/Input.js +5 -5
- package/dist/components/link/Link.d.ts +12 -10
- package/dist/components/link/Link.d.ts.map +1 -1
- package/dist/components/link/Link.js +1 -1
- package/dist/components/marquee/Marquee.d.ts.map +1 -1
- package/dist/components/marquee/Marquee.js +36 -33
- package/dist/components/{select-menu/SelectMenu.d.ts → menu/Menu.d.ts} +52 -19
- package/dist/components/menu/Menu.d.ts.map +1 -0
- package/dist/components/menu/Menu.js +161 -0
- package/dist/components/menu/index.d.ts +5 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/index.js +4 -0
- package/dist/components/{select-menu/select-menu-config.d.ts → menu/menu-config.d.ts} +5 -5
- package/dist/components/menu/menu-config.d.ts.map +1 -0
- package/dist/components/{select-menu/select-menu-config.js → menu/menu-config.js} +2 -2
- package/dist/components/menu/menu-navigation.d.ts +38 -0
- package/dist/components/menu/menu-navigation.d.ts.map +1 -0
- package/dist/components/menu/menu-navigation.js +20 -0
- package/dist/components/{select-menu/use-select-floating.d.ts → menu/use-menu-floating.d.ts} +10 -10
- package/dist/components/menu/use-menu-floating.d.ts.map +1 -0
- package/dist/components/{select-menu/use-select-floating.js → menu/use-menu-floating.js} +2 -2
- package/dist/components/modal/Modal.d.ts +6 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +62 -45
- package/dist/components/multi-select/MultiSelect.d.ts +11 -10
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +99 -86
- package/dist/components/multi-select/multi-select-config.d.ts +1 -1
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.d.ts +91 -0
- package/dist/components/pagination/Pagination.d.ts.map +1 -0
- package/dist/components/pagination/Pagination.js +66 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +4 -0
- package/dist/components/pagination/pagination-config.d.ts +66 -0
- package/dist/components/pagination/pagination-config.d.ts.map +1 -0
- package/dist/components/pagination/pagination-config.js +19 -0
- package/dist/components/pagination/pagination-styles.d.ts +19 -0
- package/dist/components/pagination/pagination-styles.d.ts.map +1 -0
- package/dist/components/pagination/pagination-styles.js +5 -0
- package/dist/components/pagination/pagination.helpers.d.ts +26 -0
- package/dist/components/pagination/pagination.helpers.d.ts.map +1 -0
- package/dist/components/pagination/pagination.helpers.js +12 -0
- package/dist/components/radio/Radio.d.ts +53 -107
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/Radio.js +50 -36
- package/dist/components/radio/RadioGroup.d.ts +107 -53
- package/dist/components/radio/RadioGroup.d.ts.map +1 -1
- package/dist/components/radio/RadioGroup.js +43 -49
- package/dist/components/radio/index.d.ts +0 -1
- package/dist/components/radio/index.d.ts.map +1 -1
- package/dist/components/resizable-screen/ResizableScreen.d.ts +4 -4
- package/dist/components/scrollbar/index.js +1 -0
- package/dist/components/scrollbar/scrollbar-config.js +13 -0
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +92 -90
- package/dist/components/skeleton/Skeleton.d.ts +65 -0
- package/dist/components/skeleton/Skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/Skeleton.js +29 -0
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/skeleton/index.d.ts.map +1 -0
- package/dist/components/skeleton/index.js +3 -0
- package/dist/components/skeleton/skeleton-config.d.ts +40 -0
- package/dist/components/skeleton/skeleton-config.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton-config.js +13 -0
- package/dist/components/skeleton/skeleton-styles.d.ts +19 -0
- package/dist/components/skeleton/skeleton-styles.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton-styles.js +5 -0
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +7 -5
- package/dist/components/table/Table.js +3 -3
- package/dist/components/tabs/Tabs.js +3 -3
- package/dist/components/textarea/Textarea.d.ts +10 -10
- package/dist/components/textarea/Textarea.js +7 -7
- package/dist/components/textarea/textarea-config.d.ts +2 -2
- package/dist/components/toast/ToastItem.d.ts.map +1 -1
- package/dist/components/toast/ToastItem.js +8 -7
- package/dist/components/tooltip/Tooltip.js +5 -5
- package/dist/components/typography/Typography.d.ts +60 -0
- package/dist/components/typography/Typography.d.ts.map +1 -0
- package/dist/components/typography/Typography.js +28 -0
- package/dist/components/typography/index.d.ts +3 -0
- package/dist/components/typography/index.d.ts.map +1 -0
- package/dist/components/typography/index.js +3 -0
- package/dist/components/typography/typography-config.d.ts +54 -0
- package/dist/components/typography/typography-config.d.ts.map +1 -0
- package/dist/components/typography/typography-config.js +12 -0
- package/dist/components/typography/typography-styles.d.ts +21 -0
- package/dist/components/typography/typography-styles.d.ts.map +1 -0
- package/dist/components/typography/typography-styles.js +19 -0
- package/dist/config/default-config.d.ts.map +1 -1
- package/dist/config/default-config.js +2 -2
- package/dist/config/index.js +1 -0
- package/dist/config/validate-config.d.ts +34 -0
- package/dist/config/validate-config.d.ts.map +1 -0
- package/dist/config/validate-config.js +190 -0
- package/dist/index.d.ts +15 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -47
- package/dist/libs/index.js +3 -0
- package/dist/libs/use-body-scroll-lock.d.ts +21 -0
- package/dist/libs/use-body-scroll-lock.d.ts.map +1 -0
- package/dist/libs/use-body-scroll-lock.js +27 -0
- package/dist/libs/use-dialog-overlay.d.ts +21 -0
- package/dist/libs/use-dialog-overlay.d.ts.map +1 -0
- package/dist/libs/use-dialog-overlay.js +21 -0
- package/dist/libs/use-prefers-reduced-motion.d.ts +23 -0
- package/dist/libs/use-prefers-reduced-motion.d.ts.map +1 -0
- package/dist/libs/use-prefers-reduced-motion.js +19 -0
- package/dist/scripts/AsheeThemeScript.js +43 -8
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/typography.d.ts +81 -0
- package/dist/shared/typography.d.ts.map +1 -0
- package/dist/shared/typography.js +137 -0
- package/dist/utils/stacking.d.ts +2 -2
- package/dist/utils/stacking.d.ts.map +1 -1
- package/package.json +13 -6
- package/dist/components/date-picker/Calendar.d.ts.map +0 -1
- package/dist/components/date-picker/Calendar.js +0 -143
- package/dist/components/date-picker/DatePicker.d.ts.map +0 -1
- package/dist/components/date-picker/TimeSpinner.d.ts.map +0 -1
- package/dist/components/date-picker/date-picker-config.d.ts.map +0 -1
- package/dist/components/date-picker/date-picker-styles.d.ts.map +0 -1
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +0 -1
- package/dist/components/date-picker/index.d.ts +0 -3
- package/dist/components/date-picker/index.d.ts.map +0 -1
- package/dist/components/date-picker/index.js +0 -6
- package/dist/components/select/Select.js +0 -98
- package/dist/components/select/index.d.ts +0 -3
- package/dist/components/select/index.d.ts.map +0 -1
- package/dist/components/select/index.js +0 -3
- package/dist/components/select/select-config.d.ts.map +0 -1
- package/dist/components/select/select-styles.d.ts.map +0 -1
- package/dist/components/select-menu/SelectMenu.d.ts.map +0 -1
- package/dist/components/select-menu/SelectMenu.js +0 -104
- package/dist/components/select-menu/index.d.ts +0 -4
- package/dist/components/select-menu/index.d.ts.map +0 -1
- package/dist/components/select-menu/index.js +0 -3
- package/dist/components/select-menu/select-menu-config.d.ts.map +0 -1
- package/dist/components/select-menu/use-select-floating.d.ts.map +0 -1
- /package/dist/components/{date-picker → calendar}/TimeSpinner.d.ts +0 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defaultColorConfig as e } from "../theme/color.js";
|
|
3
|
+
import { RADIUS_CLASS as t } from "../shared/radius.js";
|
|
4
|
+
import { TYPOGRAPHY_ALIGN_CLASS as n, TYPOGRAPHY_LEADING_CLASS as r, TYPOGRAPHY_ROLE_TOKEN as i, TYPOGRAPHY_SIZE_CLASS as a, TYPOGRAPHY_TONE_CLASS as o, TYPOGRAPHY_TRACKING_CLASS as s, TYPOGRAPHY_WEIGHT_CLASS as c } from "../shared/typography.js";
|
|
5
|
+
//#region src/config/validate-config.ts
|
|
6
|
+
var l = {
|
|
7
|
+
color: !0,
|
|
8
|
+
defaultTheme: !0,
|
|
9
|
+
defaultVariant: !0,
|
|
10
|
+
defaultColor: !0,
|
|
11
|
+
defaultRadius: !0,
|
|
12
|
+
components: !0
|
|
13
|
+
}, u = {
|
|
14
|
+
solid: !0,
|
|
15
|
+
ghost: !0,
|
|
16
|
+
bordered: !0,
|
|
17
|
+
faded: !0,
|
|
18
|
+
underlined: !0
|
|
19
|
+
}, d = Object.keys(l), f = Object.keys(u), p = Object.keys(t), m = Object.keys(i), h = [
|
|
20
|
+
"tone",
|
|
21
|
+
"align",
|
|
22
|
+
"className"
|
|
23
|
+
], g = {
|
|
24
|
+
size: a,
|
|
25
|
+
weight: c,
|
|
26
|
+
leading: r,
|
|
27
|
+
tracking: s,
|
|
28
|
+
tone: o,
|
|
29
|
+
align: n
|
|
30
|
+
}, _ = [
|
|
31
|
+
"role",
|
|
32
|
+
"tone",
|
|
33
|
+
"align",
|
|
34
|
+
"truncate",
|
|
35
|
+
"roles",
|
|
36
|
+
"className"
|
|
37
|
+
];
|
|
38
|
+
function v(e) {
|
|
39
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
40
|
+
}
|
|
41
|
+
function y(e) {
|
|
42
|
+
return typeof e == "string" ? `"${e}"` : String(e);
|
|
43
|
+
}
|
|
44
|
+
function b(e) {
|
|
45
|
+
return e.map((e) => `"${e}"`).join(", ");
|
|
46
|
+
}
|
|
47
|
+
function x(e, t, n, r) {
|
|
48
|
+
n !== void 0 && (typeof n == "string" && r.includes(n) || e.push({
|
|
49
|
+
path: t,
|
|
50
|
+
message: `${y(n)} is not a valid value (expected one of ${b(r)})`,
|
|
51
|
+
severity: "error"
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
function S(e, t, n, r) {
|
|
55
|
+
r.includes(n) || e.push({
|
|
56
|
+
path: t === "" ? n : `${t}.${n}`,
|
|
57
|
+
message: `unknown key (expected one of ${b(r)})`,
|
|
58
|
+
severity: "warning"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function C(e, t, n) {
|
|
62
|
+
if (t !== void 0) {
|
|
63
|
+
if (!v(t)) {
|
|
64
|
+
e.push({
|
|
65
|
+
path: "color",
|
|
66
|
+
message: `expected an object of themes, received ${y(t)}`,
|
|
67
|
+
severity: "error"
|
|
68
|
+
});
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
for (let [r, i] of Object.entries(t)) {
|
|
72
|
+
let t = `color.${r}`;
|
|
73
|
+
if (!v(i)) {
|
|
74
|
+
e.push({
|
|
75
|
+
path: t,
|
|
76
|
+
message: `expected a theme object, received ${y(i)}`,
|
|
77
|
+
severity: "error"
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
for (let [r, a] of Object.entries(i)) {
|
|
82
|
+
if (!n.includes(r)) {
|
|
83
|
+
S(e, t, r, n);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
typeof a != "string" && e.push({
|
|
87
|
+
path: `${t}.${r}`,
|
|
88
|
+
message: `expected a colour value, received ${y(a)}`,
|
|
89
|
+
severity: "error"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function w(e, t, r) {
|
|
96
|
+
for (let n of Object.keys(r)) S(e, t, n, _);
|
|
97
|
+
if (x(e, `${t}.role`, r.role, m), x(e, `${t}.tone`, r.tone, Object.keys(o)), x(e, `${t}.align`, r.align, Object.keys(n)), r.truncate !== void 0 && typeof r.truncate != "boolean" && e.push({
|
|
98
|
+
path: `${t}.truncate`,
|
|
99
|
+
message: `expected a boolean, received ${y(r.truncate)}`,
|
|
100
|
+
severity: "error"
|
|
101
|
+
}), r.roles !== void 0) {
|
|
102
|
+
if (!v(r.roles)) {
|
|
103
|
+
e.push({
|
|
104
|
+
path: `${t}.roles`,
|
|
105
|
+
message: `expected an object of role overrides, received ${y(r.roles)}`,
|
|
106
|
+
severity: "error"
|
|
107
|
+
});
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
for (let [n, a] of Object.entries(r.roles)) {
|
|
111
|
+
let r = `${t}.roles.${n}`;
|
|
112
|
+
if (!m.includes(n)) {
|
|
113
|
+
e.push({
|
|
114
|
+
path: r,
|
|
115
|
+
message: `unknown role (expected one of ${b(m)})`,
|
|
116
|
+
severity: "warning"
|
|
117
|
+
});
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (!v(a)) {
|
|
121
|
+
e.push({
|
|
122
|
+
path: r,
|
|
123
|
+
message: `expected an object of tokens, received ${y(a)}`,
|
|
124
|
+
severity: "error"
|
|
125
|
+
});
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
let o = [...Object.keys(i[n]), ...h];
|
|
129
|
+
for (let [t, n] of Object.entries(a)) {
|
|
130
|
+
S(e, r, t, o);
|
|
131
|
+
let i = g[t];
|
|
132
|
+
i && x(e, `${r}.${t}`, n, Object.keys(i));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function T(e, t) {
|
|
138
|
+
if (t !== void 0) {
|
|
139
|
+
if (!v(t)) {
|
|
140
|
+
e.push({
|
|
141
|
+
path: "components",
|
|
142
|
+
message: `expected an object of component overrides, received ${y(t)}`,
|
|
143
|
+
severity: "error"
|
|
144
|
+
});
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
for (let [n, r] of Object.entries(t)) {
|
|
148
|
+
let t = `components.${n}`;
|
|
149
|
+
if (!v(r)) {
|
|
150
|
+
e.push({
|
|
151
|
+
path: t,
|
|
152
|
+
message: `expected an object of overrides, received ${y(r)}`,
|
|
153
|
+
severity: "error"
|
|
154
|
+
});
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
let i = r;
|
|
158
|
+
i.className !== void 0 && typeof i.className != "string" && e.push({
|
|
159
|
+
path: `${t}.className`,
|
|
160
|
+
message: `expected a string, received ${y(i.className)}`,
|
|
161
|
+
severity: "error"
|
|
162
|
+
}), n === "typography" && w(e, t, i);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function E(t) {
|
|
167
|
+
let n = [], r = t, i = Object.keys(e), a = Object.keys(e.light);
|
|
168
|
+
for (let e of Object.keys(r)) S(n, "", e, d);
|
|
169
|
+
return x(n, "defaultTheme", r.defaultTheme, [
|
|
170
|
+
"system",
|
|
171
|
+
...i,
|
|
172
|
+
...Object.keys(v(r.color) ? r.color : {})
|
|
173
|
+
]), x(n, "defaultVariant", r.defaultVariant, f), x(n, "defaultColor", r.defaultColor, a), x(n, "defaultRadius", r.defaultRadius, p), C(n, t.color, a), T(n, t.components), n;
|
|
174
|
+
}
|
|
175
|
+
function D(e) {
|
|
176
|
+
return `${e.path}: ${e.message}`;
|
|
177
|
+
}
|
|
178
|
+
function O(e, t = {}) {
|
|
179
|
+
let n = E(e), r = n.filter((e) => e.severity === "error"), i = n.filter((e) => e.severity === "warning");
|
|
180
|
+
if (i.length > 0 && process.env.NODE_ENV !== "production") {
|
|
181
|
+
let e = t.warn ?? ((e) => console.warn(e));
|
|
182
|
+
for (let t of i) e(`[asheeui] ${D(t)}`);
|
|
183
|
+
}
|
|
184
|
+
if (r.length > 0) {
|
|
185
|
+
let e = r.map((e) => `- ${D(e)}`).join("\n");
|
|
186
|
+
throw Error(`[asheeui] Invalid configuration:\n${e}\nSee the configuration reference for the accepted values.`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
export { O as assertValidConfig, E as validateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AsheeUI main entry point.
|
|
3
|
-
* This file exports all public components, types, and utilities from the
|
|
4
|
-
* AsheeUI component library. It serves as the single entry point for
|
|
5
|
-
* consumers of the library.
|
|
6
|
-
*
|
|
7
|
-
* The exports are organized into:
|
|
8
|
-
* - Core provider: AsheeUIProvider and its props
|
|
9
|
-
* - All components: accordion, button, card, modal, toast, etc.
|
|
10
|
-
* - Shared types: Radius, Size, Variant, Color
|
|
11
|
-
* - Theme types: ColorConfig, ThemeName, ColorVariant
|
|
12
|
-
* - Theme utilities: themeController, useTheme, THEME_STORAGE_KEY
|
|
13
|
-
*/
|
|
14
1
|
export type { AsheeUIProviderProps } from './AsheeUIProvider';
|
|
15
2
|
export { AsheeUIProvider } from './AsheeUIProvider';
|
|
16
3
|
/**
|
|
17
4
|
* All component exports.
|
|
18
5
|
* Each component is exported from its respective directory.
|
|
6
|
+
*
|
|
7
|
+
* Internal building blocks (`field` and `menu`) are deliberately not
|
|
8
|
+
* exported. They are implementation details shared by the components that
|
|
9
|
+
* use them, so they are not part of the public component surface and must
|
|
10
|
+
* not be listed as components.
|
|
19
11
|
*/
|
|
20
12
|
export * from './components/accordion';
|
|
13
|
+
export * from './components/alert';
|
|
21
14
|
export * from './components/autocomplete';
|
|
15
|
+
export * from './components/avatar';
|
|
16
|
+
export * from './components/badge';
|
|
17
|
+
export * from './components/breadcrumb';
|
|
22
18
|
export * from './components/button';
|
|
23
19
|
export * from './components/card';
|
|
24
20
|
export * from './components/carousel';
|
|
25
21
|
export * from './components/chip';
|
|
26
|
-
export * from './components/
|
|
22
|
+
export * from './components/calendar';
|
|
27
23
|
export * from './components/drawer';
|
|
28
|
-
export * from './components/
|
|
24
|
+
export * from './components/dropmenu';
|
|
25
|
+
export * from './components/form';
|
|
29
26
|
export * from './components/image';
|
|
30
27
|
export * from './components/input';
|
|
31
28
|
export * from './components/keyboard';
|
|
@@ -33,11 +30,11 @@ export * from './components/link';
|
|
|
33
30
|
export * from './components/marquee';
|
|
34
31
|
export * from './components/modal';
|
|
35
32
|
export * from './components/multi-select';
|
|
33
|
+
export * from './components/pagination';
|
|
36
34
|
export * from './components/radio';
|
|
37
35
|
export * from './components/resizable-screen';
|
|
38
|
-
export * from './components/select';
|
|
39
|
-
export type { SelectMenuOption } from './components/select-menu';
|
|
40
36
|
export * from './components/sidebar';
|
|
37
|
+
export * from './components/skeleton';
|
|
41
38
|
export * from './components/spinner';
|
|
42
39
|
export * from './components/switch';
|
|
43
40
|
export * from './components/table';
|
|
@@ -45,6 +42,7 @@ export * from './components/tabs';
|
|
|
45
42
|
export * from './components/textarea';
|
|
46
43
|
export * from './components/toast';
|
|
47
44
|
export * from './components/tooltip';
|
|
45
|
+
export * from './components/typography';
|
|
48
46
|
export type { ExternalConfig } from './config';
|
|
49
47
|
/**
|
|
50
48
|
* Shared type exports.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,yCAAyC,CAAC;AAEjD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;GAQG;AACH,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C;;;GAGG;AACH,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC7D;;;GAGG;AACH,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,SAAS,GACV,MAAM,eAAe,CAAC;AACvB;;;GAGG;AACH,OAAO,EACL,iBAAiB,EACjB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import "./components/scrollbar/scrollbar-config.js";
|
|
2
3
|
import { THEME_STORAGE_KEY as e, themeController as t } from "./theme/controller.js";
|
|
3
4
|
import { useTheme as n } from "./theme/useTheme.js";
|
|
4
5
|
import { AsheeUIProvider as r } from "./AsheeUIProvider.js";
|
|
5
6
|
import { FALLBACK_ACCORDION_CONFIG as i, defaultAccordionConfig as a } from "./components/accordion/accordion-config.js";
|
|
6
7
|
import { Accordion as o } from "./components/accordion/Accordion.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { FALLBACK_ALERT_CONFIG as s, defaultAlertConfig as c } from "./components/alert/alert-config.js";
|
|
9
|
+
import { Alert as l } from "./components/alert/Alert.js";
|
|
10
|
+
import { FALLBACK_SPINNER_CONFIG as u, defaultSpinnerConfig as d } from "./components/spinner/spinner-config.js";
|
|
11
|
+
import { Spinner as f } from "./components/spinner/spinner.js";
|
|
11
12
|
import { KeyboardContext as p, useKeyboard as m } from "./components/keyboard/KeyboardContext.js";
|
|
12
13
|
import { FALLBACK_KEYBOARD_CONFIG as h, defaultKeyDisplay as g, defaultKeyboardConfig as _, defaultKeyboardLayouts as v } from "./components/keyboard/keyboard-config.js";
|
|
13
14
|
import { FALLBACK_BUTTON_CONFIG as y, defaultButtonConfig as b } from "./components/button/button-config.js";
|
|
@@ -22,46 +23,59 @@ import { FALLBACK_AUTOCOMPLETE_CONFIG as O, defaultAutocompleteConfig as k } fro
|
|
|
22
23
|
import { Autocomplete as A } from "./components/autocomplete/Autocomplete.js";
|
|
23
24
|
import { FALLBACK_IMAGE_CONFIG as j, defaultImageConfig as M } from "./components/image/image-config.js";
|
|
24
25
|
import { Image as N } from "./components/image/Image.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
|
|
26
|
+
import { FALLBACK_AVATAR_CONFIG as P, defaultAvatarConfig as F } from "./components/avatar/avatar-config.js";
|
|
27
|
+
import { Avatar as I } from "./components/avatar/Avatar.js";
|
|
28
|
+
import { FALLBACK_BADGE_CONFIG as L, defaultBadgeConfig as R } from "./components/badge/badge-config.js";
|
|
29
|
+
import { Badge as z } from "./components/badge/Badge.js";
|
|
30
|
+
import { FALLBACK_LINK_CONFIG as B, defaultLinkConfig as V } from "./components/link/link-config.js";
|
|
31
|
+
import { Link as H } from "./components/link/Link.js";
|
|
32
|
+
import { FALLBACK_BREADCRUMB_CONFIG as U, defaultBreadcrumbConfig as W } from "./components/breadcrumb/breadcrumb-config.js";
|
|
33
|
+
import { Breadcrumb as G } from "./components/breadcrumb/Breadcrumb.js";
|
|
34
|
+
import { FALLBACK_CARD_CONFIG as K, defaultCardConfig as q } from "./components/card/card-config.js";
|
|
35
|
+
import { Card as J } from "./components/card/Card.js";
|
|
36
|
+
import { FALLBACK_CAROUSEL_CONFIG as Y, defaultCarouselConfig as X } from "./components/carousel/carousel-config.js";
|
|
37
|
+
import { Carousel as Z } from "./components/carousel/Carousel.js";
|
|
38
|
+
import { FALLBACK_CHIP_CONFIG as Q, defaultChipConfig as $ } from "./components/chip/chip-config.js";
|
|
39
|
+
import { Chip as ee } from "./components/chip/Chip.js";
|
|
40
|
+
import { FALLBACK_DATE_PICKER_CONFIG as te, defaultCalendarConfig as ne } from "./components/calendar/calendar-config.js";
|
|
41
|
+
import { Calendar as re } from "./components/calendar/Calendar.js";
|
|
42
|
+
import { FALLBACK_DRAWER_CONFIG as ie, defaultDrawerConfig as ae } from "./components/drawer/drawer-config.js";
|
|
43
|
+
import { Drawer as oe } from "./components/drawer/Drawer.js";
|
|
44
|
+
import { FALLBACK_SELECT_CONFIG as se, defaultDropmenuConfig as ce } from "./components/dropmenu/dropmenu-config.js";
|
|
45
|
+
import { Dropmenu as le } from "./components/dropmenu/Dropmenu.js";
|
|
46
|
+
import { FALLBACK_FORM_CONFIG as ue, defaultFormConfig as de } from "./components/form/form-config.js";
|
|
47
|
+
import { Form as fe } from "./components/form/Form.js";
|
|
48
|
+
import { FALLBACK_MARQUEE_CONFIG as pe, defaultMarqueeConfig as me } from "./components/marquee/marquee-config.js";
|
|
49
|
+
import { Marquee as he } from "./components/marquee/Marquee.js";
|
|
50
|
+
import { FALLBACK_MODAL_CONFIG as ge, defaultModalConfig as _e } from "./components/modal/modal-config.js";
|
|
51
|
+
import { Modal as ve } from "./components/modal/Modal.js";
|
|
52
|
+
import { FALLBACK_MULTI_SELECT_CONFIG as ye, defaultMultiSelectConfig as be } from "./components/multi-select/multi-select-config.js";
|
|
53
|
+
import { MultiSelect as xe } from "./components/multi-select/MultiSelect.js";
|
|
54
|
+
import { FALLBACK_PAGINATION_CONFIG as Se, defaultPaginationConfig as Ce } from "./components/pagination/pagination-config.js";
|
|
55
|
+
import { Pagination as we } from "./components/pagination/Pagination.js";
|
|
56
|
+
import { FALLBACK_RADIO_CONFIG as Te, defaultRadioConfig as Ee } from "./components/radio/radio-config.js";
|
|
57
|
+
import { Radio as De } from "./components/radio/Radio.js";
|
|
58
|
+
import { RadioGroup as Oe } from "./components/radio/RadioGroup.js";
|
|
59
|
+
import { FALLBACK_RESIZABLE_SCREEN_CONFIG as ke, defaultResizableScreenConfig as Ae } from "./components/resizable-screen/resizable-screen-config.js";
|
|
60
|
+
import { ResizableScreen as je } from "./components/resizable-screen/ResizableScreen.js";
|
|
61
|
+
import { FALLBACK_TOOLTIP_CONFIG as Me, defaultTooltipConfig as Ne } from "./components/tooltip/tooltip-config.js";
|
|
62
|
+
import { Tooltip as Pe } from "./components/tooltip/Tooltip.js";
|
|
63
|
+
import { FALLBACK_SIDEBAR_CONFIG as Fe, defaultSidebarConfig as Ie } from "./components/sidebar/sidebar-config.js";
|
|
64
|
+
import { Sidebar as Le } from "./components/sidebar/Sidebar.js";
|
|
65
|
+
import { FALLBACK_SKELETON_CONFIG as Re, defaultSkeletonConfig as ze } from "./components/skeleton/skeleton-config.js";
|
|
66
|
+
import { Skeleton as Be } from "./components/skeleton/Skeleton.js";
|
|
67
|
+
import { FALLBACK_SWITCH_CONFIG as Ve, defaultSwitchConfig as He } from "./components/switch/switch-config.js";
|
|
68
|
+
import { Switch as Ue } from "./components/switch/Switch.js";
|
|
69
|
+
import { FALLBACK_TABLE_CONFIG as We, defaultTableConfig as Ge } from "./components/table/table-config.js";
|
|
70
|
+
import { Table as Ke } from "./components/table/Table.js";
|
|
71
|
+
import { FALLBACK_TABS_CONFIG as qe, defaultTabsConfig as Je } from "./components/tabs/tabs-config.js";
|
|
72
|
+
import { Tabs as Ye } from "./components/tabs/Tabs.js";
|
|
73
|
+
import { FALLBACK_TEXTAREA_CONFIG as Xe, defaultTextAreaConfig as Ze } from "./components/textarea/textarea-config.js";
|
|
74
|
+
import { Textarea as Qe } from "./components/textarea/Textarea.js";
|
|
75
|
+
import { ToastContext as $e, useToast as et } from "./components/toast/ToastContext.js";
|
|
76
|
+
import { FALLBACK_TOAST_CONFIG as tt, defaultToastConfig as nt } from "./components/toast/toast-config.js";
|
|
77
|
+
import { ToastItem as rt } from "./components/toast/ToastItem.js";
|
|
78
|
+
import { ToastProvider as it } from "./components/toast/ToastProvider.js";
|
|
79
|
+
import { FALLBACK_TYPOGRAPHY_CONFIG as at, defaultTypographyConfig as ot } from "./components/typography/typography-config.js";
|
|
80
|
+
import { Typography as st } from "./components/typography/Typography.js";
|
|
81
|
+
export { o as Accordion, l as Alert, r as AsheeUIProvider, A as Autocomplete, I as Avatar, z as Badge, G as Breadcrumb, x as Button, re as Calendar, J as Card, Z as Carousel, ee as Chip, oe as Drawer, le as Dropmenu, i as FALLBACK_ACCORDION_CONFIG, s as FALLBACK_ALERT_CONFIG, O as FALLBACK_AUTOCOMPLETE_CONFIG, P as FALLBACK_AVATAR_CONFIG, L as FALLBACK_BADGE_CONFIG, U as FALLBACK_BREADCRUMB_CONFIG, y as FALLBACK_BUTTON_CONFIG, K as FALLBACK_CARD_CONFIG, Y as FALLBACK_CAROUSEL_CONFIG, Q as FALLBACK_CHIP_CONFIG, te as FALLBACK_DATE_PICKER_CONFIG, ie as FALLBACK_DRAWER_CONFIG, ue as FALLBACK_FORM_CONFIG, j as FALLBACK_IMAGE_CONFIG, h as FALLBACK_KEYBOARD_CONFIG, B as FALLBACK_LINK_CONFIG, pe as FALLBACK_MARQUEE_CONFIG, ge as FALLBACK_MODAL_CONFIG, ye as FALLBACK_MULTI_SELECT_CONFIG, Se as FALLBACK_PAGINATION_CONFIG, Te as FALLBACK_RADIO_CONFIG, ke as FALLBACK_RESIZABLE_SCREEN_CONFIG, se as FALLBACK_SELECT_CONFIG, Fe as FALLBACK_SIDEBAR_CONFIG, Re as FALLBACK_SKELETON_CONFIG, u as FALLBACK_SPINNER_CONFIG, Ve as FALLBACK_SWITCH_CONFIG, We as FALLBACK_TABLE_CONFIG, qe as FALLBACK_TABS_CONFIG, Xe as FALLBACK_TEXTAREA_CONFIG, tt as FALLBACK_TOAST_CONFIG, Me as FALLBACK_TOOLTIP_CONFIG, at as FALLBACK_TYPOGRAPHY_CONFIG, fe as Form, N as Image, T as Input, p as KeyboardContext, C as KeyboardProvider, H as Link, he as Marquee, ve as Modal, xe as MultiSelect, S as OnScreenKeyboard, we as Pagination, D as PasswordInput, De as Radio, Oe as RadioGroup, je as ResizableScreen, Le as Sidebar, Be as Skeleton, f as Spinner, Ue as Switch, e as THEME_STORAGE_KEY, Ke as Table, Ye as Tabs, Qe as Textarea, $e as ToastContext, rt as ToastItem, it as ToastProvider, Pe as Tooltip, st as Typography, a as defaultAccordionConfig, c as defaultAlertConfig, k as defaultAutocompleteConfig, F as defaultAvatarConfig, R as defaultBadgeConfig, W as defaultBreadcrumbConfig, b as defaultButtonConfig, ne as defaultCalendarConfig, q as defaultCardConfig, X as defaultCarouselConfig, $ as defaultChipConfig, ae as defaultDrawerConfig, ce as defaultDropmenuConfig, de as defaultFormConfig, M as defaultImageConfig, E as defaultInputConfig, g as defaultKeyDisplay, _ as defaultKeyboardConfig, v as defaultKeyboardLayouts, V as defaultLinkConfig, me as defaultMarqueeConfig, _e as defaultModalConfig, be as defaultMultiSelectConfig, Ce as defaultPaginationConfig, Ee as defaultRadioConfig, Ae as defaultResizableScreenConfig, Ie as defaultSidebarConfig, ze as defaultSkeletonConfig, d as defaultSpinnerConfig, He as defaultSwitchConfig, Ge as defaultTableConfig, Je as defaultTabsConfig, Ze as defaultTextAreaConfig, nt as defaultToastConfig, Ne as defaultTooltipConfig, ot as defaultTypographyConfig, t as themeController, m as useKeyboard, w as useKeyboardField, n as useTheme, et as useToast };
|
package/dist/libs/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./context.js";
|
|
2
2
|
export * from "./registry.js";
|
|
3
|
+
export * from "./use-body-scroll-lock.js";
|
|
4
|
+
export * from "./use-dialog-overlay.js";
|
|
3
5
|
export * from "./use-floating-z-index.js";
|
|
4
6
|
export * from "./use-isomorphic-layout-effect.js";
|
|
7
|
+
export * from "./use-prefers-reduced-motion.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Body scroll lock for overlay components.
|
|
3
|
+
*
|
|
4
|
+
* Overlays that cover the page (modal dialogs, drawers, dropdown menus) stop
|
|
5
|
+
* the page behind them from scrolling. The lock is reference counted, so
|
|
6
|
+
* overlays that are open at the same time share one lock: the body styles
|
|
7
|
+
* captured when the first overlay opens are restored only after the last one
|
|
8
|
+
* closes. An overlay therefore never captures the styles of an already locked
|
|
9
|
+
* body, and never restores them while another overlay is still open.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Locks body scroll while `active` is true.
|
|
13
|
+
*
|
|
14
|
+
* The lock is shared by every caller: it applies on the first overlay that
|
|
15
|
+
* becomes active and is released when the last one stops being active. The
|
|
16
|
+
* lock is applied from an effect, so server rendering is unaffected.
|
|
17
|
+
*
|
|
18
|
+
* @param active - Whether the calling overlay currently covers the page.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useBodyScrollLock(active: boolean): void;
|
|
21
|
+
//# sourceMappingURL=use-body-scroll-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-body-scroll-lock.d.ts","sourceRoot":"","sources":["../../src/libs/use-body-scroll-lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAsDH;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAevD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { useEffect as e } from "react";
|
|
4
|
+
//#region src/libs/use-body-scroll-lock.ts
|
|
5
|
+
var t = 0, n = null;
|
|
6
|
+
function r() {
|
|
7
|
+
let e = window.scrollY, { style: t } = document.body, n = {
|
|
8
|
+
position: t.position,
|
|
9
|
+
top: t.top,
|
|
10
|
+
left: t.left,
|
|
11
|
+
right: t.right,
|
|
12
|
+
width: t.width,
|
|
13
|
+
overflow: t.overflow
|
|
14
|
+
};
|
|
15
|
+
return t.position = "fixed", t.top = `-${e}px`, t.left = "0", t.right = "0", t.width = "100%", t.overflow = "hidden", () => {
|
|
16
|
+
t.position = n.position, t.top = n.top, t.left = n.left, t.right = n.right, t.width = n.width, t.overflow = n.overflow, window.scrollTo(0, e);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function i(i) {
|
|
20
|
+
e(() => {
|
|
21
|
+
if (!(!i || typeof document > "u" || !document.body)) return t === 0 && (n = r()), t += 1, () => {
|
|
22
|
+
--t, t === 0 && (n?.(), n = null);
|
|
23
|
+
};
|
|
24
|
+
}, [i]);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { i as useBodyScrollLock };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FloatingRootContext } from '@floating-ui/react';
|
|
2
|
+
import { RefCallback } from 'react';
|
|
3
|
+
/** The focus wiring a dialog overlay needs. */
|
|
4
|
+
export interface DialogOverlayWiring {
|
|
5
|
+
/** Context consumed by `FloatingFocusManager`. */
|
|
6
|
+
context: FloatingRootContext;
|
|
7
|
+
/** Registers the dialog element as the focus scope root. */
|
|
8
|
+
setDialogRef: RefCallback<HTMLElement>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Wires a dialog overlay to the shared focus management.
|
|
12
|
+
*
|
|
13
|
+
* The dialog element is held in state rather than a ref so that the root
|
|
14
|
+
* context exposes it on the render after it mounts: the focus manager ignores a
|
|
15
|
+
* context whose floating element is still unknown.
|
|
16
|
+
*
|
|
17
|
+
* @param isOpen - Whether the dialog is open.
|
|
18
|
+
* @returns The focus context and the dialog ref setter.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useDialogOverlay(isOpen: boolean): DialogOverlayWiring;
|
|
21
|
+
//# sourceMappingURL=use-dialog-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dialog-overlay.d.ts","sourceRoot":"","sources":["../../src/libs/use-dialog-overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,OAAO,CAAC;AAEhE,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,kDAAkD;IAClD,OAAO,EAAE,mBAAmB,CAAC;IAC7B,4DAA4D;IAC5D,YAAY,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,CAerE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { useCallback as e, useState as t } from "react";
|
|
4
|
+
import { useFloatingRootContext as n } from "@floating-ui/react";
|
|
5
|
+
//#region src/libs/use-dialog-overlay.ts
|
|
6
|
+
function r(r) {
|
|
7
|
+
let [i, a] = t(null), o = e(() => {}, []);
|
|
8
|
+
return {
|
|
9
|
+
context: n({
|
|
10
|
+
open: r,
|
|
11
|
+
onOpenChange: o,
|
|
12
|
+
elements: {
|
|
13
|
+
reference: null,
|
|
14
|
+
floating: i
|
|
15
|
+
}
|
|
16
|
+
}),
|
|
17
|
+
setDialogRef: a
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { r as useDialogOverlay };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reduced-motion preference for AsheeUI.
|
|
3
|
+
*
|
|
4
|
+
* Continuous or automatic motion (a marquee loop, carousel autoplay and
|
|
5
|
+
* transitions) must yield to the operating system's reduced-motion preference.
|
|
6
|
+
* Components read the preference through this hook instead of each
|
|
7
|
+
* one querying the media query themselves, so the behaviour is defined once and
|
|
8
|
+
* is observable in a test.
|
|
9
|
+
*/
|
|
10
|
+
/** Media query that reports the user's reduced-motion preference. */
|
|
11
|
+
export declare const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
12
|
+
/**
|
|
13
|
+
* Reports whether the user asked for reduced motion.
|
|
14
|
+
*
|
|
15
|
+
* The preference is read after mount, so server rendering always produces the
|
|
16
|
+
* motion-safe markup and hydration never mismatches. Without a `matchMedia`
|
|
17
|
+
* implementation the preference is reported as `false`, which keeps the
|
|
18
|
+
* component's own behaviour unchanged.
|
|
19
|
+
*
|
|
20
|
+
* @returns `true` while the user prefers reduced motion.
|
|
21
|
+
*/
|
|
22
|
+
export declare function usePrefersReducedMotion(): boolean;
|
|
23
|
+
//# sourceMappingURL=use-prefers-reduced-motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-prefers-reduced-motion.d.ts","sourceRoot":"","sources":["../../src/libs/use-prefers-reduced-motion.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,qCAAqC,CAAC;AAEvE;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAoBjD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { useEffect as e, useState as t } from "react";
|
|
4
|
+
//#region src/libs/use-prefers-reduced-motion.ts
|
|
5
|
+
var n = "(prefers-reduced-motion: reduce)";
|
|
6
|
+
function r() {
|
|
7
|
+
let [r, i] = t(!1);
|
|
8
|
+
return e(() => {
|
|
9
|
+
if (typeof window > "u" || !window.matchMedia) return;
|
|
10
|
+
let e = window.matchMedia(n);
|
|
11
|
+
i(e.matches);
|
|
12
|
+
let t = (e) => {
|
|
13
|
+
i(e.matches);
|
|
14
|
+
};
|
|
15
|
+
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
16
|
+
}, []), r;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as REDUCED_MOTION_QUERY, r as usePrefersReducedMotion };
|
|
@@ -13,15 +13,44 @@ var n = {
|
|
|
13
13
|
success: "--ashee-success",
|
|
14
14
|
scrollbarThumb: "--ashee-scrollbar-thumb",
|
|
15
15
|
scrollbarTrack: "--ashee-scrollbar-track"
|
|
16
|
-
}, r = "ashee-theme-vars";
|
|
17
|
-
function
|
|
16
|
+
}, r = "ashee-theme-vars", i = "ashee-theme-script";
|
|
17
|
+
function a(e) {
|
|
18
18
|
return Object.entries(e).map(([e, t]) => {
|
|
19
19
|
let r = Object.entries(t).map(([e, t]) => ` ${n[e]}: ${t};`).join("\n");
|
|
20
20
|
return `${e === "light" ? ":root, .theme-light" : `.theme-${e}`} {\n${r}\n}`;
|
|
21
21
|
}).join("\n\n");
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
var o = {
|
|
24
|
+
width: "--ashee-scrollbar-width",
|
|
25
|
+
radius: "--ashee-scrollbar-radius",
|
|
26
|
+
trackRadius: "--ashee-scrollbar-track-radius",
|
|
27
|
+
thumbBorder: "--ashee-scrollbar-thumb-border",
|
|
28
|
+
gutter: "--ashee-scrollbar-gutter"
|
|
29
|
+
};
|
|
30
|
+
function s(e) {
|
|
31
|
+
if (!e) return "";
|
|
32
|
+
let t = {
|
|
33
|
+
width: e.width,
|
|
34
|
+
radius: e.radius,
|
|
35
|
+
trackRadius: e.trackRadius ?? e.radius,
|
|
36
|
+
thumbBorder: e.thumbBorder,
|
|
37
|
+
gutter: e.gutter
|
|
38
|
+
}, n = Object.entries(o).map(([e, n]) => {
|
|
39
|
+
let r = t[e];
|
|
40
|
+
return r ? ` ${n}: ${r};` : null;
|
|
41
|
+
}).filter((e) => e !== null);
|
|
42
|
+
return n.length > 0 ? `:root {\n${n.join("\n")}\n}` : "";
|
|
43
|
+
}
|
|
44
|
+
function c(e) {
|
|
45
|
+
return [a(e.color), s(e.components?.scrollbar)].filter((e) => e !== "").join("\n\n");
|
|
46
|
+
}
|
|
47
|
+
function l(e) {
|
|
48
|
+
if (typeof document > "u" || document.getElementById("ashee-theme-vars")) return;
|
|
49
|
+
let t = document.createElement("style");
|
|
50
|
+
t.id = r, t.textContent = c(e), document.head.appendChild(t);
|
|
51
|
+
}
|
|
52
|
+
function u({ config: n }) {
|
|
53
|
+
let a = Object.keys(n.color ?? {}), o = n.defaultTheme ?? "system", s = e, l = c(n), u = `
|
|
25
54
|
(function() {
|
|
26
55
|
var el = document.documentElement;
|
|
27
56
|
var storageKey = ${JSON.stringify(s)};
|
|
@@ -35,7 +64,13 @@ function a({ config: n }) {
|
|
|
35
64
|
} catch (e) {}
|
|
36
65
|
|
|
37
66
|
var selection = stored || defaultTheme;
|
|
67
|
+
if (selection !== 'system' && themes.indexOf(selection) === -1) {
|
|
68
|
+
selection = defaultTheme;
|
|
69
|
+
}
|
|
38
70
|
var resolved = selection === 'system' ? (systemDark ? 'dark' : 'light') : selection;
|
|
71
|
+
if (themes.indexOf(resolved) === -1) {
|
|
72
|
+
resolved = themes.indexOf(defaultTheme) !== -1 ? defaultTheme : (themes[0] || resolved);
|
|
73
|
+
}
|
|
39
74
|
|
|
40
75
|
var prefix = 'theme-';
|
|
41
76
|
for (var i = el.classList.length - 1; i >= 0; i--) {
|
|
@@ -51,16 +86,16 @@ function a({ config: n }) {
|
|
|
51
86
|
if (!styleEl) {
|
|
52
87
|
styleEl = document.createElement('style');
|
|
53
88
|
styleEl.id = ${JSON.stringify(r)};
|
|
54
|
-
styleEl.textContent = ${JSON.stringify(
|
|
89
|
+
styleEl.textContent = ${JSON.stringify(l)};
|
|
55
90
|
document.head.appendChild(styleEl);
|
|
56
91
|
}
|
|
57
92
|
})();
|
|
58
93
|
`;
|
|
59
94
|
return /* @__PURE__ */ t("script", {
|
|
60
|
-
id:
|
|
61
|
-
dangerouslySetInnerHTML: { __html:
|
|
95
|
+
id: i,
|
|
96
|
+
dangerouslySetInnerHTML: { __html: u },
|
|
62
97
|
suppressHydrationWarning: !0
|
|
63
98
|
});
|
|
64
99
|
}
|
|
65
100
|
//#endregion
|
|
66
|
-
export {
|
|
101
|
+
export { u as AsheeThemeScript, i as THEME_SCRIPT_ID, r as THEME_VARS_STYLE_ID, c as buildThemeVarsCss, l as ensureThemeVarsStyle };
|