@bearmenu/ui 0.5.2 → 0.6.1

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 (227) hide show
  1. package/dist/{chunk-ERMIA7NP.js → chunk-7PPCH42H.js} +3 -3
  2. package/dist/{chunk-HLQ2IRE7.js → chunk-BAZFVSSG.js} +3 -3
  3. package/dist/chunk-D5QHEHXJ.js +26 -0
  4. package/dist/{chunk-UISA4CIG.js → chunk-N2KNBPAQ.js} +2 -2
  5. package/dist/{chunk-7H54PTVH.js → chunk-PSR7N36A.js} +38 -10
  6. package/dist/chunk-RIDXFY6M.js +38 -0
  7. package/dist/chunk-UUJVXN2O.js +82 -0
  8. package/dist/chunk-WKMLZDUT.js +122 -0
  9. package/dist/chunk-XK2ZDQVE.js +122 -0
  10. package/dist/{chunk-4KOMHDZD.js → chunk-Y5D5LP4A.js} +18 -3
  11. package/dist/chunk-YJ6OBKZJ.js +32 -0
  12. package/dist/{chunk-ESO2EM3L.js → chunk-ZBBUKXM5.js} +2 -2
  13. package/dist/chunk-ZFNOCP6W.js +106 -0
  14. package/dist/components/accordion.js +11 -5
  15. package/dist/components/alert-dialog.js +5 -3
  16. package/dist/components/alert.d.ts +4 -1
  17. package/dist/components/alert.js +25 -9
  18. package/dist/components/avatar.d.ts +17 -2
  19. package/dist/components/avatar.js +91 -12
  20. package/dist/components/badge.d.ts +1 -1
  21. package/dist/components/badge.js +1 -1
  22. package/dist/components/breadcrumb.js +5 -2
  23. package/dist/components/button-group.d.ts +14 -0
  24. package/dist/components/button-group.js +39 -0
  25. package/dist/components/button.d.ts +3 -1
  26. package/dist/components/button.js +1 -1
  27. package/dist/components/calendar.js +3 -3
  28. package/dist/components/card.d.ts +13 -5
  29. package/dist/components/card.js +2 -2
  30. package/dist/components/carousel.d.ts +20 -3
  31. package/dist/components/carousel.js +72 -12
  32. package/dist/components/checkbox.js +1 -1
  33. package/dist/components/circular-progress.d.ts +16 -0
  34. package/dist/components/circular-progress.js +105 -0
  35. package/dist/components/combobox.d.ts +27 -0
  36. package/dist/components/combobox.js +102 -0
  37. package/dist/components/command.d.ts +16 -3
  38. package/dist/components/command.js +2 -2
  39. package/dist/components/currency-input.d.ts +1 -0
  40. package/dist/components/currency-input.js +73 -52
  41. package/dist/components/date-input.d.ts +10 -0
  42. package/dist/components/date-input.js +40 -0
  43. package/dist/components/description-list.d.ts +15 -0
  44. package/dist/components/description-list.js +67 -0
  45. package/dist/components/dialog.d.ts +13 -2
  46. package/dist/components/dialog.js +1 -1
  47. package/dist/components/drawer.d.ts +5 -2
  48. package/dist/components/drawer.js +47 -9
  49. package/dist/components/dropdown-menu.d.ts +7 -2
  50. package/dist/components/dropdown-menu.js +22 -6
  51. package/dist/components/empty-state.js +2 -2
  52. package/dist/components/field.d.ts +22 -0
  53. package/dist/components/field.js +130 -0
  54. package/dist/components/form.d.ts +2 -1
  55. package/dist/components/form.js +11 -1
  56. package/dist/components/haptic-button.js +3 -3
  57. package/dist/components/input-group.d.ts +18 -0
  58. package/dist/components/input-group.js +92 -0
  59. package/dist/components/input.d.ts +8 -2
  60. package/dist/components/input.js +1 -1
  61. package/dist/components/item.d.ts +23 -0
  62. package/dist/components/item.js +120 -0
  63. package/dist/components/kbd.d.ts +13 -0
  64. package/dist/components/kbd.js +49 -0
  65. package/dist/components/lazy-markdown.d.ts +3 -1
  66. package/dist/components/lazy-markdown.js +7 -7
  67. package/dist/components/link-button.js +1 -1
  68. package/dist/components/multi-select-combobox.js +92 -83
  69. package/dist/components/multi-select-menu.d.ts +0 -4
  70. package/dist/components/multi-select-menu.js +28 -17
  71. package/dist/components/native-select.d.ts +12 -0
  72. package/dist/components/native-select.js +49 -0
  73. package/dist/components/pagination.d.ts +5 -2
  74. package/dist/components/pagination.js +66 -7
  75. package/dist/components/place-about-tab.js +4 -4
  76. package/dist/components/place-card.js +1 -1
  77. package/dist/components/place-details-mobile.js +4 -4
  78. package/dist/components/popover.d.ts +7 -1
  79. package/dist/components/popover.js +1 -1
  80. package/dist/components/progress.d.ts +5 -1
  81. package/dist/components/progress.js +17 -3
  82. package/dist/components/radio-group.js +12 -3
  83. package/dist/components/rating.d.ts +2 -0
  84. package/dist/components/rating.js +88 -70
  85. package/dist/components/scroll-fade.d.ts +15 -0
  86. package/dist/components/scroll-fade.js +116 -0
  87. package/dist/components/search-bar.d.ts +1 -2
  88. package/dist/components/search-bar.js +37 -60
  89. package/dist/components/searchable-select.js +76 -72
  90. package/dist/components/select.d.ts +5 -1
  91. package/dist/components/select.js +30 -14
  92. package/dist/components/selection-bar.d.ts +11 -0
  93. package/dist/components/selection-bar.js +65 -0
  94. package/dist/components/separator.js +3 -2
  95. package/dist/components/sheet.d.ts +1 -1
  96. package/dist/components/sheet.js +1 -1
  97. package/dist/components/skeleton-card.js +1 -1
  98. package/dist/components/skeleton.js +1 -1
  99. package/dist/components/slider.js +21 -4
  100. package/dist/components/sliding-panels.js +9 -6
  101. package/dist/components/spinner.d.ts +17 -0
  102. package/dist/components/spinner.js +50 -0
  103. package/dist/components/stepper.d.ts +18 -0
  104. package/dist/components/stepper.js +199 -0
  105. package/dist/components/switch.js +4 -3
  106. package/dist/components/table.d.ts +23 -5
  107. package/dist/components/table.js +121 -35
  108. package/dist/components/tabs.d.ts +3 -1
  109. package/dist/components/tabs.js +37 -9
  110. package/dist/components/tag-group.d.ts +9 -0
  111. package/dist/components/tag-group.js +26 -0
  112. package/dist/components/tag.d.ts +17 -0
  113. package/dist/components/tag.js +61 -0
  114. package/dist/components/text.d.ts +1 -1
  115. package/dist/components/text.js +1 -1
  116. package/dist/components/textarea.js +2 -1
  117. package/dist/components/toast.js +1 -1
  118. package/dist/components/toaster.js +1 -1
  119. package/dist/components/toggle-group.js +1 -1
  120. package/dist/components/toggle.js +1 -1
  121. package/dist/components/tooltip.d.ts +3 -2
  122. package/dist/components/tooltip.js +16 -2
  123. package/package.json +45 -26
  124. package/src/components/accordion.tsx +11 -6
  125. package/src/components/alert-dialog.tsx +4 -2
  126. package/src/components/alert.tsx +20 -8
  127. package/src/components/avatar.tsx +106 -13
  128. package/src/components/badge.tsx +12 -11
  129. package/src/components/breadcrumb.tsx +5 -2
  130. package/src/components/button-group.stories.tsx +52 -0
  131. package/src/components/button-group.tsx +40 -0
  132. package/src/components/button.test.tsx +174 -0
  133. package/src/components/button.tsx +42 -19
  134. package/src/components/calendar.tsx +2 -2
  135. package/src/components/card.tsx +55 -13
  136. package/src/components/carousel.tsx +85 -13
  137. package/src/components/checkbox.test.tsx +58 -0
  138. package/src/components/checkbox.tsx +8 -3
  139. package/src/components/circular-progress.stories.tsx +39 -0
  140. package/src/components/circular-progress.tsx +102 -0
  141. package/src/components/collapsible.stories.tsx +7 -3
  142. package/src/components/combobox.stories.tsx +82 -0
  143. package/src/components/combobox.test.tsx +118 -0
  144. package/src/components/combobox.tsx +136 -0
  145. package/src/components/command.test.tsx +91 -0
  146. package/src/components/command.tsx +38 -15
  147. package/src/components/currency-input.test.tsx +63 -0
  148. package/src/components/currency-input.tsx +84 -66
  149. package/src/components/date-input.stories.tsx +31 -0
  150. package/src/components/date-input.tsx +43 -0
  151. package/src/components/description-list.stories.tsx +62 -0
  152. package/src/components/description-list.tsx +68 -0
  153. package/src/components/dialog.test.tsx +84 -0
  154. package/src/components/dialog.tsx +64 -24
  155. package/src/components/drawer.tsx +72 -23
  156. package/src/components/dropdown-menu.test.tsx +180 -0
  157. package/src/components/dropdown-menu.tsx +31 -6
  158. package/src/components/field.stories.tsx +36 -0
  159. package/src/components/field.test.tsx +157 -0
  160. package/src/components/field.tsx +146 -0
  161. package/src/components/form.stories.tsx +3 -2
  162. package/src/components/form.test.tsx +95 -0
  163. package/src/components/form.tsx +9 -0
  164. package/src/components/haptic-button.tsx +1 -1
  165. package/src/components/input-group.stories.tsx +61 -0
  166. package/src/components/input-group.tsx +99 -0
  167. package/src/components/input.test.tsx +103 -0
  168. package/src/components/input.tsx +24 -7
  169. package/src/components/item.stories.tsx +52 -0
  170. package/src/components/item.tsx +115 -0
  171. package/src/components/kbd.stories.tsx +33 -0
  172. package/src/components/kbd.tsx +46 -0
  173. package/src/components/lazy-markdown.tsx +10 -7
  174. package/src/components/multi-select-combobox.test.tsx +101 -0
  175. package/src/components/multi-select-combobox.tsx +85 -82
  176. package/src/components/multi-select-menu.tsx +49 -41
  177. package/src/components/native-select.stories.tsx +52 -0
  178. package/src/components/native-select.tsx +45 -0
  179. package/src/components/pagination.tsx +64 -5
  180. package/src/components/popover.tsx +66 -3
  181. package/src/components/progress.tsx +27 -4
  182. package/src/components/radio-group.test.tsx +64 -0
  183. package/src/components/radio-group.tsx +11 -3
  184. package/src/components/rating.test.tsx +112 -0
  185. package/src/components/rating.tsx +97 -82
  186. package/src/components/scroll-fade.stories.tsx +98 -0
  187. package/src/components/scroll-fade.tsx +127 -0
  188. package/src/components/search-bar.stories.tsx +1 -32
  189. package/src/components/search-bar.tsx +22 -59
  190. package/src/components/searchable-select.tsx +69 -73
  191. package/src/components/select.tsx +34 -19
  192. package/src/components/selection-bar.stories.tsx +37 -0
  193. package/src/components/selection-bar.tsx +65 -0
  194. package/src/components/separator.tsx +5 -2
  195. package/src/components/sheet.tsx +1 -1
  196. package/src/components/skeleton.tsx +2 -2
  197. package/src/components/slider.test.tsx +45 -0
  198. package/src/components/slider.tsx +31 -12
  199. package/src/components/sliding-panels.tsx +8 -5
  200. package/src/components/spinner.stories.tsx +35 -0
  201. package/src/components/spinner.tsx +50 -0
  202. package/src/components/stepper.stories.tsx +71 -0
  203. package/src/components/stepper.tsx +220 -0
  204. package/src/components/switch.test.tsx +52 -0
  205. package/src/components/switch.tsx +4 -3
  206. package/src/components/table.tsx +140 -35
  207. package/src/components/tabs.test.tsx +107 -0
  208. package/src/components/tabs.tsx +70 -23
  209. package/src/components/tag-group.stories.tsx +39 -0
  210. package/src/components/tag-group.tsx +28 -0
  211. package/src/components/tag.stories.tsx +50 -0
  212. package/src/components/tag.tsx +63 -0
  213. package/src/components/text.test.tsx +1 -1
  214. package/src/components/text.tsx +19 -3
  215. package/src/components/textarea.test.tsx +48 -0
  216. package/src/components/textarea.tsx +2 -1
  217. package/src/components/toast.tsx +4 -3
  218. package/src/components/toggle.tsx +2 -2
  219. package/src/components/tooltip.tsx +12 -2
  220. package/src/globals.css +126 -90
  221. package/dist/chunk-2BMJRXQX.js +0 -80
  222. package/dist/chunk-4AVS6CV4.js +0 -89
  223. package/dist/chunk-4UO73SKC.js +0 -26
  224. package/dist/chunk-CW24PLDW.js +0 -24
  225. package/dist/chunk-IQASCH2V.js +0 -25
  226. package/dist/chunk-NKHH23YK.js +0 -31
  227. package/dist/chunk-QJ54Z7TC.js +0 -83
