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.
Files changed (266) hide show
  1. package/dist/AsheeUIProvider.d.ts.map +1 -1
  2. package/dist/AsheeUIProvider.js +22 -15
  3. package/dist/components/accordion/Accordion.d.ts.map +1 -1
  4. package/dist/components/accordion/Accordion.js +9 -7
  5. package/dist/components/alert/Alert.d.ts +88 -0
  6. package/dist/components/alert/Alert.d.ts.map +1 -0
  7. package/dist/components/alert/Alert.js +61 -0
  8. package/dist/components/alert/alert-config.d.ts +56 -0
  9. package/dist/components/alert/alert-config.d.ts.map +1 -0
  10. package/dist/components/alert/alert-config.js +14 -0
  11. package/dist/components/alert/alert-styles.d.ts +32 -0
  12. package/dist/components/alert/alert-styles.d.ts.map +1 -0
  13. package/dist/components/alert/alert-styles.js +20 -0
  14. package/dist/components/alert/index.d.ts +3 -0
  15. package/dist/components/alert/index.d.ts.map +1 -0
  16. package/dist/components/alert/index.js +3 -0
  17. package/dist/components/autocomplete/Autocomplete.d.ts +6 -6
  18. package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
  19. package/dist/components/autocomplete/Autocomplete.js +94 -58
  20. package/dist/components/autocomplete/autocomplete-config.d.ts +1 -1
  21. package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
  22. package/dist/components/avatar/Avatar.d.ts +87 -0
  23. package/dist/components/avatar/Avatar.d.ts.map +1 -0
  24. package/dist/components/avatar/Avatar.js +43 -0
  25. package/dist/components/avatar/avatar-config.d.ts +48 -0
  26. package/dist/components/avatar/avatar-config.d.ts.map +1 -0
  27. package/dist/components/avatar/avatar-config.js +14 -0
  28. package/dist/components/avatar/avatar-styles.d.ts +21 -0
  29. package/dist/components/avatar/avatar-styles.d.ts.map +1 -0
  30. package/dist/components/avatar/avatar-styles.js +13 -0
  31. package/dist/components/avatar/avatar.helpers.d.ts +19 -0
  32. package/dist/components/avatar/avatar.helpers.d.ts.map +1 -0
  33. package/dist/components/avatar/avatar.helpers.js +11 -0
  34. package/dist/components/avatar/index.d.ts +3 -0
  35. package/dist/components/avatar/index.d.ts.map +1 -0
  36. package/dist/components/avatar/index.js +4 -0
  37. package/dist/components/badge/Badge.d.ts +69 -0
  38. package/dist/components/badge/Badge.d.ts.map +1 -0
  39. package/dist/components/badge/Badge.js +39 -0
  40. package/dist/components/badge/badge-config.d.ts +63 -0
  41. package/dist/components/badge/badge-config.d.ts.map +1 -0
  42. package/dist/components/badge/badge-config.js +15 -0
  43. package/dist/components/badge/badge-styles.d.ts +27 -0
  44. package/dist/components/badge/badge-styles.d.ts.map +1 -0
  45. package/dist/components/badge/badge-styles.js +25 -0
  46. package/dist/components/badge/index.d.ts +3 -0
  47. package/dist/components/badge/index.d.ts.map +1 -0
  48. package/dist/components/badge/index.js +3 -0
  49. package/dist/components/breadcrumb/Breadcrumb.d.ts +106 -0
  50. package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -0
  51. package/dist/components/breadcrumb/Breadcrumb.js +52 -0
  52. package/dist/components/breadcrumb/breadcrumb-config.d.ts +41 -0
  53. package/dist/components/breadcrumb/breadcrumb-config.d.ts.map +1 -0
  54. package/dist/components/breadcrumb/breadcrumb-config.js +10 -0
  55. package/dist/components/breadcrumb/breadcrumb-styles.d.ts +28 -0
  56. package/dist/components/breadcrumb/breadcrumb-styles.d.ts.map +1 -0
  57. package/dist/components/breadcrumb/breadcrumb-styles.js +17 -0
  58. package/dist/components/breadcrumb/index.d.ts +3 -0
  59. package/dist/components/breadcrumb/index.d.ts.map +1 -0
  60. package/dist/components/breadcrumb/index.js +3 -0
  61. package/dist/components/button/Button.d.ts.map +1 -1
  62. package/dist/components/button/Button.js +10 -7
  63. package/dist/components/{date-picker/DatePicker.d.ts → calendar/Calendar.d.ts} +21 -21
  64. package/dist/components/calendar/Calendar.d.ts.map +1 -0
  65. package/dist/components/{date-picker/DatePicker.js → calendar/Calendar.js} +11 -11
  66. package/dist/components/{date-picker/Calendar.d.ts → calendar/DateGrid.d.ts} +7 -7
  67. package/dist/components/calendar/DateGrid.d.ts.map +1 -0
  68. package/dist/components/calendar/DateGrid.js +194 -0
  69. package/dist/components/calendar/TimeSpinner.d.ts.map +1 -0
  70. package/dist/components/{date-picker → calendar}/TimeSpinner.js +3 -3
  71. package/dist/components/{date-picker/date-picker-config.d.ts → calendar/calendar-config.d.ts} +17 -17
  72. package/dist/components/calendar/calendar-config.d.ts.map +1 -0
  73. package/dist/components/{date-picker/date-picker-config.js → calendar/calendar-config.js} +3 -3
  74. package/dist/components/{date-picker/date-picker-styles.d.ts → calendar/calendar-styles.d.ts} +1 -1
  75. package/dist/components/calendar/calendar-styles.d.ts.map +1 -0
  76. package/dist/components/{date-picker/date-picker-styles.js → calendar/calendar-styles.js} +1 -1
  77. package/dist/components/{date-picker/date-picker.helpers.d.ts → calendar/calendar.helpers.d.ts} +9 -9
  78. package/dist/components/calendar/calendar.helpers.d.ts.map +1 -0
  79. package/dist/components/{date-picker/date-picker.helpers.js → calendar/calendar.helpers.js} +4 -4
  80. package/dist/components/calendar/index.d.ts +3 -0
  81. package/dist/components/calendar/index.d.ts.map +1 -0
  82. package/dist/components/calendar/index.js +6 -0
  83. package/dist/components/card/Card.d.ts +6 -6
  84. package/dist/components/card/Card.d.ts.map +1 -1
  85. package/dist/components/card/Card.js +8 -8
  86. package/dist/components/carousel/Carousel.d.ts.map +1 -1
  87. package/dist/components/carousel/Carousel.js +85 -83
  88. package/dist/components/carousel/carousel-styles.d.ts +1 -20
  89. package/dist/components/carousel/carousel-styles.d.ts.map +1 -1
  90. package/dist/components/chip/Chip.js +5 -5
  91. package/dist/components/drawer/Drawer.d.ts +8 -4
  92. package/dist/components/drawer/Drawer.d.ts.map +1 -1
  93. package/dist/components/drawer/Drawer.js +54 -38
  94. package/dist/components/{select/Select.d.ts → dropmenu/Dropmenu.d.ts} +21 -21
  95. package/dist/components/{select/Select.d.ts.map → dropmenu/Dropmenu.d.ts.map} +1 -1
  96. package/dist/components/dropmenu/Dropmenu.js +102 -0
  97. package/dist/components/{select/select-config.d.ts → dropmenu/dropmenu-config.d.ts} +8 -8
  98. package/dist/components/dropmenu/dropmenu-config.d.ts.map +1 -0
  99. package/dist/components/{select/select-config.js → dropmenu/dropmenu-config.js} +3 -3
  100. package/dist/components/{select/select-styles.d.ts → dropmenu/dropmenu-styles.d.ts} +1 -1
  101. package/dist/components/dropmenu/dropmenu-styles.d.ts.map +1 -0
  102. package/dist/components/{select/select-styles.js → dropmenu/dropmenu-styles.js} +1 -1
  103. package/dist/components/dropmenu/index.d.ts +3 -0
  104. package/dist/components/dropmenu/index.d.ts.map +1 -0
  105. package/dist/components/dropmenu/index.js +3 -0
  106. package/dist/components/field/FieldShell.d.ts +13 -1
  107. package/dist/components/field/FieldShell.d.ts.map +1 -1
  108. package/dist/components/field/FieldShell.js +16 -15
  109. package/dist/components/form/Form.d.ts +109 -0
  110. package/dist/components/form/Form.d.ts.map +1 -0
  111. package/dist/components/form/Form.js +42 -0
  112. package/dist/components/form/form-config.d.ts +57 -0
  113. package/dist/components/form/form-config.d.ts.map +1 -0
  114. package/dist/components/form/form-config.js +12 -0
  115. package/dist/components/form/form-styles.d.ts +27 -0
  116. package/dist/components/form/form-styles.d.ts.map +1 -0
  117. package/dist/components/form/form-styles.js +5 -0
  118. package/dist/components/form/index.d.ts +3 -0
  119. package/dist/components/form/index.d.ts.map +1 -0
  120. package/dist/components/form/index.js +3 -0
  121. package/dist/components/image/Image.d.ts +4 -5
  122. package/dist/components/image/Image.d.ts.map +1 -1
  123. package/dist/components/image/Image.js +5 -5
  124. package/dist/components/input/Input.js +5 -5
  125. package/dist/components/link/Link.d.ts +12 -10
  126. package/dist/components/link/Link.d.ts.map +1 -1
  127. package/dist/components/link/Link.js +1 -1
  128. package/dist/components/marquee/Marquee.d.ts.map +1 -1
  129. package/dist/components/marquee/Marquee.js +36 -33
  130. package/dist/components/{select-menu/SelectMenu.d.ts → menu/Menu.d.ts} +52 -19
  131. package/dist/components/menu/Menu.d.ts.map +1 -0
  132. package/dist/components/menu/Menu.js +161 -0
  133. package/dist/components/menu/index.d.ts +5 -0
  134. package/dist/components/menu/index.d.ts.map +1 -0
  135. package/dist/components/menu/index.js +4 -0
  136. package/dist/components/{select-menu/select-menu-config.d.ts → menu/menu-config.d.ts} +5 -5
  137. package/dist/components/menu/menu-config.d.ts.map +1 -0
  138. package/dist/components/{select-menu/select-menu-config.js → menu/menu-config.js} +2 -2
  139. package/dist/components/menu/menu-navigation.d.ts +38 -0
  140. package/dist/components/menu/menu-navigation.d.ts.map +1 -0
  141. package/dist/components/menu/menu-navigation.js +20 -0
  142. package/dist/components/{select-menu/use-select-floating.d.ts → menu/use-menu-floating.d.ts} +10 -10
  143. package/dist/components/menu/use-menu-floating.d.ts.map +1 -0
  144. package/dist/components/{select-menu/use-select-floating.js → menu/use-menu-floating.js} +2 -2
  145. package/dist/components/modal/Modal.d.ts +6 -1
  146. package/dist/components/modal/Modal.d.ts.map +1 -1
  147. package/dist/components/modal/Modal.js +62 -45
  148. package/dist/components/multi-select/MultiSelect.d.ts +11 -10
  149. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  150. package/dist/components/multi-select/MultiSelect.js +99 -86
  151. package/dist/components/multi-select/multi-select-config.d.ts +1 -1
  152. package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
  153. package/dist/components/pagination/Pagination.d.ts +91 -0
  154. package/dist/components/pagination/Pagination.d.ts.map +1 -0
  155. package/dist/components/pagination/Pagination.js +66 -0
  156. package/dist/components/pagination/index.d.ts +3 -0
  157. package/dist/components/pagination/index.d.ts.map +1 -0
  158. package/dist/components/pagination/index.js +4 -0
  159. package/dist/components/pagination/pagination-config.d.ts +66 -0
  160. package/dist/components/pagination/pagination-config.d.ts.map +1 -0
  161. package/dist/components/pagination/pagination-config.js +19 -0
  162. package/dist/components/pagination/pagination-styles.d.ts +19 -0
  163. package/dist/components/pagination/pagination-styles.d.ts.map +1 -0
  164. package/dist/components/pagination/pagination-styles.js +5 -0
  165. package/dist/components/pagination/pagination.helpers.d.ts +26 -0
  166. package/dist/components/pagination/pagination.helpers.d.ts.map +1 -0
  167. package/dist/components/pagination/pagination.helpers.js +12 -0
  168. package/dist/components/radio/Radio.d.ts +53 -107
  169. package/dist/components/radio/Radio.d.ts.map +1 -1
  170. package/dist/components/radio/Radio.js +50 -36
  171. package/dist/components/radio/RadioGroup.d.ts +107 -53
  172. package/dist/components/radio/RadioGroup.d.ts.map +1 -1
  173. package/dist/components/radio/RadioGroup.js +43 -49
  174. package/dist/components/radio/index.d.ts +0 -1
  175. package/dist/components/radio/index.d.ts.map +1 -1
  176. package/dist/components/resizable-screen/ResizableScreen.d.ts +4 -4
  177. package/dist/components/scrollbar/index.js +1 -0
  178. package/dist/components/scrollbar/scrollbar-config.js +13 -0
  179. package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
  180. package/dist/components/sidebar/Sidebar.js +92 -90
  181. package/dist/components/skeleton/Skeleton.d.ts +65 -0
  182. package/dist/components/skeleton/Skeleton.d.ts.map +1 -0
  183. package/dist/components/skeleton/Skeleton.js +29 -0
  184. package/dist/components/skeleton/index.d.ts +3 -0
  185. package/dist/components/skeleton/index.d.ts.map +1 -0
  186. package/dist/components/skeleton/index.js +3 -0
  187. package/dist/components/skeleton/skeleton-config.d.ts +40 -0
  188. package/dist/components/skeleton/skeleton-config.d.ts.map +1 -0
  189. package/dist/components/skeleton/skeleton-config.js +13 -0
  190. package/dist/components/skeleton/skeleton-styles.d.ts +19 -0
  191. package/dist/components/skeleton/skeleton-styles.d.ts.map +1 -0
  192. package/dist/components/skeleton/skeleton-styles.js +5 -0
  193. package/dist/components/switch/Switch.d.ts.map +1 -1
  194. package/dist/components/switch/Switch.js +7 -5
  195. package/dist/components/table/Table.js +3 -3
  196. package/dist/components/tabs/Tabs.js +3 -3
  197. package/dist/components/textarea/Textarea.d.ts +10 -10
  198. package/dist/components/textarea/Textarea.js +7 -7
  199. package/dist/components/textarea/textarea-config.d.ts +2 -2
  200. package/dist/components/toast/ToastItem.d.ts.map +1 -1
  201. package/dist/components/toast/ToastItem.js +8 -7
  202. package/dist/components/tooltip/Tooltip.js +5 -5
  203. package/dist/components/typography/Typography.d.ts +60 -0
  204. package/dist/components/typography/Typography.d.ts.map +1 -0
  205. package/dist/components/typography/Typography.js +28 -0
  206. package/dist/components/typography/index.d.ts +3 -0
  207. package/dist/components/typography/index.d.ts.map +1 -0
  208. package/dist/components/typography/index.js +3 -0
  209. package/dist/components/typography/typography-config.d.ts +54 -0
  210. package/dist/components/typography/typography-config.d.ts.map +1 -0
  211. package/dist/components/typography/typography-config.js +12 -0
  212. package/dist/components/typography/typography-styles.d.ts +21 -0
  213. package/dist/components/typography/typography-styles.d.ts.map +1 -0
  214. package/dist/components/typography/typography-styles.js +19 -0
  215. package/dist/config/default-config.d.ts.map +1 -1
  216. package/dist/config/default-config.js +2 -2
  217. package/dist/config/index.js +1 -0
  218. package/dist/config/validate-config.d.ts +34 -0
  219. package/dist/config/validate-config.d.ts.map +1 -0
  220. package/dist/config/validate-config.js +190 -0
  221. package/dist/index.d.ts +15 -17
  222. package/dist/index.d.ts.map +1 -1
  223. package/dist/index.js +61 -47
  224. package/dist/libs/index.js +3 -0
  225. package/dist/libs/use-body-scroll-lock.d.ts +21 -0
  226. package/dist/libs/use-body-scroll-lock.d.ts.map +1 -0
  227. package/dist/libs/use-body-scroll-lock.js +27 -0
  228. package/dist/libs/use-dialog-overlay.d.ts +21 -0
  229. package/dist/libs/use-dialog-overlay.d.ts.map +1 -0
  230. package/dist/libs/use-dialog-overlay.js +21 -0
  231. package/dist/libs/use-prefers-reduced-motion.d.ts +23 -0
  232. package/dist/libs/use-prefers-reduced-motion.d.ts.map +1 -0
  233. package/dist/libs/use-prefers-reduced-motion.js +19 -0
  234. package/dist/scripts/AsheeThemeScript.js +43 -8
  235. package/dist/shared/index.d.ts +1 -0
  236. package/dist/shared/index.d.ts.map +1 -1
  237. package/dist/shared/typography.d.ts +81 -0
  238. package/dist/shared/typography.d.ts.map +1 -0
  239. package/dist/shared/typography.js +137 -0
  240. package/dist/utils/stacking.d.ts +2 -2
  241. package/dist/utils/stacking.d.ts.map +1 -1
  242. package/package.json +13 -6
  243. package/dist/components/date-picker/Calendar.d.ts.map +0 -1
  244. package/dist/components/date-picker/Calendar.js +0 -143
  245. package/dist/components/date-picker/DatePicker.d.ts.map +0 -1
  246. package/dist/components/date-picker/TimeSpinner.d.ts.map +0 -1
  247. package/dist/components/date-picker/date-picker-config.d.ts.map +0 -1
  248. package/dist/components/date-picker/date-picker-styles.d.ts.map +0 -1
  249. package/dist/components/date-picker/date-picker.helpers.d.ts.map +0 -1
  250. package/dist/components/date-picker/index.d.ts +0 -3
  251. package/dist/components/date-picker/index.d.ts.map +0 -1
  252. package/dist/components/date-picker/index.js +0 -6
  253. package/dist/components/select/Select.js +0 -98
  254. package/dist/components/select/index.d.ts +0 -3
  255. package/dist/components/select/index.d.ts.map +0 -1
  256. package/dist/components/select/index.js +0 -3
  257. package/dist/components/select/select-config.d.ts.map +0 -1
  258. package/dist/components/select/select-styles.d.ts.map +0 -1
  259. package/dist/components/select-menu/SelectMenu.d.ts.map +0 -1
  260. package/dist/components/select-menu/SelectMenu.js +0 -104
  261. package/dist/components/select-menu/index.d.ts +0 -4
  262. package/dist/components/select-menu/index.d.ts.map +0 -1
  263. package/dist/components/select-menu/index.js +0 -3
  264. package/dist/components/select-menu/select-menu-config.d.ts.map +0 -1
  265. package/dist/components/select-menu/use-select-floating.d.ts.map +0 -1
  266. /package/dist/components/{date-picker → calendar}/TimeSpinner.d.ts +0 -0
