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.
Files changed (184) hide show
  1. package/README.md +1 -14
  2. package/dist/AsheeUIProvider.js +22 -24
  3. package/dist/components/accordion/Accordion.js +79 -173
  4. package/dist/components/accordion/accordion-config.js +12 -13
  5. package/dist/components/accordion/accordion-styles.js +21 -24
  6. package/dist/components/autocomplete/Autocomplete.js +78 -136
  7. package/dist/components/autocomplete/autocomplete-config.js +7 -12
  8. package/dist/components/button/Button.d.ts +29 -1
  9. package/dist/components/button/Button.d.ts.map +1 -1
  10. package/dist/components/button/Button.js +47 -108
  11. package/dist/components/button/button-config.js +16 -17
  12. package/dist/components/button/button-styles.js +10 -11
  13. package/dist/components/card/Card.d.ts +36 -16
  14. package/dist/components/card/Card.d.ts.map +1 -1
  15. package/dist/components/card/Card.js +115 -205
  16. package/dist/components/card/card-config.js +24 -21
  17. package/dist/components/card/card-styles.js +19 -22
  18. package/dist/components/carousel/Carousel.js +123 -248
  19. package/dist/components/carousel/carousel-config.js +24 -25
  20. package/dist/components/carousel/carousel-styles.js +14 -16
  21. package/dist/components/chip/Chip.js +84 -191
  22. package/dist/components/chip/chip-config.js +13 -14
  23. package/dist/components/chip/chip-styles.js +22 -26
  24. package/dist/components/date-picker/Calendar.d.ts +3 -3
  25. package/dist/components/date-picker/Calendar.d.ts.map +1 -1
  26. package/dist/components/date-picker/Calendar.js +141 -222
  27. package/dist/components/date-picker/DatePicker.d.ts +5 -5
  28. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  29. package/dist/components/date-picker/DatePicker.js +122 -220
  30. package/dist/components/date-picker/TimeSpinner.js +58 -82
  31. package/dist/components/date-picker/date-picker-config.d.ts +4 -4
  32. package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
  33. package/dist/components/date-picker/date-picker-config.js +10 -11
  34. package/dist/components/date-picker/date-picker-styles.js +44 -45
  35. package/dist/components/date-picker/date-picker.helpers.d.ts +4 -4
  36. package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -1
  37. package/dist/components/date-picker/date-picker.helpers.js +74 -102
  38. package/dist/components/drawer/Drawer.d.ts +26 -8
  39. package/dist/components/drawer/Drawer.d.ts.map +1 -1
  40. package/dist/components/drawer/Drawer.js +54 -131
  41. package/dist/components/drawer/drawer-config.js +14 -15
  42. package/dist/components/drawer/drawer-styles.js +38 -42
  43. package/dist/components/field/FieldShell.js +49 -56
  44. package/dist/components/field/field-config.js +17 -18
  45. package/dist/components/field/field-styles.js +8 -8
  46. package/dist/components/image/Image.d.ts +7 -7
  47. package/dist/components/image/Image.d.ts.map +1 -1
  48. package/dist/components/image/Image.js +65 -132
  49. package/dist/components/image/image-config.js +17 -18
  50. package/dist/components/image/image-styles.js +14 -15
  51. package/dist/components/input/Input.js +65 -150
  52. package/dist/components/input/PasswordInput.js +30 -49
  53. package/dist/components/input/input-config.js +7 -7
  54. package/dist/components/input/input-styles.js +9 -10
  55. package/dist/components/keyboard/KeyboardContext.js +10 -11
  56. package/dist/components/keyboard/KeyboardProvider.js +100 -181
  57. package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
  58. package/dist/components/keyboard/OnScreenKeyboard.js +159 -166
  59. package/dist/components/keyboard/keyboard-config.js +59 -57
  60. package/dist/components/keyboard/keyboard-styles.js +10 -11
  61. package/dist/components/keyboard/use-keyboard-field.js +29 -21
  62. package/dist/components/link/Link.js +47 -137
  63. package/dist/components/link/link-config.js +14 -15
  64. package/dist/components/link/link-styles.js +25 -29
  65. package/dist/components/marquee/Marquee.js +55 -144
  66. package/dist/components/marquee/marquee-config.js +18 -19
  67. package/dist/components/marquee/marquee-styles.js +13 -15
  68. package/dist/components/modal/Modal.d.ts +26 -10
  69. package/dist/components/modal/Modal.d.ts.map +1 -1
  70. package/dist/components/modal/Modal.js +56 -136
  71. package/dist/components/modal/modal-config.js +15 -16
  72. package/dist/components/modal/modal-styles.js +13 -14
  73. package/dist/components/multi-select/MultiSelect.d.ts +18 -2
  74. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  75. package/dist/components/multi-select/MultiSelect.js +149 -283
  76. package/dist/components/multi-select/multi-select-config.d.ts +23 -18
  77. package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
  78. package/dist/components/multi-select/multi-select-config.js +18 -21
  79. package/dist/components/multi-select/multi-select-styles.js +17 -20
  80. package/dist/components/radio/Radio.js +43 -80
  81. package/dist/components/radio/RadioGroup.js +57 -155
  82. package/dist/components/radio/radio-config.js +15 -16
  83. package/dist/components/radio/radio-context.js +6 -6
  84. package/dist/components/radio/radio-styles.js +55 -60
  85. package/dist/components/resizable-screen/ResizableScreen.js +87 -177
  86. package/dist/components/resizable-screen/resizable-screen-config.js +16 -17
  87. package/dist/components/select/Select.d.ts +3 -2
  88. package/dist/components/select/Select.d.ts.map +1 -1
  89. package/dist/components/select/Select.js +97 -195
  90. package/dist/components/select/select-config.js +8 -9
  91. package/dist/components/select/select-styles.js +5 -5
  92. package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
  93. package/dist/components/select-menu/SelectMenu.js +102 -196
  94. package/dist/components/select-menu/select-menu-config.js +12 -12
  95. package/dist/components/select-menu/use-select-floating.d.ts +11 -1
  96. package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
  97. package/dist/components/select-menu/use-select-floating.js +41 -48
  98. package/dist/components/sidebar/Sidebar.d.ts +43 -22
  99. package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
  100. package/dist/components/sidebar/Sidebar.js +146 -331
  101. package/dist/components/sidebar/sidebar-config.d.ts +98 -31
  102. package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
  103. package/dist/components/sidebar/sidebar-config.js +47 -33
  104. package/dist/components/sidebar/sidebar-styles.js +27 -32
  105. package/dist/components/spinner/spinner-config.js +12 -13
  106. package/dist/components/spinner/spinner-styles.js +13 -14
  107. package/dist/components/spinner/spinner.js +39 -82
  108. package/dist/components/switch/Switch.js +62 -154
  109. package/dist/components/switch/switch-config.js +11 -12
  110. package/dist/components/switch/switch-styles.js +14 -16
  111. package/dist/components/table/Table.js +64 -186
  112. package/dist/components/table/table-config.js +17 -18
  113. package/dist/components/table/table-styles.js +48 -52
  114. package/dist/components/tabs/Tabs.d.ts +16 -8
  115. package/dist/components/tabs/Tabs.d.ts.map +1 -1
  116. package/dist/components/tabs/Tabs.js +93 -208
  117. package/dist/components/tabs/tabs-config.d.ts +42 -20
  118. package/dist/components/tabs/tabs-config.d.ts.map +1 -1
  119. package/dist/components/tabs/tabs-config.js +26 -18
  120. package/dist/components/tabs/tabs-styles.js +15 -17
  121. package/dist/components/textarea/Textarea.js +52 -138
  122. package/dist/components/textarea/textarea-config.js +10 -11
  123. package/dist/components/textarea/textarea-styles.js +9 -10
  124. package/dist/components/toast/ToastContext.js +22 -26
  125. package/dist/components/toast/ToastItem.js +82 -144
  126. package/dist/components/toast/ToastProvider.d.ts.map +1 -1
  127. package/dist/components/toast/ToastProvider.js +128 -190
  128. package/dist/components/toast/toast-config.js +23 -24
  129. package/dist/components/toast/toast-styles.js +50 -55
  130. package/dist/components/toast/use-pausable-timeout.js +17 -13
  131. package/dist/components/tooltip/Tooltip.d.ts +5 -0
  132. package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
  133. package/dist/components/tooltip/Tooltip.js +68 -158
  134. package/dist/components/tooltip/tooltip-config.d.ts +25 -0
  135. package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
  136. package/dist/components/tooltip/tooltip-config.js +26 -22
  137. package/dist/components/tooltip/tooltip-styles.js +15 -17
  138. package/dist/config/default-config.js +11 -34
  139. package/dist/config/resolve-color.js +23 -23
  140. package/dist/config/resolve-config.d.ts.map +1 -1
  141. package/dist/config/resolve-config.js +14 -12
  142. package/dist/icons/ArrowLeftIcon.js +16 -19
  143. package/dist/icons/CalendarIcon.js +43 -24
  144. package/dist/icons/CheckIcon.js +16 -19
  145. package/dist/icons/ChevronDownIcon.js +15 -21
  146. package/dist/icons/ChevronLeftIcon.js +16 -19
  147. package/dist/icons/ChevronRightIcon.js +16 -19
  148. package/dist/icons/ChevronUpIcon.js +16 -19
  149. package/dist/icons/ClearIcon.js +26 -22
  150. package/dist/icons/ClockIcon.js +20 -22
  151. package/dist/icons/CloseIcon.js +26 -22
  152. package/dist/icons/ErrorIcon.js +16 -19
  153. package/dist/icons/ExternalLinkIcon.js +25 -23
  154. package/dist/icons/EyeIcon.js +20 -22
  155. package/dist/icons/EyeOffIcon.js +21 -22
  156. package/dist/icons/InfoIcon.js +16 -19
  157. package/dist/icons/SearchIcon.js +25 -22
  158. package/dist/icons/WarningIcon.js +16 -19
  159. package/dist/index.js +65 -163
  160. package/dist/libs/context.js +10 -13
  161. package/dist/libs/index.js +1 -0
  162. package/dist/libs/registry.js +10 -12
  163. package/dist/libs/use-floating-z-index.d.ts +32 -0
  164. package/dist/libs/use-floating-z-index.d.ts.map +1 -0
  165. package/dist/libs/use-floating-z-index.js +16 -0
  166. package/dist/libs/use-isomorphic-layout-effect.js +5 -5
  167. package/dist/scripts/AsheeThemeScript.js +35 -44
  168. package/dist/shared/radius.d.ts.map +1 -1
  169. package/dist/shared/radius.js +12 -13
  170. package/dist/shared/variant.js +46 -134
  171. package/dist/theme/color.js +28 -28
  172. package/dist/theme/controller.d.ts.map +1 -1
  173. package/dist/theme/controller.js +65 -178
  174. package/dist/theme/useTheme.js +13 -44
  175. package/dist/utils/cn.js +7 -7
  176. package/dist/utils/index.d.ts +1 -0
  177. package/dist/utils/index.d.ts.map +1 -1
  178. package/dist/utils/index.js +1 -0
  179. package/dist/utils/merge-object.js +13 -14
  180. package/dist/utils/resolve-token.js +11 -14
  181. package/dist/utils/stacking.d.ts +76 -0
  182. package/dist/utils/stacking.d.ts.map +1 -0
  183. package/dist/utils/stacking.js +34 -0
  184. package/package.json +12 -11