@@ -1,4 +1,4 @@
1
- import { Button } from '../chunk-2BMJRXQX.js';
1
+ import { Button } from '../chunk-ZFNOCP6W.js';
2
2
  import '../chunk-R47NEOSI.js';
3
3
  import { cn } from '../chunk-FEK5XGZW.js';
4
4
  import { __objRest, __spreadProps, __spreadValues } from '../chunk-3GWWZKX7.js';
@@ -21,6 +21,7 @@ function Carousel(_a) {
21
21
  opts,
22
22
  setApi,
23
23
  plugins,
24
+ gap = 16,
24
25
  className,
25
26
  children
26
27
  } = _b, props = __objRest(_b, [
@@ -28,6 +29,7 @@ function Carousel(_a) {
28
29
  "opts",
29
30
  "setApi",
30
31
  "plugins",
32
+ "gap",
31
33
  "className",
32
34
  "children"
33
35
  ]);
@@ -39,10 +41,14 @@ function Carousel(_a) {
39
41
  );
40
42
  const [canScrollPrev, setCanScrollPrev] = React.useState(false);
41
43
  const [canScrollNext, setCanScrollNext] = React.useState(false);
44
+ const [selectedIndex, setSelectedIndex] = React.useState(0);
45
+ const [slideCount, setSlideCount] = React.useState(0);
42
46
  const onSelect = React.useCallback((api2) => {
43
47
  if (!api2) return;
44
48
  setCanScrollPrev(api2.canScrollPrev());
45
49
  setCanScrollNext(api2.canScrollNext());
50
+ setSelectedIndex(api2.selectedScrollSnap());
51
+ setSlideCount(api2.scrollSnapList().length);
46
52
  }, []);
47
53
  const scrollPrev = React.useCallback(() => {
48
54
  api == null ? void 0 : api.scrollPrev();
@@ -50,6 +56,12 @@ function Carousel(_a) {
50
56
  const scrollNext = React.useCallback(() => {
51
57
  api == null ? void 0 : api.scrollNext();
52
58
  }, [api]);
59
+ const scrollTo = React.useCallback(
60
+ (index) => {
61
+ api == null ? void 0 : api.scrollTo(index);
62
+ },
63
+ [api]
64
+ );
53
65
  const handleKeyDown = React.useCallback(
54
66
  (event) => {
55
67
  if (event.key === "ArrowLeft") {
@@ -83,10 +95,14 @@ function Carousel(_a) {
83
95
  api,
84
96
  opts,
85
97
  orientation: orientation || ((opts == null ? void 0 : opts.axis) === "y" ? "vertical" : "horizontal"),
98
+ gap,
86
99
  scrollPrev,
87
100
  scrollNext,
101
+ scrollTo,
88
102
  canScrollPrev,
89
- canScrollNext
103
+ canScrollNext,
104
+ selectedIndex,
105
+ slideCount
90
106
  },
91
107
  children: /* @__PURE__ */ jsx(
92
108
  "div",
@@ -105,28 +121,26 @@ function Carousel(_a) {
105
121
  }
106
122
  function CarouselContent(_a) {
107
123
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
108
- const { carouselRef, orientation } = useCarousel();
124
+ const { carouselRef, orientation, gap } = useCarousel();
109
125
  return /* @__PURE__ */ jsx("div", { ref: carouselRef, className: "overflow-hidden", "data-slot": "carousel-content", children: /* @__PURE__ */ jsx(
110
126
  "div",
111
127
  __spreadValues({
112
- className: cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)
128
+ className: cn("flex", orientation === "horizontal" ? "" : "flex-col", className),
129
+ style: orientation === "horizontal" ? { marginLeft: `-${gap}px` } : { marginTop: `-${gap}px` }
113
130
  }, props)
114
131
  ) });
115
132
  }
116
133
  function CarouselItem(_a) {
117
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
118
- const { orientation } = useCarousel();
134
+ var _b = _a, { className, style } = _b, props = __objRest(_b, ["className", "style"]);
135
+ const { orientation, gap } = useCarousel();
119
136
  return /* @__PURE__ */ jsx(
120
137
  "div",
121
138
  __spreadValues({
122
139
  role: "group",
123
140
  "aria-roledescription": "slide",
124
141
  "data-slot": "carousel-item",
125
- className: cn(
126
- "min-w-0 shrink-0 grow-0 basis-full",
127
- orientation === "horizontal" ? "pl-4" : "pt-4",
128
- className
129
- )
142
+ className: cn("min-w-0 shrink-0 grow-0 basis-full", className),
143
+ style: __spreadValues(__spreadValues({}, orientation === "horizontal" ? { paddingLeft: `${gap}px` } : { paddingTop: `${gap}px` }), style)
130
144
  }, props)
131
145
  );
132
146
  }
@@ -194,5 +208,51 @@ function CarouselNext(_a) {
194
208
  })
195
209
  );
196
210
  }
211
+ function CarouselDots(_a) {
212
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
213
+ const { slideCount, selectedIndex, scrollTo } = useCarousel();
214
+ if (slideCount === 0) return null;
215
+ return /* @__PURE__ */ jsx(
216
+ "div",
217
+ __spreadProps(__spreadValues({
218
+ "data-slot": "carousel-dots",
219
+ className: cn("flex items-center justify-center gap-1.5", className)
220
+ }, props), {
221
+ children: Array.from({ length: slideCount }).map((_, i) => /* @__PURE__ */ jsx(
222
+ "button",
223
+ {
224
+ type: "button",
225
+ "aria-label": `Go to slide ${i + 1}`,
226
+ "aria-current": i === selectedIndex ? "true" : void 0,
227
+ onClick: () => scrollTo(i),
228
+ className: cn(
229
+ "size-2 rounded-full transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
230
+ i === selectedIndex ? "w-6 bg-primary" : "bg-muted-foreground/30 hover:bg-muted-foreground/50"
231
+ )
232
+ },
233
+ i
234
+ ))
235
+ })
236
+ );
237
+ }
238
+ function CarouselCounter(_a) {
239
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
240
+ const { slideCount, selectedIndex } = useCarousel();
241
+ if (slideCount === 0) return null;
242
+ return /* @__PURE__ */ jsxs(
243
+ "div",
244
+ __spreadProps(__spreadValues({
245
+ "data-slot": "carousel-counter",
246
+ "aria-live": "polite",
247
+ className: cn("text-xs tabular-nums text-muted-foreground", className)
248
+ }, props), {
249
+ children: [
250
+ selectedIndex + 1,
251
+ " / ",
252
+ slideCount
253
+ ]
254
+ })
255
+ );
256
+ }
197
257
 
198
- export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious };
258
+ export { Carousel, CarouselContent, CarouselCounter, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
@@ -1,3 +1,3 @@
1
- export { Checkbox } from '../chunk-IQASCH2V.js';
1
+ export { Checkbox } from '../chunk-D5QHEHXJ.js';
2
2
  import '../chunk-FEK5XGZW.js';
3
3
  import '../chunk-3GWWZKX7.js';
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+
3
+ declare const CircularProgress: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
4
+ value?: number;
5
+ max?: number;
6
+ size?: number;
7
+ strokeWidth?: number;
8
+ tone?: "primary" | "success" | "warning" | "destructive";
9
+ showLabel?: boolean;
10
+ /** Indeterminate spinner mode. */
11
+ indeterminate?: boolean;
12
+ /** Accessible label. Defaults to "Progress". */
13
+ label?: string;
14
+ } & React.RefAttributes<HTMLDivElement>>;
15
+
16
+ export { CircularProgress };
@@ -0,0 +1,105 @@
1
+ import { cn } from '../chunk-FEK5XGZW.js';
2
+ import { __objRest, __spreadProps, __spreadValues } from '../chunk-3GWWZKX7.js';
3
+ import * as React from 'react';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ var toneClasses = {
7
+ primary: "stroke-primary",
8
+ success: "stroke-success",
9
+ warning: "stroke-warning",
10
+ destructive: "stroke-destructive"
11
+ };
12
+ var CircularProgress = React.forwardRef(
13
+ (_a, ref) => {
14
+ var _b = _a, {
15
+ className,
16
+ value = 0,
17
+ max = 100,
18
+ size = 40,
19
+ strokeWidth = 4,
20
+ tone = "primary",
21
+ showLabel = false,
22
+ indeterminate = false,
23
+ label = "Progress"
24
+ } = _b, props = __objRest(_b, [
25
+ "className",
26
+ "value",
27
+ "max",
28
+ "size",
29
+ "strokeWidth",
30
+ "tone",
31
+ "showLabel",
32
+ "indeterminate",
33
+ "label"
34
+ ]);
35
+ const radius = (size - strokeWidth) / 2;
36
+ const circumference = 2 * Math.PI * radius;
37
+ const clampedValue = Math.min(Math.max(value, 0), max);
38
+ const percent = clampedValue / max * 100;
39
+ const dashOffset = circumference - circumference * percent / 100;
40
+ return /* @__PURE__ */ jsxs(
41
+ "div",
42
+ __spreadProps(__spreadValues({
43
+ ref,
44
+ "data-slot": "circular-progress",
45
+ role: "progressbar",
46
+ "aria-valuemin": 0,
47
+ "aria-valuemax": max,
48
+ "aria-valuenow": indeterminate ? void 0 : clampedValue,
49
+ "aria-label": label,
50
+ className: cn("relative inline-flex shrink-0 items-center justify-center", className),
51
+ style: { width: size, height: size }
52
+ }, props), {
53
+ children: [
54
+ /* @__PURE__ */ jsxs(
55
+ "svg",
56
+ {
57
+ width: size,
58
+ height: size,
59
+ viewBox: `0 0 ${size} ${size}`,
60
+ className: cn(indeterminate && "animate-spin"),
61
+ children: [
62
+ /* @__PURE__ */ jsx(
63
+ "circle",
64
+ {
65
+ cx: size / 2,
66
+ cy: size / 2,
67
+ r: radius,
68
+ strokeWidth,
69
+ fill: "none",
70
+ className: "stroke-muted"
71
+ }
72
+ ),
73
+ /* @__PURE__ */ jsx(
74
+ "circle",
75
+ {
76
+ cx: size / 2,
77
+ cy: size / 2,
78
+ r: radius,
79
+ strokeWidth,
80
+ fill: "none",
81
+ strokeLinecap: "round",
82
+ className: cn("transition-[stroke-dashoffset] duration-300 ease-out", toneClasses[tone]),
83
+ style: {
84
+ strokeDasharray: circumference,
85
+ strokeDashoffset: indeterminate ? circumference * 0.75 : dashOffset,
86
+ transform: `rotate(-90deg)`,
87
+ transformOrigin: `${size / 2}px ${size / 2}px`
88
+ }
89
+ }
90
+ )
91
+ ]
92
+ }
93
+ ),
94
+ showLabel && !indeterminate && /* @__PURE__ */ jsxs("span", { className: "absolute text-xs font-medium tabular-nums text-foreground", children: [
95
+ Math.round(percent),
96
+ "%"
97
+ ] })
98
+ ]
99
+ })
100
+ );
101
+ }
102
+ );
103
+ CircularProgress.displayName = "CircularProgress";
104
+
105
+ export { CircularProgress };
@@ -0,0 +1,27 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface ComboboxOption {
4
+ value: string;
5
+ label: string;
6
+ description?: string;
7
+ disabled?: boolean;
8
+ }
9
+ interface ComboboxProps {
10
+ options: ComboboxOption[];
11
+ value: string | undefined;
12
+ onValueChange: (value: string | undefined) => void;
13
+ placeholder?: string;
14
+ searchPlaceholder?: string;
15
+ emptyText?: string;
16
+ loadingText?: string;
17
+ className?: string;
18
+ disabled?: boolean;
19
+ loading?: boolean;
20
+ /** Allow clearing the selection. Defaults to true. */
21
+ clearable?: boolean;
22
+ /** If set, external search drives the option list (controlled). */
23
+ onSearchChange?: (search: string) => void;
24
+ }
25
+ declare function Combobox({ options, value, onValueChange, placeholder, searchPlaceholder, emptyText, loadingText, className, disabled, loading, clearable, onSearchChange, }: ComboboxProps): react_jsx_runtime.JSX.Element;
26
+
27
+ export { Combobox, type ComboboxOption };
@@ -0,0 +1,102 @@
1
+ import { Popover, PopoverTrigger, PopoverContent } from '../chunk-UUJVXN2O.js';
2
+ import { Command, CommandInput, CommandList, CommandLoading, CommandEmpty, CommandGroup, CommandItem } from '../chunk-PSR7N36A.js';
3
+ import '../chunk-WKMLZDUT.js';
4
+ import { Button } from '../chunk-ZFNOCP6W.js';
5
+ import '../chunk-R47NEOSI.js';
6
+ import { cn } from '../chunk-FEK5XGZW.js';
7
+ import '../chunk-3GWWZKX7.js';
8
+ import * as React from 'react';
9
+ import { ChevronsUpDown, Check, X } from 'lucide-react';
10
+ import { jsxs, jsx } from 'react/jsx-runtime';
11
+
12
+ function Combobox({
13
+ options,
14
+ value,
15
+ onValueChange,
16
+ placeholder = "Select...",
17
+ searchPlaceholder = "Search...",
18
+ emptyText = "No results.",
19
+ loadingText = "Loading\u2026",
20
+ className,
21
+ disabled = false,
22
+ loading = false,
23
+ clearable = true,
24
+ onSearchChange
25
+ }) {
26
+ const [open, setOpen] = React.useState(false);
27
+ const selected = options.find((o) => o.value === value);
28
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
29
+ /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
30
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
31
+ Button,
32
+ {
33
+ variant: "outline",
34
+ role: "combobox",
35
+ "aria-expanded": open,
36
+ "aria-haspopup": "listbox",
37
+ disabled,
38
+ className: cn("w-full justify-between font-normal", !selected && "text-muted-foreground", value && clearable && !disabled && "pr-16"),
39
+ children: [
40
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: (selected == null ? void 0 : selected.label) || placeholder }),
41
+ /* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 shrink-0 opacity-50" })
42
+ ]
43
+ }
44
+ ) }),
45
+ /* @__PURE__ */ jsx(
46
+ PopoverContent,
47
+ {
48
+ align: "start",
49
+ className: "w-[var(--radix-popover-trigger-width)] p-0",
50
+ children: /* @__PURE__ */ jsxs(Command, { shouldFilter: !onSearchChange, children: [
51
+ /* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder, onValueChange: onSearchChange }),
52
+ /* @__PURE__ */ jsxs(CommandList, { children: [
53
+ loading ? /* @__PURE__ */ jsx(CommandLoading, { children: loadingText }) : /* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }),
54
+ /* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsxs(
55
+ CommandItem,
56
+ {
57
+ value: option.value,
58
+ disabled: option.disabled,
59
+ onSelect: () => {
60
+ onValueChange(option.value === value ? void 0 : option.value);
61
+ setOpen(false);
62
+ },
63
+ children: [
64
+ /* @__PURE__ */ jsx(
65
+ Check,
66
+ {
67
+ className: cn(
68
+ "mr-2 size-4",
69
+ value === option.value ? "opacity-100" : "opacity-0"
70
+ )
71
+ }
72
+ ),
73
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
74
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: option.label }),
75
+ option.description && /* @__PURE__ */ jsx("span", { className: "truncate text-xs text-muted-foreground", children: option.description })
76
+ ] })
77
+ ]
78
+ },
79
+ option.value
80
+ )) })
81
+ ] })
82
+ ] })
83
+ }
84
+ )
85
+ ] }),
86
+ value && clearable && !disabled && /* @__PURE__ */ jsx(
87
+ "button",
88
+ {
89
+ type: "button",
90
+ "aria-label": "Clear selection",
91
+ onClick: (e) => {
92
+ e.stopPropagation();
93
+ onValueChange(void 0);
94
+ },
95
+ className: "absolute right-9 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
96
+ children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
97
+ }
98
+ )
99
+ ] });
100
+ }
101
+
102
+ export { Combobox };
@@ -19,8 +19,11 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
19
19
  disablePointerSelection?: boolean;
