asheeui 0.6.14 → 0.7.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/README.md +1 -14
- package/dist/AsheeUIProvider.js +22 -24
- package/dist/components/accordion/Accordion.js +79 -173
- package/dist/components/accordion/accordion-config.js +12 -13
- package/dist/components/accordion/accordion-styles.js +21 -24
- package/dist/components/autocomplete/Autocomplete.js +78 -136
- package/dist/components/autocomplete/autocomplete-config.js +7 -12
- package/dist/components/button/Button.d.ts +29 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +47 -108
- package/dist/components/button/button-config.js +16 -17
- package/dist/components/button/button-styles.js +10 -11
- package/dist/components/card/Card.d.ts +36 -16
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +115 -205
- package/dist/components/card/card-config.js +24 -21
- package/dist/components/card/card-styles.js +19 -22
- package/dist/components/carousel/Carousel.js +123 -248
- package/dist/components/carousel/carousel-config.js +24 -25
- package/dist/components/carousel/carousel-styles.js +14 -16
- package/dist/components/chip/Chip.js +84 -191
- package/dist/components/chip/chip-config.js +13 -14
- package/dist/components/chip/chip-styles.js +22 -26
- package/dist/components/date-picker/Calendar.d.ts +3 -3
- package/dist/components/date-picker/Calendar.d.ts.map +1 -1
- package/dist/components/date-picker/Calendar.js +141 -222
- package/dist/components/date-picker/DatePicker.d.ts +5 -5
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +122 -220
- package/dist/components/date-picker/TimeSpinner.js +58 -82
- package/dist/components/date-picker/date-picker-config.d.ts +4 -4
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +10 -11
- package/dist/components/date-picker/date-picker-styles.js +44 -45
- package/dist/components/date-picker/date-picker.helpers.d.ts +4 -4
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.helpers.js +74 -102
- package/dist/components/drawer/Drawer.d.ts +26 -8
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +54 -131
- package/dist/components/drawer/drawer-config.js +14 -15
- package/dist/components/drawer/drawer-styles.js +38 -42
- package/dist/components/field/FieldShell.js +49 -56
- package/dist/components/field/field-config.js +17 -18
- package/dist/components/field/field-styles.js +8 -8
- package/dist/components/image/Image.d.ts +7 -7
- package/dist/components/image/Image.d.ts.map +1 -1
- package/dist/components/image/Image.js +65 -132
- package/dist/components/image/image-config.js +17 -18
- package/dist/components/image/image-styles.js +14 -15
- package/dist/components/input/Input.js +65 -150
- package/dist/components/input/PasswordInput.js +30 -49
- package/dist/components/input/input-config.js +7 -7
- package/dist/components/input/input-styles.js +9 -10
- package/dist/components/keyboard/KeyboardContext.js +10 -11
- package/dist/components/keyboard/KeyboardProvider.js +100 -181
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +159 -166
- package/dist/components/keyboard/keyboard-config.js +59 -57
- package/dist/components/keyboard/keyboard-styles.js +10 -11
- package/dist/components/keyboard/use-keyboard-field.js +29 -21
- package/dist/components/link/Link.js +47 -137
- package/dist/components/link/link-config.js +14 -15
- package/dist/components/link/link-styles.js +25 -29
- package/dist/components/marquee/Marquee.js +55 -144
- package/dist/components/marquee/marquee-config.js +18 -19
- package/dist/components/marquee/marquee-styles.js +13 -15
- package/dist/components/modal/Modal.d.ts +26 -10
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +56 -136
- package/dist/components/modal/modal-config.js +15 -16
- package/dist/components/modal/modal-styles.js +13 -14
- package/dist/components/multi-select/MultiSelect.d.ts +18 -2
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +149 -283
- package/dist/components/multi-select/multi-select-config.d.ts +23 -18
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +18 -21
- package/dist/components/multi-select/multi-select-styles.js +17 -20
- package/dist/components/radio/Radio.js +43 -80
- package/dist/components/radio/RadioGroup.js +57 -155
- package/dist/components/radio/radio-config.js +15 -16
- package/dist/components/radio/radio-context.js +6 -6
- package/dist/components/radio/radio-styles.js +55 -60
- package/dist/components/resizable-screen/ResizableScreen.js +87 -177
- package/dist/components/resizable-screen/resizable-screen-config.js +16 -17
- package/dist/components/select/Select.d.ts +3 -2
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +97 -195
- package/dist/components/select/select-config.js +8 -9
- package/dist/components/select/select-styles.js +5 -5
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +102 -196
- package/dist/components/select-menu/select-menu-config.js +12 -12
- package/dist/components/select-menu/use-select-floating.d.ts +11 -1
- package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
- package/dist/components/select-menu/use-select-floating.js +41 -48
- package/dist/components/sidebar/Sidebar.d.ts +43 -22
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +146 -331
- package/dist/components/sidebar/sidebar-config.d.ts +98 -31
- package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar-config.js +47 -33
- package/dist/components/sidebar/sidebar-styles.js +27 -32
- package/dist/components/spinner/spinner-config.js +12 -13
- package/dist/components/spinner/spinner-styles.js +13 -14
- package/dist/components/spinner/spinner.js +39 -82
- package/dist/components/switch/Switch.js +62 -154
- package/dist/components/switch/switch-config.js +11 -12
- package/dist/components/switch/switch-styles.js +14 -16
- package/dist/components/table/Table.js +64 -186
- package/dist/components/table/table-config.js +17 -18
- package/dist/components/table/table-styles.js +48 -52
- package/dist/components/tabs/Tabs.d.ts +16 -8
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +93 -208
- package/dist/components/tabs/tabs-config.d.ts +42 -20
- package/dist/components/tabs/tabs-config.d.ts.map +1 -1
- package/dist/components/tabs/tabs-config.js +26 -18
- package/dist/components/tabs/tabs-styles.js +15 -17
- package/dist/components/textarea/Textarea.js +52 -138
- package/dist/components/textarea/textarea-config.js +10 -11
- package/dist/components/textarea/textarea-styles.js +9 -10
- package/dist/components/toast/ToastContext.js +22 -26
- package/dist/components/toast/ToastItem.js +82 -144
- package/dist/components/toast/ToastProvider.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.js +128 -190
- package/dist/components/toast/toast-config.js +23 -24
- package/dist/components/toast/toast-styles.js +50 -55
- package/dist/components/toast/use-pausable-timeout.js +17 -13
- package/dist/components/tooltip/Tooltip.d.ts +5 -0
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +68 -158
- package/dist/components/tooltip/tooltip-config.d.ts +25 -0
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-config.js +26 -22
- package/dist/components/tooltip/tooltip-styles.js +15 -17
- package/dist/config/default-config.js +11 -34
- package/dist/config/resolve-color.js +23 -23
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/config/resolve-config.js +14 -12
- package/dist/icons/ArrowLeftIcon.js +16 -19
- package/dist/icons/CalendarIcon.js +43 -24
- package/dist/icons/CheckIcon.js +16 -19
- package/dist/icons/ChevronDownIcon.js +15 -21
- package/dist/icons/ChevronLeftIcon.js +16 -19
- package/dist/icons/ChevronRightIcon.js +16 -19
- package/dist/icons/ChevronUpIcon.js +16 -19
- package/dist/icons/ClearIcon.js +26 -22
- package/dist/icons/ClockIcon.js +20 -22
- package/dist/icons/CloseIcon.js +26 -22
- package/dist/icons/ErrorIcon.js +16 -19
- package/dist/icons/ExternalLinkIcon.js +25 -23
- package/dist/icons/EyeIcon.js +20 -22
- package/dist/icons/EyeOffIcon.js +21 -22
- package/dist/icons/InfoIcon.js +16 -19
- package/dist/icons/SearchIcon.js +25 -22
- package/dist/icons/WarningIcon.js +16 -19
- package/dist/index.js +65 -163
- package/dist/libs/context.js +10 -13
- package/dist/libs/index.js +1 -0
- package/dist/libs/registry.js +10 -12
- package/dist/libs/use-floating-z-index.d.ts +32 -0
- package/dist/libs/use-floating-z-index.d.ts.map +1 -0
- package/dist/libs/use-floating-z-index.js +16 -0
- package/dist/libs/use-isomorphic-layout-effect.js +5 -5
- package/dist/scripts/AsheeThemeScript.js +35 -44
- package/dist/shared/radius.d.ts.map +1 -1
- package/dist/shared/radius.js +12 -13
- package/dist/shared/variant.js +46 -134
- package/dist/theme/color.js +28 -28
- package/dist/theme/controller.d.ts.map +1 -1
- package/dist/theme/controller.js +65 -178
- package/dist/theme/useTheme.js +13 -44
- package/dist/utils/cn.js +7 -7
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/merge-object.js +13 -14
- package/dist/utils/resolve-token.js +11 -14
- package/dist/utils/stacking.d.ts +76 -0
- package/dist/utils/stacking.d.ts.map +1 -0
- package/dist/utils/stacking.js +34 -0
- package/package.json +12 -11
|
@@ -1,139 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { useAsheeConfig as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { useKeyboardField as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
), Z = t(
|
|
55
|
-
I,
|
|
56
|
-
e == null ? void 0 : e.size,
|
|
57
|
-
void 0,
|
|
58
|
-
r.size
|
|
59
|
-
), R = t(
|
|
60
|
-
K,
|
|
61
|
-
e == null ? void 0 : e.variant,
|
|
62
|
-
i.defaultVariant,
|
|
63
|
-
r.variant
|
|
64
|
-
), J = t(
|
|
65
|
-
_,
|
|
66
|
-
e == null ? void 0 : e.color,
|
|
67
|
-
i.defaultColor,
|
|
68
|
-
r.color
|
|
69
|
-
), S = (s) => s === "full" ? "xl" : s, M = oe(
|
|
70
|
-
S(x),
|
|
71
|
-
S(e == null ? void 0 : e.radius),
|
|
72
|
-
i.defaultRadius,
|
|
73
|
-
r.radius
|
|
74
|
-
), n = w ?? r.status, P = t(
|
|
75
|
-
z,
|
|
76
|
-
e == null ? void 0 : e.labelAlign,
|
|
77
|
-
void 0,
|
|
78
|
-
r.labelAlign
|
|
79
|
-
), Q = t(
|
|
80
|
-
B,
|
|
81
|
-
e == null ? void 0 : e.rows,
|
|
82
|
-
void 0,
|
|
83
|
-
r.rows
|
|
84
|
-
), W = ne(
|
|
85
|
-
R,
|
|
86
|
-
J
|
|
87
|
-
), Y = n !== "default" ? le[n] : "", g = R === "underlined" ? "rounded-none" : te(
|
|
88
|
-
M,
|
|
89
|
-
ce,
|
|
90
|
-
r.radius
|
|
91
|
-
);
|
|
92
|
-
return /* @__PURE__ */ T(
|
|
93
|
-
ae,
|
|
94
|
-
{
|
|
95
|
-
id: o,
|
|
96
|
-
label: L,
|
|
97
|
-
labelAlign: P,
|
|
98
|
-
description: u,
|
|
99
|
-
descriptionId: p,
|
|
100
|
-
message: m,
|
|
101
|
-
messageId: A,
|
|
102
|
-
status: n,
|
|
103
|
-
required: v,
|
|
104
|
-
isLoading: f,
|
|
105
|
-
children: /* @__PURE__ */ T(
|
|
106
|
-
"textarea",
|
|
107
|
-
{
|
|
108
|
-
ref: c,
|
|
109
|
-
id: o,
|
|
110
|
-
disabled: k,
|
|
111
|
-
required: v,
|
|
112
|
-
rows: Q,
|
|
113
|
-
"aria-busy": f,
|
|
114
|
-
"aria-invalid": n === "error",
|
|
115
|
-
"aria-describedby": D,
|
|
116
|
-
onFocus: G,
|
|
117
|
-
onBlur: H,
|
|
118
|
-
className: ue(
|
|
119
|
-
"resize-y w-full text-foreground outline-none transition-colors shrink-0",
|
|
120
|
-
"focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
121
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
122
|
-
de[Z],
|
|
123
|
-
W,
|
|
124
|
-
Y,
|
|
125
|
-
g,
|
|
126
|
-
j
|
|
127
|
-
),
|
|
128
|
-
style: F,
|
|
129
|
-
...N
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
me.displayName = "TextArea";
|
|
137
|
-
export {
|
|
138
|
-
me as TextArea
|
|
139
|
-
};
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../../utils/cn.js";
|
|
4
|
+
import { useAsheeConfig as t } from "../../libs/context.js";
|
|
5
|
+
import { RADIUS_CLASS as n } from "../../shared/radius.js";
|
|
6
|
+
import { resolveVariantClass as r } from "../../shared/variant.js";
|
|
7
|
+
import { resolveCascade as i, resolveClassKey as a, resolveRadiusKey as o } from "../../utils/resolve-token.js";
|
|
8
|
+
import { FieldShell as ee } from "../field/FieldShell.js";
|
|
9
|
+
import { useKeyboardField as s } from "../keyboard/use-keyboard-field.js";
|
|
10
|
+
import { FALLBACK_TEXTAREA_CONFIG as c } from "./textarea-config.js";
|
|
11
|
+
import { TEXTAREA_SIZE_CLASS as te, TEXTAREA_STATUS_BORDER_CLASS as l } from "./textarea-styles.js";
|
|
12
|
+
import { forwardRef as u, useCallback as d, useId as f, useImperativeHandle as p, useRef as m } from "react";
|
|
13
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
14
|
+
//#region src/components/textarea/Textarea.tsx
|
|
15
|
+
var g = u(({ size: u, radius: g, variant: _, color: v, status: y, label: b, labelAlign: x, description: S, message: C, required: w, isLoading: T, rows: E, id: D, className: O, disabled: k, style: A, onFocus: j, onBlur: M, enableVirtualKeyboard: N = !0, ...P }, F) => {
|
|
16
|
+
let I = t(), L = I.components?.textarea, R = m(null);
|
|
17
|
+
p(F, () => R.current);
|
|
18
|
+
let z = f(), B = D ?? z, V = S ? `${B}-description` : void 0, H = C ? `${B}-message` : void 0, U = [V, H].filter(Boolean).join(" ") || void 0, { handleFocus: W, handleBlur: G } = s(B, R, !!N, typeof N == "object" && N ? N : void 0), K = d((e) => {
|
|
19
|
+
W(e), j?.(e);
|
|
20
|
+
}, [W, j]), q = d((e) => {
|
|
21
|
+
G(), M?.(e);
|
|
22
|
+
}, [G, M]), J = i(u, L?.size, void 0, c.size), Y = i(_, L?.variant, I.defaultVariant, c.variant), X = i(v, L?.color, I.defaultColor, c.color), Z = (e) => e === "full" ? "xl" : e, Q = o(Z(g), Z(L?.radius), I.defaultRadius, c.radius), $ = y ?? c.status, ne = i(x, L?.labelAlign, void 0, c.labelAlign), re = i(E, L?.rows, void 0, c.rows), ie = r(Y, X), ae = $ === "default" ? "" : l[$], oe = Y === "underlined" ? "rounded-none" : a(Q, n, c.radius);
|
|
23
|
+
return /* @__PURE__ */ h(ee, {
|
|
24
|
+
id: B,
|
|
25
|
+
label: b,
|
|
26
|
+
labelAlign: ne,
|
|
27
|
+
description: S,
|
|
28
|
+
descriptionId: V,
|
|
29
|
+
message: C,
|
|
30
|
+
messageId: H,
|
|
31
|
+
status: $,
|
|
32
|
+
required: w,
|
|
33
|
+
isLoading: T,
|
|
34
|
+
children: /* @__PURE__ */ h("textarea", {
|
|
35
|
+
ref: R,
|
|
36
|
+
id: B,
|
|
37
|
+
disabled: k,
|
|
38
|
+
required: w,
|
|
39
|
+
rows: re,
|
|
40
|
+
"aria-busy": T,
|
|
41
|
+
"aria-invalid": $ === "error",
|
|
42
|
+
"aria-describedby": U,
|
|
43
|
+
onFocus: K,
|
|
44
|
+
onBlur: q,
|
|
45
|
+
className: e("resize-y w-full text-foreground outline-none transition-colors shrink-0", "focus-visible:ring-2 focus-visible:ring-offset-2", "disabled:pointer-events-none disabled:opacity-50", te[J], ie, ae, oe, O),
|
|
46
|
+
style: A,
|
|
47
|
+
...P
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
g.displayName = "TextArea";
|
|
52
|
+
//#endregion
|
|
53
|
+
export { g as TextArea };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
-
import { FALLBACK_FIELD_CONFIG as t, defaultFieldConfig as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import { FALLBACK_FIELD_CONFIG as t, defaultFieldConfig as n } from "../field/field-config.js";
|
|
4
|
+
//#region src/components/textarea/textarea-config.ts
|
|
5
|
+
var r = {
|
|
6
|
+
...n,
|
|
7
|
+
rows: 4
|
|
8
|
+
}, i = {
|
|
9
|
+
...t,
|
|
10
|
+
rows: 4
|
|
10
11
|
};
|
|
11
12
|
e("textarea", r);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
r as defaultTextAreaConfig
|
|
15
|
-
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { i as FALLBACK_TEXTAREA_CONFIG, r as defaultTextAreaConfig };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { FIELD_STATUS_BORDER_CLASS as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
2
|
+
import { FIELD_STATUS_BORDER_CLASS as e } from "../field/field-styles.js";
|
|
3
|
+
//#region src/components/textarea/textarea-styles.ts
|
|
4
|
+
var t = {
|
|
5
|
+
sm: "p-2 text-xs",
|
|
6
|
+
md: "p-3 text-sm",
|
|
7
|
+
lg: "p-4 text-base"
|
|
8
|
+
}, n = e;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as TEXTAREA_SIZE_CLASS, n as TEXTAREA_STATUS_BORDER_CLASS };
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext as e, useContext as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
defaultAnimated: !0
|
|
23
|
-
};
|
|
2
|
+
import { createContext as e, useContext as t } from "react";
|
|
3
|
+
//#region src/components/toast/ToastContext.tsx
|
|
4
|
+
var n = e(null);
|
|
5
|
+
function r() {
|
|
6
|
+
return t(n) || {
|
|
7
|
+
toasts: [],
|
|
8
|
+
toast: () => "",
|
|
9
|
+
success: () => "",
|
|
10
|
+
error: () => "",
|
|
11
|
+
info: () => "",
|
|
12
|
+
warning: () => "",
|
|
13
|
+
removeToast: () => {},
|
|
14
|
+
clearToasts: () => {},
|
|
15
|
+
portalTarget: null,
|
|
16
|
+
defaultPlacement: "top-right",
|
|
17
|
+
defaultSize: "md",
|
|
18
|
+
defaultVariant: "bordered",
|
|
19
|
+
defaultRadius: "md",
|
|
20
|
+
defaultAnimated: !0
|
|
21
|
+
};
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
n as useToast
|
|
28
|
-
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { n as ToastContext, r as useToast };
|
|
@@ -1,148 +1,86 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
default:
|
|
28
|
-
return "secondary";
|
|
29
|
-
}
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../../utils/cn.js";
|
|
4
|
+
import { useAsheeConfig as t } from "../../libs/context.js";
|
|
5
|
+
import { RADIUS_CLASS as n } from "../../shared/radius.js";
|
|
6
|
+
import { resolveVariantClass as r } from "../../shared/variant.js";
|
|
7
|
+
import { resolveCascade as i, resolveClassKey as a } from "../../utils/resolve-token.js";
|
|
8
|
+
import { CheckIcon as o } from "../../icons/CheckIcon.js";
|
|
9
|
+
import { CloseIcon as s } from "../../icons/CloseIcon.js";
|
|
10
|
+
import { ErrorIcon as c } from "../../icons/ErrorIcon.js";
|
|
11
|
+
import { InfoIcon as l } from "../../icons/InfoIcon.js";
|
|
12
|
+
import { WarningIcon as u } from "../../icons/WarningIcon.js";
|
|
13
|
+
import { FALLBACK_TOAST_CONFIG as d } from "./toast-config.js";
|
|
14
|
+
import { TOAST_ANIMATION_STATE as f, TOAST_FONT_CLASS as p, TOAST_PADDING_CLASS as m, TOAST_TITLE_FONT_CLASS as h, TOAST_WIDTH_CLASS as g } from "./toast-styles.js";
|
|
15
|
+
import { usePausableTimeout as _ } from "./use-pausable-timeout.js";
|
|
16
|
+
import { useCallback as v, useState as y } from "react";
|
|
17
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
18
|
+
//#region src/components/toast/ToastItem.tsx
|
|
19
|
+
function S(e = "info") {
|
|
20
|
+
switch (e) {
|
|
21
|
+
case "success": return "success";
|
|
22
|
+
case "error": return "danger";
|
|
23
|
+
case "warning": return "warning";
|
|
24
|
+
case "info": return "primary";
|
|
25
|
+
default: return "secondary";
|
|
26
|
+
}
|
|
30
27
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return /* @__PURE__ */ e(H, { className: t(o, !s && "text-warning") });
|
|
40
|
-
default:
|
|
41
|
-
return /* @__PURE__ */ e(B, { className: t(o, !s && "text-primary") });
|
|
42
|
-
}
|
|
28
|
+
function C(t = "info", n = !1) {
|
|
29
|
+
let r = e("w-5 h-5", n && "text-current");
|
|
30
|
+
switch (t) {
|
|
31
|
+
case "success": return /* @__PURE__ */ b(o, { className: e(r, !n && "text-success") });
|
|
32
|
+
case "error": return /* @__PURE__ */ b(c, { className: e(r, !n && "text-danger") });
|
|
33
|
+
case "warning": return /* @__PURE__ */ b(u, { className: e(r, !n && "text-warning") });
|
|
34
|
+
default: return /* @__PURE__ */ b(l, { className: e(r, !n && "text-primary") });
|
|
35
|
+
}
|
|
43
36
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
n.radius
|
|
91
|
-
), T = X[x], j = p ? m ? T.exit : T.enter : "";
|
|
92
|
-
return /* @__PURE__ */ C(
|
|
93
|
-
"div",
|
|
94
|
-
{
|
|
95
|
-
onMouseEnter: _,
|
|
96
|
-
onMouseLeave: k,
|
|
97
|
-
className: t(
|
|
98
|
-
"pointer-events-auto relative flex gap-3 items-start shadow-lg border backdrop-blur-md select-none scrollbar-hide overflow-hidden transition-all duration-200 active:scale-[0.99]",
|
|
99
|
-
"bg-background",
|
|
100
|
-
L,
|
|
101
|
-
E,
|
|
102
|
-
M,
|
|
103
|
-
j,
|
|
104
|
-
$(f, O)
|
|
105
|
-
),
|
|
106
|
-
children: [
|
|
107
|
-
/* @__PURE__ */ e("div", { className: "shrink-0 pt-0.5 ps-1", children: A ?? re(u, y) }),
|
|
108
|
-
/* @__PURE__ */ C("div", { className: "flex-1 min-w-0 flex flex-col gap-0.5", children: [
|
|
109
|
-
s && /* @__PURE__ */ e(
|
|
110
|
-
"span",
|
|
111
|
-
{
|
|
112
|
-
className: t(
|
|
113
|
-
"leading-tight truncate text-current",
|
|
114
|
-
D
|
|
115
|
-
),
|
|
116
|
-
children: s
|
|
117
|
-
}
|
|
118
|
-
),
|
|
119
|
-
/* @__PURE__ */ e(
|
|
120
|
-
"div",
|
|
121
|
-
{
|
|
122
|
-
className: t(
|
|
123
|
-
"leading-snug wrap-break-word opacity-90 text-current",
|
|
124
|
-
F
|
|
125
|
-
),
|
|
126
|
-
children: o
|
|
127
|
-
}
|
|
128
|
-
),
|
|
129
|
-
d && /* @__PURE__ */ e("div", { className: "mt-2 flex items-center gap-2", children: d })
|
|
130
|
-
] }),
|
|
131
|
-
N && /* @__PURE__ */ e(
|
|
132
|
-
"button",
|
|
133
|
-
{
|
|
134
|
-
type: "button",
|
|
135
|
-
onClick: () => c(r),
|
|
136
|
-
"aria-label": "Dismiss notification",
|
|
137
|
-
className: "shrink-0 p-1 rounded-md opacity-70 hover:opacity-100 hover:bg-black/10 dark:hover:bg-white/10 transition-all cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-current",
|
|
138
|
-
children: /* @__PURE__ */ e(W, { className: "w-4 h-4" })
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
);
|
|
37
|
+
function w({ id: o, title: c, message: l, type: u = "info", timeout: w = 3500, icon: T, action: E, dismissible: D = !0, onDismiss: O, placement: k, size: A, variant: j, color: M, radius: N, animated: P }) {
|
|
38
|
+
let F = t().components?.toast, [I, L] = y(!1), R = i(P, F?.animated, void 0, d.animated), z = v(() => {
|
|
39
|
+
R && !I ? (L(!0), setTimeout(() => {
|
|
40
|
+
O(o);
|
|
41
|
+
}, 150)) : O(o);
|
|
42
|
+
}, [
|
|
43
|
+
R,
|
|
44
|
+
I,
|
|
45
|
+
O,
|
|
46
|
+
o
|
|
47
|
+
]), { pause: B, resume: V } = _(z, w), H = M ?? S(u), U = j === "solid", W = a(A, g, d.size), G = a(A, m, d.size), K = a(A, p, d.size), q = a(A, h, d.size), J = a(N, n, d.radius), Y = f[k], X = P ? I ? Y.exit : Y.enter : "";
|
|
48
|
+
return /* @__PURE__ */ x("div", {
|
|
49
|
+
onMouseEnter: B,
|
|
50
|
+
onMouseLeave: V,
|
|
51
|
+
className: e("pointer-events-auto relative flex gap-3 items-start shadow-lg border backdrop-blur-md select-none scrollbar-hide overflow-hidden transition-all duration-200 active:scale-[0.99]", "bg-background", W, G, J, X, r(j, H)),
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ b("div", {
|
|
54
|
+
className: "shrink-0 pt-0.5 ps-1",
|
|
55
|
+
children: T ?? C(u, U)
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ x("div", {
|
|
58
|
+
className: "flex-1 min-w-0 flex flex-col gap-0.5",
|
|
59
|
+
children: [
|
|
60
|
+
c && /* @__PURE__ */ b("span", {
|
|
61
|
+
className: e("leading-tight truncate text-current", q),
|
|
62
|
+
children: c
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ b("div", {
|
|
65
|
+
className: e("leading-snug wrap-break-word opacity-90 text-current", K),
|
|
66
|
+
children: l
|
|
67
|
+
}),
|
|
68
|
+
E && /* @__PURE__ */ b("div", {
|
|
69
|
+
className: "mt-2 flex items-center gap-2",
|
|
70
|
+
children: E
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
}),
|
|
74
|
+
D && /* @__PURE__ */ b("button", {
|
|
75
|
+
type: "button",
|
|
76
|
+
onClick: () => O(o),
|
|
77
|
+
"aria-label": "Dismiss notification",
|
|
78
|
+
className: "shrink-0 p-1 rounded-md opacity-70 hover:opacity-100 hover:bg-black/10 dark:hover:bg-white/10 transition-all cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-current",
|
|
79
|
+
children: /* @__PURE__ */ b(s, { className: "w-4 h-4" })
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
144
83
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
84
|
+
w.displayName = "ToastItem";
|
|
85
|
+
//#endregion
|
|
86
|
+
export { w as ToastItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../src/components/toast/ToastProvider.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../src/components/toast/ToastProvider.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAQvE,OAAO,EAEL,KAAK,WAAW,EAIjB,MAAM,gBAAgB,CAAC;AAKxB;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,OAAO,EACP,MAAM,EACN,cAAc,EACd,SAAS,EACT,QAAQ,EACR,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,gBAAgB,EAC9B,SAAS,GACV,EAAE,kBAAkB,+BAgRpB"}
|