@blakesteve/roster 5.11.0 → 5.12.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.
- package/README.md +37 -8
- package/dist/components/atoms/Chip/chip-variants.cjs +1 -1
- package/dist/components/atoms/Chip/chip-variants.js +8 -2
- package/dist/components/atoms/Combobox/Combobox.cjs +1 -1
- package/dist/components/atoms/Combobox/Combobox.js +20 -18
- package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.js +22 -20
- package/dist/components/atoms/Select/Select.cjs +1 -1
- package/dist/components/atoms/Select/Select.js +19 -17
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
- package/dist/components/molecules/Carousel/Carousel.js +31 -29
- package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/molecules/FileUpload/FileUpload.js +21 -19
- package/dist/components/molecules/LiquidTabs/LiquidTabs.cjs +1 -1
- package/dist/components/molecules/LiquidTabs/LiquidTabs.js +22 -20
- package/dist/components/molecules/Menu/Menu.cjs +1 -1
- package/dist/components/molecules/Menu/Menu.js +104 -102
- package/dist/components/molecules/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/molecules/RadioGroup/RadioGroup.js +23 -21
- package/dist/components/molecules/RangeSlider/RangeSlider.cjs +1 -1
- package/dist/components/molecules/RangeSlider/RangeSlider.d.ts +8 -3
- package/dist/components/molecules/RangeSlider/RangeSlider.js +38 -36
- package/dist/components/molecules/Slider/Slider.cjs +1 -1
- package/dist/components/molecules/Slider/Slider.d.ts +7 -3
- package/dist/components/molecules/Slider/Slider.js +30 -28
- package/dist/components/molecules/Slider/track-parts.d.ts +2 -1
- package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
- package/dist/components/organisms/Dialog/Dialog.js +19 -17
- package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/ModerationQueue.js +45 -43
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.js +24 -22
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
- package/dist/components/organisms/Sheet/Sheet.js +25 -23
- package/dist/internal/key-focus.cjs +1 -0
- package/dist/internal/key-focus.d.ts +7 -0
- package/dist/internal/key-focus.js +60 -0
- package/dist/internal/popup.cjs +1 -1
- package/dist/internal/popup.d.ts +15 -1
- package/dist/internal/popup.js +17 -12
- package/dist/meta.json +3 -3
- package/dist/roster.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -555,6 +555,27 @@ the ring with it. In `Menu` the ring shows for keyboard focus only, because the
|
|
|
555
555
|
pointer moves focus there too. Headless UI's popups mark the keys' row and the
|
|
556
556
|
pointer's alike, so in theirs it shows on hover as well.
|
|
557
557
|
|
|
558
|
+
**Keyboard focus shows in Safari too.** Every ring is drawn on Roster's
|
|
559
|
+
`focus-visible` variant, which matches the engine's own `:focus-visible` or an
|
|
560
|
+
element marked `data-key-focus`. WebKit doesn't match `:focus-visible` on an
|
|
561
|
+
element a script focuses in answer to a key once the page has been clicked.
|
|
562
|
+
Escape handing focus back to a menu's or a select's trigger, or to a dialog's
|
|
563
|
+
opener, and a radio group's or tabs' arrows all drew no ring in Safari after
|
|
564
|
+
a click. A small internal tracker marks those elements: keyboard mode starts on a navigation key (Tab, Option+Tab, the
|
|
565
|
+
arrows, Escape, Enter, Space, Home, End, PageUp, PageDown) and ends on pointer
|
|
566
|
+
input, and it marks only what Chromium's own `:focus-visible` already matches,
|
|
567
|
+
so Chromium's rings are unchanged. It runs while a component that moves focus
|
|
568
|
+
is mounted (Menu, the select family, Dialog, Sheet, RadioGroup, LiquidTabs,
|
|
569
|
+
Slider and the rest), on one set of document listeners.
|
|
570
|
+
|
|
571
|
+
Your own components' rings come from your Tailwind, not Roster's, so they
|
|
572
|
+
don't follow the mark on their own. To have them do the same, redefine the
|
|
573
|
+
variant in your stylesheet as Roster does:
|
|
574
|
+
|
|
575
|
+
```css
|
|
576
|
+
@custom-variant focus-visible (&:is(:focus-visible, [data-key-focus]));
|
|
577
|
+
```
|
|
578
|
+
|
|
558
579
|
### Motion
|
|
559
580
|
|
|
560
581
|
Two hand-rolled utilities, both of which stop for `prefers-reduced-motion`.
|
|
@@ -744,11 +765,10 @@ opens are also legitimately different surfaces in plenty of palettes.
|
|
|
744
765
|
**Set these at `:root`, not on a container.** The menu and the tooltip bubble
|
|
745
766
|
are portaled to `<body>`, so they are not descendants of whatever you rendered
|
|
746
767
|
the component inside: properties set on a wrapper reach the trigger and stop
|
|
747
|
-
there
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
same reason the control family needs both.
|
|
768
|
+
there, and the result is a themed trigger opening an unthemed panel, which is
|
|
769
|
+
the exact problem this family exists to fix. Any ancestor of `<body>` works:
|
|
770
|
+
`:root`, `html.dark`, or inline on `<html>` all reach every panel. Set them in
|
|
771
|
+
both scopes too, for the same reason the control family needs both.
|
|
752
772
|
|
|
753
773
|
Where each component takes them, and why not everywhere:
|
|
754
774
|
|
|
@@ -939,9 +959,12 @@ look like oversights until you know why:
|
|
|
939
959
|
variable that inline rule reads:
|
|
940
960
|
`optionsClassName="rst:[--anchor-max-height:20rem]"`.
|
|
941
961
|
- **The panel is portaled to `<body>`**, so a `.dark` scoped to part of your
|
|
942
|
-
page does not reach it.
|
|
943
|
-
|
|
944
|
-
|
|
962
|
+
page does not reach it. The panel carries `.dark` itself in that case, and
|
|
963
|
+
only then: when `.dark` is on `<html>` or `<body>` the panel is already
|
|
964
|
+
inside it, and carrying the class would re-declare Roster's palette on the
|
|
965
|
+
panel over your own. Every portaled surface does the same (`Menu`, `Sheet`
|
|
966
|
+
and the toasts too). Custom properties are not carried: set
|
|
967
|
+
`--roster-popover-*` on an ancestor of `<body>`.
|
|
945
968
|
- **A row is a click target, and focus is a ring.** Every option row shows
|
|
946
969
|
the pointer cursor, as `Menu`'s items do (a disabled one, `not-allowed`).
|
|
947
970
|
A focused row keeps its tint and adds an inset `--roster-ring`, which is
|
|
@@ -1650,6 +1673,10 @@ import { Slider } from "@blakesteve/roster";
|
|
|
1650
1673
|
still lands anywhere between them. A chip shows as pressed (solid rather
|
|
1651
1674
|
than outline) while the value is exactly its value, and pressing it again
|
|
1652
1675
|
leaves it there. A point outside `min` to `max` is left out.
|
|
1676
|
+
- **The label** is a string or a node, so it can carry markup; the slider is
|
|
1677
|
+
named by reference to it, so what's read is its text. A consumer's own
|
|
1678
|
+
`aria-labelledby` names it instead, as when the visible label is shared and
|
|
1679
|
+
each slider needs its own name.
|
|
1653
1680
|
- **The number** shows beside the label (`formatValue` writes it). A screen
|
|
1654
1681
|
reader hears it with the nearest snap point's name, "72%, Likely", and
|
|
1655
1682
|
"Not set" while there's no value, never a number. Every string is in
|
|
@@ -1724,6 +1751,8 @@ import { RangeSlider } from "@blakesteve/roster";
|
|
|
1724
1751
|
- **Snap points** put a bead on the rail and a `Chip` under it, which does
|
|
1725
1752
|
what a tap on its mark does: moves the nearer thumb there (halfway, the
|
|
1726
1753
|
low one). A chip shows as pressed while either thumb is on it.
|
|
1754
|
+
- **The label** takes a node too, and names the group and each thumb by
|
|
1755
|
+
reference; a consumer's `aria-labelledby` names them instead.
|
|
1727
1756
|
- **The number** beside the label shows both, "$120 – $340"
|
|
1728
1757
|
(`labels.range`). Each thumb says its own value with the nearest snap
|
|
1729
1758
|
point's name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-ui rst:inline-flex rst:items-center rst:rounded-full rst:font-medium rst:whitespace-nowrap rst:align-middle rst:transition-colors",{variants:{colorScheme:{primary:"",success:"",error:"",amber:"",info:"",neutral:""},variant:{soft:"",outline:"rst:bg-transparent
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-ui rst:inline-flex rst:items-center rst:rounded-full rst:border rst:border-transparent rst:font-medium rst:whitespace-nowrap rst:align-middle rst:transition-colors",{variants:{colorScheme:{primary:"",success:"",error:"",amber:"",info:"",neutral:""},variant:{soft:"",outline:"rst:bg-transparent",solid:""},size:{sm:"rst:text-xs rst:px-2.5 rst:py-0.5 rst:gap-1.5",md:"rst:text-sm rst:px-3 rst:py-1 rst:gap-2"},disabled:{true:"rst:opacity-50 rst:cursor-not-allowed",false:""}},compoundVariants:[{variant:"soft",colorScheme:"primary",className:"rst:bg-primary-50 rst:text-primary-700 rst:dark:bg-primary-500/15 rst:dark:text-primary-300"},{variant:"soft",colorScheme:"success",className:"rst:bg-success-50 rst:text-success-700 rst:dark:bg-success-500/15 rst:dark:text-success-300"},{variant:"soft",colorScheme:"error",className:"rst:bg-error-50 rst:text-error-700 rst:dark:bg-error-500/15 rst:dark:text-error-300"},{variant:"soft",colorScheme:"amber",className:"rst:bg-amber-50 rst:text-amber-800 rst:dark:bg-amber-500/15 rst:dark:text-amber-300"},{variant:"soft",colorScheme:"info",className:"rst:bg-info-50 rst:text-info-700 rst:dark:bg-info-500/15 rst:dark:text-info-300"},{variant:"soft",colorScheme:"neutral",className:"rst:bg-gray-100 rst:text-gray-700 rst:dark:bg-gray-500/15 rst:dark:text-gray-300"},{variant:"outline",colorScheme:"primary",className:"rst:border-primary-600 rst:text-primary-700 rst:dark:border-primary-400 rst:dark:text-primary-300"},{variant:"outline",colorScheme:"success",className:"rst:border-success-600 rst:text-success-700 rst:dark:border-success-400 rst:dark:text-success-300"},{variant:"outline",colorScheme:"error",className:"rst:border-error-600 rst:text-error-700 rst:dark:border-error-400 rst:dark:text-error-300"},{variant:"outline",colorScheme:"amber",className:"rst:border-amber-600 rst:text-amber-800 rst:dark:border-amber-400 rst:dark:text-amber-300"},{variant:"outline",colorScheme:"info",className:"rst:border-info-600 rst:text-info-700 rst:dark:border-info-400 rst:dark:text-info-300"},{variant:"outline",colorScheme:"neutral",className:"rst:border-gray-600 rst:text-gray-700 rst:dark:border-gray-400 rst:dark:text-gray-300"},{variant:"solid",colorScheme:"primary",className:"rst:bg-primary-500 rst:text-primary-500-ink"},{variant:"solid",colorScheme:"success",className:"rst:bg-success-500 rst:text-success-500-ink"},{variant:"solid",colorScheme:"error",className:"rst:bg-error-500 rst:text-error-500-ink"},{variant:"solid",colorScheme:"amber",className:"rst:bg-amber-500 rst:text-amber-500-ink"},{variant:"solid",colorScheme:"info",className:"rst:bg-info-500 rst:text-info-500-ink"},{variant:"solid",colorScheme:"neutral",className:"rst:bg-gray-600 rst:dark:bg-gray-500 rst:text-gray-600-ink rst:dark:text-gray-500-ink"}],defaultVariants:{colorScheme:"neutral",variant:"soft",size:"md",disabled:!1}});exports.chipVariants=t;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { cva as r } from "../../../node_modules/class-variance-authority/dist/index.js";
|
|
2
2
|
const s = /* @__PURE__ */ r(
|
|
3
|
-
|
|
3
|
+
/* A border on every variant, transparent where the variant draws none, so
|
|
4
|
+
every variant is one size. Only `outline` had one, so a chip that swaps
|
|
5
|
+
`outline` for `solid` when selected, as a filter row and a slider's snap
|
|
6
|
+
chips do, lost the border's width on both sides at the press and the row
|
|
7
|
+
jumped. A transparent border costs nothing to see: the fill paints under
|
|
8
|
+
it. Its width is `--roster-border-width`, like every edge. */
|
|
9
|
+
"rst:font-ui rst:inline-flex rst:items-center rst:rounded-full rst:border rst:border-transparent rst:font-medium rst:whitespace-nowrap rst:align-middle rst:transition-colors",
|
|
4
10
|
{
|
|
5
11
|
variants: {
|
|
6
12
|
colorScheme: {
|
|
@@ -13,7 +19,7 @@ const s = /* @__PURE__ */ r(
|
|
|
13
19
|
},
|
|
14
20
|
variant: {
|
|
15
21
|
soft: "",
|
|
16
|
-
outline: "rst:bg-transparent
|
|
22
|
+
outline: "rst:bg-transparent",
|
|
17
23
|
solid: ""
|
|
18
24
|
},
|
|
19
25
|
size: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("react"),a=require("../../../node_modules/@headlessui/react/dist/components/combobox/combobox.cjs"),_=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),L=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),R=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),T=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),U=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),A=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),i=require("../../../lib/utils.cjs"),h=require("../../../internal/field-invalid.cjs"),V=require("../Input/input-variants.cjs"),E=require("../../../internal/PopupOption.cjs"),c=require("../../../internal/popup.cjs"),H=require("../../../internal/key-focus.cjs");function B(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const K=B(j),Q=(t,s)=>{const r=s.trim().toLowerCase();return r?t.filter(n=>n.label.toLowerCase().includes(r)):t},W=({options:t,value:s,onChange:r,placeholder:n="Search...",disabled:x=!1,variant:m,size:l,error:P,label:p,helperText:b,errorMessage:u,className:q,inputClassName:O,optionsClassName:g,emptyMessage:N="No matches",filter:C=Q,...f})=>{H.useKeyFocus();const[k,v]=K.useState(""),{ref:F,inDarkScope:w}=c.useDarkScope(),d=!!u||P,D=h.isFieldInvalid(d,f),I=h.withoutInvalidProps(f),y=C(t,k),S=t.find(o=>o.value===s)??null;return e.jsxs(L.Field,{disabled:x,className:i.cn("rst:flex rst:flex-col rst:gap-1.5",q),...I,children:[p&&e.jsx(R.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:p}),e.jsx(a.Combobox,{value:s??null,onChange:r,disabled:x,children:e.jsxs("div",{ref:F,className:"rst:relative",children:[e.jsx(a.ComboboxInput,{"aria-invalid":D||void 0,className:i.cn(V.inputVariants({variant:m,size:l,error:d}),O,"rst:pr-9"),placeholder:n,displayValue:()=>S?.label??"",onChange:o=>v(o.target.value)}),e.jsx(a.ComboboxButton,{className:i.cn("rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:w-11 rst:cursor-pointer rst:items-center rst:justify-end",l==="sm"?"rst:pr-2.5":"rst:pr-3"),children:e.jsx(U.FontAwesomeIcon,{icon:A.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})}),e.jsx(T.Transition,{as:j.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",afterLeave:()=>v(""),children:e.jsx(a.ComboboxOptions,{anchor:c.POPUP_ANCHOR,className:i.cn(c.popupInDarkPalette(w,m)&&"dark",c.POPUP_PANEL,c.POPUP_WIDTH_OF_INPUT,g),children:y.length===0?e.jsx(a.ComboboxOption,{value:"",disabled:!0,className:i.cn("rst:px-4 rst:py-2.5 rst:text-sm rst:opacity-70",l==="sm"&&"rst:px-3 rst:py-2"),children:N}):y.map(o=>e.jsx(E.PopupOption,{as:a.ComboboxOption,value:o.value,disabled:o.disabled,size:l,children:o.label},o.value))})})]})}),(b||u)&&e.jsx(_.Description,{className:i.cn("rst:text-xs rst:text-left",d?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:u||b})]})};exports.Combobox=W;
|
|
@@ -8,16 +8,17 @@ import { Field as T } from "../../../node_modules/@headlessui/react/dist/compone
|
|
|
8
8
|
import { Label as q } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
|
|
9
9
|
import { Transition as B } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
|
|
10
10
|
import { FontAwesomeIcon as E } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
|
|
11
|
-
import { faChevronDown as
|
|
11
|
+
import { faChevronDown as K } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
|
|
12
12
|
import { cn as e } from "../../../lib/utils.js";
|
|
13
|
-
import { isFieldInvalid as
|
|
13
|
+
import { isFieldInvalid as V, withoutInvalidProps as W } from "../../../internal/field-invalid.js";
|
|
14
14
|
import { inputVariants as Q } from "../Input/input-variants.js";
|
|
15
15
|
import { PopupOption as Z } from "../../../internal/PopupOption.js";
|
|
16
16
|
import { useDarkScope as G, POPUP_ANCHOR as J, POPUP_WIDTH_OF_INPUT as X, POPUP_PANEL as Y, popupInDarkPalette as $ } from "../../../internal/popup.js";
|
|
17
|
-
|
|
17
|
+
import { useKeyFocus as M } from "../../../internal/key-focus.js";
|
|
18
|
+
const z = (s, o) => {
|
|
18
19
|
const a = o.trim().toLowerCase();
|
|
19
20
|
return a ? s.filter((l) => l.label.toLowerCase().includes(a)) : s;
|
|
20
|
-
},
|
|
21
|
+
}, xt = ({
|
|
21
22
|
options: s,
|
|
22
23
|
value: o,
|
|
23
24
|
onChange: a,
|
|
@@ -25,23 +26,24 @@ const M = (s, o) => {
|
|
|
25
26
|
disabled: c = !1,
|
|
26
27
|
variant: d,
|
|
27
28
|
size: i,
|
|
28
|
-
error:
|
|
29
|
+
error: y,
|
|
29
30
|
label: p,
|
|
30
31
|
helperText: f,
|
|
31
|
-
errorMessage:
|
|
32
|
-
className:
|
|
32
|
+
errorMessage: m,
|
|
33
|
+
className: P,
|
|
33
34
|
inputClassName: N,
|
|
34
35
|
optionsClassName: C,
|
|
35
36
|
emptyMessage: k = "No matches",
|
|
36
|
-
filter: g =
|
|
37
|
+
filter: g = z,
|
|
37
38
|
...u
|
|
38
39
|
}) => {
|
|
39
|
-
|
|
40
|
+
M();
|
|
41
|
+
const [F, x] = U.useState(""), { ref: O, inDarkScope: w } = G(), n = !!m || y, I = V(n, u), D = W(u), h = g(s, F), L = s.find((r) => r.value === o) ?? null;
|
|
40
42
|
return /* @__PURE__ */ b(
|
|
41
43
|
T,
|
|
42
44
|
{
|
|
43
45
|
disabled: c,
|
|
44
|
-
className: e("rst:flex rst:flex-col rst:gap-1.5",
|
|
46
|
+
className: e("rst:flex rst:flex-col rst:gap-1.5", P),
|
|
45
47
|
...D,
|
|
46
48
|
children: [
|
|
47
49
|
p && /* @__PURE__ */ t(q, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left", children: p }),
|
|
@@ -51,13 +53,13 @@ const M = (s, o) => {
|
|
|
51
53
|
value: o ?? null,
|
|
52
54
|
onChange: a,
|
|
53
55
|
disabled: c,
|
|
54
|
-
children: /* @__PURE__ */ b("div", { ref:
|
|
56
|
+
children: /* @__PURE__ */ b("div", { ref: O, className: "rst:relative", children: [
|
|
55
57
|
/* @__PURE__ */ t(
|
|
56
58
|
S,
|
|
57
59
|
{
|
|
58
60
|
"aria-invalid": I || void 0,
|
|
59
61
|
className: e(
|
|
60
|
-
Q({ variant: d, size: i, error:
|
|
62
|
+
Q({ variant: d, size: i, error: n }),
|
|
61
63
|
N,
|
|
62
64
|
"rst:pr-9"
|
|
63
65
|
),
|
|
@@ -76,7 +78,7 @@ const M = (s, o) => {
|
|
|
76
78
|
children: /* @__PURE__ */ t(
|
|
77
79
|
E,
|
|
78
80
|
{
|
|
79
|
-
icon:
|
|
81
|
+
icon: K,
|
|
80
82
|
className: "rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500",
|
|
81
83
|
"aria-hidden": "true"
|
|
82
84
|
}
|
|
@@ -96,7 +98,7 @@ const M = (s, o) => {
|
|
|
96
98
|
{
|
|
97
99
|
anchor: J,
|
|
98
100
|
className: e(
|
|
99
|
-
$(
|
|
101
|
+
$(w, d) && "dark",
|
|
100
102
|
Y,
|
|
101
103
|
/* `--input-width`, not `--button-width`: the button here is
|
|
102
104
|
the chevron, so matching it renders a 20px sliver. */
|
|
@@ -132,14 +134,14 @@ const M = (s, o) => {
|
|
|
132
134
|
] })
|
|
133
135
|
}
|
|
134
136
|
),
|
|
135
|
-
(f ||
|
|
137
|
+
(f || m) && /* @__PURE__ */ t(
|
|
136
138
|
R,
|
|
137
139
|
{
|
|
138
140
|
className: e(
|
|
139
141
|
"rst:text-xs rst:text-left",
|
|
140
|
-
|
|
142
|
+
n ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400"
|
|
141
143
|
),
|
|
142
|
-
children:
|
|
144
|
+
children: m || f
|
|
143
145
|
}
|
|
144
146
|
)
|
|
145
147
|
]
|
|
@@ -147,5 +149,5 @@ const M = (s, o) => {
|
|
|
147
149
|
);
|
|
148
150
|
};
|
|
149
151
|
export {
|
|
150
|
-
|
|
152
|
+
xt as Combobox
|
|
151
153
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),F=require("react"),K=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),W=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),X=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),h=require("../../../node_modules/@headlessui/react/dist/components/listbox/listbox.cjs"),G=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),T=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),R=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),n=require("../../../lib/utils.cjs"),_=require("../../../internal/field-invalid.cjs"),J=require("../Select/select-variants.cjs"),D=require("../Chip/Chip.cjs"),Q=require("../../../internal/PopupOption.cjs"),c=require("../../../internal/popup.cjs"),Z=require("../../../internal/key-focus.cjs"),z=({options:x,value:i,onChange:m,placeholder:v="Select options",disabled:l=!1,variant:f,size:o,error:L,className:A,triggerClassName:E,optionsClassName:U,helperText:b,errorMessage:p,label:g,display:u="chips",maxChips:N,clearable:j=!1,chipColorScheme:k="neutral",chipVariant:w="outline",clearLabel:$="Clear selection",removeLabel:C=e=>`Remove ${e}`,countLabel:y=e=>`${e} selected`,...I})=>{Z.useKeyFocus();const e=!!p||L,V=_.isFieldInvalid(e,I),B=_.withoutInvalidProps(I),a=i.length>0,P=new Map(x.map((r,s)=>[r.value,s])),d=i.map(r=>({value:r,label:x.find(s=>s.value===r)?.label??String(r)})).sort((r,s)=>(P.get(r.value)??Number.POSITIVE_INFINITY)-(P.get(s.value)??Number.POSITIVE_INFINITY)),q=N===void 0?d:d.slice(0,N),O=d.length-q.length,{ref:H,inDarkScope:M}=c.useDarkScope(),S=F.useRef(null);return t.jsxs(W.Field,{disabled:l,className:n.cn("rst:flex rst:flex-col rst:gap-1.5",A),...B,children:[g&&t.jsx(X.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:g}),t.jsx(h.Listbox,{value:i,onChange:m,disabled:l,multiple:!0,children:t.jsxs("div",{ref:H,className:"rst:relative",children:[t.jsxs("div",{className:n.cn(J.selectTriggerVariants({variant:f,size:o,error:e}),"rst:h-auto rst:flex-wrap rst:items-center rst:gap-1.5 rst:py-1.5",o==="sm"?"rst:min-h-9":o==="lg"?"rst:min-h-11":"rst:min-h-10",j&&a&&"rst:pr-16","rst:focus-within:ring-[length:calc(var(--roster-border-width,1px)+1px)] rst:focus-within:ring-ring",l&&"rst:opacity-50 rst:cursor-not-allowed",E),children:[t.jsx(h.ListboxButton,{ref:S,"aria-invalid":V||void 0,className:"rst:absolute rst:inset-0 rst:h-full rst:w-full rst:cursor-pointer rst:rounded-md rst:focus:outline-hidden rst:disabled:cursor-not-allowed",children:t.jsx("span",{className:"rst:sr-only",children:a?u==="count"?y(i.length):d.map(r=>r.label).join(", "):v})}),!a&&t.jsx("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate rst:text-gray-500 rst:dark:text-gray-400",children:v}),a&&u==="count"&&t.jsx("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate",children:y(i.length)}),a&&u==="chips"&&q.map((r,s)=>t.jsx(D.Chip,{size:"sm",variant:w,colorScheme:k,disabled:l,onRemove:()=>m(i.filter(Y=>Y!==r.value)),removeLabel:C(r.label),className:n.cn("rst:relative rst:max-w-[12rem] rst:pointer-events-none","rst:[&_button]:pointer-events-auto","rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70"),children:t.jsx("span",{className:"rst:block rst:truncate",children:r.label})},`${s}-${String(r.value)}`)),O>0&&u==="chips"&&t.jsxs(D.Chip,{size:"sm",variant:w,colorScheme:k,"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70",children:["+",O]}),t.jsx("span",{className:n.cn("rst:pointer-events-none rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:items-center",o==="sm"?"rst:pr-2.5":"rst:pr-3"),children:t.jsx(T.FontAwesomeIcon,{icon:R.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})}),j&&a&&t.jsx("button",{type:"button",disabled:l,onClick:()=>{m([]),S.current?.focus()},"aria-label":$,className:n.cn("rst:absolute rst:inset-y-0 rst:flex rst:w-6 rst:items-center rst:justify-center","rst:cursor-pointer rst:disabled:cursor-not-allowed","rst:text-current rst:opacity-70 rst:hover:opacity-100 rst:disabled:opacity-40","rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:rounded-sm",o==="sm"?"rst:right-7":"rst:right-8"),children:t.jsx(T.FontAwesomeIcon,{icon:R.faXmark,className:"rst:h-3.5 rst:w-3.5","aria-hidden":"true"})})]}),t.jsx(G.Transition,{as:F.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:t.jsx(h.ListboxOptions,{anchor:c.POPUP_ANCHOR,className:n.cn(c.popupInDarkPalette(M,f)&&"dark",c.POPUP_PANEL,c.POPUP_WIDTH_OF_BUTTON,U),children:x.map(r=>t.jsx(Q.PopupOption,{as:h.ListboxOption,value:r.value,disabled:r.disabled,size:o,children:r.label},r.value))})})]})}),(b||p)&&t.jsx(K.Description,{className:n.cn("rst:text-xs rst:text-left",e?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:p||b})]})};exports.MultiSelect=z;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { Description as
|
|
5
|
-
import { Field as
|
|
6
|
-
import { Label as
|
|
3
|
+
import K, { Fragment as V } from "react";
|
|
4
|
+
import { Description as W } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
|
|
5
|
+
import { Field as Y } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
|
|
6
|
+
import { Label as C } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
|
|
7
7
|
import { Listbox as X, ListboxButton as Z, ListboxOptions as q, ListboxOption as G } from "../../../node_modules/@headlessui/react/dist/components/listbox/listbox.js";
|
|
8
8
|
import { Transition as J } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
|
|
9
|
-
import { FontAwesomeIcon as
|
|
9
|
+
import { FontAwesomeIcon as F } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
|
|
10
10
|
import { faChevronDown as Q, faXmark as z } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
|
|
11
11
|
import { cn as n } from "../../../lib/utils.js";
|
|
12
12
|
import { isFieldInvalid as tt, withoutInvalidProps as rt } from "../../../internal/field-invalid.js";
|
|
13
13
|
import { selectTriggerVariants as et } from "../Select/select-variants.js";
|
|
14
|
-
import { Chip as
|
|
14
|
+
import { Chip as T } from "../Chip/Chip.js";
|
|
15
15
|
import { PopupOption as st } from "../../../internal/PopupOption.js";
|
|
16
16
|
import { useDarkScope as nt, POPUP_ANCHOR as ot, POPUP_WIDTH_OF_BUTTON as it, POPUP_PANEL as at, popupInDarkPalette as lt } from "../../../internal/popup.js";
|
|
17
|
-
|
|
17
|
+
import { useKeyFocus as ct } from "../../../internal/key-focus.js";
|
|
18
|
+
const Ot = ({
|
|
18
19
|
options: u,
|
|
19
20
|
value: o,
|
|
20
21
|
onChange: p,
|
|
@@ -37,22 +38,23 @@ const Pt = ({
|
|
|
37
38
|
clearLabel: E = "Clear selection",
|
|
38
39
|
removeLabel: U = (e) => `Remove ${e}`,
|
|
39
40
|
countLabel: I = (e) => `${e} selected`,
|
|
40
|
-
...
|
|
41
|
+
...y
|
|
41
42
|
}) => {
|
|
42
|
-
|
|
43
|
+
ct();
|
|
44
|
+
const e = !!h || R, $ = tt(e, y), A = rt(y), a = o.length > 0, P = new Map(u.map((t, s) => [t.value, s])), m = o.map((t) => ({
|
|
43
45
|
value: t,
|
|
44
46
|
label: u.find((s) => s.value === t)?.label ?? String(t)
|
|
45
47
|
})).sort(
|
|
46
|
-
(t, s) => (
|
|
47
|
-
), O = g === void 0 ? m : m.slice(0, g), S = m.length - O.length, { ref: B, inDarkScope: M } = nt(), _ =
|
|
48
|
+
(t, s) => (P.get(t.value) ?? Number.POSITIVE_INFINITY) - (P.get(s.value) ?? Number.POSITIVE_INFINITY)
|
|
49
|
+
), O = g === void 0 ? m : m.slice(0, g), S = m.length - O.length, { ref: B, inDarkScope: M } = nt(), _ = K.useRef(null);
|
|
48
50
|
return /* @__PURE__ */ d(
|
|
49
|
-
|
|
51
|
+
Y,
|
|
50
52
|
{
|
|
51
53
|
disabled: l,
|
|
52
54
|
className: n("rst:flex rst:flex-col rst:gap-1.5", D),
|
|
53
55
|
...A,
|
|
54
56
|
children: [
|
|
55
|
-
b && /* @__PURE__ */ r(
|
|
57
|
+
b && /* @__PURE__ */ r(C, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left", children: b }),
|
|
56
58
|
/* @__PURE__ */ r(X, { value: o, onChange: p, disabled: l, multiple: !0, children: /* @__PURE__ */ d("div", { ref: B, className: "rst:relative", children: [
|
|
57
59
|
/* @__PURE__ */ d(
|
|
58
60
|
"div",
|
|
@@ -98,7 +100,7 @@ const Pt = ({
|
|
|
98
100
|
}
|
|
99
101
|
),
|
|
100
102
|
a && c === "chips" && O.map((t, s) => /* @__PURE__ */ r(
|
|
101
|
-
|
|
103
|
+
T,
|
|
102
104
|
{
|
|
103
105
|
size: "sm",
|
|
104
106
|
variant: w,
|
|
@@ -116,7 +118,7 @@ const Pt = ({
|
|
|
116
118
|
`${s}-${String(t.value)}`
|
|
117
119
|
)),
|
|
118
120
|
S > 0 && c === "chips" && /* @__PURE__ */ d(
|
|
119
|
-
|
|
121
|
+
T,
|
|
120
122
|
{
|
|
121
123
|
size: "sm",
|
|
122
124
|
variant: w,
|
|
@@ -137,7 +139,7 @@ const Pt = ({
|
|
|
137
139
|
i === "sm" ? "rst:pr-2.5" : "rst:pr-3"
|
|
138
140
|
),
|
|
139
141
|
children: /* @__PURE__ */ r(
|
|
140
|
-
|
|
142
|
+
F,
|
|
141
143
|
{
|
|
142
144
|
icon: Q,
|
|
143
145
|
className: "rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500",
|
|
@@ -167,7 +169,7 @@ const Pt = ({
|
|
|
167
169
|
i === "sm" ? "rst:right-7" : "rst:right-8"
|
|
168
170
|
),
|
|
169
171
|
children: /* @__PURE__ */ r(
|
|
170
|
-
|
|
172
|
+
F,
|
|
171
173
|
{
|
|
172
174
|
icon: z,
|
|
173
175
|
className: "rst:h-3.5 rst:w-3.5",
|
|
@@ -182,7 +184,7 @@ const Pt = ({
|
|
|
182
184
|
/* @__PURE__ */ r(
|
|
183
185
|
J,
|
|
184
186
|
{
|
|
185
|
-
as:
|
|
187
|
+
as: V,
|
|
186
188
|
leave: "rst:transition rst:ease-in rst:duration-100",
|
|
187
189
|
leaveFrom: "rst:opacity-100",
|
|
188
190
|
leaveTo: "rst:opacity-0",
|
|
@@ -213,7 +215,7 @@ const Pt = ({
|
|
|
213
215
|
)
|
|
214
216
|
] }) }),
|
|
215
217
|
(x || h) && /* @__PURE__ */ r(
|
|
216
|
-
|
|
218
|
+
W,
|
|
217
219
|
{
|
|
218
220
|
className: n(
|
|
219
221
|
"rst:text-xs rst:text-left",
|
|
@@ -227,5 +229,5 @@ const Pt = ({
|
|
|
227
229
|
);
|
|
228
230
|
};
|
|
229
231
|
export {
|
|
230
|
-
|
|
232
|
+
Ot as MultiSelect
|
|
231
233
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),F=require("react"),S=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),D=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),I=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),n=require("../../../node_modules/@headlessui/react/dist/components/listbox/listbox.cjs"),L=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),T=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),_=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),r=require("../../../lib/utils.cjs"),f=require("../../../internal/field-invalid.cjs"),w=require("./select-variants.cjs"),R=require("../../../internal/PopupOption.cjs"),s=require("../../../internal/popup.cjs"),U=require("../../../internal/key-focus.cjs"),A=({options:l,value:d,onChange:h,placeholder:P="Select an option",disabled:u=!1,variant:x,size:i,error:b,className:q,triggerClassName:j,optionsClassName:y,helperText:p,errorMessage:a,label:m,...v})=>{U.useKeyFocus();const c=l.find(t=>t.value===d),o=!!a||b,N=f.isFieldInvalid(o,v),O=f.withoutInvalidProps(v),{ref:g,inDarkScope:k}=s.useDarkScope();return e.jsxs(D.Field,{disabled:u,className:r.cn("rst:flex rst:flex-col rst:gap-1.5",q),...O,children:[m&&e.jsx(I.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:m}),e.jsx(n.Listbox,{value:d??void 0,onChange:h,disabled:u,children:e.jsxs("div",{ref:g,className:"rst:relative",children:[e.jsxs(n.ListboxButton,{"aria-invalid":N||void 0,className:r.cn(w.selectTriggerVariants({variant:x,size:i,error:o}),j),children:[e.jsx("span",{className:r.cn("rst:block rst:truncate",!c&&"rst:text-gray-500 rst:dark:text-gray-400"),children:c?c.label:P}),e.jsx("span",{className:r.cn("rst:pointer-events-none rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:items-center",i==="sm"?"rst:pr-2.5":"rst:pr-3"),children:e.jsx(T.FontAwesomeIcon,{icon:_.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})})]}),e.jsx(L.Transition,{as:F.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:e.jsx(n.ListboxOptions,{anchor:s.POPUP_ANCHOR,className:r.cn(s.popupInDarkPalette(k,x)&&"dark",s.POPUP_PANEL,s.POPUP_WIDTH_OF_BUTTON,y),children:l.map(t=>e.jsx(R.PopupOption,{as:n.ListboxOption,value:t.value,disabled:t.disabled,size:i,children:t.label},t.value))})})]})}),(p||a)&&e.jsx(S.Description,{className:r.cn("rst:text-xs rst:text-left",o?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:a||p})]})};exports.Select=A;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { Description as
|
|
3
|
+
import { Fragment as F } from "react";
|
|
4
|
+
import { Description as D } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
|
|
5
5
|
import { Field as I } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
|
|
6
6
|
import { Label as L } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
|
|
7
7
|
import { Listbox as T, ListboxButton as _, ListboxOptions as w, ListboxOption as S } from "../../../node_modules/@headlessui/react/dist/components/listbox/listbox.js";
|
|
@@ -12,12 +12,13 @@ import { cn as s } from "../../../lib/utils.js";
|
|
|
12
12
|
import { isFieldInvalid as j, withoutInvalidProps as C } from "../../../internal/field-invalid.js";
|
|
13
13
|
import { selectTriggerVariants as E } from "./select-variants.js";
|
|
14
14
|
import { PopupOption as H } from "../../../internal/PopupOption.js";
|
|
15
|
-
import { useDarkScope as
|
|
16
|
-
|
|
15
|
+
import { useDarkScope as K, POPUP_ANCHOR as R, POPUP_WIDTH_OF_BUTTON as W, POPUP_PANEL as M, popupInDarkPalette as V } from "../../../internal/popup.js";
|
|
16
|
+
import { useKeyFocus as Z } from "../../../internal/key-focus.js";
|
|
17
|
+
const nt = ({
|
|
17
18
|
options: l,
|
|
18
19
|
value: m,
|
|
19
|
-
onChange:
|
|
20
|
-
placeholder:
|
|
20
|
+
onChange: u,
|
|
21
|
+
placeholder: h = "Select an option",
|
|
21
22
|
disabled: c = !1,
|
|
22
23
|
variant: d,
|
|
23
24
|
size: e,
|
|
@@ -30,7 +31,8 @@ const ot = ({
|
|
|
30
31
|
label: f,
|
|
31
32
|
...x
|
|
32
33
|
}) => {
|
|
33
|
-
|
|
34
|
+
Z();
|
|
35
|
+
const o = l.find((r) => r.value === m), i = !!a || v, k = j(i, x), y = C(x), { ref: O, inDarkScope: g } = K();
|
|
34
36
|
return (
|
|
35
37
|
/* `...props` is spread here, and was not before. The prop type has always
|
|
36
38
|
extended `HTMLAttributes<HTMLDivElement>`, so `id`, `data-*` and the
|
|
@@ -47,16 +49,16 @@ const ot = ({
|
|
|
47
49
|
{
|
|
48
50
|
disabled: c,
|
|
49
51
|
className: s("rst:flex rst:flex-col rst:gap-1.5", P),
|
|
50
|
-
...
|
|
52
|
+
...y,
|
|
51
53
|
children: [
|
|
52
54
|
f && /* @__PURE__ */ t(L, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left", children: f }),
|
|
53
55
|
/* @__PURE__ */ t(
|
|
54
56
|
T,
|
|
55
57
|
{
|
|
56
58
|
value: m ?? void 0,
|
|
57
|
-
onChange:
|
|
59
|
+
onChange: u,
|
|
58
60
|
disabled: c,
|
|
59
|
-
children: /* @__PURE__ */ n("div", { ref:
|
|
61
|
+
children: /* @__PURE__ */ n("div", { ref: O, className: "rst:relative", children: [
|
|
60
62
|
/* @__PURE__ */ n(
|
|
61
63
|
_,
|
|
62
64
|
{
|
|
@@ -73,7 +75,7 @@ const ot = ({
|
|
|
73
75
|
"rst:block rst:truncate",
|
|
74
76
|
!o && "rst:text-gray-500 rst:dark:text-gray-400"
|
|
75
77
|
),
|
|
76
|
-
children: o ? o.label :
|
|
78
|
+
children: o ? o.label : h
|
|
77
79
|
}
|
|
78
80
|
),
|
|
79
81
|
/* @__PURE__ */ t(
|
|
@@ -101,18 +103,18 @@ const ot = ({
|
|
|
101
103
|
/* @__PURE__ */ t(
|
|
102
104
|
U,
|
|
103
105
|
{
|
|
104
|
-
as:
|
|
106
|
+
as: F,
|
|
105
107
|
leave: "rst:transition rst:ease-in rst:duration-100",
|
|
106
108
|
leaveFrom: "rst:opacity-100",
|
|
107
109
|
leaveTo: "rst:opacity-0",
|
|
108
110
|
children: /* @__PURE__ */ t(
|
|
109
111
|
w,
|
|
110
112
|
{
|
|
111
|
-
anchor:
|
|
113
|
+
anchor: R,
|
|
112
114
|
className: s(
|
|
113
|
-
V(
|
|
115
|
+
V(g, d) && "dark",
|
|
114
116
|
M,
|
|
115
|
-
|
|
117
|
+
W,
|
|
116
118
|
b
|
|
117
119
|
),
|
|
118
120
|
children: l.map((r) => /* @__PURE__ */ t(
|
|
@@ -134,7 +136,7 @@ const ot = ({
|
|
|
134
136
|
}
|
|
135
137
|
),
|
|
136
138
|
(p || a) && /* @__PURE__ */ t(
|
|
137
|
-
|
|
139
|
+
D,
|
|
138
140
|
{
|
|
139
141
|
className: s(
|
|
140
142
|
"rst:text-xs rst:text-left",
|
|
@@ -149,5 +151,5 @@ const ot = ({
|
|
|
149
151
|
);
|
|
150
152
|
};
|
|
151
153
|
export {
|
|
152
|
-
|
|
154
|
+
nt as Select
|
|
153
155
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),Be=require("react"),$e=require("../../atoms/Button/Button.cjs"),T=require("../../../lib/utils.cjs"),ze=require("../../../lib/labels.cjs"),He=require("../../../internal/motion.cjs"),d=require("./carousel-math.cjs"),U=require("./carousel-layout.cjs");function Ue(o){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const f in o)if(f!=="default"){const x=Object.getOwnPropertyDescriptor(o,f);Object.defineProperty(a,f,x.get?x:{enumerable:!0,get:()=>o[f]})}}return a.default=o,Object.freeze(a)}const n=Ue(Be),Ve={position:(o,a)=>`${o} of ${a}`},We=o=>Math.min(3e3,500+o*.35),Xe='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])',V=o=>typeof o=="number"?`${o}px`:o;function se(o){const a=parseFloat(o);return Number.isFinite(a)?a:0}const Ge="rst:hidden rst:[@media(any-hover:hover)]:inline-flex",Je="rst:hidden rst:[@media(any-hover:hover)]:flex";function oe({direction:o}){return c.jsx("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 20 20",className:"rst:h-5 rst:w-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("path",{d:o==="prev"?"M12.5 4.5 7 10l5.5 5.5":"M7.5 4.5 13 10l-5.5 5.5"})})}const le={overflowing:null,canScrollPrev:!1,canScrollNext:!1,index:0},Ke=n.forwardRef(function({"aria-label":a,"aria-labelledby":f,children:x,itemWidth:I,perView:R,gap:W=12,gutter:X=16,bleed:ce=!1,snap:k="start",snapStrictness:ie="mandatory",oneAtATime:ae=!1,arrows:j="hover",arrowPlacement:M="controls",renderArrows:L,prevLabel:ue,nextLabel:de,prevIcon:fe,nextIcon:ge,arrowButtonProps:ve,fade:pe=!1,scrollbar:me=!1,showPosition:G=!1,labels:be,onIndexChange:J,onScrollStateChange:K,itemClassName:xe,listClassName:he,className:Se,style:ye,...we},Ne){const Q=ze.withLabels(Ve,be),p=n.useRef(null),Y=`${n.useId()}-list`,Z=n.Children.toArray(x),E=Z.length,[l,Te]=n.useState(le),ee=n.useRef(le),[Ie,Le]=n.useState(""),[Ee,Pe]=n.useState(!1),O=n.useRef({onIndexChange:J,onScrollStateChange:K});n.useEffect(()=>{O.current={onIndexChange:J,onScrollStateChange:K}});const g=n.useCallback(()=>{const e=p.current;if(!e)return null;const t=e.getBoundingClientRect(),r=getComputedStyle(e),s=t.left+e.clientLeft-e.scrollLeft;return{items:Array.from(e.children).map(u=>{const b=u.getBoundingClientRect();return{start:b.left-s,end:b.right-s}}),scrollLeft:e.scrollLeft,clientWidth:e.clientWidth,scrollWidth:e.scrollWidth,paddingStart:se(r.scrollPaddingInlineStart||r.scrollPaddingLeft),paddingEnd:se(r.scrollPaddingInlineEnd||r.scrollPaddingRight),align:k}},[k]),h=n.useCallback(()=>{const e=g();if(!e)return;const t={overflowing:d.overflows(e),canScrollPrev:d.canScrollPrev(e),canScrollNext:d.canScrollNext(e),index:e.items.length?d.currentIndex(e):0},r=ee.current;r.overflowing===t.overflowing&&r.canScrollPrev===t.canScrollPrev&&r.canScrollNext===t.canScrollNext&&r.index===t.index||(ee.current=t,Te(t),r.index!==t.index&&O.current.onIndexChange?.(t.index),(r.canScrollPrev!==t.canScrollPrev||r.canScrollNext!==t.canScrollNext)&&O.current.onScrollStateChange?.({canScrollPrev:t.canScrollPrev,canScrollNext:t.canScrollNext}))},[g]),Ce=JSON.stringify([W,X,I,R]);n.useLayoutEffect(()=>{const e=p.current;if(!e)return;h();let t=0;const r=()=>{t||(t=requestAnimationFrame(()=>{t=0,h()}))};e.addEventListener("scroll",r,{passive:!0});const s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>h()),i=()=>{s?.observe(e),Array.from(e.children).forEach(b=>s?.observe(b))};i();const u=typeof MutationObserver>"u"?null:new MutationObserver(()=>{i(),h()});return u?.observe(e,{childList:!0}),()=>{e.removeEventListener("scroll",r),s?.disconnect(),u?.disconnect(),t&&cancelAnimationFrame(t)}},[h,E,Ce]),n.useLayoutEffect(()=>{const e=p.current;if(e&&(Pe(!e.querySelector(Xe)),f)){const t=f.split(/\s+/).map(r=>document.getElementById(r)?.textContent?.trim()??"").filter(Boolean).join(" ");Le(t)}},[x,f]);const S=n.useRef(null),v=n.useCallback(()=>{const e=p.current,t=S.current;t&&(S.current=null,window.clearTimeout(t.timer),e?.removeEventListener("scrollend",t.done),e&&(e.style.scrollSnapType="",delete e.dataset.settling))},[]),m=n.useCallback((e,t)=>{const r=p.current;if(!r)return;if(v(),t!=="smooth"||He.prefersReducedMotion()||Math.abs(r.scrollLeft-e)<1){r.style.scrollSnapType="none",r.scrollTo({left:e,behavior:"instant"}),r.style.scrollSnapType="";return}r.style.scrollSnapType="none",r.dataset.settling="";const i=r.scrollLeft,u=()=>{Math.abs(r.scrollLeft-i)<.5||v()};S.current={timer:window.setTimeout(v,We(Math.abs(r.scrollLeft-e))),done:u,target:e},r.addEventListener("scrollend",u),r.scrollTo({left:e,behavior:"smooth"})},[v]),P=n.useCallback(e=>{const t=g();if(!t)return;const r=S.current?{...t,scrollLeft:S.current.target}:t;m(d.pageTarget(r,e),"smooth")},[g,m]);n.useImperativeHandle(Ne,()=>({scrollToIndex:(e,t)=>{const r=g();if(!r||!r.items.length)return;const s=Math.min(Math.max(0,Math.round(e)),r.items.length-1);m(d.snapPosition(r,s),t?.behavior??"smooth")},scrollPrev:()=>P(-1),scrollNext:()=>P(1)}),[g,P,m]),n.useEffect(()=>v,[v]);const D=n.useRef(null),_=n.useRef(null),A=n.useRef(null);n.useLayoutEffect(()=>{const e=A.current;if(!e)return;const t=e==="prev"?D.current:_.current,r=e==="prev"?_.current:D.current,s=e==="prev"?!l.canScrollPrev:!l.canScrollNext,i=document.activeElement;s&&(i!==t&&i!==document.body&&i!==null||r&&!r.disabled&&r.focus())},[l.canScrollPrev,l.canScrollNext]);const y=n.useRef(null),w=n.useRef(!1),Re=e=>{e.pointerType!=="mouse"||e.button!==0||l.overflowing&&(v(),w.current=!1,y.current={pointerId:e.pointerId,x0:e.clientX,scroll0:e.currentTarget.scrollLeft,dragging:!1})},ke=e=>{const t=y.current;if(!t||e.pointerId!==t.pointerId)return;const r=e.currentTarget,s=e.clientX-t.x0;if(!t.dragging){if(Math.abs(s)<=d.CAROUSEL_DRAG_THRESHOLD)return;t.dragging=!0,r.dataset.dragging="",r.style.scrollSnapType="none",window.getSelection?.()?.removeAllRanges();try{r.setPointerCapture(e.pointerId)}catch{}}r.scrollLeft=t.scroll0-s},F=e=>{const t=y.current;if(!t||e.pointerId!==t.pointerId||(y.current=null,!t.dragging))return;const r=e.currentTarget;delete r.dataset.dragging,w.current=e.type==="pointerup",window.setTimeout(()=>{w.current=!1},0);const s=g();s?m(d.snapPosition(s,d.nearestIndex(s)),"smooth"):r.style.scrollSnapType=""},je=e=>{!w.current||e.detail===0||(w.current=!1,e.preventDefault(),e.stopPropagation())},Me=e=>{l.overflowing&&e.preventDefault()},Oe=e=>{const t=e.currentTarget,r=e.target;if(r===t||y.current?.dragging)return;let s=!1;try{s=r.matches(":focus-visible")}catch{s=!1}if(!s)return;const i=r.closest("[data-carousel-item]");if(!i||i.parentElement!==t)return;const u=g();if(!u)return;const b=Array.prototype.indexOf.call(t.children,i);m(d.snapPosition(u,b),"instant")},[De,_e]=n.useState(0);n.useEffect(()=>{const e=window.setTimeout(()=>_e(l.index),150);return()=>window.clearTimeout(e)},[l.index]);const te=a??Ie,re=e=>te?`${e} ${te}`:e,q=j!=="none"&&l.overflowing!==!1,Ae=j==="hover"?Ge:"rst:inline-flex",ne=e=>{const t=e==="prev",{className:r,...s}=ve??{};return c.jsx($e.Button,{type:"button",variant:"outline",colorScheme:"neutral",size:"icon",...s,"aria-label":t?ue??re("Previous"):de??re("Next"),"aria-controls":Y,disabled:t?!l.canScrollPrev:!l.canScrollNext,onClick:()=>P(t?-1:1),ref:t?D:_,onFocus:()=>{A.current=e},onBlur:i=>{i.relatedTarget&&(A.current=null)},"data-carousel-arrow":e,className:T.cn("rst:size-11 rst:shrink-0 rst:rounded-full",M==="overlay"&&!L&&"rst:bg-[var(--roster-popover-bg)] rst:elevation-raised rst:hover:bg-[var(--roster-popover-bg)] rst:disabled:invisible",Ae,r),children:t?fe??c.jsx(oe,{direction:"prev"}):ge??c.jsx(oe,{direction:"next"})})},C=q?ne("prev"):null,B=q?ne("next"):null,N=G&&E?c.jsx("p",{"aria-live":"polite",className:"rst:font-ui rst:m-0 rst:text-sm rst:tabular-nums rst:opacity-75","data-carousel-position":"",children:Q.position(De+1,E)}):null;let $=null;L?$=L({prev:C,next:B,position:N}):M==="controls"&&(C||N)&&($=c.jsxs("div",{className:T.cn("rst:mb-2 rst:items-center rst:justify-end rst:gap-2",!N&&j==="hover"?Je:"rst:flex"),"data-carousel-controls":"",children:[N&&c.jsx("div",{className:"rst:mr-auto",children:N}),C,B]}));const z=pe&&l.overflowing&&(l.canScrollPrev||l.canScrollNext)?`linear-gradient(to right, ${l.canScrollPrev?"transparent, black 48px":"black"}, ${l.canScrollNext?"black calc(100% - 48px), transparent":"black"})`:void 0,H=I===void 0&&R!==void 0,Fe={"--rst-cv-gap":V(W),"--rst-cv-gutter":V(X),...H?U.perViewVars(R):{},...z?{maskImage:z,WebkitMaskImage:z}:{}},qe=I!==void 0?{width:V(I)}:H?{width:U.FLUID_ITEM_WIDTH}:void 0;return c.jsxs("div",{className:T.cn("rst:min-w-0",Se),style:ye,...we,children:[$,c.jsxs("div",{className:"rst:relative",children:[c.jsx("ul",{ref:p,id:Y,role:"list","aria-label":a,"aria-labelledby":a?void 0:f,tabIndex:Ee&&l.overflowing?0:void 0,"data-overflowing":l.overflowing?"":void 0,onPointerDown:Re,onPointerMove:ke,onPointerUp:F,onPointerCancel:F,onLostPointerCapture:F,onClickCapture:je,onDragStart:Me,onFocus:Oe,style:Fe,className:T.cn("rst:m-0 rst:flex rst:list-none rst:overflow-x-auto rst:overflow-y-hidden","rst:gap-(--rst-cv-gap) rst:px-(--rst-cv-gutter) rst:py-1 rst:scroll-px-(--rst-cv-gutter)","rst:overscroll-x-contain",ie==="mandatory"?"rst:snap-x rst:snap-mandatory":"rst:snap-x rst:snap-proximity",ce&&"rst:-mx-(--rst-cv-gutter)",!me&&"rst:[scrollbar-width:none] rst:[&::-webkit-scrollbar]:hidden",H&&U.FLUID_CLASSES,"rst:data-overflowing:cursor-grab rst:data-dragging:cursor-grabbing rst:data-dragging:select-none","rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-inset",he),children:Z.map((e,t)=>c.jsx("li",{"data-carousel-item":"","aria-label":G?Q.position(t+1,E):void 0,style:qe,className:T.cn("rst:shrink-0",k==="start"?"rst:snap-start":"rst:snap-center",ae&&"rst:snap-always",xe),children:e},n.isValidElement(e)&&e.key!=null?e.key:t))}),!L&&M==="overlay"&&q&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"rst:pointer-events-none rst:absolute rst:inset-y-0 rst:start-1 rst:flex rst:items-center",children:c.jsx("div",{className:"rst:pointer-events-auto",children:C})}),c.jsx("div",{className:"rst:pointer-events-none rst:absolute rst:inset-y-0 rst:end-1 rst:flex rst:items-center",children:c.jsx("div",{className:"rst:pointer-events-auto",children:B})})]})]})]})});exports.Carousel=Ke;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),Be=require("react"),$e=require("../../atoms/Button/Button.cjs"),T=require("../../../lib/utils.cjs"),ze=require("../../../lib/labels.cjs"),He=require("../../../internal/motion.cjs"),d=require("./carousel-math.cjs"),U=require("./carousel-layout.cjs"),Ue=require("../../../internal/key-focus.cjs");function Ve(o){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const f in o)if(f!=="default"){const x=Object.getOwnPropertyDescriptor(o,f);Object.defineProperty(a,f,x.get?x:{enumerable:!0,get:()=>o[f]})}}return a.default=o,Object.freeze(a)}const n=Ve(Be),We={position:(o,a)=>`${o} of ${a}`},Xe=o=>Math.min(3e3,500+o*.35),Ge='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])',V=o=>typeof o=="number"?`${o}px`:o;function se(o){const a=parseFloat(o);return Number.isFinite(a)?a:0}const Je="rst:hidden rst:[@media(any-hover:hover)]:inline-flex",Ke="rst:hidden rst:[@media(any-hover:hover)]:flex";function oe({direction:o}){return c.jsx("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 20 20",className:"rst:h-5 rst:w-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("path",{d:o==="prev"?"M12.5 4.5 7 10l5.5 5.5":"M7.5 4.5 13 10l-5.5 5.5"})})}const le={overflowing:null,canScrollPrev:!1,canScrollNext:!1,index:0},Qe=n.forwardRef(function({"aria-label":a,"aria-labelledby":f,children:x,itemWidth:I,perView:C,gap:W=12,gutter:X=16,bleed:ce=!1,snap:R="start",snapStrictness:ie="mandatory",oneAtATime:ae=!1,arrows:j="hover",arrowPlacement:M="controls",renderArrows:L,prevLabel:ue,nextLabel:de,prevIcon:fe,nextIcon:ge,arrowButtonProps:ve,fade:pe=!1,scrollbar:me=!1,showPosition:G=!1,labels:be,onIndexChange:J,onScrollStateChange:K,itemClassName:xe,listClassName:he,className:ye,style:Se,...we},Ne){Ue.useKeyFocus();const Q=ze.withLabels(We,be),p=n.useRef(null),Y=`${n.useId()}-list`,Z=n.Children.toArray(x),E=Z.length,[l,Te]=n.useState(le),ee=n.useRef(le),[Ie,Le]=n.useState(""),[Ee,Pe]=n.useState(!1),O=n.useRef({onIndexChange:J,onScrollStateChange:K});n.useEffect(()=>{O.current={onIndexChange:J,onScrollStateChange:K}});const g=n.useCallback(()=>{const e=p.current;if(!e)return null;const t=e.getBoundingClientRect(),r=getComputedStyle(e),s=t.left+e.clientLeft-e.scrollLeft;return{items:Array.from(e.children).map(u=>{const b=u.getBoundingClientRect();return{start:b.left-s,end:b.right-s}}),scrollLeft:e.scrollLeft,clientWidth:e.clientWidth,scrollWidth:e.scrollWidth,paddingStart:se(r.scrollPaddingInlineStart||r.scrollPaddingLeft),paddingEnd:se(r.scrollPaddingInlineEnd||r.scrollPaddingRight),align:R}},[R]),h=n.useCallback(()=>{const e=g();if(!e)return;const t={overflowing:d.overflows(e),canScrollPrev:d.canScrollPrev(e),canScrollNext:d.canScrollNext(e),index:e.items.length?d.currentIndex(e):0},r=ee.current;r.overflowing===t.overflowing&&r.canScrollPrev===t.canScrollPrev&&r.canScrollNext===t.canScrollNext&&r.index===t.index||(ee.current=t,Te(t),r.index!==t.index&&O.current.onIndexChange?.(t.index),(r.canScrollPrev!==t.canScrollPrev||r.canScrollNext!==t.canScrollNext)&&O.current.onScrollStateChange?.({canScrollPrev:t.canScrollPrev,canScrollNext:t.canScrollNext}))},[g]),ke=JSON.stringify([W,X,I,C]);n.useLayoutEffect(()=>{const e=p.current;if(!e)return;h();let t=0;const r=()=>{t||(t=requestAnimationFrame(()=>{t=0,h()}))};e.addEventListener("scroll",r,{passive:!0});const s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>h()),i=()=>{s?.observe(e),Array.from(e.children).forEach(b=>s?.observe(b))};i();const u=typeof MutationObserver>"u"?null:new MutationObserver(()=>{i(),h()});return u?.observe(e,{childList:!0}),()=>{e.removeEventListener("scroll",r),s?.disconnect(),u?.disconnect(),t&&cancelAnimationFrame(t)}},[h,E,ke]),n.useLayoutEffect(()=>{const e=p.current;if(e&&(Pe(!e.querySelector(Ge)),f)){const t=f.split(/\s+/).map(r=>document.getElementById(r)?.textContent?.trim()??"").filter(Boolean).join(" ");Le(t)}},[x,f]);const y=n.useRef(null),v=n.useCallback(()=>{const e=p.current,t=y.current;t&&(y.current=null,window.clearTimeout(t.timer),e?.removeEventListener("scrollend",t.done),e&&(e.style.scrollSnapType="",delete e.dataset.settling))},[]),m=n.useCallback((e,t)=>{const r=p.current;if(!r)return;if(v(),t!=="smooth"||He.prefersReducedMotion()||Math.abs(r.scrollLeft-e)<1){r.style.scrollSnapType="none",r.scrollTo({left:e,behavior:"instant"}),r.style.scrollSnapType="";return}r.style.scrollSnapType="none",r.dataset.settling="";const i=r.scrollLeft,u=()=>{Math.abs(r.scrollLeft-i)<.5||v()};y.current={timer:window.setTimeout(v,Xe(Math.abs(r.scrollLeft-e))),done:u,target:e},r.addEventListener("scrollend",u),r.scrollTo({left:e,behavior:"smooth"})},[v]),P=n.useCallback(e=>{const t=g();if(!t)return;const r=y.current?{...t,scrollLeft:y.current.target}:t;m(d.pageTarget(r,e),"smooth")},[g,m]);n.useImperativeHandle(Ne,()=>({scrollToIndex:(e,t)=>{const r=g();if(!r||!r.items.length)return;const s=Math.min(Math.max(0,Math.round(e)),r.items.length-1);m(d.snapPosition(r,s),t?.behavior??"smooth")},scrollPrev:()=>P(-1),scrollNext:()=>P(1)}),[g,P,m]),n.useEffect(()=>v,[v]);const D=n.useRef(null),F=n.useRef(null),_=n.useRef(null);n.useLayoutEffect(()=>{const e=_.current;if(!e)return;const t=e==="prev"?D.current:F.current,r=e==="prev"?F.current:D.current,s=e==="prev"?!l.canScrollPrev:!l.canScrollNext,i=document.activeElement;s&&(i!==t&&i!==document.body&&i!==null||r&&!r.disabled&&r.focus())},[l.canScrollPrev,l.canScrollNext]);const S=n.useRef(null),w=n.useRef(!1),Ce=e=>{e.pointerType!=="mouse"||e.button!==0||l.overflowing&&(v(),w.current=!1,S.current={pointerId:e.pointerId,x0:e.clientX,scroll0:e.currentTarget.scrollLeft,dragging:!1})},Re=e=>{const t=S.current;if(!t||e.pointerId!==t.pointerId)return;const r=e.currentTarget,s=e.clientX-t.x0;if(!t.dragging){if(Math.abs(s)<=d.CAROUSEL_DRAG_THRESHOLD)return;t.dragging=!0,r.dataset.dragging="",r.style.scrollSnapType="none",window.getSelection?.()?.removeAllRanges();try{r.setPointerCapture(e.pointerId)}catch{}}r.scrollLeft=t.scroll0-s},A=e=>{const t=S.current;if(!t||e.pointerId!==t.pointerId||(S.current=null,!t.dragging))return;const r=e.currentTarget;delete r.dataset.dragging,w.current=e.type==="pointerup",window.setTimeout(()=>{w.current=!1},0);const s=g();s?m(d.snapPosition(s,d.nearestIndex(s)),"smooth"):r.style.scrollSnapType=""},je=e=>{!w.current||e.detail===0||(w.current=!1,e.preventDefault(),e.stopPropagation())},Me=e=>{l.overflowing&&e.preventDefault()},Oe=e=>{const t=e.currentTarget,r=e.target;if(r===t||S.current?.dragging)return;let s=!1;try{s=r.matches(":focus-visible, [data-key-focus]")}catch{s=!1}if(!s)return;const i=r.closest("[data-carousel-item]");if(!i||i.parentElement!==t)return;const u=g();if(!u)return;const b=Array.prototype.indexOf.call(t.children,i);m(d.snapPosition(u,b),"instant")},[De,Fe]=n.useState(0);n.useEffect(()=>{const e=window.setTimeout(()=>Fe(l.index),150);return()=>window.clearTimeout(e)},[l.index]);const te=a??Ie,re=e=>te?`${e} ${te}`:e,q=j!=="none"&&l.overflowing!==!1,_e=j==="hover"?Je:"rst:inline-flex",ne=e=>{const t=e==="prev",{className:r,...s}=ve??{};return c.jsx($e.Button,{type:"button",variant:"outline",colorScheme:"neutral",size:"icon",...s,"aria-label":t?ue??re("Previous"):de??re("Next"),"aria-controls":Y,disabled:t?!l.canScrollPrev:!l.canScrollNext,onClick:()=>P(t?-1:1),ref:t?D:F,onFocus:()=>{_.current=e},onBlur:i=>{i.relatedTarget&&(_.current=null)},"data-carousel-arrow":e,className:T.cn("rst:size-11 rst:shrink-0 rst:rounded-full",M==="overlay"&&!L&&"rst:bg-[var(--roster-popover-bg)] rst:elevation-raised rst:hover:bg-[var(--roster-popover-bg)] rst:disabled:invisible",_e,r),children:t?fe??c.jsx(oe,{direction:"prev"}):ge??c.jsx(oe,{direction:"next"})})},k=q?ne("prev"):null,B=q?ne("next"):null,N=G&&E?c.jsx("p",{"aria-live":"polite",className:"rst:font-ui rst:m-0 rst:text-sm rst:tabular-nums rst:opacity-75","data-carousel-position":"",children:Q.position(De+1,E)}):null;let $=null;L?$=L({prev:k,next:B,position:N}):M==="controls"&&(k||N)&&($=c.jsxs("div",{className:T.cn("rst:mb-2 rst:items-center rst:justify-end rst:gap-2",!N&&j==="hover"?Ke:"rst:flex"),"data-carousel-controls":"",children:[N&&c.jsx("div",{className:"rst:mr-auto",children:N}),k,B]}));const z=pe&&l.overflowing&&(l.canScrollPrev||l.canScrollNext)?`linear-gradient(to right, ${l.canScrollPrev?"transparent, black 48px":"black"}, ${l.canScrollNext?"black calc(100% - 48px), transparent":"black"})`:void 0,H=I===void 0&&C!==void 0,Ae={"--rst-cv-gap":V(W),"--rst-cv-gutter":V(X),...H?U.perViewVars(C):{},...z?{maskImage:z,WebkitMaskImage:z}:{}},qe=I!==void 0?{width:V(I)}:H?{width:U.FLUID_ITEM_WIDTH}:void 0;return c.jsxs("div",{className:T.cn("rst:min-w-0",ye),style:Se,...we,children:[$,c.jsxs("div",{className:"rst:relative",children:[c.jsx("ul",{ref:p,id:Y,role:"list","aria-label":a,"aria-labelledby":a?void 0:f,tabIndex:Ee&&l.overflowing?0:void 0,"data-overflowing":l.overflowing?"":void 0,onPointerDown:Ce,onPointerMove:Re,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:A,onClickCapture:je,onDragStart:Me,onFocus:Oe,style:Ae,className:T.cn("rst:m-0 rst:flex rst:list-none rst:overflow-x-auto rst:overflow-y-hidden","rst:gap-(--rst-cv-gap) rst:px-(--rst-cv-gutter) rst:py-1 rst:scroll-px-(--rst-cv-gutter)","rst:overscroll-x-contain",ie==="mandatory"?"rst:snap-x rst:snap-mandatory":"rst:snap-x rst:snap-proximity",ce&&"rst:-mx-(--rst-cv-gutter)",!me&&"rst:[scrollbar-width:none] rst:[&::-webkit-scrollbar]:hidden",H&&U.FLUID_CLASSES,"rst:data-overflowing:cursor-grab rst:data-dragging:cursor-grabbing rst:data-dragging:select-none","rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-inset",he),children:Z.map((e,t)=>c.jsx("li",{"data-carousel-item":"","aria-label":G?Q.position(t+1,E):void 0,style:qe,className:T.cn("rst:shrink-0",R==="start"?"rst:snap-start":"rst:snap-center",ae&&"rst:snap-always",xe),children:e},n.isValidElement(e)&&e.key!=null?e.key:t))}),!L&&M==="overlay"&&q&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"rst:pointer-events-none rst:absolute rst:inset-y-0 rst:start-1 rst:flex rst:items-center",children:c.jsx("div",{className:"rst:pointer-events-auto",children:k})}),c.jsx("div",{className:"rst:pointer-events-none rst:absolute rst:inset-y-0 rst:end-1 rst:flex rst:items-center",children:c.jsx("div",{className:"rst:pointer-events-auto",children:B})})]})]})]})});exports.Carousel=Qe;
|