20
20
  vimBindings?: boolean;
21
21
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
22
- type CommandDialogProps = DialogProps;
23
- declare const CommandDialog: ({ children, ...props }: CommandDialogProps) => react_jsx_runtime.JSX.Element;
22
+ type CommandDialogProps = DialogProps & {
23
+ title?: string;
24
+ description?: string;
25
+ };
26
+ declare const CommandDialog: ({ title, description, children, ...props }: CommandDialogProps) => react_jsx_runtime.JSX.Element;
24
27
  declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
25
28
  ref?: React.Ref<HTMLInputElement>;
26
29
  } & {
@@ -45,6 +48,16 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
45
48
  } & {
46
49
  asChild?: boolean;
47
50
  }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
51
+ declare const CommandLoading: React.ForwardRefExoticComponent<Omit<{
52
+ children?: React.ReactNode;
53
+ } & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
54
+ ref?: React.Ref<HTMLDivElement>;
55
+ } & {
56
+ asChild?: boolean;
57
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
58
+ progress?: number;
59
+ label?: string;
60
+ } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
48
61
  declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
49
62
  children?: React.ReactNode;
50
63
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
@@ -81,4 +94,4 @@ declare const CommandShortcut: {
81
94
  displayName: string;
82
95
  };
83
96
 
