@blakesteve/roster 5.7.0 → 5.8.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 +84 -4
- package/dist/components/atoms/Avatar/Avatar.cjs +1 -1
- package/dist/components/atoms/Avatar/Avatar.d.ts +4 -0
- package/dist/components/atoms/Avatar/Avatar.js +1 -1
- package/dist/components/atoms/AvatarStrip/AvatarStrip.cjs +1 -1
- package/dist/components/atoms/AvatarStrip/AvatarStrip.d.ts +10 -1
- package/dist/components/atoms/AvatarStrip/AvatarStrip.js +34 -30
- package/dist/components/atoms/Button/button-variants.cjs +1 -1
- package/dist/components/atoms/Button/button-variants.js +5 -3
- package/dist/components/atoms/Eyebrow/eyebrow-variants.cjs +1 -1
- package/dist/components/atoms/Eyebrow/eyebrow-variants.js +8 -4
- package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.d.ts +3 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.js +87 -89
- package/dist/components/atoms/Progress/Progress.cjs +1 -1
- package/dist/components/atoms/Progress/Progress.d.ts +1 -0
- package/dist/components/atoms/Progress/Progress.js +28 -27
- package/dist/components/atoms/Stat/Stat.cjs +1 -1
- package/dist/components/atoms/Stat/Stat.js +5 -5
- package/dist/components/atoms/Stat/stat-variants.cjs +1 -1
- package/dist/components/atoms/Stat/stat-variants.js +10 -8
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +10 -1
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js +31 -29
- package/dist/components/molecules/CallToAction/CallToAction.cjs +1 -1
- package/dist/components/molecules/CallToAction/CallToAction.d.ts +8 -1
- package/dist/components/molecules/CallToAction/CallToAction.js +34 -29
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
- package/dist/components/molecules/Carousel/Carousel.d.ts +7 -0
- package/dist/components/molecules/Carousel/Carousel.js +155 -155
- package/dist/components/molecules/ErrorState/ErrorState.cjs +1 -1
- package/dist/components/molecules/ErrorState/ErrorState.d.ts +8 -1
- package/dist/components/molecules/ErrorState/ErrorState.js +44 -39
- package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/molecules/FileUpload/FileUpload.js +23 -22
- package/dist/components/molecules/MediaPreview/MediaPreview.cjs +1 -1
- package/dist/components/molecules/MediaPreview/MediaPreview.d.ts +3 -1
- package/dist/components/molecules/MediaPreview/MediaPreview.js +13 -12
- package/dist/components/molecules/Pagination/Pagination.cjs +1 -1
- package/dist/components/molecules/Pagination/Pagination.d.ts +1 -0
- package/dist/components/molecules/Pagination/Pagination.js +47 -46
- package/dist/components/molecules/ProgressField/ProgressField.d.ts +1 -0
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +2 -2
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +17 -17
- package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -1
- package/dist/components/molecules/StepProgress/StepProgress.d.ts +1 -0
- package/dist/components/molecules/StepProgress/StepProgress.js +9 -8
- package/dist/components/organisms/Countdown/Countdown.cjs +1 -1
- package/dist/components/organisms/Countdown/Countdown.d.ts +13 -0
- package/dist/components/organisms/Countdown/Countdown.js +54 -47
- package/dist/components/organisms/DataTable/DataTable.cjs +1 -1
- package/dist/components/organisms/DataTable/DataTable.d.ts +5 -3
- package/dist/components/organisms/DataTable/DataTable.js +27 -26
- package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
- package/dist/components/organisms/Dialog/Dialog.d.ts +8 -1
- package/dist/components/organisms/Dialog/Dialog.js +25 -23
- package/dist/components/organisms/Footer/Footer.cjs +1 -1
- package/dist/components/organisms/Footer/Footer.d.ts +9 -0
- package/dist/components/organisms/Footer/Footer.js +21 -23
- package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/ModerationQueue.d.ts +40 -1
- package/dist/components/organisms/ModerationQueue/ModerationQueue.js +262 -237
- package/dist/components/organisms/ModerationQueue/QueueEditDialog.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/QueueEditDialog.d.ts +1 -1
- package/dist/components/organisms/ModerationQueue/QueueEditDialog.js +23 -21
- package/dist/components/organisms/ModerationQueue/QueueEditSheet.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/QueueEditSheet.d.ts +1 -1
- package/dist/components/organisms/ModerationQueue/QueueEditSheet.js +22 -20
- package/dist/components/organisms/ModerationQueue/queue-actions.d.ts +29 -10
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.d.ts +38 -3
- package/dist/components/organisms/Navbar/Navbar.js +210 -187
- package/dist/components/organisms/Navbar/navbar-variants.cjs +1 -1
- package/dist/components/organisms/Navbar/navbar-variants.js +4 -2
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
- package/dist/components/organisms/Sheet/Sheet.d.ts +8 -1
- package/dist/components/organisms/Sheet/Sheet.js +65 -63
- package/dist/lib/labels.cjs +1 -0
- package/dist/lib/labels.d.ts +7 -0
- package/dist/lib/labels.js +12 -0
- package/dist/meta.json +3 -3
- package/dist/roster.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-ui rst:w-full rst:z-30 rst:border-b rst:transition-colors rst:duration-200",{variants:{variant:{default:"rst:bg-[var(--roster-nav-bg)] rst:border-[var(--roster-nav-border)] rst:text-[var(--roster-nav-text)]",slate:"rst:bg-gray-700 rst:border-gray-600 rst:text-gray-100 rst:dark:bg-gray-900 rst:dark:border-gray-800",primary:"rst:bg-primary-700 rst:border-primary-600 rst:text-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../node_modules/class-variance-authority/dist/index.cjs"),t=r.cva("rst:font-ui rst:w-full rst:z-30 rst:border-b rst:transition-colors rst:duration-200",{variants:{variant:{default:"rst:bg-[var(--roster-nav-bg)] rst:border-[var(--roster-nav-border)] rst:text-[var(--roster-nav-text)]",slate:"rst:bg-gray-700 rst:border-gray-600 rst:text-gray-100 rst:dark:bg-gray-900 rst:dark:border-gray-800",primary:"rst:bg-primary-700 rst:border-primary-600 rst:text-primary-700-ink rst:dark:bg-primary-950 rst:dark:border-primary-900 rst:dark:text-white",white:"rst:bg-white rst:border-gray-200 rst:text-gray-900 rst:dark:bg-gray-600 rst:dark:border-gray-700 rst:dark:text-gray-100",transparent:"rst:bg-transparent rst:border-transparent rst:text-gray-900 rst:dark:text-white"},position:{fixed:"rst:fixed rst:top-0 rst:left-0 rst:right-0",sticky:"rst:sticky rst:top-0",static:"rst:static"}},defaultVariants:{variant:"default",position:"sticky"}});exports.navbarVariants=t;
|
|
@@ -11,8 +11,10 @@ const a = /* @__PURE__ */ r(
|
|
|
11
11
|
default: "rst:bg-[var(--roster-nav-bg)] rst:border-[var(--roster-nav-border)] rst:text-[var(--roster-nav-text)]",
|
|
12
12
|
// Slate: A solid mid-dark gray in light mode, drops to a moody gray in dark mode
|
|
13
13
|
slate: "rst:bg-gray-700 rst:border-gray-600 rst:text-gray-100 rst:dark:bg-gray-900 rst:dark:border-gray-800",
|
|
14
|
-
// Primary: Bold brand color in light mode, deep rich brand color in dark mode
|
|
15
|
-
|
|
14
|
+
// Primary: Bold brand color in light mode, deep rich brand color in dark mode.
|
|
15
|
+
// Light text is primary-700's ink, as on every other solid fill, so an
|
|
16
|
+
// app with a light primary can make it dark; the dark fill keeps white.
|
|
17
|
+
primary: "rst:bg-primary-700 rst:border-primary-600 rst:text-primary-700-ink rst:dark:bg-primary-950 rst:dark:border-primary-900 rst:dark:text-white",
|
|
16
18
|
// White: Crisp white in light mode, elevated surface gray in dark mode
|
|
17
19
|
white: "rst:bg-white rst:border-gray-200 rst:text-gray-900 rst:dark:bg-gray-600 rst:dark:border-gray-700 rst:dark:text-gray-100",
|
|
18
20
|
// Transparent: Stays invisible, adapts text for standard readability
|
|
@@ -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"),Q=require("react"),Z=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),x=require("../../../node_modules/@headlessui/react/dist/components/dialog/dialog.cjs"),W=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),f=require("../../../lib/utils.cjs"),O=require("../../../lib/labels.cjs"),tt=require("../../../internal/popup.cjs"),et=require("../../../internal/motion.cjs"),rt=require("../../../internal/page-inert.cjs"),S=require("./sheet-drag.cjs"),st=require("./sheet-title.cjs");function nt(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=nt(Q),ot={close:"Close"},at="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",it="rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0",ct="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",ut="rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0",lt=["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 dt(r){return r?"current"in r?r.current:r:null}function ft({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=dt(i.current);l?.isConnected&&l.focus()})}),[]),null}function pt(){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 ht=({isOpen:r,onClose:i,onAfterClose:c,title:l,hideTitle:T=!1,description:D,actions:L,maxWidth:y=560,initialFocus:v,returnFocus:_,busy:p=!1,dragToDismiss:j=!0,contentKey:h,labels:z,className:B,children:Y})=>{const U=O.withLabels(ot,z),{ref:R,inDarkScope:V}=tt.useDarkScope(),N=et.useReducedMotion();n.useLayoutEffect(()=>{if(r)return rt.lockPage(R.current)},[r,R]);const u=n.useRef(null),C=n.useRef(null),I=n.useRef(null),E=n.useRef(null),k=n.useRef(null),w=n.useId(),g=st.titleSignature(l),P=n.useRef({signature:g,contentKey:h,open:r,busy:p});n.useEffect(()=>{const t=P.current;if(P.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||(I.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(lt);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 b=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&&b(0)})):b(0))};n.useEffect(()=>{!r&&a.current&&(a.current=null,u.current&&delete u.current.dataset.dragging),r&&!a.current&&b(0)},[r]);const X=t=>{a.current||(m.current=!1,!(!j||!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}]})))},$=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(!S.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(),b(Math.max(0,d)))},G=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(S.sheetDragOutcome(o,d,S.sheetReleaseVelocity(e.samples)))},K=t=>{const e=a.current;!e||t.pointerId!==e.pointerId||(e.phase==="dragging"?F("stay"):a.current=null)},H=t=>{!m.current||t.detail===0||(m.current=!1,t.preventDefault(),t.stopPropagation())},J={"--rst-sheet-max-width":typeof y=="number"?`${y}px`:y,...q!==null&&{"--rst-sheet-keyboard-cap":`${q}px`}};return s.jsxs(s.Fragment,{children:[s.jsx("span",{ref:R,hidden:!0}),s.jsxs(x.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",V&&"dark"),children:[s.jsx(x.DialogBackdrop,{transition:!0,"data-testid":"sheet-backdrop",className:f.cn("rst:fixed rst:inset-0 rst:bg-[var(--roster-backdrop,var(--roster-sheet-backdrop))]",N?ut:ct)}),s.jsx("div",{className:"rst:fixed rst:inset-0 rst:flex rst:items-end rst:justify-center",children:s.jsx(W.TransitionChild,{afterLeave:c,children:s.jsxs(x.DialogPanel,{ref:u,style:J,"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)]",N?it:at,"rst:data-dragging:transition-none",B),children:[s.jsxs("div",{"data-testid":"sheet-drag-zone",className:f.cn("rst:shrink-0",j&&"rst:touch-none"),onPointerDown:X,onPointerMove:$,onPointerUp:G,onPointerCancel:K,onClickCapture:H,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",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(x.DialogTitle,{as:"h2",id:w,ref:I,tabIndex:-1,className:f.cn("rst:text-lg rst:font-semibold rst:text-inherit rst:focus:outline-hidden",T&&"rst:sr-only"),children:l}),D&&s.jsx(Z.Description,{as:"p",className:"rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75",children:D})]}),L&&s.jsx("div",{className:"rst:flex rst:h-11 rst:shrink-0 rst:items-center rst:gap-1",children:L}),s.jsx("button",{ref:E,type:"button",onClick:i,"aria-label":U.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(pt,{})})]})]}),s.jsx("div",{ref:k,role:"region","aria-labelledby":w,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(ft,{target:_})]})})})]})]})};exports.Sheet=ht;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
/** Every word Sheet says of its own. Pass any of them in `labels` to replace it. */
|
|
3
|
+
export interface SheetLabels {
|
|
4
|
+
/** The close button's name. */
|
|
5
|
+
close: string;
|
|
6
|
+
}
|
|
2
7
|
export interface SheetProps {
|
|
3
8
|
isOpen: boolean;
|
|
4
9
|
/** Called by Escape, a backdrop click, the close button and a dismissing drag. */
|
|
@@ -52,6 +57,8 @@ export interface SheetProps {
|
|
|
52
57
|
* that changes under an unchanged title.
|
|
53
58
|
*/
|
|
54
59
|
contentKey?: React.Key;
|
|
60
|
+
/** The component's own words, replaced; any left out stay English. */
|
|
61
|
+
labels?: Partial<SheetLabels>;
|
|
55
62
|
/** Applied to the panel. */
|
|
56
63
|
className?: string;
|
|
57
64
|
children: React.ReactNode;
|
|
@@ -81,5 +88,5 @@ export interface SheetProps {
|
|
|
81
88
|
* The bottom padding includes `env(safe-area-inset-bottom)`, which is 0 unless
|
|
82
89
|
* the page's viewport meta sets `viewport-fit=cover`.
|
|
83
90
|
*/
|
|
84
|
-
declare const Sheet: ({ isOpen, onClose, onAfterClose, title, hideTitle, description, actions, maxWidth, initialFocus, returnFocus, busy, dragToDismiss, contentKey, className, children, }: SheetProps) => import("react/jsx-runtime").JSX.Element;
|
|
91
|
+
declare const Sheet: ({ isOpen, onClose, onAfterClose, title, hideTitle, description, actions, maxWidth, initialFocus, returnFocus, busy, dragToDismiss, contentKey, labels, className, children, }: SheetProps) => import("react/jsx-runtime").JSX.Element;
|
|
85
92
|
export { Sheet };
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as l, Fragment as
|
|
2
|
+
import { jsxs as l, Fragment as H, jsx as n } from "react/jsx-runtime";
|
|
3
3
|
import * as s from "react";
|
|
4
|
-
import { Description as
|
|
5
|
-
import { Dialog as
|
|
6
|
-
import { TransitionChild as
|
|
4
|
+
import { Description as J } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
|
|
5
|
+
import { Dialog as Z, DialogBackdrop as W, DialogPanel as O, DialogTitle as tt } from "../../../node_modules/@headlessui/react/dist/components/dialog/dialog.js";
|
|
6
|
+
import { TransitionChild as et } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
|
|
7
7
|
import { cn as d } from "../../../lib/utils.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
8
|
+
import { withLabels as rt } from "../../../lib/labels.js";
|
|
9
|
+
import { useDarkScope as st } from "../../../internal/popup.js";
|
|
10
|
+
import { useReducedMotion as nt } from "../../../internal/motion.js";
|
|
11
|
+
import { lockPage as ot } from "../../../internal/page-inert.js";
|
|
12
|
+
import { sheetDragOutcome as at, sheetReleaseVelocity as it, exceedsSheetTapSlop as ct } from "./sheet-drag.js";
|
|
13
|
+
import { titleSignature as ut } from "./sheet-title.js";
|
|
14
|
+
const lt = { close: "Close" }, dt = "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", ft = "rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0", pt = "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", mt = "rst:transition-opacity rst:duration-(--roster-sheet-fade-duration) rst:ease-out rst:data-closed:opacity-0", ht = [
|
|
14
15
|
"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])",
|
|
15
16
|
"textarea",
|
|
16
17
|
"select",
|
|
17
18
|
"[contenteditable]:not([contenteditable=false])"
|
|
18
19
|
].join(",");
|
|
19
|
-
function
|
|
20
|
+
function gt(r) {
|
|
20
21
|
return r ? "current" in r ? r.current : r : null;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function yt({ target: r }) {
|
|
23
24
|
const u = s.useRef(r), f = s.useRef(!1);
|
|
24
25
|
return s.useEffect(() => {
|
|
25
26
|
u.current = r;
|
|
26
27
|
}), s.useEffect(() => (f.current = !1, () => {
|
|
27
28
|
f.current = !0, queueMicrotask(() => {
|
|
28
29
|
if (!f.current) return;
|
|
29
|
-
const p =
|
|
30
|
+
const p = gt(u.current);
|
|
30
31
|
p?.isConnected && p.focus();
|
|
31
32
|
});
|
|
32
33
|
}), []), null;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function bt() {
|
|
35
36
|
return /* @__PURE__ */ n(
|
|
36
37
|
"svg",
|
|
37
38
|
{
|
|
@@ -47,35 +48,36 @@ function ht() {
|
|
|
47
48
|
}
|
|
48
49
|
);
|
|
49
50
|
}
|
|
50
|
-
const
|
|
51
|
+
const St = ({
|
|
51
52
|
isOpen: r,
|
|
52
53
|
onClose: u,
|
|
53
54
|
onAfterClose: f,
|
|
54
55
|
title: p,
|
|
55
56
|
hideTitle: z = !1,
|
|
56
|
-
description:
|
|
57
|
+
description: C,
|
|
57
58
|
actions: N,
|
|
58
59
|
maxWidth: v = 560,
|
|
59
60
|
initialFocus: x,
|
|
60
|
-
returnFocus:
|
|
61
|
-
busy:
|
|
61
|
+
returnFocus: B,
|
|
62
|
+
busy: m = !1,
|
|
62
63
|
dragToDismiss: E = !0,
|
|
63
|
-
contentKey:
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
contentKey: h,
|
|
65
|
+
labels: Y,
|
|
66
|
+
className: T,
|
|
67
|
+
children: _
|
|
66
68
|
}) => {
|
|
67
|
-
const { ref: R, inDarkScope:
|
|
69
|
+
const q = rt(lt, Y), { ref: R, inDarkScope: $ } = st(), D = nt();
|
|
68
70
|
s.useLayoutEffect(() => {
|
|
69
71
|
if (r)
|
|
70
|
-
return
|
|
72
|
+
return ot(R.current);
|
|
71
73
|
}, [r, R]);
|
|
72
|
-
const i = s.useRef(null), I = s.useRef(null), w = s.useRef(null), k = s.useRef(null),
|
|
74
|
+
const i = s.useRef(null), I = s.useRef(null), w = s.useRef(null), k = s.useRef(null), L = s.useRef(null), S = s.useId(), g = ut(p), P = s.useRef({ signature: g, contentKey: h, open: r, busy: m });
|
|
73
75
|
s.useEffect(() => {
|
|
74
76
|
const t = P.current;
|
|
75
|
-
if (P.current = { signature: g, contentKey:
|
|
76
|
-
const e = t.contentKey !==
|
|
77
|
-
!e && !o || (w.current?.focus(),
|
|
78
|
-
}, [g,
|
|
77
|
+
if (P.current = { signature: g, contentKey: h, open: r, busy: m }, !t.open || !r) return;
|
|
78
|
+
const e = t.contentKey !== h, o = t.signature !== g && !t.busy;
|
|
79
|
+
!e && !o || (w.current?.focus(), L.current && (L.current.scrollTop = 0));
|
|
80
|
+
}, [g, h, r, m]), s.useEffect(() => {
|
|
79
81
|
if (!r) return;
|
|
80
82
|
const t = requestAnimationFrame(() => {
|
|
81
83
|
const e = i.current, o = document.activeElement;
|
|
@@ -89,7 +91,7 @@ const Lt = ({
|
|
|
89
91
|
const t = window.visualViewport;
|
|
90
92
|
if (!t) return;
|
|
91
93
|
const e = () => {
|
|
92
|
-
const o = document.activeElement, c = !!o && !!i.current?.contains(o) && o.matches(
|
|
94
|
+
const o = document.activeElement, c = !!o && !!i.current?.contains(o) && o.matches(ht);
|
|
93
95
|
A(c ? Math.round(t.height) : null);
|
|
94
96
|
};
|
|
95
97
|
return t.addEventListener("resize", e), document.addEventListener("focusin", e), document.addEventListener("focusout", e), () => {
|
|
@@ -111,7 +113,7 @@ const Lt = ({
|
|
|
111
113
|
s.useEffect(() => {
|
|
112
114
|
!r && a.current && (a.current = null, i.current && delete i.current.dataset.dragging), r && !a.current && b(0);
|
|
113
115
|
}, [r]);
|
|
114
|
-
const
|
|
116
|
+
const U = (t) => {
|
|
115
117
|
a.current || (y.current = !1, !(!E || !r) && (t.pointerType === "mouse" && (t.button !== 0 || !I.current?.contains(t.target)) || (a.current = {
|
|
116
118
|
pointerId: t.pointerId,
|
|
117
119
|
x0: t.clientX,
|
|
@@ -120,12 +122,12 @@ const Lt = ({
|
|
|
120
122
|
phase: "pending",
|
|
121
123
|
samples: [{ t: t.timeStamp, y: t.clientY }]
|
|
122
124
|
})));
|
|
123
|
-
},
|
|
125
|
+
}, V = (t) => {
|
|
124
126
|
const e = a.current;
|
|
125
127
|
if (!e || t.pointerId !== e.pointerId) return;
|
|
126
128
|
const o = t.clientX - e.x0, c = t.clientY - e.y0;
|
|
127
129
|
if (e.phase === "pending") {
|
|
128
|
-
if (!
|
|
130
|
+
if (!ct(o, c)) return;
|
|
129
131
|
if (Math.abs(o) > Math.abs(c)) {
|
|
130
132
|
e.phase = "ignored";
|
|
131
133
|
return;
|
|
@@ -138,7 +140,7 @@ const Lt = ({
|
|
|
138
140
|
i.current && (i.current.dataset.dragging = "");
|
|
139
141
|
}
|
|
140
142
|
e.phase === "dragging" && (e.dy = c, e.samples.push({ t: t.timeStamp, y: t.clientY }), e.samples.length > 32 && e.samples.shift(), b(Math.max(0, c)));
|
|
141
|
-
},
|
|
143
|
+
}, X = (t) => {
|
|
142
144
|
const e = a.current;
|
|
143
145
|
if (!e || t.pointerId !== e.pointerId) return;
|
|
144
146
|
if (e.phase !== "dragging") {
|
|
@@ -147,20 +149,20 @@ const Lt = ({
|
|
|
147
149
|
}
|
|
148
150
|
e.samples.push({ t: t.timeStamp, y: t.clientY });
|
|
149
151
|
const o = t.clientY - e.y0, c = i.current?.getBoundingClientRect().height ?? 0;
|
|
150
|
-
j(
|
|
151
|
-
},
|
|
152
|
+
j(at(o, c, it(e.samples)));
|
|
153
|
+
}, G = (t) => {
|
|
152
154
|
const e = a.current;
|
|
153
155
|
!e || t.pointerId !== e.pointerId || (e.phase === "dragging" ? j("stay") : a.current = null);
|
|
154
|
-
},
|
|
156
|
+
}, K = (t) => {
|
|
155
157
|
!y.current || t.detail === 0 || (y.current = !1, t.preventDefault(), t.stopPropagation());
|
|
156
|
-
},
|
|
158
|
+
}, Q = {
|
|
157
159
|
"--rst-sheet-max-width": typeof v == "number" ? `${v}px` : v,
|
|
158
160
|
...M !== null && { "--rst-sheet-keyboard-cap": `${M}px` }
|
|
159
161
|
};
|
|
160
|
-
return /* @__PURE__ */ l(
|
|
162
|
+
return /* @__PURE__ */ l(H, { children: [
|
|
161
163
|
/* @__PURE__ */ n("span", { ref: R, hidden: !0 }),
|
|
162
164
|
/* @__PURE__ */ l(
|
|
163
|
-
|
|
165
|
+
Z,
|
|
164
166
|
{
|
|
165
167
|
open: r,
|
|
166
168
|
as: "div",
|
|
@@ -168,25 +170,25 @@ const Lt = ({
|
|
|
168
170
|
initialFocus: x ?? k,
|
|
169
171
|
className: d(
|
|
170
172
|
"rst:font-ui rst:relative rst:z-50 rst:focus:outline-hidden",
|
|
171
|
-
|
|
173
|
+
$ && "dark"
|
|
172
174
|
),
|
|
173
175
|
children: [
|
|
174
176
|
/* @__PURE__ */ n(
|
|
175
|
-
|
|
177
|
+
W,
|
|
176
178
|
{
|
|
177
179
|
transition: !0,
|
|
178
180
|
"data-testid": "sheet-backdrop",
|
|
179
181
|
className: d(
|
|
180
182
|
"rst:fixed rst:inset-0 rst:bg-[var(--roster-backdrop,var(--roster-sheet-backdrop))]",
|
|
181
|
-
D ?
|
|
183
|
+
D ? mt : pt
|
|
182
184
|
)
|
|
183
185
|
}
|
|
184
186
|
),
|
|
185
|
-
/* @__PURE__ */ n("div", { className: "rst:fixed rst:inset-0 rst:flex rst:items-end rst:justify-center", children: /* @__PURE__ */ n(
|
|
186
|
-
|
|
187
|
+
/* @__PURE__ */ n("div", { className: "rst:fixed rst:inset-0 rst:flex rst:items-end rst:justify-center", children: /* @__PURE__ */ n(et, { afterLeave: f, children: /* @__PURE__ */ l(
|
|
188
|
+
O,
|
|
187
189
|
{
|
|
188
190
|
ref: i,
|
|
189
|
-
style:
|
|
191
|
+
style: Q,
|
|
190
192
|
"data-testid": "sheet-panel",
|
|
191
193
|
className: d(
|
|
192
194
|
/* 92dvh, or the visual viewport while the keyboard is up,
|
|
@@ -200,9 +202,9 @@ const Lt = ({
|
|
|
200
202
|
"rst:[--roster-ring-offset:var(--roster-popover-bg)]",
|
|
201
203
|
"rst:pb-[env(safe-area-inset-bottom)]",
|
|
202
204
|
"rst:translate-y-[var(--rst-sheet-drag,0px)]",
|
|
203
|
-
D ?
|
|
205
|
+
D ? ft : dt,
|
|
204
206
|
"rst:data-dragging:transition-none",
|
|
205
|
-
|
|
207
|
+
T
|
|
206
208
|
),
|
|
207
209
|
children: [
|
|
208
210
|
/* @__PURE__ */ l(
|
|
@@ -210,11 +212,11 @@ const Lt = ({
|
|
|
210
212
|
{
|
|
211
213
|
"data-testid": "sheet-drag-zone",
|
|
212
214
|
className: d("rst:shrink-0", E && "rst:touch-none"),
|
|
213
|
-
onPointerDown:
|
|
214
|
-
onPointerMove:
|
|
215
|
-
onPointerUp:
|
|
216
|
-
onPointerCancel:
|
|
217
|
-
onClickCapture:
|
|
215
|
+
onPointerDown: U,
|
|
216
|
+
onPointerMove: V,
|
|
217
|
+
onPointerUp: X,
|
|
218
|
+
onPointerCancel: G,
|
|
219
|
+
onClickCapture: K,
|
|
218
220
|
children: [
|
|
219
221
|
/* @__PURE__ */ n(
|
|
220
222
|
"div",
|
|
@@ -237,7 +239,7 @@ const Lt = ({
|
|
|
237
239
|
/* @__PURE__ */ l("div", { className: "rst:-mt-3 rst:flex rst:items-start rst:gap-2 rst:px-5 rst:pb-4", children: [
|
|
238
240
|
/* @__PURE__ */ l("div", { className: "rst:min-w-0 rst:flex-1 rst:pt-2", children: [
|
|
239
241
|
/* @__PURE__ */ n(
|
|
240
|
-
|
|
242
|
+
tt,
|
|
241
243
|
{
|
|
242
244
|
as: "h2",
|
|
243
245
|
id: S,
|
|
@@ -250,12 +252,12 @@ const Lt = ({
|
|
|
250
252
|
children: p
|
|
251
253
|
}
|
|
252
254
|
),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
C && /* @__PURE__ */ n(
|
|
256
|
+
J,
|
|
255
257
|
{
|
|
256
258
|
as: "p",
|
|
257
259
|
className: "rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75",
|
|
258
|
-
children:
|
|
260
|
+
children: C
|
|
259
261
|
}
|
|
260
262
|
)
|
|
261
263
|
] }),
|
|
@@ -268,9 +270,9 @@ const Lt = ({
|
|
|
268
270
|
ref: k,
|
|
269
271
|
type: "button",
|
|
270
272
|
onClick: u,
|
|
271
|
-
"aria-label":
|
|
273
|
+
"aria-label": q.close,
|
|
272
274
|
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",
|
|
273
|
-
children: /* @__PURE__ */ n(
|
|
275
|
+
children: /* @__PURE__ */ n(bt, {})
|
|
274
276
|
}
|
|
275
277
|
)
|
|
276
278
|
] })
|
|
@@ -280,17 +282,17 @@ const Lt = ({
|
|
|
280
282
|
/* @__PURE__ */ n(
|
|
281
283
|
"div",
|
|
282
284
|
{
|
|
283
|
-
ref:
|
|
285
|
+
ref: L,
|
|
284
286
|
role: "region",
|
|
285
287
|
"aria-labelledby": S,
|
|
286
288
|
tabIndex: 0,
|
|
287
289
|
"data-testid": "sheet-content",
|
|
288
|
-
"aria-busy":
|
|
290
|
+
"aria-busy": m || void 0,
|
|
289
291
|
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",
|
|
290
|
-
children:
|
|
292
|
+
children: _
|
|
291
293
|
}
|
|
292
294
|
),
|
|
293
|
-
/* @__PURE__ */ n(
|
|
295
|
+
/* @__PURE__ */ n(yt, { target: B })
|
|
294
296
|
]
|
|
295
297
|
}
|
|
296
298
|
) }) })
|
|
@@ -300,5 +302,5 @@ const Lt = ({
|
|
|
300
302
|
] });
|
|
301
303
|
};
|
|
302
304
|
export {
|
|
303
|
-
|
|
305
|
+
St as Sheet
|
|
304
306
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(c,t){const e={...c};if(t)for(const o of Object.keys(t)){const n=t[o];n!==void 0&&(e[o]=n)}return e}exports.withLabels=i;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A component's own words with an app's replacements laid over them. An entry
|
|
3
|
+
* passed as `undefined` (a translation catalog missing a key, say) keeps the
|
|
4
|
+
* default: a plain spread would let it through, leaving a control unnamed, or
|
|
5
|
+
* throwing where a function label is called.
|
|
6
|
+
*/
|
|
7
|
+
export declare function withLabels<L extends object>(defaults: L, overrides?: Partial<L>): L;
|
package/dist/meta.json
CHANGED