@blakesteve/roster 5.16.0 → 5.18.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.
Files changed (33) hide show
  1. package/README.md +227 -2
  2. package/dist/components/molecules/RadioTileGroup/RadioTileGroup.cjs +1 -0
  3. package/dist/components/molecules/RadioTileGroup/RadioTileGroup.d.ts +101 -0
  4. package/dist/components/molecules/RadioTileGroup/RadioTileGroup.js +142 -0
  5. package/dist/components/molecules/RadioTileGroup/radio-tile-group-variants.cjs +1 -0
  6. package/dist/components/molecules/RadioTileGroup/radio-tile-group-variants.d.ts +49 -0
  7. package/dist/components/molecules/RadioTileGroup/radio-tile-group-variants.js +34 -0
  8. package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -1
  9. package/dist/components/molecules/StepProgress/StepProgress.js +29 -42
  10. package/dist/components/molecules/Timeline/Timeline.cjs +1 -0
  11. package/dist/components/molecules/Timeline/Timeline.d.ts +86 -0
  12. package/dist/components/molecules/Timeline/Timeline.js +217 -0
  13. package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
  14. package/dist/components/organisms/Dialog/Dialog.d.ts +58 -6
  15. package/dist/components/organisms/Dialog/Dialog.js +82 -59
  16. package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
  17. package/dist/components/organisms/Sheet/Sheet.d.ts +2 -1
  18. package/dist/components/organisms/Sheet/Sheet.js +90 -87
  19. package/dist/index.d.ts +3 -0
  20. package/dist/internal/leave-watchdog.cjs +1 -0
  21. package/dist/internal/leave-watchdog.d.ts +62 -0
  22. package/dist/internal/leave-watchdog.js +64 -0
  23. package/dist/internal/step-check.cjs +1 -0
  24. package/dist/internal/step-check.d.ts +2 -0
  25. package/dist/internal/step-check.js +6 -0
  26. package/dist/internal/step-marker.cjs +1 -0
  27. package/dist/internal/step-marker.d.ts +10 -0
  28. package/dist/internal/step-marker.js +12 -0
  29. package/dist/meta.json +3 -3
  30. package/dist/roster.cjs +1 -1
  31. package/dist/roster.css +1 -1
  32. package/dist/roster.js +155 -147
  33. package/package.json +1 -1
@@ -1,20 +1,22 @@
1
1
  "use client";
2
- import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
+ import { jsxs as i, jsx as r } from "react/jsx-runtime";
3
3
  import { cn as d } from "../../../lib/utils.js";
4
4
  import { withLabels as b } from "../../../lib/labels.js";
5
5
  import { Progress as y } from "../../atoms/Progress/Progress.js";