84
- export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
97
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut };
@@ -1,4 +1,4 @@
1
- export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from '../chunk-7H54PTVH.js';
2
- import '../chunk-4AVS6CV4.js';
1
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut } from '../chunk-PSR7N36A.js';
2
+ import '../chunk-WKMLZDUT.js';
3
3
  import '../chunk-FEK5XGZW.js';
4
4
  import '../chunk-3GWWZKX7.js';
@@ -11,6 +11,7 @@ interface CurrencyInputProps {
11
11
  disabled?: boolean;
12
12
  className?: string;
13
13
  error?: string;
14
+ id?: string;
14
15
  }
15
16
  declare const CurrencyInput: React.ForwardRefExoticComponent<CurrencyInputProps & React.RefAttributes<HTMLInputElement>>;
16
17
 
@@ -1,22 +1,37 @@
1
- import { Input } from '../chunk-CW24PLDW.js';
1
+ import { Input } from '../chunk-RIDXFY6M.js';
2
2
  import { cn } from '../chunk-FEK5XGZW.js';
3
3
  import { __objRest, __spreadValues } from '../chunk-3GWWZKX7.js';
4
4
  import * as React from 'react';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
6
 
7
+ var ALLOWED_NAVIGATION_KEYS = /* @__PURE__ */ new Set([
8
+ "Backspace",
9
+ "Tab",
10
+ "Escape",
11
+ "Enter",
12
+ "Delete",
13
+ "Home",
14
+ "End",
15
+ "ArrowLeft",
16
+ "ArrowRight",
17
+ "ArrowUp",
18
+ "ArrowDown"
19
+ ]);
20
+ var ALLOWED_SHORTCUT_KEYS = /* @__PURE__ */ new Set(["a", "c", "v", "x", "z"]);
7
21
  var CurrencyInput = React.forwardRef(
8
22
  (_a, ref) => {
9
23
  var _b = _a, {
10
24
  value,
11
25
  onChange,
12
26
  placeholder = "Enter amount",
13
- currency: _currency = "$",
27
+ currency = "$",
14
28
  locale = "en-US",
15
29
  min,
16
30
  max,
17
31
  disabled = false,
18
32
  className,
19
- error
33
+ error,
34
+ id: providedId
20
35
  } = _b, props = __objRest(_b, [
21
36
  "value",
22
37
  "onChange",
@@ -27,17 +42,24 @@ var CurrencyInput = React.forwardRef(
27
42
  "max",
28
43
  "disabled",
29
44
  "className",
30
- "error"
45
+ "error",
46
+ "id"
31
47
  ]);
48
+ const reactId = React.useId();
49
+ const id = providedId != null ? providedId : reactId;
50
+ const errorId = `${id}-error`;
32
51
  const [displayValue, setDisplayValue] = React.useState("");
33
52
  const [isFocused, setIsFocused] = React.useState(false);
34
- const formatNumber = (num) => {
35
- if (num === null || isNaN(num)) return "";
36
- return new Intl.NumberFormat(locale, {
37
- minimumFractionDigits: 0,
38
- maximumFractionDigits: 2
39
- }).format(num);
40
- };
53
+ const formatNumber = React.useCallback(
54
+ (num) => {
55
+ if (num === null || isNaN(num)) return "";
56
+ return new Intl.NumberFormat(locale, {
57
+ minimumFractionDigits: 0,
58
+ maximumFractionDigits: 2
59
+ }).format(num);
60
+ },
61
+ [locale]
62
+ );
41
63
  const parseInput = (input) => {
42
64
  const cleaned = input.replace(/[^\d.-]/g, "");
43
65
  const parsed = parseFloat(cleaned);
@@ -47,18 +69,14 @@ var CurrencyInput = React.forwardRef(
47
69
  if (!isFocused) {
48
70
  setDisplayValue(formatNumber(value));
49
71
  }
50
- }, [value, isFocused, locale]);
72
+ }, [value, isFocused, formatNumber]);
51
73
  const handleInputChange = (e) => {
52
74
  const inputValue = e.target.value;
53
75
  setDisplayValue(inputValue);
54
76
  const parsedValue = parseInput(inputValue);
55
77
  if (parsedValue !== null) {
56
- if (min !== void 0 && parsedValue < min) {
57
- return;
58
- }
59
- if (max !== void 0 && parsedValue > max) {
60
- return;
61
- }
78
+ if (min !== void 0 && parsedValue < min) return;
79
+ if (max !== void 0 && parsedValue > max) return;
62
80
  }
63
81
  onChange(parsedValue);
64
82
  };
@@ -77,42 +95,45 @@ var CurrencyInput = React.forwardRef(
77
95
  }
78
96
  };
