@blakesteve/roster 5.9.0 → 5.11.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 +206 -25
- package/dist/components/atoms/Button/button-variants.js +1 -1
- package/dist/components/atoms/Eyebrow/eyebrow-variants.d.ts +2 -2
- package/dist/components/atoms/Input/input-variants.js +1 -1
- package/dist/components/atoms/PasswordInput/PasswordInput.cjs +1 -1
- package/dist/components/atoms/PasswordInput/PasswordInput.js +5 -5
- package/dist/components/atoms/Select/select-variants.cjs +1 -1
- package/dist/components/atoms/Select/select-variants.js +11 -2
- package/dist/components/atoms/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/atoms/Skeleton/Skeleton.d.ts +19 -3
- package/dist/components/atoms/Skeleton/Skeleton.js +38 -33
- package/dist/components/atoms/ThemeToggle/ThemeToggle.d.ts +1 -1
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/molecules/CheckboxGroup/checkbox-group-variants.d.ts +1 -1
- package/dist/components/molecules/Menu/Menu.cjs +1 -1
- package/dist/components/molecules/Menu/Menu.js +60 -53
- package/dist/components/molecules/RangeSlider/RangeSlider.cjs +1 -0
- package/dist/components/molecules/RangeSlider/RangeSlider.d.ts +74 -0
- package/dist/components/molecules/RangeSlider/RangeSlider.js +164 -0
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +13 -4
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +35 -35
- package/dist/components/molecules/Slider/Slider.cjs +1 -0
- package/dist/components/molecules/Slider/Slider.d.ts +87 -0
- package/dist/components/molecules/Slider/Slider.js +128 -0
- package/dist/components/molecules/Slider/track-parts.cjs +1 -0
- package/dist/components/molecules/Slider/track-parts.d.ts +64 -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/molecules/Toast/Toaster.d.ts +1 -1
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.js +37 -37
- package/dist/index.d.ts +2 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.js +4 -1
- 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,74 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SliderSnapPoint } from '../Slider/track';
|
|
3
|
+
/** A range's two values, low then high. */
|
|
4
|
+
export type RangeValue = [number, number];
|
|
5
|
+
/** Every word RangeSlider says. Pass any of them in `labels` to replace it. */
|
|
6
|
+
export interface RangeSliderLabels {
|
|
7
|
+
/** The low thumb's name, heard after the slider's label: "Price Minimum". */
|
|
8
|
+
low: string;
|
|
9
|
+
/** The high thumb's name. */
|
|
10
|
+
high: string;
|
|
11
|
+
/** What a screen reader hears for a thumb's value, with the nearest snap point's label when there is one: "40, Likely". */
|
|
12
|
+
valueText: (value: string, nearest: string | undefined) => string;
|
|
13
|
+
/** The number shown beside the label, both values in one: "20 – 80". */
|
|
14
|
+
range: (low: string, high: string) => string;
|
|
15
|
+
}
|
|
16
|
+
export interface RangeSliderProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
17
|
+
/** The two values, low then high. Pass it to control the slider; leave it out for one that starts from `defaultValue`. */
|
|
18
|
+
value?: RangeValue;
|
|
19
|
+
/** Where an uncontrolled slider starts. The whole range, `[min, max]`, by default. */
|
|
20
|
+
defaultValue?: RangeValue;
|
|
21
|
+
/** Each change: a tap, every step of a drag, a key, a snap point. */
|
|
22
|
+
onChange?: (value: RangeValue) => void;
|
|
23
|
+
/** Once a change is finished: a tap, the end of a drag, a key, a snap point. */
|
|
24
|
+
onCommit?: (value: RangeValue) => void;
|
|
25
|
+
/** The lowest value. */
|
|
26
|
+
min?: number;
|
|
27
|
+
/** The highest value. */
|
|
28
|
+
max?: number;
|
|
29
|
+
/** The smallest move: the arrows step by it, and every value lands on it. */
|
|
30
|
+
step?: number;
|
|
31
|
+
/** PageUp and PageDown's move. A tenth of the range, on a step, by default. */
|
|
32
|
+
pageStep?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Named stops, any values and labels. Each gets a mark on the track and a
|
|
35
|
+
* chip under it, which does what a tap on its mark does: moves the nearer
|
|
36
|
+
* thumb there. A point outside `min` to `max` is left out.
|
|
37
|
+
*/
|
|
38
|
+
snapPoints?: SliderSnapPoint[];
|
|
39
|
+
/** The slider's name, shown above the track. */
|
|
40
|
+
label?: string;
|
|
41
|
+
/** Supporting text under the slider. */
|
|
42
|
+
helperText?: string;
|
|
43
|
+
/** The message for an invalid value. Implies the error state. */
|
|
44
|
+
errorMessage?: string;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** A form field name: both values are submitted under it, low then high, as a multiple select's are. */
|
|
47
|
+
name?: string;
|
|
48
|
+
/** How a value is written, in the readout and in what's said. */
|
|
49
|
+
formatValue?: (value: number) => string;
|
|
50
|
+
/** Every word the slider says, with English defaults. */
|
|
51
|
+
labels?: Partial<RangeSliderLabels>;
|
|
52
|
+
/** Classes for the track, the pointer's hit area. */
|
|
53
|
+
trackClassName?: string;
|
|
54
|
+
/** Classes for each thumb. */
|
|
55
|
+
thumbClassName?: string;
|
|
56
|
+
/** Classes for each snap chip. */
|
|
57
|
+
chipClassName?: string;
|
|
58
|
+
/** Classes for the label. */
|
|
59
|
+
labelClassName?: string;
|
|
60
|
+
/** Classes for the helper text or error message. */
|
|
61
|
+
messageClassName?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Two values picked along one track, a low and a high: tapped, dragged,
|
|
65
|
+
* stepped with the keys, or set from a named snap point.
|
|
66
|
+
*
|
|
67
|
+
* Each thumb is a slider of its own to a screen reader and the keyboard, a
|
|
68
|
+
* tab stop named for the slider and for its end ("Price Minimum"), whose
|
|
69
|
+
* range runs to the other thumb: the thumbs meet, and never cross. The track
|
|
70
|
+
* takes a press for the nearer thumb. It starts at the whole range, and has
|
|
71
|
+
* no not-set state: the whole range is what "any" looks like.
|
|
72
|
+
*/
|
|
73
|
+
declare function RangeSlider({ value: controlled, defaultValue, onChange, onCommit, min, max, step, pageStep, snapPoints, label, helperText, errorMessage, disabled, name, formatValue, labels: overrides, className, trackClassName, thumbClassName, chipClassName, labelClassName, messageClassName, "aria-invalid": ariaInvalid, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...props }: RangeSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
export { RangeSlider };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as B, jsx as i, Fragment as ue } from "react/jsx-runtime";
|
|
3
|
+
import { useId as fe, useState as ge, useReducer as ve, useRef as g } from "react";
|
|
4
|
+
import { cn as q } from "../../../lib/utils.js";
|
|
5
|
+
import { withLabels as pe } from "../../../lib/labels.js";
|
|
6
|
+
import { isFieldInvalid as he, withoutInvalidProps as me } from "../../../internal/field-invalid.js";
|
|
7
|
+
import { useScale as we, useCommitted as ye, useFormReset as be, useTrackPress as Se, inRange as Re, along as $e, thumbClasses as ke, nearestPoint as Ie, trackClasses as xe, keyTarget as Be } from "../Slider/track.js";
|
|
8
|
+
import { SliderHeader as je, Rail as Ce, Fill as Fe, Marks as Me, SnapChips as Ne, Message as Te } from "../Slider/track-parts.js";
|
|
9
|
+
const Le = {
|
|
10
|
+
low: "Minimum",
|
|
11
|
+
high: "Maximum",
|
|
12
|
+
valueText: (n, o) => o ? `${n}, ${o}` : n,
|
|
13
|
+
range: (n, o) => `${n} – ${o}`
|
|
14
|
+
}, Oe = ([n, o]) => n <= o ? [n, o] : [o, n];
|
|
15
|
+
function qe({
|
|
16
|
+
value: n,
|
|
17
|
+
defaultValue: o,
|
|
18
|
+
onChange: G,
|
|
19
|
+
onCommit: j,
|
|
20
|
+
min: u = 0,
|
|
21
|
+
max: f = 100,
|
|
22
|
+
step: C = 1,
|
|
23
|
+
pageStep: J,
|
|
24
|
+
snapPoints: Q = [],
|
|
25
|
+
label: F,
|
|
26
|
+
helperText: M,
|
|
27
|
+
errorMessage: w,
|
|
28
|
+
disabled: s = !1,
|
|
29
|
+
name: v,
|
|
30
|
+
formatValue: y = String,
|
|
31
|
+
labels: U,
|
|
32
|
+
className: W,
|
|
33
|
+
trackClassName: X,
|
|
34
|
+
thumbClassName: Y,
|
|
35
|
+
chipClassName: Z,
|
|
36
|
+
labelClassName: _,
|
|
37
|
+
messageClassName: V,
|
|
38
|
+
"aria-invalid": ee,
|
|
39
|
+
"aria-labelledby": re,
|
|
40
|
+
"aria-describedby": te,
|
|
41
|
+
...N
|
|
42
|
+
}) {
|
|
43
|
+
const p = pe(Le, U), h = fe(), T = `${h}-label`, L = `${h}-message`, b = [`${h}-low`, `${h}-high`], S = re ?? (F ? T : void 0), l = we(u, f, C, J), R = n !== void 0, [O, P] = ge(o ?? [u, f]), D = R ? n : O, t = Oe([l.clamp(D[0]), l.clamp(D[1])]), ne = he(!!w, { ...N, "aria-invalid": ee }), K = me(N), d = ye(t), [, ie] = ve((e) => e + 1, 0), $ = (e, r, a) => {
|
|
44
|
+
const c = d.current, x = e === 0 ? Math.min(r, c[1]) : Math.max(r, c[0]);
|
|
45
|
+
if (x === c[e]) return;
|
|
46
|
+
const m = e === 0 ? [x, c[1]] : [c[0], x];
|
|
47
|
+
d.current = m, R ? ie() : P(m), G?.(m), a && j?.(m);
|
|
48
|
+
}, z = g(null), A = g(O);
|
|
49
|
+
be(
|
|
50
|
+
z,
|
|
51
|
+
R,
|
|
52
|
+
() => {
|
|
53
|
+
d.current = A.current, P(A.current);
|
|
54
|
+
},
|
|
55
|
+
v
|
|
56
|
+
);
|
|
57
|
+
const E = g(null), H = [g(null), g(null)], { dragging: k, rtl: oe, handlers: se } = Se({
|
|
58
|
+
trackRef: E,
|
|
59
|
+
disabled: s,
|
|
60
|
+
scale: l,
|
|
61
|
+
min: u,
|
|
62
|
+
max: f,
|
|
63
|
+
values: () => d.current,
|
|
64
|
+
set: $,
|
|
65
|
+
focus: (e) => H[e].current?.focus({ preventScroll: !0 }),
|
|
66
|
+
commit: () => j?.(d.current),
|
|
67
|
+
own: { down: void 0, move: void 0, up: void 0, cancel: void 0, lost: void 0 }
|
|
68
|
+
}), ae = (e) => (r) => {
|
|
69
|
+
if (s) return;
|
|
70
|
+
const a = d.current, c = Be(r, a[e], {
|
|
71
|
+
scale: l,
|
|
72
|
+
step: C,
|
|
73
|
+
start: a[e],
|
|
74
|
+
floor: e === 0 ? u : a[0],
|
|
75
|
+
ceiling: e === 0 ? a[1] : f,
|
|
76
|
+
rtl: oe()
|
|
77
|
+
});
|
|
78
|
+
c !== void 0 && (r.preventDefault(), $(e, c, !0));
|
|
79
|
+
}, le = (e) => {
|
|
80
|
+
const [r, a] = d.current;
|
|
81
|
+
$(e <= r ? 0 : e >= a ? 1 : e - r <= a - e ? 0 : 1, e, !0);
|
|
82
|
+
}, I = Re(Q, u, f), ce = [M || w ? L : void 0, te].filter(Boolean).join(" ") || void 0, de = "rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background";
|
|
83
|
+
return /* @__PURE__ */ B(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
...K,
|
|
87
|
+
role: "group",
|
|
88
|
+
"aria-labelledby": S,
|
|
89
|
+
className: q("rst:font-ui rst:flex rst:min-w-0 rst:flex-col rst:gap-1.5", W),
|
|
90
|
+
"data-range-slider": "",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ i(
|
|
93
|
+
je,
|
|
94
|
+
{
|
|
95
|
+
labelId: T,
|
|
96
|
+
label: F,
|
|
97
|
+
readout: p.range(y(t[0]), y(t[1])),
|
|
98
|
+
empty: !1,
|
|
99
|
+
disabled: s,
|
|
100
|
+
labelClassName: _
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ i("span", { id: b[0], hidden: !0, children: p.low }),
|
|
104
|
+
/* @__PURE__ */ i("span", { id: b[1], hidden: !0, children: p.high }),
|
|
105
|
+
/* @__PURE__ */ B(
|
|
106
|
+
"div",
|
|
107
|
+
{
|
|
108
|
+
...se,
|
|
109
|
+
ref: E,
|
|
110
|
+
"data-dragging": k ? "" : void 0,
|
|
111
|
+
className: q(xe(s), X),
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ i(Ce, {}),
|
|
114
|
+
/* @__PURE__ */ i(Fe, { from: l.at(t[0]), to: l.at(t[1]), dragging: k }),
|
|
115
|
+
/* @__PURE__ */ i(Me, { points: I, at: l.at, filled: (e) => e >= t[0] && e <= t[1] }),
|
|
116
|
+
t.map((e, r) => /* @__PURE__ */ i(
|
|
117
|
+
"span",
|
|
118
|
+
{
|
|
119
|
+
ref: H[r],
|
|
120
|
+
role: "slider",
|
|
121
|
+
tabIndex: s ? void 0 : 0,
|
|
122
|
+
"aria-labelledby": [S, b[r]].filter(Boolean).join(" "),
|
|
123
|
+
"aria-describedby": ce,
|
|
124
|
+
"aria-valuemin": r === 0 ? u : t[0],
|
|
125
|
+
"aria-valuemax": r === 0 ? t[1] : f,
|
|
126
|
+
"aria-valuenow": e,
|
|
127
|
+
"aria-valuetext": p.valueText(y(e), Ie(I, e)?.label),
|
|
128
|
+
"aria-orientation": "horizontal",
|
|
129
|
+
"aria-disabled": s || void 0,
|
|
130
|
+
"aria-invalid": ne || void 0,
|
|
131
|
+
"data-slider-thumb": r === 0 ? "low" : "high",
|
|
132
|
+
onKeyDown: ae(r),
|
|
133
|
+
className: ke(k, de, Y),
|
|
134
|
+
style: { insetInlineStart: $e(l.at(e)) }
|
|
135
|
+
},
|
|
136
|
+
r
|
|
137
|
+
))
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ i(
|
|
142
|
+
Ne,
|
|
143
|
+
{
|
|
144
|
+
points: I,
|
|
145
|
+
labelledBy: S,
|
|
146
|
+
label: K["aria-label"],
|
|
147
|
+
pressed: (e) => e === t[0] || e === t[1],
|
|
148
|
+
pick: le,
|
|
149
|
+
disabled: s,
|
|
150
|
+
chipClassName: Z
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ i(Te, { id: L, helperText: M, errorMessage: w, disabled: s, className: V }),
|
|
154
|
+
v && /* @__PURE__ */ B(ue, { children: [
|
|
155
|
+
/* @__PURE__ */ i("input", { ref: z, type: "hidden", name: v, value: String(t[0]), disabled: s, readOnly: !0 }),
|
|
156
|
+
/* @__PURE__ */ i("input", { type: "hidden", name: v, value: String(t[1]), disabled: s, readOnly: !0 })
|
|
157
|
+
] })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
export {
|
|
163
|
+
qe as RangeSlider
|
|
164
|
+
};
|
|
@@ -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"),c=require("../../../lib/utils.cjs"),j=require("../../atoms/Card/Card.cjs"),S=require("../../atoms/Eyebrow/Eyebrow.cjs"),d=require("../../atoms/Stat/stat-variants.cjs"),u=require("../../organisms/Table/Table.cjs"),s=require("../../atoms/Skeleton/Skeleton.cjs");function k({media:a,lines:n=3,variant:r,padding:t,animation:i,className:l}){return e.jsxs(j.Card,{variant:r,padding:t,className:l,"aria-hidden":"true","data-skeleton":"card",children:[a!==void 0&&e.jsx(s.Skeleton,{shape:"block",height:a,animation:i,className:"rst:mb-4"}),e.jsx(s.Skeleton,{size:"lg",width:"45%",animation:i}),n>0&&e.jsx(s.Skeleton,{size:"md",lines:n,animation:i,className:"rst:mt-2"})]})}function m({columns:a,animation:n,className:r}){const t=["70%","50%","60%","40%"];return e.jsx(u.TableRow,{"aria-hidden":"true",className:r,"data-skeleton":"table-row",children:Array.from({length:Math.max(1,a)},(i,l)=>e.jsx(u.TableCell,{children:e.jsx(s.Skeleton,{size:"inherit",width:t[l%t.length],animation:n})},l))})}function w({size:a="md",withName:n=!1,animation:r,className:t}){return n?e.jsxs("span",{"aria-hidden":"true",className:c.cn("rst:flex rst:items-center rst:gap-3",t),"data-skeleton":"avatar",children:[e.jsx(s.Skeleton,{shape:"circle",size:a,animation:r}),e.jsx(s.Skeleton,{size:"md",width:"8rem",animation:r})]}):e.jsx(s.Skeleton,{shape:"circle",size:a,animation:r,className:t})}function p({size:a="md",semantics:n="definition",source:r=!1,animation:t,className:i}){const l=d.statValueVariants({size:a,colorScheme:"neutral"}),o=e.jsx(s.Skeleton,{size:"inherit",width:"2.5em",animation:t}),h=e.jsx(S.Eyebrow,{size:"xs",children:e.jsx(s.Skeleton,{size:"inherit",width:"9em",animation:t})}),x=e.jsx("span",{className:d.statSourceClass,children:e.jsx(s.Skeleton,{size:"inherit",width:"12em",animation:t})});return n==="standalone"?e.jsxs("span",{"aria-hidden":"true",className:c.cn("rst:flex rst:flex-col rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("span",{className:l,children:o}),h,r&&x]}):e.jsxs("div",{"aria-hidden":"true",className:c.cn("rst:grid rst:content-start rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("dt",{className:"rst:relative rst:col-start-1 rst:row-start-2 rst:flex",children:h}),r?e.jsxs("dd",{className:c.cn("rst:m-0",l,"rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"),children:[e.jsx("span",{className:"rst:row-start-1",children:o}),e.jsx("span",{className:c.cn(d.statSourceClass,"rst:row-start-3"),children:e.jsx(s.Skeleton,{size:"inherit",width:"12em",animation:t})})]}):e.jsx("dd",{className:c.cn("rst:m-0 rst:col-start-1 rst:row-start-1",l),children:o})]})}exports.SkeletonAvatar=w;exports.SkeletonCard=k;exports.SkeletonStat=p;exports.SkeletonTableRow=m;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { CardProps } from '../../atoms/Card/Card';
|
|
3
|
+
import { SkeletonAnimation } from '../../atoms/Skeleton/Skeleton';
|
|
3
4
|
export interface SkeletonCardProps extends Pick<CardProps, "variant" | "padding"> {
|
|
4
5
|
/** A media block above the text, at this height (an image, a chart). */
|
|
5
6
|
media?: CSSProperties["height"];
|
|
6
7
|
/** Body lines under the title. */
|
|
7
8
|
lines?: number;
|
|
9
|
+
/** How its skeletons move: see `Skeleton`. Inside a `SkeletonRegion`, the region's. */
|
|
10
|
+
animation?: SkeletonAnimation;
|
|
8
11
|
className?: string;
|
|
9
12
|
}
|
|
10
13
|
/**
|
|
11
14
|
* A Card loading. Stands in for a Card holding an optional media block (with
|
|
12
15
|
* 16px below it), a `text-base` title, and `text-sm` body lines 8px under it.
|
|
13
16
|
*/
|
|
14
|
-
declare function SkeletonCard({ media, lines, variant, padding, className }: SkeletonCardProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function SkeletonCard({ media, lines, variant, padding, animation, className }: SkeletonCardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
export interface SkeletonTableRowProps {
|
|
16
19
|
/** How many cells. */
|
|
17
20
|
columns: number;
|
|
21
|
+
/** How its skeletons move: see `Skeleton`. Inside a `SkeletonRegion`, the region's. */
|
|
22
|
+
animation?: SkeletonAnimation;
|
|
18
23
|
className?: string;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
@@ -22,16 +27,18 @@ export interface SkeletonTableRowProps {
|
|
|
22
27
|
* size, each holding one line in the cell's text size. Stands in for a row of
|
|
23
28
|
* one-line cells.
|
|
24
29
|
*/
|
|
25
|
-
declare function SkeletonTableRow({ columns, className }: SkeletonTableRowProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare function SkeletonTableRow({ columns, animation, className }: SkeletonTableRowProps): import("react/jsx-runtime").JSX.Element;
|
|
26
31
|
export interface SkeletonAvatarProps {
|
|
27
32
|
/** Avatar's sizes. */
|
|
28
33
|
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
29
34
|
/** A name line beside it, in `text-sm`. */
|
|
30
35
|
withName?: boolean;
|
|
36
|
+
/** How its skeletons move: see `Skeleton`. Inside a `SkeletonRegion`, the region's. */
|
|
37
|
+
animation?: SkeletonAnimation;
|
|
31
38
|
className?: string;
|
|
32
39
|
}
|
|
33
40
|
/** An Avatar loading, and optionally the name beside it. */
|
|
34
|
-
declare function SkeletonAvatar({ size, withName, className }: SkeletonAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
declare function SkeletonAvatar({ size, withName, animation, className }: SkeletonAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
35
42
|
export interface SkeletonStatProps {
|
|
36
43
|
/** Stat's sizes. */
|
|
37
44
|
size?: "sm" | "md" | "lg";
|
|
@@ -43,6 +50,8 @@ export interface SkeletonStatProps {
|
|
|
43
50
|
semantics?: "definition" | "standalone";
|
|
44
51
|
/** A source line under the figure, as a Stat with `source` has. */
|
|
45
52
|
source?: boolean;
|
|
53
|
+
/** How its skeletons move: see `Skeleton`. Inside a `SkeletonRegion`, the region's. */
|
|
54
|
+
animation?: SkeletonAnimation;
|
|
46
55
|
className?: string;
|
|
47
56
|
}
|
|
48
57
|
/**
|
|
@@ -51,5 +60,5 @@ export interface SkeletonStatProps {
|
|
|
51
60
|
* the label is the real Eyebrow, a flex item where Stat's is, so it makes the
|
|
52
61
|
* same line.
|
|
53
62
|
*/
|
|
54
|
-
declare function SkeletonStat({ size, semantics, source, className }: SkeletonStatProps): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
declare function SkeletonStat({ size, semantics, source, animation, className }: SkeletonStatProps): import("react/jsx-runtime").JSX.Element;
|
|
55
64
|
export { SkeletonCard, SkeletonTableRow, SkeletonAvatar, SkeletonStat };
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Card as
|
|
5
|
-
import { Eyebrow as
|
|
6
|
-
import { statValueVariants as
|
|
7
|
-
import { TableRow as
|
|
8
|
-
import { Skeleton as
|
|
9
|
-
function
|
|
10
|
-
return /* @__PURE__ */ o(
|
|
11
|
-
|
|
12
|
-
/* @__PURE__ */ t(
|
|
13
|
-
|
|
3
|
+
import { cn as d } from "../../../lib/utils.js";
|
|
4
|
+
import { Card as u } from "../../atoms/Card/Card.js";
|
|
5
|
+
import { Eyebrow as f } from "../../atoms/Eyebrow/Eyebrow.js";
|
|
6
|
+
import { statValueVariants as w, statSourceClass as m } from "../../atoms/Stat/stat-variants.js";
|
|
7
|
+
import { TableRow as g, TableCell as k } from "../../organisms/Table/Table.js";
|
|
8
|
+
import { Skeleton as e } from "../../atoms/Skeleton/Skeleton.js";
|
|
9
|
+
function T({ media: a, lines: l = 3, variant: s, padding: r, animation: n, className: i }) {
|
|
10
|
+
return /* @__PURE__ */ o(u, { variant: s, padding: r, className: i, "aria-hidden": "true", "data-skeleton": "card", children: [
|
|
11
|
+
a !== void 0 && /* @__PURE__ */ t(e, { shape: "block", height: a, animation: n, className: "rst:mb-4" }),
|
|
12
|
+
/* @__PURE__ */ t(e, { size: "lg", width: "45%", animation: n }),
|
|
13
|
+
l > 0 && /* @__PURE__ */ t(e, { size: "md", lines: l, animation: n, className: "rst:mt-2" })
|
|
14
14
|
] });
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
return /* @__PURE__ */ t(
|
|
16
|
+
function j({ columns: a, animation: l, className: s }) {
|
|
17
|
+
const r = ["70%", "50%", "60%", "40%"];
|
|
18
|
+
return /* @__PURE__ */ t(g, { "aria-hidden": "true", className: s, "data-skeleton": "table-row", children: Array.from({ length: Math.max(1, a) }, (n, i) => /* @__PURE__ */ t(k, { children: /* @__PURE__ */ t(e, { size: "inherit", width: r[i % r.length], animation: l }) }, i)) });
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
22
|
-
/* @__PURE__ */ t(
|
|
23
|
-
/* @__PURE__ */ t(
|
|
24
|
-
] }) : /* @__PURE__ */ t(
|
|
20
|
+
function y({ size: a = "md", withName: l = !1, animation: s, className: r }) {
|
|
21
|
+
return l ? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: d("rst:flex rst:items-center rst:gap-3", r), "data-skeleton": "avatar", children: [
|
|
22
|
+
/* @__PURE__ */ t(e, { shape: "circle", size: a, animation: s }),
|
|
23
|
+
/* @__PURE__ */ t(e, { size: "md", width: "8rem", animation: s })
|
|
24
|
+
] }) : /* @__PURE__ */ t(e, { shape: "circle", size: a, animation: s, className: r });
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const i =
|
|
28
|
-
return
|
|
29
|
-
/* @__PURE__ */ t("span", { className: i, children:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
] }) : /* @__PURE__ */ o("div", { "aria-hidden": "true", className:
|
|
33
|
-
/* @__PURE__ */ t("dt", { className: "rst:relative rst:col-start-1 rst:row-start-2 rst:flex", children:
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */ t("span", { className: "rst:row-start-1", children:
|
|
36
|
-
/* @__PURE__ */ t("span", { className:
|
|
37
|
-
] }) : /* @__PURE__ */ t("dd", { className:
|
|
26
|
+
function A({ size: a = "md", semantics: l = "definition", source: s = !1, animation: r, className: n }) {
|
|
27
|
+
const i = w({ size: a, colorScheme: "neutral" }), c = /* @__PURE__ */ t(e, { size: "inherit", width: "2.5em", animation: r }), h = /* @__PURE__ */ t(f, { size: "xs", children: /* @__PURE__ */ t(e, { size: "inherit", width: "9em", animation: r }) }), p = /* @__PURE__ */ t("span", { className: m, children: /* @__PURE__ */ t(e, { size: "inherit", width: "12em", animation: r }) });
|
|
28
|
+
return l === "standalone" ? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: d("rst:flex rst:flex-col rst:gap-[3px]", n), "data-skeleton": "stat", children: [
|
|
29
|
+
/* @__PURE__ */ t("span", { className: i, children: c }),
|
|
30
|
+
h,
|
|
31
|
+
s && p
|
|
32
|
+
] }) : /* @__PURE__ */ o("div", { "aria-hidden": "true", className: d("rst:grid rst:content-start rst:gap-[3px]", n), "data-skeleton": "stat", children: [
|
|
33
|
+
/* @__PURE__ */ t("dt", { className: "rst:relative rst:col-start-1 rst:row-start-2 rst:flex", children: h }),
|
|
34
|
+
s ? /* @__PURE__ */ o("dd", { className: d("rst:m-0", i, "rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"), children: [
|
|
35
|
+
/* @__PURE__ */ t("span", { className: "rst:row-start-1", children: c }),
|
|
36
|
+
/* @__PURE__ */ t("span", { className: d(m, "rst:row-start-3"), children: /* @__PURE__ */ t(e, { size: "inherit", width: "12em", animation: r }) })
|
|
37
|
+
] }) : /* @__PURE__ */ t("dd", { className: d("rst:m-0 rst:col-start-1 rst:row-start-1", i), children: c })
|
|
38
38
|
] });
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
y as SkeletonAvatar,
|
|
42
|
+
T as SkeletonCard,
|
|
43
|
+
A as SkeletonStat,
|
|
44
|
+
j as SkeletonTableRow
|
|
45
45
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react"),z=require("../../../lib/utils.cjs"),be=require("../../../lib/labels.cjs"),A=require("../../../internal/field-invalid.cjs"),s=require("./track.cjs"),d=require("./track-parts.cjs"),pe={notSet:"Not set",valueText:(v,f)=>f?`${v}, ${f}`:v};function ye({value:v,defaultValue:f,onChange:E,onCommit:m,min:i=0,max:o=100,step:x=1,pageStep:H,startValue:M,snapPoints:_=[],label:I,helperText:q,errorMessage:g,disabled:n=!1,name:b,formatValue:G=String,labels:J,className:Q,trackClassName:U,thumbClassName:W,chipClassName:X,labelClassName:Y,messageClassName:Z,"aria-invalid":V,"aria-labelledby":ee,onKeyDown:te,onPointerDown:re,onPointerMove:se,onPointerUp:ne,onPointerCancel:ie,onLostPointerCapture:le,...p}){const y=be.withLabels(pe,J),N=c.useId(),P=`${N}-label`,B=`${N}-message`,C=ee??(I?P:void 0),l=s.useScale(i,o,x,H),T=l.snap(M??i+(o-i)/2),S=v!==void 0,[$,D]=c.useState(f===void 0?T:f),F=S?v:$,t=F===null?null:l.clamp(F),ae=A.isFieldInvalid(!!g,{...p,"aria-invalid":V}),L=A.withoutInvalidProps(p),a=s.useCommitted(t),[,oe]=c.useReducer(e=>e+1,0),j=(e,u)=>{e!==a.current&&(a.current=e,S?oe():D(e),E?.(e),u&&e!==null&&m?.(e))},O=c.useRef(null),K=c.useRef($);s.useFormReset(O,S,()=>{a.current=K.current,D(K.current)},b);const h=c.useRef(null),{dragging:R,rtl:ue,handlers:ce}=s.useTrackPress({trackRef:h,disabled:n,scale:l,min:i,max:o,values:()=>[a.current],set:(e,u,ge)=>j(u,ge),focus:()=>h.current?.focus({preventScroll:!0}),commit:()=>a.current!==null&&m?.(a.current),own:{down:re,move:se,up:ne,cancel:ie,lost:le}}),de=e=>{if(te?.(e),n)return;const u=s.keyTarget(e,a.current,{scale:l,step:x,start:T,floor:i,ceiling:o,rtl:ue()});u!==void 0&&(e.preventDefault(),j(u,!0))},w=s.inRange(_,i,o),k=t===null?null:G(t),ve=k===null?y.notSet:y.valueText(k,s.nearestPoint(w,t)?.label),fe=[q||g?B:void 0,p["aria-describedby"]].filter(Boolean).join(" ")||void 0;return r.jsxs("div",{className:z.cn("rst:font-ui rst:flex rst:min-w-0 rst:flex-col rst:gap-1.5",Q),"data-slider":"",children:[r.jsx(d.SliderHeader,{labelId:P,label:I,readout:k??y.notSet,empty:t===null,disabled:n,labelClassName:Y}),r.jsxs("div",{...L,...ce,ref:h,role:"slider",tabIndex:n?void 0:0,"aria-labelledby":C,"aria-describedby":fe,"aria-valuemin":i,"aria-valuemax":o,"aria-valuenow":t??void 0,"aria-valuetext":ve,"aria-orientation":"horizontal","aria-disabled":n||void 0,"aria-invalid":ae||void 0,"data-dragging":R?"":void 0,"data-empty":t===null?"":void 0,onKeyDown:de,className:z.cn(s.trackClasses(n),"rst:group/slider rst:focus-visible:outline-hidden",t===null&&"rst:focus-visible:ring-2 rst:focus-visible:ring-ring",U),children:[r.jsx(d.Rail,{}),t!==null&&r.jsx(d.Fill,{from:0,to:l.at(t),dragging:R}),r.jsx(d.Marks,{points:w,at:l.at,filled:e=>t!==null&&t>=e}),t!==null&&r.jsx("span",{"aria-hidden":"true","data-slider-thumb":"",className:s.thumbClasses(R,"rst:group-focus-visible/slider:ring-2 rst:group-focus-visible/slider:ring-ring rst:group-focus-visible/slider:ring-offset-2 rst:ring-offset-background",W),style:{insetInlineStart:s.along(l.at(t))}})]}),r.jsx(d.SnapChips,{points:w,labelledBy:C,label:L["aria-label"],pressed:e=>t===e,pick:e=>j(e,!0),disabled:n,chipClassName:X}),r.jsx(d.Message,{id:B,helperText:q,errorMessage:g,disabled:n,className:Z}),b&&r.jsx("input",{ref:O,type:"hidden",name:b,value:t===null?"":String(t),disabled:n,readOnly:!0})]})}exports.Slider=ye;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SliderSnapPoint } from './track';
|
|
3
|
+
export type { SliderSnapPoint };
|
|
4
|
+
/** Every word Slider says. Pass any of them in `labels` to replace it. */
|
|
5
|
+
export interface SliderLabels {
|
|
6
|
+
/** Shown, and said, while there's no value. */
|
|
7
|
+
notSet: string;
|
|
8
|
+
/** What a screen reader hears for a value, with the nearest snap point's label when there is one: "72, Likely". */
|
|
9
|
+
valueText: (value: string, nearest: string | undefined) => string;
|
|
10
|
+
}
|
|
11
|
+
export interface SliderProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
|
|
12
|
+
/**
|
|
13
|
+
* The value, or `null` for not set: no thumb and an empty track. Pass it to
|
|
14
|
+
* control the slider, `null` included, which is how a consumer offers a
|
|
15
|
+
* clear. Leave it out for an uncontrolled slider that starts from
|
|
16
|
+
* `defaultValue`.
|
|
17
|
+
*/
|
|
18
|
+
value?: number | null;
|
|
19
|
+
/**
|
|
20
|
+
* Where an uncontrolled slider starts: `startValue` when left out, the
|
|
21
|
+
* middle unless that's set. `null` starts it not set.
|
|
22
|
+
*/
|
|
23
|
+
defaultValue?: number | null;
|
|
24
|
+
/** Each change: a tap, every step of a drag, a key, a snap point. */
|
|
25
|
+
onChange?: (value: number | null) => void;
|
|
26
|
+
/** Once a change is finished: a tap, the end of a drag, a key, a snap point. */
|
|
27
|
+
onCommit?: (value: number) => void;
|
|
28
|
+
/** The lowest value. */
|
|
29
|
+
min?: number;
|
|
30
|
+
/** The highest value. */
|
|
31
|
+
max?: number;
|
|
32
|
+
/** The smallest move: the arrows step by it, and every value lands on it. */
|
|
33
|
+
step?: number;
|
|
34
|
+
/** PageUp and PageDown's move. A tenth of the range, on a step, by default. */
|
|
35
|
+
pageStep?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Where the thumb first appears: an uncontrolled slider's start when
|
|
38
|
+
* `defaultValue` is left out, and where the first arrow or Page key puts it
|
|
39
|
+
* on an empty slider. The middle of the range by default. Home and End go to
|
|
40
|
+
* `min` and `max`.
|
|
41
|
+
*/
|
|
42
|
+
startValue?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Named stops, any values and labels. Each gets a chip under the track that
|
|
45
|
+
* moves the thumb to it, and a mark on the track. A point outside `min` to
|
|
46
|
+
* `max` is left out, since the track can't show it.
|
|
47
|
+
*/
|
|
48
|
+
snapPoints?: SliderSnapPoint[];
|
|
49
|
+
/** The slider's name, shown above the track. */
|
|
50
|
+
label?: string;
|
|
51
|
+
/** Supporting text under the slider. */
|
|
52
|
+
helperText?: string;
|
|
53
|
+
/** The message for an invalid value. Implies the error state. */
|
|
54
|
+
errorMessage?: string;
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/** A form field name: the value is submitted under it, and an empty string while not set. */
|
|
57
|
+
name?: string;
|
|
58
|
+
/** How the value is written, in the readout and in what's said: `(v) => `${v}%`` for a percentage. */
|
|
59
|
+
formatValue?: (value: number) => string;
|
|
60
|
+
/** Every word the slider says, with English defaults. */
|
|
61
|
+
labels?: Partial<SliderLabels>;
|
|
62
|
+
/** Classes for the track's hit area, the element with the slider role. */
|
|
63
|
+
trackClassName?: string;
|
|
64
|
+
/** Classes for the thumb. */
|
|
65
|
+
thumbClassName?: string;
|
|
66
|
+
/** Classes for each snap chip. */
|
|
67
|
+
chipClassName?: string;
|
|
68
|
+
/** Classes for the label. */
|
|
69
|
+
labelClassName?: string;
|
|
70
|
+
/** Classes for the helper text or error message. */
|
|
71
|
+
messageClassName?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A value picked along a track: tapped, dragged, stepped with the keys, or
|
|
75
|
+
* set from a named snap point.
|
|
76
|
+
*
|
|
77
|
+
* It starts with the thumb at `startValue`, the middle by default. Not set is
|
|
78
|
+
* there when it's asked for: `defaultValue={null}`, or `value={null}` when
|
|
79
|
+
* controlled, gives no thumb and an empty track, and a form takes that as a
|
|
80
|
+
* valid answer (an empty string under `name`). The first tap, drag or key sets
|
|
81
|
+
* it, and a consumer controlling `value` can set it back to `null`.
|
|
82
|
+
*
|
|
83
|
+
* One thumb. Two, for a range, is `RangeSlider`, on the same track, so
|
|
84
|
+
* `value` here stays a number.
|
|
85
|
+
*/
|
|
86
|
+
declare function Slider({ value: controlled, defaultValue, onChange, onCommit, min, max, step, pageStep, startValue, snapPoints, label, helperText, errorMessage, disabled, name, formatValue, labels: overrides, className, trackClassName, thumbClassName, chipClassName, labelClassName, messageClassName, "aria-invalid": ariaInvalid, "aria-labelledby": ariaLabelledBy, onKeyDown: onKeyDownProp, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture, ...props }: SliderProps): import("react/jsx-runtime").JSX.Element;
|
|
87
|
+
export { Slider };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as z, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { useId as ve, useState as ge, useReducer as pe, useRef as w } from "react";
|
|
4
|
+
import { cn as A } from "../../../lib/utils.js";
|
|
5
|
+
import { withLabels as me } from "../../../lib/labels.js";
|
|
6
|
+
import { isFieldInvalid as be, withoutInvalidProps as ye } from "../../../internal/field-invalid.js";
|
|
7
|
+
import { useScale as Se, useCommitted as he, useFormReset as we, useTrackPress as ke, inRange as Re, nearestPoint as Ie, along as Ne, thumbClasses as Be, trackClasses as Ce, keyTarget as $e } from "./track.js";
|
|
8
|
+
import { SliderHeader as je, Rail as De, Fill as Fe, Marks as Le, SnapChips as Pe, Message as Te } from "./track-parts.js";
|
|
9
|
+
const Ke = {
|
|
10
|
+
notSet: "Not set",
|
|
11
|
+
valueText: (u, c) => c ? `${u}, ${c}` : u
|
|
12
|
+
};
|
|
13
|
+
function Ge({
|
|
14
|
+
value: u,
|
|
15
|
+
defaultValue: c,
|
|
16
|
+
onChange: E,
|
|
17
|
+
onCommit: k,
|
|
18
|
+
min: n = 0,
|
|
19
|
+
max: o = 100,
|
|
20
|
+
step: R = 1,
|
|
21
|
+
pageStep: H,
|
|
22
|
+
startValue: _,
|
|
23
|
+
snapPoints: q = [],
|
|
24
|
+
label: I,
|
|
25
|
+
helperText: N,
|
|
26
|
+
errorMessage: d,
|
|
27
|
+
disabled: t = !1,
|
|
28
|
+
name: f,
|
|
29
|
+
formatValue: x = String,
|
|
30
|
+
labels: G,
|
|
31
|
+
className: J,
|
|
32
|
+
trackClassName: M,
|
|
33
|
+
thumbClassName: Q,
|
|
34
|
+
chipClassName: U,
|
|
35
|
+
labelClassName: W,
|
|
36
|
+
messageClassName: X,
|
|
37
|
+
"aria-invalid": Y,
|
|
38
|
+
"aria-labelledby": Z,
|
|
39
|
+
onKeyDown: V,
|
|
40
|
+
onPointerDown: ee,
|
|
41
|
+
onPointerMove: re,
|
|
42
|
+
onPointerUp: te,
|
|
43
|
+
onPointerCancel: ie,
|
|
44
|
+
onLostPointerCapture: ne,
|
|
45
|
+
...v
|
|
46
|
+
}) {
|
|
47
|
+
const g = me(Ke, G), B = ve(), C = `${B}-label`, $ = `${B}-message`, j = Z ?? (I ? C : void 0), l = Se(n, o, R, H), D = l.snap(_ ?? n + (o - n) / 2), p = u !== void 0, [F, L] = ge(c === void 0 ? D : c), P = p ? u : F, r = P === null ? null : l.clamp(P), le = be(!!d, { ...v, "aria-invalid": Y }), T = ye(v), s = he(r), [, se] = pe((e) => e + 1, 0), m = (e, a) => {
|
|
48
|
+
e !== s.current && (s.current = e, p ? se() : L(e), E?.(e), a && e !== null && k?.(e));
|
|
49
|
+
}, K = w(null), O = w(F);
|
|
50
|
+
we(
|
|
51
|
+
K,
|
|
52
|
+
p,
|
|
53
|
+
() => {
|
|
54
|
+
s.current = O.current, L(O.current);
|
|
55
|
+
},
|
|
56
|
+
f
|
|
57
|
+
);
|
|
58
|
+
const b = w(null), { dragging: y, rtl: oe, handlers: ae } = ke({
|
|
59
|
+
trackRef: b,
|
|
60
|
+
disabled: t,
|
|
61
|
+
scale: l,
|
|
62
|
+
min: n,
|
|
63
|
+
max: o,
|
|
64
|
+
values: () => [s.current],
|
|
65
|
+
set: (e, a, fe) => m(a, fe),
|
|
66
|
+
focus: () => b.current?.focus({ preventScroll: !0 }),
|
|
67
|
+
commit: () => s.current !== null && k?.(s.current),
|
|
68
|
+
own: { down: ee, move: re, up: te, cancel: ie, lost: ne }
|
|
69
|
+
}), ue = (e) => {
|
|
70
|
+
if (V?.(e), t) return;
|
|
71
|
+
const a = $e(e, s.current, { scale: l, step: R, start: D, floor: n, ceiling: o, rtl: oe() });
|
|
72
|
+
a !== void 0 && (e.preventDefault(), m(a, !0));
|
|
73
|
+
}, S = Re(q, n, o), h = r === null ? null : x(r), ce = h === null ? g.notSet : g.valueText(h, Ie(S, r)?.label), de = [N || d ? $ : void 0, v["aria-describedby"]].filter(Boolean).join(" ") || void 0;
|
|
74
|
+
return /* @__PURE__ */ z("div", { className: A("rst:font-ui rst:flex rst:min-w-0 rst:flex-col rst:gap-1.5", J), "data-slider": "", children: [
|
|
75
|
+
/* @__PURE__ */ i(je, { labelId: C, label: I, readout: h ?? g.notSet, empty: r === null, disabled: t, labelClassName: W }),
|
|
76
|
+
/* @__PURE__ */ z(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
...T,
|
|
80
|
+
...ae,
|
|
81
|
+
ref: b,
|
|
82
|
+
role: "slider",
|
|
83
|
+
tabIndex: t ? void 0 : 0,
|
|
84
|
+
"aria-labelledby": j,
|
|
85
|
+
"aria-describedby": de,
|
|
86
|
+
"aria-valuemin": n,
|
|
87
|
+
"aria-valuemax": o,
|
|
88
|
+
"aria-valuenow": r ?? void 0,
|
|
89
|
+
"aria-valuetext": ce,
|
|
90
|
+
"aria-orientation": "horizontal",
|
|
91
|
+
"aria-disabled": t || void 0,
|
|
92
|
+
"aria-invalid": le || void 0,
|
|
93
|
+
"data-dragging": y ? "" : void 0,
|
|
94
|
+
"data-empty": r === null ? "" : void 0,
|
|
95
|
+
onKeyDown: ue,
|
|
96
|
+
className: A(
|
|
97
|
+
Ce(t),
|
|
98
|
+
"rst:group/slider rst:focus-visible:outline-hidden",
|
|
99
|
+
r === null && "rst:focus-visible:ring-2 rst:focus-visible:ring-ring",
|
|
100
|
+
M
|
|
101
|
+
),
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ i(De, {}),
|
|
104
|
+
r !== null && /* @__PURE__ */ i(Fe, { from: 0, to: l.at(r), dragging: y }),
|
|
105
|
+
/* @__PURE__ */ i(Le, { points: S, at: l.at, filled: (e) => r !== null && r >= e }),
|
|
106
|
+
r !== null && /* @__PURE__ */ i("span", { "aria-hidden": "true", "data-slider-thumb": "", className: Be(y, "rst:group-focus-visible/slider:ring-2 rst:group-focus-visible/slider:ring-ring rst:group-focus-visible/slider:ring-offset-2 rst:ring-offset-background", Q), style: { insetInlineStart: Ne(l.at(r)) } })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ i(
|
|
111
|
+
Pe,
|
|
112
|
+
{
|
|
113
|
+
points: S,
|
|
114
|
+
labelledBy: j,
|
|
115
|
+
label: T["aria-label"],
|
|
116
|
+
pressed: (e) => r === e,
|
|
117
|
+
pick: (e) => m(e, !0),
|
|
118
|
+
disabled: t,
|
|
119
|
+
chipClassName: U
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ i(Te, { id: $, helperText: N, errorMessage: d, disabled: t, className: X }),
|
|
123
|
+
f && /* @__PURE__ */ i("input", { ref: K, type: "hidden", name: f, value: r === null ? "" : String(r), disabled: t, readOnly: !0 })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
Ge as Slider
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("../../../lib/utils.cjs"),i=require("../../atoms/Chip/Chip.cjs"),s=require("./track.cjs");function d(t){return r.jsxs("div",{className:"rst:flex rst:items-baseline rst:justify-between rst:gap-3",children:[t.label?r.jsx("span",{id:t.labelId,className:a.cn("rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]",t.disabled&&"rst:opacity-50",t.labelClassName),children:t.label}):r.jsx("span",{}),r.jsx("span",{"aria-hidden":"true","data-slider-readout":"",className:a.cn("rst:text-sm rst:tabular-nums",t.empty?"rst:text-gray-500 rst:dark:text-gray-400":"rst:font-semibold rst:text-[var(--roster-control-text)]",t.disabled&&"rst:opacity-50"),children:t.readout})]})}function o(){return r.jsx("span",{"aria-hidden":"true","data-slider-rail":"",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",style:{insetInline:s.INSET}})}function c({from:t,to:e,dragging:n}){return r.jsx("span",{"aria-hidden":"true","data-slider-fill":"",className:a.cn("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","rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]",!n&&"rst:transition-[inset-inline-start,width] rst:duration-150 rst:ease-out rst:motion-reduce:transition-none"),style:{insetInlineStart:s.along(t),width:`calc((100% - ${2*s.INSET}px) * ${e-t})`}})}function u({points:t,at:e,filled:n}){return t.map(l=>r.jsx("span",{"aria-hidden":"true","data-slider-mark":"","data-filled":n(l.value)?"":void 0,className:a.cn("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","rst:transition-colors rst:duration-150 rst:motion-reduce:transition-none rst:forced-colors:forced-color-adjust-none",n(l.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]"),style:{insetInlineStart:s.along(e(l.value),s.INSET+s.CAP)}},`${l.value}:${l.label}`))}function b(t){return t.points.length===0?null:r.jsx("div",{role:"group","aria-labelledby":t.labelledBy,"aria-label":t.labelledBy?void 0:t.label,className:"rst:mt-0.5 rst:flex rst:flex-wrap rst:gap-x-2 rst:gap-y-4","data-slider-snaps":"",children:t.points.map(e=>r.jsx(i.Chip,{selected:t.pressed(e.value),onSelectedChange:()=>t.pick(e.value),variant:t.pressed(e.value)?"solid":"outline",colorScheme:t.pressed(e.value)?"primary":"neutral",disabled:t.disabled,className:a.cn("rst:min-w-11 rst:shrink-0 rst:justify-center",t.chipClassName),children:e.label},`${e.value}:${e.label}`))})}function x(t){return!t.helperText&&!t.errorMessage?null:r.jsx("p",{id:t.id,className:a.cn("rst:m-0 rst:text-xs rst:text-left",t.errorMessage?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400",t.disabled&&"rst:opacity-50",t.className),children:t.errorMessage||t.helperText})}exports.Fill=c;exports.Marks=u;exports.Message=x;exports.Rail=o;exports.SliderHeader=d;exports.SnapChips=b;
|