@kumix/ui 0.3.0 → 0.3.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 (242) hide show
  1. package/README.md +14 -1
  2. package/dist/components/custom/confirm-dialog.d.ts +16 -0
  3. package/dist/components/custom/confirm-dialog.d.ts.map +1 -0
  4. package/dist/components/custom/confirm-dialog.js +93 -0
  5. package/dist/components/custom/confirm-dialog.js.map +1 -0
  6. package/dist/components/custom/toast.d.ts +20 -0
  7. package/dist/components/custom/toast.d.ts.map +1 -0
  8. package/dist/components/custom/toast.js +73 -0
  9. package/dist/components/custom/toast.js.map +1 -0
  10. package/dist/components/motion/action-swap.js +1 -1
  11. package/dist/components/motion/animated-badge.js +2 -2
  12. package/dist/components/motion/animated-number.js +1 -1
  13. package/dist/components/motion/animated-sidebar.js +2 -2
  14. package/dist/components/motion/animated-toast-stack.js +4 -4
  15. package/dist/components/motion/animated-toast-stack.js.map +1 -1
  16. package/dist/components/motion/attachment-upload.d.ts +47 -0
  17. package/dist/components/motion/attachment-upload.d.ts.map +1 -0
  18. package/dist/components/motion/attachment-upload.js +737 -0
  19. package/dist/components/motion/attachment-upload.js.map +1 -0
  20. package/dist/components/motion/availability-scheduler/copy-menu.d.ts +10 -0
  21. package/dist/components/motion/availability-scheduler/copy-menu.d.ts.map +1 -0
  22. package/dist/components/motion/availability-scheduler/copy-menu.js +3 -0
  23. package/dist/components/motion/availability-scheduler/day-row.d.ts +15 -0
  24. package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -0
  25. package/dist/components/motion/availability-scheduler/day-row.js +181 -0
  26. package/dist/components/motion/availability-scheduler/day-row.js.map +1 -0
  27. package/dist/components/motion/availability-scheduler/icon-button.d.ts +15 -0
  28. package/dist/components/motion/availability-scheduler/icon-button.d.ts.map +1 -0
  29. package/dist/components/motion/availability-scheduler/icon-button.js +24 -0
  30. package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -0
  31. package/dist/components/motion/availability-scheduler/index.d.ts +14 -0
  32. package/dist/components/motion/availability-scheduler/index.d.ts.map +1 -0
  33. package/dist/components/motion/availability-scheduler/index.js +59 -0
  34. package/dist/components/motion/availability-scheduler/index.js.map +1 -0
  35. package/dist/components/motion/availability-scheduler/time-select.d.ts +10 -0
  36. package/dist/components/motion/availability-scheduler/time-select.d.ts.map +1 -0
  37. package/dist/components/motion/availability-scheduler/time-select.js +26 -0
  38. package/dist/components/motion/availability-scheduler/time-select.js.map +1 -0
  39. package/dist/components/motion/bloom-menu.d.ts +17 -0
  40. package/dist/components/motion/bloom-menu.d.ts.map +1 -0
  41. package/dist/components/motion/bloom-menu.js +170 -0
  42. package/dist/components/motion/bloom-menu.js.map +1 -0
  43. package/dist/components/motion/bottom-sheet.js +1 -1
  44. package/dist/components/motion/bounce-sidebar.js +1 -1
  45. package/dist/components/motion/bouncy-accordion.js +2 -2
  46. package/dist/components/motion/button/base.js +1 -1
  47. package/dist/components/motion/button/index.d.ts +4 -0
  48. package/dist/components/motion/button/index.js +5 -0
  49. package/dist/components/motion/button/magnetic.js +1 -1
  50. package/dist/components/motion/button/stateful.js +2 -2
  51. package/dist/components/motion/center-morph-modal.js +2 -2
  52. package/dist/components/motion/checkbox.js +1 -1
  53. package/dist/components/motion/chromatic-text-reveal.js +1 -1
  54. package/dist/components/motion/command-palette.d.ts +26 -0
  55. package/dist/components/motion/command-palette.d.ts.map +1 -0
  56. package/dist/components/motion/command-palette.js +246 -0
  57. package/dist/components/motion/command-palette.js.map +1 -0
  58. package/dist/components/motion/context-menu.js +2 -2
  59. package/dist/components/motion/cylinder-carousel.js +1 -1
  60. package/dist/components/motion/dock.js +1 -1
  61. package/dist/components/motion/drawer.js +1 -1
  62. package/dist/components/motion/dynamic-island.d.ts +22 -0
  63. package/dist/components/motion/dynamic-island.d.ts.map +1 -0
  64. package/dist/components/motion/dynamic-island.js +143 -0
  65. package/dist/components/motion/dynamic-island.js.map +1 -0
  66. package/dist/components/motion/expandable-action-bar.d.ts +52 -0
  67. package/dist/components/motion/expandable-action-bar.d.ts.map +1 -0
  68. package/dist/components/motion/expandable-action-bar.js +191 -0
  69. package/dist/components/motion/expandable-action-bar.js.map +1 -0
  70. package/dist/components/motion/expandable-tabs.d.ts +33 -0
  71. package/dist/components/motion/expandable-tabs.d.ts.map +1 -0
  72. package/dist/components/motion/expandable-tabs.js +291 -0
  73. package/dist/components/motion/expandable-tabs.js.map +1 -0
  74. package/dist/components/motion/feedback-widget.d.ts +18 -0
  75. package/dist/components/motion/feedback-widget.d.ts.map +1 -0
  76. package/dist/components/motion/feedback-widget.js +413 -0
  77. package/dist/components/motion/feedback-widget.js.map +1 -0
  78. package/dist/components/motion/file-upload.d.ts +48 -0
  79. package/dist/components/motion/file-upload.d.ts.map +1 -0
  80. package/dist/components/motion/file-upload.js +382 -0
  81. package/dist/components/motion/file-upload.js.map +1 -0
  82. package/dist/components/motion/hold-action-button.js +1 -1
  83. package/dist/components/motion/infinite-masonry.d.ts +31 -0
  84. package/dist/components/motion/infinite-masonry.d.ts.map +1 -0
  85. package/dist/components/motion/infinite-masonry.js +223 -0
  86. package/dist/components/motion/infinite-masonry.js.map +1 -0
  87. package/dist/components/motion/input.js +1 -1
  88. package/dist/components/motion/loader.js +1 -1
  89. package/dist/components/motion/magnetic.js +1 -1
  90. package/dist/components/motion/morphing-modal.js +1 -1
  91. package/dist/components/motion/not-found/glitch.d.ts +6 -0
  92. package/dist/components/motion/not-found/glitch.d.ts.map +1 -0
  93. package/dist/components/motion/not-found/glitch.js +90 -0
  94. package/dist/components/motion/not-found/glitch.js.map +1 -0
  95. package/dist/components/motion/not-found/magnetic.d.ts +6 -0
  96. package/dist/components/motion/not-found/magnetic.d.ts.map +1 -0
  97. package/dist/components/motion/not-found/magnetic.js +47 -0
  98. package/dist/components/motion/not-found/magnetic.js.map +1 -0
  99. package/dist/components/motion/not-found/shared.d.ts +32 -0
  100. package/dist/components/motion/not-found/shared.d.ts.map +1 -0
  101. package/dist/components/motion/not-found/shared.js +52 -0
  102. package/dist/components/motion/not-found/shared.js.map +1 -0
  103. package/dist/components/motion/not-found/spotlight.d.ts +6 -0
  104. package/dist/components/motion/not-found/spotlight.d.ts.map +1 -0
  105. package/dist/components/motion/not-found/spotlight.js +70 -0
  106. package/dist/components/motion/not-found/spotlight.js.map +1 -0
  107. package/dist/components/motion/not-found/stacked.d.ts +6 -0
  108. package/dist/components/motion/not-found/stacked.d.ts.map +1 -0
  109. package/dist/components/motion/not-found/stacked.js +95 -0
  110. package/dist/components/motion/not-found/stacked.js.map +1 -0
  111. package/dist/components/motion/not-found/terminal.d.ts +6 -0
  112. package/dist/components/motion/not-found/terminal.d.ts.map +1 -0
  113. package/dist/components/motion/not-found/terminal.js +90 -0
  114. package/dist/components/motion/not-found/terminal.js.map +1 -0
  115. package/dist/components/motion/notification-stack.d.ts +35 -0
  116. package/dist/components/motion/notification-stack.d.ts.map +1 -0
  117. package/dist/components/motion/notification-stack.js +187 -0
  118. package/dist/components/motion/notification-stack.js.map +1 -0
  119. package/dist/components/motion/number-ticker.js +1 -1
  120. package/dist/components/motion/otp-input.d.ts +32 -0
  121. package/dist/components/motion/otp-input.d.ts.map +1 -0
  122. package/dist/components/motion/otp-input.js +272 -0
  123. package/dist/components/motion/otp-input.js.map +1 -0
  124. package/dist/components/motion/overflow-actions.d.ts +39 -0
  125. package/dist/components/motion/overflow-actions.d.ts.map +1 -0
  126. package/dist/components/motion/overflow-actions.js +220 -0
  127. package/dist/components/motion/overflow-actions.js.map +1 -0
  128. package/dist/components/motion/parallax.js +1 -1
  129. package/dist/components/motion/popover-morph.js +2 -2
  130. package/dist/components/motion/popover-morph.js.map +1 -1
  131. package/dist/components/motion/popover.js +1 -1
  132. package/dist/components/motion/preview-rail.js +1 -1
  133. package/dist/components/motion/pull-to-refresh.js +2 -2
  134. package/dist/components/motion/pull-to-refresh.js.map +1 -1
  135. package/dist/components/motion/radio.js +1 -1
  136. package/dist/components/motion/range-slider-bubble.js +1 -1
  137. package/dist/components/motion/range-slider-fluid.js +1 -1
  138. package/dist/components/motion/range-slider-ruler.js +2 -2
  139. package/dist/components/motion/range-slider-ruler.js.map +1 -1
  140. package/dist/components/motion/range-slider-wave.js +1 -1
  141. package/dist/components/motion/range-slider.js +1 -1
  142. package/dist/components/motion/scroll-progress.js +1 -1
  143. package/dist/components/motion/scroll-reveal.js +1 -1
  144. package/dist/components/motion/select-morph.js +2 -2
  145. package/dist/components/motion/select.js +2 -2
  146. package/dist/components/motion/shader-background.js +1 -1
  147. package/dist/components/motion/shared-layout-bg.js +2 -2
  148. package/dist/components/motion/shared-layout-bg.js.map +1 -1
  149. package/dist/components/motion/slide-action-button.js +1 -1
  150. package/dist/components/motion/smooth-scroll.js +1 -1
  151. package/dist/components/motion/swipeable-list.d.ts +60 -0
  152. package/dist/components/motion/swipeable-list.d.ts.map +1 -0
  153. package/dist/components/motion/swipeable-list.js +254 -0
  154. package/dist/components/motion/swipeable-list.js.map +1 -0
  155. package/dist/components/motion/switch.js +1 -1
  156. package/dist/components/motion/table/index.js +1 -1
  157. package/dist/components/motion/table/row-handle.js +1 -1
  158. package/dist/components/motion/table/table-header.js +2 -2
  159. package/dist/components/motion/table/table-menu.js +1 -1
  160. package/dist/components/motion/tabs.js +1 -1
  161. package/dist/components/motion/text-reveal.js +1 -1
  162. package/dist/components/motion/text-shimmer.js +1 -1
  163. package/dist/components/motion/text-shimmer.js.map +1 -1
  164. package/dist/components/motion/theme-toggle.js +2 -2
  165. package/dist/components/motion/tilt-card.js +1 -1
  166. package/dist/components/motion/tooltip.js +1 -1
  167. package/dist/components/motion/wheel-picker.js +1 -1
  168. package/dist/components/reui/alert.d.ts +1 -1
  169. package/dist/components/reui/alert.js +1 -1
  170. package/dist/components/reui/autocomplete.js +1 -1
  171. package/dist/components/reui/badge.d.ts +1 -1
  172. package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
  173. package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
  174. package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
  175. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
  176. package/dist/components/reui/data-grid/data-grid-table-dnd.js +1 -1
  177. package/dist/components/reui/data-grid/data-grid-table.js +1 -1
  178. package/dist/components/reui/date-selector.js +2 -2
  179. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
  180. package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
  181. package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
  182. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  183. package/dist/components/reui/filters.js +2 -2
  184. package/dist/components/reui/frame.d.ts +1 -1
  185. package/dist/components/reui/frame.js +1 -1
  186. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  187. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  188. package/dist/components/reui/gantt/gantt-view.js +2 -2
  189. package/dist/components/reui/number-field.js +1 -1
  190. package/dist/components/reui/phone-input.js +2 -2
  191. package/dist/components/reui/rating.js +1 -1
  192. package/dist/components/reui/tree.js +1 -1
  193. package/dist/components/ui/accordion.js +1 -1
  194. package/dist/components/ui/alert-dialog.js +1 -1
  195. package/dist/components/ui/alert.js +1 -1
  196. package/dist/components/ui/attachment.d.ts +1 -1
  197. package/dist/components/ui/attachment.js +1 -1
  198. package/dist/components/ui/badge.d.ts +1 -1
  199. package/dist/components/ui/breadcrumb.js +1 -1
  200. package/dist/components/ui/bubble.d.ts +1 -1
  201. package/dist/components/ui/bubble.js +1 -1
  202. package/dist/components/ui/button-group.d.ts +1 -1
  203. package/dist/components/ui/button-group.js +1 -1
  204. package/dist/components/ui/button.d.ts +2 -2
  205. package/dist/components/ui/button.js +2 -2
  206. package/dist/components/ui/calendar.js +1 -1
  207. package/dist/components/ui/carousel.js +1 -1
  208. package/dist/components/ui/checkbox.js +1 -1
  209. package/dist/components/ui/combobox.js +1 -1
  210. package/dist/components/ui/command.js +1 -1
  211. package/dist/components/ui/context-menu.js +1 -1
  212. package/dist/components/ui/dialog.js +1 -1
  213. package/dist/components/ui/dropdown-menu.js +1 -1
  214. package/dist/components/ui/empty.js +1 -1
  215. package/dist/components/ui/field.d.ts +1 -1
  216. package/dist/components/ui/field.js +1 -1
  217. package/dist/components/ui/input-group.js +1 -1
  218. package/dist/components/ui/input-otp.js +1 -1
  219. package/dist/components/ui/item.d.ts +2 -2
  220. package/dist/components/ui/item.js +1 -1
  221. package/dist/components/ui/marker.d.ts +1 -1
  222. package/dist/components/ui/marker.js +1 -1
  223. package/dist/components/ui/menubar.js +1 -1
  224. package/dist/components/ui/message-scroller.js +1 -1
  225. package/dist/components/ui/native-select.js +1 -1
  226. package/dist/components/ui/navigation-menu.js +1 -1
  227. package/dist/components/ui/pagination.js +1 -1
  228. package/dist/components/ui/select.js +1 -1
  229. package/dist/components/ui/sheet.js +1 -1
  230. package/dist/components/ui/sidebar.d.ts +1 -1
  231. package/dist/components/ui/sidebar.js +1 -1
  232. package/dist/components/ui/sonner.js +1 -1
  233. package/dist/components/ui/spinner.js +1 -1
  234. package/dist/components/ui/tabs.js +1 -1
  235. package/dist/components/ui/toast.js +1 -1
  236. package/dist/components/ui/toggle.d.ts +1 -1
  237. package/dist/components/ui/toggle.js +1 -1
  238. package/dist/copy-menu-BJ-MXnkN.js +201 -0
  239. package/dist/copy-menu-BJ-MXnkN.js.map +1 -0
  240. package/dist/types-smkWN_7x.d.ts +20 -0
  241. package/dist/types-smkWN_7x.d.ts.map +1 -0
  242. package/package.json +2 -2
