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,160 @@
1
+ 'use client';
2
+ import { haptic } from './chunk-WGFJLFTP.js';
3
+ import { useControllableState } from './chunk-KPG24YFL.js';
4
+ import { cx, useMotionPreset } from './chunk-UFUN2OKY.js';
5
+ import * as React from 'react';
6
+ import { motion, AnimatePresence } from 'motion/react';
7
+ import { jsx, jsxs } from 'react/jsx-runtime';
8
+
9
+ var AccordionContext = React.createContext(null);
10
+ var ItemContext = React.createContext(null);
11
+ var useAccordion = () => {
12
+ const ctx = React.useContext(AccordionContext);
13
+ if (!ctx) throw new Error("Accordion parts must be rendered inside <Accordion>.");
14
+ return ctx;
15
+ };
16
+ var useItem = () => {
17
+ const ctx = React.useContext(ItemContext);
18
+ if (!ctx) throw new Error("AccordionTrigger/AccordionContent must be inside <AccordionItem>.");
19
+ return ctx;
20
+ };
21
+ var Accordion = React.forwardRef(function Accordion2(props, ref) {
22
+ const { type = "single", value, defaultValue, onValueChange, variant = "line", haptics = true, className, children, onKeyDown, ...rest } = props;
23
+ const collapsible = props.collapsible ?? true;
24
+ delete rest.collapsible;
25
+ const multiple = type === "multiple";
26
+ const [state, setState] = useControllableState({
27
+ value,
28
+ defaultValue: defaultValue ?? (multiple ? [] : null),
29
+ onChange: onValueChange
30
+ });
31
+ const open = multiple ? state ?? [] : state ? [state] : [];
32
+ const baseId = React.useId();
33
+ const order = React.Children.toArray(children).filter(React.isValidElement).map((c) => c.props.value).filter((v) => typeof v === "string");
34
+ const toggle = (item) => {
35
+ if (haptics) haptic(4);
36
+ if (multiple) setState(open.includes(item) ? open.filter((v) => v !== item) : [...open, item]);
37
+ else setState(open.includes(item) ? collapsible ? null : item : item);
38
+ };
39
+ const handleKey = (event) => {
40
+ onKeyDown?.(event);
41
+ const triggers = Array.from(event.currentTarget.querySelectorAll("[data-fl-accordion-trigger]:not(:disabled)"));
42
+ const i = triggers.indexOf(document.activeElement);
43
+ if (i === -1) return;
44
+ const next = { ArrowDown: i + 1, ArrowUp: i - 1, Home: 0, End: triggers.length - 1 }[event.key];
45
+ if (next === void 0) return;
46
+ event.preventDefault();
47
+ triggers[(next + triggers.length) % triggers.length]?.focus();
48
+ };
49
+ return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: { open, toggle, variant, order, baseId }, children: /* @__PURE__ */ jsx("div", { ...rest, ref, className: cx("fl-accordion", className), "data-variant": variant, onKeyDown: handleKey, children }) });
50
+ });
51
+ var AccordionItem = React.forwardRef(function AccordionItem2({ value, disabled, className, children, ...rest }, ref) {
52
+ const { open, variant, order } = useAccordion();
53
+ const { t } = useMotionPreset();
54
+ const isOpen = open.includes(value);
55
+ const i = order.indexOf(value);
56
+ const prevOpen = i > 0 && open.includes(order[i - 1]);
57
+ const nextOpen = i < order.length - 1 && open.includes(order[i + 1]);
58
+ const first = i <= 0;
59
+ const last = i === order.length - 1;
60
+ const R = 14;
61
+ const r = 3;
62
+ const detach = variant === "detach" ? {
63
+ marginTop: isOpen && !first ? 10 : 0,
64
+ marginBottom: isOpen && !last ? 10 : 0,
65
+ borderTopLeftRadius: first || isOpen || prevOpen ? R : r,
66
+ borderTopRightRadius: first || isOpen || prevOpen ? R : r,
67
+ borderBottomLeftRadius: last || isOpen || nextOpen ? R : r,
68
+ borderBottomRightRadius: last || isOpen || nextOpen ? R : r
69
+ } : void 0;
70
+ return /* @__PURE__ */ jsx(ItemContext.Provider, { value: { value, open: isOpen, disabled }, children: /* @__PURE__ */ jsx(
71
+ motion.div,
72
+ {
73
+ ...rest,
74
+ ref,
75
+ className: cx("fl-accordion__item", className),
76
+ "data-state": isOpen ? "open" : "closed",
77
+ "data-disabled": disabled || void 0,
78
+ initial: false,
79
+ animate: detach,
80
+ transition: t({ type: "spring", stiffness: 420, damping: 34 }),
81
+ children
82
+ }
83
+ ) });
84
+ });
85
+ var AccordionTrigger = React.forwardRef(function AccordionTrigger2({ className, children, icon, onClick, ...rest }, ref) {
86
+ const { toggle, variant, baseId } = useAccordion();
87
+ const { value, open, disabled } = useItem();
88
+ const { t } = useMotionPreset();
89
+ return /* @__PURE__ */ jsx("h3", { className: "fl-accordion__heading", children: /* @__PURE__ */ jsxs(
90
+ "button",
91
+ {
92
+ ...rest,
93
+ ref,
94
+ type: "button",
95
+ id: `${baseId}-trigger-${value}`,
96
+ "aria-expanded": open,
97
+ "aria-controls": `${baseId}-content-${value}`,
98
+ disabled,
99
+ "data-fl-accordion-trigger": "",
100
+ "data-state": open ? "open" : "closed",
101
+ className: cx("fl-reset-button fl-accordion__trigger", className),
102
+ onClick: (e) => {
103
+ onClick?.(e);
104
+ if (!e.defaultPrevented) toggle(value);
105
+ },
106
+ children: [
107
+ /* @__PURE__ */ jsx("span", { className: "fl-accordion__title", children }),
108
+ /* @__PURE__ */ jsx("span", { className: "fl-accordion__icon", "aria-hidden": true, children: icon ?? (variant === "line" ? /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", width: "14", height: "14", children: [
109
+ /* @__PURE__ */ jsx("path", { d: "M2.5 8h11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
110
+ /* @__PURE__ */ jsx(
111
+ motion.path,
112
+ {
113
+ d: "M8 2.5v11",
114
+ stroke: "currentColor",
115
+ strokeWidth: "1.5",
116
+ strokeLinecap: "round",
117
+ initial: false,
118
+ animate: { rotate: open ? 90 : 0, scaleY: open ? 0 : 1 },
119
+ transition: t({ type: "spring", stiffness: 400, damping: 24 })
120
+ }
121
+ )
122
+ ] }) : /* @__PURE__ */ jsx(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__ */ jsx("path", { d: "M4 6l4 4 4-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })) })
123
+ ]
124
+ }
125
+ ) });
126
+ });
127
+ var AccordionContent = React.forwardRef(function AccordionContent2({ className, children, ...rest }, ref) {
128
+ const { baseId } = useAccordion();
129
+ const { value, open } = useItem();
130
+ const { t, reduced } = useMotionPreset();
131
+ return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: open && /* @__PURE__ */ jsx(
132
+ motion.div,
133
+ {
134
+ id: `${baseId}-content-${value}`,
135
+ role: "region",
136
+ "aria-labelledby": `${baseId}-trigger-${value}`,
137
+ className: "fl-accordion__collapse",
138
+ initial: { height: 0, opacity: 0 },
139
+ animate: { height: "auto", opacity: 1 },
140
+ exit: { height: 0, opacity: 0 },
141
+ transition: t({ type: "spring", stiffness: 380, damping: 36, opacity: { duration: 0.18 } }),
142
+ children: /* @__PURE__ */ jsx(
143
+ motion.div,
144
+ {
145
+ ...rest,
146
+ ref,
147
+ className: cx("fl-accordion__content", className),
148
+ initial: { y: reduced ? 0 : -8 },
149
+ animate: { y: 0 },
150
+ exit: { y: reduced ? 0 : -4 },
151
+ transition: t({ type: "spring", stiffness: 380, damping: 30 }),
152
+ children
153
+ }
154
+ )
155
+ },
156
+ "content"
157
+ ) });
158
+ });
159
+
160
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
@@ -0,0 +1,66 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
25
+
26
+ // src/internal/hooks.ts
27
+ var useIsoLayoutEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
28
+ function mergeRefs(...refs) {
29
+ return (node) => {
30
+ for (const ref of refs) {
31
+ if (typeof ref === "function") ref(node);
32
+ else if (ref) ref.current = node;
33
+ }
34
+ };
35
+ }
36
+ function useElementSize() {
37
+ const [node, setNode] = React__namespace.useState(null);
38
+ const [size, setSize] = React__namespace.useState({ width: 0, height: 0 });
39
+ useIsoLayoutEffect(() => {
40
+ if (!node) return;
41
+ const measure = () => setSize({ width: node.offsetWidth, height: node.offsetHeight });
42
+ measure();
43
+ if (typeof ResizeObserver === "undefined") return;
44
+ const ro = new ResizeObserver(measure);
45
+ ro.observe(node);
46
+ return () => ro.disconnect();
47
+ }, [node]);
48
+ return [setNode, size, node];
49
+ }
50
+ function haptic(pattern = 6) {
51
+ try {
52
+ if (typeof navigator !== "undefined" && typeof navigator.vibrate === "function") navigator.vibrate(pattern);
53
+ } catch {
54
+ }
55
+ }
56
+ function useMounted() {
57
+ const [mounted, setMounted] = React__namespace.useState(false);
58
+ React__namespace.useEffect(() => setMounted(true), []);
59
+ return mounted;
60
+ }
61
+
62
+ exports.haptic = haptic;
63
+ exports.mergeRefs = mergeRefs;
64
+ exports.useElementSize = useElementSize;
65
+ exports.useIsoLayoutEffect = useIsoLayoutEffect;
66
+ exports.useMounted = useMounted;
@@ -0,0 +1,156 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var chunkQWYHH465_cjs = require('./chunk-QWYHH465.cjs');
5
+ var chunkCPUW5LDN_cjs = require('./chunk-CPUW5LDN.cjs');
6
+ var chunkG5UZZ2XG_cjs = require('./chunk-G5UZZ2XG.cjs');
7
+ var chunkPBMXL53R_cjs = require('./chunk-PBMXL53R.cjs');
8
+ var React = require('react');
9
+ var react = require('motion/react');
10
+ var jsxRuntime = require('react/jsx-runtime');
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
31
+
32
+ var MorphContext = React__namespace.createContext(null);
33
+ var useMorph = () => {
34
+ const ctx = React__namespace.useContext(MorphContext);
35
+ if (!ctx) throw new Error("MorphDialog parts must be rendered inside <MorphDialog>.");
36
+ return ctx;
37
+ };
38
+ var MORPH = { type: "spring", stiffness: 320, damping: 32, mass: 0.9 };
39
+ function MorphDialog({ open: openProp, defaultOpen = false, onOpenChange, children, container }) {
40
+ const [open, setOpen] = chunkG5UZZ2XG_cjs.useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });
41
+ const id = React__namespace.useId();
42
+ const triggerRef = React__namespace.useRef(null);
43
+ const { t } = chunkPBMXL53R_cjs.useMotionPreset();
44
+ return /* @__PURE__ */ jsxRuntime.jsx(MorphContext.Provider, { value: { open, setOpen, id, triggerRef, container }, children: /* @__PURE__ */ jsxRuntime.jsx(react.MotionConfig, { transition: t(MORPH), children }) });
45
+ }
46
+ var MorphDialogTrigger = React__namespace.forwardRef(function MorphDialogTrigger2({ className, children, style, onClick, ...rest }, ref) {
47
+ const { open, setOpen, id, triggerRef } = useMorph();
48
+ const [size, setSize] = React__namespace.useState(null);
49
+ return (
50
+ // The wrapper keeps the trigger's footprint while its surface is "inside" the dialog.
51
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-morph-dialog__slot", style: open && size ? { width: size.width, height: size.height } : void 0, children: !open && /* @__PURE__ */ jsxRuntime.jsx(
52
+ react.motion.button,
53
+ {
54
+ ...rest,
55
+ ref: (el) => {
56
+ triggerRef.current = el;
57
+ if (typeof ref === "function") ref(el);
58
+ else if (ref) ref.current = el;
59
+ },
60
+ type: "button",
61
+ layoutId: `${id}-surface`,
62
+ "aria-haspopup": "dialog",
63
+ "aria-expanded": false,
64
+ className: chunkPBMXL53R_cjs.cx("fl-reset-button fl-morph-dialog__trigger", className),
65
+ style: { borderRadius: 16, ...style },
66
+ onClick: (e) => {
67
+ onClick?.(e);
68
+ if (e.defaultPrevented) return;
69
+ const el = e.currentTarget;
70
+ setSize({ width: el.offsetWidth, height: el.offsetHeight });
71
+ setOpen(true);
72
+ },
73
+ children
74
+ }
75
+ ) })
76
+ );
77
+ });
78
+ var MorphDialogContent = React__namespace.forwardRef(function MorphDialogContent2({ className, children, style, dismissible = true, ...rest }, ref) {
79
+ const { open, setOpen, id, triggerRef, container } = useMorph();
80
+ const panelRef = React__namespace.useRef(null);
81
+ const { reduced } = chunkPBMXL53R_cjs.useMotionPreset();
82
+ chunkQWYHH465_cjs.useScrollLock(open);
83
+ chunkQWYHH465_cjs.useFocusTrap(panelRef, open);
84
+ chunkQWYHH465_cjs.useEscape(open, () => setOpen(false));
85
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkCPUW5LDN_cjs.Portal, { container, anchor: triggerRef.current, children: /* @__PURE__ */ jsxRuntime.jsxs(react.AnimatePresence, { children: [
86
+ open && /* @__PURE__ */ jsxRuntime.jsx(
87
+ react.motion.div,
88
+ {
89
+ className: "fl-overlay fl-morph-dialog__backdrop",
90
+ initial: { opacity: 0 },
91
+ animate: { opacity: 1 },
92
+ exit: { opacity: 0 },
93
+ transition: { duration: 0.2 },
94
+ onClick: () => dismissible && setOpen(false)
95
+ },
96
+ "backdrop"
97
+ ),
98
+ open && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fl-morph-dialog__frame", children: /* @__PURE__ */ jsxRuntime.jsx(
99
+ react.motion.div,
100
+ {
101
+ ...rest,
102
+ ref: (el) => {
103
+ panelRef.current = el;
104
+ if (typeof ref === "function") ref(el);
105
+ else if (ref) ref.current = el;
106
+ },
107
+ layoutId: `${id}-surface`,
108
+ role: "dialog",
109
+ "aria-modal": "true",
110
+ "aria-labelledby": `${id}-title`,
111
+ tabIndex: -1,
112
+ className: chunkPBMXL53R_cjs.cx("fl-morph-dialog__panel", className),
113
+ style: { borderRadius: 22, ...style },
114
+ children: /* @__PURE__ */ jsxRuntime.jsx(
115
+ react.motion.div,
116
+ {
117
+ className: "fl-morph-dialog__body",
118
+ initial: { opacity: 0, y: reduced ? 0 : 10 },
119
+ animate: { opacity: 1, y: 0, transition: { delay: reduced ? 0 : 0.08, type: "spring", stiffness: 380, damping: 30 } },
120
+ exit: { opacity: 0, transition: { duration: 0.08 } },
121
+ children
122
+ }
123
+ )
124
+ }
125
+ ) }, "frame")
126
+ ] }) });
127
+ });
128
+ var MorphDialogTitle = React__namespace.forwardRef(function MorphDialogTitle2({ className, children, as = "h2", ...rest }, ref) {
129
+ const { id, open } = useMorph();
130
+ const Tag = react.motion[as];
131
+ return /* @__PURE__ */ jsxRuntime.jsx(Tag, { ...rest, ref, id: open ? `${id}-title` : void 0, layoutId: `${id}-title`, layout: "position", className: chunkPBMXL53R_cjs.cx("fl-morph-dialog__title", className), children });
132
+ });
133
+ var MorphDialogClose = React__namespace.forwardRef(function MorphDialogClose2({ className, children, onClick, ...rest }, ref) {
134
+ const { setOpen } = useMorph();
135
+ return /* @__PURE__ */ jsxRuntime.jsx(
136
+ "button",
137
+ {
138
+ ...rest,
139
+ ref,
140
+ type: "button",
141
+ "aria-label": children ? void 0 : "Close",
142
+ className: chunkPBMXL53R_cjs.cx("fl-reset-button", children ? "fl-morph-dialog__action" : "fl-morph-dialog__close", className),
143
+ onClick: (e) => {
144
+ onClick?.(e);
145
+ if (!e.defaultPrevented) setOpen(false);
146
+ },
147
+ children: children ?? /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 14 14", width: "12", height: "12", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 3l8 8M11 3l-8 8", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) })
148
+ }
149
+ );
150
+ });
151
+
152
+ exports.MorphDialog = MorphDialog;
153
+ exports.MorphDialogClose = MorphDialogClose;
154
+ exports.MorphDialogContent = MorphDialogContent;
155
+ exports.MorphDialogTitle = MorphDialogTitle;
156
+ exports.MorphDialogTrigger = MorphDialogTrigger;
@@ -0,0 +1,261 @@
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 easeInOut = (x) => x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;
32
+ function RadioGroupImpl({
33
+ options,
34
+ value: valueProp,
35
+ defaultValue,
36
+ onValueChange,
37
+ variant = "leap",
38
+ orientation = "vertical",
39
+ size = "md",
40
+ name,
41
+ disabled,
42
+ required,
43
+ haptics = true,
44
+ className,
45
+ ...rest
46
+ }, ref) {
47
+ const [value, setValue] = chunkG5UZZ2XG_cjs.useControllableState({ value: valueProp, defaultValue, onChange: onValueChange });
48
+ const { t, reduced } = chunkPBMXL53R_cjs.useMotionPreset();
49
+ const generated = React__namespace.useId();
50
+ const groupName = name ?? `fl-radio-${generated}`;
51
+ const rootRef = React__namespace.useRef(null);
52
+ const rings = React__namespace.useRef([]);
53
+ const dotRef = React__namespace.useRef(null);
54
+ const x = react.useMotionValue(0);
55
+ const y = react.useMotionValue(0);
56
+ const scale = react.useMotionValue(0);
57
+ const index = options.findIndex((o) => o.value === value);
58
+ const [landed, setLanded] = React__namespace.useState(index);
59
+ const landedRef = React__namespace.useRef(true);
60
+ landedRef.current = landed !== -1;
61
+ const labels = React__namespace.useRef([]);
62
+ const hx = react.useMotionValue(0);
63
+ const hy = react.useMotionValue(0);
64
+ const hw = react.useMotionValue(0);
65
+ const hh = react.useMotionValue(0);
66
+ const ho = react.useMotionValue(0);
67
+ const highlightPlaced = React__namespace.useRef(false);
68
+ const placeHighlight = React__namespace.useCallback(
69
+ (instant) => {
70
+ const el = labels.current[index];
71
+ if (variant !== "slide") return;
72
+ if (!el) {
73
+ ho.set(0);
74
+ return;
75
+ }
76
+ const target = { x: el.offsetLeft, y: el.offsetTop, w: el.offsetWidth, h: el.offsetHeight };
77
+ if (instant || !highlightPlaced.current || reduced) {
78
+ hx.set(target.x);
79
+ hy.set(target.y);
80
+ hw.set(target.w);
81
+ hh.set(target.h);
82
+ ho.set(1);
83
+ highlightPlaced.current = true;
84
+ return;
85
+ }
86
+ const spring = { type: "spring", stiffness: 480, damping: 36 };
87
+ react.animate(hx, target.x, spring);
88
+ react.animate(hy, target.y, spring);
89
+ react.animate(hw, target.w, spring);
90
+ react.animate(hh, target.h, spring);
91
+ react.animate(ho, 1, { duration: 0.15 });
92
+ },
93
+ [index, variant, reduced]
94
+ );
95
+ chunk5ARTY5RT_cjs.useIsoLayoutEffect(() => placeHighlight(false), [placeHighlight]);
96
+ const centerOf = (i) => {
97
+ const ring = rings.current[i];
98
+ const root = rootRef.current;
99
+ if (!ring || !root) return null;
100
+ const a = ring.getBoundingClientRect();
101
+ const b = root.getBoundingClientRect();
102
+ return { x: a.left - b.left + a.width / 2, y: a.top - b.top + a.height / 2 };
103
+ };
104
+ const prevIndex = React__namespace.useRef(index);
105
+ chunk5ARTY5RT_cjs.useIsoLayoutEffect(() => {
106
+ if (variant !== "leap") return;
107
+ const from = prevIndex.current;
108
+ prevIndex.current = index;
109
+ const to = centerOf(index);
110
+ if (!to) {
111
+ scale.set(0);
112
+ return;
113
+ }
114
+ const start = from >= 0 ? centerOf(from) : null;
115
+ if (!start || from === index || reduced) {
116
+ x.set(to.x);
117
+ y.set(to.y);
118
+ if (from === index || reduced) {
119
+ scale.set(1);
120
+ setLanded(index);
121
+ } else {
122
+ react.animate(scale, [0, 1], { type: "spring", stiffness: 600, damping: 16 });
123
+ setLanded(index);
124
+ }
125
+ return;
126
+ }
127
+ const dx = to.x - start.x;
128
+ const dy = to.y - start.y;
129
+ const dist = Math.hypot(dx, dy);
130
+ const lift = Math.min(28, dist * 0.32);
131
+ const nx = orientation === "vertical" ? -1 : 0;
132
+ const ny = orientation === "vertical" ? 0 : -1;
133
+ const cx2 = (start.x + to.x) / 2 + nx * lift;
134
+ const cy = (start.y + to.y) / 2 + ny * lift;
135
+ const steps = 14;
136
+ const xs = [];
137
+ const ys = [];
138
+ for (let s = 0; s <= steps; s++) {
139
+ const p = easeInOut(s / steps);
140
+ const q = 1 - p;
141
+ xs.push(q * q * start.x + 2 * q * p * cx2 + p * p * to.x);
142
+ ys.push(q * q * start.y + 2 * q * p * cy + p * p * to.y);
143
+ }
144
+ const duration = Math.min(0.52, 0.26 + dist / 900);
145
+ setLanded(-1);
146
+ react.animate(x, xs, { duration, ease: "linear" });
147
+ react.animate(y, ys, { duration, ease: "linear" });
148
+ react.animate(scale, [1, 1.35, 1], { duration, ease: "easeInOut" }).then(() => {
149
+ setLanded(index);
150
+ const el = dotRef.current;
151
+ if (el) react.animate(el, { scaleX: [1.3, 1], scaleY: [0.72, 1] }, { type: "spring", stiffness: 700, damping: 14 });
152
+ });
153
+ }, [index, variant, orientation, size, reduced]);
154
+ const placeHighlightRef = React__namespace.useRef(placeHighlight);
155
+ placeHighlightRef.current = placeHighlight;
156
+ React__namespace.useEffect(() => {
157
+ const root = rootRef.current;
158
+ if (!root || typeof ResizeObserver === "undefined") return;
159
+ const ro = new ResizeObserver(() => {
160
+ placeHighlightRef.current(true);
161
+ const c = centerOf(prevIndex.current);
162
+ if (c && landedRef.current) {
163
+ x.set(c.x);
164
+ y.set(c.y);
165
+ }
166
+ });
167
+ ro.observe(root);
168
+ return () => ro.disconnect();
169
+ }, [variant]);
170
+ return /* @__PURE__ */ jsxRuntime.jsxs(
171
+ "div",
172
+ {
173
+ ...rest,
174
+ ref: chunk5ARTY5RT_cjs.mergeRefs(rootRef, ref),
175
+ role: "radiogroup",
176
+ "aria-orientation": orientation,
177
+ "aria-disabled": disabled || void 0,
178
+ "aria-required": required || void 0,
179
+ className: chunkPBMXL53R_cjs.cx("fl-radio-group", className),
180
+ "data-variant": variant,
181
+ "data-orientation": orientation,
182
+ "data-size": size,
183
+ children: [
184
+ variant === "slide" && /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-radio__highlight", "aria-hidden": true, style: { x: hx, y: hy, width: hw, height: hh, opacity: ho } }),
185
+ options.map((option, i) => {
186
+ const checked = i === index;
187
+ const isDisabled = disabled || option.disabled;
188
+ return /* @__PURE__ */ jsxRuntime.jsxs(
189
+ "label",
190
+ {
191
+ ref: (el) => {
192
+ labels.current[i] = el;
193
+ },
194
+ className: "fl-radio",
195
+ "data-state": checked ? "checked" : "unchecked",
196
+ "data-disabled": isDisabled || void 0,
197
+ children: [
198
+ /* @__PURE__ */ jsxRuntime.jsx(
199
+ "input",
200
+ {
201
+ type: "radio",
202
+ className: "fl-radio__input",
203
+ name: groupName,
204
+ value: option.value,
205
+ checked,
206
+ disabled: isDisabled,
207
+ required,
208
+ onChange: () => {
209
+ if (haptics) chunk5ARTY5RT_cjs.haptic(5);
210
+ setValue(option.value);
211
+ }
212
+ }
213
+ ),
214
+ /* @__PURE__ */ jsxRuntime.jsxs(
215
+ "span",
216
+ {
217
+ ref: (el) => {
218
+ rings.current[i] = el;
219
+ },
220
+ className: "fl-radio__ring",
221
+ "aria-hidden": true,
222
+ children: [
223
+ variant === "ring" && /* @__PURE__ */ jsxRuntime.jsx(
224
+ react.motion.span,
225
+ {
226
+ className: "fl-radio__band",
227
+ initial: false,
228
+ animate: { borderWidth: checked ? "calc(var(--fl-radio-size) * 0.3)" : "1.5px" },
229
+ transition: t(checked ? { type: "spring", stiffness: 500, damping: 13 } : { type: "spring", stiffness: 500, damping: 30 })
230
+ }
231
+ ),
232
+ variant === "slide" && /* @__PURE__ */ jsxRuntime.jsx(
233
+ react.motion.span,
234
+ {
235
+ className: "fl-radio__pip",
236
+ initial: false,
237
+ animate: { scale: checked ? 1 : 0 },
238
+ transition: t({ type: "spring", stiffness: 600, damping: 20, delay: checked ? 0.06 : 0 })
239
+ }
240
+ ),
241
+ variant === "leap" && checked && landed === i && /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-radio__impact", initial: { scale: 0.6, opacity: 0.5 }, animate: { scale: 1.9, opacity: 0 }, transition: { duration: 0.45, ease: "easeOut" } })
242
+ ]
243
+ }
244
+ ),
245
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "fl-radio__text", children: [
246
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-radio__label", children: option.label }),
247
+ option.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-radio__description", children: option.description })
248
+ ] })
249
+ ]
250
+ },
251
+ option.value
252
+ );
253
+ }),
254
+ variant === "leap" && /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { ref: dotRef, className: "fl-radio__dot", "aria-hidden": true, style: { x, y, scale } })
255
+ ]
256
+ }
257
+ );
258
+ }
259
+ var RadioGroup = React__namespace.forwardRef(RadioGroupImpl);
260
+
261
+ exports.RadioGroup = RadioGroup;