@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.
Files changed (84) hide show
  1. package/README.md +84 -4
  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/MultiSelect/MultiSelect.cjs +1 -1
  13. package/dist/components/atoms/MultiSelect/MultiSelect.d.ts +3 -1
  14. package/dist/components/atoms/MultiSelect/MultiSelect.js +87 -89
  15. package/dist/components/atoms/Progress/Progress.cjs +1 -1
  16. package/dist/components/atoms/Progress/Progress.d.ts +1 -0
  17. package/dist/components/atoms/Progress/Progress.js +28 -27
  18. package/dist/components/atoms/Stat/Stat.cjs +1 -1
  19. package/dist/components/atoms/Stat/Stat.js +5 -5
  20. package/dist/components/atoms/Stat/stat-variants.cjs +1 -1
  21. package/dist/components/atoms/Stat/stat-variants.js +10 -8
  22. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.cjs +1 -1
  23. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +10 -1
  24. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js +31 -29
  25. package/dist/components/molecules/CallToAction/CallToAction.cjs +1 -1
  26. package/dist/components/molecules/CallToAction/CallToAction.d.ts +8 -1
  27. package/dist/components/molecules/CallToAction/CallToAction.js +34 -29
  28. package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
  29. package/dist/components/molecules/Carousel/Carousel.d.ts +7 -0
  30. package/dist/components/molecules/Carousel/Carousel.js +155 -155
  31. package/dist/components/molecules/ErrorState/ErrorState.cjs +1 -1
  32. package/dist/components/molecules/ErrorState/ErrorState.d.ts +8 -1
  33. package/dist/components/molecules/ErrorState/ErrorState.js +44 -39
  34. package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
  35. package/dist/components/molecules/FileUpload/FileUpload.js +23 -22
  36. package/dist/components/molecules/MediaPreview/MediaPreview.cjs +1 -1
  37. package/dist/components/molecules/MediaPreview/MediaPreview.d.ts +3 -1
  38. package/dist/components/molecules/MediaPreview/MediaPreview.js +13 -12
  39. package/dist/components/molecules/Pagination/Pagination.cjs +1 -1
  40. package/dist/components/molecules/Pagination/Pagination.d.ts +1 -0
  41. package/dist/components/molecules/Pagination/Pagination.js +47 -46
  42. package/dist/components/molecules/ProgressField/ProgressField.d.ts +1 -0
  43. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
  44. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +2 -2
  45. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +17 -17
  46. package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -1
  47. package/dist/components/molecules/StepProgress/StepProgress.d.ts +1 -0
  48. package/dist/components/molecules/StepProgress/StepProgress.js +9 -8
  49. package/dist/components/organisms/Countdown/Countdown.cjs +1 -1
  50. package/dist/components/organisms/Countdown/Countdown.d.ts +13 -0
  51. package/dist/components/organisms/Countdown/Countdown.js +54 -47
  52. package/dist/components/organisms/DataTable/DataTable.cjs +1 -1
  53. package/dist/components/organisms/DataTable/DataTable.d.ts +5 -3
  54. package/dist/components/organisms/DataTable/DataTable.js +27 -26
  55. package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
  56. package/dist/components/organisms/Dialog/Dialog.d.ts +8 -1
  57. package/dist/components/organisms/Dialog/Dialog.js +25 -23
  58. package/dist/components/organisms/Footer/Footer.cjs +1 -1
  59. package/dist/components/organisms/Footer/Footer.d.ts +9 -0
  60. package/dist/components/organisms/Footer/Footer.js +21 -23
  61. package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
  62. package/dist/components/organisms/ModerationQueue/ModerationQueue.d.ts +40 -1
  63. package/dist/components/organisms/ModerationQueue/ModerationQueue.js +262 -237
  64. package/dist/components/organisms/ModerationQueue/QueueEditDialog.cjs +1 -1
  65. package/dist/components/organisms/ModerationQueue/QueueEditDialog.d.ts +1 -1
  66. package/dist/components/organisms/ModerationQueue/QueueEditDialog.js +23 -21
  67. package/dist/components/organisms/ModerationQueue/QueueEditSheet.cjs +1 -1
  68. package/dist/components/organisms/ModerationQueue/QueueEditSheet.d.ts +1 -1
  69. package/dist/components/organisms/ModerationQueue/QueueEditSheet.js +22 -20
  70. package/dist/components/organisms/ModerationQueue/queue-actions.d.ts +29 -10
  71. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  72. package/dist/components/organisms/Navbar/Navbar.d.ts +38 -3
  73. package/dist/components/organisms/Navbar/Navbar.js +210 -187
  74. package/dist/components/organisms/Navbar/navbar-variants.cjs +1 -1
  75. package/dist/components/organisms/Navbar/navbar-variants.js +4 -2
  76. package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
  77. package/dist/components/organisms/Sheet/Sheet.d.ts +8 -1
  78. package/dist/components/organisms/Sheet/Sheet.js +65 -63
  79. package/dist/lib/labels.cjs +1 -0
  80. package/dist/lib/labels.d.ts +7 -0
  81. package/dist/lib/labels.js +12 -0
  82. package/dist/meta.json +3 -3
  83. package/dist/roster.css +1 -1
  84. package/package.json +1 -1
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("react"),p=require("../../../lib/utils.cjs"),H=require("../../atoms/Button/Button.cjs"),pt=require("../../atoms/Progress/Progress.cjs"),R=require("./file-rules.cjs"),gt={choose:"Choose photos",dropHint:"or drag them here",dropHere:"Drop to add them",queued:"Waiting",uploading:n=>n===null?"Uploading":`Uploading, ${n}%`,processing:"Finishing up",done:"Uploaded",failed:"Didn't upload.",rejected:"Not added.",remove:n=>`Remove ${n}`,retry:n=>`Try ${n} again`,wrongType:()=>"That type of file isn't accepted.",tooLarge:(n,d)=>`It's over ${R.formatBytes(d)}.`,tooMany:n=>`Only ${n} can be added.`,duplicate:()=>"It's already added.",uploadError:n=>n instanceof Error&&n.message?n.message:"Something went wrong.",size:R.formatBytes,added:n=>`${n} ${n===1?"photo":"photos"} added.`,progress:(n,d)=>`${n} of ${d} uploaded.`,failedNotice:(n,d)=>`${n} didn't upload. ${d}`,rejectedNotice:(n,d)=>`${n} wasn't added. ${d}`,removed:n=>`${n} removed.`};function ht({file:n,status:d}){const[q,M]=o.useState(!1),B=!q&&(n.type.startsWith("image/")||/\.(jpe?g|png|gif|webp|avif|heic|heif)$/i.test(n.name)),N=o.useCallback(L=>{if(!L)return;const w=URL.createObjectURL(n);return L.src=w,()=>URL.revokeObjectURL(w)},[n]),x="rst:h-14 rst:w-14 rst:shrink-0 rst:rounded-md rst:border rst:border-[var(--roster-card-border)]";return B?r.jsx("img",{ref:N,alt:"",onError:()=>M(!0),className:p.cn(x,"rst:object-cover",d==="rejected"&&"rst:opacity-50"),"data-file-thumb":"image"}):r.jsx("span",{"aria-hidden":"true",className:p.cn(x,"rst:flex rst:items-center rst:justify-center rst:text-gray-500 rst:dark:text-gray-400"),"data-file-thumb":"placeholder",children:r.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),r.jsx("circle",{cx:"9",cy:"10",r:"1.6"}),r.jsx("path",{d:"m21 15-4.2-4.2a1.6 1.6 0 0 0-2.3 0L7 18"})]})})}const W="rst:cursor-not-allowed rst:opacity-50",S={width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function xt({label:n,upload:d,onChange:q,accept:M="image/*",types:B,maxSize:N,maxFiles:x,validate:L,concurrency:w=3,helperText:E,errorMessage:T,disabled:i=!1,strings:Q,className:X}){const c={...gt,...Q},D=o.useId(),I=`${D}-label`,G=`${D}-help`,V=`${D}-error`,[U,Y]=o.useState([]),l=o.useRef(U),Z=o.useRef(0),m=o.useRef(new Map),F=o.useRef(null),_=o.useRef(null),g=o.useRef({upload:d,onChange:q,concurrency:w,t:c,pump:()=>{}}),[z,tt]=o.useState({text:"",n:0}),j=o.useRef([]),v=o.useRef(null),$=o.useCallback((t,s=!1)=>{s&&(j.current=j.current.filter(e=>!e.count)),j.current.push({text:t,count:s}),!v.current&&(v.current=setTimeout(()=>{v.current=null;const e=j.current.map(u=>u.text).join(" ");j.current=[],tt(u=>({text:e,n:u.n+1}))},0))},[]),O=o.useRef(null),[et,rt]=o.useState(0),J=t=>{O.current=t,rt(s=>s+1)};o.useLayoutEffect(()=>{const t=O.current;if(!t)return;O.current=null,(F.current?.querySelector(t)??F.current?.querySelector("[data-file-choose]"))?.focus()},[et]);const y=o.useCallback(t=>{l.current=t,Y(t),g.current.onChange?.(t)},[]),b=o.useCallback((t,s)=>{l.current.some(e=>e.id===t)&&y(l.current.map(e=>e.id===t?{...e,...s}:e))},[y]);function k(){const{concurrency:t}=g.current,s=l.current.filter(u=>u.status==="uploading"||u.status==="processing").length,e=l.current.filter(u=>u.status==="queued").slice(0,Math.max(0,Math.max(1,t)-s));for(const u of e)st(u)}function st(t){const s=new AbortController;m.current.set(t.id,s),b(t.id,{status:"uploading",progress:null,reason:void 0});const e=()=>!s.signal.aborted&&m.current.get(t.id)===s,u={onProgress:a=>{if(!e())return;const f=Math.round(Math.min(1,Math.max(0,Number.isFinite(a)?a:0))*100)/100,h=l.current.find(ft=>ft.id===t.id);h?.status==="uploading"&&h.progress!==f&&b(t.id,{progress:f})},onProcessing:()=>{e()&&b(t.id,{status:"processing"})},signal:s.signal};new Promise(a=>a(g.current.upload(t.file,u))).then(a=>{if(!e())return;m.current.delete(t.id),b(t.id,{status:"done",progress:1,result:a});const f=l.current.filter(h=>h.status!=="rejected");$(g.current.t.progress(f.filter(h=>h.status==="done").length,f.length),!0),k()},a=>{if(!e())return;m.current.delete(t.id);const f=g.current.t.uploadError(a);b(t.id,{status:"failed",reason:f}),$(g.current.t.failedNotice(t.file.name,f)),k()})}o.useLayoutEffect(()=>{g.current={upload:d,onChange:q,concurrency:w,t:c,pump:k}}),o.useEffect(()=>{const t=m.current;return l.current.some(e=>(e.status==="uploading"||e.status==="processing")&&!t.has(e.id))&&(y(l.current.map(e=>(e.status==="uploading"||e.status==="processing")&&!t.has(e.id)?{...e,status:"queued",progress:null}:e)),g.current.pump()),()=>{for(const e of t.values())e.abort();t.clear(),v.current&&clearTimeout(v.current),v.current=null,j.current=[]}},[y]);const nt=B??R.acceptList(M),at=(t,s)=>{if(s.some(u=>R.sameFile(u.file,t)))return c.duplicate(t);const e=L?.(t);if(e)return e;if(!R.matchesType(t,nt))return c.wrongType(t);if(N!==void 0&&t.size>N)return c.tooLarge(t,N);if(x!==void 0&&s.length>=x)return c.tooMany(x)},K=t=>{if(i||t.length===0)return;const s=l.current.filter(a=>a.status!=="rejected"),e=[];for(const a of t){const f=at(a,[...s,...e.filter(h=>h.status!=="rejected")]);e.push({id:`${D}-file-${Z.current++}`,file:a,status:f?"rejected":"queued",progress:null,reason:f})}y([...l.current,...e]);const u=e.filter(a=>a.status==="queued").length;u&&$(c.added(u));for(const a of e)a.reason&&$(c.rejectedNotice(a.file.name,a.reason));k()},ot=t=>{if(i)return;const s=l.current,e=s.findIndex(a=>a.id===t);if(e<0)return;m.current.get(t)?.abort(),m.current.delete(t);const u=s[e+1]??s[e-1];y(s.filter(a=>a.id!==t)),$(c.removed(s[e].file.name)),J(u?`[data-file-remove="${u.id}"]`:"[data-file-choose]"),k()},ct=t=>{i||(b(t,{status:"queued",progress:null,reason:void 0}),J(`[data-file-remove="${t}"]`),k())},[ut,P]=o.useState(0),C=t=>Array.from(t.dataTransfer?.types??[]).includes("Files"),it={onDragEnter:t=>{C(t)&&(t.preventDefault(),P(s=>s+1))},onDragOver:t=>{C(t)&&(t.preventDefault(),t.dataTransfer.dropEffect=i?"none":"copy")},onDragLeave:t=>{C(t)&&P(s=>Math.max(0,s-1))},onDrop:t=>{C(t)&&(t.preventDefault(),P(0),K(Array.from(t.dataTransfer.files)))}},A=ut>0&&!i,dt=t=>{switch(t.status){case"queued":return c.queued;case"uploading":return c.uploading(t.progress===null?null:Math.round(t.progress*100));case"processing":return c.processing;case"done":return c.done;case"failed":return`${c.failed} ${t.reason??""}`.trim();case"rejected":return`${c.rejected} ${t.reason??""}`.trim()}},lt=[E?G:null,T?V:null].filter(Boolean).join(" ")||void 0;return r.jsxs("div",{ref:F,role:"group","aria-labelledby":I,className:p.cn("rst:font-ui rst:w-full",X),"data-file-upload":"",children:[r.jsx("p",{id:I,className:p.cn("rst:mb-1.5 rst:text-left rst:text-sm rst:font-medium rst:leading-none rst:text-[var(--roster-control-text)]",i&&"rst:opacity-70"),children:n}),r.jsxs("div",{...it,"data-file-drop":"","data-dragging":A?"":void 0,className:p.cn("rst:flex rst:flex-col rst:items-center rst:justify-center rst:gap-2 rst:rounded-lg rst:border-2 rst:border-dashed rst:px-4 rst:py-6 rst:text-center rst:transition-colors rst:motion-reduce:transition-none",A?"rst:border-primary-500 rst:bg-primary-500/10":T?"rst:border-error-500 rst:dark:border-error-400":"rst:border-gray-300 rst:dark:border-gray-600"),children:[r.jsx(H.Button,{type:"button",variant:"outline",colorScheme:"neutral",size:"lg",className:p.cn("rst:px-5",i&&W),"aria-disabled":i||void 0,"aria-describedby":lt,onClick:()=>_.current?.click(),"data-file-choose":"",startIcon:r.jsx("svg",{...S,"aria-hidden":"true",children:r.jsx("path",{d:"M12 16V4M7 9l5-5 5 5M5 20h14"})}),children:c.choose}),r.jsx("p",{className:"rst:hidden rst:text-xs rst:text-gray-600 rst:pointer-fine:block rst:dark:text-gray-400","data-file-drop-hint":"",children:A?c.dropHere:c.dropHint}),r.jsx("input",{ref:_,type:"file",hidden:!0,tabIndex:-1,accept:M,multiple:x!==1,disabled:i,onChange:t=>{K(Array.from(t.currentTarget.files??[])),t.currentTarget.value=""},"data-file-input":""})]}),E&&r.jsx("p",{id:G,className:"rst:mt-1.5 rst:text-left rst:text-xs rst:text-gray-500 rst:dark:text-gray-400",children:E}),T&&r.jsx("p",{id:V,className:"rst:mt-1.5 rst:text-left rst:text-xs rst:font-medium rst:text-error-600 rst:dark:text-error-400",children:T}),U.length>0&&r.jsx("ul",{className:"rst:mt-3 rst:flex rst:flex-col rst:gap-2","aria-labelledby":I,children:U.map(t=>{const s=t.status==="failed"||t.status==="rejected",e=t.status==="uploading"||t.status==="processing"||t.status==="queued";return r.jsxs("li",{"data-file-item":t.id,"data-status":t.status,className:"rst:flex rst:items-center rst:gap-3 rst:rounded-md rst:border rst:border-[var(--roster-card-border)] rst:p-2",children:[r.jsx(ht,{file:t.file,status:t.status}),r.jsxs("div",{className:"rst:min-w-0 rst:flex-1 rst:text-left",children:[r.jsx("p",{className:"rst:truncate rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]",title:t.file.name,children:t.file.name}),r.jsxs("p",{className:p.cn("rst:mt-0.5 rst:flex rst:items-start rst:gap-1 rst:text-xs",s?"rst:text-error-600 rst:dark:text-error-400":"rst:text-gray-600 rst:dark:text-gray-400"),"data-file-status":"",children:[t.status==="done"&&r.jsx("svg",{...S,width:14,height:14,"aria-hidden":"true",className:"rst:mt-px rst:shrink-0 rst:text-success-600 rst:dark:text-success-400",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})}),r.jsxs("span",{children:[r.jsx("span",{className:"rst:tabular-nums",children:c.size(t.file.size)}),r.jsx("span",{"aria-hidden":"true",children:" · "}),dt(t)]})]}),e&&r.jsx("div",{className:"rst:mt-1.5","data-file-progress":"",children:r.jsx(pt.Progress,{size:"sm",value:t.status==="processing"?100:t.status==="uploading"?(t.progress??0)*100:0,busy:t.status==="processing"||t.status==="uploading"&&t.progress===null,announce:!1})})]}),t.status==="failed"&&r.jsx(H.Button,{type:"button",variant:"ghost",colorScheme:"neutral",size:"icon",className:p.cn("rst:h-11 rst:w-11",i&&W),"aria-disabled":i||void 0,"aria-label":c.retry(t.file.name),onClick:()=>ct(t.id),"data-file-retry":t.id,children:r.jsxs("svg",{...S,"aria-hidden":"true",children:[r.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),r.jsx("path",{d:"M3 3v5h5"})]})}),r.jsx(H.Button,{type:"button",variant:"ghost",colorScheme:"neutral",size:"icon",className:p.cn("rst:h-11 rst:w-11",i&&W),"aria-disabled":i||void 0,"aria-label":c.remove(t.file.name),onClick:()=>ot(t.id),"data-file-remove":t.id,children:r.jsx("svg",{...S,"aria-hidden":"true",children:r.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]},t.id)})}),r.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"rst:sr-only","data-file-live":"","data-file-live-n":z.n,children:[z.text,z.n%2?" ":""]})]})}exports.FileUpload=xt;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("react"),p=require("../../../lib/utils.cjs"),pt=require("../../../lib/labels.cjs"),H=require("../../atoms/Button/Button.cjs"),gt=require("../../atoms/Progress/Progress.cjs"),R=require("./file-rules.cjs"),ht={choose:"Choose photos",dropHint:"or drag them here",dropHere:"Drop to add them",queued:"Waiting",uploading:n=>n===null?"Uploading":`Uploading, ${n}%`,processing:"Finishing up",done:"Uploaded",failed:"Didn't upload.",rejected:"Not added.",remove:n=>`Remove ${n}`,retry:n=>`Try ${n} again`,wrongType:()=>"That type of file isn't accepted.",tooLarge:(n,l)=>`It's over ${R.formatBytes(l)}.`,tooMany:n=>`Only ${n} can be added.`,duplicate:()=>"It's already added.",uploadError:n=>n instanceof Error&&n.message?n.message:"Something went wrong.",size:R.formatBytes,added:n=>`${n} ${n===1?"photo":"photos"} added.`,progress:(n,l)=>`${n} of ${l} uploaded.`,failedNotice:(n,l)=>`${n} didn't upload. ${l}`,rejectedNotice:(n,l)=>`${n} wasn't added. ${l}`,removed:n=>`${n} removed.`};function xt({file:n,status:l}){const[q,L]=o.useState(!1),B=!q&&(n.type.startsWith("image/")||/\.(jpe?g|png|gif|webp|avif|heic|heif)$/i.test(n.name)),N=o.useCallback(M=>{if(!M)return;const w=URL.createObjectURL(n);return M.src=w,()=>URL.revokeObjectURL(w)},[n]),x="rst:h-14 rst:w-14 rst:shrink-0 rst:rounded-md rst:border rst:border-[var(--roster-card-border)]";return B?r.jsx("img",{ref:N,alt:"",onError:()=>L(!0),className:p.cn(x,"rst:object-cover",l==="rejected"&&"rst:opacity-50"),"data-file-thumb":"image"}):r.jsx("span",{"aria-hidden":"true",className:p.cn(x,"rst:flex rst:items-center rst:justify-center rst:text-gray-500 rst:dark:text-gray-400"),"data-file-thumb":"placeholder",children:r.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),r.jsx("circle",{cx:"9",cy:"10",r:"1.6"}),r.jsx("path",{d:"m21 15-4.2-4.2a1.6 1.6 0 0 0-2.3 0L7 18"})]})})}const W="rst:cursor-not-allowed rst:opacity-50",S={width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function mt({label:n,upload:l,onChange:q,accept:L="image/*",types:B,maxSize:N,maxFiles:x,validate:M,concurrency:w=3,helperText:E,errorMessage:T,disabled:i=!1,strings:Q,className:X}){const c=pt.withLabels(ht,Q),D=o.useId(),I=`${D}-label`,G=`${D}-help`,V=`${D}-error`,[U,Y]=o.useState([]),d=o.useRef(U),Z=o.useRef(0),m=o.useRef(new Map),F=o.useRef(null),_=o.useRef(null),g=o.useRef({upload:l,onChange:q,concurrency:w,t:c,pump:()=>{}}),[z,tt]=o.useState({text:"",n:0}),j=o.useRef([]),v=o.useRef(null),$=o.useCallback((t,s=!1)=>{s&&(j.current=j.current.filter(e=>!e.count)),j.current.push({text:t,count:s}),!v.current&&(v.current=setTimeout(()=>{v.current=null;const e=j.current.map(u=>u.text).join(" ");j.current=[],tt(u=>({text:e,n:u.n+1}))},0))},[]),O=o.useRef(null),[et,rt]=o.useState(0),J=t=>{O.current=t,rt(s=>s+1)};o.useLayoutEffect(()=>{const t=O.current;if(!t)return;O.current=null,(F.current?.querySelector(t)??F.current?.querySelector("[data-file-choose]"))?.focus()},[et]);const y=o.useCallback(t=>{d.current=t,Y(t),g.current.onChange?.(t)},[]),b=o.useCallback((t,s)=>{d.current.some(e=>e.id===t)&&y(d.current.map(e=>e.id===t?{...e,...s}:e))},[y]);function k(){const{concurrency:t}=g.current,s=d.current.filter(u=>u.status==="uploading"||u.status==="processing").length,e=d.current.filter(u=>u.status==="queued").slice(0,Math.max(0,Math.max(1,t)-s));for(const u of e)st(u)}function st(t){const s=new AbortController;m.current.set(t.id,s),b(t.id,{status:"uploading",progress:null,reason:void 0});const e=()=>!s.signal.aborted&&m.current.get(t.id)===s,u={onProgress:a=>{if(!e())return;const f=Math.round(Math.min(1,Math.max(0,Number.isFinite(a)?a:0))*100)/100,h=d.current.find(ft=>ft.id===t.id);h?.status==="uploading"&&h.progress!==f&&b(t.id,{progress:f})},onProcessing:()=>{e()&&b(t.id,{status:"processing"})},signal:s.signal};new Promise(a=>a(g.current.upload(t.file,u))).then(a=>{if(!e())return;m.current.delete(t.id),b(t.id,{status:"done",progress:1,result:a});const f=d.current.filter(h=>h.status!=="rejected");$(g.current.t.progress(f.filter(h=>h.status==="done").length,f.length),!0),k()},a=>{if(!e())return;m.current.delete(t.id);const f=g.current.t.uploadError(a);b(t.id,{status:"failed",reason:f}),$(g.current.t.failedNotice(t.file.name,f)),k()})}o.useLayoutEffect(()=>{g.current={upload:l,onChange:q,concurrency:w,t:c,pump:k}}),o.useEffect(()=>{const t=m.current;return d.current.some(e=>(e.status==="uploading"||e.status==="processing")&&!t.has(e.id))&&(y(d.current.map(e=>(e.status==="uploading"||e.status==="processing")&&!t.has(e.id)?{...e,status:"queued",progress:null}:e)),g.current.pump()),()=>{for(const e of t.values())e.abort();t.clear(),v.current&&clearTimeout(v.current),v.current=null,j.current=[]}},[y]);const nt=B??R.acceptList(L),at=(t,s)=>{if(s.some(u=>R.sameFile(u.file,t)))return c.duplicate(t);const e=M?.(t);if(e)return e;if(!R.matchesType(t,nt))return c.wrongType(t);if(N!==void 0&&t.size>N)return c.tooLarge(t,N);if(x!==void 0&&s.length>=x)return c.tooMany(x)},K=t=>{if(i||t.length===0)return;const s=d.current.filter(a=>a.status!=="rejected"),e=[];for(const a of t){const f=at(a,[...s,...e.filter(h=>h.status!=="rejected")]);e.push({id:`${D}-file-${Z.current++}`,file:a,status:f?"rejected":"queued",progress:null,reason:f})}y([...d.current,...e]);const u=e.filter(a=>a.status==="queued").length;u&&$(c.added(u));for(const a of e)a.reason&&$(c.rejectedNotice(a.file.name,a.reason));k()},ot=t=>{if(i)return;const s=d.current,e=s.findIndex(a=>a.id===t);if(e<0)return;m.current.get(t)?.abort(),m.current.delete(t);const u=s[e+1]??s[e-1];y(s.filter(a=>a.id!==t)),$(c.removed(s[e].file.name)),J(u?`[data-file-remove="${u.id}"]`:"[data-file-choose]"),k()},ct=t=>{i||(b(t,{status:"queued",progress:null,reason:void 0}),J(`[data-file-remove="${t}"]`),k())},[ut,P]=o.useState(0),C=t=>Array.from(t.dataTransfer?.types??[]).includes("Files"),it={onDragEnter:t=>{C(t)&&(t.preventDefault(),P(s=>s+1))},onDragOver:t=>{C(t)&&(t.preventDefault(),t.dataTransfer.dropEffect=i?"none":"copy")},onDragLeave:t=>{C(t)&&P(s=>Math.max(0,s-1))},onDrop:t=>{C(t)&&(t.preventDefault(),P(0),K(Array.from(t.dataTransfer.files)))}},A=ut>0&&!i,lt=t=>{switch(t.status){case"queued":return c.queued;case"uploading":return c.uploading(t.progress===null?null:Math.round(t.progress*100));case"processing":return c.processing;case"done":return c.done;case"failed":return`${c.failed} ${t.reason??""}`.trim();case"rejected":return`${c.rejected} ${t.reason??""}`.trim()}},dt=[E?G:null,T?V:null].filter(Boolean).join(" ")||void 0;return r.jsxs("div",{ref:F,role:"group","aria-labelledby":I,className:p.cn("rst:font-ui rst:w-full",X),"data-file-upload":"",children:[r.jsx("p",{id:I,className:p.cn("rst:mb-1.5 rst:text-left rst:text-sm rst:font-medium rst:leading-none rst:text-[var(--roster-control-text)]",i&&"rst:opacity-70"),children:n}),r.jsxs("div",{...it,"data-file-drop":"","data-dragging":A?"":void 0,className:p.cn("rst:flex rst:flex-col rst:items-center rst:justify-center rst:gap-2 rst:rounded-lg rst:border-2 rst:border-dashed rst:px-4 rst:py-6 rst:text-center rst:transition-colors rst:motion-reduce:transition-none",A?"rst:border-primary-500 rst:bg-primary-500/10":T?"rst:border-error-500 rst:dark:border-error-400":"rst:border-gray-300 rst:dark:border-gray-600"),children:[r.jsx(H.Button,{type:"button",variant:"outline",colorScheme:"neutral",size:"lg",className:p.cn("rst:px-5",i&&W),"aria-disabled":i||void 0,"aria-describedby":dt,onClick:()=>_.current?.click(),"data-file-choose":"",startIcon:r.jsx("svg",{...S,"aria-hidden":"true",children:r.jsx("path",{d:"M12 16V4M7 9l5-5 5 5M5 20h14"})}),children:c.choose}),r.jsx("p",{className:"rst:hidden rst:text-xs rst:text-gray-600 rst:pointer-fine:block rst:dark:text-gray-400","data-file-drop-hint":"",children:A?c.dropHere:c.dropHint}),r.jsx("input",{ref:_,type:"file",hidden:!0,tabIndex:-1,accept:L,multiple:x!==1,disabled:i,onChange:t=>{K(Array.from(t.currentTarget.files??[])),t.currentTarget.value=""},"data-file-input":""})]}),E&&r.jsx("p",{id:G,className:"rst:mt-1.5 rst:text-left rst:text-xs rst:text-gray-500 rst:dark:text-gray-400",children:E}),T&&r.jsx("p",{id:V,className:"rst:mt-1.5 rst:text-left rst:text-xs rst:font-medium rst:text-error-600 rst:dark:text-error-400",children:T}),U.length>0&&r.jsx("ul",{className:"rst:mt-3 rst:flex rst:flex-col rst:gap-2","aria-labelledby":I,children:U.map(t=>{const s=t.status==="failed"||t.status==="rejected",e=t.status==="uploading"||t.status==="processing"||t.status==="queued";return r.jsxs("li",{"data-file-item":t.id,"data-status":t.status,className:"rst:flex rst:items-center rst:gap-3 rst:rounded-md rst:border rst:border-[var(--roster-card-border)] rst:p-2",children:[r.jsx(xt,{file:t.file,status:t.status}),r.jsxs("div",{className:"rst:min-w-0 rst:flex-1 rst:text-left",children:[r.jsx("p",{className:"rst:truncate rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]",title:t.file.name,children:t.file.name}),r.jsxs("p",{className:p.cn("rst:mt-0.5 rst:flex rst:items-start rst:gap-1 rst:text-xs",s?"rst:text-error-600 rst:dark:text-error-400":"rst:text-gray-600 rst:dark:text-gray-400"),"data-file-status":"",children:[t.status==="done"&&r.jsx("svg",{...S,width:14,height:14,"aria-hidden":"true",className:"rst:mt-px rst:shrink-0 rst:text-success-600 rst:dark:text-success-400",children:r.jsx("path",{d:"M20 6 9 17l-5-5"})}),r.jsxs("span",{children:[r.jsx("span",{className:"rst:tabular-nums",children:c.size(t.file.size)}),r.jsx("span",{"aria-hidden":"true",children:" · "}),lt(t)]})]}),e&&r.jsx("div",{className:"rst:mt-1.5","data-file-progress":"",children:r.jsx(gt.Progress,{size:"sm",value:t.status==="processing"?100:t.status==="uploading"?(t.progress??0)*100:0,busy:t.status==="processing"||t.status==="uploading"&&t.progress===null,announce:!1})})]}),t.status==="failed"&&r.jsx(H.Button,{type:"button",variant:"ghost",colorScheme:"neutral",size:"icon",className:p.cn("rst:h-11 rst:w-11",i&&W),"aria-disabled":i||void 0,"aria-label":c.retry(t.file.name),onClick:()=>ct(t.id),"data-file-retry":t.id,children:r.jsxs("svg",{...S,"aria-hidden":"true",children:[r.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),r.jsx("path",{d:"M3 3v5h5"})]})}),r.jsx(H.Button,{type:"button",variant:"ghost",colorScheme:"neutral",size:"icon",className:p.cn("rst:h-11 rst:w-11",i&&W),"aria-disabled":i||void 0,"aria-label":c.remove(t.file.name),onClick:()=>ot(t.id),"data-file-remove":t.id,children:r.jsx("svg",{...S,"aria-hidden":"true",children:r.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]},t.id)})}),r.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"rst:sr-only","data-file-live":"","data-file-live-n":z.n,children:[z.text,z.n%2?" ":""]})]})}exports.FileUpload=mt;
@@ -1,11 +1,12 @@
1
1
  "use client";
2
2
  import { jsxs as p, jsx as n } from "react/jsx-runtime";
3
- import { useId as vr, useState as L, useRef as f, useCallback as U, useLayoutEffect as Y, useEffect as xr } from "react";
3
+ import { useId as vr, useState as M, useRef as f, useCallback as U, useLayoutEffect as Y, useEffect as xr } from "react";
4
4
  import { cn as g } from "../../../lib/utils.js";
5
+ import { withLabels as yr } from "../../../lib/labels.js";
5
6
  import { Button as G } from "../../atoms/Button/Button.js";
6
- import { Progress as yr } from "../../atoms/Progress/Progress.js";
7
- import { formatBytes as Z, acceptList as br, sameFile as kr, matchesType as Nr } from "./file-rules.js";
8
- const wr = {
7
+ import { Progress as br } from "../../atoms/Progress/Progress.js";
8
+ import { acceptList as kr, formatBytes as Z, sameFile as Nr, matchesType as wr } from "./file-rules.js";
9
+ const $r = {
9
10
  choose: "Choose photos",
10
11
  dropHint: "or drag them here",
11
12
  dropHere: "Drop to add them",
@@ -29,8 +30,8 @@ const wr = {
29
30
  rejectedNotice: (s, d) => `${s} wasn't added. ${d}`,
30
31
  removed: (s) => `${s} removed.`
31
32
  };
32
- function $r({ file: s, status: d }) {
33
- const [T, D] = L(!1), B = !T && (s.type.startsWith("image/") || /\.(jpe?g|png|gif|webp|avif|heic|heif)$/i.test(s.name)), $ = U(
33
+ function jr({ file: s, status: d }) {
34
+ const [T, D] = M(!1), B = !T && (s.type.startsWith("image/") || /\.(jpe?g|png|gif|webp|avif|heic|heif)$/i.test(s.name)), $ = U(
34
35
  (q) => {
35
36
  if (!q) return;
36
37
  const j = URL.createObjectURL(s);
@@ -62,7 +63,7 @@ function $r({ file: s, status: d }) {
62
63
  );
63
64
  }
64
65
  const V = "rst:cursor-not-allowed rst:opacity-50", I = { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" };
65
- function Rr({
66
+ function Er({
66
67
  label: s,
67
68
  upload: d,
68
69
  onChange: T,
@@ -78,14 +79,14 @@ function Rr({
78
79
  strings: rr,
79
80
  className: tr
80
81
  }) {
81
- const a = { ...wr, ...rr }, C = vr(), z = `${C}-label`, _ = `${C}-help`, J = `${C}-error`, [F, er] = L([]), u = f(F), sr = f(0), x = f(/* @__PURE__ */ new Map()), O = f(null), K = f(null), h = f({ upload: d, onChange: T, concurrency: j, t: a, pump: () => {
82
- } }), [A, nr] = L({ text: "", n: 0 }), y = f([]), b = f(null), M = U((r, e = !1) => {
82
+ const a = yr($r, rr), C = vr(), z = `${C}-label`, _ = `${C}-help`, J = `${C}-error`, [F, er] = M([]), u = f(F), sr = f(0), x = f(/* @__PURE__ */ new Map()), O = f(null), K = f(null), h = f({ upload: d, onChange: T, concurrency: j, t: a, pump: () => {
83
+ } }), [A, nr] = M({ text: "", n: 0 }), y = f([]), b = f(null), L = U((r, e = !1) => {
83
84
  e && (y.current = y.current.filter((t) => !t.count)), y.current.push({ text: r, count: e }), !b.current && (b.current = setTimeout(() => {
84
85
  b.current = null;
85
86
  const t = y.current.map((c) => c.text).join(" ");
86
87
  y.current = [], nr((c) => ({ text: t, n: c.n + 1 }));
87
88
  }, 0));
88
- }, []), H = f(null), [or, ar] = L(0), Q = (r) => {
89
+ }, []), H = f(null), [or, ar] = M(0), Q = (r) => {
89
90
  H.current = r, ar((e) => e + 1);
90
91
  };
91
92
  Y(() => {
@@ -124,13 +125,13 @@ function Rr({
124
125
  if (!t()) return;
125
126
  x.current.delete(r.id), N(r.id, { status: "done", progress: 1, result: o });
126
127
  const l = u.current.filter((m) => m.status !== "rejected");
127
- M(h.current.t.progress(l.filter((m) => m.status === "done").length, l.length), !0), w();
128
+ L(h.current.t.progress(l.filter((m) => m.status === "done").length, l.length), !0), w();
128
129
  },
129
130
  (o) => {
130
131
  if (!t()) return;
131
132
  x.current.delete(r.id);
132
133
  const l = h.current.t.uploadError(o);
133
- N(r.id, { status: "failed", reason: l }), M(h.current.t.failedNotice(r.file.name, l)), w();
134
+ N(r.id, { status: "failed", reason: l }), L(h.current.t.failedNotice(r.file.name, l)), w();
134
135
  }
135
136
  );
136
137
  }
@@ -147,11 +148,11 @@ function Rr({
147
148
  r.clear(), b.current && clearTimeout(b.current), b.current = null, y.current = [];
148
149
  };
149
150
  }, [k]);
150
- const ir = B ?? br(D), dr = (r, e) => {
151
- if (e.some((c) => kr(c.file, r))) return a.duplicate(r);
151
+ const ir = B ?? kr(D), dr = (r, e) => {
152
+ if (e.some((c) => Nr(c.file, r))) return a.duplicate(r);
152
153
  const t = q?.(r);
153
154
  if (t) return t;
154
- if (!Nr(r, ir)) return a.wrongType(r);
155
+ if (!wr(r, ir)) return a.wrongType(r);
155
156
  if ($ !== void 0 && r.size > $) return a.tooLarge(r, $);
156
157
  if (v !== void 0 && e.length >= v) return a.tooMany(v);
157
158
  }, X = (r) => {
@@ -163,8 +164,8 @@ function Rr({
163
164
  }
164
165
  k([...u.current, ...t]);
165
166
  const c = t.filter((o) => o.status === "queued").length;
166
- c && M(a.added(c));
167
- for (const o of t) o.reason && M(a.rejectedNotice(o.file.name, o.reason));
167
+ c && L(a.added(c));
168
+ for (const o of t) o.reason && L(a.rejectedNotice(o.file.name, o.reason));
168
169
  w();
169
170
  }, ur = (r) => {
170
171
  if (i) return;
@@ -172,10 +173,10 @@ function Rr({
172
173
  if (t < 0) return;
173
174
  x.current.get(r)?.abort(), x.current.delete(r);
174
175
  const c = e[t + 1] ?? e[t - 1];
175
- k(e.filter((o) => o.id !== r)), M(a.removed(e[t].file.name)), Q(c ? `[data-file-remove="${c.id}"]` : "[data-file-choose]"), w();
176
+ k(e.filter((o) => o.id !== r)), L(a.removed(e[t].file.name)), Q(c ? `[data-file-remove="${c.id}"]` : "[data-file-choose]"), w();
176
177
  }, lr = (r) => {
177
178
  i || (N(r, { status: "queued", progress: null, reason: void 0 }), Q(`[data-file-remove="${r}"]`), w());
178
- }, [fr, P] = L(0), E = (r) => Array.from(r.dataTransfer?.types ?? []).includes("Files"), pr = {
179
+ }, [fr, P] = M(0), E = (r) => Array.from(r.dataTransfer?.types ?? []).includes("Files"), pr = {
179
180
  onDragEnter: (r) => {
180
181
  E(r) && (r.preventDefault(), P((e) => e + 1));
181
182
  },
@@ -289,7 +290,7 @@ function Rr({
289
290
  "data-status": r.status,
290
291
  className: "rst:flex rst:items-center rst:gap-3 rst:rounded-md rst:border rst:border-[var(--roster-card-border)] rst:p-2",
291
292
  children: [
292
- /* @__PURE__ */ n($r, { file: r.file, status: r.status }),
293
+ /* @__PURE__ */ n(jr, { file: r.file, status: r.status }),
293
294
  /* @__PURE__ */ p("div", { className: "rst:min-w-0 rst:flex-1 rst:text-left", children: [
294
295
  /* @__PURE__ */ n("p", { className: "rst:truncate rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]", title: r.file.name, children: r.file.name }),
295
296
  /* @__PURE__ */ p(
@@ -311,7 +312,7 @@ function Rr({
311
312
  }
312
313
  ),
313
314
  t && /* @__PURE__ */ n("div", { className: "rst:mt-1.5", "data-file-progress": "", children: /* @__PURE__ */ n(
314
- yr,
315
+ br,
315
316
  {
316
317
  size: "sm",
317
318
  value: r.status === "processing" ? 100 : r.status === "uploading" ? (r.progress ?? 0) * 100 : 0,
@@ -378,5 +379,5 @@ function Rr({
378
379
  );
379
380
  }
380
381
  export {
381
- Rr as FileUpload
382
+ Er as FileUpload
382
383
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("react"),i=require("../../../lib/utils.cjs");function h({src:e,href:t,alt:s,unavailableLabel:n="Preview unavailable",openLabel:a="Open original",onUnavailable:u,className:o,...g}){const[x,b]=m.useState(null),f=!e||x===e,c="rst:font-ui rst:h-28 rst:w-36 rst:shrink-0 rst:rounded-md rst:border rst:border-[var(--roster-card-border)]";if(f){const d=r.jsxs(r.Fragment,{children:[r.jsx("span",{children:n}),t?r.jsxs("span",{className:"rst:font-semibold rst:underline",children:[a,r.jsx("span",{"aria-hidden":"true",children:" ↗"})]}):null]}),l=i.cn(c,"rst:flex rst:flex-col rst:items-center rst:justify-center rst:gap-1 rst:border-dashed rst:px-2 rst:text-center rst:text-xs rst:text-gray-600 rst:dark:text-gray-300",o);return t?r.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:i.cn(l,"rst:hover:bg-gray-50 rst:dark:hover:bg-gray-800 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring"),"aria-label":`${n}. ${a}, in a new tab: ${s}`,children:d}):r.jsx("span",{role:"img","aria-label":`${n}: ${s}`,className:l,children:d})}return r.jsx("img",{...g,src:e,alt:s,className:i.cn(c,"rst:object-cover",o),onError:()=>{b(e),u?.()}})}exports.MediaPreview=h;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),h=require("react"),i=require("../../../lib/utils.cjs");function j({src:e,href:t,alt:s,unavailableLabel:n="Preview unavailable",openLabel:a="Open original",newTabLabel:u="in a new tab",onUnavailable:g,className:o,...x}){const[b,f]=h.useState(null),m=!e||b===e,c="rst:font-ui rst:h-28 rst:w-36 rst:shrink-0 rst:rounded-md rst:border rst:border-[var(--roster-card-border)]";if(m){const d=r.jsxs(r.Fragment,{children:[r.jsx("span",{children:n}),t?r.jsxs("span",{className:"rst:font-semibold rst:underline",children:[a,r.jsx("span",{"aria-hidden":"true",children:" ↗"})]}):null]}),l=i.cn(c,"rst:flex rst:flex-col rst:items-center rst:justify-center rst:gap-1 rst:border-dashed rst:px-2 rst:text-center rst:text-xs rst:text-gray-600 rst:dark:text-gray-300",o);return t?r.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:i.cn(l,"rst:hover:bg-gray-50 rst:dark:hover:bg-gray-800 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring"),"aria-label":`${n}. ${a}, ${u}: ${s}`,children:d}):r.jsx("span",{role:"img","aria-label":`${n}: ${s}`,className:l,children:d})}return r.jsx("img",{...x,src:e,alt:s,className:i.cn(c,"rst:object-cover",o),onError:()=>{f(e),g?.()}})}exports.MediaPreview=j;
@@ -10,6 +10,8 @@ export interface MediaPreviewProps extends Omit<ImgHTMLAttributes<HTMLImageEleme
10
10
  unavailableLabel?: string;
11
11
  /** The link's own words. */
12
12
  openLabel?: string;
13
+ /** Said with the link's name, since its arrow shows it only to the eye: "in a new tab". */
14
+ newTabLabel?: string;
13
15
  /** Called once when the thumbnail fails, for an app that keeps a count. */
14
16
  onUnavailable?: () => void;
15
17
  }
@@ -23,5 +25,5 @@ export interface MediaPreviewProps extends Omit<ImgHTMLAttributes<HTMLImageEleme
23
25
  * for a card that says the preview is unavailable and links to the original,
24
26
  * in the same footprint, so a row of previews doesn't jump.
25
27
  */
26
- declare function MediaPreview({ src, href, alt, unavailableLabel, openLabel, onUnavailable, className, ...props }: MediaPreviewProps): import("react/jsx-runtime").JSX.Element;
28
+ declare function MediaPreview({ src, href, alt, unavailableLabel, openLabel, newTabLabel, onUnavailable, className, ...props }: MediaPreviewProps): import("react/jsx-runtime").JSX.Element;
27
29
  export { MediaPreview };
@@ -1,20 +1,21 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as m, Fragment as x } from "react/jsx-runtime";
3
- import { useState as p } from "react";
2
+ import { jsx as r, jsxs as m, Fragment as p } from "react/jsx-runtime";
3
+ import { useState as v } from "react";
4
4
  import { cn as i } from "../../../lib/utils.js";
5
- function $({
5
+ function j({
6
6
  src: e,
7
7
  href: t,
8
8
  alt: s,
9
9
  unavailableLabel: n = "Preview unavailable",
10
10
  openLabel: o = "Open original",
11
- onUnavailable: g,
11
+ newTabLabel: g = "in a new tab",
12
+ onUnavailable: u,
12
13
  className: a,
13
- ...u
14
+ ...f
14
15
  }) {
15
- const [f, b] = p(null), h = !e || f === e, d = "rst:font-ui rst:h-28 rst:w-36 rst:shrink-0 rst:rounded-md rst:border rst:border-[var(--roster-card-border)]";
16
- if (h) {
17
- const l = /* @__PURE__ */ m(x, { children: [
16
+ const [b, h] = v(null), x = !e || b === e, d = "rst:font-ui rst:h-28 rst:w-36 rst:shrink-0 rst:rounded-md rst:border rst:border-[var(--roster-card-border)]";
17
+ if (x) {
18
+ const l = /* @__PURE__ */ m(p, { children: [
18
19
  /* @__PURE__ */ r("span", { children: n }),
19
20
  t ? /* @__PURE__ */ m("span", { className: "rst:font-semibold rst:underline", children: [
20
21
  o,
@@ -32,7 +33,7 @@ function $({
32
33
  target: "_blank",
33
34
  rel: "noreferrer",
34
35
  className: i(c, "rst:hover:bg-gray-50 rst:dark:hover:bg-gray-800 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring"),
35
- "aria-label": `${n}. ${o}, in a new tab: ${s}`,
36
+ "aria-label": `${n}. ${o}, ${g}: ${s}`,
36
37
  children: l
37
38
  }
38
39
  ) : /* @__PURE__ */ r("span", { role: "img", "aria-label": `${n}: ${s}`, className: c, children: l });
@@ -40,16 +41,16 @@ function $({
40
41
  return /* @__PURE__ */ r(
41
42
  "img",
42
43
  {
43
- ...u,
44
+ ...f,
44
45
  src: e,
45
46
  alt: s,
46
47
  className: i(d, "rst:object-cover", a),
47
48
  onError: () => {
48
- b(e), g?.();
49
+ h(e), u?.();
49
50
  }
50
51
  }
51
52
  );
52
53
  }
53
54
  export {
54
- $ as MediaPreview
55
+ j as MediaPreview
55
56
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("react"),v=require("../../../lib/utils.cjs"),ee=require("../../atoms/Button/Button.cjs"),te=require("../../atoms/Button/button-variants.cjs"),se=require("../../atoms/Select/select-variants.cjs"),Q=require("./page-items.cjs"),re={nav:"Pagination",page:t=>`Page ${t}`,number:t=>String(t),previous:"Previous",next:"Next",previousPage:t=>t===null?"Previous page":`Previous page (${t})`,nextPage:t=>t===null?"Next page":`Next page (${t})`,firstPage:t=>t===null?"First page":`First page (${t})`,lastPage:t=>t===null?"Last page":`Last page (${t})`,gap:"…",picker:"Page",of:t=>`of ${t}`,status:(t,i)=>`Page ${t} of ${i}`};function ae({href:t,className:i,children:c,onClick:o,...d}){return e.jsx("a",{href:t,className:i,onClick:o,"aria-label":d["aria-label"],"aria-current":d["aria-current"],"aria-disabled":d["aria-disabled"],children:c})}const ne="rst:h-11 rst:min-w-11 rst:px-2",ie="rst:cursor-not-allowed rst:opacity-50",le="rst:forced-colors:border-2 rst:forced-colors:underline rst:forced-colors:decoration-2 rst:forced-colors:underline-offset-4",X={width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},F=({dir:t,double:i=!1})=>e.jsx("svg",{...X,className:"rst:shrink-0",children:t==="left"?i?e.jsx("path",{d:"m11 17-5-5 5-5M18 17l-5-5 5-5"}):e.jsx("path",{d:"m15 18-6-6 6-6"}):i?e.jsx("path",{d:"m13 17 5-5-5-5M6 17l5-5-5-5"}):e.jsx("path",{d:"m9 18 6-6-6-6"})});function oe({id:t,describedBy:i,page:c,pageCount:o,number:d,onCommit:k}){const[u,j]=w.useState(null),p=w.useRef(!1),x=u&&u.page===c?u.value:null,b=l=>{j(null),l!==c&&k(l)},P=w.useMemo(()=>Array.from({length:o},(l,f)=>e.jsx("option",{value:f+1,children:d(f+1)},f+1)),[o,d]);return e.jsx("select",{id:t,value:x??c,"aria-describedby":i,disabled:o<1,onKeyDown:l=>{if(l.key==="Enter"){x!==null&&(l.preventDefault(),b(x));return}if(l.key==="Escape"){j(null);return}p.current=!0,setTimeout(()=>{p.current=!1},0)},onChange:l=>{const f=Number(l.currentTarget.value);p.current?j({page:c,value:f}):b(f)},onBlur:()=>{x!==null&&b(x)},className:v.cn(se.selectTriggerVariants({variant:"outline"}),"rst:h-11 rst:w-auto rst:min-w-16 rst:appearance-none rst:pl-3 rst:pr-8 rst:text-base rst:tabular-nums"),"data-pagination-picker":"",children:P})}function ce({page:t,pageCount:i,onPageChange:c,getPageHref:o,linkComponent:d,navigate:k,layout:u="auto",siblings:j=1,edges:p=!0,align:x="center",variant:b="ghost",announce:P=!0,labels:l,className:f}){const a={...re,...l},m=Number.isFinite(i)?Math.max(0,Math.floor(i)):0,n=Q.clampPage(t,m),C=w.useId(),Y=d??ae,[E,Z]=w.useState({page:n,text:""});E.page!==n&&Z({page:n,text:P?a.status(n,m):""});const L=s=>{s!==Math.floor(t)&&c?.(s)},y=(s,r,N,A)=>{const h=s==="page"&&r===n,$=r===null,U=v.cn(ne,$&&ie,h&&le,A.className),W=s==="page"?`page-${r}`:s;if(o){const J=o(r??n);return e.jsx(Y,{href:J,to:J,className:v.cn(te.buttonVariants({variant:h?"solid":b,colorScheme:h?"primary":"neutral"}),U),"aria-label":A.label,"aria-current":h?"page":void 0,"aria-disabled":$?!0:void 0,onClick:g=>{if($){g.preventDefault();return}!g.defaultPrevented&&g.button===0&&!g.metaKey&&!g.ctrlKey&&!g.shiftKey&&!g.altKey&&r!==null&&L(r)},children:N},W)}return e.jsx(ee.Button,{type:"button",variant:h?"solid":b,colorScheme:h?"primary":"neutral",className:U,"aria-label":A.label,"aria-current":h?"page":void 0,"aria-disabled":$||void 0,onClick:()=>{r!==null&&L(r)},children:N},W)},I=n>1?n-1:null,R=n<m?n+1:null,T=n>1?1:null,B=n<m?m:null,M=s=>y("previous",I,e.jsxs(e.Fragment,{children:[e.jsx(F,{dir:"left"}),s&&e.jsx("span",{className:"rst:hidden rst:pr-1 rst:@[36rem]:inline",children:a.previous})]}),{label:a.previousPage(I)}),S=s=>y("next",R,e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:"rst:hidden rst:pl-1 rst:@[36rem]:inline",children:a.next}),e.jsx(F,{dir:"right"})]}),{label:a.nextPage(R)}),K=s=>y("first",T,e.jsx(F,{dir:"left",double:!0}),{label:a.firstPage(T),className:s?"rst:hidden rst:@[24rem]:inline-flex":void 0}),V=s=>y("last",B,e.jsx(F,{dir:"right",double:!0}),{label:a.lastPage(B),className:s?"rst:hidden rst:@[24rem]:inline-flex":void 0}),D="rst:flex rst:flex-wrap rst:items-center rst:gap-1",q={start:"rst:justify-start",center:"rst:justify-center",end:"rst:justify-end"}[x],O=s=>e.jsxs("div",{className:v.cn(D,q,s),"data-pagination-layout":"pages",children:[M(!0),Q.pageItems(n,m,j).map(r=>typeof r=="number"?y("page",r,a.number(r),{label:a.page(r)}):e.jsx("span",{"aria-hidden":"true",className:"rst:inline-flex rst:h-11 rst:w-11 rst:items-center rst:justify-center rst:text-sm rst:text-gray-500 rst:dark:text-gray-400",children:a.gap},r)),S(!0)]}),_=`${C}-picker`,z=`${C}-of`,G=s=>e.jsxs("div",{className:v.cn(D,q,s),"data-pagination-layout":"compact",children:[p&&K(!0),M(!1),e.jsxs("div",{className:"rst:flex rst:items-center rst:gap-2 rst:px-1 rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]",children:[e.jsx("label",{htmlFor:_,children:a.picker}),e.jsxs("span",{className:"rst:relative rst:inline-flex",children:[e.jsx(oe,{id:_,describedBy:z,page:n,pageCount:m,number:a.number,onCommit:r=>{if(o){c?.(r);const N=o(r);k?k(N):window.location.assign(N)}else L(r)}}),e.jsx("svg",{...X,width:16,height:16,className:"rst:pointer-events-none rst:absolute rst:right-2.5 rst:top-1/2 rst:-translate-y-1/2 rst:text-gray-500 rst:dark:text-gray-400",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]}),e.jsx("span",{id:z,className:"rst:tabular-nums",children:a.of(m)})]}),S(!1),p&&V(!0)]}),H=e.jsxs("div",{className:v.cn(D,q),"data-pagination-layout":"arrows",children:[p&&K(!1),M(!1),S(!1),p&&V(!1)]});return e.jsxs("nav",{"aria-label":a.nav,className:v.cn("rst:font-ui",u==="arrows"?"rst:w-fit":"rst:@container rst:w-full rst:[contain-intrinsic-inline-size:18rem]",f),"data-pagination":"",children:[u==="pages"&&O(),u==="compact"&&G(),u==="arrows"&&H,u==="auto"&&e.jsxs(e.Fragment,{children:[O("rst:hidden rst:@[28rem]:flex"),G("rst:@[28rem]:hidden")]}),P&&e.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"rst:sr-only","data-pagination-live":"",children:E.text})]})}exports.Pagination=ce;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("react"),b=require("../../../lib/utils.cjs"),ee=require("../../../lib/labels.cjs"),te=require("../../atoms/Button/Button.cjs"),se=require("../../atoms/Button/button-variants.cjs"),re=require("../../atoms/Select/select-variants.cjs"),Q=require("./page-items.cjs"),ae={nav:"Pagination",page:t=>`Page ${t}`,number:t=>String(t),previous:"Previous",next:"Next",previousPage:t=>t===null?"Previous page":`Previous page (${t})`,nextPage:t=>t===null?"Next page":`Next page (${t})`,firstPage:t=>t===null?"First page":`First page (${t})`,lastPage:t=>t===null?"Last page":`Last page (${t})`,gap:"…",picker:"Page",of:t=>`of ${t}`,status:(t,i)=>`Page ${t} of ${i}`};function ne({href:t,className:i,children:c,onClick:o,...d}){return e.jsx("a",{href:t,className:i,onClick:o,"aria-label":d["aria-label"],"aria-current":d["aria-current"],"aria-disabled":d["aria-disabled"],children:c})}const ie="rst:h-11 rst:min-w-11 rst:px-2",le="rst:cursor-not-allowed rst:opacity-50",oe="rst:forced-colors:border-2 rst:forced-colors:underline rst:forced-colors:decoration-2 rst:forced-colors:underline-offset-4",X={width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},L=({dir:t,double:i=!1})=>e.jsx("svg",{...X,className:"rst:shrink-0",children:t==="left"?i?e.jsx("path",{d:"m11 17-5-5 5-5M18 17l-5-5 5-5"}):e.jsx("path",{d:"m15 18-6-6 6-6"}):i?e.jsx("path",{d:"m13 17 5-5-5-5M6 17l5-5-5-5"}):e.jsx("path",{d:"m9 18 6-6-6-6"})});function ce({id:t,describedBy:i,page:c,pageCount:o,number:d,onCommit:k}){const[u,j]=w.useState(null),p=w.useRef(!1),x=u&&u.page===c?u.value:null,v=l=>{j(null),l!==c&&k(l)},P=w.useMemo(()=>Array.from({length:o},(l,f)=>e.jsx("option",{value:f+1,children:d(f+1)},f+1)),[o,d]);return e.jsx("select",{id:t,value:x??c,"aria-describedby":i,disabled:o<1,onKeyDown:l=>{if(l.key==="Enter"){x!==null&&(l.preventDefault(),v(x));return}if(l.key==="Escape"){j(null);return}p.current=!0,setTimeout(()=>{p.current=!1},0)},onChange:l=>{const f=Number(l.currentTarget.value);p.current?j({page:c,value:f}):v(f)},onBlur:()=>{x!==null&&v(x)},className:b.cn(re.selectTriggerVariants({variant:"outline"}),"rst:h-11 rst:w-auto rst:min-w-16 rst:appearance-none rst:pl-3 rst:pr-8 rst:text-base rst:tabular-nums"),"data-pagination-picker":"",children:P})}function ue({page:t,pageCount:i,onPageChange:c,getPageHref:o,linkComponent:d,navigate:k,layout:u="auto",siblings:j=1,edges:p=!0,align:x="center",variant:v="ghost",announce:P=!0,labels:l,className:f}){const a=ee.withLabels(ae,l),m=Number.isFinite(i)?Math.max(0,Math.floor(i)):0,n=Q.clampPage(t,m),C=w.useId(),Y=d??ne,[E,Z]=w.useState({page:n,text:""});E.page!==n&&Z({page:n,text:P?a.status(n,m):""});const F=s=>{s!==Math.floor(t)&&c?.(s)},y=(s,r,N,A)=>{const h=s==="page"&&r===n,$=r===null,U=b.cn(ie,$&&le,h&&oe,A.className),W=s==="page"?`page-${r}`:s;if(o){const J=o(r??n);return e.jsx(Y,{href:J,to:J,className:b.cn(se.buttonVariants({variant:h?"solid":v,colorScheme:h?"primary":"neutral"}),U),"aria-label":A.label,"aria-current":h?"page":void 0,"aria-disabled":$?!0:void 0,onClick:g=>{if($){g.preventDefault();return}!g.defaultPrevented&&g.button===0&&!g.metaKey&&!g.ctrlKey&&!g.shiftKey&&!g.altKey&&r!==null&&F(r)},children:N},W)}return e.jsx(te.Button,{type:"button",variant:h?"solid":v,colorScheme:h?"primary":"neutral",className:U,"aria-label":A.label,"aria-current":h?"page":void 0,"aria-disabled":$||void 0,onClick:()=>{r!==null&&F(r)},children:N},W)},I=n>1?n-1:null,R=n<m?n+1:null,T=n>1?1:null,B=n<m?m:null,M=s=>y("previous",I,e.jsxs(e.Fragment,{children:[e.jsx(L,{dir:"left"}),s&&e.jsx("span",{className:"rst:hidden rst:pr-1 rst:@[36rem]:inline",children:a.previous})]}),{label:a.previousPage(I)}),S=s=>y("next",R,e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:"rst:hidden rst:pl-1 rst:@[36rem]:inline",children:a.next}),e.jsx(L,{dir:"right"})]}),{label:a.nextPage(R)}),K=s=>y("first",T,e.jsx(L,{dir:"left",double:!0}),{label:a.firstPage(T),className:s?"rst:hidden rst:@[24rem]:inline-flex":void 0}),V=s=>y("last",B,e.jsx(L,{dir:"right",double:!0}),{label:a.lastPage(B),className:s?"rst:hidden rst:@[24rem]:inline-flex":void 0}),q="rst:flex rst:flex-wrap rst:items-center rst:gap-1",D={start:"rst:justify-start",center:"rst:justify-center",end:"rst:justify-end"}[x],O=s=>e.jsxs("div",{className:b.cn(q,D,s),"data-pagination-layout":"pages",children:[M(!0),Q.pageItems(n,m,j).map(r=>typeof r=="number"?y("page",r,a.number(r),{label:a.page(r)}):e.jsx("span",{"aria-hidden":"true",className:"rst:inline-flex rst:h-11 rst:w-11 rst:items-center rst:justify-center rst:text-sm rst:text-gray-500 rst:dark:text-gray-400",children:a.gap},r)),S(!0)]}),_=`${C}-picker`,z=`${C}-of`,G=s=>e.jsxs("div",{className:b.cn(q,D,s),"data-pagination-layout":"compact",children:[p&&K(!0),M(!1),e.jsxs("div",{className:"rst:flex rst:items-center rst:gap-2 rst:px-1 rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]",children:[e.jsx("label",{htmlFor:_,children:a.picker}),e.jsxs("span",{className:"rst:relative rst:inline-flex",children:[e.jsx(ce,{id:_,describedBy:z,page:n,pageCount:m,number:a.number,onCommit:r=>{if(o){c?.(r);const N=o(r);k?k(N):window.location.assign(N)}else F(r)}}),e.jsx("svg",{...X,width:16,height:16,className:"rst:pointer-events-none rst:absolute rst:right-2.5 rst:top-1/2 rst:-translate-y-1/2 rst:text-gray-500 rst:dark:text-gray-400",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]}),e.jsx("span",{id:z,className:"rst:tabular-nums",children:a.of(m)})]}),S(!1),p&&V(!0)]}),H=e.jsxs("div",{className:b.cn(q,D),"data-pagination-layout":"arrows",children:[p&&K(!1),M(!1),S(!1),p&&V(!1)]});return e.jsxs("nav",{"aria-label":a.nav,className:b.cn("rst:font-ui",u==="arrows"?"rst:w-fit":"rst:@container rst:w-full rst:[contain-intrinsic-inline-size:18rem]",f),"data-pagination":"",children:[u==="pages"&&O(),u==="compact"&&G(),u==="arrows"&&H,u==="auto"&&e.jsxs(e.Fragment,{children:[O("rst:hidden rst:@[28rem]:flex"),G("rst:@[28rem]:hidden")]}),P&&e.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"rst:sr-only","data-pagination-live":"",children:E.text})]})}exports.Pagination=ue;
@@ -96,6 +96,7 @@ export interface PaginationProps {
96
96
  variant?: "ghost" | "outline";
97
97
  /** Say the new page in a polite live region when it changes. */
98
98
  announce?: boolean;
99
+ /** The component's own words, replaced; any left out stay English. */
99
100
  labels?: Partial<PaginationLabels>;
100
101
  className?: string;
101
102
  }
@@ -1,12 +1,13 @@
1
1
  "use client";
2
- import { jsxs as u, Fragment as I, jsx as e } from "react/jsx-runtime";
3
- import { useId as et, useState as X, useRef as rt, useMemo as st } from "react";
2
+ import { jsxs as u, Fragment as I, jsx as r } from "react/jsx-runtime";
3
+ import { useId as rt, useState as X, useRef as et, useMemo as st } from "react";
4
4
  import { cn as x } from "../../../lib/utils.js";
5
- import { Button as at } from "../../atoms/Button/Button.js";
6
- import { buttonVariants as nt } from "../../atoms/Button/button-variants.js";
7
- import { selectTriggerVariants as it } from "../../atoms/Select/select-variants.js";
8
- import { clampPage as lt, pageItems as ot } from "./page-items.js";
9
- const ct = {
5
+ import { withLabels as at } from "../../../lib/labels.js";
6
+ import { Button as nt } from "../../atoms/Button/Button.js";
7
+ import { buttonVariants as it } from "../../atoms/Button/button-variants.js";
8
+ import { selectTriggerVariants as lt } from "../../atoms/Select/select-variants.js";
9
+ import { clampPage as ot, pageItems as ct } from "./page-items.js";
10
+ const dt = {
10
11
  nav: "Pagination",
11
12
  page: (t) => `Page ${t}`,
12
13
  number: (t) => String(t),
@@ -21,8 +22,8 @@ const ct = {
21
22
  of: (t) => `of ${t}`,
22
23
  status: (t, i) => `Page ${t} of ${i}`
23
24
  };
24
- function dt({ href: t, className: i, children: c, onClick: o, ...p }) {
25
- return /* @__PURE__ */ e(
25
+ function ut({ href: t, className: i, children: c, onClick: o, ...p }) {
26
+ return /* @__PURE__ */ r(
26
27
  "a",
27
28
  {
28
29
  href: t,
@@ -35,8 +36,8 @@ function dt({ href: t, className: i, children: c, onClick: o, ...p }) {
35
36
  }
36
37
  );
37
38
  }
38
- const ut = "rst:h-11 rst:min-w-11 rst:px-2", pt = "rst:cursor-not-allowed rst:opacity-50", ft = "rst:forced-colors:border-2 rst:forced-colors:underline rst:forced-colors:decoration-2 rst:forced-colors:underline-offset-4", Y = { width: 18, height: 18, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0 }, j = ({ dir: t, double: i = !1 }) => /* @__PURE__ */ e("svg", { ...Y, className: "rst:shrink-0", children: t === "left" ? i ? /* @__PURE__ */ e("path", { d: "m11 17-5-5 5-5M18 17l-5-5 5-5" }) : /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" }) : i ? /* @__PURE__ */ e("path", { d: "m13 17 5-5-5-5M6 17l5-5-5-5" }) : /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" }) });
39
- function mt({
39
+ const pt = "rst:h-11 rst:min-w-11 rst:px-2", ft = "rst:cursor-not-allowed rst:opacity-50", mt = "rst:forced-colors:border-2 rst:forced-colors:underline rst:forced-colors:decoration-2 rst:forced-colors:underline-offset-4", Y = { width: 18, height: 18, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0 }, j = ({ dir: t, double: i = !1 }) => /* @__PURE__ */ r("svg", { ...Y, className: "rst:shrink-0", children: t === "left" ? i ? /* @__PURE__ */ r("path", { d: "m11 17-5-5 5-5M18 17l-5-5 5-5" }) : /* @__PURE__ */ r("path", { d: "m15 18-6-6 6-6" }) : i ? /* @__PURE__ */ r("path", { d: "m13 17 5-5-5-5M6 17l5-5-5-5" }) : /* @__PURE__ */ r("path", { d: "m9 18 6-6-6-6" }) });
40
+ function ht({
40
41
  id: t,
41
42
  describedBy: i,
42
43
  page: c,
@@ -44,13 +45,13 @@ function mt({
44
45
  number: p,
45
46
  onCommit: P
46
47
  }) {
47
- const [d, N] = X(null), f = rt(!1), v = d && d.page === c ? d.value : null, y = (l) => {
48
+ const [d, N] = X(null), f = et(!1), v = d && d.page === c ? d.value : null, y = (l) => {
48
49
  N(null), l !== c && P(l);
49
50
  }, $ = st(
50
- () => Array.from({ length: o }, (l, m) => /* @__PURE__ */ e("option", { value: m + 1, children: p(m + 1) }, m + 1)),
51
+ () => Array.from({ length: o }, (l, m) => /* @__PURE__ */ r("option", { value: m + 1, children: p(m + 1) }, m + 1)),
51
52
  [o, p]
52
53
  );
53
- return /* @__PURE__ */ e(
54
+ return /* @__PURE__ */ r(
54
55
  "select",
55
56
  {
56
57
  id: t,
@@ -78,7 +79,7 @@ function mt({
78
79
  v !== null && y(v);
79
80
  },
80
81
  className: x(
81
- it({ variant: "outline" }),
82
+ lt({ variant: "outline" }),
82
83
  /* 16px: iOS zooms the page into a select whose text is smaller. */
83
84
  "rst:h-11 rst:w-auto rst:min-w-16 rst:appearance-none rst:pl-3 rst:pr-8 rst:text-base rst:tabular-nums"
84
85
  ),
@@ -87,7 +88,7 @@ function mt({
87
88
  }
88
89
  );
89
90
  }
90
- function kt({
91
+ function $t({
91
92
  page: t,
92
93
  pageCount: i,
93
94
  onPageChange: c,
@@ -103,20 +104,20 @@ function kt({
103
104
  labels: l,
104
105
  className: m
105
106
  }) {
106
- const a = { ...ct, ...l }, h = Number.isFinite(i) ? Math.max(0, Math.floor(i)) : 0, n = lt(t, h), S = et(), Z = p ?? dt, [T, H] = X({ page: n, text: "" });
107
+ const a = at(dt, l), h = Number.isFinite(i) ? Math.max(0, Math.floor(i)) : 0, n = ot(t, h), S = rt(), Z = p ?? ut, [T, H] = X({ page: n, text: "" });
107
108
  T.page !== n && H({ page: n, text: $ ? a.status(n, h) : "" });
108
- const D = (r) => {
109
- r !== Math.floor(t) && c?.(r);
110
- }, w = (r, s, k, F) => {
111
- const g = r === "page" && s === n, L = s === null, q = x(ut, L && pt, g && ft, F.className), J = r === "page" ? `page-${s}` : r;
109
+ const D = (e) => {
110
+ e !== Math.floor(t) && c?.(e);
111
+ }, w = (e, s, k, F) => {
112
+ const g = e === "page" && s === n, L = s === null, q = x(pt, L && ft, g && mt, F.className), J = e === "page" ? `page-${s}` : e;
112
113
  if (o) {
113
114
  const Q = o(s ?? n);
114
- return /* @__PURE__ */ e(
115
+ return /* @__PURE__ */ r(
115
116
  Z,
116
117
  {
117
118
  href: Q,
118
119
  to: Q,
119
- className: x(nt({ variant: g ? "solid" : y, colorScheme: g ? "primary" : "neutral" }), q),
120
+ className: x(it({ variant: g ? "solid" : y, colorScheme: g ? "primary" : "neutral" }), q),
120
121
  "aria-label": F.label,
121
122
  "aria-current": g ? "page" : void 0,
122
123
  "aria-disabled": L ? !0 : void 0,
@@ -132,8 +133,8 @@ function kt({
132
133
  J
133
134
  );
134
135
  }
135
- return /* @__PURE__ */ e(
136
- at,
136
+ return /* @__PURE__ */ r(
137
+ nt,
137
138
  {
138
139
  type: "button",
139
140
  variant: g ? "solid" : y,
@@ -149,42 +150,42 @@ function kt({
149
150
  },
150
151
  J
151
152
  );
152
- }, B = n > 1 ? n - 1 : null, K = n < h ? n + 1 : null, R = n > 1 ? 1 : null, O = n < h ? h : null, M = (r) => w(
153
+ }, B = n > 1 ? n - 1 : null, K = n < h ? n + 1 : null, R = n > 1 ? 1 : null, O = n < h ? h : null, M = (e) => w(
153
154
  "previous",
154
155
  B,
155
156
  /* @__PURE__ */ u(I, { children: [
156
- /* @__PURE__ */ e(j, { dir: "left" }),
157
- r && /* @__PURE__ */ e("span", { className: "rst:hidden rst:pr-1 rst:@[36rem]:inline", children: a.previous })
157
+ /* @__PURE__ */ r(j, { dir: "left" }),
158
+ e && /* @__PURE__ */ r("span", { className: "rst:hidden rst:pr-1 rst:@[36rem]:inline", children: a.previous })
158
159
  ] }),
159
160
  { label: a.previousPage(B) }
160
- ), A = (r) => w(
161
+ ), A = (e) => w(
161
162
  "next",
162
163
  K,
163
164
  /* @__PURE__ */ u(I, { children: [
164
- r && /* @__PURE__ */ e("span", { className: "rst:hidden rst:pl-1 rst:@[36rem]:inline", children: a.next }),
165
- /* @__PURE__ */ e(j, { dir: "right" })
165
+ e && /* @__PURE__ */ r("span", { className: "rst:hidden rst:pl-1 rst:@[36rem]:inline", children: a.next }),
166
+ /* @__PURE__ */ r(j, { dir: "right" })
166
167
  ] }),
167
168
  { label: a.nextPage(K) }
168
- ), V = (r) => w("first", R, /* @__PURE__ */ e(j, { dir: "left", double: !0 }), {
169
+ ), V = (e) => w("first", R, /* @__PURE__ */ r(j, { dir: "left", double: !0 }), {
169
170
  label: a.firstPage(R),
170
- className: r ? "rst:hidden rst:@[24rem]:inline-flex" : void 0
171
- }), _ = (r) => w("last", O, /* @__PURE__ */ e(j, { dir: "right", double: !0 }), {
171
+ className: e ? "rst:hidden rst:@[24rem]:inline-flex" : void 0
172
+ }), _ = (e) => w("last", O, /* @__PURE__ */ r(j, { dir: "right", double: !0 }), {
172
173
  label: a.lastPage(O),
173
- className: r ? "rst:hidden rst:@[24rem]:inline-flex" : void 0
174
- }), C = "rst:flex rst:flex-wrap rst:items-center rst:gap-1", E = { start: "rst:justify-start", center: "rst:justify-center", end: "rst:justify-end" }[v], z = (r) => /* @__PURE__ */ u("div", { className: x(C, E, r), "data-pagination-layout": "pages", children: [
174
+ className: e ? "rst:hidden rst:@[24rem]:inline-flex" : void 0
175
+ }), C = "rst:flex rst:flex-wrap rst:items-center rst:gap-1", E = { start: "rst:justify-start", center: "rst:justify-center", end: "rst:justify-end" }[v], z = (e) => /* @__PURE__ */ u("div", { className: x(C, E, e), "data-pagination-layout": "pages", children: [
175
176
  M(!0),
176
- ot(n, h, N).map(
177
- (s) => typeof s == "number" ? w("page", s, a.number(s), { label: a.page(s) }) : /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "rst:inline-flex rst:h-11 rst:w-11 rst:items-center rst:justify-center rst:text-sm rst:text-gray-500 rst:dark:text-gray-400", children: a.gap }, s)
177
+ ct(n, h, N).map(
178
+ (s) => typeof s == "number" ? w("page", s, a.number(s), { label: a.page(s) }) : /* @__PURE__ */ r("span", { "aria-hidden": "true", className: "rst:inline-flex rst:h-11 rst:w-11 rst:items-center rst:justify-center rst:text-sm rst:text-gray-500 rst:dark:text-gray-400", children: a.gap }, s)
178
179
  ),
179
180
  A(!0)
180
- ] }), G = `${S}-picker`, U = `${S}-of`, W = (r) => /* @__PURE__ */ u("div", { className: x(C, E, r), "data-pagination-layout": "compact", children: [
181
+ ] }), G = `${S}-picker`, U = `${S}-of`, W = (e) => /* @__PURE__ */ u("div", { className: x(C, E, e), "data-pagination-layout": "compact", children: [
181
182
  f && V(!0),
182
183
  M(!1),
183
184
  /* @__PURE__ */ u("div", { className: "rst:flex rst:items-center rst:gap-2 rst:px-1 rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]", children: [
184
- /* @__PURE__ */ e("label", { htmlFor: G, children: a.picker }),
185
+ /* @__PURE__ */ r("label", { htmlFor: G, children: a.picker }),
185
186
  /* @__PURE__ */ u("span", { className: "rst:relative rst:inline-flex", children: [
186
- /* @__PURE__ */ e(
187
- mt,
187
+ /* @__PURE__ */ r(
188
+ ht,
188
189
  {
189
190
  id: G,
190
191
  describedBy: U,
@@ -200,9 +201,9 @@ function kt({
200
201
  }
201
202
  }
202
203
  ),
203
- /* @__PURE__ */ e("svg", { ...Y, width: 16, height: 16, className: "rst:pointer-events-none rst:absolute rst:right-2.5 rst:top-1/2 rst:-translate-y-1/2 rst:text-gray-500 rst:dark:text-gray-400", children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" }) })
204
+ /* @__PURE__ */ r("svg", { ...Y, width: 16, height: 16, className: "rst:pointer-events-none rst:absolute rst:right-2.5 rst:top-1/2 rst:-translate-y-1/2 rst:text-gray-500 rst:dark:text-gray-400", children: /* @__PURE__ */ r("path", { d: "m6 9 6 6 6-6" }) })
204
205
  ] }),
205
- /* @__PURE__ */ e("span", { id: U, className: "rst:tabular-nums", children: a.of(h) })
206
+ /* @__PURE__ */ r("span", { id: U, className: "rst:tabular-nums", children: a.of(h) })
206
207
  ] }),
207
208
  A(!1),
208
209
  f && _(!0)
@@ -236,12 +237,12 @@ function kt({
236
237
  z("rst:hidden rst:@[28rem]:flex"),
237
238
  W("rst:@[28rem]:hidden")
238
239
  ] }),
239
- $ && /* @__PURE__ */ e("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", className: "rst:sr-only", "data-pagination-live": "", children: T.text })
240
+ $ && /* @__PURE__ */ r("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", className: "rst:sr-only", "data-pagination-live": "", children: T.text })
240
241
  ]
241
242
  }
242
243
  )
243
244
  );
244
245
  }
245
246
  export {
246
- kt as Pagination
247
+ $t as Pagination
247
248
  };
@@ -7,6 +7,7 @@ export interface ProgressFieldProps extends Pick<ProgressProps, "value" | "max"
7
7
  valueText?: string;
8
8
  /** A line under the bar: bytes, a step counter, a time left. */
9
9
  detail?: ReactNode;
10
+ /** The component's own words, replaced; any left out stay English. */
10
11
  labels?: Partial<ProgressLabels>;
11
12
  className?: string;
12
13
  }
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../lib/utils.cjs"),m=require("../../atoms/Card/Card.cjs"),j=require("../../atoms/Eyebrow/Eyebrow.cjs"),c=require("../../atoms/Stat/stat-variants.cjs"),h=require("../../organisms/Table/Table.cjs"),t=require("../../atoms/Skeleton/Skeleton.cjs");function k({media:r,lines:a=3,variant:s,padding:i,className:n}){return e.jsxs(m.Card,{variant:s,padding:i,className:n,"aria-hidden":"true","data-skeleton":"card",children:[r!==void 0&&e.jsx(t.Skeleton,{shape:"block",height:r,className:"rst:mb-4"}),e.jsx(t.Skeleton,{size:"lg",width:"45%"}),a>0&&e.jsx(t.Skeleton,{size:"md",lines:a,className:"rst:mt-2"})]})}function S({columns:r,className:a}){const s=["70%","50%","60%","40%"];return e.jsx(h.TableRow,{"aria-hidden":"true",className:a,"data-skeleton":"table-row",children:Array.from({length:Math.max(1,r)},(i,n)=>e.jsx(h.TableCell,{children:e.jsx(t.Skeleton,{size:"inherit",width:s[n%s.length]})},n))})}function w({size:r="md",withName:a=!1,className:s}){return a?e.jsxs("span",{"aria-hidden":"true",className:l.cn("rst:flex rst:items-center rst:gap-3",s),"data-skeleton":"avatar",children:[e.jsx(t.Skeleton,{shape:"circle",size:r}),e.jsx(t.Skeleton,{size:"md",width:"8rem"})]}):e.jsx(t.Skeleton,{shape:"circle",size:r,className:s})}function b({size:r="md",semantics:a="definition",source:s=!1,className:i}){const n=c.statValueVariants({size:r,colorScheme:"neutral"}),o=e.jsx(t.Skeleton,{size:"inherit",width:"2.5em"}),d=x=>e.jsx(j.Eyebrow,{size:"xs",children:e.jsx(t.Skeleton,{size:"inherit",width:"9em",className:x?"rst:inline-block rst:align-baseline":void 0})}),u=e.jsx("span",{className:c.statSourceClass,children:e.jsx(t.Skeleton,{size:"inherit",width:"12em"})});return a==="standalone"?e.jsxs("span",{"aria-hidden":"true",className:l.cn("rst:flex rst:flex-col rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("span",{className:n,children:o}),d(!1),s&&u]}):e.jsxs("div",{"aria-hidden":"true",className:l.cn("rst:grid rst:content-start rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("dt",{className:"rst:relative rst:col-start-1 rst:row-start-2",children:d(!0)}),s?e.jsxs("dd",{className:l.cn("rst:m-0",n,"rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"),children:[e.jsx("span",{className:"rst:row-start-1",children:o}),e.jsx("span",{className:l.cn(c.statSourceClass,"rst:row-start-3"),children:e.jsx(t.Skeleton,{size:"inherit",width:"12em"})})]}):e.jsx("dd",{className:l.cn("rst:m-0 rst:col-start-1 rst:row-start-1",n),children:o})]})}exports.SkeletonAvatar=w;exports.SkeletonCard=k;exports.SkeletonStat=b;exports.SkeletonTableRow=S;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../lib/utils.cjs"),x=require("../../atoms/Card/Card.cjs"),m=require("../../atoms/Eyebrow/Eyebrow.cjs"),c=require("../../atoms/Stat/stat-variants.cjs"),h=require("../../organisms/Table/Table.cjs"),t=require("../../atoms/Skeleton/Skeleton.cjs");function j({media:r,lines:a=3,variant:s,padding:i,className:n}){return e.jsxs(x.Card,{variant:s,padding:i,className:n,"aria-hidden":"true","data-skeleton":"card",children:[r!==void 0&&e.jsx(t.Skeleton,{shape:"block",height:r,className:"rst:mb-4"}),e.jsx(t.Skeleton,{size:"lg",width:"45%"}),a>0&&e.jsx(t.Skeleton,{size:"md",lines:a,className:"rst:mt-2"})]})}function S({columns:r,className:a}){const s=["70%","50%","60%","40%"];return e.jsx(h.TableRow,{"aria-hidden":"true",className:a,"data-skeleton":"table-row",children:Array.from({length:Math.max(1,r)},(i,n)=>e.jsx(h.TableCell,{children:e.jsx(t.Skeleton,{size:"inherit",width:s[n%s.length]})},n))})}function k({size:r="md",withName:a=!1,className:s}){return a?e.jsxs("span",{"aria-hidden":"true",className:l.cn("rst:flex rst:items-center rst:gap-3",s),"data-skeleton":"avatar",children:[e.jsx(t.Skeleton,{shape:"circle",size:r}),e.jsx(t.Skeleton,{size:"md",width:"8rem"})]}):e.jsx(t.Skeleton,{shape:"circle",size:r,className:s})}function w({size:r="md",semantics:a="definition",source:s=!1,className:i}){const n=c.statValueVariants({size:r,colorScheme:"neutral"}),o=e.jsx(t.Skeleton,{size:"inherit",width:"2.5em"}),d=e.jsx(m.Eyebrow,{size:"xs",children:e.jsx(t.Skeleton,{size:"inherit",width:"9em"})}),u=e.jsx("span",{className:c.statSourceClass,children:e.jsx(t.Skeleton,{size:"inherit",width:"12em"})});return a==="standalone"?e.jsxs("span",{"aria-hidden":"true",className:l.cn("rst:flex rst:flex-col rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("span",{className:n,children:o}),d,s&&u]}):e.jsxs("div",{"aria-hidden":"true",className:l.cn("rst:grid rst:content-start rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("dt",{className:"rst:relative rst:col-start-1 rst:row-start-2 rst:flex",children:d}),s?e.jsxs("dd",{className:l.cn("rst:m-0",n,"rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"),children:[e.jsx("span",{className:"rst:row-start-1",children:o}),e.jsx("span",{className:l.cn(c.statSourceClass,"rst:row-start-3"),children:e.jsx(t.Skeleton,{size:"inherit",width:"12em"})})]}):e.jsx("dd",{className:l.cn("rst:m-0 rst:col-start-1 rst:row-start-1",n),children:o})]})}exports.SkeletonAvatar=k;exports.SkeletonCard=j;exports.SkeletonStat=w;exports.SkeletonTableRow=S;
@@ -48,8 +48,8 @@ export interface SkeletonStatProps {
48
48
  /**
49
49
  * A Stat loading. Stat's own markup in each of its forms, with lines in place
50
50
  * of its words, so the figure that arrives is the height of what held it:
51
- * the label is the real Eyebrow, inline in a `dt` where Stat's is, so it
52
- * takes the same line box.
51
+ * the label is the real Eyebrow, a flex item where Stat's is, so it makes the
52
+ * same line.
53
53
  */
54
54
  declare function SkeletonStat({ size, semantics, source, className }: SkeletonStatProps): import("react/jsx-runtime").JSX.Element;
55
55
  export { SkeletonCard, SkeletonTableRow, SkeletonAvatar, SkeletonStat };