@@ -1,139 +1,53 @@
1
1
  "use client";
2
- import { jsx as T } from "react/jsx-runtime";
3
- import { forwardRef as q, useRef as V, useImperativeHandle as ee, useId as re, useCallback as E } from "react";
4
- import { useAsheeConfig as se } from "../../libs/context.js";
5
- import { resolveCascade as t, resolveRadiusKey as oe, resolveClassKey as te } from "../../utils/resolve-token.js";
6
- import { FieldShell as ae } from "../field/FieldShell.js";
7
- import { FALLBACK_TEXTAREA_CONFIG as r } from "./textarea-config.js";
8
- import { TEXTAREA_STATUS_BORDER_CLASS as le, TEXTAREA_SIZE_CLASS as de } from "./textarea-styles.js";
9
- import { useKeyboardField as ie } from "../keyboard/use-keyboard-field.js";
10
- import { resolveVariantClass as ne } from "../../shared/variant.js";
11
- import { RADIUS_CLASS as ce } from "../../shared/radius.js";
12
- import { cn as ue } from "../../utils/cn.js";
13
- const me = q(
14
- ({
15
- size: I,
16
- radius: x,
17
- variant: K,
18
- color: _,
19
- status: w,
20
- label: L,
21
- labelAlign: z,
22
- description: u,
23
- message: m,
24
- required: v,
25
- isLoading: f,
26
- rows: B,
27
- id: C,
28
- className: j,
29
- disabled: k,
30
- style: F,
31
- onFocus: a,
32
- onBlur: l,
33
- enableVirtualKeyboard: d = !0,
34
- ...N
35
- }, O) => {
36
- var h;
37
- const i = se(), e = (h = i.components) == null ? void 0 : h.textarea, c = V(null);
38
- ee(O, () => c.current);
39
- const X = re(), o = C ?? X, p = u ? `${o}-description` : void 0, A = m ? `${o}-message` : void 0, D = [p, A].filter(Boolean).join(" ") || void 0, U = !!d, $ = typeof d == "object" && d !== null ? d : void 0, { handleFocus: y, handleBlur: b } = ie(
40
- o,
41
- c,
42
- U,
43
- $
44
- ), G = E(
45
- (s) => {
46
- y(s), a == null || a(s);
47
- },
48
- [y, a]
49
- ), H = E(
50
- (s) => {
51
- b(), l == null || l(s);
52
- },
53
- [b, l]
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 o } from "../field/field-config.js";
4
- const r = {
5
- ...o,
6
- rows: 4
7
- }, n = {
8
- ...t,
9
- rows: 4
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
- export {
13
- n as FALLBACK_TEXTAREA_CONFIG,
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 t } from "../field/field-styles.js";
3
- const A = {
4
- sm: "p-2 text-xs",
5
- md: "p-3 text-sm",
6
- lg: "p-4 text-base"
7
- }, E = t;
8
- export {
9
- A as TEXTAREA_SIZE_CLASS,
10
- E as TEXTAREA_STATUS_BORDER_CLASS
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 o } from "react";
3
- const a = e(null);
4
- function n() {
5
- const t = o(a);
6
- return t || {
7
- toasts: [],
8
- toast: () => "",
9
- success: () => "",
10
- error: () => "",
11
- info: () => "",
12
- warning: () => "",
13
- removeToast: () => {
14
- },
15
- clearToasts: () => {
16
- },
17
- portalTarget: null,
18
- defaultPlacement: "top-right",
19
- defaultSize: "md",
20
- defaultVariant: "bordered",
21
- defaultRadius: "md",
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
- export {
26
- a as ToastContext,
27
- n as useToast
28
- };
23
+ //#endregion
24
+ export { n as ToastContext, r as useToast };
@@ -1,148 +1,86 @@
1
1
  "use client";
2
- import { jsxs as C, jsx as e } from "react/jsx-runtime";
3
- import { useState as G, useCallback as K } from "react";
4
- import { CheckIcon as P } from "../../icons/CheckIcon.js";
5
- import { CloseIcon as W } from "../../icons/CloseIcon.js";
6
- import { ErrorIcon as z } from "../../icons/ErrorIcon.js";
7
- import { InfoIcon as B } from "../../icons/InfoIcon.js";
8
- import { WarningIcon as H } from "../../icons/WarningIcon.js";
9
- import { useAsheeConfig as R } from "../../libs/context.js";
10
- import { resolveCascade as U, resolveClassKey as a } from "../../utils/resolve-token.js";
11
- import { FALLBACK_TOAST_CONFIG as n } from "./toast-config.js";
12
- import { TOAST_WIDTH_CLASS as V, TOAST_PADDING_CLASS as q, TOAST_FONT_CLASS as J, TOAST_TITLE_FONT_CLASS as Q, TOAST_ANIMATION_STATE as X } from "./toast-styles.js";
13
- import { usePausableTimeout as Y } from "./use-pausable-timeout.js";
14
- import { RADIUS_CLASS as Z } from "../../shared/radius.js";
15
- import { cn as t } from "../../utils/cn.js";
16
- import { resolveVariantClass as $ } from "../../shared/variant.js";
17
- function ee(r = "info") {
18
- switch (r) {
19
- case "success":
20
- return "success";
21
- case "error":
22
- return "danger";
23
- case "warning":
24
- return "warning";
25
- case "info":
26
- return "primary";
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 re(r = "info", s = !1) {
32
- const o = t("w-5 h-5", s && "text-current");
33
- switch (r) {
34
- case "success":
35
- return /* @__PURE__ */ e(P, { className: t(o, !s && "text-success") });
36
- case "error":
37
- return /* @__PURE__ */ e(z, { className: t(o, !s && "text-danger") });
38
- case "warning":
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 se({
45
- id: r,
46
- title: s,
47
- message: o,
48
- type: u = "info",
49
- timeout: v = 3500,
50
- icon: A,
51
- action: d,
52
- dismissible: N = !0,
53
- onDismiss: c,
54
- placement: x,
55
- size: i,
56
- variant: f,
57
- color: b,
58
- radius: I,
59
- animated: p
60
- }) {
61
- var h;
62
- const l = (h = R().components) == null ? void 0 : h.toast, [m, S] = G(!1), g = U(
63
- p,
64
- l == null ? void 0 : l.animated,
65
- void 0,
66
- n.animated
67
- ), w = K(() => {
68
- g && !m ? (S(!0), setTimeout(() => {
69
- c(r);
70
- }, 150)) : c(r);
71
- }, [g, m, c, r]), { pause: _, resume: k } = Y(w, v), O = b ?? ee(u), y = f === "solid", L = a(
72
- i,
73
- V,
74
- n.size
75
- ), E = a(
76
- i,
77
- q,
78
- n.size
79
- ), F = a(
80
- i,
81
- J,
82
- n.size
83
- ), D = a(
84
- i,
85
- Q,
86
- n.size
87
- ), M = a(
88
- I,
89
- Z,
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
- se.displayName = "ToastItem";
146
- export {
147
- se as ToastItem
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;AAOvE,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,+BA+QpB"}
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"}