@@ -3,77 +3,113 @@
3
3
  import { useAsheeConfig as e } from "../../libs/context.js";
4
4
  import { resolveCascade as t, resolveRadiusKey as n } from "../../utils/resolve-token.js";
5
5
  import { Input as r } from "../input/Input.js";
6
- import { SelectMenu as i } from "../select-menu/SelectMenu.js";
7
- import { useSelectFloating as a } from "../select-menu/use-select-floating.js";
8
- import { FALLBACK_AUTOCOMPLETE_CONFIG as o } from "./autocomplete-config.js";
9
- import { forwardRef as s, useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
10
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
11
- import { useDismiss as m, useFocus as h, useInteractions as g, useRole as _ } from "@floating-ui/react";
6
+ import { edgeOptionIndex as i, nextOptionIndex as a } from "../menu/menu-navigation.js";
7
+ import { Menu as o, menuOptionId as s } from "../menu/Menu.js";
8
+ import { useMenuFloating as c } from "../menu/use-menu-floating.js";
9
+ import { FALLBACK_AUTOCOMPLETE_CONFIG as l } from "./autocomplete-config.js";
10
+ import { forwardRef as u, useCallback as d, useEffect as f, useMemo as p, useState as m } from "react";
11
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
12
+ import { useDismiss as _, useFocus as ee, useInteractions as v, useRole as y } from "@floating-ui/react";
12
13
  //#region src/components/autocomplete/Autocomplete.tsx
13
- var v = s(({ options: s = [], value: v, onValueChange: y, onInputChange: b, allowCustomValue: x = !1, belowList: S, menu: C, variant: w, color: T, radius: E, size: D, endContent: O, onClick: k, disabled: A, placeholder: j = "Type to search...", className: M, ...N }, P) => {
14
- let F = e(), I = F.components?.autocomplete, L = t(w, I?.variant, F.defaultVariant, o.variant), R = t(T, I?.color, F.defaultColor, o.color), z = n(E, I?.radius, F.defaultRadius, o.radius), ee = t(D, I?.size, void 0, o.size), B = u(() => s.find((e) => e.value === v), [s, v]), [V, H] = d(!1), [U, W] = d(() => B ? B.label : String(v ?? ""));
15
- l(() => {
16
- B ? W(B.label) : v != null && W(String(v));
17
- }, [B, v]);
18
- let { refs: G, context: K, isPositioned: q, floatingStyles: J } = a({
19
- isOpen: V,
20
- onOpenChange: H,
21
- disabled: A
22
- }), Y = h(K), X = m(K), Z = _(K, { role: "combobox" }), { getReferenceProps: Q, getFloatingProps: $ } = g([
23
- Y,
24
- X,
25
- Z
26
- ]), te = u(() => U.trim() ? s.filter((e) => e.label.toLowerCase().includes(U.toLowerCase())) : s, [s, U]), ne = c((e) => {
14
+ var b = u(({ options: u = [], value: b, onValueChange: x, onInputChange: S, allowCustomValue: C = !1, belowList: w, menu: T, variant: te, color: ne, radius: E, size: D, endContent: O, onClick: k, onKeyDown: A, disabled: j, placeholder: M = "Type to search...", className: N, ...P }, F) => {
15
+ let I = e(), L = I.components?.autocomplete, R = t(te, L?.variant, I.defaultVariant, l.variant), z = t(ne, L?.color, I.defaultColor, l.color), B = n(E, L?.radius, I.defaultRadius, l.radius), V = t(D, L?.size, void 0, l.size), H = p(() => u.find((e) => e.value === b), [u, b]), [U, W] = m(!1), [G, K] = m(() => H ? H.label : String(b ?? "")), [q, J] = m(null);
16
+ f(() => {
17
+ H ? K(H.label) : b != null && K(String(b));
18
+ }, [H, b]);
19
+ let { refs: Y, context: X, isPositioned: Z, floatingStyles: re } = c({
20
+ isOpen: U,
21
+ onOpenChange: W,
22
+ disabled: j
23
+ }), ie = ee(X), ae = _(X), oe = y(X, { role: "combobox" }), { getReferenceProps: se, getFloatingProps: ce } = v([
24
+ ie,
25
+ ae,
26
+ oe
27
+ ]), Q = p(() => G.trim() ? u.filter((e) => e.label.toLowerCase().includes(G.toLowerCase())) : u, [u, G]), le = d((e) => {
27
28
  let t = e.target.value;
28
- W(t), b?.(t), H(!0), x && y?.(t);
29
+ K(t), S?.(t), W(!0), J(null), C && x?.(t);
29
30
  }, [
30
- x,
31
- b,
32
- y
33
- ]), re = c((e) => {
34
- W(e.label), y?.(e.value, e), H(!1);
35
- }, [y]), ie = u(() => v == null ? [] : [v], [v]);
36
- return /* @__PURE__ */ p("div", {
31
+ C,
32
+ S,
33
+ x
34
+ ]), $ = d((e) => {
35
+ K(e.label), x?.(e.value, e), W(!1), J(null);
36
+ }, [x]), ue = d((e) => {
37
+ if (A?.(e), e.defaultPrevented || j) return;
38
+ let t = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
39
+ if (t !== 0) {
40
+ if (e.preventDefault(), !U) {
41
+ W(!0);
42
+ return;
43
+ }
44
+ J((e) => a(Q, e, t));
45
+ return;
46
+ }
47
+ if (e.key === "Home" || e.key === "End") {
48
+ if (!U) return;
49
+ e.preventDefault(), J(i(Q, e.key === "Home" ? "first" : "last"));
50
+ return;
51
+ }
52
+ if (e.key === "Enter" && U) {
53
+ let t = q === null ? void 0 : Q[q];
54
+ t && !t.disabled && (e.preventDefault(), $(t));
55
+ return;
56
+ }
57
+ e.key === "Escape" && U && (W(!1), J(null));
58
+ }, [
59
+ q,
60
+ A,
61
+ j,
62
+ Q,
63
+ $,
64
+ U
65
+ ]), de = q === null ? void 0 : s(X.floatingId, q), fe = se({
66
+ ...P,
67
+ onKeyDown: ue
68
+ }), pe = p(() => b == null ? [] : [b], [b]);
69
+ return /* @__PURE__ */ g("div", {
37
70
  className: "w-full relative inline-block",
38
- children: [/* @__PURE__ */ f(r, {
71
+ children: [/* @__PURE__ */ h(r, {
39
72
  ref: (e) => {
40
- G.setReference(e), typeof P == "function" ? P(e) : P && (P.current = e);
73
+ Y.setReference(e), typeof F == "function" ? F(e) : F && (F.current = e);
41
74
  },
42
- variant: L,
43
- radius: z,
44
- color: R,
45
- size: ee,
46
- disabled: A,
47
- placeholder: j,
48
- value: U,
49
- onChange: ne,
75
+ variant: R,
76
+ radius: B,
77
+ color: z,
78
+ size: V,
79
+ disabled: j,
80
+ placeholder: M,
81
+ value: G,
82
+ onChange: le,
50
83
  onClick: (e) => {
51
- A || H(!0), k?.(e);
84
+ j || W(!0), k?.(e);
52
85
  },
53
- "aria-expanded": V,
54
- "aria-autocomplete": "none",
86
+ "aria-expanded": U,
87
+ "aria-autocomplete": "list",
88
+ "aria-activedescendant": de,
55
89
  endContent: O,
56
- className: M,
57
- ...Q(N)
58
- }), /* @__PURE__ */ f(i, {
59
- isOpen: V,
60
- floatingStyles: J,
61
- context: K,
62
- getFloatingProps: $,
63
- setFloatingRef: G.setFloating,
64
- isPositioned: q,
65
- options: te,
66
- selectedValues: ie,
67
- onSelectMenuOption: re,
90
+ className: N,
91
+ ...fe
92
+ }), /* @__PURE__ */ h(o, {
93
+ isOpen: U,
94
+ floatingStyles: re,
95
+ context: X,
96
+ getFloatingProps: ce,
97
+ setFloatingRef: Y.setFloating,
98
+ isPositioned: Z,
99
+ activeIndex: q,
100
+ onActiveIndexChange: J,
101
+ options: Q,
102
+ selectedValues: pe,
103
+ onOptionSelect: $,
68
104
  isSearch: !1,
69
- belowList: S,
70
- menuProps: C,
71
- menuConfig: I?.menu,
105
+ belowList: w,
106
+ menuProps: T,
107
+ menuConfig: L?.menu,
72
108
  initialFocus: -1,
73
109
  returnFocus: !1
74
110
  })]
75
111
  });
76
112
  });
77
- v.displayName = "Autocomplete";
113
+ b.displayName = "Autocomplete";
78
114
  //#endregion
79
- export { v as Autocomplete };
115
+ export { b as Autocomplete };
@@ -1,5 +1,5 @@
1
1
  import { InputConfig } from '../input';
2
- import { MenuConfig } from '../select-menu';
2
+ import { MenuConfig } from '../menu';
3
3
  /**
4
4
  * Theme configuration options for the Autocomplete component.
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-config.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAEvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;CAE/B,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,YAAY,EAAE,kBAAkB,CAAC;KAClC;CACF"}
1
+ {"version":3,"file":"autocomplete-config.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAEvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;CAE/B,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,YAAY,EAAE,kBAAkB,CAAC;KAClC;CACF"}
@@ -0,0 +1,87 @@
1
+ import { ElementType, HTMLAttributes, ReactNode } from 'react';
2
+ import { AvatarConfig } from './avatar-config';
3
+ type BaseAvatarProps = AvatarConfig & Omit<HTMLAttributes<HTMLDivElement>, "color" | "children">;
4
+ /**
5
+ * Configuration options for the Avatar component.
6
+ */
7
+ export interface AvatarProps extends BaseAvatarProps {
8
+ /**
9
+ * Name of the represented entity.
10
+ * Supplies the initials the avatar falls back to and, unless `alt` overrides
11
+ * it, the name assistive technology reads.
12
+ */
13
+ name?: string;
14
+ /**
15
+ * Picture of the represented entity.
16
+ * When it is missing or fails to load, the avatar shows its fallback.
17
+ */
18
+ src?: string;
19
+ /**
20
+ * Name assistive technology reads, instead of `name`.
21
+ * Use it when the entity's name is not the wording the avatar should carry.
22
+ */
23
+ alt?: string;
24
+ /**
25
+ * Component that replaces the picture inside the avatar, passed to
26
+ * {@link Image}. This is how a consumer keeps a framework image working
27
+ * inside an avatar.
28
+ */
29
+ component?: ElementType;
30
+ /**
31
+ * Additional props for that component, passed to {@link Image}.
32
+ */
33
+ componentProps?: Record<string, unknown>;
34
+ /**
35
+ * Content shown in place of the initials when there is no picture.
36
+ */
37
+ fallback?: ReactNode;
38
+ }
39
+ /**
40
+ * An entity representation with an initials fallback.
41
+ *
42
+ * Avatar shows the picture of a person or an entity, and falls back to that
43
+ * entity's initials when there is no picture or the picture fails to load. The
44
+ * fallback sits on the accent surface of the resolved colour, and the picture
45
+ * is rendered through the framework's {@link Image} primitive, so a consumer
46
+ * keeps its own image component by passing `component`.
47
+ *
48
+ * The avatar carries the entity's name as a single image role with a label, so
49
+ * assistive technology reads one name instead of the initials and the picture
50
+ * separately. With neither a name nor an alternative given, the avatar is
51
+ * decoration and is hidden from assistive technology: that is the right
52
+ * behaviour for a purely decorative picture beside text that already names the
53
+ * entity.
54
+ *
55
+ * Diameter, radius and colour resolve through the standard AsheeUI cascade:
56
+ * prop, component config, global theme defaults, and the built-in fallback.
57
+ *
58
+ * @param props - Avatar configuration options and div attributes.
59
+ * @param props.name - The represented entity's name.
60
+ * @param props.src - The picture's source.
61
+ * @param props.alt - Name for assistive technology, instead of `name`.
62
+ * @param props.component - Custom image component, passed to `Image`.
63
+ * @param props.componentProps - Additional props for that component.
64
+ * @param props.fallback - Content shown when there is no picture.
65
+ * @param props.size - Diameter scale. Defaults to "md".
66
+ * @param props.radius - Corner rounding. Defaults to "full".
67
+ * @param props.color - Accent colour of the fallback surface.
68
+ * @param props.className - Extra classes applied last, which is where a
69
+ * consumer overrides the diameter.
70
+ *
71
+ * @example
72
+ * ```tsx
73
+ * <Avatar name="Ada Lovelace" src="/ada.png" />
74
+ * ```
75
+ *
76
+ * @example
77
+ * ```tsx
78
+ * // No picture: the initials carry the identity.
79
+ * <Avatar name="Ada Lovelace" size="lg" />
80
+ * ```
81
+ *
82
+ * @see AvatarConfig - The configuration type for component defaults.
83
+ * @see Image - The framework's image primitive.
84
+ */
85
+ export declare const Avatar: import('react').ForwardRefExoticComponent<AvatarProps & import('react').RefAttributes<HTMLDivElement>>;
86
+ export {};
87
+ //# sourceMappingURL=Avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/Avatar.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,cAAc,EACnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAOf,OAAO,EACL,KAAK,YAAY,EAElB,MAAM,iBAAiB,CAAC;AASzB,KAAK,eAAe,GAAG,YAAY,GACjC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,MAAM,wGAsGlB,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ "use client";
3
+ import { cn as e } from "../../utils/cn.js";
4
+ import { RADIUS_CLASS as t } from "../../shared/radius.js";
5
+ import { resolveVariantClass as n } from "../../shared/variant.js";
6
+ import { useAsheeConfig as r } from "../../libs/context.js";
7
+ import { resolveCascade as i, resolveClassKey as a } from "../../utils/resolve-token.js";
8
+ import { Image as o } from "../image/Image.js";
9
+ import { FALLBACK_AVATAR_CONFIG as s } from "./avatar-config.js";
10
+ import { AVATAR_BASE_CLASS as c, AVATAR_FALLBACK_VARIANT as l, AVATAR_FONT_CLASS as u, AVATAR_SIZE_CLASS as d } from "./avatar-styles.js";
11
+ import { getInitials as f } from "./avatar.helpers.js";
12
+ import { forwardRef as p, useState as m } from "react";
13
+ import { jsx as h } from "react/jsx-runtime";
14
+ //#region src/components/avatar/Avatar.tsx
15
+ var g = p(({ name: p, src: g, alt: _, component: v, componentProps: y, fallback: b, size: x, radius: S, color: C, className: w, ...T }, E) => {
16
+ let D = r(), O = D.components?.avatar, [k, A] = m(!1), j = i(x, O?.size, void 0, s.size), M = i(S, O?.radius, D.defaultRadius, s.radius), N = i(C, O?.color, D.defaultColor, s.color), P = a(j, d, s.size), F = a(j, u, s.size), I = a(M, t, s.radius), L = _ ?? p, R = !!g && !k;
17
+ return /* @__PURE__ */ h("div", {
18
+ ref: E,
19
+ role: "img",
20
+ "aria-label": L,
21
+ "aria-hidden": !L || void 0,
22
+ className: e(c, P, I, w),
23
+ ...T,
24
+ children: R ? /* @__PURE__ */ h(o, {
25
+ src: g,
26
+ alt: "",
27
+ component: v,
28
+ componentProps: y,
29
+ fit: "cover",
30
+ radius: M,
31
+ showSkeleton: !1,
32
+ onError: () => A(!0),
33
+ className: "size-full"
34
+ }) : /* @__PURE__ */ h("span", {
35
+ "aria-hidden": "true",
36
+ className: e("inline-flex items-center justify-center size-full", F, n(l, N)),
37
+ children: b ?? f(p ?? "")
38
+ })
39
+ });
40
+ });
41
+ g.displayName = "Avatar";
42
+ //#endregion
43
+ export { g as Avatar };
@@ -0,0 +1,48 @@
1
+ import { Color, Radius, Size } from '../../shared';
2
+ /**
3
+ * Theme configuration options for the Avatar component.
4
+ *
5
+ * Set under `components.avatar` in the AsheeUI config. Values feed the
6
+ * component-level fallback tier of the theme cascade.
7
+ */
8
+ export interface AvatarConfig {
9
+ /**
10
+ * Diameter scale of the avatar.
11
+ *
12
+ * @default "md"
13
+ */
14
+ size?: Size;
15
+ /**
16
+ * Corner rounding.
17
+ * The default makes a circular avatar; a smaller radius makes it square.
18
+ *
19
+ * @default "full"
20
+ */
21
+ radius?: Radius;
22
+ /**
23
+ * Theme accent colour.
24
+ * Colours the surface the initials fall back to. It does not tint the image.
25
+ *
26
+ * @default "primary"
27
+ */
28
+ color?: Color;
29
+ }
30
+ /**
31
+ * Default config values registered for the Avatar component.
32
+ *
33
+ * `color` is intentionally absent so it inherits from the global
34
+ * `defaultColor`.
35
+ */
36
+ export declare const defaultAvatarConfig: AvatarConfig;
37
+ /**
38
+ * Hard fallback values used when no config tier provides a value.
39
+ * These values are used when instance props, component config,
40
+ * and global defaults are all undefined.
41
+ */
42
+ export declare const FALLBACK_AVATAR_CONFIG: Required<AvatarConfig>;
43
+ declare module "../../libs/registry" {
44
+ interface ComponentTypeConfigRegistry {
45
+ avatar: AvatarConfig;
46
+ }
47
+ }
48
+ //# sourceMappingURL=avatar-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar-config.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/avatar-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,YAGjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,YAAY,CAIhD,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,MAAM,EAAE,YAAY,CAAC;KACtB;CACF"}
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { registerComponentDefaults as e } from "../../libs/registry.js";
3
+ //#region src/components/avatar/avatar-config.ts
4
+ var t = {
5
+ size: "md",
6
+ radius: "full"
7
+ }, n = {
8
+ size: "md",
9
+ radius: "full",
10
+ color: "primary"
11
+ };
12
+ e("avatar", t);
13
+ //#endregion
14
+ export { n as FALLBACK_AVATAR_CONFIG, t as defaultAvatarConfig };
@@ -0,0 +1,21 @@
1
+ import { Size, Variant } from '../../shared';
2
+ /**
3
+ * CSS classes for the avatar's diameter based on size.
4
+ */
5
+ export declare const AVATAR_SIZE_CLASS: Record<Size, string>;
6
+ /**
7
+ * CSS classes for the initials' font size based on size.
8
+ */
9
+ export declare const AVATAR_FONT_CLASS: Record<Size, string>;
10
+ /**
11
+ * Base classes for the avatar frame.
12
+ * The frame clips the picture to the resolved radius and centres a fallback.
13
+ */
14
+ export declare const AVATAR_BASE_CLASS = "relative inline-flex items-center justify-center shrink-0 overflow-hidden select-none font-medium uppercase";
15
+ /**
16
+ * The variant the initials fall back to.
17
+ * An avatar shows an entity, so its fallback is a filled accent surface rather
18
+ * than an outline or a tint.
19
+ */
20
+ export declare const AVATAR_FALLBACK_VARIANT: Variant;
21
+ //# sourceMappingURL=avatar-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar-styles.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/avatar-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAIlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAIlD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,gHACiF,CAAC;AAEhH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ //#region src/components/avatar/avatar-styles.ts
3
+ var e = {
4
+ sm: "size-8",
5
+ md: "size-10",
6
+ lg: "size-12"
7
+ }, t = {
8
+ sm: "text-xs",
9
+ md: "text-sm",
10
+ lg: "text-base"
11
+ }, n = "relative inline-flex items-center justify-center shrink-0 overflow-hidden select-none font-medium uppercase", r = "solid";
12
+ //#endregion
13
+ export { n as AVATAR_BASE_CLASS, r as AVATAR_FALLBACK_VARIANT, t as AVATAR_FONT_CLASS, e as AVATAR_SIZE_CLASS };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Avatar helpers for AsheeUI.
3
+ * This file provides the small pure helpers the Avatar component needs, kept
4
+ * apart from the component so they can be reasoned about and tested on their
5
+ * own.
6
+ */
7
+ /**
8
+ * Derives the initials shown when an avatar has no picture.
9
+ *
10
+ * A single word contributes its first two characters, and a longer name
11
+ * contributes the first character of its first and last word, which is what
12
+ * identifies a person in most name orders.
13
+ *
14
+ * @param name - The represented entity's name.
15
+ * @returns One or two uppercase characters, or an empty string when there is
16
+ * nothing to derive them from.
17
+ */
18
+ export declare function getInitials(name: string): string;
19
+ //# sourceMappingURL=avatar.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/avatar.helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUhD"}
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ //#region src/components/avatar/avatar.helpers.ts
3
+ function e(e) {
4
+ let t = e.trim().split(/\s+/).filter(Boolean);
5
+ if (t.length === 0) return "";
6
+ if (t.length === 1) return t[0].slice(0, 2).toUpperCase();
7
+ let n = t[0], r = t[t.length - 1];
8
+ return `${n[0]}${r[0]}`.toUpperCase();
9
+ }
10
+ //#endregion
11
+ export { e as getInitials };
@@ -0,0 +1,3 @@
1
+ export * from './Avatar';
2
+ export * from './avatar-config';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./Avatar.js";
2
+ export * from "./avatar-config.js";
3
+ export * from "./avatar-styles.js";
4
+ export * from "./avatar.helpers.js";
@@ -0,0 +1,69 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ import { BadgeConfig } from './badge-config';
3
+ type BaseBadgeProps = BadgeConfig & Omit<HTMLAttributes<HTMLSpanElement>, "color" | "content">;
4
+ /**
5
+ * Configuration options for the Badge component.
6
+ */
7
+ export interface BadgeProps extends BaseBadgeProps {
8
+ /**
9
+ * Badge content.
10
+ * Typically a short piece of text. Omit it when the badge shows only an icon
11
+ * and pass `label` instead so the badge still has an accessible name.
12
+ */
13
+ children?: ReactNode;
14
+ /**
15
+ * Text that stands in for the badge's content.
16
+ * Use it when the badge shows only an icon: the text is rendered for
17
+ * assistive technology and the visible content is treated as decoration. A
18
+ * badge with visible text does not need it, because its text is its content.
19
+ */
20
+ label?: string;
21
+ /**
22
+ * Content rendered before the badge text, typically an icon.
23
+ */
24
+ startContent?: ReactNode;
25
+ /**
26
+ * Content rendered after the badge text, typically an icon.
27
+ */
28
+ endContent?: ReactNode;
29
+ }
30
+ /**
31
+ * A compact status or label indicator.
32
+ *
33
+ * Badge renders an inline, non-interactive element for short pieces of status
34
+ * or category information. Its colour, variant, size, and radius resolve
35
+ * through the standard AsheeUI cascade: prop, component config, global theme
36
+ * defaults, and the built-in fallback. It is decorative in the sense that it
37
+ * carries no interaction of its own: pointer events, focus, and keyboard
38
+ * behaviour belong to whatever it is placed inside.
39
+ *
40
+ * Consumer `className` is appended last, so it can restyle or reposition the
41
+ * badge without fighting the framework's classes.
42
+ *
43
+ * @param props - Badge configuration options and span attributes.
44
+ * @param props.children - Badge text or content.
45
+ * @param props.label - Text that stands in for the content of an icon-only badge.
46
+ * @param props.variant - Visual style variant. Defaults to the configured value.
47
+ * @param props.color - Theme accent colour. Defaults to the configured value.
48
+ * @param props.size - Density scale. Defaults to "md".
49
+ * @param props.radius - Corner rounding. Defaults to "full".
50
+ * @param props.startContent - Content rendered before the badge text.
51
+ * @param props.endContent - Content rendered after the badge text.
52
+ * @param props.className - Extra classes applied last.
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * <Badge color="success">Active</Badge>
57
+ * ```
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * // Icon only: the label is the badge's accessible name.
62
+ * <Badge label="Active" startContent={<CheckIcon />} />
63
+ * ```
64
+ *
65
+ * @see BadgeConfig - The configuration type for component defaults.
66
+ */
67
+ export declare const Badge: import('react').ForwardRefExoticComponent<BadgeProps & import('react').RefAttributes<HTMLSpanElement>>;
68
+ export {};
69
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/Badge.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAiBf,OAAO,EACL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAExB,KAAK,cAAc,GAAG,WAAW,GAC/B,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,KAAK,wGA+HjB,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ "use client";
3
+ import { cn as e } from "../../utils/cn.js";
4
+ import { RADIUS_CLASS as t } from "../../shared/radius.js";
5
+ import { resolveVariantClass as n } from "../../shared/variant.js";
6
+ import { useAsheeConfig as r } from "../../libs/context.js";
7
+ import { resolveCascade as i, resolveClassKey as a, resolveRadiusKey as o } from "../../utils/resolve-token.js";
8
+ import { BADGE_FONT_CLASS as s, BADGE_GAP_CLASS as c, BADGE_HEIGHT_CLASS as l, BADGE_ICON_SIZE_CLASS as u, BADGE_PADDING_CLASS as d } from "./badge-styles.js";
9
+ import { FALLBACK_BADGE_CONFIG as f } from "./badge-config.js";
10
+ import { forwardRef as p } from "react";
11
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
12
+ //#region src/components/badge/Badge.tsx
13
+ var _ = p(({ variant: p, color: _, size: v, radius: y, label: b, children: x, startContent: S, endContent: C, className: w, ...T }, E) => {
14
+ let D = r(), O = D.components?.badge, k = i(p, O?.variant, D.defaultVariant, f.variant), A = k === "underlined" ? "bordered" : k, j = i(_, O?.color, D.defaultColor, f.color), M = i(v, O?.size, void 0, f.size), N = o(y, O?.radius, D.defaultRadius, f.radius), P = a(M, l, f.size), F = a(M, d, f.size), I = a(M, s, f.size), L = a(M, c, f.size), R = a(M, u, f.size), z = a(N, t, f.radius);
15
+ return /* @__PURE__ */ h("span", {
16
+ ref: E,
17
+ className: e("inline-flex items-center justify-center shrink-0 whitespace-nowrap font-medium select-none", P, F, I, L, R, z, n(A, j), w),
18
+ ...T,
19
+ children: b ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
20
+ className: "sr-only",
21
+ children: b
22
+ }), /* @__PURE__ */ g("span", {
23
+ "aria-hidden": "true",
24
+ className: e("inline-flex items-center", L),
25
+ children: [
26
+ S,
27
+ x,
28
+ C
29
+ ]
30
+ })] }) : /* @__PURE__ */ g(m, { children: [
31
+ S,
32
+ x,
33
+ C
34
+ ] })
35
+ });
36
+ });
37
+ _.displayName = "Badge";
38
+ //#endregion
39
+ export { _ as Badge };