@blakesteve/roster 5.1.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -3
- package/dist/components/atoms/Combobox/Combobox.cjs +1 -1
- package/dist/components/atoms/Combobox/Combobox.js +63 -62
- package/dist/components/atoms/Input/Input.cjs +1 -1
- package/dist/components/atoms/Input/Input.js +41 -39
- package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.js +69 -68
- package/dist/components/atoms/Select/Select.cjs +1 -1
- package/dist/components/atoms/Select/Select.js +52 -51
- package/dist/components/atoms/Spinner/Spinner.cjs +1 -1
- package/dist/components/atoms/Spinner/Spinner.d.ts +6 -1
- package/dist/components/atoms/Spinner/Spinner.js +9 -8
- package/dist/components/atoms/Textarea/Textarea.cjs +1 -1
- package/dist/components/atoms/Textarea/Textarea.js +36 -34
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -0
- package/dist/components/molecules/Carousel/Carousel.d.ts +146 -0
- package/dist/components/molecules/Carousel/Carousel.js +363 -0
- package/dist/components/molecules/Carousel/carousel-layout.cjs +1 -0
- package/dist/components/molecules/Carousel/carousel-layout.d.ts +23 -0
- package/dist/components/molecules/Carousel/carousel-layout.js +22 -0
- package/dist/components/molecules/Carousel/carousel-math.cjs +1 -0
- package/dist/components/molecules/Carousel/carousel-math.d.ts +60 -0
- package/dist/components/molecules/Carousel/carousel-math.js +58 -0
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.cjs +1 -1
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +5 -3
- package/dist/components/molecules/CheckboxGroup/CheckboxGroup.js +61 -59
- package/dist/components/molecules/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/molecules/EmptyState/EmptyState.d.ts +7 -1
- package/dist/components/molecules/EmptyState/EmptyState.js +18 -14
- package/dist/components/molecules/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/molecules/RadioGroup/RadioGroup.d.ts +4 -3
- package/dist/components/molecules/RadioGroup/RadioGroup.js +48 -47
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
- package/dist/components/organisms/Sheet/Sheet.d.ts +8 -5
- package/dist/components/organisms/Sheet/Sheet.js +122 -121
- package/dist/components/organisms/Sheet/sheet-title.cjs +1 -0
- package/dist/components/organisms/Sheet/sheet-title.d.ts +10 -0
- package/dist/components/organisms/Sheet/sheet-title.js +17 -0
- package/dist/index.d.ts +1 -0
- package/dist/internal/field-invalid.cjs +1 -0
- package/dist/internal/field-invalid.d.ts +37 -0
- package/dist/internal/field-invalid.js +13 -0
- package/dist/meta.json +3 -3
- package/dist/roster.cjs +1 -1
- package/dist/roster.css +1 -1
- package/dist/roster.js +55 -53
- package/package.json +1 -1
|
@@ -1,55 +1,56 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
|
-
import { Description as
|
|
5
|
-
import { Field as
|
|
6
|
-
import { Label as
|
|
7
|
-
import { RadioGroup as
|
|
4
|
+
import { Description as p } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
|
|
5
|
+
import { Field as S } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
|
|
6
|
+
import { Label as f } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
|
|
7
|
+
import { RadioGroup as j, Radio as D } from "../../../node_modules/@headlessui/react/dist/components/radio-group/radio-group.js";
|
|
8
8
|
import { cn as t } from "../../../lib/utils.js";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import { isFieldInvalid as F, withoutInvalidProps as O } from "../../../internal/field-invalid.js";
|
|
10
|
+
import { radioDotVariants as P, radioVariants as Z, radioOptionVariants as A, radioGroupOptionsVariants as B } from "./radio-group-variants.js";
|
|
11
|
+
const K = {
|
|
11
12
|
sm: "rst:text-xs",
|
|
12
13
|
md: "rst:text-sm",
|
|
13
14
|
lg: "rst:text-base"
|
|
14
|
-
},
|
|
15
|
-
options:
|
|
16
|
-
value:
|
|
17
|
-
onChange:
|
|
15
|
+
}, Y = ({
|
|
16
|
+
options: u,
|
|
17
|
+
value: v,
|
|
18
|
+
onChange: y,
|
|
18
19
|
label: d,
|
|
19
20
|
helperText: m,
|
|
20
21
|
errorMessage: o,
|
|
21
22
|
disabled: a = !1,
|
|
22
|
-
size:
|
|
23
|
+
size: h = "md",
|
|
23
24
|
orientation: i = "vertical",
|
|
24
25
|
colorScheme: N,
|
|
25
|
-
className:
|
|
26
|
-
optionsClassName:
|
|
27
|
-
optionClassName:
|
|
28
|
-
radioClassName:
|
|
26
|
+
className: b,
|
|
27
|
+
optionsClassName: g,
|
|
28
|
+
optionClassName: w,
|
|
29
|
+
radioClassName: z,
|
|
29
30
|
labelClassName: k,
|
|
30
|
-
optionLabelClassName:
|
|
31
|
-
descriptionClassName:
|
|
32
|
-
messageClassName:
|
|
33
|
-
"aria-invalid":
|
|
34
|
-
...
|
|
31
|
+
optionLabelClassName: V,
|
|
32
|
+
descriptionClassName: E,
|
|
33
|
+
messageClassName: G,
|
|
34
|
+
"aria-invalid": I,
|
|
35
|
+
...n
|
|
35
36
|
}) => {
|
|
36
|
-
const
|
|
37
|
+
const x = !!o, L = F(x, { ...n, "aria-invalid": I }), R = O(n), e = h ?? "md";
|
|
37
38
|
return /* @__PURE__ */ c(
|
|
38
|
-
|
|
39
|
+
j,
|
|
39
40
|
{
|
|
40
|
-
value:
|
|
41
|
-
onChange:
|
|
41
|
+
value: v,
|
|
42
|
+
onChange: y,
|
|
42
43
|
disabled: a,
|
|
43
44
|
className: t(
|
|
44
45
|
"rst:font-ui rst:flex rst:flex-col rst:gap-1.5 rst:min-w-0",
|
|
45
|
-
|
|
46
|
+
b
|
|
46
47
|
),
|
|
47
|
-
...
|
|
48
|
-
"aria-invalid":
|
|
48
|
+
...R,
|
|
49
|
+
"aria-invalid": L || void 0,
|
|
49
50
|
"aria-orientation": i,
|
|
50
51
|
children: [
|
|
51
52
|
d && /* @__PURE__ */ s(
|
|
52
|
-
|
|
53
|
+
f,
|
|
53
54
|
{
|
|
54
55
|
className: t(
|
|
55
56
|
"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",
|
|
@@ -63,37 +64,37 @@ const B = {
|
|
|
63
64
|
"div",
|
|
64
65
|
{
|
|
65
66
|
className: t(
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
B({ size: e, orientation: i }),
|
|
68
|
+
g
|
|
68
69
|
),
|
|
69
|
-
children:
|
|
70
|
-
|
|
70
|
+
children: u.map((r) => /* @__PURE__ */ c(
|
|
71
|
+
S,
|
|
71
72
|
{
|
|
72
73
|
disabled: a || r.disabled,
|
|
73
74
|
className: t(
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
A({ orientation: i, size: e }),
|
|
76
|
+
w
|
|
76
77
|
),
|
|
77
78
|
children: [
|
|
78
79
|
/* @__PURE__ */ s(
|
|
79
|
-
|
|
80
|
+
D,
|
|
80
81
|
{
|
|
81
82
|
value: r.value,
|
|
82
83
|
className: ({ checked: l }) => t(
|
|
83
|
-
|
|
84
|
+
Z({ colorScheme: N, size: e, checked: l }),
|
|
84
85
|
/* `self-start`, and no nudge. The circle's height equals the
|
|
85
86
|
label's line-height at every size, so aligning their top
|
|
86
87
|
edges puts the radio on the first line whether the label
|
|
87
88
|
is one line or four. */
|
|
88
89
|
"rst:self-start",
|
|
89
90
|
a || r.disabled ? "rst:opacity-50 rst:cursor-not-allowed" : "rst:cursor-pointer",
|
|
90
|
-
|
|
91
|
+
z
|
|
91
92
|
),
|
|
92
93
|
children: ({ checked: l }) => /* @__PURE__ */ s(
|
|
93
94
|
"span",
|
|
94
95
|
{
|
|
95
96
|
className: t(
|
|
96
|
-
|
|
97
|
+
P({ size: e }),
|
|
97
98
|
l ? "rst:opacity-100" : "rst:opacity-0"
|
|
98
99
|
)
|
|
99
100
|
}
|
|
@@ -113,24 +114,24 @@ const B = {
|
|
|
113
114
|
),
|
|
114
115
|
children: [
|
|
115
116
|
/* @__PURE__ */ s(
|
|
116
|
-
|
|
117
|
+
f,
|
|
117
118
|
{
|
|
118
119
|
className: t(
|
|
119
120
|
"rst:cursor-pointer rst:select-none",
|
|
120
121
|
"rst:text-[var(--roster-control-text)]",
|
|
121
122
|
"rst:data-disabled:cursor-not-allowed rst:data-disabled:opacity-50",
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
K[e],
|
|
124
|
+
V
|
|
124
125
|
),
|
|
125
126
|
children: r.label
|
|
126
127
|
}
|
|
127
128
|
),
|
|
128
129
|
r.description && /* @__PURE__ */ s(
|
|
129
|
-
|
|
130
|
+
p,
|
|
130
131
|
{
|
|
131
132
|
className: t(
|
|
132
133
|
"rst:text-xs rst:text-gray-500 rst:dark:text-gray-400 rst:data-disabled:opacity-50",
|
|
133
|
-
|
|
134
|
+
E
|
|
134
135
|
),
|
|
135
136
|
children: r.description
|
|
136
137
|
}
|
|
@@ -145,14 +146,14 @@ const B = {
|
|
|
145
146
|
}
|
|
146
147
|
),
|
|
147
148
|
(m || o) && /* @__PURE__ */ s(
|
|
148
|
-
|
|
149
|
+
p,
|
|
149
150
|
{
|
|
150
151
|
as: "p",
|
|
151
152
|
className: t(
|
|
152
153
|
"rst:text-xs rst:text-left",
|
|
153
|
-
|
|
154
|
+
x ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400",
|
|
154
155
|
a && "rst:opacity-50",
|
|
155
|
-
|
|
156
|
+
G
|
|
156
157
|
),
|
|
157
158
|
children: o || m
|
|
158
159
|
}
|
|
@@ -162,5 +163,5 @@ const B = {
|
|
|
162
163
|
);
|
|
163
164
|
};
|
|
164
165
|
export {
|
|
165
|
-
|
|
166
|
+
Y as RadioGroup
|
|
166
167
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),H=require("react"),J=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),y=require("../../../node_modules/@headlessui/react/dist/components/dialog/dialog.cjs"),Q=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),f=require("../../../lib/utils.cjs"),Z=require("../../../internal/popup.cjs"),W=require("../../../internal/motion.cjs"),O=require("../../../internal/page-inert.cjs"),D=require("./sheet-drag.cjs"),tt=require("./sheet-title.cjs");function et(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const c in r)if(c!=="default"){const l=Object.getOwnPropertyDescriptor(r,c);Object.defineProperty(i,c,l.get?l:{enumerable:!0,get:()=>r[c]})}}return i.default=r,Object.freeze(i)}const n=et(H),rt="rst:transition-transform rst:duration-(--roster-sheet-enter-duration) rst:ease-(--roster-sheet-enter-easing) rst:data-leave:duration-(--roster-sheet-leave-duration) rst:data-leave:ease-(--roster-sheet-leave-easing) rst:data-closed:translate-y-full",st="rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0",nt="rst:transition-opacity rst:duration-(--roster-sheet-enter-duration) rst:ease-out rst:data-leave:duration-(--roster-sheet-leave-duration) rst:data-closed:opacity-0",ot="rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0",at=["input:not([type=checkbox]):not([type=radio]):not([type=button]):not([type=submit]):not([type=reset]):not([type=range]):not([type=color]):not([type=file]):not([type=image])","textarea","select","[contenteditable]:not([contenteditable=false])"].join(",");function it(r){return r?"current"in r?r.current:r:null}function ct({target:r}){const i=n.useRef(r),c=n.useRef(!1);return n.useEffect(()=>{i.current=r}),n.useEffect(()=>(c.current=!1,()=>{c.current=!0,queueMicrotask(()=>{if(!c.current)return;const l=it(i.current);l?.isConnected&&l.focus()})}),[]),null}function ut(){return s.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",children:s.jsx("path",{d:"M5 5l10 10M15 5L5 15"})})}const lt=({isOpen:r,onClose:i,onAfterClose:c,title:l,hideTitle:T=!1,description:S,actions:N,maxWidth:b=560,initialFocus:v,returnFocus:_,busy:p=!1,dragToDismiss:j=!0,contentKey:h,className:z,children:Y})=>{const{ref:R,inDarkScope:B}=Z.useDarkScope(),C=W.useReducedMotion();n.useLayoutEffect(()=>{if(r)return O.lockPage(R.current)},[r,R]);const u=n.useRef(null),I=n.useRef(null),L=n.useRef(null),E=n.useRef(null),k=n.useRef(null),P=n.useId(),g=tt.titleSignature(l),w=n.useRef({signature:g,contentKey:h,open:r,busy:p});n.useEffect(()=>{const t=w.current;if(w.current={signature:g,contentKey:h,open:r,busy:p},!t.open||!r)return;const e=t.contentKey!==h,o=t.signature!==g&&!t.busy;!e&&!o||(L.current?.focus(),k.current&&(k.current.scrollTop=0))},[g,h,r,p]),n.useEffect(()=>{if(!r)return;const t=requestAnimationFrame(()=>{const e=u.current,o=document.activeElement;!e||o&&e.contains(o)||(v?.current??E.current)?.focus()});return()=>cancelAnimationFrame(t)},[r,v]);const[q,M]=n.useState(null);n.useEffect(()=>{if(!r)return;const t=window.visualViewport;if(!t)return;const e=()=>{const o=document.activeElement,d=!!o&&!!u.current?.contains(o)&&o.matches(at);M(d?Math.round(t.height):null)};return t.addEventListener("resize",e),document.addEventListener("focusin",e),document.addEventListener("focusout",e),()=>{t.removeEventListener("resize",e),document.removeEventListener("focusin",e),document.removeEventListener("focusout",e),M(null)}},[r]);const a=n.useRef(null),m=n.useRef(!1),A=n.useRef(r);n.useEffect(()=>{A.current=r},[r]);const x=t=>{u.current?.style.setProperty("--rst-sheet-drag",`${t}px`)},F=t=>{const e=u.current;a.current=null,e&&(delete e.dataset.dragging,t==="close"?(i(),requestAnimationFrame(()=>{A.current&&!a.current&&x(0)})):x(0))};n.useEffect(()=>{!r&&a.current&&(a.current=null,u.current&&delete u.current.dataset.dragging),r&&!a.current&&x(0)},[r]);const U=t=>{a.current||(m.current=!1,!(!j||!r)&&(t.pointerType==="mouse"&&(t.button!==0||!I.current?.contains(t.target))||(a.current={pointerId:t.pointerId,x0:t.clientX,y0:t.clientY,dy:0,phase:"pending",samples:[{t:t.timeStamp,y:t.clientY}]})))},V=t=>{const e=a.current;if(!e||t.pointerId!==e.pointerId)return;const o=t.clientX-e.x0,d=t.clientY-e.y0;if(e.phase==="pending"){if(!D.exceedsSheetTapSlop(o,d))return;if(Math.abs(o)>Math.abs(d)){e.phase="ignored";return}e.phase="dragging",m.current=!0;try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}u.current&&(u.current.dataset.dragging="")}e.phase==="dragging"&&(e.dy=d,e.samples.push({t:t.timeStamp,y:t.clientY}),e.samples.length>32&&e.samples.shift(),x(Math.max(0,d)))},X=t=>{const e=a.current;if(!e||t.pointerId!==e.pointerId)return;if(e.phase!=="dragging"){a.current=null;return}e.samples.push({t:t.timeStamp,y:t.clientY});const o=t.clientY-e.y0,d=u.current?.getBoundingClientRect().height??0;F(D.sheetDragOutcome(o,d,D.sheetReleaseVelocity(e.samples)))},$=t=>{const e=a.current;!e||t.pointerId!==e.pointerId||(e.phase==="dragging"?F("stay"):a.current=null)},G=t=>{!m.current||t.detail===0||(m.current=!1,t.preventDefault(),t.stopPropagation())},K={"--rst-sheet-max-width":typeof b=="number"?`${b}px`:b,...q!==null&&{"--rst-sheet-keyboard-cap":`${q}px`}};return s.jsxs(s.Fragment,{children:[s.jsx("span",{ref:R,hidden:!0}),s.jsxs(y.Dialog,{open:r,as:"div",onClose:i,initialFocus:v??E,className:f.cn("rst:font-ui rst:relative rst:z-50 rst:focus:outline-hidden",B&&"dark"),children:[s.jsx(y.DialogBackdrop,{transition:!0,"data-testid":"sheet-backdrop",className:f.cn("rst:fixed rst:inset-0 rst:bg-(--roster-sheet-backdrop)",C?ot:nt)}),s.jsx("div",{className:"rst:fixed rst:inset-0 rst:flex rst:items-end rst:justify-center",children:s.jsx(Q.TransitionChild,{afterLeave:c,children:s.jsxs(y.DialogPanel,{ref:u,style:K,"data-testid":"sheet-panel",className:f.cn("rst:relative rst:flex rst:max-h-[min(92dvh,var(--rst-sheet-keyboard-cap,92dvh))] rst:w-full rst:flex-col","rst:md:max-w-(--rst-sheet-max-width)","rst:rounded-t-2xl rst:border rst:border-b-0 rst:elevation-overlay","rst:bg-[var(--roster-popover-bg)] rst:border-[var(--roster-popover-border)] rst:text-[var(--roster-popover-text)]","rst:[--roster-ring-offset:var(--roster-popover-bg)]","rst:pb-[env(safe-area-inset-bottom)]","rst:translate-y-[var(--rst-sheet-drag,0px)]",C?st:rt,"rst:data-dragging:transition-none",z),children:[s.jsxs("div",{"data-testid":"sheet-drag-zone",className:f.cn("rst:shrink-0",j&&"rst:touch-none"),onPointerDown:U,onPointerMove:V,onPointerUp:X,onPointerCancel:$,onClickCapture:G,children:[s.jsx("div",{ref:I,"aria-hidden":"true","data-testid":"sheet-handle",className:f.cn("rst:flex rst:h-11 rst:items-start rst:justify-center rst:pt-2",j&&"rst:cursor-grab rst:active:cursor-grabbing"),children:s.jsx("span",{className:"rst:h-1 rst:w-10 rst:rounded-full rst:bg-current rst:opacity-30"})}),s.jsxs("div",{className:"rst:-mt-3 rst:flex rst:items-start rst:gap-2 rst:px-5 rst:pb-4",children:[s.jsxs("div",{className:"rst:min-w-0 rst:flex-1 rst:pt-2",children:[s.jsx(y.DialogTitle,{as:"h2",id:P,ref:L,tabIndex:-1,className:f.cn("rst:text-lg rst:font-semibold rst:text-inherit rst:focus:outline-hidden",T&&"rst:sr-only"),children:l}),S&&s.jsx(J.Description,{as:"p",className:"rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75",children:S})]}),N&&s.jsx("div",{className:"rst:flex rst:h-11 rst:shrink-0 rst:items-center rst:gap-1",children:N}),s.jsx("button",{ref:E,type:"button",onClick:i,"aria-label":"Close",className:"rst:inline-flex rst:size-11 rst:shrink-0 rst:-mr-2 rst:cursor-pointer rst:items-center rst:justify-center rst:rounded-md rst:bg-transparent rst:text-inherit rst:opacity-60 rst:transition-opacity rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:opacity-100 rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",children:s.jsx(ut,{})})]})]}),s.jsx("div",{ref:k,role:"region","aria-labelledby":P,tabIndex:0,"data-testid":"sheet-content","aria-busy":p||void 0,className:"rst:min-h-0 rst:flex-1 rst:overflow-y-auto rst:overscroll-contain rst:px-5 rst:pb-4 rst:focus:outline-hidden rst:ring-inset rst:focus-visible:ring-2 rst:focus-visible:ring-ring",children:Y}),s.jsx(ct,{target:_})]})})})]})]})};exports.Sheet=lt;
|
|
@@ -14,12 +14,15 @@ export interface SheetProps {
|
|
|
14
14
|
* The sheet's accessible name, rendered as an `h2`. Required, because a
|
|
15
15
|
* dialog without a name is announced as "dialog" and nothing else.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* the
|
|
17
|
+
* A node rather than only a string, so a title can carry markup (a date in
|
|
18
|
+
* a `<time>`, a word in another style); the name is its text either way.
|
|
19
|
+
*
|
|
20
|
+
* Changing its text while the sheet is open counts as a content swap: focus
|
|
21
|
+
* moves to the new title so a screen reader announces it. Not while `busy`:
|
|
22
|
+
* a title that changes during loading is a provisional one being refined,
|
|
23
|
+
* and the reader keeps their place.
|
|
21
24
|
*/
|
|
22
|
-
title:
|
|
25
|
+
title: React.ReactNode;
|
|
23
26
|
/** Hides the title visually. It stays the accessible name. */
|
|
24
27
|
hideTitle?: boolean;
|
|
25
28
|
/** Wired to the dialog's `aria-describedby`. */
|