@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.
Files changed (47) hide show
  1. package/README.md +57 -3
  2. package/dist/components/atoms/Combobox/Combobox.cjs +1 -1
  3. package/dist/components/atoms/Combobox/Combobox.js +63 -62
  4. package/dist/components/atoms/Input/Input.cjs +1 -1
  5. package/dist/components/atoms/Input/Input.js +41 -39
  6. package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
  7. package/dist/components/atoms/MultiSelect/MultiSelect.js +69 -68
  8. package/dist/components/atoms/Select/Select.cjs +1 -1
  9. package/dist/components/atoms/Select/Select.js +52 -51
  10. package/dist/components/atoms/Spinner/Spinner.cjs +1 -1
  11. package/dist/components/atoms/Spinner/Spinner.d.ts +6 -1
  12. package/dist/components/atoms/Spinner/Spinner.js +9 -8
  13. package/dist/components/atoms/Textarea/Textarea.cjs +1 -1
  14. package/dist/components/atoms/Textarea/Textarea.js +36 -34
  15. package/dist/components/molecules/Carousel/Carousel.cjs +1 -0
  16. package/dist/components/molecules/Carousel/Carousel.d.ts +146 -0
  17. package/dist/components/molecules/Carousel/Carousel.js +363 -0
  18. package/dist/components/molecules/Carousel/carousel-layout.cjs +1 -0
  19. package/dist/components/molecules/Carousel/carousel-layout.d.ts +23 -0
  20. package/dist/components/molecules/Carousel/carousel-layout.js +22 -0
  21. package/dist/components/molecules/Carousel/carousel-math.cjs +1 -0
  22. package/dist/components/molecules/Carousel/carousel-math.d.ts +60 -0
  23. package/dist/components/molecules/Carousel/carousel-math.js +58 -0
  24. package/dist/components/molecules/CheckboxGroup/CheckboxGroup.cjs +1 -1
  25. package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +5 -3
  26. package/dist/components/molecules/CheckboxGroup/CheckboxGroup.js +61 -59
  27. package/dist/components/molecules/EmptyState/EmptyState.cjs +1 -1
  28. package/dist/components/molecules/EmptyState/EmptyState.d.ts +7 -1
  29. package/dist/components/molecules/EmptyState/EmptyState.js +18 -14
  30. package/dist/components/molecules/RadioGroup/RadioGroup.cjs +1 -1
  31. package/dist/components/molecules/RadioGroup/RadioGroup.d.ts +4 -3
  32. package/dist/components/molecules/RadioGroup/RadioGroup.js +48 -47
  33. package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
  34. package/dist/components/organisms/Sheet/Sheet.d.ts +8 -5
  35. package/dist/components/organisms/Sheet/Sheet.js +122 -121
  36. package/dist/components/organisms/Sheet/sheet-title.cjs +1 -0
  37. package/dist/components/organisms/Sheet/sheet-title.d.ts +10 -0
  38. package/dist/components/organisms/Sheet/sheet-title.js +17 -0
  39. package/dist/index.d.ts +1 -0
  40. package/dist/internal/field-invalid.cjs +1 -0
  41. package/dist/internal/field-invalid.d.ts +37 -0
  42. package/dist/internal/field-invalid.js +13 -0
  43. package/dist/meta.json +3 -3
  44. package/dist/roster.cjs +1 -1
  45. package/dist/roster.css +1 -1
  46. package/dist/roster.js +55 -53
  47. 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 x } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
