@jfrader/ui 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/dist/accordion-DLul6vIl.js +205 -0
  2. package/dist/accordion.js +1 -1
  3. package/dist/{announcement-bar-B58xempt.js → announcement-bar-Dlbq5-9D.js} +1 -1
  4. package/dist/announcement-bar.js +1 -1
  5. package/dist/avatar-CaGJHy1N.js +145 -0
  6. package/dist/{avatar-group-DOQQuV51.js → avatar-group-M1opAQEG.js} +1 -1
  7. package/dist/avatar-group.js +1 -1
  8. package/dist/avatar.js +1 -1
  9. package/dist/badge-CjM5Agqk.js +119 -0
  10. package/dist/badge.js +1 -1
  11. package/dist/{bottom-sheet-DPJBFkie.js → bottom-sheet-DjZOPq4k.js} +10 -9
  12. package/dist/bottom-sheet.js +1 -1
  13. package/dist/{breadcrumbs-Cfw_hgt2.js → breadcrumbs-BDK_LiwH.js} +10 -3
  14. package/dist/breadcrumbs.js +1 -1
  15. package/dist/{button-C92uYFJW.js → button-NLY0h6EJ.js} +7 -7
  16. package/dist/button.js +1 -1
  17. package/dist/{calendar-B3Svu0X2.js → calendar-BzJdv_SZ.js} +3 -1
  18. package/dist/calendar.js +1 -1
  19. package/dist/card-Ca4KQKYQ.js +154 -0
  20. package/dist/card.js +1 -1
  21. package/dist/carousel-B7OrvD6J.js +474 -0
  22. package/dist/carousel.js +1 -1
  23. package/dist/{checkbox-cFquiSdy.js → checkbox-DKSzExj2.js} +16 -15
  24. package/dist/checkbox.js +1 -1
  25. package/dist/{chip-group-DTQd_M-G.js → chip-group-DjQ0_6Y9.js} +2 -1
  26. package/dist/chip-group.js +1 -1
  27. package/dist/{code-block-ahnRi-g8.js → code-block-B5we2lZa.js} +75 -74
  28. package/dist/code-block.js +1 -1
  29. package/dist/{combobox-Bhzvu9ma.js → combobox-DFFqOBCi.js} +114 -109
  30. package/dist/combobox.js +1 -1
  31. package/dist/command-palette-BmQu2w4H.js +391 -0
  32. package/dist/command-palette.js +1 -1
  33. package/dist/comment-thread-ASaXDcGo.js +1410 -0
  34. package/dist/comment-thread.js +2 -0
  35. package/dist/context-menu-__1c2Dk9.js +370 -0
  36. package/dist/context-menu.js +2 -0
  37. package/dist/{copy-button-ByiA6D3R.js → copy-button-DCSLcYS-.js} +1 -1
  38. package/dist/copy-button.js +1 -1
  39. package/dist/{date-picker-5zKSSuFF.js → date-picker-BiPN7yeK.js} +4 -4
  40. package/dist/date-picker.js +1 -1
  41. package/dist/date-range-picker-DQpUeKqV.js +570 -0
  42. package/dist/date-range-picker.js +1 -1
  43. package/dist/{dialog-ciiv9H2b.js → dialog-BX1zYMs-.js} +2 -1
  44. package/dist/dialog.js +1 -1
  45. package/dist/{divider-DYoJf0I_.js → divider-Cp7aNbhM.js} +21 -20
  46. package/dist/divider.js +1 -1
  47. package/dist/elastic-slider-BG6K019r.js +395 -0
  48. package/dist/elastic-slider.js +2 -0
  49. package/dist/{expandable-card-C-qJcZ14.js → expandable-card-rUATve0o.js} +8 -1
  50. package/dist/expandable-card.js +1 -1
  51. package/dist/expanding-search-BxOwtdwt.js +238 -0
  52. package/dist/expanding-search.js +2 -0
  53. package/dist/file-dropzone-BuXm3Tea.js +457 -0
  54. package/dist/file-dropzone.js +1 -1
  55. package/dist/{filter-toolbar-D5KEKTSe.js → filter-toolbar-Cy5Hqur-.js} +4 -2
  56. package/dist/filter-toolbar.js +1 -1
  57. package/dist/{hover-card-B-nrCIy2.js → hover-card-CoMJKg1g.js} +7 -7
  58. package/dist/hover-card.js +1 -1
  59. package/dist/{image-compare-ciuhPtQZ.js → image-compare-BxY8Ykzt.js} +1 -1
  60. package/dist/image-compare.js +1 -1
  61. package/dist/index.js +81 -76
  62. package/dist/{json-viewer-BcySQfjZ.js → json-viewer-DgWqyU75.js} +7 -3
  63. package/dist/json-viewer.js +1 -1
  64. package/dist/mention-input-sq61si9L.js +600 -0
  65. package/dist/mention-input.js +1 -1
  66. package/dist/menu-DDKgmK2F.js +295 -0
  67. package/dist/menu.js +1 -1
  68. package/dist/{metric-card-Bh9K4fZs.js → metric-card--lVTz5Wn.js} +2 -2
  69. package/dist/metric-card.js +1 -1
  70. package/dist/{multi-select-Pce_IYnz.js → multi-select-DG1BCFX7.js} +14 -6
  71. package/dist/multi-select.js +1 -1
  72. package/dist/{navigation-sP5fiuQS.js → navigation-CC26JDr-.js} +20 -14
  73. package/dist/navigation.js +1 -1
  74. package/dist/{overlay-layer-SeUyyEPD.js → overlay-layer-qEbpEtb8.js} +16 -2
  75. package/dist/{pagination-DmXZ8E85.js → pagination-BfkeWbmP.js} +23 -22
  76. package/dist/pagination.js +1 -1
  77. package/dist/pill-BaS-uIbn.js +58 -0
  78. package/dist/pill.js +1 -1
  79. package/dist/popover-CErIw2q3.js +125 -0
  80. package/dist/popover.js +1 -1
  81. package/dist/{progress-CbOWBUdA.js → progress-DAQkfhPd.js} +1 -1
  82. package/dist/progress.js +1 -1
  83. package/dist/{radio-cards-D2QZENI_.js → radio-cards-Cu9cBssN.js} +35 -34
  84. package/dist/radio-cards.js +1 -1
  85. package/dist/{radio-group-E6mMRgo7.js → radio-group-TIK0-iPX.js} +18 -15
  86. package/dist/radio-group.js +1 -1
  87. package/dist/{resizable-panels-BhjUVXZZ.js → resizable-panels-DUpQEpwG.js} +3 -2
  88. package/dist/resizable-panels.js +1 -1
  89. package/dist/{search-field-IxF0IJXm.js → search-field-DMvho0KQ.js} +2 -2
  90. package/dist/search-field.js +1 -1
  91. package/dist/{segmented-control-yO1K1nbi.js → segmented-control-8ZUGnsZm.js} +2 -1
  92. package/dist/segmented-control.js +1 -1
  93. package/dist/{select-n_H52W1Z.js → select-D5rhJ8gi.js} +3 -2
  94. package/dist/select.js +1 -1
  95. package/dist/{signature-pad-q2SAsrdD.js → signature-pad-_bTeguN9.js} +256 -251
  96. package/dist/signature-pad.js +1 -1
  97. package/dist/slider-DVG6-Awh.js +308 -0
  98. package/dist/slider.js +1 -1
  99. package/dist/{sortable-data-table-tirqlLY2.js → sortable-data-table-CYKT_Ng7.js} +2 -2
  100. package/dist/sortable-data-table.js +1 -1
  101. package/dist/{split-button-Cb3EHs64.js → split-button-BCw4zZom.js} +75 -81
  102. package/dist/split-button.js +1 -1
  103. package/dist/{swipe-actions-DiZC57-3.js → swipe-actions-CBuJREU1.js} +4 -2
  104. package/dist/swipe-actions.js +1 -1
  105. package/dist/switch-C1WrKrf-.js +145 -0
  106. package/dist/switch.js +1 -1
  107. package/dist/tabs-XluwRjgg.js +210 -0
  108. package/dist/tabs.js +1 -1
  109. package/dist/{text-field-C8TWG-tY.js → text-field-hU72iSVS.js} +15 -13
  110. package/dist/text-field.js +1 -1
  111. package/dist/{textarea-BrW0XcG_.js → textarea-3k4Y0QQ3.js} +18 -16
  112. package/dist/textarea.js +1 -1
  113. package/dist/theme-root.js +1 -1
  114. package/dist/theme-switch-C505TtU8.js +166 -0
  115. package/dist/theme-switch.js +2 -0
  116. package/dist/{time-picker-Db8D49cP.js → time-picker-CPlhW0tr.js} +26 -20
  117. package/dist/time-picker.js +1 -1
  118. package/dist/{timeline-k3nURuCP.js → timeline-B0uAAVfT.js} +8 -2
  119. package/dist/timeline.js +1 -1
  120. package/dist/{toast-BHxI32ZA.js → toast-B7wo3sX1.js} +98 -79
  121. package/dist/{toast-stack-DqrAzdg5.js → toast-stack-B40VpS4M.js} +18 -4
  122. package/dist/toast-stack.js +1 -1
  123. package/dist/toast.js +1 -1
  124. package/dist/{toggle-group-fcjzpifI.js → toggle-group-B2fpFZwV.js} +1 -1
  125. package/dist/toggle-group.js +1 -1
  126. package/dist/tooltip-BvgVTCTN.js +120 -0
  127. package/dist/tooltip.js +1 -1
  128. package/dist/{tree-view-C2liIxqy.js → tree-view-j8qLqkb_.js} +5 -1
  129. package/dist/tree-view.js +1 -1
  130. package/dist/types/components/checkbox/checkbox.d.ts +1 -1
  131. package/dist/types/components/command-palette/command-palette.d.ts +1 -1
  132. package/dist/types/components/comment-thread/comment-thread.d.ts +118 -0
  133. package/dist/types/components/comment-thread/index.d.ts +1 -0
  134. package/dist/types/components/comment-thread/thread-core.d.ts +96 -0
  135. package/dist/types/components/comment-thread/thread-parts.d.ts +114 -0
  136. package/dist/types/components/context-menu/context-menu.d.ts +55 -0
  137. package/dist/types/components/context-menu/index.d.ts +2 -0
  138. package/dist/types/components/date-range-picker/date-range-picker.d.ts +1 -1
  139. package/dist/types/components/elastic-slider/elastic-slider.d.ts +53 -0
  140. package/dist/types/components/elastic-slider/index.d.ts +1 -0
  141. package/dist/types/components/expanding-search/expanding-search.d.ts +22 -0
  142. package/dist/types/components/expanding-search/index.d.ts +1 -0
  143. package/dist/types/components/menu/menu.d.ts +50 -7
  144. package/dist/types/components/pagination/pagination.d.ts +1 -1
  145. package/dist/types/components/radio-cards/radio-cards.d.ts +1 -1
  146. package/dist/types/components/radio-group/radio-group.d.ts +1 -1
  147. package/dist/types/components/slider/slider-style.d.ts +14 -0
  148. package/dist/types/components/slider/slider.d.ts +2 -10
  149. package/dist/types/components/slider/use-slider-interaction.d.ts +79 -0
  150. package/dist/types/components/split-button/split-button.d.ts +2 -2
  151. package/dist/types/components/tabs/tabs.d.ts +1 -1
  152. package/dist/types/components/text-field/text-field.d.ts +1 -1
  153. package/dist/types/components/textarea/textarea.d.ts +1 -1
  154. package/dist/types/components/theme-switch/index.d.ts +1 -0
  155. package/dist/types/components/theme-switch/theme-switch.d.ts +33 -0
  156. package/dist/types/components/tooltip/tooltip.d.ts +1 -1
  157. package/dist/types/index.d.ts +5 -0
  158. package/dist/types/overlay/overlay-layer.d.ts +20 -0
  159. package/dist/types/overlay/use-overlay-floating.d.ts +9 -2
  160. package/dist/{use-overlay-floating-DvJifLpF.js → use-overlay-floating-Bx2jBKAA.js} +8 -6
  161. package/dist/use-slider-interaction-ChL-208h.js +234 -0
  162. package/package.json +22 -2
  163. package/dist/accordion-xCI_u0BV.js +0 -198
  164. package/dist/avatar-BahDVO9t.js +0 -132
  165. package/dist/badge-B_sLygxU.js +0 -108
  166. package/dist/card-D-aI2QHx.js +0 -158
  167. package/dist/carousel-IvPqN-oM.js +0 -472
  168. package/dist/command-palette-BQ5LleGb.js +0 -384
  169. package/dist/date-range-picker-B5uFWsm-.js +0 -562
  170. package/dist/file-dropzone-pR4v7owg.js +0 -457
  171. package/dist/mention-input-BcQKX2EJ.js +0 -599
  172. package/dist/menu-xwOOUtWP.js +0 -275
  173. package/dist/pill-DO2gHzMb.js +0 -56
  174. package/dist/popover-QHcEvf9c.js +0 -119
  175. package/dist/slider-t0B5cecO.js +0 -477
  176. package/dist/switch-qwv8jQnR.js +0 -142
  177. package/dist/tabs-CAVJndX1.js +0 -203
  178. package/dist/tooltip-CkeiW9C1.js +0 -113
  179. package/dist/{theme-root-BbTBuLMQ.js → theme-root-Bs1U3uPA.js} +2 -2