6
- const k = {
6
+ import { stepMarkerClass as N } from "../../../internal/step-marker.js";
7
+ import { StepCheck as v } from "../../../internal/step-check.js";
8
+ const w = {
7
9
  nav: "Progress",
8
10
  position: (s, c) => `Step ${s} of ${c}`,
9
11
  done: "done",
10
12
  number: (s) => String(s)
11
- }, v = () => /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M20 6 9 17l-5-5" }) });
12
- function L({ steps: s, current: c, variant: h = "stepper", labels: x, className: g }) {
13
- const n = b(k, x), a = s.length;
14
- if (a === 0) return null;
15
- const t = Math.min(Math.max(1, Math.floor(Number.isFinite(c) ? c : 1)), a + 1), m = t > a, p = m ? n.position(a, a) : n.position(t, a), f = m ? p : `${p}: ${s[t - 1]}`;
16
- return h === "segmented" ? /* @__PURE__ */ l("div", { className: d("rst:font-ui rst:w-full rst:min-w-0", g), "data-step-progress": "segmented", children: [
17
- /* @__PURE__ */ l("div", { className: "rst:mb-1.5 rst:flex rst:items-baseline rst:justify-between rst:gap-3 rst:text-sm", "aria-hidden": "true", children: [
13
+ };
14
+ function P({ steps: s, current: c, variant: h = "stepper", labels: x, className: f }) {
15
+ const o = b(w, x), e = s.length;
16
+ if (e === 0) return null;
17
+ const t = Math.min(Math.max(1, Math.floor(Number.isFinite(c) ? c : 1)), e + 1), m = t > e, p = m ? o.position(e, e) : o.position(t, e), g = m ? p : `${p}: ${s[t - 1]}`;
18
+ return h === "segmented" ? /* @__PURE__ */ i("div", { className: d("rst:font-ui rst:w-full rst:min-w-0", f), "data-step-progress": "segmented", children: [
19
+ /* @__PURE__ */ i("div", { className: "rst:mb-1.5 rst:flex rst:items-baseline rst:justify-between rst:gap-3 rst:text-sm", "aria-hidden": "true", children: [
18
20
  /* @__PURE__ */ r("span", { className: "rst:font-medium rst:text-[var(--roster-control-text)]", "data-step-position": "", children: p }),
19
21
  !m && /* @__PURE__ */ r("span", { className: "rst:min-w-0 rst:truncate rst:text-gray-600 rst:dark:text-gray-400", "data-step-name": "", children: s[t - 1] })
20
22
  ] }),
@@ -22,69 +24,54 @@ function L({ steps: s, current: c, variant: h = "stepper", labels: x, className:
22
24
  y,
23
25
  {
24
26
  variant: "segmented",
25
- segments: s.map((u, i) => i + 1 < t ? "done" : i + 1 === t ? "current" : "remaining"),
27
+ segments: s.map((u, l) => l + 1 < t ? "done" : l + 1 === t ? "current" : "remaining"),
26
28
  announce: !1
27
29
  }
28
30
  ),
29
- /* @__PURE__ */ r("span", { role: "status", className: "rst:sr-only", "data-step-status": "", children: f })
30
- ] }) : /* @__PURE__ */ l("div", { className: d("rst:font-ui rst:w-full", g), "data-step-progress": "stepper", children: [
31
- /* @__PURE__ */ r("ol", { "aria-label": n.nav, className: "rst:m-0 rst:flex rst:w-full rst:list-none rst:p-0", children: s.map((u, i) => {
32
- const o = i + 1, e = o < t ? "done" : o === t ? "current" : "upcoming";
33
- return /* @__PURE__ */ l(
31
+ /* @__PURE__ */ r("span", { role: "status", className: "rst:sr-only", "data-step-status": "", children: g })
32
+ ] }) : /* @__PURE__ */ i("div", { className: d("rst:font-ui rst:w-full", f), "data-step-progress": "stepper", children: [
33
+ /* @__PURE__ */ r("ol", { "aria-label": o.nav, className: "rst:m-0 rst:flex rst:w-full rst:list-none rst:p-0", children: s.map((u, l) => {
34
+ const a = l + 1, n = a < t ? "done" : a === t ? "current" : "upcoming";
35
+ return /* @__PURE__ */ i(
34
36
  "li",
35
37
  {
36
- "aria-current": e === "current" ? "step" : void 0,
38
+ "aria-current": n === "current" ? "step" : void 0,
37
39
  className: "rst:relative rst:flex rst:min-w-0 rst:flex-1 rst:flex-col rst:items-center rst:gap-1.5 rst:text-center",
38
- "data-step": e,
40
+ "data-step": n,
39
41
  children: [
40
- i > 0 && /* @__PURE__ */ r(
42
+ l > 0 && /* @__PURE__ */ r(
41
43
  "span",
42
44
  {
43
45
  "aria-hidden": "true",
44
46
  className: d(
45
47
  "rst:absolute rst:right-1/2 rst:top-4 rst:h-0.5 rst:w-full rst:-translate-y-1/2",
46
- o <= t ? "rst:bg-primary-600 rst:dark:bg-primary-400 rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]" : "rst:bg-[var(--roster-skeleton)] rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[GrayText]"
47
- ),
48
- "data-step-connector": o <= t ? "filled" : "empty"
49
- }
50
- ),
51
- /* @__PURE__ */ r(
52
- "span",
53
- {
54
- "aria-hidden": "true",
55
- className: d(
56
- "rst:relative rst:z-10 rst:flex rst:h-8 rst:w-8 rst:items-center rst:justify-center rst:rounded-full rst:text-sm rst:font-semibold rst:tabular-nums",
57
- e === "done" && "rst:bg-primary-600 rst:text-primary-600-ink rst:dark:bg-primary-400 rst:dark:text-gray-950 rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight] rst:forced-colors:text-[HighlightText]",
58
- /* A border, not a ring: forced colors keep a border and drop
59
- the shadow a ring is drawn with. */
60
- e === "current" && "rst:border-2 rst:border-primary-600 rst:bg-[var(--roster-card-bg)] rst:text-primary-600 rst:dark:border-primary-400 rst:dark:text-primary-400",
61
- e === "upcoming" && "rst:bg-[var(--roster-skeleton)] rst:text-gray-600 rst:dark:text-gray-300 rst:forced-colors:border"
48
+ a <= t ? "rst:bg-primary-600 rst:dark:bg-primary-400 rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]" : "rst:bg-[var(--roster-skeleton)] rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[GrayText]"
62
49
  ),
63
- "data-step-marker": "",
64
- children: e === "done" ? /* @__PURE__ */ r(v, {}) : n.number(o)
50
+ "data-step-connector": a <= t ? "filled" : "empty"
65
51
  }
66
52
  ),
67
- /* @__PURE__ */ l(
53
+ /* @__PURE__ */ r("span", { "aria-hidden": "true", className: N(n), "data-step-marker": "", children: n === "done" ? /* @__PURE__ */ r(v, {}) : o.number(a) }),
54
+ /* @__PURE__ */ i(
68
55
  "span",
69
56
  {
70
57
  className: d(
71
58
  "rst:w-full rst:px-1 rst:text-xs rst:leading-4 rst:break-words",
72
- e === "current" ? "rst:font-semibold rst:text-[var(--roster-control-text)]" : "rst:text-gray-600 rst:dark:text-gray-400"
59
+ n === "current" ? "rst:font-semibold rst:text-[var(--roster-control-text)]" : "rst:text-gray-600 rst:dark:text-gray-400"
73
60
  ),
74
61
  children: [
75
62
  u,
76
- e === "done" && /* @__PURE__ */ r("span", { className: "rst:sr-only", children: `, ${n.done}` })
63
+ n === "done" && /* @__PURE__ */ r("span", { className: "rst:sr-only", children: `, ${o.done}` })
77
64
  ]
78
65
  }
79
66
  )
80
67
  ]
81
68
  },
82
- `${o}-${u}`
69
+ `${a}-${u}`
83
70
  );
84
71
  }) }),
85
- /* @__PURE__ */ r("span", { role: "status", className: "rst:sr-only", "data-step-status": "", children: f })
72
+ /* @__PURE__ */ r("span", { role: "status", className: "rst:sr-only", "data-step-status": "", children: g })
86
73
  ] });
87
74
  }
88
75
  export {
89
- L as StepProgress
76
+ P as StepProgress
90
77
  };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),C=require("react"),s=require("../../../lib/utils.cjs"),R=require("../../../lib/labels.cjs"),z=require("../../../internal/step-marker.cjs"),L=require("../../../internal/step-check.cjs"),E={done:"done",number:e=>String(e),now:"Now"},F={whenActions:{grid:"rst:@[40rem]:grid-cols-[fit-content(12rem)_minmax(2rem,max-content)_minmax(0,1fr)_auto]",when:"rst:@[40rem]:col-start-1",marker:"rst:@[40rem]:col-start-2",body:"rst:@[40rem]:col-start-3",actions:"rst:@[40rem]:col-start-4"},when:{grid:"rst:@[40rem]:grid-cols-[fit-content(12rem)_minmax(2rem,max-content)_minmax(0,1fr)]",when:"rst:@[40rem]:col-start-1",marker:"rst:@[40rem]:col-start-2",body:"rst:@[40rem]:col-start-3",actions:""},actions:{grid:"rst:@[40rem]:grid-cols-[minmax(2rem,max-content)_minmax(0,1fr)_auto]",when:"",marker:"rst:@[40rem]:col-start-1",body:"rst:@[40rem]:col-start-2",actions:"rst:@[40rem]:col-start-3"},neither:{grid:"",when:"",marker:"rst:@[40rem]:col-start-1",body:"rst:@[40rem]:col-start-2",actions:""}};function h({reached:e,className:x}){return r.jsx("span",{"aria-hidden":"true","data-timeline-rail":e?"done":"ahead",className:s.cn("rst:absolute rst:left-1/2 rst:w-0.5 rst:-translate-x-1/2",e?"rst:bg-(--roster-timeline-rail-done) rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]":"rst:bg-(--roster-timeline-rail) rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[GrayText]",x)})}function G({steps:e,label:x,"aria-labelledby":w,current:b=0,nowBefore:i,labels:p,className:j,stepClassName:N,whenClassName:y,markerClassName:v,titleClassName:k,contentClassName:_,actionsClassName:T,nowClassName:q}){const u=R.withLabels(E,p),m=e.length;if(m===0)return null;const l=Math.min(Math.max(0,Math.floor(Number.isFinite(b)?b:0)),m+1),d=e.some(t=>t.when!=null),g=e.some(t=>t.actions!=null),a=F[d&&g?"whenActions":d?"when":g?"actions":"neither"],M=i!=null&&i>=1&&i<=m?i:void 0,S=t=>r.jsxs("li",{"aria-hidden":"true","data-timeline-now":"",className:s.cn("rst:col-span-full rst:grid rst:grid-cols-subgrid",q),children:[r.jsx("span",{className:s.cn("rst:relative rst:col-start-1 rst:row-start-1 rst:row-end-3 rst:@[40rem]:row-end-2",a.marker),children:t>1&&r.jsx(h,{reached:t<=l,className:"rst:inset-y-0"})}),r.jsx("span",{className:s.cn("rst:col-start-2 rst:row-start-1 rst:text-xs rst:font-semibold rst:uppercase rst:tracking-wider rst:text-(--roster-timeline-now) rst:forced-colors:text-[CanvasText]",d?"rst:@[40rem]:col-start-1 rst:@[40rem]:self-center":a.body),children:u.now}),r.jsx("span",{className:s.cn("rst:col-start-1 rst:col-end-[-1] rst:row-start-2 rst:my-2 rst:h-0.5 rst:bg-(--roster-timeline-now) rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[CanvasText]",d&&"rst:@[40rem]:col-start-2 rst:@[40rem]:row-start-1 rst:@[40rem]:self-center")})]},"now");return r.jsx("div",{className:s.cn("rst:font-ui rst:@container rst:w-full rst:min-w-0",j),"data-timeline":"",children:r.jsx("ol",{"aria-label":w?void 0:x,"aria-labelledby":w,className:s.cn("rst:m-0 rst:list-none rst:p-0 rst:grid rst:grid-cols-[minmax(2rem,max-content)_minmax(0,1fr)] rst:gap-x-3 rst:@[40rem]:gap-x-4",a.grid),children:e.map((t,A)=>{const n=A+1,o=n<l?"done":n===l?"current":"upcoming",c=n===m,f=c?"":"rst:pb-6";return r.jsxs(C.Fragment,{children:[M===n&&S(n),r.jsxs("li",{"aria-current":o==="current"?"step":void 0,"data-step":o,className:s.cn("rst:col-span-full rst:grid rst:grid-cols-subgrid",N),children:[t.when!=null&&r.jsx("div",{"data-timeline-when":"",className:s.cn("rst:col-start-2 rst:row-start-1 rst:min-w-0 rst:pt-1.5 rst:text-sm rst:text-gray-600 rst:dark:text-gray-400","rst:@[40rem]:row-start-1",a.when,c?"":"rst:@[40rem]:pb-6",y),children:t.when}),r.jsxs("div",{"aria-hidden":"true","data-timeline-marker":"",className:s.cn("rst:relative rst:col-start-1 rst:row-start-1 rst:row-end-3 rst:flex rst:justify-center rst:@[40rem]:row-end-2",a.marker,f,v),children:[n>1&&r.jsx(h,{reached:n<=l,className:"rst:top-0 rst:h-4"}),!c&&r.jsx(h,{reached:n+1<=l,className:"rst:top-4 rst:bottom-0"}),t.marker==null?r.jsx("span",{className:z.stepMarkerClass(o),children:o==="done"?r.jsx(L.StepCheck,{}):u.number(n)}):t.marker==="hollow"?r.jsx("span",{className:"rst:relative rst:z-10 rst:block rst:size-8 rst:rounded-full rst:border-2 rst:border-(--roster-timeline-rail) rst:bg-[var(--roster-card-bg)] rst:forced-colors:border-[GrayText]","data-timeline-hollow":""}):r.jsx("span",{className:"rst:relative rst:z-10",children:t.marker})]}),r.jsxs("div",{className:s.cn("rst:col-start-2 rst:row-start-2 rst:min-w-0 rst:@[40rem]:contents",f),children:[r.jsxs("div",{"data-timeline-body":"",className:s.cn("rst:min-w-0 rst:@[40rem]:row-start-1 rst:@[40rem]:pt-1.5",a.body,t.when==null&&"rst:pt-1.5",c?"":"rst:@[40rem]:pb-6"),children:[r.jsxs("div",{className:s.cn("rst:text-sm rst:text-[var(--roster-control-text)]",o==="current"?"rst:font-semibold":"rst:font-medium",k),children:[t.title,o==="done"&&r.jsx("span",{className:"rst:sr-only",children:`, ${u.done}`})]}),t.content!=null&&r.jsx("div",{className:s.cn("rst:mt-0.5 rst:text-sm rst:text-gray-600 rst:dark:text-gray-400",_),children:t.content})]}),t.actions!=null&&r.jsx("div",{"data-timeline-actions":"",className:s.cn("rst:mt-2 rst:flex rst:flex-wrap rst:gap-2 rst:@[40rem]:row-start-1 rst:@[40rem]:mt-0 rst:@[40rem]:justify-self-end rst:@[40rem]:justify-end",a.actions,c?"":"rst:@[40rem]:pb-6",T),children:t.actions})]})]})]},t.id)})})})}exports.Timeline=G;
@@ -0,0 +1,86 @@
1
+ import { default as React } from 'react';
2
+ /** Every word Timeline shows or says. Pass any of them in `labels` to replace it. */
3
+ export interface TimelineLabels {
4
+ /** Said after a finished step's title. */
5
+ done: string;
6
+ /** A step's number, as its default marker shows it. */
7
+ number: (step: number) => string;
8
+ /** The word on the "now" divider. Shown only: the divider is hidden from assistive technology. */
9
+ now: string;
10
+ }
11
+ export type TimelineStep = {
12
+ /** Unique among the steps, and stable: React's key. */
13
+ id: string;
14
+ /** The step's name, at the top of its body. */
15
+ title: React.ReactNode;
16
+ /** The leading column: a date, a week, a time. */
17
+ when?: React.ReactNode;
18
+ /** Anything under the title: a description, facts, a badge. */
19
+ content?: React.ReactNode;
20
+ /** The trailing column: buttons and links of your own. */
21
+ actions?: React.ReactNode;
22
+ /**
23
+ * What sits on the line in place of the numbered marker: a mark of your
24
+ * own, or `"hollow"` for an empty ring, for a step with nothing in it yet.
25
+ * Decoration: hidden from assistive technology. A mark of your own needs a
26
+ * background, or the line shows through it.
27
+ */
28
+ marker?: React.ReactNode | "hollow";
29
+ };
30
+ export interface TimelineProps {
31
+ steps: TimelineStep[];
32
+ /** The list's name. Use `aria-labelledby` instead when a heading on the page names it. */
33
+ label?: string;
34
+ "aria-labelledby"?: string;
35
+ /**
36
+ * The step you're on, from 1: the ones before it are done, the ones after
37
+ * it upcoming. 0, the default, for none started; past the last for every
38
+ * step done.
39
+ */
40
+ current?: number;
41
+ /**
42
+ * Draws the "now" divider just before this step, from 1: where today falls,
43
+ * which needn't be beside the current step. Leave it out for none.
44
+ */
45
+ nowBefore?: number;
46
+ /** The component's own words, replaced; any left out stay English. */
47
+ labels?: Partial<TimelineLabels>;
48
+ className?: string;
49
+ /** Classes for every step, the `<li>`. It carries `data-step`: `done`, `current` or `upcoming`. */
50
+ stepClassName?: string;
51
+ /** Classes for every step's leading column. */
52
+ whenClassName?: string;
53
+ /** Classes for what holds every step's marker, on the line. */
54
+ markerClassName?: string;
55
+ /** Classes for every step's title. */
56
+ titleClassName?: string;
57
+ /** Classes for every step's `content`. */
58
+ contentClassName?: string;
59
+ /** Classes for every step's trailing column. */
60
+ actionsClassName?: string;
61
+ /** Classes for the "now" divider's row. */
62
+ nowClassName?: string;
63
+ }
64
+ /**
65
+ * Steps down the page, each with its own content: a schedule, a history, an
66
+ * onboarding list. Each step has a title, any content under it, a leading
67
+ * "when" column, a trailing column for actions, and a marker on a line that
68
+ * runs through them all.
69
+ *
70
+ * Its own component rather than `StepProgress orientation="vertical"`, with
71
+ * the same markers. A timeline isn't always progress: a schedule doesn't
72
+ * advance while you watch it, so there's no "Step 3 of 5" status here, and
73
+ * where today falls (the "now" divider) needn't be the current step. And each
74
+ * step carries content, where `StepProgress` takes names.
75
+ *
76
+ * An ordered list with a name. The current step is `aria-current="step"`,
77
+ * each finished one says "done" after its title, and the markers, the line
78
+ * and the "now" divider are hidden from assistive technology. It takes no
79
+ * keys: buttons and links inside a step are reached in reading order, which
80
+ * is the order they're shown in.
81
+ *
82
+ * Below 40rem of its own width the leading column moves above the body and
83
+ * the actions under it.
84
+ */
85
+ declare function Timeline({ steps, label, "aria-labelledby": labelledBy, current: rawCurrent, nowBefore, labels: overrides, className, stepClassName, whenClassName, markerClassName, titleClassName, contentClassName, actionsClassName, nowClassName, }: TimelineProps): import("react/jsx-runtime").JSX.Element | null;
86
+ export { Timeline };
@@ -0,0 +1,217 @@
1
+ "use client";
2
+ import { jsx as t, jsxs as o } from "react/jsx-runtime";
3
+ import R from "react";
4
+ import { cn as s } from "../../../lib/utils.js";
5
+ import { withLabels as S } from "../../../lib/labels.js";
6
+ import { stepMarkerClass as E } from "../../../internal/step-marker.js";
7
+ import { StepCheck as F } from "../../../internal/step-check.js";
8
+ const G = {
9
+ done: "done",
10
+ number: (e) => String(e),
11
+ now: "Now"
12
+ }, W = {
13
+ whenActions: {
14
+ grid: "rst:@[40rem]:grid-cols-[fit-content(12rem)_minmax(2rem,max-content)_minmax(0,1fr)_auto]",
15
+ when: "rst:@[40rem]:col-start-1",
16
+ marker: "rst:@[40rem]:col-start-2",
17
+ body: "rst:@[40rem]:col-start-3",
18
+ actions: "rst:@[40rem]:col-start-4"
19
+ },
20
+ when: {
21
+ grid: "rst:@[40rem]:grid-cols-[fit-content(12rem)_minmax(2rem,max-content)_minmax(0,1fr)]",
22
+ when: "rst:@[40rem]:col-start-1",
23
+ marker: "rst:@[40rem]:col-start-2",
24
+ body: "rst:@[40rem]:col-start-3",
25
+ actions: ""
26
+ },
27
+ actions: {
28
+ grid: "rst:@[40rem]:grid-cols-[minmax(2rem,max-content)_minmax(0,1fr)_auto]",
29
+ when: "",
30
+ marker: "rst:@[40rem]:col-start-1",
31
+ body: "rst:@[40rem]:col-start-2",
32
+ actions: "rst:@[40rem]:col-start-3"
33
+ },
34
+ neither: {
35
+ grid: "",
36
+ when: "",
37
+ marker: "rst:@[40rem]:col-start-1",
38
+ body: "rst:@[40rem]:col-start-2",
39
+ actions: ""
40
+ }
41
+ };
42
+ function f({ reached: e, className: u }) {
43
+ return /* @__PURE__ */ t(
44
+ "span",
45
+ {
46
+ "aria-hidden": "true",
47
+ "data-timeline-rail": e ? "done" : "ahead",
48
+ className: s(
49
+ "rst:absolute rst:left-1/2 rst:w-0.5 rst:-translate-x-1/2",
50
+ e ? "rst:bg-(--roster-timeline-rail-done) rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]" : "rst:bg-(--roster-timeline-rail) rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[GrayText]",
51
+ u
52
+ )
53
+ }
54
+ );
55
+ }
56
+ function K({
57
+ steps: e,
58
+ label: u,
59
+ "aria-labelledby": x,
60
+ current: b = 0,
61
+ nowBefore: m,
62
+ labels: N,
63
+ className: y,
64
+ stepClassName: v,
65
+ whenClassName: k,
66
+ markerClassName: _,
67
+ titleClassName: j,
68
+ contentClassName: T,
69
+ actionsClassName: A,
70
+ nowClassName: M
71
+ }) {
72
+ const w = S(G, N), d = e.length;
73
+ if (d === 0) return null;
74
+ const i = Math.min(Math.max(0, Math.floor(Number.isFinite(b) ? b : 0)), d + 1), h = e.some((r) => r.when != null), g = e.some((r) => r.actions != null), n = W[h && g ? "whenActions" : h ? "when" : g ? "actions" : "neither"], z = m != null && m >= 1 && m <= d ? m : void 0, C = (r) => /* @__PURE__ */ o(
75
+ "li",
76
+ {
77
+ "aria-hidden": "true",
78
+ "data-timeline-now": "",
79
+ className: s("rst:col-span-full rst:grid rst:grid-cols-subgrid", M),
80
+ children: [
81
+ /* @__PURE__ */ t("span", { className: s("rst:relative rst:col-start-1 rst:row-start-1 rst:row-end-3 rst:@[40rem]:row-end-2", n.marker), children: r > 1 && /* @__PURE__ */ t(f, { reached: r <= i, className: "rst:inset-y-0" }) }),
82
+ /* @__PURE__ */ t(
83
+ "span",
84
+ {
85
+ className: s(
86
+ "rst:col-start-2 rst:row-start-1 rst:text-xs rst:font-semibold rst:uppercase rst:tracking-wider rst:text-(--roster-timeline-now) rst:forced-colors:text-[CanvasText]",
87
+ h ? "rst:@[40rem]:col-start-1 rst:@[40rem]:self-center" : n.body
88
+ ),
89
+ children: w.now
90
+ }
91
+ ),
92
+ /* @__PURE__ */ t(
93
+ "span",
94
+ {
95
+ className: s(
96
+ "rst:col-start-1 rst:col-end-[-1] rst:row-start-2 rst:my-2 rst:h-0.5 rst:bg-(--roster-timeline-now) rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[CanvasText]",
97
+ h && "rst:@[40rem]:col-start-2 rst:@[40rem]:row-start-1 rst:@[40rem]:self-center"
98
+ )
99
+ }
100
+ )
101
+ ]
102
+ },
103
+ "now"
104
+ );
105
+ return /* @__PURE__ */ t("div", { className: s("rst:font-ui rst:@container rst:w-full rst:min-w-0", y), "data-timeline": "", children: /* @__PURE__ */ t(
106
+ "ol",
107
+ {
108
+ "aria-label": x ? void 0 : u,
109
+ "aria-labelledby": x,
110
+ className: s(
111
+ "rst:m-0 rst:list-none rst:p-0 rst:grid rst:grid-cols-[minmax(2rem,max-content)_minmax(0,1fr)] rst:gap-x-3 rst:@[40rem]:gap-x-4",
112
+ n.grid
113
+ ),
114
+ children: e.map((r, L) => {
115
+ const a = L + 1, l = a < i ? "done" : a === i ? "current" : "upcoming", c = a === d, p = c ? "" : "rst:pb-6";
116
+ return /* @__PURE__ */ o(R.Fragment, { children: [
117
+ z === a && C(a),
118
+ /* @__PURE__ */ o(
119
+ "li",
120
+ {
121
+ "aria-current": l === "current" ? "step" : void 0,
122
+ "data-step": l,
123
+ className: s("rst:col-span-full rst:grid rst:grid-cols-subgrid", v),
124
+ children: [
125
+ r.when != null && /* @__PURE__ */ t(
126
+ "div",
127
+ {
128
+ "data-timeline-when": "",
129
+ className: s(
130
+ "rst:col-start-2 rst:row-start-1 rst:min-w-0 rst:pt-1.5 rst:text-sm rst:text-gray-600 rst:dark:text-gray-400",
131
+ "rst:@[40rem]:row-start-1",
132
+ n.when,
133
+ c ? "" : "rst:@[40rem]:pb-6",
134
+ k
135
+ ),
136
+ children: r.when
137
+ }
138
+ ),
139
+ /* @__PURE__ */ o(
140
+ "div",
141
+ {
142
+ "aria-hidden": "true",
143
+ "data-timeline-marker": "",
144
+ className: s(
145
+ "rst:relative rst:col-start-1 rst:row-start-1 rst:row-end-3 rst:flex rst:justify-center rst:@[40rem]:row-end-2",
146
+ n.marker,
147
+ p,
148
+ _
149
+ ),
150
+ children: [
151
+ a > 1 && /* @__PURE__ */ t(f, { reached: a <= i, className: "rst:top-0 rst:h-4" }),
152
+ !c && /* @__PURE__ */ t(f, { reached: a + 1 <= i, className: "rst:top-4 rst:bottom-0" }),
153
+ r.marker == null ? /* @__PURE__ */ t("span", { className: E(l), children: l === "done" ? /* @__PURE__ */ t(F, {}) : w.number(a) }) : r.marker === "hollow" ? /* @__PURE__ */ t(
154
+ "span",
155
+ {
156
+ className: "rst:relative rst:z-10 rst:block rst:size-8 rst:rounded-full rst:border-2 rst:border-(--roster-timeline-rail) rst:bg-[var(--roster-card-bg)] rst:forced-colors:border-[GrayText]",
157
+ "data-timeline-hollow": ""
158
+ }
159
+ ) : /* @__PURE__ */ t("span", { className: "rst:relative rst:z-10", children: r.marker })
160
+ ]
161
+ }
162
+ ),
163
+ /* @__PURE__ */ o("div", { className: s("rst:col-start-2 rst:row-start-2 rst:min-w-0 rst:@[40rem]:contents", p), children: [
164
+ /* @__PURE__ */ o(
165
+ "div",
166
+ {
167
+ "data-timeline-body": "",
168
+ className: s(
169
+ "rst:min-w-0 rst:@[40rem]:row-start-1 rst:@[40rem]:pt-1.5",
170
+ n.body,
171
+ r.when == null && "rst:pt-1.5",
172
+ c ? "" : "rst:@[40rem]:pb-6"
173
+ ),
174
+ children: [
175
+ /* @__PURE__ */ o(
176
+ "div",
177
+ {
178
+ className: s(
179
+ "rst:text-sm rst:text-[var(--roster-control-text)]",
180
+ l === "current" ? "rst:font-semibold" : "rst:font-medium",
181
+ j
182
+ ),
183
+ children: [
184
+ r.title,
185
+ l === "done" && /* @__PURE__ */ t("span", { className: "rst:sr-only", children: `, ${w.done}` })
186
+ ]
187
+ }
188
+ ),
189
+ r.content != null && /* @__PURE__ */ t("div", { className: s("rst:mt-0.5 rst:text-sm rst:text-gray-600 rst:dark:text-gray-400", T), children: r.content })
190
+ ]
191
+ }
192
+ ),
193
+ r.actions != null && /* @__PURE__ */ t(
194
+ "div",
195
+ {
196
+ "data-timeline-actions": "",
197
+ className: s(
198
+ "rst:mt-2 rst:flex rst:flex-wrap rst:gap-2 rst:@[40rem]:row-start-1 rst:@[40rem]:mt-0 rst:@[40rem]:justify-self-end rst:@[40rem]:justify-end",
199
+ n.actions,
200
+ c ? "" : "rst:@[40rem]:pb-6",
201
+ A
202
+ ),
203
+ children: r.actions
204
+ }
205
+ )
206
+ ] })
207
+ ]
208
+ }
209
+ )
210
+ ] }, r.id);
211
+ })
212
+ }
213
+ ) });
214
+ }
215
+ export {
216
+ K as Timeline
217
+ };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),j=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),w=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),o=require("../../../node_modules/class-variance-authority/dist/index.cjs"),s=require("../../../lib/utils.cjs"),N=require("../../../lib/labels.cjs"),_=require("../../../internal/page-inert.cjs"),q=require("../../../internal/key-focus.cjs"),a=require("../../../node_modules/@headlessui/react/dist/components/dialog/dialog.cjs"),d=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),F=o.cva("rst:relative rst:w-full rst:transform rst:overflow-hidden rst:rounded-2xl rst:p-6 rst:text-left rst:align-middle rst:elevation-overlay rst:transition-all rst:border",{variants:{size:{xs:"rst:max-w-xs",sm:"rst:max-w-sm",md:"rst:max-w-md",lg:"rst:max-w-lg",xl:"rst:max-w-xl","2xl":"rst:max-w-2xl","3xl":"rst:max-w-3xl",full:"rst:max-w-[95vw] rst:m-4"},variant:{white:"rst:bg-[var(--roster-popover-bg)] rst:border-[var(--roster-popover-border)] rst:text-[var(--roster-popover-text)]",slate:"rst:bg-gray-700 rst:border-gray-600 rst:text-gray-100 rst:dark:bg-gray-900 rst:dark:border-gray-800 rst:[--roster-ring:var(--roster-primary-400,#5ea3de)] rst:[--roster-ring-offset:var(--roster-gray-700,#44403c)] rst:dark:[--roster-ring-offset:var(--roster-gray-900,#1c1917)] rst:[--roster-control-text:var(--roster-gray-100,#f5f5f4)] rst:[--roster-control-border:var(--roster-gray-400,#a8a29e)] rst:[--roster-control-border-focus:var(--roster-primary-400,#5ea3de)]",primary:"rst:bg-primary-700 rst:border-primary-600 rst:text-primary-700-ink rst:dark:text-white rst:dark:bg-primary-950 rst:dark:border-primary-900 rst:[--roster-ring:var(--roster-primary-400,#5ea3de)] rst:[--roster-ring-offset:var(--roster-primary-700,#084063)] rst:dark:[--roster-ring-offset:var(--roster-primary-950,#021724)] rst:[--roster-control-text:var(--roster-gray-100,#f5f5f4)] rst:[--roster-control-border:var(--roster-gray-400,#a8a29e)] rst:[--roster-control-border-focus:var(--roster-primary-400,#5ea3de)]",glass:"rst:bg-white/80 rst:border-white/20 rst:backdrop-blur-xl rst:text-gray-900 rst:dark:bg-slate-900/80 rst:dark:border-slate-700/50 rst:dark:text-white"},status:{default:"",destructive:"rst:border-t-4 rst:border-t-error-500",success:"rst:border-t-4 rst:border-t-success-500"}},defaultVariants:{size:"md",variant:"white",status:"default"}}),T=o.cva("rst:text-xl rst:font-bold rst:leading-6 rst:text-inherit"),D=o.cva("rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75"),L=o.cva("rst:inline-flex rst:size-11 rst:shrink-0 rst:items-center rst:justify-center rst:-m-3 rst:cursor-pointer rst:rounded-md rst:bg-transparent rst:text-inherit rst:opacity-50 rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background rst:transition-opacity"),V={close:"Close dialog"},z=({isOpen:u,onClose:i,title:m,description:n,size:x,variant:l,status:b,children:g,className:f,onAfterClose:v,labels:p})=>{q.useKeyFocus();const y=N.withLabels(V,p),[h,k]=t.useState(!1);t.useLayoutEffect(()=>{k(!0)},[]);const e=u&&h,c=t.useRef(null);return t.useLayoutEffect(()=>{if(e)return _.lockPage(c.current)},[e]),r.jsxs(r.Fragment,{children:[e&&r.jsx("span",{ref:c,hidden:!0}),r.jsxs(a.Dialog,{open:e,as:"div",className:"rst:font-ui rst:relative rst:z-50",onClose:i,children:[r.jsx(d.TransitionChild,{as:t.Fragment,enter:"rst:ease-out rst:duration-300",enterFrom:"rst:opacity-0",enterTo:"rst:opacity-100",leave:"rst:ease-in rst:duration-200",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:r.jsx(a.DialogBackdrop,{className:s.cn("rst:fixed rst:inset-0 rst:transition-opacity",l==="glass"?"rst:bg-[var(--roster-backdrop,color-mix(in_oklab,oklch(20.8%_0.042_265.755)_40%,transparent))] rst:dark:bg-[var(--roster-backdrop,color-mix(in_oklab,var(--roster-black,#1e1c1a)_60%,transparent))]":"rst:bg-[var(--roster-backdrop,color-mix(in_oklab,oklch(20.8%_0.042_265.755)_60%,transparent))] rst:dark:bg-[var(--roster-backdrop,color-mix(in_oklab,var(--roster-black,#1e1c1a)_80%,transparent))] rst:backdrop-blur-backdrop")})}),r.jsx("div",{className:"rst:fixed rst:inset-0 rst:overflow-y-auto",children:r.jsx("div",{className:"rst:flex rst:min-h-full rst:items-center rst:justify-center rst:p-4 rst:text-center",children:r.jsx(d.TransitionChild,{as:t.Fragment,enter:"rst:ease-out rst:duration-300",enterFrom:"rst:opacity-0 rst:scale-95",enterTo:"rst:opacity-100 rst:scale-100",leave:"rst:ease-in rst:duration-200",leaveFrom:"rst:opacity-100 rst:scale-100",leaveTo:"rst:opacity-0 rst:scale-95",afterLeave:v,children:r.jsxs(a.DialogPanel,{className:s.cn(F({size:x,variant:l,status:b}),f),children:[r.jsxs("div",{className:"rst:flex rst:items-start rst:justify-between",children:[r.jsxs("div",{children:[r.jsx(a.DialogTitle,{as:"h2",className:s.cn(T()),children:m}),n&&r.jsx("p",{className:s.cn(D()),children:n})]}),r.jsx("div",{className:"rst:ml-4 rst:flex rst:shrink-0",children:r.jsx("button",{type:"button",onClick:i,className:s.cn(L()),"aria-label":y.close,children:r.jsx(j.FontAwesomeIcon,{icon:w.faXmark,className:"rst:h-5 rst:w-5"})})})]}),r.jsx("div",{className:"rst:mt-6",children:g})]})})})})]})]})};exports.Dialog=z;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),D=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),R=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),i=require("../../../node_modules/class-variance-authority/dist/index.cjs"),s=require("../../../lib/utils.cjs"),V=require("../../../lib/labels.cjs"),E=require("../../../internal/page-inert.cjs"),S=require("../../../internal/leave-watchdog.cjs"),z=require("../../../internal/key-focus.cjs"),e=require("../../../node_modules/@headlessui/react/dist/components/dialog/dialog.cjs"),c=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),C=i.cva("rst:relative rst:w-full rst:transform rst:overflow-hidden rst:rounded-2xl rst:p-6 rst:text-left rst:align-middle rst:elevation-overlay rst:transition-all rst:border",{variants:{size:{xs:"rst:max-w-xs",sm:"rst:max-w-sm",md:"rst:max-w-md",lg:"rst:max-w-lg",xl:"rst:max-w-xl","2xl":"rst:max-w-2xl","3xl":"rst:max-w-3xl",full:"rst:max-w-[95vw] rst:m-4"},variant:{white:"rst:bg-[var(--roster-popover-bg)] rst:border-[var(--roster-popover-border)] rst:text-[var(--roster-popover-text)]",slate:"rst:bg-gray-700 rst:border-gray-600 rst:text-gray-100 rst:dark:bg-gray-900 rst:dark:border-gray-800 rst:[--roster-ring:var(--roster-primary-400,#5ea3de)] rst:[--roster-ring-offset:var(--roster-gray-700,#44403c)] rst:dark:[--roster-ring-offset:var(--roster-gray-900,#1c1917)] rst:[--roster-control-text:var(--roster-gray-100,#f5f5f4)] rst:[--roster-control-border:var(--roster-gray-400,#a8a29e)] rst:[--roster-control-border-focus:var(--roster-primary-400,#5ea3de)]",primary:"rst:bg-primary-700 rst:border-primary-600 rst:text-primary-700-ink rst:dark:text-white rst:dark:bg-primary-950 rst:dark:border-primary-900 rst:[--roster-ring:var(--roster-primary-400,#5ea3de)] rst:[--roster-ring-offset:var(--roster-primary-700,#084063)] rst:dark:[--roster-ring-offset:var(--roster-primary-950,#021724)] rst:[--roster-control-text:var(--roster-gray-100,#f5f5f4)] rst:[--roster-control-border:var(--roster-gray-400,#a8a29e)] rst:[--roster-control-border-focus:var(--roster-primary-400,#5ea3de)]",glass:"rst:bg-white/80 rst:border-white/20 rst:backdrop-blur-xl rst:text-gray-900 rst:dark:bg-slate-900/80 rst:dark:border-slate-700/50 rst:dark:text-white"},status:{default:"",destructive:"rst:border-t-4 rst:border-t-error-500",success:"rst:border-t-4 rst:border-t-success-500"}},defaultVariants:{size:"md",variant:"white",status:"default"}}),p=i.cva("rst:text-xl rst:font-bold rst:leading-6 rst:text-inherit"),y=i.cva("rst:mt-1 rst:text-sm rst:text-inherit rst:opacity-75"),P=i.cva("rst:inline-flex rst:size-11 rst:shrink-0 rst:items-center rst:justify-center rst:-m-3 rst:cursor-pointer rst:rounded-md rst:bg-transparent rst:text-inherit rst:opacity-50 rst:hover:opacity-100 rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background rst:transition-opacity"),A={close:"Close dialog"},M=200,B=({isOpen:h,onClose:d,title:u,description:o,size:k,variant:f,status:j,children:x,className:m,onAfterClose:w,labels:N,layout:F="default",titleHidden:v=!1})=>{z.useKeyFocus();const _=F==="fullscreen",q=V.withLabels(A,N),[T,L]=t.useState(!1);t.useLayoutEffect(()=>{L(!0)},[]);const a=h&&T,g=t.useRef(null),n=t.useRef(null),l=S.useLeaveWatchdog(g,n,a,M,w),b=t.useRef(null);return t.useLayoutEffect(()=>{if(a)return E.lockPage(b.current)},[a]),r.jsxs(r.Fragment,{children:[a&&r.jsx("span",{ref:b,hidden:!0}),r.jsxs(e.Dialog,{ref:g,open:a,as:"div",className:"rst:font-ui rst:fixed rst:inset-0 rst:z-50",onClose:d,children:[r.jsx(c.TransitionChild,{as:t.Fragment,enter:"rst:ease-out rst:duration-300",enterFrom:"rst:opacity-0",enterTo:"rst:opacity-100",leave:"rst:ease-in rst:duration-200",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:r.jsx(e.DialogBackdrop,{className:s.cn("rst:fixed rst:inset-0 rst:transition-opacity",f==="glass"?"rst:bg-[var(--roster-backdrop,color-mix(in_oklab,oklch(20.8%_0.042_265.755)_40%,transparent))] rst:dark:bg-[var(--roster-backdrop,color-mix(in_oklab,var(--roster-black,#1e1c1a)_60%,transparent))]":"rst:bg-[var(--roster-backdrop,color-mix(in_oklab,oklch(20.8%_0.042_265.755)_60%,transparent))] rst:dark:bg-[var(--roster-backdrop,color-mix(in_oklab,var(--roster-black,#1e1c1a)_80%,transparent))] rst:backdrop-blur-backdrop")})}),_?r.jsx(c.TransitionChild,{as:t.Fragment,enter:"rst:ease-out rst:duration-300",enterFrom:"rst:opacity-0",enterTo:"rst:opacity-100",leave:"rst:ease-in rst:duration-200",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",afterLeave:l.afterLeave,children:r.jsxs(e.DialogPanel,{ref:n,className:s.cn("rst:fixed rst:inset-0 rst:overflow-y-auto",m),children:[r.jsx(e.DialogTitle,{as:"h2",className:v?"rst:sr-only":s.cn(p()),children:u}),o&&r.jsx("p",{className:s.cn(y()),children:o}),x]})}):r.jsx("div",{className:"rst:fixed rst:inset-0 rst:overflow-y-auto",children:r.jsx("div",{className:"rst:flex rst:min-h-full rst:items-center rst:justify-center rst:p-4 rst:text-center",children:r.jsx(c.TransitionChild,{as:t.Fragment,enter:"rst:ease-out rst:duration-300",enterFrom:"rst:opacity-0 rst:scale-95",enterTo:"rst:opacity-100 rst:scale-100",leave:"rst:ease-in rst:duration-200",leaveFrom:"rst:opacity-100 rst:scale-100",leaveTo:"rst:opacity-0 rst:scale-95",afterLeave:l.afterLeave,children:r.jsxs(e.DialogPanel,{ref:n,className:s.cn(C({size:k,variant:f,status:j}),m),children:[r.jsxs("div",{className:"rst:flex rst:items-start rst:justify-between",children:[r.jsxs("div",{children:[r.jsx(e.DialogTitle,{as:"h2",className:v?"rst:sr-only":s.cn(p()),children:u}),o&&r.jsx("p",{className:s.cn(y()),children:o})]}),r.jsx("div",{className:"rst:ml-4 rst:flex rst:shrink-0",children:r.jsx("button",{type:"button",onClick:d,className:s.cn(P()),"aria-label":q.close,children:r.jsx(D.FontAwesomeIcon,{icon:R.faXmark,className:"rst:h-5 rst:w-5"})})})]}),r.jsx("div",{className:"rst:mt-6",children:x})]})})})})]},l.key)]})};exports.Dialog=B;
@@ -18,15 +18,67 @@ export interface DialogProps extends VariantProps<typeof dialogVariants> {
18
18
  children: ReactNode;
19
19
  className?: string;
20
20
  /**
21
- * Called once the dialog has finished closing, after its leave transition.
22
- * The place to move focus somewhere other than where it was before the
23
- * dialog opened, for instance when that element no longer exists. Not
24
- * called for a close cut short by reopening, nor when the dialog unmounts
25
- * while open.
21
+ * Called once the dialog has finished closing, after its leave transition,
22
+ * once for each close, a close during the entrance included. The place to
23
+ * move focus somewhere other than where it was before the dialog opened,
24
+ * for instance when that element no longer exists. Not called for a close
25
+ * cut short by reopening, nor when the dialog unmounts while open.
26
26
  */
27
27
  onAfterClose?: () => void;
28
28
  /** The component's own words, replaced; any left out stay English. */
29
29
  labels?: Partial<DialogLabels>;
30
+ /**
31
+ * `"default"`: a panel, sized by `size` and styled by `variant` and
32
+ * `status`, with Roster's header (the title, the description and a close
33
+ * button).
34
+ *
35
+ * `"fullscreen"`: the dialog fills the viewport, with no box, no padding,
36
+ * and no header or close button of Roster's: everything inside is yours, a
37
+ * close control included. For a photo viewer or a full-screen card. The
38
+ * scrim stays (`--roster-backdrop` retints it), `className` lands on the
39
+ * full-viewport panel, and it fades in and out without scaling. `size` and
40
+ * `status` don't apply; `variant` still picks the scrim. The whole viewport
41
+ * is the panel, so a click anywhere in it doesn't close the dialog: give it
42
+ * your own close, and use Headless UI's `autoFocus` on the element to focus
43
+ * first.
44
+ *
45
+ * Either way, focus moves in on open, Tab stays inside, Escape closes, focus
46
+ * goes back to what opened it, and the page behind is inert.
47
+ */
48
+ layout?: "default" | "fullscreen";
49
+ /**
50
+ * Keep the title as the dialog's accessible name, said by a screen reader
51
+ * when the dialog opens, without showing it: for a dialog whose content
52
+ * names itself, like a photo viewer. Works with either layout.
53
+ */
54
+ titleHidden?: boolean;
30
55
  }
31
- declare const Dialog: ({ isOpen, onClose, title, description, size, variant, status, children, className, onAfterClose, labels, }: DialogProps) => import("react/jsx-runtime").JSX.Element;
56
+ /**
57
+ * A modal dialog. Focus moves in when it opens, Tab stays inside, Escape and
58
+ * the close button close it, focus goes back to what opened it, and the page
59
+ * behind is inert and hidden from assistive technology.
60
+ *
61
+ * `layout="fullscreen"` with `titleHidden` is a bare dialog over the whole
62
+ * viewport, for a photo viewer or a full-screen card: the content and its
63
+ * controls are yours, and Roster keeps the focus, the keys and the page
64
+ * behind.
65
+ *
66
+ * ```tsx
67
+ * <Dialog isOpen={open} onClose={close} title="Photos" titleHidden layout="fullscreen">
68
+ * <div style={{ height: "100%", display: "grid", placeItems: "center" }}>
69
+ * <img src={photo.src} alt={photo.alt} />
70
+ * <p>{index + 1} of {photos.length}: {photo.caption}</p>
71
+ * <Button onClick={previous}>Previous</Button>
72
+ * <Button onClick={next}>Next</Button>
73
+ * <Button autoFocus onClick={close}>Close</Button>
74
+ * </div>
75
+ * </Dialog>
76
+ * ```
77
+ *
78
+ * **Where focus starts.** On the element marked `data-autofocus`, or a Roster
79
+ * `Button` given `autoFocus` (Headless UI reads both); with neither, on the
80
+ * dialog itself. In a photo viewer that's usually Close, or the photo's own
81
+ * region if it takes focus.
82
+ */
83
+ declare const Dialog: ({ isOpen, onClose, title, description, size, variant, status, children, className, onAfterClose, labels, layout, titleHidden, }: DialogProps) => import("react/jsx-runtime").JSX.Element;
32
84
  export { Dialog };