5
- import { Field as R } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
6
- import { Label as p } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
7
- import { RadioGroup as S, Radio as j } from "../../../node_modules/@headlessui/react/dist/components/radio-group/radio-group.js";
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 { radioDotVariants as D, radioVariants as O, radioOptionVariants as Z, radioGroupOptionsVariants as A } from "./radio-group-variants.js";
10
- const B = {
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
- }, J = ({
15
- options: f,
16
- value: u,
17
- onChange: v,
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: y = "md",
23
+ size: h = "md",
23
24
  orientation: i = "vertical",
24
25
  colorScheme: N,
25
- className: h,
26
- optionsClassName: b,
27
- optionClassName: z,
28
- radioClassName: g,
26
+ className: b,
27
+ optionsClassName: g,
28
+ optionClassName: w,
29
+ radioClassName: z,
29
30
  labelClassName: k,
30
- optionLabelClassName: w,
31
- descriptionClassName: V,
32
- messageClassName: E,
33
- "aria-invalid": G,
34
- ...L
31
+ optionLabelClassName: V,
32
+ descriptionClassName: E,
33
+ messageClassName: G,
34
+ "aria-invalid": I,
35
+ ...n
35
36
  }) => {
36
- const n = !!o, e = y ?? "md";
37
+ const x = !!o, L = F(x, { ...n, "aria-invalid": I }), R = O(n), e = h ?? "md";
37
38
  return /* @__PURE__ */ c(
38
- S,
39
+ j,
39
40
  {
40
- value: u,
41
- onChange: v,
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
- h
46
+ b
46
47
  ),
47
- ...L,
48
- "aria-invalid": n || G || void 0,
48
+ ...R,
49
+ "aria-invalid": L || void 0,
49
50
  "aria-orientation": i,
50
51
  children: [
51
52
  d && /* @__PURE__ */ s(
52
- p,
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
- A({ size: e, orientation: i }),
67
- b
67
+ B({ size: e, orientation: i }),
68
+ g
68
69
  ),
69
- children: f.map((r) => /* @__PURE__ */ c(
70
- R,
70
+ children: u.map((r) => /* @__PURE__ */ c(
71
+ S,
71
72
  {
72
73
  disabled: a || r.disabled,
73
74
  className: t(
74
- Z({ orientation: i, size: e }),
75
- z
75
+ A({ orientation: i, size: e }),
76
+ w
76
77
  ),
77
78
  children: [
78
79
  /* @__PURE__ */ s(
79
- j,
80
+ D,
80
81
  {
81
82
  value: r.value,
82
83
  className: ({ checked: l }) => t(
83
- O({ colorScheme: N, size: e, checked: l }),
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
- g
91
+ z
91
92
  ),
92
93
  children: ({ checked: l }) => /* @__PURE__ */ s(
93
94
  "span",
94
95
  {
95
96
  className: t(
96
- D({ size: e }),
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
- p,
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
- B[e],
123
- w
123
+ K[e],
124
+ V
124
125
  ),
125
126
  children: r.label
126
127
  }
127
128
  ),
128
129
  r.description && /* @__PURE__ */ s(
129
- x,
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
- V
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
- x,
149
+ p,
149
150
  {
150
151
  as: "p",
151
152
  className: t(
152
153
  "rst:text-xs rst:text-left",
153
- n ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400",
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
- E
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
- J as RadioGroup
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"),K=require("react"),H=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),x=require("../../../node_modules/@headlessui/react/dist/components/dialog/dialog.cjs"),J=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),f=require("../../../lib/utils.cjs"),Q=require("../../../internal/popup.cjs"),Z=require("../../../internal/motion.cjs"),W=require("../../../internal/page-inert.cjs"),k=require("./sheet-drag.cjs");function O(r){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const u in r)if(u!=="default"){const i=Object.getOwnPropertyDescriptor(r,u);Object.defineProperty(c,u,i.get?i:{enumerable:!0,get:()=>r[u]})}}return c.default=r,Object.freeze(c)}const n=O(K),tt="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",et="rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0",rt="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",st="rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0",nt=["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 ot(r){return r?"current"in r?r.current:r:null}function at({target:r}){const c=n.useRef(r),u=n.useRef(!1);return n.useEffect(()=>{c.current=r}),n.useEffect(()=>(u.current=!1,()=>{u.current=!0,queueMicrotask(()=>{if(!u.current)return;const i=ot(c.current);i?.isConnected&&i.focus()})}),[]),null}function it(){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 ct=({isOpen:r,onClose:c,onAfterClose:u,title:i,hideTitle:F=!1,description:D,actions:N,maxWidth:y=560,initialFocus:b,returnFocus:_,busy:p=!1,dragToDismiss:v=!0,contentKey:h,className:T,children:z})=>{const{ref:j,inDarkScope:Y}=Q.useDarkScope(),S=Z.useReducedMotion();n.useLayoutEffect(()=>{if(r)return W.lockPage(j.current)},[r,j]);const l=n.useRef(null),C=n.useRef(null),I=n.useRef(null),R=n.useRef(null),E=n.useRef(null),L=n.useId(),P=n.useRef({title:i,contentKey:h,open:r,busy:p});n.useEffect(()=>{const t=P.current;if(P.current={title:i,contentKey:h,open:r,busy:p},!t.open||!r)return;const e=t.contentKey!==h,o=t.title!==i&&!t.busy;!e&&!o||(I.current?.focus(),E.current&&(E.current.scrollTop=0))},[i,h,r,p]),n.useEffect(()=>{if(!r)return;const t=requestAnimationFrame(()=>{const e=l.current,o=document.activeElement;!e||o&&e.contains(o)||(b?.current??R.current)?.focus()});return()=>cancelAnimationFrame(t)},[r,b]);const[w,q]=n.useState(null);n.useEffect(()=>{if(!r)return;const t=window.visualViewport;if(!t)return;const e=()=>{const o=document.activeElement,d=!!o&&!!l.current?.contains(o)&&o.matches(nt);q(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),q(null)}},[r]);const a=n.useRef(null),g=n.useRef(!1),M=n.useRef(r);n.useEffect(()=>{M.current=r},[r]);const m=t=>{l.current?.style.setProperty("--rst-sheet-drag",`${t}px`)},A=t=>{const e=l.current;a.current=null,e&&(delete e.dataset.dragging,t==="close"?(c(),requestAnimationFrame(()=>{M.current&&!a.current&&m(0)})):m(0))};n.useEffect(()=>{!r&&a.current&&(a.current=null,l.current&&delete l.current.dataset.dragging),r&&!a.current&&m(0)},[r]);const B=t=>{a.current||(g.current=!1,!(!v||!r)&&(t.pointerType==="mouse"&&(t.button!==0||!C.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}]})))},U=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(!k.exceedsSheetTapSlop(o,d))return;if(Math.abs(o)>Math.abs(d)){e.phase="ignored";return}e.phase="dragging",g.current=!0;try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}l.current&&(l.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(),m(Math.max(0,d)))},V=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=l.current?.getBoundingClientRect().height??0;A(k.sheetDragOutcome(o,d,k.sheetReleaseVelocity(e.samples)))},X=t=>{const e=a.current;!e||t.pointerId!==e.pointerId||(e.phase==="dragging"?A("stay"):a.current=null)},$=t=>{!g.current||t.detail===0||(g.current=!1,t.preventDefault(),t.stopPropagation())},G={"--rst-sheet-max-width":typeof y=="number"?`${y}px`:y,...w!==null&&{"--rst-sheet-keyboard-cap":`${w}px`}};return s.jsxs(s.Fragment,{children:[s.jsx("span",{ref:j,hidden:!0}),s.jsxs(x.Dialog,{open:r,as:"div",onClose:c,initialFocus:b??R,className:f.cn("rst:font-ui rst:relative rst:z-50 rst:focus:outline-hidden",Y&&"dark"),children:[s.jsx(x.DialogBackdrop,{transition:!0,"data-testid":"sheet-backdrop",className:f.cn("rst:fixed rst:inset-0 rst:bg-(--roster-sheet-backdrop)",S?st:rt)}),s.jsx("div",{className:"rst:fixed rst:inset-0 rst:flex rst:items-end rst:justify-center",children:s.jsx(J.TransitionChild,{afterLeave:u,children:s.jsxs(x.DialogPanel,{ref:l,style:G,"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)]",S?et:tt,"rst:data-dragging:transition-none",T),children:[s.jsxs("div",{"data-testid":"sheet-drag-zone",className:f.cn("rst:shrink-0",v&&"rst:touch-none"),onPointerDown:B,onPointerMove:U,onPointerUp:V,onPointerCancel:X,onClickCapture:$,children:[s.jsx("div",{ref:C,"aria-hidden":"true","data-testid":"sheet-handle",className:f.cn("rst:flex rst:h-11 rst:items-start rst:justify-center rst:pt-2",v&&"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(x.DialogTitle,{as:"h2",id:L,ref:I,tabIndex:-1,className:f.cn("rst:text-lg rst:font-semibold rst:text-inherit rst:focus:outline-hidden",F&&"rst:sr-only"),children:i}),D&&s.jsx(H.Description,{as:"p",className:"rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75",children:D})]}),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:R,type:"button",onClick:c,"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(it,{})})]})]}),s.jsx("div",{ref:E,role:"region","aria-labelledby":L,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:z}),s.jsx(at,{target:_})]})})})]})]})};exports.Sheet=ct;
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
- * Changing it while the sheet is open counts as a content swap: focus moves
18
- * to the new title so a screen reader announces it. Not while `busy`: a
19
- * title that changes during loading is a provisional one being refined, and
20
- * the reader keeps their place.
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: string;
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`. */