seppia 0.0.0-stage → 0.1.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 (252) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -3
  3. package/dist/chunk-2PABDSNH.cjs +208 -0
  4. package/dist/chunk-2Z4YKJMT.js +329 -0
  5. package/dist/chunk-344MRWFO.js +25 -0
  6. package/dist/chunk-3A2LHCPV.cjs +30 -0
  7. package/dist/chunk-3NQ776G6.cjs +204 -0
  8. package/dist/chunk-3XIEBFVO.cjs +130 -0
  9. package/dist/chunk-4IHNW52F.cjs +197 -0
  10. package/dist/chunk-4YGBUMQC.js +160 -0
  11. package/dist/chunk-5ARTY5RT.cjs +66 -0
  12. package/dist/chunk-5PAJS63K.cjs +156 -0
  13. package/dist/chunk-5Z32CAHE.cjs +261 -0
  14. package/dist/chunk-66ITQTT2.js +108 -0
  15. package/dist/chunk-6EABLOB7.js +190 -0
  16. package/dist/chunk-6FF73V3S.js +190 -0
  17. package/dist/chunk-6LRDNOZX.cjs +138 -0
  18. package/dist/chunk-76MEQHGW.js +192 -0
  19. package/dist/chunk-7B2YEOYF.js +26 -0
  20. package/dist/chunk-7Y22U2ZF.js +370 -0
  21. package/dist/chunk-AFGJQET4.js +186 -0
  22. package/dist/chunk-AG3OBSP5.cjs +216 -0
  23. package/dist/chunk-AHRXESD2.js +126 -0
  24. package/dist/chunk-AJPI65BL.cjs +153 -0
  25. package/dist/chunk-CCDDQHCS.js +182 -0
  26. package/dist/chunk-CGX6YCV6.js +130 -0
  27. package/dist/chunk-CPUW5LDN.cjs +28 -0
  28. package/dist/chunk-DAO7YH2R.cjs +165 -0
  29. package/dist/chunk-DO5WEBTN.cjs +139 -0
  30. package/dist/chunk-DUUDPN7C.cjs +203 -0
  31. package/dist/chunk-EOPY2VWT.cjs +185 -0
  32. package/dist/chunk-EUQ6BCML.cjs +175 -0
  33. package/dist/chunk-EYO4XMKU.js +145 -0
  34. package/dist/chunk-F7UECO7G.js +175 -0
  35. package/dist/chunk-FGJDDSUJ.js +303 -0
  36. package/dist/chunk-G5UZZ2XG.cjs +52 -0
  37. package/dist/chunk-GJ6WO63L.js +216 -0
  38. package/dist/chunk-GP32TY6P.cjs +409 -0
  39. package/dist/chunk-HQLB5Z37.cjs +275 -0
  40. package/dist/chunk-HSXGQNQ6.js +143 -0
  41. package/dist/chunk-I2XZ2WMY.js +385 -0
  42. package/dist/chunk-I525FOTN.cjs +214 -0
  43. package/dist/chunk-IAPRIVJO.js +157 -0
  44. package/dist/chunk-IUSSIILO.cjs +393 -0
  45. package/dist/chunk-JV6GJ3JJ.js +92 -0
  46. package/dist/chunk-KPG24YFL.js +30 -0
  47. package/dist/chunk-LGBMJIY6.js +174 -0
  48. package/dist/chunk-LYEOVFOQ.cjs +148 -0
  49. package/dist/chunk-LYYMITLC.js +238 -0
  50. package/dist/chunk-M42F5QS5.cjs +212 -0
  51. package/dist/chunk-NN3HMY7H.cjs +260 -0
  52. package/dist/chunk-NU5MGYFP.cjs +167 -0
  53. package/dist/chunk-OCIKUJ3U.js +117 -0
  54. package/dist/chunk-PBMXL53R.cjs +39 -0
  55. package/dist/chunk-PGEK6DFE.cjs +351 -0
  56. package/dist/chunk-QPWVBVDC.cjs +130 -0
  57. package/dist/chunk-QWYHH465.cjs +117 -0
  58. package/dist/chunk-RFCZJPGM.js +116 -0
  59. package/dist/chunk-RIBXHAKG.cjs +179 -0
  60. package/dist/chunk-SDWRKTFC.cjs +158 -0
  61. package/dist/chunk-SMY24MVU.js +92 -0
  62. package/dist/chunk-SSARMSS3.cjs +325 -0
  63. package/dist/chunk-T533JPW5.js +131 -0
  64. package/dist/chunk-T7AMVHIB.js +221 -0
  65. package/dist/chunk-TVGVZSIA.js +130 -0
  66. package/dist/chunk-UFU5S3LK.cjs +244 -0
  67. package/dist/chunk-UFUN2OKY.js +35 -0
  68. package/dist/chunk-VDSMO63G.cjs +153 -0
  69. package/dist/chunk-VHXWP5OX.cjs +115 -0
  70. package/dist/chunk-VW32EE3I.js +153 -0
  71. package/dist/chunk-WGFJLFTP.js +40 -0
  72. package/dist/chunk-WSL2OVTO.js +136 -0
  73. package/dist/chunk-WVWVJSU2.cjs +309 -0
  74. package/dist/chunk-XLZPYDNI.js +287 -0
  75. package/dist/chunk-XUBFOAT4.js +239 -0
  76. package/dist/chunk-Y3UCNSXF.js +253 -0
  77. package/dist/chunk-YDJMVDAJ.cjs +196 -0
  78. package/dist/chunk-ZF5HY2K4.cjs +238 -0
  79. package/dist/chunk-ZXKEYL6L.js +181 -0
  80. package/dist/chunk-ZZYMYQU2.js +108 -0
  81. package/dist/components/accordion.cjs +26 -0
  82. package/dist/components/accordion.d.cts +41 -0
  83. package/dist/components/accordion.d.ts +41 -0
  84. package/dist/components/accordion.js +5 -0
  85. package/dist/components/calendar.cjs +14 -0
  86. package/dist/components/calendar.d.cts +41 -0
  87. package/dist/components/calendar.d.ts +41 -0
  88. package/dist/components/calendar.js +5 -0
  89. package/dist/components/checkbox.cjs +14 -0
  90. package/dist/components/checkbox.d.cts +27 -0
  91. package/dist/components/checkbox.d.ts +27 -0
  92. package/dist/components/checkbox.js +5 -0
  93. package/dist/components/chip-select.cjs +14 -0
  94. package/dist/components/chip-select.d.cts +31 -0
  95. package/dist/components/chip-select.d.ts +31 -0
  96. package/dist/components/chip-select.js +5 -0
  97. package/dist/components/clock.cjs +12 -0
  98. package/dist/components/clock.d.cts +25 -0
  99. package/dist/components/clock.d.ts +25 -0
  100. package/dist/components/clock.js +3 -0
  101. package/dist/components/color-picker.cjs +14 -0
  102. package/dist/components/color-picker.d.cts +23 -0
  103. package/dist/components/color-picker.d.ts +23 -0
  104. package/dist/components/color-picker.js +5 -0
  105. package/dist/components/command-palette.cjs +20 -0
  106. package/dist/components/command-palette.d.cts +53 -0
  107. package/dist/components/command-palette.d.ts +53 -0
  108. package/dist/components/command-palette.js +7 -0
  109. package/dist/components/date-picker.cjs +18 -0
  110. package/dist/components/date-picker.d.cts +40 -0
  111. package/dist/components/date-picker.d.ts +40 -0
  112. package/dist/components/date-picker.js +9 -0
  113. package/dist/components/drawer.cjs +16 -0
  114. package/dist/components/drawer.d.cts +22 -0
  115. package/dist/components/drawer.d.ts +22 -0
  116. package/dist/components/drawer.js +7 -0
  117. package/dist/components/floating-panel.cjs +13 -0
  118. package/dist/components/floating-panel.d.cts +25 -0
  119. package/dist/components/floating-panel.d.ts +25 -0
  120. package/dist/components/floating-panel.js +4 -0
  121. package/dist/components/hold-button.cjs +13 -0
  122. package/dist/components/hold-button.d.cts +30 -0
  123. package/dist/components/hold-button.d.ts +30 -0
  124. package/dist/components/hold-button.js +4 -0
  125. package/dist/components/knob.cjs +15 -0
  126. package/dist/components/knob.d.cts +33 -0
  127. package/dist/components/knob.d.ts +33 -0
  128. package/dist/components/knob.js +6 -0
  129. package/dist/components/magnetic-button.cjs +13 -0
  130. package/dist/components/magnetic-button.d.cts +23 -0
  131. package/dist/components/magnetic-button.d.ts +23 -0
  132. package/dist/components/magnetic-button.js +4 -0
  133. package/dist/components/morph-button.cjs +13 -0
  134. package/dist/components/morph-button.d.cts +34 -0
  135. package/dist/components/morph-button.d.ts +34 -0
  136. package/dist/components/morph-button.js +4 -0
  137. package/dist/components/morph-dialog.cjs +32 -0
  138. package/dist/components/morph-dialog.d.cts +30 -0
  139. package/dist/components/morph-dialog.d.ts +30 -0
  140. package/dist/components/morph-dialog.js +7 -0
  141. package/dist/components/number-field.cjs +15 -0
  142. package/dist/components/number-field.d.cts +32 -0
  143. package/dist/components/number-field.d.ts +32 -0
  144. package/dist/components/number-field.js +6 -0
  145. package/dist/components/pin-input.cjs +14 -0
  146. package/dist/components/pin-input.d.cts +29 -0
  147. package/dist/components/pin-input.d.ts +29 -0
  148. package/dist/components/pin-input.js +5 -0
  149. package/dist/components/popover.cjs +16 -0
  150. package/dist/components/popover.d.cts +26 -0
  151. package/dist/components/popover.d.ts +26 -0
  152. package/dist/components/popover.js +7 -0
  153. package/dist/components/progress.cjs +17 -0
  154. package/dist/components/progress.d.cts +39 -0
  155. package/dist/components/progress.d.ts +39 -0
  156. package/dist/components/progress.js +4 -0
  157. package/dist/components/radial-menu.cjs +14 -0
  158. package/dist/components/radial-menu.d.cts +31 -0
  159. package/dist/components/radial-menu.d.ts +31 -0
  160. package/dist/components/radial-menu.js +5 -0
  161. package/dist/components/radio-group.cjs +14 -0
  162. package/dist/components/radio-group.d.cts +34 -0
  163. package/dist/components/radio-group.d.ts +34 -0
  164. package/dist/components/radio-group.js +5 -0
  165. package/dist/components/resizable-panels.cjs +18 -0
  166. package/dist/components/resizable-panels.d.cts +24 -0
  167. package/dist/components/resizable-panels.d.ts +24 -0
  168. package/dist/components/resizable-panels.js +5 -0
  169. package/dist/components/segmented-control.cjs +14 -0
  170. package/dist/components/segmented-control.d.cts +34 -0
  171. package/dist/components/segmented-control.d.ts +34 -0
  172. package/dist/components/segmented-control.js +5 -0
  173. package/dist/components/slider.cjs +15 -0
  174. package/dist/components/slider.d.cts +39 -0
  175. package/dist/components/slider.d.ts +39 -0
  176. package/dist/components/slider.js +6 -0
  177. package/dist/components/sortable-list.cjs +13 -0
  178. package/dist/components/sortable-list.d.cts +24 -0
  179. package/dist/components/sortable-list.d.ts +24 -0
  180. package/dist/components/sortable-list.js +4 -0
  181. package/dist/components/sparkline.cjs +14 -0
  182. package/dist/components/sparkline.d.cts +28 -0
  183. package/dist/components/sparkline.d.ts +28 -0
  184. package/dist/components/sparkline.js +5 -0
  185. package/dist/components/swipe-confirm.cjs +13 -0
  186. package/dist/components/swipe-confirm.d.cts +18 -0
  187. package/dist/components/swipe-confirm.d.ts +18 -0
  188. package/dist/components/swipe-confirm.js +4 -0
  189. package/dist/components/switch.cjs +15 -0
  190. package/dist/components/switch.d.cts +29 -0
  191. package/dist/components/switch.d.ts +29 -0
  192. package/dist/components/switch.js +6 -0
  193. package/dist/components/tabs.cjs +30 -0
  194. package/dist/components/tabs.d.cts +29 -0
  195. package/dist/components/tabs.d.ts +29 -0
  196. package/dist/components/tabs.js +5 -0
  197. package/dist/components/tether.cjs +16 -0
  198. package/dist/components/tether.d.cts +35 -0
  199. package/dist/components/tether.d.ts +35 -0
  200. package/dist/components/tether.js +3 -0
  201. package/dist/components/theme-switch.cjs +14 -0
  202. package/dist/components/theme-switch.d.cts +24 -0
  203. package/dist/components/theme-switch.d.ts +24 -0
  204. package/dist/components/theme-switch.js +5 -0
  205. package/dist/components/toaster.cjs +21 -0
  206. package/dist/components/toaster.d.cts +71 -0
  207. package/dist/components/toaster.d.ts +71 -0
  208. package/dist/components/toaster.js +4 -0
  209. package/dist/components/wheel-picker.cjs +15 -0
  210. package/dist/components/wheel-picker.d.cts +27 -0
  211. package/dist/components/wheel-picker.d.ts +27 -0
  212. package/dist/components/wheel-picker.js +6 -0
  213. package/dist/css/accordion.css +2 -0
  214. package/dist/css/base.css +2 -0
  215. package/dist/css/calendar.css +2 -0
  216. package/dist/css/checkbox.css +2 -0
  217. package/dist/css/chip-select.css +2 -0
  218. package/dist/css/clock.css +2 -0
  219. package/dist/css/color-picker.css +2 -0
  220. package/dist/css/command-palette.css +2 -0
  221. package/dist/css/date-picker.css +2 -0
  222. package/dist/css/drawer.css +2 -0
  223. package/dist/css/floating-panel.css +2 -0
  224. package/dist/css/hold-button.css +2 -0
  225. package/dist/css/knob.css +2 -0
  226. package/dist/css/magnetic-button.css +2 -0
  227. package/dist/css/morph-button.css +2 -0
  228. package/dist/css/morph-dialog.css +2 -0
  229. package/dist/css/number-field.css +2 -0
  230. package/dist/css/pin-input.css +2 -0
  231. package/dist/css/popover.css +2 -0
  232. package/dist/css/progress.css +2 -0
  233. package/dist/css/radial-menu.css +2 -0
  234. package/dist/css/radio-group.css +2 -0
  235. package/dist/css/resizable-panels.css +2 -0
  236. package/dist/css/segmented-control.css +2 -0
  237. package/dist/css/slider.css +2 -0
  238. package/dist/css/sortable-list.css +2 -0
  239. package/dist/css/sparkline.css +2 -0
  240. package/dist/css/swipe-confirm.css +2 -0
  241. package/dist/css/switch.css +2 -0
  242. package/dist/css/tabs.css +2 -0
  243. package/dist/css/tether.css +2 -0
  244. package/dist/css/theme-switch.css +2 -0
  245. package/dist/css/toaster.css +2 -0
  246. package/dist/css/wheel-picker.css +2 -0
  247. package/dist/index.cjs +249 -0
  248. package/dist/index.d.cts +77 -0
  249. package/dist/index.d.ts +77 -0
  250. package/dist/index.js +40 -0
  251. package/dist/styles.css +2 -0
  252. package/package.json +98 -6