79
97
  const handleKeyDown = (e) => {
80
- if ([8, 9, 27, 13, 46, 35, 36, 37, 38, 39, 40].includes(e.keyCode)) {
81
- return;
82
- }
83
- if ((e.ctrlKey || e.metaKey) && [65, 67, 86, 88, 90].includes(e.keyCode)) {
84
- return;
85
- }
86
- if (e.keyCode >= 48 && e.keyCode <= 57 || // 0-9
87
- e.keyCode >= 96 && e.keyCode <= 105 || // numpad 0-9
88
- e.keyCode === 190 || e.keyCode === 110 || // decimal point
89
- e.keyCode === 189 || e.keyCode === 109) {
90
- return;
91
- }
98
+ if (ALLOWED_NAVIGATION_KEYS.has(e.key)) return;
99
+ if ((e.ctrlKey || e.metaKey) && ALLOWED_SHORTCUT_KEYS.has(e.key.toLowerCase())) return;
100
+ if (/^[0-9]$/.test(e.key)) return;
101
+ if (e.key === "." || e.key === "-") return;
92
102
  e.preventDefault();
93
103
  };
94
- return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
95
- /* @__PURE__ */ jsx(
96
- Input,
97
- __spreadValues({
98
- ref,
99
- type: "text",
100
- value: displayValue,
101
- onChange: handleInputChange,
102
- onFocus: handleFocus,
103
- onBlur: handleBlur,
104
- onKeyDown: handleKeyDown,
105
- placeholder,
106
- disabled,
107
- className: cn(
108
- "pl-8",
109
- // Space for currency symbol
110
- error && "border-destructive focus-visible:ring-destructive",
111
- className
112
- )
113
- }, props)
114
- ),
115
- error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive mt-1 ml-1", children: error })
104
+ const symbolLength = currency.length;
105
+ const inputPaddingClass = symbolLength <= 1 ? "pl-8" : symbolLength === 2 ? "pl-10" : symbolLength === 3 ? "pl-12" : "pl-14";
106
+ return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
107
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
108
+ /* @__PURE__ */ jsx(
109
+ "span",
110
+ {
111
+ "aria-hidden": true,
112
+ className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm font-medium text-muted-foreground",
113
+ children: currency
114
+ }
115
+ ),
116
+ /* @__PURE__ */ jsx(
117
+ Input,
118
+ __spreadValues({
119
+ ref,
120
+ id,
121
+ type: "text",
122
+ inputMode: "decimal",
123
+ value: displayValue,
124
+ onChange: handleInputChange,
125
+ onFocus: handleFocus,
126
+ onBlur: handleBlur,
127
+ onKeyDown: handleKeyDown,
128
+ placeholder,
129
+ disabled,
130
+ "aria-invalid": error ? true : void 0,
131
+ "aria-describedby": error ? errorId : void 0,
132
+ className: cn(inputPaddingClass, className)
133
+ }, props)
134
+ )
135
+ ] }),
136
+ error && /* @__PURE__ */ jsx("p", { id: errorId, className: "ml-1 mt-1 text-sm text-destructive", children: error })
116
137
  ] });
117
138
  }
118
139
  );
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+
3
+ declare const DateInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> & {
4
+ /** Native input type. Defaults to "date". */
5
+ type?: "date" | "datetime-local" | "time" | "month" | "week";
6
+ size?: "sm" | "default" | "lg";
7
+ showIcon?: boolean;
8
+ } & React.RefAttributes<HTMLInputElement>>;
9
+
10
+ export { DateInput };