@blakesteve/roster 5.6.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.
Files changed (99) hide show
  1. package/README.md +190 -5
  2. package/dist/components/atoms/Avatar/Avatar.cjs +1 -1
  3. package/dist/components/atoms/Avatar/Avatar.d.ts +4 -0
  4. package/dist/components/atoms/Avatar/Avatar.js +1 -1
  5. package/dist/components/atoms/AvatarStrip/AvatarStrip.cjs +1 -1
  6. package/dist/components/atoms/AvatarStrip/AvatarStrip.d.ts +10 -1
  7. package/dist/components/atoms/AvatarStrip/AvatarStrip.js +34 -30
  8. package/dist/components/atoms/Button/button-variants.cjs +1 -1
  9. package/dist/components/atoms/Button/button-variants.js +5 -3
  10. package/dist/components/atoms/Eyebrow/eyebrow-variants.cjs +1 -1
  11. package/dist/components/atoms/Eyebrow/eyebrow-variants.js +8 -4
  12. package/dist/components/atoms/LoadingDots/LoadingDots.cjs +1 -0
  13. package/dist/components/atoms/LoadingDots/LoadingDots.d.ts +20 -0
  14. package/dist/components/atoms/LoadingDots/LoadingDots.js +43 -0
  15. package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
  16. package/dist/components/atoms/MultiSelect/MultiSelect.d.ts +3 -1
  17. package/dist/components/atoms/MultiSelect/MultiSelect.js +87 -89
  18. package/dist/components/atoms/Progress/Progress.cjs +1 -0
  19. package/dist/components/atoms/Progress/Progress.d.ts +62 -0
  20. package/dist/components/atoms/Progress/Progress.js +107 -0
  21. package/dist/components/atoms/Progress/progress-values.cjs +1 -0
  22. package/dist/components/atoms/Progress/progress-values.d.ts +26 -0
  23. package/dist/components/atoms/Progress/progress-values.js +12 -0
  24. package/dist/components/atoms/Skeleton/Skeleton.cjs +1 -0
  25. package/dist/components/atoms/Skeleton/Skeleton.d.ts +79 -0
  26. package/dist/components/atoms/Skeleton/Skeleton.js +80 -0
  27. package/dist/components/atoms/Stat/Stat.cjs +1 -1
  28. package/dist/components/atoms/Stat/Stat.js +19 -19
  29. package/dist/components/atoms/Stat/stat-variants.cjs +1 -1
  30. package/dist/components/atoms/Stat/stat-variants.d.ts +1 -0
  31. package/dist/components/atoms/Stat/stat-variants.js +10 -7
  32. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.cjs +1 -1
  33. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +10 -1
  34. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js +31 -29
  35. package/dist/components/molecules/CallToAction/CallToAction.cjs +1 -1
  36. package/dist/components/molecules/CallToAction/CallToAction.d.ts +8 -1
  37. package/dist/components/molecules/CallToAction/CallToAction.js +34 -29
  38. package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
  39. package/dist/components/molecules/Carousel/Carousel.d.ts +7 -0
  40. package/dist/components/molecules/Carousel/Carousel.js +155 -155
  41. package/dist/components/molecules/ErrorState/ErrorState.cjs +1 -1
  42. package/dist/components/molecules/ErrorState/ErrorState.d.ts +8 -1
  43. package/dist/components/molecules/ErrorState/ErrorState.js +44 -39
  44. package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
  45. package/dist/components/molecules/FileUpload/FileUpload.js +122 -142
  46. package/dist/components/molecules/MediaPreview/MediaPreview.cjs +1 -1
  47. package/dist/components/molecules/MediaPreview/MediaPreview.d.ts +3 -1
  48. package/dist/components/molecules/MediaPreview/MediaPreview.js +13 -12
  49. package/dist/components/molecules/Pagination/Pagination.cjs +1 -1
  50. package/dist/components/molecules/Pagination/Pagination.d.ts +1 -0
  51. package/dist/components/molecules/Pagination/Pagination.js +47 -46
  52. package/dist/components/molecules/ProgressField/ProgressField.cjs +1 -0
  53. package/dist/components/molecules/ProgressField/ProgressField.d.ts +24 -0
  54. package/dist/components/molecules/ProgressField/ProgressField.js +32 -0
  55. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -0
  56. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +55 -0
  57. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +45 -0
  58. package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -0
  59. package/dist/components/molecules/StepProgress/StepProgress.d.ts +37 -0
  60. package/dist/components/molecules/StepProgress/StepProgress.js +90 -0
  61. package/dist/components/organisms/Countdown/Countdown.cjs +1 -1
  62. package/dist/components/organisms/Countdown/Countdown.d.ts +13 -0
  63. package/dist/components/organisms/Countdown/Countdown.js +54 -47
  64. package/dist/components/organisms/DataTable/DataTable.cjs +1 -1
  65. package/dist/components/organisms/DataTable/DataTable.d.ts +5 -3
  66. package/dist/components/organisms/DataTable/DataTable.js +27 -26
  67. package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
  68. package/dist/components/organisms/Dialog/Dialog.d.ts +9 -2
  69. package/dist/components/organisms/Dialog/Dialog.js +25 -23
  70. package/dist/components/organisms/Footer/Footer.cjs +1 -1
  71. package/dist/components/organisms/Footer/Footer.d.ts +9 -0
  72. package/dist/components/organisms/Footer/Footer.js +21 -23
  73. package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
  74. package/dist/components/organisms/ModerationQueue/ModerationQueue.d.ts +40 -1
  75. package/dist/components/organisms/ModerationQueue/ModerationQueue.js +262 -237
  76. package/dist/components/organisms/ModerationQueue/QueueEditDialog.cjs +1 -1
  77. package/dist/components/organisms/ModerationQueue/QueueEditDialog.d.ts +1 -1
  78. package/dist/components/organisms/ModerationQueue/QueueEditDialog.js +23 -21
  79. package/dist/components/organisms/ModerationQueue/QueueEditSheet.cjs +1 -1
  80. package/dist/components/organisms/ModerationQueue/QueueEditSheet.d.ts +1 -1
  81. package/dist/components/organisms/ModerationQueue/QueueEditSheet.js +22 -20
  82. package/dist/components/organisms/ModerationQueue/queue-actions.d.ts +29 -10
  83. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  84. package/dist/components/organisms/Navbar/Navbar.d.ts +38 -3
  85. package/dist/components/organisms/Navbar/Navbar.js +210 -187
  86. package/dist/components/organisms/Navbar/navbar-variants.cjs +1 -1
  87. package/dist/components/organisms/Navbar/navbar-variants.js +4 -2
  88. package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
  89. package/dist/components/organisms/Sheet/Sheet.d.ts +8 -1
  90. package/dist/components/organisms/Sheet/Sheet.js +65 -63
  91. package/dist/index.d.ts +6 -0
  92. package/dist/lib/labels.cjs +1 -0
  93. package/dist/lib/labels.d.ts +7 -0
  94. package/dist/lib/labels.js +12 -0
  95. package/dist/meta.json +3 -3
  96. package/dist/roster.cjs +1 -1
  97. package/dist/roster.css +1 -1
  98. package/dist/roster.js +174 -157
  99. package/package.json +1 -1
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
3
+ import { useState as l, useEffect as m } from "react";
4
+ import { cn as a } from "../../../lib/utils.js";
5
+ const u = [
6
+ { rest: "rst:opacity-100", delay: "0s" },
7
+ { rest: "rst:opacity-60", delay: "0.2s" },
8
+ { rest: "rst:opacity-30", delay: "0.4s" }
9
+ ];
10
+ function g({ label: s = "Loading", announce: r = !0, className: o }) {
11
+ const [i, n] = l("");
12
+ return m(() => {
13
+ const t = setTimeout(() => n(s), 50);
14
+ return () => clearTimeout(t);
15
+ }, [s]), /* @__PURE__ */ c(
16
+ "span",
17
+ {
18
+ role: r ? "status" : void 0,
19
+ className: a("rst:inline-flex rst:items-center rst:gap-[0.25em] rst:align-middle", o),
20
+ "data-loading-dots": "",
21
+ children: [
22
+ u.map((t, d) => /* @__PURE__ */ e(
23
+ "span",
24
+ {
25
+ "aria-hidden": "true",
26
+ className: a(
27
+ "rst:block rst:h-[0.4em] rst:w-[0.4em] rst:rounded-full rst:bg-current rst:animate-dot",
28
+ /* Forced colors drop backgrounds; these keep the text's color. */
29
+ "rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[CanvasText]",
30
+ t.rest
31
+ ),
32
+ style: { animationDelay: t.delay, animationFillMode: "backwards" }
33
+ },
34
+ d
35
+ )),
36
+ /* @__PURE__ */ e("span", { className: "rst:sr-only", children: r ? i : s })
37
+ ]
38
+ }
39
+ );
40
+ }
41
+ export {
42
+ g as LoadingDots
43
+ };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),S=require("react"),Y=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),W=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),X=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),h=require("../../../node_modules/@headlessui/react/dist/components/listbox/listbox.cjs"),G=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),T=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),F=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),s=require("../../../lib/utils.cjs"),R=require("../../../internal/field-invalid.cjs"),J=require("../Select/select-variants.cjs"),_=require("../Chip/Chip.cjs"),K=require("../../../internal/PopupOption.cjs"),c=require("../../../internal/popup.cjs"),Q=({options:x,value:n,onChange:m,placeholder:v="Select options",disabled:a=!1,variant:f,size:i,error:L,className:D,triggerClassName:A,optionsClassName:E,helperText:b,errorMessage:p,label:g,display:u="chips",maxChips:N,clearable:j=!1,chipColorScheme:w="neutral",chipVariant:k="outline",clearLabel:U="Clear selection",removeLabel:$=l=>`Remove ${l}`,...I})=>{const l=!!p||L,C=R.isFieldInvalid(l,I),V=R.withoutInvalidProps(I),o=n.length>0,P=new Map(x.map((r,e)=>[r.value,e])),d=n.map(r=>({value:r,label:x.find(e=>e.value===r)?.label??String(r)})).sort((r,e)=>(P.get(r.value)??Number.POSITIVE_INFINITY)-(P.get(e.value)??Number.POSITIVE_INFINITY)),y=N===void 0?d:d.slice(0,N),q=d.length-y.length,{ref:B,inDarkScope:H}=c.useDarkScope(),O=S.useRef(null);return t.jsxs(W.Field,{disabled:a,className:s.cn("rst:flex rst:flex-col rst:gap-1.5",D),...V,children:[g&&t.jsx(X.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:g}),t.jsx(h.Listbox,{value:n,onChange:m,disabled:a,multiple:!0,children:t.jsxs("div",{ref:B,className:"rst:relative",children:[t.jsxs("div",{className:s.cn(J.selectTriggerVariants({variant:f,size:i,error:l}),"rst:h-auto rst:flex-wrap rst:items-center rst:gap-1.5 rst:py-1.5",i==="sm"?"rst:min-h-9":i==="lg"?"rst:min-h-11":"rst:min-h-10",j&&o&&"rst:pr-16","rst:focus-within:ring-[length:calc(var(--roster-border-width,1px)+1px)] rst:focus-within:ring-ring",a&&"rst:opacity-50 rst:cursor-not-allowed",A),children:[t.jsx(h.ListboxButton,{ref:O,"aria-invalid":C||void 0,className:"rst:absolute rst:inset-0 rst:h-full rst:w-full rst:cursor-pointer rst:rounded-md rst:focus:outline-hidden rst:disabled:cursor-not-allowed",children:t.jsx("span",{className:"rst:sr-only",children:o?u==="count"?`${n.length} selected`:d.map(r=>r.label).join(", "):v})}),!o&&t.jsx("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate rst:text-gray-500 rst:dark:text-gray-400",children:v}),o&&u==="count"&&t.jsxs("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate",children:[n.length," selected"]}),o&&u==="chips"&&y.map((r,e)=>t.jsx(_.Chip,{size:"sm",variant:k,colorScheme:w,disabled:a,onRemove:()=>m(n.filter(M=>M!==r.value)),removeLabel:$(r.label),className:s.cn("rst:relative rst:max-w-[12rem] rst:pointer-events-none","rst:[&_button]:pointer-events-auto","rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70"),children:t.jsx("span",{className:"rst:block rst:truncate",children:r.label})},`${e}-${String(r.value)}`)),q>0&&u==="chips"&&t.jsxs(_.Chip,{size:"sm",variant:k,colorScheme:w,"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70",children:["+",q]}),t.jsx("span",{className:s.cn("rst:pointer-events-none rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:items-center",i==="sm"?"rst:pr-2.5":"rst:pr-3"),children:t.jsx(T.FontAwesomeIcon,{icon:F.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})}),j&&o&&t.jsx("button",{type:"button",disabled:a,onClick:()=>{m([]),O.current?.focus()},"aria-label":U,className:s.cn("rst:absolute rst:inset-y-0 rst:flex rst:w-6 rst:items-center rst:justify-center","rst:cursor-pointer rst:disabled:cursor-not-allowed","rst:text-current rst:opacity-70 rst:hover:opacity-100 rst:disabled:opacity-40","rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:rounded-sm",i==="sm"?"rst:right-7":"rst:right-8"),children:t.jsx(T.FontAwesomeIcon,{icon:F.faXmark,className:"rst:h-3.5 rst:w-3.5","aria-hidden":"true"})})]}),t.jsx(G.Transition,{as:S.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:t.jsx(h.ListboxOptions,{anchor:c.POPUP_ANCHOR,className:s.cn(c.popupInDarkPalette(H,f)&&"dark",c.POPUP_PANEL,c.POPUP_WIDTH_OF_BUTTON,E),children:x.map(r=>t.jsx(K.PopupOption,{as:h.ListboxOption,value:r.value,disabled:r.disabled,size:i,children:r.label},r.value))})})]})}),(b||p)&&t.jsx(Y.Description,{className:s.cn("rst:text-xs rst:text-left",l?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:p||b})]})};exports.MultiSelect=Q;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),T=require("react"),W=require("../../../node_modules/@headlessui/react/dist/components/description/description.cjs"),X=require("../../../node_modules/@headlessui/react/dist/components/field/field.cjs"),G=require("../../../node_modules/@headlessui/react/dist/components/label/label.cjs"),h=require("../../../node_modules/@headlessui/react/dist/components/listbox/listbox.cjs"),J=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs"),F=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),R=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),n=require("../../../lib/utils.cjs"),_=require("../../../internal/field-invalid.cjs"),K=require("../Select/select-variants.cjs"),D=require("../Chip/Chip.cjs"),Q=require("../../../internal/PopupOption.cjs"),c=require("../../../internal/popup.cjs"),Z=({options:x,value:i,onChange:m,placeholder:v="Select options",disabled:l=!1,variant:f,size:o,error:L,className:A,triggerClassName:E,optionsClassName:U,helperText:b,errorMessage:p,label:g,display:u="chips",maxChips:N,clearable:j=!1,chipColorScheme:w="neutral",chipVariant:k="outline",clearLabel:$="Clear selection",removeLabel:C=e=>`Remove ${e}`,countLabel:I=e=>`${e} selected`,...P})=>{const e=!!p||L,V=_.isFieldInvalid(e,P),B=_.withoutInvalidProps(P),a=i.length>0,y=new Map(x.map((r,s)=>[r.value,s])),d=i.map(r=>({value:r,label:x.find(s=>s.value===r)?.label??String(r)})).sort((r,s)=>(y.get(r.value)??Number.POSITIVE_INFINITY)-(y.get(s.value)??Number.POSITIVE_INFINITY)),q=N===void 0?d:d.slice(0,N),O=d.length-q.length,{ref:H,inDarkScope:M}=c.useDarkScope(),S=T.useRef(null);return t.jsxs(X.Field,{disabled:l,className:n.cn("rst:flex rst:flex-col rst:gap-1.5",A),...B,children:[g&&t.jsx(G.Label,{className:"rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left",children:g}),t.jsx(h.Listbox,{value:i,onChange:m,disabled:l,multiple:!0,children:t.jsxs("div",{ref:H,className:"rst:relative",children:[t.jsxs("div",{className:n.cn(K.selectTriggerVariants({variant:f,size:o,error:e}),"rst:h-auto rst:flex-wrap rst:items-center rst:gap-1.5 rst:py-1.5",o==="sm"?"rst:min-h-9":o==="lg"?"rst:min-h-11":"rst:min-h-10",j&&a&&"rst:pr-16","rst:focus-within:ring-[length:calc(var(--roster-border-width,1px)+1px)] rst:focus-within:ring-ring",l&&"rst:opacity-50 rst:cursor-not-allowed",E),children:[t.jsx(h.ListboxButton,{ref:S,"aria-invalid":V||void 0,className:"rst:absolute rst:inset-0 rst:h-full rst:w-full rst:cursor-pointer rst:rounded-md rst:focus:outline-hidden rst:disabled:cursor-not-allowed",children:t.jsx("span",{className:"rst:sr-only",children:a?u==="count"?I(i.length):d.map(r=>r.label).join(", "):v})}),!a&&t.jsx("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate rst:text-gray-500 rst:dark:text-gray-400",children:v}),a&&u==="count"&&t.jsx("span",{"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:block rst:truncate",children:I(i.length)}),a&&u==="chips"&&q.map((r,s)=>t.jsx(D.Chip,{size:"sm",variant:k,colorScheme:w,disabled:l,onRemove:()=>m(i.filter(Y=>Y!==r.value)),removeLabel:C(r.label),className:n.cn("rst:relative rst:max-w-[12rem] rst:pointer-events-none","rst:[&_button]:pointer-events-auto","rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70"),children:t.jsx("span",{className:"rst:block rst:truncate",children:r.label})},`${s}-${String(r.value)}`)),O>0&&u==="chips"&&t.jsxs(D.Chip,{size:"sm",variant:k,colorScheme:w,"aria-hidden":"true",className:"rst:pointer-events-none rst:relative rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70",children:["+",O]}),t.jsx("span",{className:n.cn("rst:pointer-events-none rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:items-center",o==="sm"?"rst:pr-2.5":"rst:pr-3"),children:t.jsx(F.FontAwesomeIcon,{icon:R.faChevronDown,className:"rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500","aria-hidden":"true"})}),j&&a&&t.jsx("button",{type:"button",disabled:l,onClick:()=>{m([]),S.current?.focus()},"aria-label":$,className:n.cn("rst:absolute rst:inset-y-0 rst:flex rst:w-6 rst:items-center rst:justify-center","rst:cursor-pointer rst:disabled:cursor-not-allowed","rst:text-current rst:opacity-70 rst:hover:opacity-100 rst:disabled:opacity-40","rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:rounded-sm",o==="sm"?"rst:right-7":"rst:right-8"),children:t.jsx(F.FontAwesomeIcon,{icon:R.faXmark,className:"rst:h-3.5 rst:w-3.5","aria-hidden":"true"})})]}),t.jsx(J.Transition,{as:T.Fragment,leave:"rst:transition rst:ease-in rst:duration-100",leaveFrom:"rst:opacity-100",leaveTo:"rst:opacity-0",children:t.jsx(h.ListboxOptions,{anchor:c.POPUP_ANCHOR,className:n.cn(c.popupInDarkPalette(M,f)&&"dark",c.POPUP_PANEL,c.POPUP_WIDTH_OF_BUTTON,U),children:x.map(r=>t.jsx(Q.PopupOption,{as:h.ListboxOption,value:r.value,disabled:r.disabled,size:o,children:r.label},r.value))})})]})}),(b||p)&&t.jsx(W.Description,{className:n.cn("rst:text-xs rst:text-left",e?"rst:text-error-600 rst:dark:text-error-400 rst:font-medium":"rst:text-gray-500 rst:dark:text-gray-400"),children:p||b})]})};exports.MultiSelect=Z;
@@ -70,6 +70,8 @@ export interface MultiSelectProps extends Omit<React.HTMLAttributes<HTMLDivEleme
70
70
  * tell apart, so this takes the label rather than being a constant.