@@ -0,0 +1,203 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var chunk5ARTY5RT_cjs = require('./chunk-5ARTY5RT.cjs');
5
+ var chunkPBMXL53R_cjs = require('./chunk-PBMXL53R.cjs');
6
+ var React = require('react');
7
+ var react = require('motion/react');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
+
30
+ var FLING = { type: "spring", stiffness: 300, damping: 30, mass: 0.9 };
31
+ var FloatingPanel = React__namespace.forwardRef(function FloatingPanel2({ title, corner: cornerProp, defaultCorner = "bottom-right", onCornerChange, margin = 16, minimizable = true, defaultMinimized = false, actions, haptics = true, className, children, ...rest }, ref) {
32
+ const [cornerState, setCornerState] = React__namespace.useState(cornerProp ?? defaultCorner);
33
+ const corner = cornerProp ?? cornerState;
34
+ const [minimized, setMinimized] = React__namespace.useState(defaultMinimized);
35
+ const [dragging, setDragging] = React__namespace.useState(false);
36
+ const panelRef = React__namespace.useRef(null);
37
+ const x = react.useMotionValue(0);
38
+ const y = react.useMotionValue(0);
39
+ const { t, reduced } = chunkPBMXL53R_cjs.useMotionPreset();
40
+ const drag = React__namespace.useRef(null);
41
+ const anchors = () => {
42
+ const el = panelRef.current;
43
+ const parent = el?.offsetParent;
44
+ if (!el || !parent) return null;
45
+ const W = parent.clientWidth;
46
+ const H = parent.clientHeight;
47
+ const w = el.offsetWidth;
48
+ const h = el.offsetHeight;
49
+ return {
50
+ "top-left": { x: margin, y: margin },
51
+ "top-right": { x: W - w - margin, y: margin },
52
+ "bottom-left": { x: margin, y: H - h - margin },
53
+ "bottom-right": { x: W - w - margin, y: H - h - margin }
54
+ };
55
+ };
56
+ const settle = (c, velocity, instant = false) => {
57
+ const a = anchors();
58
+ if (!a) return;
59
+ if (instant || reduced) {
60
+ x.set(a[c].x);
61
+ y.set(a[c].y);
62
+ return;
63
+ }
64
+ react.animate(x, a[c].x, { ...FLING, velocity: velocity?.x ?? 0 });
65
+ react.animate(y, a[c].y, { ...FLING, velocity: velocity?.y ?? 0 });
66
+ };
67
+ const setCorner = (c) => {
68
+ if (c !== corner) {
69
+ if (haptics) chunk5ARTY5RT_cjs.haptic(6);
70
+ onCornerChange?.(c);
71
+ }
72
+ setCornerState(c);
73
+ };
74
+ chunk5ARTY5RT_cjs.useIsoLayoutEffect(() => {
75
+ settle(corner, void 0, true);
76
+ const el = panelRef.current;
77
+ const parent = el?.offsetParent;
78
+ if (!el || !parent || typeof ResizeObserver === "undefined") return;
79
+ const ro = new ResizeObserver(() => !drag.current && settle(cornerRef.current, void 0, true));
80
+ ro.observe(parent);
81
+ return () => ro.disconnect();
82
+ }, []);
83
+ const cornerRef = React__namespace.useRef(corner);
84
+ cornerRef.current = corner;
85
+ chunk5ARTY5RT_cjs.useIsoLayoutEffect(() => {
86
+ if (!drag.current) settle(corner);
87
+ }, [corner, minimized]);
88
+ const onPointerDown = (event) => {
89
+ if (event.button !== 0 || event.target.closest("button")) return;
90
+ x.stop();
91
+ y.stop();
92
+ drag.current = { px: event.clientX, py: event.clientY, x: x.get(), y: y.get(), samples: [{ t: performance.now(), x: event.clientX, y: event.clientY }] };
93
+ setDragging(true);
94
+ event.currentTarget.setPointerCapture?.(event.pointerId);
95
+ };
96
+ const onPointerMove = (event) => {
97
+ const d = drag.current;
98
+ if (!d) return;
99
+ x.set(d.x + event.clientX - d.px);
100
+ y.set(d.y + event.clientY - d.py);
101
+ d.samples.push({ t: performance.now(), x: event.clientX, y: event.clientY });
102
+ if (d.samples.length > 5) d.samples.shift();
103
+ };
104
+ const onPointerUp = () => {
105
+ const d = drag.current;
106
+ if (!d) return;
107
+ drag.current = null;
108
+ setDragging(false);
109
+ const a = d.samples[0];
110
+ const b = d.samples[d.samples.length - 1];
111
+ const dt = Math.max(1, b.t - a.t) / 1e3;
112
+ const v = { x: (b.x - a.x) / dt, y: (b.y - a.y) / dt };
113
+ const px = x.get() + v.x * 0.18;
114
+ const py = y.get() + v.y * 0.18;
115
+ const anchorsNow = anchors();
116
+ if (!anchorsNow) return;
117
+ let best = corner;
118
+ let bestD = Infinity;
119
+ Object.keys(anchorsNow).forEach((c) => {
120
+ const dd = Math.hypot(anchorsNow[c].x - px, anchorsNow[c].y - py);
121
+ if (dd < bestD) {
122
+ bestD = dd;
123
+ best = c;
124
+ }
125
+ });
126
+ setCorner(best);
127
+ settle(best, v);
128
+ };
129
+ const onKeyDown = (event) => {
130
+ const [v, h] = corner.split("-");
131
+ const map = {
132
+ ArrowLeft: `${v}-left`,
133
+ ArrowRight: `${v}-right`,
134
+ ArrowUp: `top-${h}`,
135
+ ArrowDown: `bottom-${h}`
136
+ };
137
+ if (map[event.key]) {
138
+ event.preventDefault();
139
+ setCorner(map[event.key]);
140
+ } else if ((event.key === "Enter" || event.key === " ") && minimizable) {
141
+ event.preventDefault();
142
+ setMinimized((m) => !m);
143
+ }
144
+ };
145
+ return /* @__PURE__ */ jsxRuntime.jsxs(
146
+ react.motion.div,
147
+ {
148
+ ...rest,
149
+ ref: (el) => {
150
+ panelRef.current = el;
151
+ if (typeof ref === "function") ref(el);
152
+ else if (ref) ref.current = el;
153
+ },
154
+ role: "region",
155
+ "aria-label": typeof title === "string" ? title : rest["aria-label"] ?? "Floating panel",
156
+ className: chunkPBMXL53R_cjs.cx("fl-floating", className),
157
+ "data-dragging": dragging || void 0,
158
+ "data-minimized": minimized || void 0,
159
+ "data-corner": corner,
160
+ style: { x, y },
161
+ animate: { scale: dragging && !reduced ? 1.03 : 1 },
162
+ transition: t({ type: "spring", stiffness: 500, damping: 30 }),
163
+ children: [
164
+ /* @__PURE__ */ jsxRuntime.jsxs(
165
+ "div",
166
+ {
167
+ className: "fl-floating__bar",
168
+ tabIndex: 0,
169
+ "aria-label": "Move panel with arrow keys. Enter to minimise.",
170
+ onPointerDown,
171
+ onPointerMove,
172
+ onPointerUp,
173
+ onPointerCancel: onPointerUp,
174
+ onDoubleClick: () => minimizable && setMinimized((m) => !m),
175
+ onKeyDown,
176
+ children: [
177
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-floating__grip", "aria-hidden": true, children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx("i", {}, i)) }),
178
+ title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-floating__title", children: title }),
179
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "fl-floating__actions", children: [
180
+ actions,
181
+ minimizable && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "fl-reset-button fl-floating__min", "aria-label": minimized ? "Expand panel" : "Minimise panel", "aria-expanded": !minimized, onClick: () => setMinimized((m) => !m), children: /* @__PURE__ */ jsxRuntime.jsx(react.motion.svg, { viewBox: "0 0 12 12", width: "11", height: "11", "aria-hidden": true, animate: { rotate: minimized ? 180 : 0 }, transition: t({ type: "spring", stiffness: 500, damping: 26 }), children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 4.5 6 7.5 9 4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
182
+ ] })
183
+ ]
184
+ }
185
+ ),
186
+ /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: !minimized && /* @__PURE__ */ jsxRuntime.jsx(
187
+ react.motion.div,
188
+ {
189
+ className: "fl-floating__body",
190
+ initial: { height: 0, opacity: 0 },
191
+ animate: { height: "auto", opacity: 1 },
192
+ exit: { height: 0, opacity: 0 },
193
+ transition: t({ type: "spring", stiffness: 420, damping: 36, opacity: { duration: 0.15 } }),
194
+ onAnimationComplete: () => settle(cornerRef.current),
195
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fl-floating__content", children })
196
+ }
197
+ ) })
198
+ ]
199
+ }
200
+ );
201
+ });
202
+
203
+ exports.FloatingPanel = FloatingPanel;
@@ -0,0 +1,185 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var chunk5ARTY5RT_cjs = require('./chunk-5ARTY5RT.cjs');
5
+ var chunkG5UZZ2XG_cjs = require('./chunk-G5UZZ2XG.cjs');
6
+ var chunkPBMXL53R_cjs = require('./chunk-PBMXL53R.cjs');
7
+ var React = require('react');
8
+ var react = require('motion/react');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
+
31
+ var AccordionContext = React__namespace.createContext(null);
32
+ var ItemContext = React__namespace.createContext(null);
33
+ var useAccordion = () => {
34
+ const ctx = React__namespace.useContext(AccordionContext);
35
+ if (!ctx) throw new Error("Accordion parts must be rendered inside <Accordion>.");
36
+ return ctx;
37
+ };
38
+ var useItem = () => {
39
+ const ctx = React__namespace.useContext(ItemContext);
40
+ if (!ctx) throw new Error("AccordionTrigger/AccordionContent must be inside <AccordionItem>.");
41
+ return ctx;
42
+ };
43
+ var Accordion = React__namespace.forwardRef(function Accordion2(props, ref) {
44
+ const { type = "single", value, defaultValue, onValueChange, variant = "line", haptics = true, className, children, onKeyDown, ...rest } = props;
45
+ const collapsible = props.collapsible ?? true;
46
+ delete rest.collapsible;
47
+ const multiple = type === "multiple";
48
+ const [state, setState] = chunkG5UZZ2XG_cjs.useControllableState({
49
+ value,
50
+ defaultValue: defaultValue ?? (multiple ? [] : null),
51
+ onChange: onValueChange
52
+ });
53
+ const open = multiple ? state ?? [] : state ? [state] : [];
54
+ const baseId = React__namespace.useId();
55
+ const order = React__namespace.Children.toArray(children).filter(React__namespace.isValidElement).map((c) => c.props.value).filter((v) => typeof v === "string");
56
+ const toggle = (item) => {
57
+ if (haptics) chunk5ARTY5RT_cjs.haptic(4);
58
+ if (multiple) setState(open.includes(item) ? open.filter((v) => v !== item) : [...open, item]);
59
+ else setState(open.includes(item) ? collapsible ? null : item : item);
60
+ };
61
+ const handleKey = (event) => {
62
+ onKeyDown?.(event);
63
+ const triggers = Array.from(event.currentTarget.querySelectorAll("[data-fl-accordion-trigger]:not(:disabled)"));
64
+ const i = triggers.indexOf(document.activeElement);
65
+ if (i === -1) return;
66
+ const next = { ArrowDown: i + 1, ArrowUp: i - 1, Home: 0, End: triggers.length - 1 }[event.key];
67
+ if (next === void 0) return;
68
+ event.preventDefault();
69
+ triggers[(next + triggers.length) % triggers.length]?.focus();
70
+ };
71
+ return /* @__PURE__ */ jsxRuntime.jsx(AccordionContext.Provider, { value: { open, toggle, variant, order, baseId }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, ref, className: chunkPBMXL53R_cjs.cx("fl-accordion", className), "data-variant": variant, onKeyDown: handleKey, children }) });
72
+ });
73
+ var AccordionItem = React__namespace.forwardRef(function AccordionItem2({ value, disabled, className, children, ...rest }, ref) {
74
+ const { open, variant, order } = useAccordion();
75
+ const { t } = chunkPBMXL53R_cjs.useMotionPreset();
76
+ const isOpen = open.includes(value);
77
+ const i = order.indexOf(value);
78
+ const prevOpen = i > 0 && open.includes(order[i - 1]);
79
+ const nextOpen = i < order.length - 1 && open.includes(order[i + 1]);
80
+ const first = i <= 0;
81
+ const last = i === order.length - 1;
82
+ const R = 14;
83
+ const r = 3;
84
+ const detach = variant === "detach" ? {
85
+ marginTop: isOpen && !first ? 10 : 0,
86
+ marginBottom: isOpen && !last ? 10 : 0,
87
+ borderTopLeftRadius: first || isOpen || prevOpen ? R : r,
88
+ borderTopRightRadius: first || isOpen || prevOpen ? R : r,
89
+ borderBottomLeftRadius: last || isOpen || nextOpen ? R : r,
90
+ borderBottomRightRadius: last || isOpen || nextOpen ? R : r
91
+ } : void 0;
92
+ return /* @__PURE__ */ jsxRuntime.jsx(ItemContext.Provider, { value: { value, open: isOpen, disabled }, children: /* @__PURE__ */ jsxRuntime.jsx(
93
+ react.motion.div,
94
+ {
95
+ ...rest,
96
+ ref,
97
+ className: chunkPBMXL53R_cjs.cx("fl-accordion__item", className),
98
+ "data-state": isOpen ? "open" : "closed",
99
+ "data-disabled": disabled || void 0,
100
+ initial: false,
101
+ animate: detach,
102
+ transition: t({ type: "spring", stiffness: 420, damping: 34 }),
103
+ children
104
+ }
105
+ ) });
106
+ });
107
+ var AccordionTrigger = React__namespace.forwardRef(function AccordionTrigger2({ className, children, icon, onClick, ...rest }, ref) {
108
+ const { toggle, variant, baseId } = useAccordion();
109
+ const { value, open, disabled } = useItem();
110
+ const { t } = chunkPBMXL53R_cjs.useMotionPreset();
111
+ return /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "fl-accordion__heading", children: /* @__PURE__ */ jsxRuntime.jsxs(
112
+ "button",
113
+ {
114
+ ...rest,
115
+ ref,
116
+ type: "button",
117
+ id: `${baseId}-trigger-${value}`,
118
+ "aria-expanded": open,
119
+ "aria-controls": `${baseId}-content-${value}`,
120
+ disabled,
121
+ "data-fl-accordion-trigger": "",
122
+ "data-state": open ? "open" : "closed",
123
+ className: chunkPBMXL53R_cjs.cx("fl-reset-button fl-accordion__trigger", className),
124
+ onClick: (e) => {
125
+ onClick?.(e);
126
+ if (!e.defaultPrevented) toggle(value);
127
+ },
128
+ children: [
129
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-accordion__title", children }),
130
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-accordion__icon", "aria-hidden": true, children: icon ?? (variant === "line" ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: "0 0 16 16", width: "14", height: "14", children: [
131
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.5 8h11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
132
+ /* @__PURE__ */ jsxRuntime.jsx(
133
+ react.motion.path,
134
+ {
135
+ d: "M8 2.5v11",
136
+ stroke: "currentColor",
137
+ strokeWidth: "1.5",
138
+ strokeLinecap: "round",
139
+ initial: false,
140
+ animate: { rotate: open ? 90 : 0, scaleY: open ? 0 : 1 },
141
+ transition: t({ type: "spring", stiffness: 400, damping: 24 })
142
+ }
143
+ )
144
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(react.motion.svg, { viewBox: "0 0 16 16", width: "14", height: "14", initial: false, animate: { rotate: open ? 180 : 0 }, transition: t({ type: "spring", stiffness: 400, damping: 22 }), children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 6l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })) })
145
+ ]
146
+ }
147
+ ) });
148
+ });
149
+ var AccordionContent = React__namespace.forwardRef(function AccordionContent2({ className, children, ...rest }, ref) {
150
+ const { baseId } = useAccordion();
151
+ const { value, open } = useItem();
152
+ const { t, reduced } = chunkPBMXL53R_cjs.useMotionPreset();
153
+ return /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: open && /* @__PURE__ */ jsxRuntime.jsx(
154
+ react.motion.div,
155
+ {
156
+ id: `${baseId}-content-${value}`,
157
+ role: "region",
158
+ "aria-labelledby": `${baseId}-trigger-${value}`,
159
+ className: "fl-accordion__collapse",
160
+ initial: { height: 0, opacity: 0 },
161
+ animate: { height: "auto", opacity: 1 },
162
+ exit: { height: 0, opacity: 0 },
163
+ transition: t({ type: "spring", stiffness: 380, damping: 36, opacity: { duration: 0.18 } }),
164
+ children: /* @__PURE__ */ jsxRuntime.jsx(
165
+ react.motion.div,
166
+ {
167
+ ...rest,
168
+ ref,
169
+ className: chunkPBMXL53R_cjs.cx("fl-accordion__content", className),
170
+ initial: { y: reduced ? 0 : -8 },
171
+ animate: { y: 0 },
172
+ exit: { y: reduced ? 0 : -4 },
173
+ transition: t({ type: "spring", stiffness: 380, damping: 30 }),
174
+ children
175
+ }
176
+ )
177
+ },
178
+ "content"
179
+ ) });
180
+ });
181
+
182
+ exports.Accordion = Accordion;
183
+ exports.AccordionContent = AccordionContent;
184
+ exports.AccordionItem = AccordionItem;
185
+ exports.AccordionTrigger = AccordionTrigger;
@@ -0,0 +1,175 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var chunk5ARTY5RT_cjs = require('./chunk-5ARTY5RT.cjs');
5
+ var chunkG5UZZ2XG_cjs = require('./chunk-G5UZZ2XG.cjs');
6
+ var chunkPBMXL53R_cjs = require('./chunk-PBMXL53R.cjs');
7
+ var React = require('react');
8
+ var react = require('motion/react');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
+
31
+ var PinInput = React__namespace.forwardRef(function PinInput2({
32
+ length = 6,
33
+ value: valueProp,
34
+ defaultValue = "",
35
+ onValueChange,
36
+ onComplete,
37
+ type = "numeric",
38
+ mask,
39
+ status = "idle",
40
+ variant = "cells",
41
+ size = "md",
42
+ haptics = true,
43
+ disabled,
44
+ className,
45
+ style,
46
+ onFocus,
47
+ onBlur,
48
+ ...rest
49
+ }, ref) {
50
+ const [value, setValue] = chunkG5UZZ2XG_cjs.useControllableState({ value: valueProp, defaultValue, onChange: onValueChange });
51
+ const { t, reduced } = chunkPBMXL53R_cjs.useMotionPreset();
52
+ const inputRef = React__namespace.useRef(null);
53
+ const rootRef = React__namespace.useRef(null);
54
+ const cells = React__namespace.useRef([]);
55
+ const [focused, setFocused] = React__namespace.useState(false);
56
+ const caretX = react.useMotionValue(0);
57
+ const caretPlaced = React__namespace.useRef(false);
58
+ const active = Math.min(value.length, length - 1);
59
+ const full = value.length >= length;
60
+ const sanitize = (raw) => (type === "numeric" ? raw.replace(/\D/g, "") : raw.replace(/[^a-z0-9]/gi, "").toUpperCase()).slice(0, length);
61
+ chunk5ARTY5RT_cjs.useIsoLayoutEffect(() => {
62
+ const cell = cells.current[active];
63
+ if (!cell) return;
64
+ const target = cell.offsetLeft + (full ? cell.offsetWidth - 10 : 0);
65
+ if (!caretPlaced.current) {
66
+ caretX.set(target);
67
+ caretPlaced.current = true;
68
+ } else react.animate(caretX, target, t({ type: "spring", stiffness: 700, damping: 40 }));
69
+ }, [active, full, length, size, variant]);
70
+ const prevStatus = React__namespace.useRef(status);
71
+ React__namespace.useEffect(() => {
72
+ if (prevStatus.current === status) return;
73
+ prevStatus.current = status;
74
+ if (status === "error") {
75
+ if (haptics) chunk5ARTY5RT_cjs.haptic([24, 40, 24]);
76
+ if (rootRef.current && !reduced) react.animate(rootRef.current, { x: [0, -10, 9, -7, 5, -3, 0] }, { duration: 0.5, ease: "easeOut" });
77
+ }
78
+ if (status === "success") {
79
+ if (haptics) chunk5ARTY5RT_cjs.haptic([8, 30, 8]);
80
+ if (!reduced)
81
+ cells.current.forEach((cell, i) => {
82
+ if (cell) react.animate(cell, { y: [0, -6, 0] }, { delay: i * 0.045, duration: 0.42, ease: [0.3, 0, 0.3, 1] });
83
+ });
84
+ }
85
+ }, [status]);
86
+ return /* @__PURE__ */ jsxRuntime.jsxs(
87
+ "div",
88
+ {
89
+ ref: rootRef,
90
+ className: chunkPBMXL53R_cjs.cx("fl-pin", className),
91
+ style,
92
+ "data-variant": variant,
93
+ "data-size": size,
94
+ "data-status": status,
95
+ "data-focused": focused || void 0,
96
+ "data-disabled": disabled || void 0,
97
+ onPointerDown: (e) => {
98
+ if (disabled) return;
99
+ e.preventDefault();
100
+ const input = inputRef.current;
101
+ input?.focus();
102
+ input?.setSelectionRange(value.length, value.length);
103
+ },
104
+ children: [
105
+ /* @__PURE__ */ jsxRuntime.jsx(
106
+ "input",
107
+ {
108
+ ...rest,
109
+ ref: chunk5ARTY5RT_cjs.mergeRefs(inputRef, ref),
110
+ className: "fl-pin__input",
111
+ value,
112
+ disabled,
113
+ inputMode: type === "numeric" ? "numeric" : "text",
114
+ autoComplete: "one-time-code",
115
+ autoCapitalize: "characters",
116
+ spellCheck: false,
117
+ maxLength: length,
118
+ pattern: type === "numeric" ? `\\d{${length}}` : void 0,
119
+ "aria-label": rest["aria-label"] ?? `Verification code, ${length} characters`,
120
+ "aria-invalid": status === "error" || void 0,
121
+ onChange: (event) => {
122
+ const next = sanitize(event.target.value);
123
+ if (next.length > value.length && haptics) chunk5ARTY5RT_cjs.haptic(3);
124
+ setValue(next);
125
+ if (next.length === length && next !== value) onComplete?.(next);
126
+ requestAnimationFrame(() => inputRef.current?.setSelectionRange(next.length, next.length));
127
+ },
128
+ onFocus: (e) => {
129
+ setFocused(true);
130
+ onFocus?.(e);
131
+ },
132
+ onBlur: (e) => {
133
+ setFocused(false);
134
+ onBlur?.(e);
135
+ }
136
+ }
137
+ ),
138
+ Array.from({ length }, (_, i) => {
139
+ const ch = value[i];
140
+ return /* @__PURE__ */ jsxRuntime.jsxs(
141
+ "span",
142
+ {
143
+ ref: (el) => {
144
+ cells.current[i] = el;
145
+ },
146
+ className: "fl-pin__cell",
147
+ "aria-hidden": true,
148
+ "data-filled": ch !== void 0 || void 0,
149
+ "data-active": focused && i === active && !full || void 0,
150
+ children: [
151
+ /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: ch !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
152
+ react.motion.span,
153
+ {
154
+ className: "fl-pin__char",
155
+ initial: { opacity: 0, y: 10, scale: 0.5 },
156
+ animate: { opacity: 1, y: 0, scale: 1 },
157
+ exit: { opacity: 0, scale: 0.5, transition: { duration: 0.12 } },
158
+ transition: t({ type: "spring", stiffness: 600, damping: 24 }),
159
+ children: mask ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-pin__dot" }) : ch
160
+ },
161
+ `${i}-${ch}`
162
+ ) }),
163
+ variant === "line" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-pin__underline" })
164
+ ]
165
+ },
166
+ i
167
+ );
168
+ }),
169
+ /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-pin__caret", "aria-hidden": true, style: { x: caretX }, "data-full": full || void 0 })
170
+ ]
171
+ }
172
+ );
173
+ });
174
+
175
+ exports.PinInput = PinInput;