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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dirt2939
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,92 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # Seppia
2
+
3
+ Everyday React interface components — switches, calendars, sliders, dialogs — re-engineered with physical motion.
4
+
5
+ Every component is a real, accessible control: keyboard operable, screen-reader labelled, controlled or uncontrolled, themeable through CSS variables, and calm when the user prefers reduced motion.
6
+
7
+ ```bash
8
+ npm install seppia motion
9
+ ```
10
+
11
+ ```tsx
12
+ import 'seppia/styles.css';
13
+ import { Switch } from 'seppia';
14
+
15
+ export function Settings() {
16
+ return <Switch aria-label="Wi-Fi" defaultChecked onCheckedChange={(on) => console.log(on)} />;
17
+ }
18
+ ```
19
+
20
+ ## Requirements
21
+
22
+ | Peer | Version |
23
+ | ---------- | -------- |
24
+ | `react` | ≥ 18.2 |
25
+ | `react-dom`| ≥ 18.2 |
26
+ | `motion` | ≥ 12 |
27
+
28
+ Every module ships with `'use client'`, so it works in the Next.js App Router out of the box.
29
+
30
+ ## Styles
31
+
32
+ Import the full stylesheet once (≈ 14 KB gzipped):
33
+
34
+ ```ts
35
+ import 'seppia/styles.css';
36
+ ```
37
+
38
+ Or import only what you use:
39
+
40
+ ```ts
41
+ import 'seppia/css/base.css'; // tokens + shared primitives (required)
42
+ import 'seppia/css/switch.css';
43
+ import 'seppia/css/calendar.css';
44
+ ```
45
+
46
+ JavaScript is fully tree-shakeable — import from the root (`seppia`) or from a component entry (`seppia/switch`).
47
+
48
+ ## Theming
49
+
50
+ All colours, radii and shadows are CSS custom properties prefixed with `--fl-`, declared with zero specificity so you can override them anywhere:
51
+
52
+ ```css
53
+ :root {
54
+ --fl-accent: #2f6bff;
55
+ --fl-radius: 8px;
56
+ }
57
+ ```
58
+
59
+ Dark mode follows whatever your app already uses — `data-theme="dark"`, `class="dark"` or `data-fl-theme="dark"` on any ancestor. Themes nest: a light island inside a dark page works, and portaled overlays (popovers, dialogs, drawers) inherit the theme of the element that opened them.
60
+
61
+ ## Motion
62
+
63
+ Springs are shared across the library and exported for your own UI:
64
+
65
+ ```ts
66
+ import { springs } from 'seppia';
67
+ // springs.snappy · springs.smooth · springs.bouncy · springs.elastic · springs.gentle
68
+ ```
69
+
70
+ When `prefers-reduced-motion: reduce` is set, transforms collapse to instant state changes while every interaction keeps working.
71
+
72
+ ## Components
73
+
74
+ | Category | Components |
75
+ | ------------ | ---------- |
76
+ | Buttons | `MagneticButton`, `MorphButton`, `HoldButton` |
77
+ | Switches | `Switch`, `ThemeSwitch` |
78
+ | Selection | `Checkbox`, `SegmentedControl`, `RadioGroup`, `ChipSelect` |
79
+ | Calendars | `Calendar`, `DatePicker`, `WheelPicker` |
80
+ | Panels | `Accordion`, `ResizablePanels`, `SortableList`, `FloatingPanel` |
81
+ | Navigation | `Tabs`, `CommandPalette` |
82
+ | Inputs | `Slider`, `Knob`, `NumberField`, `PinInput` |
83
+ | Feedback | `Toaster` + `toast()`, `Progress`, `Loader`, `SwipeConfirm` |
84
+ | Overlays | `MorphDialog`, `Drawer`, `Popover` |
85
+ | Widgets | `ColorPicker`, `Clock`, `Sparkline` |
86
+ | Experimental | `Tether`, `RadialMenu` |
87
+
88
+ Documentation, live playgrounds and source for every component: see the Seppia site.
89
+
90
+ ## License
91
+
92
+ MIT © Dirt2939
@@ -0,0 +1,208 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var chunk3A2LHCPV_cjs = require('./chunk-3A2LHCPV.cjs');
5
+ var chunk5ARTY5RT_cjs = require('./chunk-5ARTY5RT.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 KNOB_SPRING = { type: "spring", stiffness: 760, damping: 34, mass: 0.75 };
33
+ var STRETCH = 6;
34
+ var INSET = 2;
35
+ var Switch = React__namespace.forwardRef(function Switch2({
36
+ checked: checkedProp,
37
+ defaultChecked = false,
38
+ onCheckedChange,
39
+ variant = "toggle",
40
+ size = "md",
41
+ labels = ["Off", "On"],
42
+ name,
43
+ value = "on",
44
+ haptics = true,
45
+ disabled,
46
+ className,
47
+ onClick,
48
+ onPointerDown,
49
+ onKeyDown,
50
+ onKeyUp,
51
+ ...rest
52
+ }, forwardedRef) {
53
+ const [checked, setChecked] = chunkG5UZZ2XG_cjs.useControllableState({ value: checkedProp, defaultValue: defaultChecked, onChange: onCheckedChange });
54
+ const { reduced, t } = chunkPBMXL53R_cjs.useMotionPreset();
55
+ const rootRef = React__namespace.useRef(null);
56
+ const [pressed, setPressed] = React__namespace.useState(false);
57
+ const [dragging, setDragging] = React__namespace.useState(false);
58
+ const [metrics, setMetrics] = React__namespace.useState({ travel: 18, knob: 22 });
59
+ const drag = React__namespace.useRef(null);
60
+ const suppressClick = React__namespace.useRef(false);
61
+ const x = react.useMotionValue(0);
62
+ const width = react.useMotionValue(metrics.knob);
63
+ const metricsRef = React__namespace.useRef(metrics);
64
+ metricsRef.current = metrics;
65
+ const progress = react.useTransform(x, (v) => Math.min(1, Math.max(0, v / Math.max(1, metricsRef.current.travel - STRETCH))));
66
+ const rotate = react.useMotionValue(0);
67
+ const draggable = variant !== "rocker";
68
+ chunk5ARTY5RT_cjs.useIsoLayoutEffect(() => {
69
+ const el = rootRef.current;
70
+ if (!el || variant === "rocker") return;
71
+ const h = el.clientHeight;
72
+ const w = el.clientWidth;
73
+ const knob = h - INSET * 2;
74
+ setMetrics({ knob, travel: w - knob - INSET * 2 });
75
+ }, [size, variant]);
76
+ const first = React__namespace.useRef(true);
77
+ chunk5ARTY5RT_cjs.useIsoLayoutEffect(() => {
78
+ if (variant === "rocker") {
79
+ const base = checked ? -1 : 1;
80
+ const target = pressed ? base * 4 : base * 11;
81
+ if (first.current) rotate.set(target);
82
+ else react.animate(rotate, target, t(pressed ? { type: "spring", stiffness: 900, damping: 40 } : { type: "spring", stiffness: 560, damping: 18 }));
83
+ first.current = false;
84
+ return;
85
+ }
86
+ if (dragging) return;
87
+ const stretch = pressed ? STRETCH : 0;
88
+ const targetX = checked ? metrics.travel - stretch : 0;
89
+ const targetW = metrics.knob + stretch;
90
+ if (first.current) {
91
+ x.set(targetX);
92
+ width.set(targetW);
93
+ } else {
94
+ react.animate(x, targetX, t(KNOB_SPRING));
95
+ react.animate(width, targetW, t(KNOB_SPRING));
96
+ }
97
+ first.current = false;
98
+ }, [checked, pressed, dragging, metrics, variant, reduced]);
99
+ const commit = (next) => {
100
+ if (next !== checked && haptics) chunk5ARTY5RT_cjs.haptic(8);
101
+ setChecked(next);
102
+ };
103
+ const handlePointerDown = (event) => {
104
+ onPointerDown?.(event);
105
+ if (disabled || event.defaultPrevented || event.button !== 0) return;
106
+ setPressed(true);
107
+ if (draggable) {
108
+ drag.current = { x0: event.clientX, start: x.get(), moved: false };
109
+ event.currentTarget.setPointerCapture?.(event.pointerId);
110
+ }
111
+ };
112
+ const handlePointerMove = (event) => {
113
+ const d = drag.current;
114
+ if (!d) return;
115
+ const dx = event.clientX - d.x0;
116
+ if (!d.moved && Math.abs(dx) > 3) {
117
+ d.moved = true;
118
+ setDragging(true);
119
+ }
120
+ if (d.moved) {
121
+ const max = metrics.travel - STRETCH;
122
+ x.set(chunk3A2LHCPV_cjs.rubberClamp(d.start + dx, 0, max, metrics.travel, 0.4));
123
+ }
124
+ };
125
+ const endPointer = (event, cancelled = false) => {
126
+ const d = drag.current;
127
+ drag.current = null;
128
+ setPressed(false);
129
+ if (d?.moved) {
130
+ suppressClick.current = !cancelled;
131
+ setDragging(false);
132
+ if (!cancelled) commit(x.get() > (metrics.travel - STRETCH) / 2);
133
+ }
134
+ if (event.currentTarget.hasPointerCapture?.(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
135
+ };
136
+ const handleClick = (event) => {
137
+ onClick?.(event);
138
+ if (suppressClick.current) {
139
+ suppressClick.current = false;
140
+ return;
141
+ }
142
+ if (disabled || event.defaultPrevented) return;
143
+ commit(!checked);
144
+ };
145
+ const handleKeyDown = (event) => {
146
+ onKeyDown?.(event);
147
+ if ((event.key === " " || event.key === "Enter") && !event.repeat && !disabled) setPressed(true);
148
+ };
149
+ const handleKeyUp = (event) => {
150
+ onKeyUp?.(event);
151
+ if (event.key === " " || event.key === "Enter") setPressed(false);
152
+ };
153
+ const offLabelOpacity = react.useTransform(progress, [0, 0.6], [1, 0]);
154
+ const offLabelX = react.useTransform(progress, [0, 1], [0, 10]);
155
+ const onLabelOpacity = react.useTransform(progress, [0.4, 1], [0, 1]);
156
+ const onLabelX = react.useTransform(progress, [0, 1], [-10, 0]);
157
+ const shadeLeft = react.useTransform(rotate, [-11, 11], [1, 0]);
158
+ const shadeRight = react.useTransform(rotate, [-11, 11], [0, 1]);
159
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
160
+ /* @__PURE__ */ jsxRuntime.jsx(
161
+ "button",
162
+ {
163
+ ...rest,
164
+ ref: chunk5ARTY5RT_cjs.mergeRefs(rootRef, forwardedRef),
165
+ type: "button",
166
+ role: "switch",
167
+ "aria-checked": checked,
168
+ disabled,
169
+ "data-state": checked ? "checked" : "unchecked",
170
+ "data-variant": variant,
171
+ "data-size": size,
172
+ "data-pressed": pressed || void 0,
173
+ "data-dragging": dragging || void 0,
174
+ className: chunkPBMXL53R_cjs.cx("fl-reset-button fl-switch", className),
175
+ onClick: handleClick,
176
+ onPointerDown: handlePointerDown,
177
+ onPointerMove: handlePointerMove,
178
+ onPointerUp: (e) => endPointer(e),
179
+ onPointerCancel: (e) => endPointer(e, true),
180
+ onKeyDown: handleKeyDown,
181
+ onKeyUp: handleKeyUp,
182
+ onBlur: () => setPressed(false),
183
+ children: variant === "rocker" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-switch__bezel", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsxs(react.motion.span, { className: "fl-switch__paddle", style: { rotateY: rotate }, children: [
184
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "fl-switch__half", "data-side": "on", children: [
185
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-switch__glyph", children: labels[1] }),
186
+ /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-switch__shade", style: { opacity: shadeLeft } })
187
+ ] }),
188
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "fl-switch__half", "data-side": "off", children: [
189
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "fl-switch__glyph", children: labels[0] }),
190
+ /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-switch__shade", style: { opacity: shadeRight } })
191
+ ] })
192
+ ] }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
193
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "fl-switch__track", "aria-hidden": true, children: [
194
+ /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-switch__fill", style: { opacity: progress } }),
195
+ variant === "label" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
196
+ /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-switch__text", "data-side": "on", style: { opacity: onLabelOpacity, x: onLabelX }, children: labels[1] }),
197
+ /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-switch__text", "data-side": "off", style: { opacity: offLabelOpacity, x: offLabelX }, children: labels[0] })
198
+ ] })
199
+ ] }),
200
+ /* @__PURE__ */ jsxRuntime.jsx(react.motion.span, { className: "fl-switch__knob", "aria-hidden": true, style: { x, width } })
201
+ ] })
202
+ }
203
+ ),
204
+ name && checked ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value }) : null
205
+ ] });
206
+ });
207
+
208
+ exports.Switch = Switch;
@@ -0,0 +1,329 @@
1
+ 'use client';
2
+ import { haptic } from './chunk-WGFJLFTP.js';
3
+ import { useControllableState } from './chunk-KPG24YFL.js';
4
+ import { useMotionPreset, cx } from './chunk-UFUN2OKY.js';
5
+ import * as React from 'react';
6
+ import { AnimatePresence, motion, LayoutGroup } from 'motion/react';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+
9
+ // src/components/calendar/dates.ts
10
+ var startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
11
+ var addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
12
+ var daysInMonth = (y, m) => new Date(y, m + 1, 0).getDate();
13
+ var addMonths = (d, n) => {
14
+ const first = new Date(d.getFullYear(), d.getMonth() + n, 1);
15
+ return new Date(first.getFullYear(), first.getMonth(), Math.min(d.getDate(), daysInMonth(first.getFullYear(), first.getMonth())));
16
+ };
17
+ var startOfMonth = (d) => new Date(d.getFullYear(), d.getMonth(), 1);
18
+ var isSameDay = (a, b) => !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
19
+ var isSameMonth = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
20
+ var compareDay = (a, b) => startOfDay(a).getTime() - startOfDay(b).getTime();
21
+ var startOfWeek = (d, weekStartsOn) => addDays(d, -((d.getDay() - weekStartsOn + 7) % 7));
22
+ var monthKey = (d) => d.getFullYear() * 12 + d.getMonth();
23
+ function monthGrid(month, weekStartsOn) {
24
+ const first = startOfWeek(startOfMonth(month), weekStartsOn);
25
+ return Array.from({ length: 6 }, (_, r) => Array.from({ length: 7 }, (_2, c) => addDays(first, r * 7 + c)));
26
+ }
27
+ var SLIDE = { type: "spring", stiffness: 380, damping: 36 };
28
+ var MARK = { type: "spring", stiffness: 520, damping: 38 };
29
+ var Calendar = React.forwardRef(function Calendar2(props, ref) {
30
+ const {
31
+ mode = "single",
32
+ value: valueProp,
33
+ defaultValue,
34
+ onValueChange,
35
+ month: monthProp,
36
+ defaultMonth,
37
+ onMonthChange,
38
+ min,
39
+ max,
40
+ isDateDisabled,
41
+ weekStartsOn = 1,
42
+ locale,
43
+ showOutsideDays = true,
44
+ size = "md",
45
+ haptics = true,
46
+ today: todayProp,
47
+ className,
48
+ ...rest
49
+ } = props;
50
+ const today = React.useMemo(() => startOfDay(todayProp ?? /* @__PURE__ */ new Date()), [todayProp?.getTime()]);
51
+ const isRange = mode === "range";
52
+ const [value, setValue] = useControllableState({
53
+ value: valueProp,
54
+ defaultValue: defaultValue ?? (isRange ? { start: null, end: null } : null),
55
+ onChange: onValueChange
56
+ });
57
+ const single = isRange ? null : value;
58
+ const range = isRange ? value ?? { start: null, end: null } : { start: null, end: null };
59
+ const anchor = single ?? range.start ?? today;
60
+ const [month, setMonthState] = useControllableState({
61
+ value: monthProp,
62
+ defaultValue: startOfMonth(defaultMonth ?? anchor),
63
+ onChange: onMonthChange
64
+ });
65
+ const [direction, setDirection] = React.useState(1);
66
+ const [view, setView] = React.useState("days");
67
+ const [focusDate, setFocusDate] = React.useState(anchor);
68
+ const [hover, setHover] = React.useState(null);
69
+ const gridRef = React.useRef(null);
70
+ const wantsFocus = React.useRef(false);
71
+ const { t, reduced } = useMotionPreset();
72
+ const layoutId = React.useId();
73
+ const goMonth = (next) => {
74
+ const n = startOfMonth(next);
75
+ if (monthKey(n) === monthKey(month)) return;
76
+ setDirection(monthKey(n) > monthKey(month) ? 1 : -1);
77
+ setMonthState(n);
78
+ };
79
+ const disabled = (d) => min && compareDay(d, min) < 0 || max && compareDay(d, max) > 0 || !!isDateDisabled?.(d);
80
+ const select = (d) => {
81
+ if (disabled(d)) return;
82
+ if (haptics) haptic(4);
83
+ setFocusDate(d);
84
+ if (!isSameMonth(d, month)) goMonth(d);
85
+ if (!isRange) {
86
+ setValue(d);
87
+ return;
88
+ }
89
+ const { start, end } = range;
90
+ if (!start || start && end) setValue({ start: d, end: null });
91
+ else if (compareDay(d, start) < 0) setValue({ start: d, end: start });
92
+ else setValue({ start, end: d });
93
+ };
94
+ const moveFocus = (d) => {
95
+ setFocusDate(d);
96
+ wantsFocus.current = true;
97
+ if (!isSameMonth(d, month)) goMonth(d);
98
+ };
99
+ React.useEffect(() => {
100
+ if (!wantsFocus.current) return;
101
+ wantsFocus.current = false;
102
+ const key = focusDate.toDateString();
103
+ requestAnimationFrame(() => gridRef.current?.querySelector(`[data-date="${key}"]`)?.focus());
104
+ }, [focusDate, month]);
105
+ const onGridKey = (event) => {
106
+ const map = {
107
+ ArrowLeft: () => addDays(focusDate, -1),
108
+ ArrowRight: () => addDays(focusDate, 1),
109
+ ArrowUp: () => addDays(focusDate, -7),
110
+ ArrowDown: () => addDays(focusDate, 7),
111
+ PageUp: () => addMonths(focusDate, event.shiftKey ? -12 : -1),
112
+ PageDown: () => addMonths(focusDate, event.shiftKey ? 12 : 1),
113
+ Home: () => startOfWeek(focusDate, weekStartsOn),
114
+ End: () => addDays(startOfWeek(focusDate, weekStartsOn), 6)
115
+ };
116
+ const fn = map[event.key];
117
+ if (!fn) return;
118
+ event.preventDefault();
119
+ moveFocus(fn());
120
+ };
121
+ const fmtTitle = React.useMemo(() => new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }), [locale]);
122
+ const fmtMonth = React.useMemo(() => new Intl.DateTimeFormat(locale, { month: "short" }), [locale]);
123
+ const fmtDay = React.useMemo(() => new Intl.DateTimeFormat(locale, { weekday: "long", month: "long", day: "numeric", year: "numeric" }), [locale]);
124
+ const fmtWeekday = React.useMemo(() => new Intl.DateTimeFormat(locale, { weekday: "narrow" }), [locale]);
125
+ const weekdays = Array.from({ length: 7 }, (_, i) => addDays(startOfWeek(today, weekStartsOn), i));
126
+ const rows = monthGrid(month, weekStartsOn);
127
+ const rangeEnd = range.start && !range.end && hover ? hover : range.end;
128
+ const lo = range.start && rangeEnd ? compareDay(range.start, rangeEnd) <= 0 ? range.start : rangeEnd : range.start;
129
+ const hi = range.start && rangeEnd ? compareDay(range.start, rangeEnd) <= 0 ? rangeEnd : range.start : range.start;
130
+ const title = view === "days" ? fmtTitle.format(month) : view === "months" ? String(month.getFullYear()) : `${Math.floor(month.getFullYear() / 12) * 12} \u2013 ${Math.floor(month.getFullYear() / 12) * 12 + 11}`;
131
+ const step = (k) => {
132
+ if (view === "days") goMonth(addMonths(month, k));
133
+ else if (view === "months") goMonth(addMonths(month, k * 12));
134
+ else goMonth(addMonths(month, k * 144));
135
+ };
136
+ return /* @__PURE__ */ jsxs("div", { ...rest, ref, className: cx("fl-calendar", className), "data-size": size, "data-mode": mode, "data-view": view, children: [
137
+ /* @__PURE__ */ jsxs("div", { className: "fl-calendar__header", children: [
138
+ /* @__PURE__ */ jsxs(
139
+ "button",
140
+ {
141
+ type: "button",
142
+ className: "fl-reset-button fl-calendar__title",
143
+ "aria-live": "polite",
144
+ onClick: () => setView(view === "days" ? "months" : view === "months" ? "years" : "days"),
145
+ "aria-label": view === "days" ? `${title}, choose month` : view === "months" ? `${title}, choose year` : "Back to days",
146
+ children: [
147
+ /* @__PURE__ */ jsx("span", { className: "fl-calendar__title-clip", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: direction, children: /* @__PURE__ */ jsx(
148
+ motion.span,
149
+ {
150
+ custom: direction,
151
+ initial: { y: direction * 14, opacity: 0 },
152
+ animate: { y: 0, opacity: 1 },
153
+ exit: { y: direction * -14, opacity: 0 },
154
+ transition: t(SLIDE),
155
+ children: title
156
+ },
157
+ title
158
+ ) }) }),
159
+ /* @__PURE__ */ jsx(motion.svg, { viewBox: "0 0 12 12", width: "12", height: "12", "aria-hidden": true, animate: { rotate: view === "days" ? 0 : 180 }, transition: t(MARK), children: /* @__PURE__ */ jsx("path", { d: "M3 4.5 6 7.5 9 4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }) })
160
+ ]
161
+ }
162
+ ),
163
+ /* @__PURE__ */ jsxs("div", { className: "fl-calendar__nav", children: [
164
+ /* @__PURE__ */ jsx("button", { type: "button", className: "fl-reset-button fl-calendar__arrow", "aria-label": "Previous", onClick: () => step(-1), children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3.5 5.5 8l4.5 4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
165
+ /* @__PURE__ */ jsx("button", { type: "button", className: "fl-reset-button fl-calendar__arrow", "aria-label": "Next", onClick: () => step(1), children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M6 3.5 10.5 8 6 12.5", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
166
+ ] })
167
+ ] }),
168
+ /* @__PURE__ */ jsx("div", { className: "fl-calendar__viewport", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children: view === "days" ? /* @__PURE__ */ jsxs(
169
+ motion.div,
170
+ {
171
+ className: "fl-calendar__days",
172
+ initial: { opacity: 0, scale: 1.12 },
173
+ animate: { opacity: 1, scale: 1 },
174
+ exit: { opacity: 0, scale: 1.12 },
175
+ transition: t({ type: "spring", stiffness: 420, damping: 36 }),
176
+ children: [
177
+ /* @__PURE__ */ jsx("div", { className: "fl-calendar__weekdays", "aria-hidden": true, children: weekdays.map((d) => /* @__PURE__ */ jsx("span", { children: fmtWeekday.format(d) }, d.getDay())) }),
178
+ /* @__PURE__ */ jsx("div", { className: "fl-calendar__grid-clip", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: direction, children: /* @__PURE__ */ jsx(
179
+ motion.div,
180
+ {
181
+ ref: gridRef,
182
+ role: "grid",
183
+ "aria-label": fmtTitle.format(month),
184
+ className: "fl-calendar__grid",
185
+ custom: direction,
186
+ variants: {
187
+ enter: (dir) => ({ x: reduced ? 0 : `${dir * 36}%`, opacity: 0 }),
188
+ center: { x: "0%", opacity: 1 },
189
+ exit: (dir) => ({ x: reduced ? 0 : `${dir * -36}%`, opacity: 0 })
190
+ },
191
+ initial: "enter",
192
+ animate: "center",
193
+ exit: "exit",
194
+ transition: t(SLIDE),
195
+ onKeyDown: onGridKey,
196
+ onPointerLeave: () => setHover(null),
197
+ children: /* @__PURE__ */ jsx(LayoutGroup, { id: layoutId, children: rows.map((week, r) => {
198
+ const segStart = lo && hi ? week.findIndex((d) => compareDay(d, lo) >= 0 && compareDay(d, hi) <= 0) : -1;
199
+ let segEnd = -1;
200
+ if (segStart !== -1) {
201
+ for (let c = 6; c >= 0; c--) if (compareDay(week[c], lo) >= 0 && compareDay(week[c], hi) <= 0) {
202
+ segEnd = c;
203
+ break;
204
+ }
205
+ }
206
+ const capStart = segStart !== -1 && isSameDay(week[segStart], lo);
207
+ const capEnd = segEnd !== -1 && isSameDay(week[segEnd], hi);
208
+ return /* @__PURE__ */ jsxs(
209
+ motion.div,
210
+ {
211
+ role: "row",
212
+ className: "fl-calendar__row",
213
+ custom: direction,
214
+ initial: reduced ? false : { x: direction * (12 + r * 4) },
215
+ animate: { x: 0 },
216
+ transition: t({ ...SLIDE, delay: r * 0.018 }),
217
+ children: [
218
+ isRange && segStart !== -1 && !isSameDay(lo, hi) && /* @__PURE__ */ jsx(
219
+ motion.span,
220
+ {
221
+ className: "fl-calendar__band",
222
+ "aria-hidden": true,
223
+ "data-preview": !range.end && !!hover || void 0,
224
+ initial: false,
225
+ animate: {
226
+ left: `${segStart / 7 * 100}%`,
227
+ width: `${(segEnd - segStart + 1) / 7 * 100}%`,
228
+ borderTopLeftRadius: capStart ? 999 : 4,
229
+ borderBottomLeftRadius: capStart ? 999 : 4,
230
+ borderTopRightRadius: capEnd ? 999 : 4,
231
+ borderBottomRightRadius: capEnd ? 999 : 4
232
+ },
233
+ transition: t(MARK)
234
+ }
235
+ ),
236
+ week.map((day) => {
237
+ const outside = !isSameMonth(day, month);
238
+ const isDisabled = disabled(day);
239
+ const selected = isRange ? isSameDay(day, range.start) || isSameDay(day, range.end) : isSameDay(day, single);
240
+ const inRange = isRange && lo && hi && compareDay(day, lo) > 0 && compareDay(day, hi) < 0;
241
+ const isToday = isSameDay(day, today);
242
+ const focusable = isSameDay(day, focusDate) && isSameMonth(focusDate, month);
243
+ const fallbackFocus = !isSameMonth(focusDate, month) && day.getDate() === 1 && !outside;
244
+ const edge = isRange && (isSameDay(day, lo) || isSameDay(day, hi)) && !!hi;
245
+ return /* @__PURE__ */ jsx("div", { role: "gridcell", className: "fl-calendar__cell", "aria-selected": selected || !!inRange || void 0, children: (!outside || showOutsideDays) && /* @__PURE__ */ jsxs(
246
+ "button",
247
+ {
248
+ type: "button",
249
+ className: "fl-reset-button fl-calendar__day",
250
+ "data-date": day.toDateString(),
251
+ "data-outside": outside || void 0,
252
+ "data-today": isToday || void 0,
253
+ "data-selected": selected || edge || void 0,
254
+ "data-in-range": inRange || void 0,
255
+ disabled: isDisabled,
256
+ tabIndex: focusable || fallbackFocus ? 0 : -1,
257
+ "aria-label": fmtDay.format(day),
258
+ "aria-current": isToday ? "date" : void 0,
259
+ "aria-pressed": selected || void 0,
260
+ onClick: () => select(day),
261
+ onFocus: () => setFocusDate(day),
262
+ onPointerEnter: () => isRange && setHover(day),
263
+ children: [
264
+ (selected || edge) && /* @__PURE__ */ jsx(
265
+ motion.span,
266
+ {
267
+ layoutId: isRange ? void 0 : "mark",
268
+ className: "fl-calendar__mark",
269
+ initial: isRange ? { scale: 0.4, opacity: 0 } : false,
270
+ animate: { scale: 1, opacity: 1 },
271
+ transition: t(isRange ? { type: "spring", stiffness: 600, damping: 26 } : MARK)
272
+ }
273
+ ),
274
+ /* @__PURE__ */ jsx("span", { className: "fl-calendar__num", children: day.getDate() })
275
+ ]
276
+ }
277
+ ) }, day.toDateString());
278
+ })
279
+ ]
280
+ },
281
+ r
282
+ );
283
+ }) })
284
+ },
285
+ monthKey(month)
286
+ ) }) })
287
+ ]
288
+ },
289
+ "days"
290
+ ) : /* @__PURE__ */ jsx(
291
+ motion.div,
292
+ {
293
+ className: "fl-calendar__zoom",
294
+ "data-view": view,
295
+ initial: { opacity: 0, scale: view === "months" ? 0.86 : 0.86 },
296
+ animate: { opacity: 1, scale: 1 },
297
+ exit: { opacity: 0, scale: 0.86 },
298
+ transition: t({ type: "spring", stiffness: 420, damping: 36 }),
299
+ children: (view === "months" ? Array.from({ length: 12 }, (_, i) => new Date(month.getFullYear(), i, 1)) : Array.from({ length: 12 }, (_, i) => new Date(Math.floor(month.getFullYear() / 12) * 12 + i, month.getMonth(), 1))).map((d, i) => {
300
+ const current = view === "months" ? d.getMonth() === month.getMonth() : d.getFullYear() === month.getFullYear();
301
+ const isNow = view === "months" ? isSameMonth(d, today) : d.getFullYear() === today.getFullYear();
302
+ return /* @__PURE__ */ jsx(
303
+ motion.button,
304
+ {
305
+ type: "button",
306
+ className: "fl-reset-button fl-calendar__pick",
307
+ "data-current": current || void 0,
308
+ "data-today": isNow || void 0,
309
+ "aria-pressed": current,
310
+ initial: reduced ? false : { opacity: 0, y: 6 },
311
+ animate: { opacity: 1, y: 0 },
312
+ transition: t({ ...SLIDE, delay: i * 0.012 }),
313
+ onClick: () => {
314
+ goMonth(d);
315
+ setView(view === "years" ? "months" : "days");
316
+ },
317
+ children: view === "months" ? fmtMonth.format(d) : d.getFullYear()
318
+ },
319
+ d.toISOString()
320
+ );
321
+ })
322
+ },
323
+ view
324
+ ) }) }),
325
+ /* @__PURE__ */ jsx("span", { className: "fl-sr-only", "aria-live": "polite", children: isRange && range.start && !range.end ? `Start ${fmtDay.format(range.start)}. Choose an end date.` : "" })
326
+ ] });
327
+ });
328
+
329
+ export { Calendar };