71
71
  */
72
72
  removeLabel?: (label: string) => string;
73
+ /** With `display="count"`, how many are chosen: "3 selected". Shown, and said. */
74
+ countLabel?: (count: number) => string;
73
75
  }
74
- declare const MultiSelect: ({ options, value, onChange, placeholder, disabled, variant, size, error, className, triggerClassName, optionsClassName, helperText, errorMessage, label, display, maxChips, clearable, chipColorScheme, chipVariant, clearLabel, removeLabel, ...props }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
76
+ declare const MultiSelect: ({ options, value, onChange, placeholder, disabled, variant, size, error, className, triggerClassName, optionsClassName, helperText, errorMessage, label, display, maxChips, clearable, chipColorScheme, chipVariant, clearLabel, removeLabel, countLabel, ...props }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
75
77
  export { MultiSelect };
@@ -1,65 +1,66 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
3
- import H, { Fragment as V } from "react";
4
- import { Description as W } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
5
- import { Field as Y } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
6
- import { Label as C } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
7
- import { Listbox as K, ListboxButton as X, ListboxOptions as Z, ListboxOption as q } from "../../../node_modules/@headlessui/react/dist/components/listbox/listbox.js";
8
- import { Transition as G } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
9
- import { FontAwesomeIcon as _ } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
10
- import { faChevronDown as J, faXmark as Q } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
11
- import { cn as s } from "../../../lib/utils.js";
12
- import { isFieldInvalid as z, withoutInvalidProps as tt } from "../../../internal/field-invalid.js";
13
- import { selectTriggerVariants as rt } from "../Select/select-variants.js";
14
- import { Chip as T } from "../Chip/Chip.js";
15
- import { PopupOption as et } from "../../../internal/PopupOption.js";
16
- import { useDarkScope as st, POPUP_ANCHOR as nt, POPUP_WIDTH_OF_BUTTON as ot, POPUP_PANEL as at, popupInDarkPalette as it } from "../../../internal/popup.js";
17
- const It = ({
2
+ import { jsxs as d, jsx as r } from "react/jsx-runtime";
3
+ import V, { Fragment as W } from "react";
4
+ import { Description as Y } from "../../../node_modules/@headlessui/react/dist/components/description/description.js";
5
+ import { Field as C } from "../../../node_modules/@headlessui/react/dist/components/field/field.js";
6
+ import { Label as K } from "../../../node_modules/@headlessui/react/dist/components/label/label.js";
7
+ import { Listbox as X, ListboxButton as Z, ListboxOptions as q, ListboxOption as G } from "../../../node_modules/@headlessui/react/dist/components/listbox/listbox.js";
8
+ import { Transition as J } from "../../../node_modules/@headlessui/react/dist/components/transition/transition.js";
9
+ import { FontAwesomeIcon as T } from "../../../node_modules/@fortawesome/react-fontawesome/dist/index.js";
10
+ import { faChevronDown as Q, faXmark as z } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
11
+ import { cn as n } from "../../../lib/utils.js";
12
+ import { isFieldInvalid as tt, withoutInvalidProps as rt } from "../../../internal/field-invalid.js";
13
+ import { selectTriggerVariants as et } from "../Select/select-variants.js";
14
+ import { Chip as F } from "../Chip/Chip.js";
15
+ import { PopupOption as st } from "../../../internal/PopupOption.js";
16
+ import { useDarkScope as nt, POPUP_ANCHOR as ot, POPUP_WIDTH_OF_BUTTON as it, POPUP_PANEL as at, popupInDarkPalette as lt } from "../../../internal/popup.js";
17
+ const Pt = ({
18
18
  options: u,
19
- value: n,
19
+ value: o,
20
20
  onChange: p,
21
21
  placeholder: f = "Select options",
22
- disabled: i = !1,
22
+ disabled: l = !1,
23
23
  variant: v,
24
- size: o,
25
- error: F,
26
- className: L,
27
- triggerClassName: R,
28
- optionsClassName: D,
24
+ size: i,
25
+ error: R,
26
+ className: D,
27
+ triggerClassName: L,
28
+ optionsClassName: j,
29
29
  helperText: x,
30
30
  errorMessage: h,
31
31
  label: b,
32
- display: m = "chips",
32
+ display: c = "chips",
33
33
  maxChips: g,
34
34
  clearable: N = !1,
35
35
  chipColorScheme: k = "neutral",
36
36
  chipVariant: w = "outline",
37
- clearLabel: j = "Clear selection",
38
- removeLabel: E = (l) => `Remove ${l}`,
39
- ...I
37
+ clearLabel: E = "Clear selection",
38
+ removeLabel: U = (e) => `Remove ${e}`,
39
+ countLabel: I = (e) => `${e} selected`,
40
+ ...P
40
41
  }) => {
41
- const l = !!h || F, U = z(l, I), $ = tt(I), a = n.length > 0, P = new Map(u.map((t, e) => [t.value, e])), d = n.map((t) => ({
42
+ const e = !!h || R, $ = tt(e, P), A = rt(P), a = o.length > 0, y = new Map(u.map((t, s) => [t.value, s])), m = o.map((t) => ({
42
43
  value: t,
43
- label: u.find((e) => e.value === t)?.label ?? String(t)
44
+ label: u.find((s) => s.value === t)?.label ?? String(t)
44
45
  })).sort(
45
- (t, e) => (P.get(t.value) ?? Number.POSITIVE_INFINITY) - (P.get(e.value) ?? Number.POSITIVE_INFINITY)
46
- ), y = g === void 0 ? d : d.slice(0, g), O = d.length - y.length, { ref: A, inDarkScope: B } = st(), S = H.useRef(null);
47
- return /* @__PURE__ */ c(
48
- Y,
46
+ (t, s) => (y.get(t.value) ?? Number.POSITIVE_INFINITY) - (y.get(s.value) ?? Number.POSITIVE_INFINITY)
47
+ ), O = g === void 0 ? m : m.slice(0, g), S = m.length - O.length, { ref: B, inDarkScope: M } = nt(), _ = V.useRef(null);
48
+ return /* @__PURE__ */ d(
49
+ C,
49
50
  {
50
- disabled: i,
51
- className: s("rst:flex rst:flex-col rst:gap-1.5", L),
52
- ...$,
51
+ disabled: l,
52
+ className: n("rst:flex rst:flex-col rst:gap-1.5", D),
53
+ ...A,
53
54
  children: [
54
- b && /* @__PURE__ */ r(C, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left", children: b }),
55
- /* @__PURE__ */ r(K, { value: n, onChange: p, disabled: i, multiple: !0, children: /* @__PURE__ */ c("div", { ref: A, className: "rst:relative", children: [
56
- /* @__PURE__ */ c(
55
+ b && /* @__PURE__ */ r(K, { className: "rst:block rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)] rst:text-left", children: b }),
56
+ /* @__PURE__ */ r(X, { value: o, onChange: p, disabled: l, multiple: !0, children: /* @__PURE__ */ d("div", { ref: B, className: "rst:relative", children: [
57
+ /* @__PURE__ */ d(
57
58
  "div",
58
59
  {
59
- className: s(
60
- rt({ variant: v, size: o, error: l }),
60
+ className: n(
61
+ et({ variant: v, size: i, error: e }),
61
62
  "rst:h-auto rst:flex-wrap rst:items-center rst:gap-1.5 rst:py-1.5",
62
- o === "sm" ? "rst:min-h-9" : o === "lg" ? "rst:min-h-11" : "rst:min-h-10",
63
+ i === "sm" ? "rst:min-h-9" : i === "lg" ? "rst:min-h-11" : "rst:min-h-10",
63
64
  N && a && "rst:pr-16",
64
65
  /* The ring is on the shell and fires from `focus-within`, because
65
66
  the element that actually takes focus is the invisible button
@@ -67,17 +68,17 @@ const It = ({
67
68
  control too: those are inside the field and should light it.
68
69
  One pixel heavier than the edge, as Select's trigger is. */
69
70
  "rst:focus-within:ring-[length:calc(var(--roster-border-width,1px)+1px)] rst:focus-within:ring-ring",
70
- i && "rst:opacity-50 rst:cursor-not-allowed",
71
- R
71
+ l && "rst:opacity-50 rst:cursor-not-allowed",
72
+ L
72
73
  ),
73
74
  children: [
74
75
  /* @__PURE__ */ r(
75
- X,
76
+ Z,
76
77
  {
77
- ref: S,
78
- "aria-invalid": U || void 0,
78
+ ref: _,
79
+ "aria-invalid": $ || void 0,
79
80
  className: "rst:absolute rst:inset-0 rst:h-full rst:w-full rst:cursor-pointer rst:rounded-md rst:focus:outline-hidden rst:disabled:cursor-not-allowed",
80
- children: /* @__PURE__ */ r("span", { className: "rst:sr-only", children: a ? m === "count" ? `${n.length} selected` : d.map((t) => t.label).join(", ") : f })
81
+ children: /* @__PURE__ */ r("span", { className: "rst:sr-only", children: a ? c === "count" ? I(o.length) : m.map((t) => t.label).join(", ") : f })
81
82
  }
82
83
  ),
83
84
  !a && /* @__PURE__ */ r(
@@ -88,37 +89,34 @@ const It = ({
88
89
  children: f
89
90
  }
90
91
  ),
91
- a && m === "count" && /* @__PURE__ */ c(
92
+ a && c === "count" && /* @__PURE__ */ r(
92
93
  "span",
93
94
  {
94
95
  "aria-hidden": "true",
95
96
  className: "rst:pointer-events-none rst:relative rst:block rst:truncate",
96
- children: [
97
- n.length,
98
- " selected"
99
- ]
97
+ children: I(o.length)
100
98
  }
101
99
  ),
102
- a && m === "chips" && y.map((t, e) => /* @__PURE__ */ r(
103
- T,
100
+ a && c === "chips" && O.map((t, s) => /* @__PURE__ */ r(
101
+ F,
104
102
  {
105
103
  size: "sm",
106
104
  variant: w,
107
105
  colorScheme: k,
108
- disabled: i,
109
- onRemove: () => p(n.filter((M) => M !== t.value)),
110
- removeLabel: E(t.label),
111
- className: s(
106
+ disabled: l,
107
+ onRemove: () => p(o.filter((H) => H !== t.value)),
108
+ removeLabel: U(t.label),
109
+ className: n(
112
110
  "rst:relative rst:max-w-[12rem] rst:pointer-events-none",
113
111
  "rst:[&_button]:pointer-events-auto",
114
112
  "rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70"
115
113
  ),
116
114
  children: /* @__PURE__ */ r("span", { className: "rst:block rst:truncate", children: t.label })
117
115
  },
118
- `${e}-${String(t.value)}`
116
+ `${s}-${String(t.value)}`
119
117
  )),
120
- O > 0 && m === "chips" && /* @__PURE__ */ c(
121
- T,
118
+ S > 0 && c === "chips" && /* @__PURE__ */ d(
119
+ F,
122
120
  {
123
121
  size: "sm",
124
122
  variant: w,
@@ -127,21 +125,21 @@ const It = ({
127
125
  className: "rst:pointer-events-none rst:relative rst:text-inherit rst:border-current/70 rst:dark:text-inherit rst:dark:border-current/70",
128
126
  children: [
129
127
  "+",
130
- O
128
+ S
131
129
  ]
132
130
  }
133
131
  ),
134
132
  /* @__PURE__ */ r(
135
133
  "span",
136
134
  {
137
- className: s(
135
+ className: n(
138
136
  "rst:pointer-events-none rst:absolute rst:inset-y-0 rst:right-0 rst:flex rst:items-center",
139
- o === "sm" ? "rst:pr-2.5" : "rst:pr-3"
137
+ i === "sm" ? "rst:pr-2.5" : "rst:pr-3"
140
138
  ),
141
139
  children: /* @__PURE__ */ r(
142
- _,
140
+ T,
143
141
  {
144
- icon: J,
142
+ icon: Q,
145
143
  className: "rst:h-3.5 rst:w-3.5 rst:text-gray-400 rst:dark:text-gray-500",
146
144
  "aria-hidden": "true"
147
145
  }
@@ -152,12 +150,12 @@ const It = ({
152
150
  "button",
153
151
  {
154
152
  type: "button",
155
- disabled: i,
153
+ disabled: l,
156
154
  onClick: () => {
157
- p([]), S.current?.focus();
155
+ p([]), _.current?.focus();
158
156
  },
159
- "aria-label": j,
160
- className: s(
157
+ "aria-label": E,
158
+ className: n(
161
159
  /* `w-6` is not decoration: WCAG 2.5.8 asks 24x24 CSS px and
162
160
  a bare 14px icon measured 20px wide. The spacing exception
163
161
  does not apply, because this sits inside the trigger's own
@@ -166,12 +164,12 @@ const It = ({
166
164
  "rst:cursor-pointer rst:disabled:cursor-not-allowed",
167
165
  "rst:text-current rst:opacity-70 rst:hover:opacity-100 rst:disabled:opacity-40",
168
166
  "rst:focus:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:rounded-sm",
169
- o === "sm" ? "rst:right-7" : "rst:right-8"
167
+ i === "sm" ? "rst:right-7" : "rst:right-8"
170
168
  ),
171
169
  children: /* @__PURE__ */ r(
172
- _,
170
+ T,
173
171
  {
174
- icon: Q,
172
+ icon: z,
175
173
  className: "rst:h-3.5 rst:w-3.5",
176
174
  "aria-hidden": "true"
177
175
  }
@@ -182,29 +180,29 @@ const It = ({
182
180
  }
183
181
  ),
184
182
  /* @__PURE__ */ r(
185
- G,
183
+ J,
186
184
  {
187
- as: V,
185
+ as: W,
188
186
  leave: "rst:transition rst:ease-in rst:duration-100",
189
187
  leaveFrom: "rst:opacity-100",
190
188
  leaveTo: "rst:opacity-0",
191
189
  children: /* @__PURE__ */ r(
192
- Z,
190
+ q,
193
191
  {
194
- anchor: nt,
195
- className: s(
196
- it(B, v) && "dark",
192
+ anchor: ot,
193
+ className: n(
194
+ lt(M, v) && "dark",
197
195
  at,
198
- ot,
199
- D
196
+ it,
197
+ j
200
198
  ),
201
199
  children: u.map((t) => /* @__PURE__ */ r(
202
- et,
200
+ st,
203
201
  {
204
- as: q,
202
+ as: G,
205
203
  value: t.value,
206
204
  disabled: t.disabled,
207
- size: o,
205
+ size: i,
208
206
  children: t.label
209
207
  },
210
208
  t.value
@@ -215,11 +213,11 @@ const It = ({
215
213
  )
216
214
  ] }) }),
217
215
  (x || h) && /* @__PURE__ */ r(
218
- W,
216
+ Y,
219
217
  {
220
- className: s(
218
+ className: n(
221
219
  "rst:text-xs rst:text-left",
222
- l ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400"
220
+ e ? "rst:text-error-600 rst:dark:text-error-400 rst:font-medium" : "rst:text-gray-500 rst:dark:text-gray-400"
223
221
  ),
224
222
  children: h || x
225
223
  }
@@ -229,5 +227,5 @@ const It = ({
229
227
  );
230
228
  };
231
229
  export {
232
- It as MultiSelect
230
+ Pt as MultiSelect
233
231
  };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),u=require("react"),c=require("../../../lib/utils.cjs"),G=require("../../../lib/labels.cjs"),H=require("./progress-values.cjs"),O={percent:r=>`${r}%`,count:(r,s)=>`${r} of ${s}`,indeterminate:"Loading",status:(r,s)=>r?`${r}: ${s}`:s},b={default:"rst:bg-primary-600 rst:dark:bg-primary-400",success:"rst:bg-success-600 rst:dark:bg-success-400",warning:"rst:bg-amber-700 rst:dark:bg-amber-400",error:"rst:bg-error-600 rst:dark:bg-error-400"},P={default:"rst:border-primary-600 rst:dark:border-primary-400",success:"rst:border-success-600 rst:dark:border-success-400",warning:"rst:border-amber-700 rst:dark:border-amber-400",error:"rst:border-error-600 rst:dark:border-error-400"},p="rst:bg-[var(--roster-skeleton)]",R="rst:forced-colors:outline-solid rst:forced-colors:outline-1",h="rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]",T={sm:"rst:h-1.5",md:"rst:h-2.5"};function V(r,s,t){const[m,n]=u.useState(r),e=u.useRef(r),l=u.useRef(Number.NEGATIVE_INFINITY),a=u.useRef(r);return u.useEffect(()=>{if(a.current=r,r===e.current)return;const f=t?0:Math.max(0,l.current+s-Date.now()),g=setTimeout(()=>{a.current!==e.current&&(l.current=Date.now(),e.current=a.current,n(a.current))},f);return()=>clearTimeout(g)},[r,s,t]),m}function _({value:r,max:s=100,variant:t="continuous",segments:m,status:n="default",size:e="md",rounded:l=!0,busy:a=!1,label:f,valueText:g,announce:j=!0,announceEvery:y=1500,labels:v,className:x}){const i=G.withLabels(O,v),{known:w,fraction:k,percent:I,states:L,done:E,applicable:S,complete:$}=H.progressValues({value:r,max:s,variant:t,segments:m}),q=g??(t==="segmented"?i.count(E,S):w?i.percent(I):i.indeterminate),F=$,A=V(i.status(f,q),y,F),N=a&&"rst:animate-pulse rst:motion-reduce:animate-none",C=t==="segmented"?o.jsx("div",{"aria-hidden":"true",className:c.cn("rst:flex rst:w-full",e==="sm"?"rst:gap-0.5":"rst:gap-1",T[e],N),"data-progress-track":"",children:L.map((d,D)=>o.jsx("span",{className:c.cn("rst:h-full rst:min-w-0 rst:flex-1",l?"rst:rounded-full":"rst:rounded-sm",d==="done"&&[b[n],h],d==="current"&&[p,"rst:border-2",P[n]],d==="remaining"&&[p,R],d==="na"&&"rst:border rst:border-dashed rst:border-gray-500 rst:dark:border-gray-400"),"data-segment":d},D))}):o.jsx("div",{"aria-hidden":"true",className:c.cn("rst:relative rst:w-full rst:overflow-hidden rst:rounded-full",T[e],p,R,N),"data-progress-track":"",children:w?o.jsx("div",{className:c.cn("rst:h-full rst:rounded-full rst:transition-[width] rst:motion-reduce:transition-none",b[n],h),style:{width:`${k*100}%`,minWidth:k>0?e==="sm"?"0.375rem":"0.625rem":void 0},"data-progress-fill":""}):o.jsx("div",{className:c.cn("rst:absolute rst:inset-y-0 rst:left-0 rst:w-[30%] rst:rounded-full rst:animate-progress-travel",b[n],h),"data-progress-fill":"indeterminate"})});return o.jsxs("div",{className:c.cn("rst:w-full",x),"data-progress":t,"data-status":n,children:[C,j&&o.jsx("span",{role:"status",className:"rst:sr-only","data-progress-status":"",children:A})]})}exports.Progress=_;
@@ -0,0 +1,62 @@
1
+ import { SegmentState } from './progress-values';
2
+ export type ProgressStatus = "default" | "success" | "warning" | "error";
3
+ /** A segment's state: finished, under way, still to come, or not part of this one. */
4
+ export type ProgressSegmentState = SegmentState;
5
+ /** Every word Progress says. Pass any of them in `labels` to replace it. */
6
+ export interface ProgressLabels {
7
+ /** A continuous value as said: "45%". */
8
+ percent: (percent: number) => string;
9
+ /** A segmented value as said: "3 of 8". Segments that don't apply aren't counted. */
10
+ count: (done: number, total: number) => string;
11
+ /** Said when there's no value to give. */
12
+ indeterminate: string;
13
+ /** The label and the value together: "Uploading photos: 45%". */
14
+ status: (label: string | undefined, value: string) => string;
15
+ }
16
+ export interface ProgressProps {
17
+ /**
18
+ * How far, from 0 to `max`. Leave it out for indeterminate: work under way
19
+ * with no figure, drawn as a pill crossing the track.
20
+ */
21
+ value?: number | null;
22
+ /** The whole: 100 by default; for segmented, the number of segments. */
23
+ max?: number;
24
+ /**
25
+ * - `"continuous"`: one filled track, for a fraction (bytes, percent).
26
+ * - `"segmented"`: one cell per unit, for a count of discrete things:
27
+ * "twelve of sixteen" reads without a number beside it.
28
+ */
29
+ variant?: "continuous" | "segmented";
30
+ /** Segmented: each segment's state, when there's more to say than done and not done. */
31
+ segments?: ProgressSegmentState[];
32
+ status?: ProgressStatus;
33
+ size?: "sm" | "md";
34
+ /** Segmented: round each cell into a capsule (the default), or keep them square. */
35
+ rounded?: boolean;
36
+ /**
37
+ * The value stands but work goes on (a server finishing what it was sent):
38
+ * the bar breathes in place. Stops under reduced motion.
39
+ */
40
+ busy?: boolean;
41
+ /** What's progressing, for the status a screen reader hears: "Uploading photos". */
42
+ label?: string;
43
+ /** The value as said, in place of the percent or the count: "3 of 8 files". */
44
+ valueText?: string;
45
+ /** Give the value to screen readers in a polite status region. Off when something else already says it. */
46
+ announce?: boolean;
47
+ /** The least time between two announcements, in milliseconds. */
48
+ announceEvery?: number;
49
+ /** The component's own words, replaced; any left out stay English. */
50
+ labels?: Partial<ProgressLabels>;
51
+ className?: string;
52
+ }
53
+ /**
54
+ * How far through something is: a continuous bar, or a segmented one.
55
+ *
56
+ * The bar is a picture and is hidden from screen readers; a status region
57
+ * beside it carries the value as text, because a changed `aria-label` isn't
58
+ * reliably announced and a `progressbar` may beep or speak on every update.
59
+ * Most screens want ProgressField, which adds a visible label and value.
60
+ */
61
+ declare function Progress({ value, max, variant, segments, status, size, rounded, busy, label, valueText: valueOverride, announce, announceEvery, labels: overrides, className, }: ProgressProps): import("react/jsx-runtime").JSX.Element;
62
+ export { Progress };
@@ -0,0 +1,107 @@
1
+ "use client";
2
+ import { jsx as a, jsxs as H } from "react/jsx-runtime";
3
+ import { useState as _, useRef as b, useEffect as K } from "react";
4
+ import { cn as d } from "../../../lib/utils.js";
5
+ import { withLabels as O } from "../../../lib/labels.js";
6
+ import { progressValues as V } from "./progress-values.js";
7
+ const B = {
8
+ percent: (r) => `${r}%`,
9
+ count: (r, s) => `${r} of ${s}`,
10
+ indeterminate: "Loading",
11
+ status: (r, s) => r ? `${r}: ${s}` : s
12
+ }, g = {
13
+ default: "rst:bg-primary-600 rst:dark:bg-primary-400",
14
+ success: "rst:bg-success-600 rst:dark:bg-success-400",
15
+ warning: "rst:bg-amber-700 rst:dark:bg-amber-400",
16
+ error: "rst:bg-error-600 rst:dark:bg-error-400"
17
+ }, M = {
18
+ default: "rst:border-primary-600 rst:dark:border-primary-400",
19
+ success: "rst:border-success-600 rst:dark:border-success-400",
20
+ warning: "rst:border-amber-700 rst:dark:border-amber-400",
21
+ error: "rst:border-error-600 rst:dark:border-error-400"
22
+ }, p = "rst:bg-[var(--roster-skeleton)]", T = "rst:forced-colors:outline-solid rst:forced-colors:outline-1", h = "rst:forced-colors:forced-color-adjust-none rst:forced-colors:bg-[Highlight]", y = { sm: "rst:h-1.5", md: "rst:h-2.5" };
23
+ function P(r, s, e) {
24
+ const [u, o] = _(r), t = b(r), l = b(Number.NEGATIVE_INFINITY), n = b(r);
25
+ return K(() => {
26
+ if (n.current = r, r === t.current) return;
27
+ const m = e ? 0 : Math.max(0, l.current + s - Date.now()), f = setTimeout(() => {
28
+ n.current !== t.current && (l.current = Date.now(), t.current = n.current, o(n.current));
29
+ }, m);
30
+ return () => clearTimeout(f);
31
+ }, [r, s, e]), u;
32
+ }
33
+ function U({
34
+ value: r,
35
+ max: s = 100,
36
+ variant: e = "continuous",
37
+ segments: u,
38
+ status: o = "default",
39
+ size: t = "md",
40
+ rounded: l = !0,
41
+ busy: n = !1,
42
+ label: m,
43
+ valueText: f,
44
+ announce: I = !0,
45
+ announceEvery: L = 1500,
46
+ labels: v,
47
+ className: E
48
+ }) {
49
+ const i = O(B, v), { known: w, fraction: k, percent: R, states: $, done: F, applicable: A, complete: C } = V({ value: r, max: s, variant: e, segments: u }), D = f ?? (e === "segmented" ? i.count(F, A) : w ? i.percent(R) : i.indeterminate), S = C, j = P(i.status(m, D), L, S), N = n && "rst:animate-pulse rst:motion-reduce:animate-none", x = e === "segmented" ? /* @__PURE__ */ a(
50
+ "div",
51
+ {
52
+ "aria-hidden": "true",
53
+ className: d("rst:flex rst:w-full", t === "sm" ? "rst:gap-0.5" : "rst:gap-1", y[t], N),
54
+ "data-progress-track": "",
55
+ children: $.map((c, G) => /* @__PURE__ */ a(
56
+ "span",
57
+ {
58
+ className: d(
59
+ "rst:h-full rst:min-w-0 rst:flex-1",
60
+ l ? "rst:rounded-full" : "rst:rounded-sm",
61
+ c === "done" && [g[o], h],
62
+ /* Under way: the track inside a border of the fill's color. */
63
+ c === "current" && [p, "rst:border-2", M[o]],
64
+ c === "remaining" && [p, T],
65
+ /* Not part of this one: a dashed outline, neither filled nor to
66
+ fill. Gray-500 on light and gray-400 on dark clear 3:1. */
67
+ c === "na" && "rst:border rst:border-dashed rst:border-gray-500 rst:dark:border-gray-400"
68
+ ),
69
+ "data-segment": c
70
+ },
71
+ G
72
+ ))
73
+ }
74
+ ) : /* @__PURE__ */ a(
75
+ "div",
76
+ {
77
+ "aria-hidden": "true",
78
+ className: d("rst:relative rst:w-full rst:overflow-hidden rst:rounded-full", y[t], p, T, N),
79
+ "data-progress-track": "",
80
+ children: w ? /* @__PURE__ */ a(
81
+ "div",
82
+ {
83
+ className: d(
84
+ "rst:h-full rst:rounded-full rst:transition-[width] rst:motion-reduce:transition-none",
85
+ g[o],
86
+ h
87
+ ),
88
+ style: { width: `${k * 100}%`, minWidth: k > 0 ? t === "sm" ? "0.375rem" : "0.625rem" : void 0 },
89
+ "data-progress-fill": ""
90
+ }
91
+ ) : /* @__PURE__ */ a(
92
+ "div",
93
+ {
94
+ className: d("rst:absolute rst:inset-y-0 rst:left-0 rst:w-[30%] rst:rounded-full rst:animate-progress-travel", g[o], h),
95
+ "data-progress-fill": "indeterminate"
96
+ }
97
+ )
98
+ }
99
+ );
100
+ return /* @__PURE__ */ H("div", { className: d("rst:w-full", E), "data-progress": e, "data-status": o, children: [
101
+ x,
102
+ I && /* @__PURE__ */ a("span", { role: "status", className: "rst:sr-only", "data-progress-status": "", children: j })
103
+ ] });
104
+ }
105
+ export {
106
+ U as Progress
107
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function u({value:t,max:c=100,variant:a="continuous",segments:h}){const s=Number.isFinite(c)?Math.max(0,c):100,e=t!=null&&Number.isFinite(t),n=e&&s>0?Math.min(1,Math.max(0,t/s)):0,m=n>=1?100:n<=0?0:Math.min(99,Math.max(1,Math.round(n*100))),r=a==="segmented"?h??Array.from({length:Math.floor(s)},(o,d)=>e&&d<Math.floor(t)?"done":"remaining"):[],l=r.filter(o=>o==="done").length,i=r.filter(o=>o!=="na").length,g=a==="segmented"?i>0&&l===i:e&&n>=1;return{known:e,fraction:n,percent:m,states:r,done:l,applicable:i,complete:g}}exports.progressValues=u;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The numbers a Progress shows and says, worked out once so the bar, the
3
+ * status and a ProgressField's visible value can't disagree.
4
+ */
5
+ export type SegmentState = "done" | "current" | "remaining" | "na";
6
+ export interface ProgressValues {
7
+ /** Whether there's a figure at all; without one, the bar is indeterminate. */
8
+ known: boolean;
9
+ /** 0 to 1. */
10
+ fraction: number;
11
+ /** The percent as said and shown: 1 to 99 while under way, never rounded to 0 or 100. */
12
+ percent: number;
13
+ /** Segmented: every segment's state. */
14
+ states: SegmentState[];
15
+ done: number;
16
+ /** Segments that count: all but `na`. */
17
+ applicable: number;
18
+ /** Nothing left: the value is at the whole, or every applicable segment is done. */
19
+ complete: boolean;
20
+ }
21
+ export declare function progressValues({ value, max, variant, segments, }: {
22
+ value?: number | null;
23
+ max?: number;
24
+ variant?: "continuous" | "segmented";
25
+ segments?: SegmentState[];
26
+ }): ProgressValues;
@@ -0,0 +1,12 @@
1
+ function f({
2
+ value: n,
3
+ max: c = 100,
4
+ variant: a = "continuous",
5
+ segments: m
6
+ }) {
7
+ const s = Number.isFinite(c) ? Math.max(0, c) : 100, o = n != null && Number.isFinite(n), t = o && s > 0 ? Math.min(1, Math.max(0, n / s)) : 0, l = t >= 1 ? 100 : t <= 0 ? 0 : Math.min(99, Math.max(1, Math.round(t * 100))), r = a === "segmented" ? m ?? Array.from({ length: Math.floor(s) }, (e, d) => o && d < Math.floor(n) ? "done" : "remaining") : [], h = r.filter((e) => e === "done").length, i = r.filter((e) => e !== "na").length, M = a === "segmented" ? i > 0 && h === i : o && t >= 1;
8
+ return { known: o, fraction: t, percent: l, states: r, done: h, applicable: i, complete: M };
9
+ }
10
+ export {
11
+ f as progressValues
12
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),x=require("react"),c=require("../../../lib/utils.cjs"),k={sm:"rst:text-xs",md:"rst:text-sm",lg:"rst:text-base",inherit:""},f={xs:"rst:h-6 rst:w-6",sm:"rst:h-8 rst:w-8",md:"rst:h-10 rst:w-10",lg:"rst:h-12 rst:w-12",xl:"rst:h-16 rst:w-16"},b={sm:"rst:rounded-sm",md:"rst:rounded-md",lg:"rst:rounded-lg",xl:"rst:rounded-xl",full:"rst:rounded-full"},h="rst:animate-skeleton rst:forced-colors:outline-solid rst:forced-colors:outline-1";function S({shape:s="line",size:r,lines:a=1,width:e,height:u,radius:i,className:l}){if(s==="circle"){const o=r&&r in f?r:"md";return t.jsx("span",{"aria-hidden":"true",className:c.cn("rst:block rst:shrink-0 rst:rounded-full rst:border rst:border-transparent",f[o],h,l),"data-skeleton":"circle"})}if(s==="block")return t.jsx("span",{"aria-hidden":"true",className:c.cn("rst:block rst:w-full",b[i??"lg"],h,l),style:{height:u??"8rem",width:e},"data-skeleton":"block"});const m=r&&r in k?r:"md",n=Math.max(1,Math.floor(a)),j=o=>{const d=o===n-1;return t.jsxs("span",{className:c.cn("rst:relative rst:block",n>1&&!d&&"rst:w-full"),style:{width:n>1?d?e??"60%":void 0:e},children:[" ",t.jsx("span",{className:c.cn("rst:absolute rst:inset-x-0 rst:top-1/2 rst:h-[0.7em] rst:-translate-y-1/2",b[i??"sm"],h)})]},o)};return t.jsx("span",{"aria-hidden":"true",className:c.cn("rst:block",k[m],l),"data-skeleton":"line",children:Array.from({length:n},(o,d)=>j(d))})}function g({loading:s,skeleton:r,label:a="Loading",announce:e=!0,children:u,className:i}){const[l,m]=x.useState("");return x.useEffect(()=>{const n=setTimeout(()=>m(s&&e?a:""),s?50:0);return()=>clearTimeout(n)},[s,a,e]),t.jsxs(t.Fragment,{children:[t.jsx("span",{role:"status",className:"rst:sr-only","data-skeleton-status":"",children:l}),t.jsx("div",{"aria-busy":s||void 0,className:i,"data-skeleton-region":s?"loading":"ready",children:s?t.jsx("div",{"aria-hidden":"true",children:r}):u})]})}exports.Skeleton=S;exports.SkeletonRegion=g;