@@ -1,472 +0,0 @@
1
- 'use client';
2
- import { r as e, t } from "./sx-Dx9JUKp5.js";
3
- import { n, t as r } from "./focus-ring-BK5W5_NY.js";
4
- import { n as i, r as a } from "./media-8yrN85VT.js";
5
- import { n as o } from "./roving-focus-CYlo_Kf8.js";
6
- import { t as ee } from "./use-controlled-state-DpeVQZNR.js";
7
- import { t as s } from "./button-C92uYFJW.js";
8
- import { Children as te, isValidElement as c, useEffect as l, useId as ne, useLayoutEffect as re, useMemo as ie, useRef as u, useState as d, useSyncExternalStore as ae } from "react";
9
- import { vars as f } from "@jfrader/tokens/vars";
10
- import { createElement as oe } from "@emotion/react";
11
- import { jsx as p, jsxs as se } from "@emotion/react/jsx-runtime";
12
- import { useMergeRefs as m } from "@floating-ui/react";
13
- //#region src/components/carousel/carousel.tsx
14
- var ce = "min(80cqw, 21rem)", h = "min(var(--carousel-slide-size), 100cqw)", le = 6, ue = 120, g = "(prefers-reduced-motion: reduce)", de = "a[href], button, input, select, textarea, label, summary, [contenteditable]:not([contenteditable=\"false\"]), [tabindex], [role=\"slider\"]", fe = {
15
- itemSelector: "[role=\"tab\"]",
16
- ownerSelector: "[role=\"tablist\"]"
17
- }, _ = () => {};
18
- function pe(e) {
19
- if (typeof window > "u" || !window.matchMedia) return _;
20
- let t = window.matchMedia(g);
21
- return t.addEventListener("change", e), () => t.removeEventListener("change", e);
22
- }
23
- var me = () => typeof window < "u" && window.matchMedia?.(g).matches === !0;
24
- function he(e) {
25
- return typeof document > "u" ? _ : (document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e));
26
- }
27
- var ge = () => typeof document < "u" && document.hidden, _e = () => !1;
28
- function ve(e, t) {
29
- return t === 0 ? 0 : Math.min(Math.max(Number.isFinite(e) ? Math.trunc(e) : 0, 0), t - 1);
30
- }
31
- function v(e, t) {
32
- return (n) => {
33
- e?.(n), n.defaultPrevented || t(n);
34
- };
35
- }
36
- var ye = (...e) => e.filter(Boolean).join(" ") || void 0, y = (e, t) => c(e) && e.key !== null ? e.key : `slide-${t}`, be = e({
37
- label: "carousel",
38
- containerType: "inline-size",
39
- boxSizing: "border-box",
40
- inlineSize: "100%",
41
- minInlineSize: 0,
42
- display: "grid",
43
- gap: f.space[3],
44
- fontFamily: f.font.sans,
45
- color: f.color.text
46
- }), xe = e({ justifySelf: "start" }), Se = e({
47
- overflowX: "auto",
48
- overflowY: "hidden",
49
- scrollSnapType: "inline mandatory",
50
- overscrollBehaviorInline: "contain",
51
- scrollbarWidth: "none",
52
- borderRadius: f.radius.lg,
53
- "&:focus-visible": n,
54
- "&[data-disabled]": { overflowX: "hidden" },
55
- "&[data-dragging]": {
56
- cursor: "grabbing",
57
- userSelect: "none"
58
- }
59
- }), Ce = e({
60
- display: "flex",
61
- gap: f.space[3],
62
- inlineSize: "max-content",
63
- paddingInline: `calc((100cqw - ${h}) / 2)`
64
- }), we = e({
65
- flex: "none",
66
- boxSizing: "border-box",
67
- inlineSize: h,
68
- minInlineSize: 0,
69
- scrollSnapAlign: "center",
70
- scrollSnapStop: "always"
71
- }), Te = e({
72
- display: "flex",
73
- flexWrap: "wrap",
74
- alignItems: "center",
75
- gap: f.space[2]
76
- }), Ee = e({
77
- display: "flex",
78
- flex: "1 1 auto",
79
- minInlineSize: 0,
80
- overflowX: "auto",
81
- scrollbarWidth: "none"
82
- }), De = e({
83
- appearance: "none",
84
- display: "inline-grid",
85
- placeItems: "center",
86
- flex: "none",
87
- minInlineSize: f.space[8],
88
- blockSize: f.space[8],
89
- padding: 0,
90
- border: 0,
91
- borderRadius: f.radius.full,
92
- background: "transparent",
93
- cursor: "pointer",
94
- "&:hover:not([aria-disabled=\"true\"]):not([aria-selected=\"true\"]) > span": { backgroundColor: f.color.textMuted },
95
- "&[aria-selected=\"true\"] > span": {
96
- inlineSize: f.space[6],
97
- backgroundColor: f.color.accent
98
- },
99
- "&[aria-disabled=\"true\"]": {
100
- cursor: "not-allowed",
101
- opacity: .55
102
- },
103
- "&:focus-visible": r,
104
- [i]: {
105
- "& > span": {
106
- forcedColorAdjust: "none",
107
- backgroundColor: "CanvasText"
108
- },
109
- "&[aria-selected=\"true\"] > span": { backgroundColor: "Highlight" }
110
- }
111
- }), Oe = e({
112
- display: "block",
113
- inlineSize: f.space[2],
114
- blockSize: f.space[2],
115
- borderRadius: f.radius.full,
116
- backgroundColor: f.color.borderControl,
117
- transitionProperty: "inline-size, background-color",
118
- transitionDuration: f.motion.duration.fast,
119
- transitionTimingFunction: f.motion.easeStandard,
120
- [a]: { transitionDuration: "0s" }
121
- }), ke = e({
122
- inlineSize: f.space[8],
123
- paddingInline: 0
124
- }), Ae = e({
125
- inlineSize: f.space[4],
126
- blockSize: f.space[4],
127
- "&:dir(rtl)": { transform: "scaleX(-1)" }
128
- }), je = e({
129
- margin: 0,
130
- textAlign: "center",
131
- fontSize: f.textSize.sm,
132
- lineHeight: f.lineHeight.base,
133
- color: f.color.textMuted,
134
- fontVariantNumeric: "tabular-nums"
135
- }), Me = e({
136
- display: "grid",
137
- placeItems: "center",
138
- padding: f.space[8],
139
- border: `1px dashed ${f.color.borderControl}`,
140
- borderRadius: f.radius.lg,
141
- fontSize: f.textSize.sm,
142
- lineHeight: f.lineHeight.base,
143
- color: f.color.textMuted
144
- });
145
- function Ne({ direction: e }) {
146
- return /* @__PURE__ */ p("svg", {
147
- viewBox: "0 0 16 16",
148
- "aria-hidden": "true",
149
- focusable: "false",
150
- css: Ae,
151
- children: /* @__PURE__ */ p("path", {
152
- d: e === "previous" ? "M10 3 5 8l5 5" : "m6 3 5 5-5 5",
153
- fill: "none",
154
- stroke: "currentColor",
155
- strokeWidth: "1.5",
156
- strokeLinecap: "round",
157
- strokeLinejoin: "round"
158
- })
159
- });
160
- }
161
- function b({ ref: e, children: n, value: r, defaultValue: i = 0, onValueChange: a, slideSize: c = ce, getSlideLabel: f, activation: h = "auto", interval: g, autoPlay: Ae = !1, playingValue: b, defaultPlayingValue: Pe, onPlayingValueChange: Fe, locale: Ie, labels: Le, disabled: x = !1, slotProps: S, className: Re, sx: ze, style: Be, role: Ve = "region", "aria-roledescription": He, onFocus: Ue, onBlur: We, onPointerEnter: Ge, onPointerLeave: Ke, ...qe }) {
162
- let Je = ne(), Ye = ie(() => new Intl.NumberFormat(Ie), [Ie]), C = {
163
- slides: "Slides",
164
- chooseSlide: "Choose slide",
165
- previous: "Previous slide",
166
- next: "Next slide",
167
- startRotation: "Start slide rotation",
168
- stopRotation: "Stop slide rotation",
169
- empty: "No slides",
170
- carouselRole: "carousel",
171
- slideCount: (e, t) => `Slide ${Ye.format(e + 1)} of ${Ye.format(t)}`,
172
- ...Le
173
- }, Xe = f ?? C.slideCount, w = te.toArray(n), T = w.length, Ze = JSON.stringify(w.map(y)), E = T > 1, [Qe, D] = ee(r, i, a), O = Qe ?? 0, k = ve(O, T), A = E && !x, j = typeof g == "number" && Number.isFinite(g) && g > 0 ? g : void 0, M = j !== void 0 && E, [$e, et] = ee(b, Pe ?? Ae, Fe), [tt, N] = d(!1), [P, nt] = d(null), F = ae(pe, me, _e), rt = ae(he, ge, _e), [it, at] = d(!1), [ot, st] = d(!1), [ct, lt] = d(!1), I = M && $e && !tt && !F && !x, L = I && !it && !ot && !rt && !ct, [R, ut] = d(null), dt = R !== null && R < T ? R : k, [ft, pt] = d(0), mt = u(null), z = u(null), B = u(null), ht = u(null), gt = m([e, mt]), _t = m([S?.viewport?.ref, z]), vt = m([S?.tabList?.ref, ht]), V = u(null), H = u(null), U = u(null), W = u(null), G = u(null), K = u(null), yt = u(!0), bt = u(0), xt = u(void 0), St = (e) => `${Je}-panel-${e}`, Ct = (e) => `${Je}-tab-${e}`;
174
- l(() => {
175
- Number.isFinite(O) || console.warn(`Carousel: value ${O} is not a finite index; showing the first slide.`);
176
- }, [O]), l(() => {
177
- F && N(!0);
178
- }, [F]), l(() => {
179
- let e = mt.current;
180
- if (!M || !e || typeof IntersectionObserver > "u") return;
181
- let t = new IntersectionObserver(([e]) => lt(e ? !e.isIntersecting : !1));
182
- return t.observe(e), () => t.disconnect();
183
- }, [M]), l(() => {
184
- if (!L || j === void 0) return;
185
- let e = setTimeout(() => {
186
- nt(k), D((k + 1) % T);
187
- }, j);
188
- return () => clearTimeout(e);
189
- }, [
190
- L,
191
- j,
192
- k,
193
- T,
194
- D
195
- ]), l(() => {
196
- P !== null && (nt(null), P === k && N(!0));
197
- }, [P, k]), l(() => () => clearTimeout(xt.current), []);
198
- let wt = (e) => B.current?.children[e], Tt = (e, t) => {
199
- let n = z.current, r = wt(e);
200
- if (!n || !r) return;
201
- let i = n.getBoundingClientRect(), a = r.getBoundingClientRect(), o = a.left + a.width / 2 - (i.left + i.width / 2);
202
- Math.abs(o) < 1 || (K.current = n.scrollLeft + o, n.scrollTo({
203
- left: K.current,
204
- behavior: t
205
- }));
206
- }, Et = () => {
207
- let e = z.current, t = B.current;
208
- if (!e || !t) return k;
209
- let n = e.getBoundingClientRect(), r = n.left + n.width / 2, i = k, a = Infinity;
210
- return Array.from(t.children).forEach((e, t) => {
211
- let n = e.getBoundingClientRect(), o = Math.abs(n.left + n.width / 2 - r);
212
- o < a && (a = o, i = t);
213
- }), i;
214
- };
215
- re(() => {
216
- bt.current = k;
217
- let e = z.current;
218
- if (!e) return;
219
- let { activeElement: t, body: n } = e.ownerDocument, r = V.current, i = (t) => e.contains(t) && t.closest("[inert]") !== null, a = t !== null && i(t), o = t === n && r !== null && (!r.isConnected || i(r));
220
- (a || o) && e.focus({ preventScroll: !0 }), ht.current?.contains(t) || ut(null), !H.current?.active && (Tt(k, yt.current || F ? "instant" : "smooth"), yt.current = !1);
221
- }, [
222
- k,
223
- Ze,
224
- ft
225
- ]), l(() => {
226
- let e = z.current;
227
- if (!e || typeof ResizeObserver > "u") return;
228
- let t = new ResizeObserver(() => {
229
- H.current?.active || Tt(bt.current, "instant");
230
- });
231
- return t.observe(e), () => t.disconnect();
232
- }, [T > 0]);
233
- let q = (e) => {
234
- if (!A) return;
235
- let t = ve(e, T);
236
- t !== k && D(t);
237
- }, Dt = (e) => {
238
- U.current = e, q(e), pt((e) => e + 1);
239
- }, Ot = () => {
240
- let e = z.current, t = K.current;
241
- if (e && t !== null) {
242
- Math.abs(e.scrollLeft - t) < 2 && (K.current = null);
243
- return;
244
- }
245
- if (!A || H.current) return;
246
- let n = Et();
247
- n !== k && n !== U.current && Dt(n);
248
- }, kt = () => {
249
- clearTimeout(xt.current), xt.current = setTimeout(Ot, ue);
250
- }, At = typeof window < "u" && "onscrollend" in window, jt = () => {
251
- M && !tt && (N(!0), et(!1));
252
- }, Mt = v(Ue, (e) => {
253
- V.current = e.target, jt();
254
- }), Nt = v(We, (e) => {
255
- let t = e.relatedTarget;
256
- t !== null && !e.currentTarget.contains(t) && (V.current = null);
257
- }), Pt = () => {
258
- let e = G.current ?? (I ? "stop" : "start");
259
- G.current = null, N(e === "stop"), et(e === "start");
260
- }, Ft = () => {
261
- U.current = null, K.current = null;
262
- }, It = (e) => {
263
- if (Ft(), e.target !== e.currentTarget || !A) return;
264
- let t = getComputedStyle(e.currentTarget).direction === "rtl", n = {
265
- ArrowRight: k + (t ? -1 : 1),
266
- ArrowLeft: k + (t ? 1 : -1),
267
- Home: 0,
268
- End: T - 1
269
- }[e.key];
270
- n !== void 0 && (e.preventDefault(), q(n));
271
- }, Lt = (e) => {
272
- if (Ft(), !A || e.pointerType !== "mouse" || e.button !== 0) return;
273
- let t = e.currentTarget, n = e.target.closest(de);
274
- n && n !== t && t.contains(n) || (H.current = {
275
- pointerId: e.pointerId,
276
- startX: e.clientX,
277
- startY: e.clientY,
278
- startScroll: t.scrollLeft,
279
- active: !1
280
- });
281
- }, Rt = (e) => {
282
- let t = H.current;
283
- if (!t || t.pointerId !== e.pointerId) return;
284
- let n = e.currentTarget, r = e.clientX - t.startX, i = e.clientY - t.startY;
285
- if (!t.active) {
286
- if (Math.abs(i) >= le && Math.abs(i) > Math.abs(r)) {
287
- H.current = null;
288
- return;
289
- }
290
- if (Math.abs(r) < le) return;
291
- t.active = !0, n.setPointerCapture(e.pointerId), n.style.scrollSnapType = "none", n.ownerDocument.getSelection()?.removeAllRanges(), st(!0);
292
- }
293
- n.scrollLeft = t.startScroll - r;
294
- }, zt = (e, t) => {
295
- let n = H.current;
296
- if (!n || n.pointerId !== e.pointerId || (H.current = null, !n.active)) return;
297
- let r = e.currentTarget;
298
- if (r.style.scrollSnapType = "", st(!1), !t) {
299
- pt((e) => e + 1);
300
- return;
301
- }
302
- let i = (e) => {
303
- e.preventDefault(), e.stopPropagation();
304
- };
305
- r.addEventListener("click", i, {
306
- capture: !0,
307
- once: !0
308
- }), setTimeout(() => r.removeEventListener("click", i, { capture: !0 })), Dt(Et());
309
- }, Bt = (e) => {
310
- ut(e), h === "auto" && (W.current = e, q(e));
311
- }, Vt = (e) => {
312
- let t = W.current === e;
313
- W.current = null, !(h === "auto" && t) && q(e);
314
- }, Ht = (e) => {
315
- W.current = null, o(e, e.currentTarget, "horizontal", fe);
316
- }, Ut = {
317
- ...Be,
318
- "--carousel-slide-size": typeof c == "number" ? `${c}px` : c
319
- }, { viewport: J, track: Wt, slide: Gt, controls: Kt, tabList: Y, indicator: X, rotationButton: Z, previousButton: Q, nextButton: $, status: qt, empty: Jt } = S ?? {};
320
- return /* @__PURE__ */ p(t, {
321
- className: Re,
322
- styles: be,
323
- sx: ze,
324
- children: (e) => /* @__PURE__ */ se("section", {
325
- ...qe,
326
- ref: gt,
327
- role: Ve,
328
- "aria-roledescription": He ?? C.carouselRole,
329
- "data-ui": "carousel",
330
- "data-disabled": x || void 0,
331
- "data-rotating": L || void 0,
332
- className: e,
333
- style: Ut,
334
- onFocus: Mt,
335
- onBlur: Nt,
336
- onPointerEnter: v(Ge, (e) => {
337
- e.pointerType !== "touch" && at(!0);
338
- }),
339
- onPointerLeave: v(Ke, () => at(!1)),
340
- children: [
341
- M && /* @__PURE__ */ p(s, {
342
- size: "sm",
343
- variant: "outline",
344
- ...Z,
345
- css: [xe, Z?.css],
346
- "data-ui": "carousel-rotation",
347
- "aria-disabled": x || F || void 0,
348
- onPointerDown: v(Z?.onPointerDown, () => {
349
- G.current = I ? "stop" : "start";
350
- }),
351
- onClick: v(Z?.onClick, Pt),
352
- children: I ? C.stopRotation : C.startRotation
353
- }),
354
- T === 0 ? /* @__PURE__ */ p("div", {
355
- ...Jt,
356
- "data-ui": "carousel-empty",
357
- css: [Me, Jt?.css],
358
- children: C.empty
359
- }) : /* @__PURE__ */ p("div", {
360
- ...J,
361
- ref: _t,
362
- role: "group",
363
- "aria-label": J?.["aria-label"] ?? (J?.["aria-labelledby"] ? void 0 : C.slides),
364
- tabIndex: A ? 0 : void 0,
365
- "data-ui": "carousel-viewport",
366
- "data-disabled": x || void 0,
367
- "data-dragging": ot || void 0,
368
- css: [Se, J?.css],
369
- onKeyDown: v(J?.onKeyDown, It),
370
- onWheel: v(J?.onWheel, Ft),
371
- onPointerDown: v(J?.onPointerDown, Lt),
372
- onPointerMove: v(J?.onPointerMove, Rt),
373
- onPointerUp: v(J?.onPointerUp, (e) => zt(e, !0)),
374
- onPointerCancel: v(J?.onPointerCancel, (e) => zt(e, !1)),
375
- onScroll: v(J?.onScroll, At ? _ : kt),
376
- onScrollEnd: v(J?.onScrollEnd, Ot),
377
- children: /* @__PURE__ */ p("div", {
378
- ...Wt,
379
- ref: B,
380
- "data-ui": "carousel-track",
381
- css: [Ce, Wt?.css],
382
- children: w.map((e, t) => {
383
- let n = t === k;
384
- return /* @__PURE__ */ oe("div", {
385
- ...Gt,
386
- key: y(e, t),
387
- role: E ? "tabpanel" : void 0,
388
- id: St(t),
389
- "aria-labelledby": ye(Gt?.["aria-labelledby"], E ? Ct(t) : void 0),
390
- "aria-hidden": !n || void 0,
391
- inert: !n,
392
- "data-ui": "carousel-slide",
393
- "data-state": n ? "active" : "inactive",
394
- css: [we, Gt?.css]
395
- }, e);
396
- })
397
- })
398
- }),
399
- E && /* @__PURE__ */ se("div", {
400
- ...Kt,
401
- "data-ui": "carousel-controls",
402
- css: [Te, Kt?.css],
403
- children: [
404
- /* @__PURE__ */ p("div", {
405
- ...Y,
406
- ref: vt,
407
- role: "tablist",
408
- "aria-label": Y?.["aria-label"] ?? (Y?.["aria-labelledby"] ? void 0 : C.chooseSlide),
409
- "aria-orientation": "horizontal",
410
- "data-ui": "carousel-tablist",
411
- css: [Ee, Y?.css],
412
- onKeyDown: v(Y?.onKeyDown, Ht),
413
- children: w.map((e, t) => /* @__PURE__ */ oe("button", {
414
- ...X,
415
- key: y(e, t),
416
- type: "button",
417
- role: "tab",
418
- id: Ct(t),
419
- "aria-label": Xe(t, T),
420
- "aria-selected": t === k,
421
- "aria-controls": St(t),
422
- "aria-disabled": x || void 0,
423
- tabIndex: t === dt ? 0 : -1,
424
- "data-ui": "carousel-indicator",
425
- css: [De, X?.css],
426
- onPointerDown: v(X?.onPointerDown, () => {
427
- W.current = null;
428
- }),
429
- onFocus: v(X?.onFocus, () => Bt(t)),
430
- onClick: v(X?.onClick, () => Vt(t))
431
- }, /* @__PURE__ */ p("span", { css: Oe })))
432
- }),
433
- /* @__PURE__ */ p(s, {
434
- size: "sm",
435
- variant: "outline",
436
- ...Q,
437
- css: [ke, Q?.css],
438
- "data-ui": "carousel-previous",
439
- "aria-label": Q?.["aria-label"] ?? C.previous,
440
- "aria-disabled": !A || k === 0 || void 0,
441
- onClick: v(Q?.onClick, () => q(k - 1)),
442
- children: /* @__PURE__ */ p(Ne, { direction: "previous" })
443
- }),
444
- /* @__PURE__ */ p(s, {
445
- size: "sm",
446
- variant: "outline",
447
- ...$,
448
- css: [ke, $?.css],
449
- "data-ui": "carousel-next",
450
- "aria-label": $?.["aria-label"] ?? C.next,
451
- "aria-disabled": !A || k === T - 1 || void 0,
452
- onClick: v($?.onClick, () => q(k + 1)),
453
- children: /* @__PURE__ */ p(Ne, { direction: "next" })
454
- })
455
- ]
456
- }),
457
- E && /* @__PURE__ */ p("div", {
458
- ...qt,
459
- role: "status",
460
- "aria-live": L ? "off" : "polite",
461
- "aria-atomic": "true",
462
- "data-ui": "carousel-status",
463
- css: [je, qt?.css],
464
- children: Xe(k, T)
465
- })
466
- ]
467
- })
468
- });
469
- }
470
- b.displayName = "Carousel";
471
- //#endregion
472
- export { b as t };