@blakesteve/roster 5.10.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 +202 -11
- 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/PasswordInput/PasswordInput.cjs +1 -1
- package/dist/components/atoms/PasswordInput/PasswordInput.js +5 -5
- package/dist/components/atoms/Select/Select.cjs +1 -1
- package/dist/components/atoms/Select/Select.js +19 -17
- package/dist/components/atoms/Select/select-variants.cjs +1 -1
- package/dist/components/atoms/Select/select-variants.js +11 -2
- 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 +133 -124
- 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 -0
- package/dist/components/molecules/RangeSlider/RangeSlider.d.ts +79 -0
- package/dist/components/molecules/RangeSlider/RangeSlider.js +166 -0
- package/dist/components/molecules/Slider/Slider.cjs +1 -0
- package/dist/components/molecules/Slider/Slider.d.ts +91 -0
- package/dist/components/molecules/Slider/Slider.js +130 -0
- package/dist/components/molecules/Slider/track-parts.cjs +1 -0
- package/dist/components/molecules/Slider/track-parts.d.ts +65 -0
- package/dist/components/molecules/Slider/track-parts.js +121 -0
- package/dist/components/molecules/Slider/track.cjs +1 -0
- package/dist/components/molecules/Slider/track.d.ts +115 -0
- package/dist/components/molecules/Slider/track.js +152 -0
- 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/index.d.ts +2 -0
- 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.cjs +1 -1
- package/dist/roster.css +1 -1
- package/dist/roster.js +67 -63
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SliderSnapPoint } from './track';
|
|
3
|
+
/** The label and the visible number above the track. The number is hidden from screen readers, which hear it as the value. */
|
|
4
|
+
export declare function SliderHeader(props: {
|
|
5
|
+
labelId: string;
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
readout: string;
|
|
8
|
+
empty: boolean;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
labelClassName?: string;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* The rail, from the start edge's inset to the end edge's: a light surface
|
|
14
|
+
* edged in the control border's color. With no value it's all there is of
|
|
15
|
+
* the slider, so its edge carries the 3:1 a control's does.
|
|
16
|
+
*/
|
|
17
|
+
export declare function Rail(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
/** The filled part of the rail, between two shares of it. */
|
|
19
|
+
export declare function Fill({ from, to, dragging }: {
|
|
20
|
+
from: number;
|
|
21
|
+
to: number;
|
|
22
|
+
dragging: boolean;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Each snap point's mark: a bead set in the rail, its edge's color on the
|
|
26
|
+
* bare rail and the page's on the fill, so it shows on either.
|
|
27
|
+
*/
|
|
28
|
+
export declare function Marks({ points, at, filled }: {
|
|
29
|
+
points: SliderSnapPoint[];
|
|
30
|
+
at: (v: number) => number;
|
|
31
|
+
filled: (v: number) => boolean;
|
|
32
|
+
}): import("react/jsx-runtime").JSX.Element[];
|
|
33
|
+
/**
|
|
34
|
+
* A chip for each snap point, under the track, in a group named as the
|
|
35
|
+
* slider is so the chips are heard as its presets.
|
|
36
|
+
*
|
|
37
|
+
* The clearance is what Chip's 44px target asks of its layout: it reaches up
|
|
38
|
+
* to 8px above and below the chip, so the row sits 8px under the track (the
|
|
39
|
+
* column's 6px and 2px more), where it can't take the bottom of a thumb's
|
|
40
|
+
* target, and wrapped rows are 16px apart. A short label is widened to 44
|
|
41
|
+
* too, since the target is only as wide as the chip, and no chip shrinks: a
|
|
42
|
+
* min-width replaces the flex item's own floor of its label's width, so in a
|
|
43
|
+
* row narrower than a label the chip would otherwise squeeze to 44 under it.
|
|
44
|
+
*
|
|
45
|
+
* A chip only ever moves a value to itself: pressed again, it stays, as a
|
|
46
|
+
* preset does. Pressed swaps outline for solid, as Chip's own selectable
|
|
47
|
+
* does, so it reads without color.
|
|
48
|
+
*/
|
|
49
|
+
export declare function SnapChips(props: {
|
|
50
|
+
points: SliderSnapPoint[];
|
|
51
|
+
labelledBy: string | undefined;
|
|
52
|
+
label: string | undefined;
|
|
53
|
+
pressed: (v: number) => boolean;
|
|
54
|
+
pick: (v: number) => void;
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
chipClassName?: string;
|
|
57
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
58
|
+
/** The helper text, or the error in its place. */
|
|
59
|
+
export declare function Message(props: {
|
|
60
|
+
id: string;
|
|
61
|
+
helperText?: string;
|
|
62
|
+
errorMessage?: string;
|
|
63
|
+
disabled: boolean;
|
|
64
|
+
className?: string;
|
|
65
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { cn as a } from "../../../lib/utils.js";
|
|
4
|
+
import { Chip as o } from "../../atoms/Chip/Chip.js";
|
|
5
|
+
import { INSET as n, along as i, CAP as c } from "./track.js";
|
|
6
|
+
function g(t) {
|
|
7
|
+
return /* @__PURE__ */ d("div", { className: "rst:flex rst:items-baseline rst:justify-between rst:gap-3", children: [
|
|
8
|
+
t.label ? /* @__PURE__ */ e(
|
|
9
|
+
"span",
|
|
10
|
+
{
|
|
11
|
+
id: t.labelId,
|
|
12
|
+
className: a("rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]", t.disabled && "rst:opacity-50", t.labelClassName),
|
|
13
|
+
children: t.label
|
|
14
|
+
}
|
|
15
|
+
) : /* @__PURE__ */ e("span", {}),
|
|
16
|
+
/* @__PURE__ */ e(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
"data-slider-readout": "",
|
|
21
|
+
className: a(
|
|
22
|
+
"rst:text-sm rst:tabular-nums",
|
|
23
|
+
t.empty ? "rst:text-gray-500 rst:dark:text-gray-400" : "rst:font-semibold rst:text-[var(--roster-control-text)]",
|
|
24
|
+
t.disabled && "rst:opacity-50"
|
|
25
|
+
),
|
|
26
|
+
children: t.readout
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
function x() {
|
|
32
|
+
return /* @__PURE__ */ e(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
"data-slider-rail": "",
|
|
37
|
+
className: "rst:absolute rst:top-1/2 rst:h-2.5 rst:-translate-y-1/2 rst:rounded-full rst:border rst:border-[var(--roster-control-border)] rst:bg-gray-100 rst:dark:bg-gray-800",
|
|
38
|
+
style: { insetInline: n }
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function h({ from: t, to: r, dragging: l }) {
|
|
43
|
+
return /* @__PURE__ */ e(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
"data-slider-fill": "",
|
|
48
|
+
className: a(
|
|
49
|
+
"rst:absolute rst:top-1/2 rst:h-2.5 rst:-translate-y-1/2 rst:rounded-full rst:bg-primary-600 rst:dark:bg-primary-400",
|
|
50
|
+
"rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]",
|
|
51
|
+
!l && "rst:transition-[inset-inline-start,width] rst:duration-150 rst:ease-out rst:motion-reduce:transition-none"
|
|
52
|
+
),
|
|
53
|
+
style: { insetInlineStart: i(t), width: `calc((100% - ${2 * n}px) * ${r - t})` }
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function y({ points: t, at: r, filled: l }) {
|
|
58
|
+
return t.map((s) => /* @__PURE__ */ e(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
"data-slider-mark": "",
|
|
63
|
+
"data-filled": l(s.value) ? "" : void 0,
|
|
64
|
+
className: a(
|
|
65
|
+
"rst:absolute rst:top-1/2 rst:size-1.5 rst:-translate-x-1/2 rst:-translate-y-1/2 rst:rounded-full rst:rtl:translate-x-1/2",
|
|
66
|
+
"rst:transition-colors rst:duration-150 rst:motion-reduce:transition-none rst:forced-colors:forced-color-adjust-none",
|
|
67
|
+
l(s.value) ? "rst:bg-white rst:dark:bg-gray-900 rst:forced-colors:bg-[Canvas]" : "rst:bg-[var(--roster-control-border)] rst:forced-colors:bg-[CanvasText]"
|
|
68
|
+
),
|
|
69
|
+
style: { insetInlineStart: i(r(s.value), n + c) }
|
|
70
|
+
},
|
|
71
|
+
`${s.value}:${s.label}`
|
|
72
|
+
));
|
|
73
|
+
}
|
|
74
|
+
function v(t) {
|
|
75
|
+
return t.points.length === 0 ? null : /* @__PURE__ */ e(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
role: "group",
|
|
79
|
+
"aria-labelledby": t.labelledBy,
|
|
80
|
+
"aria-label": t.labelledBy ? void 0 : t.label,
|
|
81
|
+
className: "rst:mt-0.5 rst:flex rst:flex-wrap rst:gap-x-2 rst:gap-y-4",
|
|
82
|
+
"data-slider-snaps": "",
|
|
83
|
+
children: t.points.map((r) => /* @__PURE__ */ e(
|
|
84
|
+
o,
|
|
85
|
+
{
|
|
86
|
+
selected: t.pressed(r.value),
|
|
87
|
+
onSelectedChange: () => t.pick(r.value),
|
|
88
|
+
variant: t.pressed(r.value) ? "solid" : "outline",
|
|
89
|
+
colorScheme: t.pressed(r.value) ? "primary" : "neutral",
|
|
90
|
+
disabled: t.disabled,
|
|
91
|
+
className: a("rst:min-w-11 rst:shrink-0 rst:justify-center", t.chipClassName),
|
|
92
|
+
children: r.label
|
|
93
|
+
},
|
|
94
|
+
`${r.value}:${r.label}`
|
|
95
|
+
))
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
function N(t) {
|
|
100
|
+
return !t.helperText && !t.errorMessage ? null : /* @__PURE__ */ e(
|
|
101
|
+
"p",
|
|
102
|
+
{
|
|
103
|
+
id: t.id,
|
|
104
|
+
className: a(
|
|
105
|
+
"rst:m-0 rst:text-xs rst:text-left",
|
|
106
|
+
t.errorMessage ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400",
|
|
107
|
+
t.disabled && "rst:opacity-50",
|
|
108
|
+
t.className
|
|
109
|
+
),
|
|
110
|
+
children: t.errorMessage || t.helperText
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
h as Fill,
|
|
116
|
+
y as Marks,
|
|
117
|
+
N as Message,
|
|
118
|
+
x as Rail,
|
|
119
|
+
g as SliderHeader,
|
|
120
|
+
v as SnapChips
|
|
121
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),A=require("../../../lib/utils.cjs"),p=22,E=5,I=(t,s=p)=>`calc(${s}px + (100% - ${2*s}px) * ${t})`,X=t=>{const[s,n="0"]=String(t).split("e"),c=s.indexOf(".");return Math.max(0,(c===-1?0:s.length-c-1)-Number(n))};function D(t,s,n,c){const o=Math.max(X(n),X(t)),u=h.useCallback(b=>Math.min(s,Math.max(t,b)),[t,s]),l=h.useCallback((b,M=0)=>{const g=(b-t)/n,C=Math.round(g),R=M===0||Math.abs(g-C)<1e-6?C:M>0?Math.floor(g):Math.ceil(g);return u(Number((t+R*n).toFixed(o)))},[t,n,o,u]),T=h.useCallback(b=>s===t?0:(b-t)/(s-t),[t,s]);return{clamp:u,snap:l,at:T,coarse:c??Math.max(n,l(t+(s-t)/10)-t)}}function L(t,s,n){if(t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)return;const c=u=>Math.min(n.ceiling,Math.max(n.floor,u)),o=u=>s===null?n.start:c(n.scale.snap(s+u,u>0?1:-1));switch(t.key){case(n.rtl?"ArrowLeft":"ArrowRight"):case"ArrowUp":return o(n.step);case(n.rtl?"ArrowRight":"ArrowLeft"):case"ArrowDown":return o(-n.step);case"PageUp":return o(n.scale.coarse);case"PageDown":return o(-n.scale.coarse);case"Home":return n.floor;case"End":return n.ceiling;default:return}}function N(t){const[s,n]=h.useState(!1),c=h.useRef(null),o=()=>!!t.trackRef.current&&getComputedStyle(t.trackRef.current).direction==="rtl",u=()=>t.trackRef.current.getBoundingClientRect(),l=r=>{const e=u();let a=(r-e.left-p)/Math.max(1,e.width-2*p);return a=Math.min(1,Math.max(0,a)),o()&&(a=1-a),t.scale.snap(t.min+a*(t.max-t.min))},T=r=>{const e=u();return e.left+p+(e.width-2*p)*(o()?1-t.scale.at(r):t.scale.at(r))},b=r=>t.values().some((e,a)=>e!==r[a]),M=(r,e)=>{try{r.setPointerCapture(e)}catch{}n(!0)},g=(r,e,a)=>{const f=c.current;!f||f.id!==e||(c.current=null,f.mode==="drag"&&(n(!1),r.hasPointerCapture(e)&&r.releasePointerCapture(e),a&&b(f.from)&&t.commit()))},C=(r,e)=>{if(r.thumb!=="either")return r.thumb;const a=t.values()[r.tied[0]];if(e!==a)return r.thumb=e>a?r.tied[r.tied.length-1]:r.tied[0],t.focus(r.thumb),r.thumb};return{dragging:s,rtl:o,handlers:{onPointerDown:r=>{if(t.own.down?.(r),t.disabled||r.button!==0)return;if(c.current){if(!r.isPrimary)return;g(r.currentTarget,c.current.id,!1)}r.preventDefault();const e=r.currentTarget,a=t.values(),f=a.map((i,k)=>({v:i,i:k})).filter(i=>i.v!==null),P=i=>Math.abs(r.clientX-T(i)),d=f.reduce((i,k)=>!i||P(k.v)<P(i.v)?k:i,void 0),m=!!d&&P(d.v)<=p,w=d?f.filter(i=>i.v===d.v).map(i=>i.i):[0];let y=d?d.i:0;if(w.length>1){const i=l(r.clientX);y=m?"either":i<d.v?w[0]:w[w.length-1]}const S=m?T(d.v)-r.clientX:0,x={id:r.pointerId,x:r.clientX,y:r.clientY,thumb:y,tied:w,grab:S,from:a};if(r.pointerType==="mouse"||m){t.focus(y==="either"?w[0]:y),c.current={...x,mode:"drag"},M(e,r.pointerId),!m&&y!=="either"&&t.set(y,l(r.clientX),!1);return}c.current={...x,mode:"pending"}},onPointerMove:r=>{t.own.move?.(r);const e=c.current;if(!e||e.id!==r.pointerId)return;if(e.mode==="pending"){const P=Math.abs(r.clientX-e.x),d=Math.abs(r.clientY-e.y);if(P>7&&P>d){e.mode="drag",M(r.currentTarget,r.pointerId);const m=C(e,l(r.clientX));m!==void 0&&(t.focus(m),t.set(m,l(r.clientX),!1))}else d>10&&(c.current=null);return}const a=l(r.clientX+e.grab),f=C(e,a);f!==void 0&&t.set(f,a,!1)},onPointerUp:r=>{t.own.up?.(r);const e=c.current;if(e&&e.id===r.pointerId&&e.mode==="pending"){c.current=null,e.thumb!=="either"&&(t.focus(e.thumb),t.set(e.thumb,l(r.clientX),!0));return}g(r.currentTarget,r.pointerId,!0)},onPointerCancel:r=>{t.own.cancel?.(r),g(r.currentTarget,r.pointerId,!0)},onLostPointerCapture:r=>{t.own.lost?.(r),r.target===r.currentTarget&&g(r.currentTarget,r.pointerId,!0)}}}}function U(t){const s=h.useRef(t);return h.useLayoutEffect(()=>{s.current=t}),s}function F(t,s,n,c){const o=h.useRef(n);h.useEffect(()=>{o.current=n}),h.useEffect(()=>{const u=t.current?.form;if(!u||s)return;const l=()=>o.current();return u.addEventListener("reset",l),()=>u.removeEventListener("reset",l)},[t,s,c])}const K=(t,s,n)=>t.filter(c=>c.value>=s&&c.value<=n).sort((c,o)=>c.value-o.value),$=(t,s)=>s===null||t.length===0?void 0:t.reduce((n,c)=>Math.abs(c.value-s)<Math.abs(n.value-s)?c:n,t[0]),q=t=>A.cn("rst:relative rst:h-11 rst:w-full rst:touch-pan-y rst:select-none rst:rounded-md",t?"rst:cursor-not-allowed rst:opacity-50":"rst:cursor-pointer"),H=(t,s,n)=>A.cn("rst:absolute rst:top-1/2 rst:size-5 rst:-translate-x-1/2 rst:-translate-y-1/2 rst:rounded-full rst:rtl:translate-x-1/2","rst:border-2 rst:border-primary-600 rst:bg-white rst:elevation-control rst:dark:border-primary-400 rst:dark:bg-gray-900","rst:forced-colors:border-[Highlight]",s,!t&&"rst:transition-[inset-inline-start] rst:duration-150 rst:ease-out rst:motion-reduce:transition-none",n);exports.CAP=E;exports.INSET=p;exports.along=I;exports.inRange=K;exports.keyTarget=L;exports.nearestPoint=$;exports.thumbClasses=H;exports.trackClasses=q;exports.useCommitted=U;exports.useFormReset=F;exports.useScale=D;exports.useTrackPress=N;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { KeyboardEvent, PointerEvent, RefObject } from 'react';
|
|
2
|
+
/** A named stop on the track: a chip under it moves a thumb there. */
|
|
3
|
+
export interface SliderSnapPoint {
|
|
4
|
+
value: number;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const INSET = 22;
|
|
8
|
+
export declare const CAP = 5;
|
|
9
|
+
/** A place along the rail, as a share of it from the start edge, for `inset-inline-start`. */
|
|
10
|
+
export declare const along: (share: number, inset?: number) => string;
|
|
11
|
+
export interface Scale {
|
|
12
|
+
clamp: (n: number) => number;
|
|
13
|
+
/**
|
|
14
|
+
* The nearest value on a step, in range. `toward` takes the next one that
|
|
15
|
+
* way instead, for a key from a value between steps (a controlled value off
|
|
16
|
+
* the grid, or a `max` that isn't on it): Left from 1 on a 0.3 step lands on
|
|
17
|
+
* 0.9, not 0.6.
|
|
18
|
+
*/
|
|
19
|
+
snap: (raw: number, toward?: -1 | 0 | 1) => number;
|
|
20
|
+
/** PageUp and PageDown's move. */
|
|
21
|
+
coarse: number;
|
|
22
|
+
/** A value's share of the range, from `min`. */
|
|
23
|
+
at: (v: number) => number;
|
|
24
|
+
}
|
|
25
|
+
export declare function useScale(min: number, max: number, step: number, pageStep: number | undefined): Scale;
|
|
26
|
+
/**
|
|
27
|
+
* Where a key takes a thumb, or `undefined` for a key that isn't the
|
|
28
|
+
* slider's. The arrows step by `step` and the Page keys by the scale's
|
|
29
|
+
* `coarse`, Home and End go to `floor` and `ceiling`, and a thumb with no
|
|
30
|
+
* value goes to `start` on an arrow or Page key rather than stepping from
|
|
31
|
+
* anywhere. A combination is the app's or the browser's, and so is a key its
|
|
32
|
+
* owner has already handled.
|
|
33
|
+
*/
|
|
34
|
+
export declare function keyTarget(event: KeyboardEvent, now: number | null, o: {
|
|
35
|
+
scale: Scale;
|
|
36
|
+
step: number;
|
|
37
|
+
start: number;
|
|
38
|
+
floor: number;
|
|
39
|
+
ceiling: number;
|
|
40
|
+
rtl: boolean;
|
|
41
|
+
}): number | undefined;
|
|
42
|
+
type Handler = ((event: PointerEvent<HTMLDivElement>) => void) | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The track's pointer, for any number of thumbs.
|
|
45
|
+
*
|
|
46
|
+
* A mouse press, or one on a thumb, drags at once. A touch on the track waits
|
|
47
|
+
* to see which way it goes: across is a drag, down the page is a scroll and
|
|
48
|
+
* sets nothing, and no movement is a tap, set when the finger lifts. A press
|
|
49
|
+
* takes the thumb nearest it, worked out from the values rather than from
|
|
50
|
+
* the drawn thumbs, which may still be easing there. Two thumbs on one spot
|
|
51
|
+
* are told apart by the way the drag first moves: up the range takes the
|
|
52
|
+
* higher one. A press on a thumb keeps where it landed on it, rather than
|
|
53
|
+
* jumping the thumb to the pointer.
|
|
54
|
+
*/
|
|
55
|
+
export declare function useTrackPress(o: {
|
|
56
|
+
trackRef: RefObject<HTMLDivElement | null>;
|
|
57
|
+
disabled: boolean;
|
|
58
|
+
scale: Scale;
|
|
59
|
+
min: number;
|
|
60
|
+
max: number;
|
|
61
|
+
/** The values the thumbs are at, by index; `null` for one not placed. */
|
|
62
|
+
values: () => (number | null)[];
|
|
63
|
+
set: (thumb: number, value: number, finished: boolean) => void;
|
|
64
|
+
focus: (thumb: number) => void;
|
|
65
|
+
/** A drag that moved something has ended. */
|
|
66
|
+
commit: () => void;
|
|
67
|
+
/** The consumer's own handlers, called first. */
|
|
68
|
+
own: {
|
|
69
|
+
down: Handler;
|
|
70
|
+
move: Handler;
|
|
71
|
+
up: Handler;
|
|
72
|
+
cancel: Handler;
|
|
73
|
+
lost: Handler;
|
|
74
|
+
};
|
|
75
|
+
}): {
|
|
76
|
+
dragging: boolean;
|
|
77
|
+
rtl: () => boolean;
|
|
78
|
+
handlers: {
|
|
79
|
+
onPointerDown: (event: PointerEvent<HTMLDivElement>) => void;
|
|
80
|
+
onPointerMove: (event: PointerEvent<HTMLDivElement>) => void;
|
|
81
|
+
onPointerUp: (event: PointerEvent<HTMLDivElement>) => void;
|
|
82
|
+
onPointerCancel: (event: PointerEvent<HTMLDivElement>) => void;
|
|
83
|
+
onLostPointerCapture: (event: PointerEvent<HTMLDivElement>) => void;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Keeps a ref on the values the thumbs are at, for the keys and the pointer
|
|
88
|
+
* to step from. Set the moment a change is made, so input that arrives
|
|
89
|
+
* before a render counts every press, and never read from the drawn thumbs,
|
|
90
|
+
* which ease toward the values after them. Each render brings it back to the
|
|
91
|
+
* values, which a controlling owner may have set from outside, or declined.
|
|
92
|
+
*/
|
|
93
|
+
export declare function useCommitted<T>(value: T): RefObject<T>;
|
|
94
|
+
/**
|
|
95
|
+
* A form's reset puts an uncontrolled slider back where it started, as it
|
|
96
|
+
* does a native input. A controlled one is its owner's to reset.
|
|
97
|
+
*/
|
|
98
|
+
export declare function useFormReset(input: RefObject<HTMLInputElement | null>, controlled: boolean, reset: () => void, name: string | undefined): void;
|
|
99
|
+
/** Snap points in range, in the track's order, low to high from its start, whatever order they came in. */
|
|
100
|
+
export declare const inRange: (points: SliderSnapPoint[], min: number, max: number) => SliderSnapPoint[];
|
|
101
|
+
/** The snap point nearest a value. Halfway between two, the lower one's. */
|
|
102
|
+
export declare const nearestPoint: (points: SliderSnapPoint[], value: number | null) => SliderSnapPoint | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* The track's classes. 44px tall, a thumb's whole target. pan-y: a finger
|
|
105
|
+
* moving down the page still scrolls it; across, it drags.
|
|
106
|
+
*/
|
|
107
|
+
export declare const trackClasses: (disabled: boolean) => string;
|
|
108
|
+
/**
|
|
109
|
+
* A thumb's classes: drawn where its value is, eased there unless it's being
|
|
110
|
+
* dragged. Its target is the 44px around it, which the track's height and
|
|
111
|
+
* inset keep on the track. `ring` is the focus ring, for whichever state
|
|
112
|
+
* shows it.
|
|
113
|
+
*/
|
|
114
|
+
export declare const thumbClasses: (dragging: boolean, ring: string, className?: string) => string;
|
|
115
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback as T, useRef as k, useLayoutEffect as E, useEffect as A, useState as S } from "react";
|
|
3
|
+
import { cn as I } from "../../../lib/utils.js";
|
|
4
|
+
const P = 22, Y = 5, z = (t, s = P) => `calc(${s}px + (100% - ${2 * s}px) * ${t})`, D = (t) => {
|
|
5
|
+
const [s, n = "0"] = String(t).split("e"), c = s.indexOf(".");
|
|
6
|
+
return Math.max(0, (c === -1 ? 0 : s.length - c - 1) - Number(n));
|
|
7
|
+
};
|
|
8
|
+
function B(t, s, n, c) {
|
|
9
|
+
const a = Math.max(D(n), D(t)), i = T((g) => Math.min(s, Math.max(t, g)), [t, s]), l = T(
|
|
10
|
+
(g, M = 0) => {
|
|
11
|
+
const h = (g - t) / n, y = Math.round(h), R = M === 0 || Math.abs(h - y) < 1e-6 ? y : M > 0 ? Math.floor(h) : Math.ceil(h);
|
|
12
|
+
return i(Number((t + R * n).toFixed(a)));
|
|
13
|
+
},
|
|
14
|
+
[t, n, a, i]
|
|
15
|
+
), x = T((g) => s === t ? 0 : (g - t) / (s - t), [t, s]);
|
|
16
|
+
return { clamp: i, snap: l, at: x, coarse: c ?? Math.max(n, l(t + (s - t) / 10) - t) };
|
|
17
|
+
}
|
|
18
|
+
function O(t, s, n) {
|
|
19
|
+
if (t.defaultPrevented || t.altKey || t.ctrlKey || t.metaKey) return;
|
|
20
|
+
const c = (i) => Math.min(n.ceiling, Math.max(n.floor, i)), a = (i) => s === null ? n.start : c(n.scale.snap(s + i, i > 0 ? 1 : -1));
|
|
21
|
+
switch (t.key) {
|
|
22
|
+
case (n.rtl ? "ArrowLeft" : "ArrowRight"):
|
|
23
|
+
case "ArrowUp":
|
|
24
|
+
return a(n.step);
|
|
25
|
+
case (n.rtl ? "ArrowRight" : "ArrowLeft"):
|
|
26
|
+
case "ArrowDown":
|
|
27
|
+
return a(-n.step);
|
|
28
|
+
case "PageUp":
|
|
29
|
+
return a(n.scale.coarse);
|
|
30
|
+
case "PageDown":
|
|
31
|
+
return a(-n.scale.coarse);
|
|
32
|
+
case "Home":
|
|
33
|
+
return n.floor;
|
|
34
|
+
case "End":
|
|
35
|
+
return n.ceiling;
|
|
36
|
+
default:
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function j(t) {
|
|
41
|
+
const [s, n] = S(!1), c = k(null), a = () => !!t.trackRef.current && getComputedStyle(t.trackRef.current).direction === "rtl", i = () => t.trackRef.current.getBoundingClientRect(), l = (r) => {
|
|
42
|
+
const e = i();
|
|
43
|
+
let o = (r - e.left - P) / Math.max(1, e.width - 2 * P);
|
|
44
|
+
return o = Math.min(1, Math.max(0, o)), a() && (o = 1 - o), t.scale.snap(t.min + o * (t.max - t.min));
|
|
45
|
+
}, x = (r) => {
|
|
46
|
+
const e = i();
|
|
47
|
+
return e.left + P + (e.width - 2 * P) * (a() ? 1 - t.scale.at(r) : t.scale.at(r));
|
|
48
|
+
}, g = (r) => t.values().some((e, o) => e !== r[o]), M = (r, e) => {
|
|
49
|
+
try {
|
|
50
|
+
r.setPointerCapture(e);
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
n(!0);
|
|
54
|
+
}, h = (r, e, o) => {
|
|
55
|
+
const f = c.current;
|
|
56
|
+
!f || f.id !== e || (c.current = null, f.mode === "drag" && (n(!1), r.hasPointerCapture(e) && r.releasePointerCapture(e), o && g(f.from) && t.commit()));
|
|
57
|
+
}, y = (r, e) => {
|
|
58
|
+
if (r.thumb !== "either") return r.thumb;
|
|
59
|
+
const o = t.values()[r.tied[0]];
|
|
60
|
+
if (e !== o)
|
|
61
|
+
return r.thumb = e > o ? r.tied[r.tied.length - 1] : r.tied[0], t.focus(r.thumb), r.thumb;
|
|
62
|
+
};
|
|
63
|
+
return { dragging: s, rtl: a, handlers: { onPointerDown: (r) => {
|
|
64
|
+
if (t.own.down?.(r), t.disabled || r.button !== 0) return;
|
|
65
|
+
if (c.current) {
|
|
66
|
+
if (!r.isPrimary) return;
|
|
67
|
+
h(r.currentTarget, c.current.id, !1);
|
|
68
|
+
}
|
|
69
|
+
r.preventDefault();
|
|
70
|
+
const e = r.currentTarget, o = t.values(), f = o.map((u, C) => ({ v: u, i: C })).filter((u) => u.v !== null), b = (u) => Math.abs(r.clientX - x(u)), d = f.reduce((u, C) => !u || b(C.v) < b(u.v) ? C : u, void 0), m = !!d && b(d.v) <= P, p = d ? f.filter((u) => u.v === d.v).map((u) => u.i) : [0];
|
|
71
|
+
let w = d ? d.i : 0;
|
|
72
|
+
if (p.length > 1) {
|
|
73
|
+
const u = l(r.clientX);
|
|
74
|
+
w = m ? "either" : u < d.v ? p[0] : p[p.length - 1];
|
|
75
|
+
}
|
|
76
|
+
const L = m ? x(d.v) - r.clientX : 0, X = { id: r.pointerId, x: r.clientX, y: r.clientY, thumb: w, tied: p, grab: L, from: o };
|
|
77
|
+
if (r.pointerType === "mouse" || m) {
|
|
78
|
+
t.focus(w === "either" ? p[0] : w), c.current = { ...X, mode: "drag" }, M(e, r.pointerId), !m && w !== "either" && t.set(w, l(r.clientX), !1);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
c.current = { ...X, mode: "pending" };
|
|
82
|
+
}, onPointerMove: (r) => {
|
|
83
|
+
t.own.move?.(r);
|
|
84
|
+
const e = c.current;
|
|
85
|
+
if (!e || e.id !== r.pointerId) return;
|
|
86
|
+
if (e.mode === "pending") {
|
|
87
|
+
const b = Math.abs(r.clientX - e.x), d = Math.abs(r.clientY - e.y);
|
|
88
|
+
if (b > 7 && b > d) {
|
|
89
|
+
e.mode = "drag", M(r.currentTarget, r.pointerId);
|
|
90
|
+
const m = y(e, l(r.clientX));
|
|
91
|
+
m !== void 0 && (t.focus(m), t.set(m, l(r.clientX), !1));
|
|
92
|
+
} else d > 10 && (c.current = null);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const o = l(r.clientX + e.grab), f = y(e, o);
|
|
96
|
+
f !== void 0 && t.set(f, o, !1);
|
|
97
|
+
}, onPointerUp: (r) => {
|
|
98
|
+
t.own.up?.(r);
|
|
99
|
+
const e = c.current;
|
|
100
|
+
if (e && e.id === r.pointerId && e.mode === "pending") {
|
|
101
|
+
c.current = null, e.thumb !== "either" && (t.focus(e.thumb), t.set(e.thumb, l(r.clientX), !0));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
h(r.currentTarget, r.pointerId, !0);
|
|
105
|
+
}, onPointerCancel: (r) => {
|
|
106
|
+
t.own.cancel?.(r), h(r.currentTarget, r.pointerId, !0);
|
|
107
|
+
}, onLostPointerCapture: (r) => {
|
|
108
|
+
t.own.lost?.(r), r.target === r.currentTarget && h(r.currentTarget, r.pointerId, !0);
|
|
109
|
+
} } };
|
|
110
|
+
}
|
|
111
|
+
function q(t) {
|
|
112
|
+
const s = k(t);
|
|
113
|
+
return E(() => {
|
|
114
|
+
s.current = t;
|
|
115
|
+
}), s;
|
|
116
|
+
}
|
|
117
|
+
function G(t, s, n, c) {
|
|
118
|
+
const a = k(n);
|
|
119
|
+
A(() => {
|
|
120
|
+
a.current = n;
|
|
121
|
+
}), A(() => {
|
|
122
|
+
const i = t.current?.form;
|
|
123
|
+
if (!i || s) return;
|
|
124
|
+
const l = () => a.current();
|
|
125
|
+
return i.addEventListener("reset", l), () => i.removeEventListener("reset", l);
|
|
126
|
+
}, [t, s, c]);
|
|
127
|
+
}
|
|
128
|
+
const J = (t, s, n) => t.filter((c) => c.value >= s && c.value <= n).sort((c, a) => c.value - a.value), Q = (t, s) => s === null || t.length === 0 ? void 0 : t.reduce((n, c) => Math.abs(c.value - s) < Math.abs(n.value - s) ? c : n, t[0]), V = (t) => I(
|
|
129
|
+
"rst:relative rst:h-11 rst:w-full rst:touch-pan-y rst:select-none rst:rounded-md",
|
|
130
|
+
t ? "rst:cursor-not-allowed rst:opacity-50" : "rst:cursor-pointer"
|
|
131
|
+
), W = (t, s, n) => I(
|
|
132
|
+
"rst:absolute rst:top-1/2 rst:size-5 rst:-translate-x-1/2 rst:-translate-y-1/2 rst:rounded-full rst:rtl:translate-x-1/2",
|
|
133
|
+
"rst:border-2 rst:border-primary-600 rst:bg-white rst:elevation-control rst:dark:border-primary-400 rst:dark:bg-gray-900",
|
|
134
|
+
"rst:forced-colors:border-[Highlight]",
|
|
135
|
+
s,
|
|
136
|
+
!t && "rst:transition-[inset-inline-start] rst:duration-150 rst:ease-out rst:motion-reduce:transition-none",
|
|
137
|
+
n
|
|
138
|
+
);
|
|
139
|
+
export {
|
|
140
|
+
Y as CAP,
|
|
141
|
+
P as INSET,
|
|
142
|
+
z as along,
|
|
143
|
+
J as inRange,
|
|
144
|
+
O as keyTarget,
|
|
145
|
+
Q as nearestPoint,
|
|
146
|
+
W as thumbClasses,
|
|
147
|
+
V as trackClasses,
|
|
148
|
+
q as useCommitted,
|
|
149
|
+
G as useFormReset,
|
|
150
|
+
B as useScale,
|
|
151
|
+
j as useTrackPress
|
|
152
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),j=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),w=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),o=require("../../../node_modules/class-variance-authority/dist/index.cjs"),s=require("../../../lib/utils.cjs"),N=require("../../../lib/labels.cjs"),_=require("../../../internal/page-inert.cjs"),a=require("../../../node_modules/@headlessui/react/dist/components/dialog/dialog.cjs"),d=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),j=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),w=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),o=require("../../../node_modules/class-variance-authority/dist/index.cjs"),s=require("../../../lib/utils.cjs"),N=require("../../../lib/labels.cjs"),_=require("../../../internal/page-inert.cjs"),q=require("../../../internal/key-focus.cjs"),a=require("../../../node_modules/@headlessui/react/dist/components/dialog/dialog.cjs"),d=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),F=o.cva("rst:relative rst:w-full rst:transform rst:overflow-hidden rst:rounded-2xl rst:p-6 rst:text-left rst:align-middle rst:elevation-overlay rst:transition-all rst:border",{variants:{size:{xs:"rst:max-w-xs",sm:"rst:max-w-sm",md:"rst:max-w-md",lg:"rst:max-w-lg",xl:"rst:max-w-xl","2xl":"rst:max-w-2xl","3xl":"rst:max-w-3xl",full:"rst:max-w-[95vw] rst:m-4"},variant:{white:"rst:bg-[var(--roster-popover-bg)] rst:border-[var(--roster-popover-border)] rst:text-[var(--roster-popover-text)]",slate:"rst:bg-gray-700 rst:border-gray-600 rst:text-gray-100 rst:dark:bg-gray-900 rst:dark:border-gray-800 rst:[--roster-ring:var(--roster-primary-400,#5ea3de)] rst:[--roster-ring-offset:var(--roster-gray-700,#44403c)] rst:dark:[--roster-ring-offset:var(--roster-gray-900,#1c1917)] rst:[--roster-control-text:var(--roster-gray-100,#f5f5f4)] rst:[--roster-control-border:var(--roster-gray-400,#a8a29e)] rst:[--roster-control-border-focus:var(--roster-primary-400,#5ea3de)]",primary:"rst:bg-primary-700 rst:border-primary-600 rst:text-primary-700-ink rst:dark:text-white rst:dark:bg-primary-950 rst:dark:border-primary-900 rst:[--roster-ring:var(--roster-primary-400,#5ea3de)] rst:[--roster-ring-offset:var(--roster-primary-700,#084063)] rst:dark:[--roster-ring-offset:var(--roster-primary-950,#021724)] rst:[--roster-control-text:var(--roster-gray-100,#f5f5f4)] rst:[--roster-control-border:var(--roster-gray-400,#a8a29e)] rst:[--roster-control-border-focus:var(--roster-primary-400,#5ea3de)]",glass:"rst:bg-white/80 rst:border-white/20 rst:backdrop-blur-xl rst:text-gray-900 rst:dark:bg-slate-900/80 rst:dark:border-slate-700/50 rst:dark:text-white"},status:{default:"",destructive:"rst:border-t-4 rst:border-t-error-500",success:"rst:border-t-4 rst:border-t-success-500"}},defaultVariants:{size:"md",variant:"white",status:"default"}}),T=o.cva("rst:text-xl rst:font-bold rst:leading-6 rst:text-inherit"),D=o.cva("rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75"),L=o.cva("rst:inline-flex rst:size-11 rst:shrink-0 rst:items-center rst:justify-center rst:-m-3 rst:cursor-pointer rst:rounded-md rst:bg-transparent rst:text-inherit rst:opacity-50 rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background rst:transition-opacity"),V={close:"Close dialog"},z=({isOpen:u,onClose:i,title:m,description:n,size:x,variant:l,status:b,children:g,className:f,onAfterClose:v,labels:p})=>{q.useKeyFocus();const y=N.withLabels(V,p),[h,k]=t.useState(!1);t.useLayoutEffect(()=>{k(!0)},[]);const e=u&&h,c=t.useRef(null);return t.useLayoutEffect(()=>{if(e)return _.lockPage(c.current)},[e]),r.jsxs(r.Fragment,{children:[e&&r.jsx("span",{ref:c,hidden:!0}),r.jsxs(a.Dialog,{open:e,as:"div",className:"rst:font-ui rst:relative rst:z-50",onClose:i,children:[r.jsx(d.TransitionChild,{as:t.Fragment,enter:"rst:ease-out rst:duration-300",enterFrom:"rst:opacity-0",enterTo:"rst:opacity-100",leave:"rst:ease-in rst:duration-200",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:r.jsx(a.DialogBackdrop,{className:s.cn("rst:fixed rst:inset-0 rst:transition-opacity",l==="glass"?"rst:bg-[var(--roster-backdrop,color-mix(in_oklab,oklch(20.8%_0.042_265.755)_40%,transparent))] rst:dark:bg-[var(--roster-backdrop,color-mix(in_oklab,var(--roster-black,#1e1c1a)_60%,transparent))]":"rst:bg-[var(--roster-backdrop,color-mix(in_oklab,oklch(20.8%_0.042_265.755)_60%,transparent))] rst:dark:bg-[var(--roster-backdrop,color-mix(in_oklab,var(--roster-black,#1e1c1a)_80%,transparent))] rst:backdrop-blur-backdrop")})}),r.jsx("div",{className:"rst:fixed rst:inset-0 rst:overflow-y-auto",children:r.jsx("div",{className:"rst:flex rst:min-h-full rst:items-center rst:justify-center rst:p-4 rst:text-center",children:r.jsx(d.TransitionChild,{as:t.Fragment,enter:"rst:ease-out rst:duration-300",enterFrom:"rst:opacity-0 rst:scale-95",enterTo:"rst:opacity-100 rst:scale-100",leave:"rst:ease-in rst:duration-200",leaveFrom:"rst:opacity-100 rst:scale-100",leaveTo:"rst:opacity-0 rst:scale-95",afterLeave:v,children:r.jsxs(a.DialogPanel,{className:s.cn(F({size:x,variant:l,status:b}),f),children:[r.jsxs("div",{className:"rst:flex rst:items-start rst:justify-between",children:[r.jsxs("div",{children:[r.jsx(a.DialogTitle,{as:"h2",className:s.cn(T()),children:m}),n&&r.jsx("p",{className:s.cn(D()),children:n})]}),r.jsx("div",{className:"rst:ml-4 rst:flex rst:shrink-0",children:r.jsx("button",{type:"button",onClick:i,className:s.cn(L()),"aria-label":y.close,children:r.jsx(j.FontAwesomeIcon,{icon:w.faXmark,className:"rst:h-5 rst:w-5"})})})]}),r.jsx("div",{className:"rst:mt-6",children:g})]})})})})]})]})};exports.Dialog=z;
|
|
@@ -7,9 +7,10 @@ import { cva as a } from "../../../node_modules/class-variance-authority/dist/in
|
|
|
7
7
|
import { cn as s } from "../../../lib/utils.js";
|
|
8
8
|
import { withLabels as j } from "../../../lib/labels.js";
|
|
9
9
|
import { lockPage as z } from "../../../internal/page-inert.js";
|
|
10
|
-
import {
|
|
10
|
+
import { useKeyFocus as D } from "../../../internal/key-focus.js";
|
|
11
|
+
import { Dialog as V, DialogBackdrop as A, DialogPanel as B, DialogTitle as C } from "../../../node_modules/@headlessui/react/dist/components/dialog/dialog.js";
|
|
11
12
|
import { TransitionChild as m } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
|
|
12
|
-
const
|
|
13
|
+
const E = /* @__PURE__ */ a(
|
|
13
14
|
"rst:relative rst:w-full rst:transform rst:overflow-hidden rst:rounded-2xl rst:p-6 rst:text-left rst:align-middle rst:elevation-overlay rst:transition-all rst:border",
|
|
14
15
|
{
|
|
15
16
|
variants: {
|
|
@@ -78,9 +79,9 @@ const C = /* @__PURE__ */ a(
|
|
|
78
79
|
status: "default"
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
),
|
|
82
|
+
), P = /* @__PURE__ */ a("rst:text-xl rst:font-bold rst:leading-6 rst:text-inherit"), R = /* @__PURE__ */ a("rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75"), S = /* @__PURE__ */ a(
|
|
82
83
|
"rst:inline-flex rst:size-11 rst:shrink-0 rst:items-center rst:justify-center rst:-m-3 rst:cursor-pointer rst:rounded-md rst:bg-transparent rst:text-inherit rst:opacity-50 rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background rst:transition-opacity"
|
|
83
|
-
),
|
|
84
|
+
), I = { close: "Close dialog" }, W = ({
|
|
84
85
|
isOpen: f,
|
|
85
86
|
onClose: o,
|
|
86
87
|
title: p,
|
|
@@ -88,12 +89,13 @@ const C = /* @__PURE__ */ a(
|
|
|
88
89
|
size: b,
|
|
89
90
|
variant: n,
|
|
90
91
|
status: g,
|
|
91
|
-
children:
|
|
92
|
-
className:
|
|
92
|
+
children: u,
|
|
93
|
+
className: v,
|
|
93
94
|
onAfterClose: x,
|
|
94
95
|
labels: y
|
|
95
96
|
}) => {
|
|
96
|
-
|
|
97
|
+
D();
|
|
98
|
+
const h = j(I, y), [k, w] = _(!1);
|
|
97
99
|
c(() => {
|
|
98
100
|
w(!0);
|
|
99
101
|
}, []);
|
|
@@ -104,7 +106,7 @@ const C = /* @__PURE__ */ a(
|
|
|
104
106
|
}, [e]), /* @__PURE__ */ t(N, { children: [
|
|
105
107
|
e && /* @__PURE__ */ r("span", { ref: l, hidden: !0 }),
|
|
106
108
|
/* @__PURE__ */ t(
|
|
107
|
-
|
|
109
|
+
V,
|
|
108
110
|
{
|
|
109
111
|
open: e,
|
|
110
112
|
as: "div",
|
|
@@ -122,7 +124,7 @@ const C = /* @__PURE__ */ a(
|
|
|
122
124
|
leaveFrom: "rst:opacity-100",
|
|
123
125
|
leaveTo: "rst:opacity-0",
|
|
124
126
|
children: /* @__PURE__ */ r(
|
|
125
|
-
|
|
127
|
+
A,
|
|
126
128
|
{
|
|
127
129
|
className: s(
|
|
128
130
|
"rst:fixed rst:inset-0 rst:transition-opacity",
|
|
@@ -144,30 +146,30 @@ const C = /* @__PURE__ */ a(
|
|
|
144
146
|
leaveTo: "rst:opacity-0 rst:scale-95",
|
|
145
147
|
afterLeave: x,
|
|
146
148
|
children: /* @__PURE__ */ t(
|
|
147
|
-
|
|
149
|
+
B,
|
|
148
150
|
{
|
|
149
151
|
className: s(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
E({ size: b, variant: n, status: g }),
|
|
153
|
+
v
|
|
152
154
|
),
|
|
153
155
|
children: [
|
|
154
156
|
/* @__PURE__ */ t("div", { className: "rst:flex rst:items-start rst:justify-between", children: [
|
|
155
157
|
/* @__PURE__ */ t("div", { children: [
|
|
156
|
-
/* @__PURE__ */ r(
|
|
157
|
-
i && /* @__PURE__ */ r("p", { className: s(
|
|
158
|
+
/* @__PURE__ */ r(C, { as: "h2", className: s(P()), children: p }),
|
|
159
|
+
i && /* @__PURE__ */ r("p", { className: s(R()), children: i })
|
|
158
160
|
] }),
|
|
159
161
|
/* @__PURE__ */ r("div", { className: "rst:ml-4 rst:flex rst:shrink-0", children: /* @__PURE__ */ r(
|
|
160
162
|
"button",
|
|
161
163
|
{
|
|
162
164
|
type: "button",
|
|
163
165
|
onClick: o,
|
|
164
|
-
className: s(
|
|
166
|
+
className: s(S()),
|
|
165
167
|
"aria-label": h.close,
|
|
166
168
|
children: /* @__PURE__ */ r(L, { icon: T, className: "rst:h-5 rst:w-5" })
|
|
167
169
|
}
|
|
168
170
|
) })
|
|
169
171
|
] }),
|
|
170
|
-
/* @__PURE__ */ r("div", { className: "rst:mt-6", children:
|
|
172
|
+
/* @__PURE__ */ r("div", { className: "rst:mt-6", children: u })
|
|
171
173
|
]
|
|
172
174
|
}
|
|
173
175
|
)
|
|
@@ -179,5 +181,5 @@ const C = /* @__PURE__ */ a(
|
|
|
179
181
|
] });
|
|
180
182
|
};
|
|
181
183
|
export {
|
|
182
|
-
|
|
184
|
+
W as Dialog
|
|
183
185
|
};
|