@@ -0,0 +1,413 @@
1
+ "use client";
2
+ import { EASE_OUT } from "../../lib/ease.js";
3
+ import { Button } from "./button/base.js";
4
+ import { StatefulButton } from "./button/stateful.js";
5
+ import "./button/index.js";
6
+ import { useCallback, useEffect, useRef, useState } from "react";
7
+ import { cn } from "@kumix/utils";
8
+ import { AlertCircle, MessageSquare, X } from "lucide-react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { AnimatePresence, motion, useReducedMotion } from "motion/react";
11
+ //#region src/components/motion/feedback-widget.tsx
12
+ const SUCCESS_DURATION_MS = 1600;
13
+ const MORPH_OPEN_EASE = [
14
+ .34,
15
+ 1.25,
16
+ .64,
17
+ 1
18
+ ];
19
+ const MORPH_CLOSE_EASE = [
20
+ .22,
21
+ 1,
22
+ .36,
23
+ 1
24
+ ];
25
+ const MORPH_OPEN_DURATION = .4;
26
+ const MORPH_CLOSE_DURATION = .28;
27
+ const MORPH_FADE_DURATION = .22;
28
+ const MORPH_SLIDE = 40;
29
+ const MORPH_SCALE = .97;
30
+ const MORPH_BLUR = "blur(2px)";
31
+ const SPRINKLES = Array.from({ length: 8 }, (_, i) => {
32
+ const angle = i / 8 * Math.PI * 2;
33
+ return {
34
+ x: Math.cos(angle) * 26,
35
+ y: Math.sin(angle) * 26,
36
+ color: i % 2 === 0 ? "var(--color-success)" : "var(--accent)"
37
+ };
38
+ });
39
+ function FeedbackWidget({ onSubmit, position = "bottom-right", title = "Help us improve", placeholder = "Share an idea or report a bug", icon, className }) {
40
+ const reduce = useReducedMotion();
41
+ const rootRef = useRef(null);
42
+ const textareaRef = useRef(null);
43
+ const closeTimerRef = useRef(null);
44
+ const [status, setStatus] = useState("idle");
45
+ const [message, setMessage] = useState("");
46
+ const open = status !== "idle";
47
+ const busy = status === "sending";
48
+ const clearCloseTimer = useCallback(() => {
49
+ if (closeTimerRef.current === null) return;
50
+ clearTimeout(closeTimerRef.current);
51
+ closeTimerRef.current = null;
52
+ }, []);
53
+ const close = useCallback(() => {
54
+ clearCloseTimer();
55
+ setStatus("idle");
56
+ setMessage("");
57
+ }, [clearCloseTimer]);
58
+ useEffect(() => () => {
59
+ if (closeTimerRef.current !== null) clearTimeout(closeTimerRef.current);
60
+ }, []);
61
+ useEffect(() => {
62
+ if (status !== "open") return;
63
+ const timer = window.setTimeout(() => textareaRef.current?.focus(), reduce ? 0 : MORPH_OPEN_DURATION * 1e3);
64
+ return () => window.clearTimeout(timer);
65
+ }, [status, reduce]);
66
+ useEffect(() => {
67
+ if (!open) return;
68
+ const onKey = (e) => {
69
+ if (e.key === "Escape" && !busy) close();
70
+ };
71
+ const onPointer = (e) => {
72
+ if (!busy && rootRef.current && !rootRef.current.contains(e.target)) close();
73
+ };
74
+ window.addEventListener("keydown", onKey);
75
+ window.addEventListener("pointerdown", onPointer);
76
+ return () => {
77
+ window.removeEventListener("keydown", onKey);
78
+ window.removeEventListener("pointerdown", onPointer);
79
+ };
80
+ }, [
81
+ open,
82
+ busy,
83
+ close
84
+ ]);
85
+ const scheduleSuccessClose = () => {
86
+ clearCloseTimer();
87
+ closeTimerRef.current = setTimeout(close, SUCCESS_DURATION_MS);
88
+ };
89
+ const submit = async () => {
90
+ if (busy || message.trim().length === 0) return;
91
+ setStatus("sending");
92
+ try {
93
+ await onSubmit?.({ message });
94
+ setStatus("sent");
95
+ scheduleSuccessClose();
96
+ } catch {
97
+ setStatus("error");
98
+ }
99
+ };
100
+ const left = position === "bottom-left";
101
+ const contentOffset = left ? -40 : MORPH_SLIDE;
102
+ const surfaceTransition = reduce ? { duration: 0 } : {
103
+ layout: {
104
+ duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,
105
+ ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE
106
+ },
107
+ borderRadius: {
108
+ duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,
109
+ ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE
110
+ }
111
+ };
112
+ const contentTransition = reduce ? { duration: 0 } : {
113
+ opacity: {
114
+ duration: MORPH_FADE_DURATION,
115
+ ease: MORPH_CLOSE_EASE
116
+ },
117
+ x: {
118
+ duration: MORPH_OPEN_DURATION,
119
+ ease: MORPH_CLOSE_EASE
120
+ },
121
+ scale: {
122
+ duration: MORPH_OPEN_DURATION,
123
+ ease: MORPH_CLOSE_EASE
124
+ },
125
+ filter: {
126
+ duration: MORPH_FADE_DURATION,
127
+ ease: MORPH_CLOSE_EASE
128
+ },
129
+ rotate: {
130
+ duration: MORPH_OPEN_DURATION,
131
+ ease: MORPH_CLOSE_EASE
132
+ }
133
+ };
134
+ const viewInitial = reduce ? { opacity: 0 } : {
135
+ opacity: 0,
136
+ y: 8,
137
+ filter: "blur(4px)"
138
+ };
139
+ const viewAnimate = reduce ? {
140
+ opacity: 1,
141
+ transition: {
142
+ duration: .18,
143
+ ease: EASE_OUT
144
+ }
145
+ } : {
146
+ opacity: 1,
147
+ y: 0,
148
+ filter: "blur(0px)",
149
+ transition: {
150
+ duration: .24,
151
+ ease: EASE_OUT
152
+ }
153
+ };
154
+ const viewExit = reduce ? {
155
+ opacity: 0,
156
+ transition: {
157
+ duration: .14,
158
+ ease: EASE_OUT
159
+ }
160
+ } : {
161
+ opacity: 0,
162
+ y: -8,
163
+ filter: "blur(4px)",
164
+ transition: {
165
+ duration: .16,
166
+ ease: EASE_OUT
167
+ }
168
+ };
169
+ return /* @__PURE__ */ jsx("div", {
170
+ ref: rootRef,
171
+ className: cn("pointer-events-none absolute bottom-4 z-30", left ? "left-4" : "right-4", className),
172
+ children: /* @__PURE__ */ jsx(motion.div, {
173
+ layout: true,
174
+ animate: { borderRadius: open ? 20 : 40 },
175
+ transition: surfaceTransition,
176
+ style: { transformOrigin: left ? "bottom left" : "bottom right" },
177
+ className: cn("pointer-events-auto absolute bottom-0 overflow-hidden border border-border bg-background text-foreground shadow-lg", open ? "w-[min(86vw,320px)] p-2" : "h-12 w-12 p-0", left ? "left-0" : "right-0"),
178
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
179
+ initial: false,
180
+ mode: "popLayout",
181
+ children: open ? /* @__PURE__ */ jsx(motion.div, {
182
+ initial: reduce ? { opacity: 0 } : {
183
+ opacity: 0,
184
+ x: contentOffset,
185
+ scale: MORPH_SCALE,
186
+ filter: MORPH_BLUR
187
+ },
188
+ animate: {
189
+ opacity: 1,
190
+ x: 0,
191
+ scale: 1,
192
+ filter: "blur(0px)"
193
+ },
194
+ exit: reduce ? { opacity: 0 } : {
195
+ opacity: 0,
196
+ x: contentOffset,
197
+ scale: MORPH_SCALE,
198
+ filter: MORPH_BLUR
199
+ },
200
+ transition: contentTransition,
201
+ children: /* @__PURE__ */ jsx(motion.div, {
202
+ layout: "position",
203
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
204
+ mode: "popLayout",
205
+ initial: false,
206
+ propagate: true,
207
+ children: status === "sent" ? /* @__PURE__ */ jsx(motion.div, {
208
+ initial: viewInitial,
209
+ animate: viewAnimate,
210
+ exit: viewExit,
211
+ children: /* @__PURE__ */ jsxs("div", {
212
+ className: "flex flex-col items-center justify-center gap-1.5 rounded-[20px] bg-border/60 px-4 py-6 text-center",
213
+ children: [
214
+ /* @__PURE__ */ jsxs("div", {
215
+ className: "relative mb-1 flex h-12 w-12 items-center justify-center",
216
+ children: [reduce ? null : SPRINKLES.map((s, i) => /* @__PURE__ */ jsx(motion.span, {
217
+ initial: {
218
+ opacity: 0,
219
+ scale: .4,
220
+ x: 0,
221
+ y: 0
222
+ },
223
+ animate: {
224
+ opacity: [
225
+ 0,
226
+ 1,
227
+ 0
228
+ ],
229
+ scale: [
230
+ 0,
231
+ 1,
232
+ .4
233
+ ],
234
+ x: s.x,
235
+ y: s.y
236
+ },
237
+ transition: {
238
+ duration: .6,
239
+ delay: .18 + i * .02,
240
+ ease: "easeOut"
241
+ },
242
+ style: { backgroundColor: s.color },
243
+ className: "absolute h-1.5 w-1.5 rounded-full"
244
+ }, `${s.x}-${s.y}`)), /* @__PURE__ */ jsx(motion.div, {
245
+ initial: reduce ? { scale: 1 } : { scale: 0 },
246
+ animate: { scale: 1 },
247
+ transition: {
248
+ type: "spring",
249
+ stiffness: 500,
250
+ damping: 22,
251
+ delay: .04
252
+ },
253
+ className: "flex h-12 w-12 items-center justify-center rounded-full bg-(--color-success)",
254
+ children: /* @__PURE__ */ jsx(motion.svg, {
255
+ viewBox: "0 0 24 24",
256
+ fill: "none",
257
+ className: "h-5 w-5 text-white",
258
+ children: /* @__PURE__ */ jsx(motion.path, {
259
+ d: "M5 12.5l4.5 4.5L19 7.5",
260
+ stroke: "currentColor",
261
+ strokeWidth: 2.5,
262
+ strokeLinecap: "round",
263
+ strokeLinejoin: "round",
264
+ initial: reduce ? { pathLength: 1 } : { pathLength: 0 },
265
+ animate: { pathLength: 1 },
266
+ transition: {
267
+ duration: .35,
268
+ ease: "easeOut",
269
+ delay: .15
270
+ }
271
+ })
272
+ })
273
+ })]
274
+ }),
275
+ /* @__PURE__ */ jsx("h3", {
276
+ className: "font-semibold text-foreground text-sm",
277
+ children: "Thanks!"
278
+ }),
279
+ /* @__PURE__ */ jsx("p", {
280
+ className: "text-muted-foreground text-xs leading-relaxed",
281
+ children: "Your feedback helps us build something better."
282
+ })
283
+ ]
284
+ })
285
+ }, "sent") : status === "error" ? /* @__PURE__ */ jsx(motion.div, {
286
+ initial: viewInitial,
287
+ animate: viewAnimate,
288
+ exit: viewExit,
289
+ children: /* @__PURE__ */ jsxs("div", {
290
+ role: "alert",
291
+ className: "rounded-[20px] bg-border/60 px-4 py-5 text-center",
292
+ children: [
293
+ /* @__PURE__ */ jsx("div", {
294
+ className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 text-destructive",
295
+ children: /* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5" })
296
+ }),
297
+ /* @__PURE__ */ jsx("h3", {
298
+ className: "mt-3 font-semibold text-foreground text-sm",
299
+ children: "Something went wrong"
300
+ }),
301
+ /* @__PURE__ */ jsx("p", {
302
+ className: "mt-1 text-muted-foreground text-xs leading-relaxed",
303
+ children: "We couldn't send your feedback. Please try again."
304
+ }),
305
+ /* @__PURE__ */ jsx(Button, {
306
+ size: "sm",
307
+ onClick: submit,
308
+ className: "mt-4",
309
+ children: "Try again"
310
+ })
311
+ ]
312
+ })
313
+ }, "error") : /* @__PURE__ */ jsxs(motion.div, {
314
+ initial: viewInitial,
315
+ animate: viewAnimate,
316
+ exit: viewExit,
317
+ children: [/* @__PURE__ */ jsxs("div", {
318
+ className: "min-h-[150px] rounded-[20px] bg-border/60 px-4 py-3.5",
319
+ children: [/* @__PURE__ */ jsxs("div", {
320
+ className: "flex items-start justify-between gap-3",
321
+ children: [/* @__PURE__ */ jsx("h3", {
322
+ className: "font-semibold text-foreground text-sm",
323
+ children: title
324
+ }), /* @__PURE__ */ jsx("button", {
325
+ type: "button",
326
+ onClick: close,
327
+ "aria-label": "Close",
328
+ className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-foreground/[0.07] text-muted-foreground transition-colors hover:text-foreground",
329
+ children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
330
+ })]
331
+ }), /* @__PURE__ */ jsx("textarea", {
332
+ ref: textareaRef,
333
+ value: message,
334
+ onChange: (e) => setMessage(e.target.value),
335
+ placeholder,
336
+ disabled: busy,
337
+ rows: 3,
338
+ className: "mt-2 w-full resize-none bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground/60 md:text-sm"
339
+ })]
340
+ }), /* @__PURE__ */ jsxs("div", {
341
+ className: "flex items-center gap-2 px-1 pt-2 pb-1",
342
+ children: [/* @__PURE__ */ jsx(Button, {
343
+ variant: "secondary",
344
+ size: "md",
345
+ onClick: close,
346
+ disabled: busy,
347
+ className: "flex-1 bg-border text-muted-foreground hover:text-foreground",
348
+ children: "Cancel"
349
+ }), /* @__PURE__ */ jsx(StatefulButton, {
350
+ state: busy ? "loading" : "idle",
351
+ loadingText: "Sending",
352
+ size: "md",
353
+ onClick: submit,
354
+ disabled: busy || message.trim().length === 0,
355
+ className: "flex-1 bg-foreground text-background hover:bg-foreground/90",
356
+ children: "Submit"
357
+ })]
358
+ })]
359
+ }, "form")
360
+ })
361
+ })
362
+ }, "panel") : /* @__PURE__ */ jsx(motion.button, {
363
+ type: "button",
364
+ initial: reduce ? { opacity: 0 } : {
365
+ opacity: 0,
366
+ x: -contentOffset,
367
+ filter: MORPH_BLUR
368
+ },
369
+ animate: {
370
+ opacity: 1,
371
+ x: 0,
372
+ filter: "blur(0px)"
373
+ },
374
+ exit: reduce ? { opacity: 0 } : {
375
+ opacity: 0,
376
+ x: -contentOffset,
377
+ filter: MORPH_BLUR
378
+ },
379
+ transition: contentTransition,
380
+ onClick: () => {
381
+ clearCloseTimer();
382
+ setStatus("open");
383
+ },
384
+ "aria-label": title,
385
+ "aria-haspopup": "dialog",
386
+ whileTap: reduce ? void 0 : { scale: .92 },
387
+ className: cn("absolute bottom-0 flex h-12 w-12 items-center justify-center bg-transparent text-foreground", left ? "left-0" : "right-0"),
388
+ children: /* @__PURE__ */ jsx(motion.span, {
389
+ initial: reduce ? false : {
390
+ rotate: 45,
391
+ scale: MORPH_SCALE
392
+ },
393
+ animate: {
394
+ rotate: 0,
395
+ scale: 1
396
+ },
397
+ exit: {
398
+ rotate: 45,
399
+ scale: MORPH_SCALE
400
+ },
401
+ transition: contentTransition,
402
+ className: "grid h-5 w-5 shrink-0 place-items-center [&>svg]:h-full [&>svg]:w-full",
403
+ children: icon ?? /* @__PURE__ */ jsx(MessageSquare, { className: "h-5 w-5" })
404
+ })
405
+ }, "trigger")
406
+ })
407
+ })
408
+ });
409
+ }
410
+ //#endregion
411
+ export { FeedbackWidget };
412
+
413
+ //# sourceMappingURL=feedback-widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback-widget.js","names":[],"sources":["../../../src/components/motion/feedback-widget.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { AlertCircle, MessageSquare, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { Button, StatefulButton } from \"./button\";\n\ntype Status = \"idle\" | \"open\" | \"sending\" | \"sent\" | \"error\";\n\nconst SUCCESS_DURATION_MS = 1600;\n\n// The trigger grows into the panel with a slight overshoot on open, then uses\n// a calmer curve on close so dismissing feels faster and less prominent.\nconst MORPH_OPEN_EASE = [0.34, 1.25, 0.64, 1] as const;\nconst MORPH_CLOSE_EASE = [0.22, 1, 0.36, 1] as const;\nconst MORPH_OPEN_DURATION = 0.4;\nconst MORPH_CLOSE_DURATION = 0.28;\nconst MORPH_FADE_DURATION = 0.22;\nconst MORPH_SLIDE = 40;\nconst MORPH_SCALE = 0.97;\nconst MORPH_BLUR = \"blur(2px)\";\n\n// Celebration sprinkles that burst from the success icon.\nconst SPRINKLES = Array.from({ length: 8 }, (_, i) => {\n const angle = (i / 8) * Math.PI * 2;\n return {\n x: Math.cos(angle) * 26,\n y: Math.sin(angle) * 26,\n color: i % 2 === 0 ? \"var(--color-success)\" : \"var(--accent)\",\n };\n});\n\nexport interface FeedbackData {\n message: string;\n}\n\nexport interface FeedbackWidgetProps {\n /** Called on submit. May be async; the button shows a sending state until it resolves. */\n onSubmit?: (data: FeedbackData) => void | Promise<void>;\n position?: \"bottom-right\" | \"bottom-left\";\n title?: string;\n placeholder?: string;\n icon?: ReactNode;\n className?: string;\n}\n\nexport function FeedbackWidget({\n onSubmit,\n position = \"bottom-right\",\n title = \"Help us improve\",\n placeholder = \"Share an idea or report a bug\",\n icon,\n className,\n}: FeedbackWidgetProps) {\n const reduce = useReducedMotion();\n const rootRef = useRef<HTMLDivElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const [status, setStatus] = useState<Status>(\"idle\");\n const [message, setMessage] = useState(\"\");\n\n const open = status !== \"idle\";\n const busy = status === \"sending\";\n\n const clearCloseTimer = useCallback(() => {\n if (closeTimerRef.current === null) return;\n clearTimeout(closeTimerRef.current);\n closeTimerRef.current = null;\n }, []);\n\n const close = useCallback(() => {\n clearCloseTimer();\n setStatus(\"idle\");\n setMessage(\"\");\n }, [clearCloseTimer]);\n\n useEffect(\n () => () => {\n if (closeTimerRef.current !== null) {\n clearTimeout(closeTimerRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (status !== \"open\") return;\n\n // Match the wallet account switcher's staged interaction: focusing while\n // the surface is still expanding makes the caret and focus state appear\n // inside a scaled panel. Arm the field once the open morph has settled.\n const timer = window.setTimeout(\n () => textareaRef.current?.focus(),\n reduce ? 0 : MORPH_OPEN_DURATION * 1000,\n );\n return () => window.clearTimeout(timer);\n }, [status, reduce]);\n\n // Dismiss on escape or outside click while open (but not mid-send).\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\" && !busy) close();\n };\n const onPointer = (e: PointerEvent) => {\n if (!busy && rootRef.current && !rootRef.current.contains(e.target as Node)) {\n close();\n }\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, busy, close]);\n\n const scheduleSuccessClose = () => {\n clearCloseTimer();\n closeTimerRef.current = setTimeout(close, SUCCESS_DURATION_MS);\n };\n\n const submit = async () => {\n if (busy || message.trim().length === 0) return;\n setStatus(\"sending\");\n try {\n await onSubmit?.({ message });\n setStatus(\"sent\");\n scheduleSuccessClose();\n } catch {\n // Preserve the message so a rejected submission can be retried.\n setStatus(\"error\");\n }\n };\n\n const left = position === \"bottom-left\";\n const contentOffset = left ? -MORPH_SLIDE : MORPH_SLIDE;\n const surfaceTransition = reduce\n ? { duration: 0 }\n : {\n layout: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n borderRadius: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n };\n const contentTransition = reduce\n ? { duration: 0 }\n : {\n opacity: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n x: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n scale: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n filter: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n rotate: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n };\n const viewInitial = reduce ? { opacity: 0 } : { opacity: 0, y: 8, filter: \"blur(4px)\" };\n const viewAnimate = reduce\n ? {\n opacity: 1,\n transition: { duration: 0.18, ease: EASE_OUT },\n }\n : {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: { duration: 0.24, ease: EASE_OUT },\n };\n const viewExit = reduce\n ? {\n opacity: 0,\n transition: { duration: 0.14, ease: EASE_OUT },\n }\n : {\n opacity: 0,\n y: -8,\n filter: \"blur(4px)\",\n transition: { duration: 0.16, ease: EASE_OUT },\n };\n\n return (\n <div\n ref={rootRef}\n className={cn(\n \"pointer-events-none absolute bottom-4 z-30\",\n left ? \"left-4\" : \"right-4\",\n className,\n )}\n >\n {/* One persistent shell grows out of the corner trigger. The shell and\n its contents use separate timing so the surface leads the reveal. */}\n <motion.div\n layout\n animate={{ borderRadius: open ? 20 : 40 }}\n transition={surfaceTransition}\n style={{ transformOrigin: left ? \"bottom left\" : \"bottom right\" }}\n className={cn(\n \"pointer-events-auto absolute bottom-0 overflow-hidden border border-border bg-background text-foreground shadow-lg\",\n open ? \"w-[min(86vw,320px)] p-2\" : \"h-12 w-12 p-0\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? (\n <motion.div\n key=\"panel\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, scale: 1, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n >\n <motion.div layout=\"position\">\n <AnimatePresence mode=\"popLayout\" initial={false} propagate>\n {status === \"sent\" ? (\n <motion.div\n key=\"sent\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"flex flex-col items-center justify-center gap-1.5 rounded-[20px] bg-border/60 px-4 py-6 text-center\">\n <div className=\"relative mb-1 flex h-12 w-12 items-center justify-center\">\n {reduce\n ? null\n : SPRINKLES.map((s, i) => (\n <motion.span\n key={`${s.x}-${s.y}`}\n initial={{ opacity: 0, scale: 0.4, x: 0, y: 0 }}\n animate={{\n opacity: [0, 1, 0],\n scale: [0, 1, 0.4],\n x: s.x,\n y: s.y,\n }}\n transition={{\n duration: 0.6,\n delay: 0.18 + i * 0.02,\n ease: \"easeOut\",\n }}\n style={{ backgroundColor: s.color }}\n className=\"absolute h-1.5 w-1.5 rounded-full\"\n />\n ))}\n <motion.div\n initial={reduce ? { scale: 1 } : { scale: 0 }}\n animate={{ scale: 1 }}\n transition={{\n type: \"spring\",\n stiffness: 500,\n damping: 22,\n delay: 0.04,\n }}\n className=\"flex h-12 w-12 items-center justify-center rounded-full bg-(--color-success)\"\n >\n <motion.svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n className=\"h-5 w-5 text-white\"\n >\n <motion.path\n d=\"M5 12.5l4.5 4.5L19 7.5\"\n stroke=\"currentColor\"\n strokeWidth={2.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n initial={reduce ? { pathLength: 1 } : { pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={{\n duration: 0.35,\n ease: \"easeOut\",\n delay: 0.15,\n }}\n />\n </motion.svg>\n </motion.div>\n </div>\n <h3 className=\"font-semibold text-foreground text-sm\">Thanks!</h3>\n <p className=\"text-muted-foreground text-xs leading-relaxed\">\n Your feedback helps us build something better.\n </p>\n </div>\n </motion.div>\n ) : status === \"error\" ? (\n <motion.div\n key=\"error\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div\n role=\"alert\"\n className=\"rounded-[20px] bg-border/60 px-4 py-5 text-center\"\n >\n <div className=\"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 text-destructive\">\n <AlertCircle className=\"h-5 w-5\" />\n </div>\n <h3 className=\"mt-3 font-semibold text-foreground text-sm\">\n Something went wrong\n </h3>\n <p className=\"mt-1 text-muted-foreground text-xs leading-relaxed\">\n We couldn&apos;t send your feedback. Please try again.\n </p>\n <Button size=\"sm\" onClick={submit} className=\"mt-4\">\n Try again\n </Button>\n </div>\n </motion.div>\n ) : (\n <motion.div\n key=\"form\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"min-h-[150px] rounded-[20px] bg-border/60 px-4 py-3.5\">\n <div className=\"flex items-start justify-between gap-3\">\n <h3 className=\"font-semibold text-foreground text-sm\">{title}</h3>\n <button\n type=\"button\"\n onClick={close}\n aria-label=\"Close\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-foreground/[0.07] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <X className=\"h-3 w-3\" />\n </button>\n </div>\n <textarea\n ref={textareaRef}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n placeholder={placeholder}\n disabled={busy}\n rows={3}\n className=\"mt-2 w-full resize-none bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground/60 md:text-sm\"\n />\n </div>\n\n <div className=\"flex items-center gap-2 px-1 pt-2 pb-1\">\n <Button\n variant=\"secondary\"\n size=\"md\"\n onClick={close}\n disabled={busy}\n className=\"flex-1 bg-border text-muted-foreground hover:text-foreground\"\n >\n Cancel\n </Button>\n <StatefulButton\n state={busy ? \"loading\" : \"idle\"}\n loadingText=\"Sending\"\n size=\"md\"\n onClick={submit}\n disabled={busy || message.trim().length === 0}\n className=\"flex-1 bg-foreground text-background hover:bg-foreground/90\"\n >\n Submit\n </StatefulButton>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </motion.div>\n </motion.div>\n ) : (\n <motion.button\n key=\"trigger\"\n type=\"button\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n onClick={() => {\n clearCloseTimer();\n setStatus(\"open\");\n }}\n aria-label={title}\n aria-haspopup=\"dialog\"\n whileTap={reduce ? undefined : { scale: 0.92 }}\n className={cn(\n \"absolute bottom-0 flex h-12 w-12 items-center justify-center bg-transparent text-foreground\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <motion.span\n initial={reduce ? false : { rotate: 45, scale: MORPH_SCALE }}\n animate={{ rotate: 0, scale: 1 }}\n exit={{ rotate: 45, scale: MORPH_SCALE }}\n transition={contentTransition}\n className=\"grid h-5 w-5 shrink-0 place-items-center [&>svg]:h-full [&>svg]:w-full\"\n >\n {icon ?? <MessageSquare className=\"h-5 w-5\" />}\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n </motion.div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,sBAAsB;AAI5B,MAAM,kBAAkB;CAAC;CAAM;CAAM;CAAM;AAAC;AAC5C,MAAM,mBAAmB;CAAC;CAAM;CAAG;CAAM;AAAC;AAC1C,MAAM,sBAAsB;AAC5B,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,MAAM,aAAa;AAGnB,MAAM,YAAY,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM;CACpD,MAAM,QAAS,IAAI,IAAK,KAAK,KAAK;CAClC,OAAO;EACL,GAAG,KAAK,IAAI,KAAK,IAAI;EACrB,GAAG,KAAK,IAAI,KAAK,IAAI;EACrB,OA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AAM;KAClB;KACA,cAAY;KACZ,iBAAc;KACd,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;KAC7C,WAAW,GACT,+FACA,OAAO,WAAW,SACpB;KAEA,UAAA,oBAAC,OAAO,MAAR;MACE,SAAS,SAAS,QAAQ;OAAE,QAAQ;OAAI,OAAO;MAAY;MAC3D,SAAS;OAAE,QAAQ;OAAG,OAAO;MAAE;MAC/B,MAAM;OAAE,QAAQ;OAAI,OAAO;MAAY;MACvC,YAAY;MACZ,WAAU;MAET,UAAA,QAAQ,oBAAC,eAAD,EAAe,WAAU,UAAW,CAAA;KAClC,CAAA;IACA,GA3CT,SA2CS;GAEF,CAAA;EACP,CAAA;CACT,CAAA;AAET"}
@@ -0,0 +1,48 @@
1
+ //#region src/components/motion/file-upload.d.ts
2
+ type FileUploadStatus = "queued" | "uploading" | "success" | "error";
3
+ type FileUploadVariant = "default" | "centered";
4
+ type FileUploadItem = {
5
+ id: string;
6
+ name: string;
7
+ size: number;
8
+ type?: string;
9
+ progress?: number;
10
+ status?: FileUploadStatus;
11
+ error?: string;
12
+ file?: File;
13
+ };
14
+ type FileUploadClassNames = {
15
+ root?: string;
16
+ dropzone?: string;
17
+ queue?: string;
18
+ item?: string;
19
+ leading?: string;
20
+ content?: string;
21
+ name?: string;
22
+ meta?: string;
23
+ progress?: string;
24
+ action?: string;
25
+ };
26
+ interface FileUploadProps {
27
+ value?: FileUploadItem[];
28
+ defaultValue?: FileUploadItem[];
29
+ onValueChange?: (items: FileUploadItem[]) => void;
30
+ onFilesAdded?: (items: FileUploadItem[], files: File[]) => void;
31
+ onRemove?: (item: FileUploadItem) => void;
32
+ onRetry?: (item: FileUploadItem) => void;
33
+ accept?: string;
34
+ multiple?: boolean;
35
+ maxFiles?: number;
36
+ disabled?: boolean;
37
+ variant?: FileUploadVariant;
38
+ title?: string;
39
+ description?: string;
40
+ browseLabel?: string;
41
+ className?: string;
42
+ classNames?: FileUploadClassNames;
43
+ }
44
+ declare function createFileUploadItem(file: File, index?: number): FileUploadItem;
45
+ declare function FileUpload({ value, defaultValue, onValueChange, onFilesAdded, onRemove, onRetry, accept, multiple, maxFiles, disabled, variant, title, description, browseLabel, className, classNames }: FileUploadProps): import("react").JSX.Element;
46
+ //#endregion
47
+ export { FileUpload, FileUploadClassNames, FileUploadItem, FileUploadProps, FileUploadStatus, FileUploadVariant, createFileUploadItem };
48
+ //# sourceMappingURL=file-upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload.d.ts","names":[],"sources":["../../../src/components/motion/file-upload.tsx"],"mappings":";KAwBY;KACA;KAEA;EACV;EACA;EACA;EACA;EACA;EACA,SAAS;EACT;EACA,OAAO;;KAGG;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf,QAAQ;EACR,eAAe;EACf,iBAAiB,OAAO;EACxB,gBAAgB,OAAO,kBAAkB,OAAO;EAChD,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA,aAAa;;iBAgHC,qBAAqB,MAAM,MAAM,iBAAY;iBA0J7C,aACd,OACA,cACA,eACA,cACA,UACA,SACA,QACA,UACA,UACA,UACA,SACA,OACA,aACA,aACA,WACA,cACC,kCAAe,IAAA"}