@apipass/design-system 7.4.7 → 8.1.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 (104) hide show
  1. package/dist/lib/embedded-styles.js +2 -2
  2. package/dist/lib/lib.index.cjs +1 -1
  3. package/dist/lib/lib.index.js +809 -795
  4. package/dist/lib/lib.index.js.map +1 -1
  5. package/dist/lib/style.css +1 -1
  6. package/dist/lib/ui/components/ConfirmDialog/ConfirmDialog.cjs +1 -1
  7. package/dist/lib/ui/components/ConfirmDialog/ConfirmDialog.cjs.map +1 -1
  8. package/dist/lib/ui/components/ConfirmDialog/ConfirmDialog.js +27 -25
  9. package/dist/lib/ui/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
  10. package/dist/lib/ui/components/DataTable/DataTable.cjs +1 -1
  11. package/dist/lib/ui/components/DataTable/DataTable.cjs.map +1 -1
  12. package/dist/lib/ui/components/DataTable/DataTable.js +210 -174
  13. package/dist/lib/ui/components/DataTable/DataTable.js.map +1 -1
  14. package/dist/lib/ui/components/FormModal/FormModal.cjs +1 -1
  15. package/dist/lib/ui/components/FormModal/FormModal.cjs.map +1 -1
  16. package/dist/lib/ui/components/FormModal/FormModal.js +22 -21
  17. package/dist/lib/ui/components/FormModal/FormModal.js.map +1 -1
  18. package/dist/lib/ui/components/LoadingOverlay/LoadingOverlay.cjs +2 -0
  19. package/dist/lib/ui/components/LoadingOverlay/LoadingOverlay.cjs.map +1 -0
  20. package/dist/lib/ui/components/LoadingOverlay/LoadingOverlay.js +36 -0
  21. package/dist/lib/ui/components/LoadingOverlay/LoadingOverlay.js.map +1 -0
  22. package/dist/lib/ui/components/PageLoadingState/PageLoadingState.cjs +2 -0
  23. package/dist/lib/ui/components/PageLoadingState/PageLoadingState.cjs.map +1 -0
  24. package/dist/lib/ui/components/PageLoadingState/PageLoadingState.js +18 -0
  25. package/dist/lib/ui/components/PageLoadingState/PageLoadingState.js.map +1 -0
  26. package/dist/lib/ui/hooks/useAnimationFrame.cjs +2 -0
  27. package/dist/lib/ui/hooks/useAnimationFrame.cjs.map +1 -0
  28. package/dist/lib/ui/hooks/useAnimationFrame.js +24 -0
  29. package/dist/lib/ui/hooks/useAnimationFrame.js.map +1 -0
  30. package/dist/lib/ui/hooks/useLoadingVisibility.cjs +2 -0
  31. package/dist/lib/ui/hooks/useLoadingVisibility.cjs.map +1 -0
  32. package/dist/lib/ui/hooks/useLoadingVisibility.js +34 -0
  33. package/dist/lib/ui/hooks/useLoadingVisibility.js.map +1 -0
  34. package/dist/lib/ui/hooks/useMediaQuery.cjs +1 -1
  35. package/dist/lib/ui/hooks/useMediaQuery.cjs.map +1 -1
  36. package/dist/lib/ui/hooks/useMediaQuery.js +5 -2
  37. package/dist/lib/ui/hooks/useMediaQuery.js.map +1 -1
  38. package/dist/lib/ui/primitives/BrandLoader/BrandLoader.cjs +2 -0
  39. package/dist/lib/ui/primitives/BrandLoader/BrandLoader.cjs.map +1 -0
  40. package/dist/lib/ui/primitives/BrandLoader/BrandLoader.js +165 -0
  41. package/dist/lib/ui/primitives/BrandLoader/BrandLoader.js.map +1 -0
  42. package/dist/lib/ui/primitives/BrandLoader/BrandLoaderProvider.cjs +2 -0
  43. package/dist/lib/ui/primitives/BrandLoader/BrandLoaderProvider.cjs.map +1 -0
  44. package/dist/lib/ui/primitives/BrandLoader/BrandLoaderProvider.js +9 -0
  45. package/dist/lib/ui/primitives/BrandLoader/BrandLoaderProvider.js.map +1 -0
  46. package/dist/lib/ui/primitives/BrandLoader/brandLoaderSymbolContext.cjs +2 -0
  47. package/dist/lib/ui/primitives/BrandLoader/brandLoaderSymbolContext.cjs.map +1 -0
  48. package/dist/lib/ui/primitives/BrandLoader/brandLoaderSymbolContext.js +10 -0
  49. package/dist/lib/ui/primitives/BrandLoader/brandLoaderSymbolContext.js.map +1 -0
  50. package/dist/lib/ui/primitives/BrandLoader/brandLoaderVariants.cjs +2 -0
  51. package/dist/lib/ui/primitives/BrandLoader/brandLoaderVariants.cjs.map +1 -0
  52. package/dist/lib/ui/primitives/BrandLoader/brandLoaderVariants.js +166 -0
  53. package/dist/lib/ui/primitives/BrandLoader/brandLoaderVariants.js.map +1 -0
  54. package/dist/lib/ui/primitives/Button/Button.cjs +1 -1
  55. package/dist/lib/ui/primitives/Button/Button.cjs.map +1 -1
  56. package/dist/lib/ui/primitives/Button/Button.js +72 -49
  57. package/dist/lib/ui/primitives/Button/Button.js.map +1 -1
  58. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.cjs +1 -1
  59. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.cjs.map +1 -1
  60. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.js +235 -229
  61. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.js.map +1 -1
  62. package/dist/lib/ui/primitives/DateRangePicker/dateRangePresets.cjs +1 -1
  63. package/dist/lib/ui/primitives/DateRangePicker/dateRangePresets.cjs.map +1 -1
  64. package/dist/lib/ui/primitives/DateRangePicker/dateRangePresets.js +26 -21
  65. package/dist/lib/ui/primitives/DateRangePicker/dateRangePresets.js.map +1 -1
  66. package/dist/lib/ui/primitives/IconButton/IconButton.cjs +1 -1
  67. package/dist/lib/ui/primitives/IconButton/IconButton.cjs.map +1 -1
  68. package/dist/lib/ui/primitives/IconButton/IconButton.js +11 -11
  69. package/dist/lib/ui/primitives/IconButton/IconButton.js.map +1 -1
  70. package/dist/lib/ui/primitives/LoadingState/LoadingState.cjs +2 -0
  71. package/dist/lib/ui/primitives/LoadingState/LoadingState.cjs.map +1 -0
  72. package/dist/lib/ui/primitives/LoadingState/LoadingState.js +33 -0
  73. package/dist/lib/ui/primitives/LoadingState/LoadingState.js.map +1 -0
  74. package/dist/lib/ui/primitives/PermissionGate/PermissionGate.cjs +1 -1
  75. package/dist/lib/ui/primitives/PermissionGate/PermissionGate.cjs.map +1 -1
  76. package/dist/lib/ui/primitives/PermissionGate/PermissionGate.js +14 -9
  77. package/dist/lib/ui/primitives/PermissionGate/PermissionGate.js.map +1 -1
  78. package/dist/lib/ui/primitives/Tree/Tree.cjs +1 -1
  79. package/dist/lib/ui/primitives/Tree/Tree.cjs.map +1 -1
  80. package/dist/lib/ui/primitives/Tree/Tree.js +31 -24
  81. package/dist/lib/ui/primitives/Tree/Tree.js.map +1 -1
  82. package/dist/types/ui/components/DataTable/DataTable.d.ts +31 -8
  83. package/dist/types/ui/components/LoadingOverlay/LoadingOverlay.d.ts +13 -0
  84. package/dist/types/ui/components/PageLoadingState/PageLoadingState.d.ts +4 -0
  85. package/dist/types/ui/components/index.d.ts +2 -1
  86. package/dist/types/ui/hooks/index.d.ts +1 -0
  87. package/dist/types/ui/hooks/useAnimationFrame.d.ts +3 -0
  88. package/dist/types/ui/hooks/useLoadingVisibility.d.ts +7 -0
  89. package/dist/types/ui/primitives/BrandLoader/BrandLoader.d.ts +25 -0
  90. package/dist/types/ui/primitives/BrandLoader/BrandLoaderProvider.d.ts +7 -0
  91. package/dist/types/ui/primitives/BrandLoader/brandLoaderSymbolContext.d.ts +3 -0
  92. package/dist/types/ui/primitives/BrandLoader/brandLoaderVariants.d.ts +33 -0
  93. package/dist/types/ui/primitives/Button/Button.d.ts +1 -0
  94. package/dist/types/ui/primitives/DateRangePicker/DateRangePicker.d.ts +3 -2
  95. package/dist/types/ui/primitives/DateRangePicker/dateRangePresets.d.ts +5 -0
  96. package/dist/types/ui/primitives/LoadingState/LoadingState.d.ts +10 -0
  97. package/dist/types/ui/primitives/PermissionGate/PermissionGate.d.ts +16 -6
  98. package/dist/types/ui/primitives/index.d.ts +2 -0
  99. package/package.json +4 -2
  100. package/dist/lib/ui/components/WidgetLoadingState/WidgetLoadingState.cjs +0 -2
  101. package/dist/lib/ui/components/WidgetLoadingState/WidgetLoadingState.cjs.map +0 -1
  102. package/dist/lib/ui/components/WidgetLoadingState/WidgetLoadingState.js +0 -27
  103. package/dist/lib/ui/components/WidgetLoadingState/WidgetLoadingState.js.map +0 -1
  104. package/dist/types/ui/components/WidgetLoadingState/WidgetLoadingState.d.ts +0 -6
@@ -1,42 +1,43 @@
1
- import { jsx as r, jsxs as a } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
2
2
  /* empty css */
3
- import { DialogModal as h, Dialog as u, DialogTitle as D, DialogClose as y, DialogBody as P } from "../../primitives/Dialog/Dialog.js";
4
- import { Flex as o } from "../../layout/Flex/Flex.js";
5
- import { Button as n } from "../../primitives/Button/Button.js";
3
+ import { DialogModal as h, Dialog as u, DialogTitle as D, DialogClose as P, DialogBody as y } from "../../primitives/Dialog/Dialog.js";
4
+ import { Flex as a } from "../../layout/Flex/Flex.js";
5
+ import { Button as l } from "../../primitives/Button/Button.js";
6
6
  function B({
7
- isOpen: l,
7
+ isOpen: o,
8
8
  title: m,
9
- submitLabel: t = "Save",
10
- cancelLabel: c = "Cancel",
11
- isLoading: e = !1,
12
- isSubmitDisabled: d = !1,
9
+ submitLabel: d = "Save",
10
+ cancelLabel: t = "Cancel",
11
+ isLoading: n = !1,
12
+ isSubmitDisabled: c = !1,
13
13
  size: s = "medium",
14
14
  onSubmit: f,
15
- onClose: i,
16
- children: p
15
+ onClose: e,
16
+ children: g
17
17
  }) {
18
- return l ? /* @__PURE__ */ r(h, { isOpen: l, onOpenChange: (g) => !g && i(), children: /* @__PURE__ */ a(u, { className: "form-modal", size: s, children: [
19
- /* @__PURE__ */ a(o, { direction: "row", alignPrimary: "space-between", alignSecondary: "center", children: [
18
+ return o ? /* @__PURE__ */ r(h, { isOpen: o, onOpenChange: (p) => !p && e(), children: /* @__PURE__ */ i(u, { className: "form-modal", size: s, children: [
19
+ /* @__PURE__ */ i(a, { direction: "row", alignPrimary: "space-between", alignSecondary: "center", children: [
20
20
  /* @__PURE__ */ r(D, { children: m }),
21
- /* @__PURE__ */ r(y, { onPress: i })
21
+ /* @__PURE__ */ r(P, { onPress: e })
22
22
  ] }),
23
- /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(o, { direction: "column", gap: "300", children: p }) }),
24
- /* @__PURE__ */ a(
25
- o,
23
+ /* @__PURE__ */ r(y, { children: /* @__PURE__ */ r(a, { direction: "column", gap: "300", children: g }) }),
24
+ /* @__PURE__ */ i(
25
+ a,
26
26
  {
27
27
  direction: "row",
28
28
  gap: "200",
29
29
  alignPrimary: "end",
30
30
  className: "form-modal-footer",
31
31
  children: [
32
- /* @__PURE__ */ r(n, { variant: "neutral", onPress: i, isDisabled: e, children: c }),
32
+ /* @__PURE__ */ r(l, { variant: "neutral", onPress: e, isDisabled: n, children: t }),
33
33
  /* @__PURE__ */ r(
34
- n,
34
+ l,
35
35
  {
36
36
  variant: "primary",
37
37
  onPress: f,
38
- isDisabled: d || e,
39
- children: e ? "..." : t
38
+ isDisabled: c,
39
+ isPending: n,
40
+ children: d
40
41
  }
41
42
  )
42
43
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"FormModal.js","sources":["../../../../../src/ui/components/FormModal/FormModal.tsx"],"sourcesContent":["import {\n Button,\n Dialog,\n DialogBody,\n DialogClose,\n DialogModal,\n DialogTitle,\n type DialogSize,\n} from \"primitives\";\nimport { Flex } from \"layout\";\nimport type { ReactNode } from \"react\";\nimport \"./formmodal.css\";\n\nexport type FormModalSize = DialogSize;\n\nexport interface FormModalProps {\n isOpen: boolean;\n title: string;\n submitLabel?: string;\n cancelLabel?: string;\n isLoading?: boolean;\n isSubmitDisabled?: boolean;\n /**\n * Maximum width of the dialog. Defaults to `\"medium\"`, which preserves the\n * previous fixed width. Use `\"large\"`/`\"xlarge\"` for forms that embed wide\n * content such as tables.\n */\n size?: FormModalSize;\n onSubmit: () => void;\n onClose: () => void;\n children: ReactNode;\n}\n\nexport function FormModal({\n isOpen,\n title,\n submitLabel = \"Save\",\n cancelLabel = \"Cancel\",\n isLoading = false,\n isSubmitDisabled = false,\n size = \"medium\",\n onSubmit,\n onClose,\n children,\n}: FormModalProps) {\n if (!isOpen) return null;\n\n return (\n <DialogModal isOpen={isOpen} onOpenChange={(open) => !open && onClose()}>\n <Dialog className=\"form-modal\" size={size}>\n <Flex direction=\"row\" alignPrimary=\"space-between\" alignSecondary=\"center\">\n <DialogTitle>{title}</DialogTitle>\n <DialogClose onPress={onClose} />\n </Flex>\n <DialogBody>\n <Flex direction=\"column\" gap=\"300\">\n {children}\n </Flex>\n </DialogBody>\n <Flex\n direction=\"row\"\n gap=\"200\"\n alignPrimary=\"end\"\n className=\"form-modal-footer\"\n >\n <Button variant=\"neutral\" onPress={onClose} isDisabled={isLoading}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"primary\"\n onPress={onSubmit}\n isDisabled={isSubmitDisabled || isLoading}\n >\n {isLoading ? \"...\" : submitLabel}\n </Button>\n </Flex>\n </Dialog>\n </DialogModal>\n );\n}\n"],"names":["FormModal","isOpen","title","submitLabel","cancelLabel","isLoading","isSubmitDisabled","size","onSubmit","onClose","children","jsx","DialogModal","open","jsxs","Dialog","Flex","DialogTitle","DialogClose","DialogBody","Button"],"mappings":";;;;;AAiCO,SAASA,EAAU;AAAA,EACxB,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,kBAAAC,IAAmB;AAAA,EACnB,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAAmB;AACjB,SAAKT,IAGH,gBAAAU,EAACC,GAAA,EAAY,QAAAX,GAAgB,cAAc,CAACY,MAAS,CAACA,KAAQJ,EAAA,GAC5D,UAAA,gBAAAK,EAACC,GAAA,EAAO,WAAU,cAAa,MAAAR,GAC7B,UAAA;AAAA,IAAA,gBAAAO,EAACE,KAAK,WAAU,OAAM,cAAa,iBAAgB,gBAAe,UAChE,UAAA;AAAA,MAAA,gBAAAL,EAACM,KAAa,UAAAf,EAAA,CAAM;AAAA,MACpB,gBAAAS,EAACO,GAAA,EAAY,SAAST,EAAA,CAAS;AAAA,IAAA,GACjC;AAAA,IACA,gBAAAE,EAACQ,KACC,UAAA,gBAAAR,EAACK,GAAA,EAAK,WAAU,UAAS,KAAI,OAC1B,UAAAN,EAAA,CACH,EAAA,CACF;AAAA,IACA,gBAAAI;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,KAAI;AAAA,QACJ,cAAa;AAAA,QACb,WAAU;AAAA,QAEV,UAAA;AAAA,UAAA,gBAAAL,EAACS,KAAO,SAAQ,WAAU,SAASX,GAAS,YAAYJ,GACrD,UAAAD,EAAA,CACH;AAAA,UACA,gBAAAO;AAAA,YAACS;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAASZ;AAAA,cACT,YAAYF,KAAoBD;AAAA,cAE/B,cAAY,QAAQF;AAAA,YAAA;AAAA,UAAA;AAAA,QACvB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CACF,EAAA,CACF,IAhCkB;AAkCtB;"}
1
+ {"version":3,"file":"FormModal.js","sources":["../../../../../src/ui/components/FormModal/FormModal.tsx"],"sourcesContent":["import {\n Button,\n Dialog,\n DialogBody,\n DialogClose,\n DialogModal,\n DialogTitle,\n type DialogSize,\n} from \"primitives\";\nimport { Flex } from \"layout\";\nimport type { ReactNode } from \"react\";\nimport \"./formmodal.css\";\n\nexport type FormModalSize = DialogSize;\n\nexport interface FormModalProps {\n isOpen: boolean;\n title: string;\n submitLabel?: string;\n cancelLabel?: string;\n isLoading?: boolean;\n isSubmitDisabled?: boolean;\n /**\n * Maximum width of the dialog. Defaults to `\"medium\"`, which preserves the\n * previous fixed width. Use `\"large\"`/`\"xlarge\"` for forms that embed wide\n * content such as tables.\n */\n size?: FormModalSize;\n onSubmit: () => void;\n onClose: () => void;\n children: ReactNode;\n}\n\nexport function FormModal({\n isOpen,\n title,\n submitLabel = \"Save\",\n cancelLabel = \"Cancel\",\n isLoading = false,\n isSubmitDisabled = false,\n size = \"medium\",\n onSubmit,\n onClose,\n children,\n}: FormModalProps) {\n if (!isOpen) return null;\n\n return (\n <DialogModal isOpen={isOpen} onOpenChange={(open) => !open && onClose()}>\n <Dialog className=\"form-modal\" size={size}>\n <Flex direction=\"row\" alignPrimary=\"space-between\" alignSecondary=\"center\">\n <DialogTitle>{title}</DialogTitle>\n <DialogClose onPress={onClose} />\n </Flex>\n <DialogBody>\n <Flex direction=\"column\" gap=\"300\">\n {children}\n </Flex>\n </DialogBody>\n <Flex\n direction=\"row\"\n gap=\"200\"\n alignPrimary=\"end\"\n className=\"form-modal-footer\"\n >\n <Button variant=\"neutral\" onPress={onClose} isDisabled={isLoading}>\n {cancelLabel}\n </Button>\n <Button\n variant=\"primary\"\n onPress={onSubmit}\n isDisabled={isSubmitDisabled}\n isPending={isLoading}\n >\n {submitLabel}\n </Button>\n </Flex>\n </Dialog>\n </DialogModal>\n );\n}\n"],"names":["FormModal","isOpen","title","submitLabel","cancelLabel","isLoading","isSubmitDisabled","size","onSubmit","onClose","children","jsx","DialogModal","open","jsxs","Dialog","Flex","DialogTitle","DialogClose","DialogBody","Button"],"mappings":";;;;;AAiCO,SAASA,EAAU;AAAA,EACxB,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,kBAAAC,IAAmB;AAAA,EACnB,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAAmB;AACjB,SAAKT,IAGH,gBAAAU,EAACC,GAAA,EAAY,QAAAX,GAAgB,cAAc,CAACY,MAAS,CAACA,KAAQJ,EAAA,GAC5D,UAAA,gBAAAK,EAACC,GAAA,EAAO,WAAU,cAAa,MAAAR,GAC7B,UAAA;AAAA,IAAA,gBAAAO,EAACE,KAAK,WAAU,OAAM,cAAa,iBAAgB,gBAAe,UAChE,UAAA;AAAA,MAAA,gBAAAL,EAACM,KAAa,UAAAf,EAAA,CAAM;AAAA,MACpB,gBAAAS,EAACO,GAAA,EAAY,SAAST,EAAA,CAAS;AAAA,IAAA,GACjC;AAAA,IACA,gBAAAE,EAACQ,KACC,UAAA,gBAAAR,EAACK,GAAA,EAAK,WAAU,UAAS,KAAI,OAC1B,UAAAN,EAAA,CACH,EAAA,CACF;AAAA,IACA,gBAAAI;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,KAAI;AAAA,QACJ,cAAa;AAAA,QACb,WAAU;AAAA,QAEV,UAAA;AAAA,UAAA,gBAAAL,EAACS,KAAO,SAAQ,WAAU,SAASX,GAAS,YAAYJ,GACrD,UAAAD,EAAA,CACH;AAAA,UACA,gBAAAO;AAAA,YAACS;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAASZ;AAAA,cACT,YAAYF;AAAA,cACZ,WAAWD;AAAA,cAEV,UAAAF;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CACF,EAAA,CACF,IAjCkB;AAmCtB;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("../../../vendor/clsx/dist/clsx.cjs"),g=require("react-aria-components");;/* empty css */const i=require("../../hooks/useLoadingVisibility.cjs"),y=require("../../primitives/Dialog/Dialog.cjs"),b=require("../../primitives/BrandLoader/BrandLoader.cjs");function m({isOpen:r,label:s,message:a,variant:n="trace",size:o="64",delayMs:l=i.defaultLoadingDelayMs,minVisibleMs:t=i.defaultLoadingMinVisibleMs,className:d}){const c=i.useLoadingVisibility(r,{delayMs:l,minVisibleMs:t});return e.jsx(y.DialogModal,{isOpen:c,isDismissable:!1,isKeyboardDismissDisabled:!0,className:u.clsx("loading-overlay",d),children:e.jsxs(g.Dialog,{"aria-label":s,className:"loading-overlay-content",children:[e.jsx(b.BrandLoader,{label:s,variant:n,size:o}),a&&e.jsx("span",{className:"loading-overlay-message",children:a})]})})}exports.LoadingOverlay=m;
2
+ //# sourceMappingURL=LoadingOverlay.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingOverlay.cjs","sources":["../../../../../src/ui/components/LoadingOverlay/LoadingOverlay.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n defaultLoadingDelayMs,\n defaultLoadingMinVisibleMs,\n useLoadingVisibility,\n} from \"hooks\";\nimport {\n BrandLoader,\n DialogModal,\n type BrandLoaderSize,\n type BrandLoaderVariant,\n} from \"primitives\";\nimport { Dialog as RACDialog } from \"react-aria-components\";\nimport \"./loading-overlay.css\";\n\nexport type LoadingOverlayProps = {\n isOpen: boolean;\n label: string;\n message?: string;\n variant?: BrandLoaderVariant;\n size?: BrandLoaderSize;\n delayMs?: number;\n minVisibleMs?: number;\n className?: string;\n};\n\nexport function LoadingOverlay({\n isOpen,\n label,\n message,\n variant = \"trace\",\n size = \"64\",\n delayMs = defaultLoadingDelayMs,\n minVisibleMs = defaultLoadingMinVisibleMs,\n className,\n}: LoadingOverlayProps) {\n const isVisible = useLoadingVisibility(isOpen, { delayMs, minVisibleMs });\n\n return (\n <DialogModal\n isOpen={isVisible}\n isDismissable={false}\n isKeyboardDismissDisabled\n className={clsx(\"loading-overlay\", className)}\n >\n <RACDialog aria-label={label} className=\"loading-overlay-content\">\n <BrandLoader label={label} variant={variant} size={size} />\n {message && <span className=\"loading-overlay-message\">{message}</span>}\n </RACDialog>\n </DialogModal>\n );\n}\n"],"names":["LoadingOverlay","isOpen","label","message","variant","size","delayMs","defaultLoadingDelayMs","minVisibleMs","defaultLoadingMinVisibleMs","className","isVisible","useLoadingVisibility","jsx","DialogModal","clsx","jsxs","RACDialog","BrandLoader"],"mappings":"+YA0BO,SAASA,EAAe,CAC7B,OAAAC,EACA,MAAAC,EACA,QAAAC,EACA,QAAAC,EAAU,QACV,KAAAC,EAAO,KACP,QAAAC,EAAUC,EAAAA,sBACV,aAAAC,EAAeC,EAAAA,2BACf,UAAAC,CACF,EAAwB,CACtB,MAAMC,EAAYC,EAAAA,qBAAqBX,EAAQ,CAAE,QAAAK,EAAS,aAAAE,EAAc,EAExE,OACEK,EAAAA,IAACC,EAAAA,YAAA,CACC,OAAQH,EACR,cAAe,GACf,0BAAyB,GACzB,UAAWI,EAAAA,KAAK,kBAAmBL,CAAS,EAE5C,SAAAM,EAAAA,KAACC,EAAAA,OAAA,CAAU,aAAYf,EAAO,UAAU,0BACtC,SAAA,CAAAW,EAAAA,IAACK,EAAAA,YAAA,CAAY,MAAAhB,EAAc,QAAAE,EAAkB,KAAAC,CAAA,CAAY,EACxDF,GAAWU,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA2B,SAAAV,CAAA,CAAQ,CAAA,CAAA,CACjE,CAAA,CAAA,CAGN"}
@@ -0,0 +1,36 @@
1
+ import { jsx as i, jsxs as d } from "react/jsx-runtime";
2
+ import { clsx as c } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { Dialog as f } from "react-aria-components";
4
+ /* empty css */
5
+ import { useLoadingVisibility as p, defaultLoadingDelayMs as g, defaultLoadingMinVisibleMs as y } from "../../hooks/useLoadingVisibility.js";
6
+ import { DialogModal as b } from "../../primitives/Dialog/Dialog.js";
7
+ import { BrandLoader as u } from "../../primitives/BrandLoader/BrandLoader.js";
8
+ function V({
9
+ isOpen: s,
10
+ label: a,
11
+ message: o,
12
+ variant: r = "trace",
13
+ size: e = "64",
14
+ delayMs: l = g,
15
+ minVisibleMs: n = y,
16
+ className: m
17
+ }) {
18
+ const t = p(s, { delayMs: l, minVisibleMs: n });
19
+ return /* @__PURE__ */ i(
20
+ b,
21
+ {
22
+ isOpen: t,
23
+ isDismissable: !1,
24
+ isKeyboardDismissDisabled: !0,
25
+ className: c("loading-overlay", m),
26
+ children: /* @__PURE__ */ d(f, { "aria-label": a, className: "loading-overlay-content", children: [
27
+ /* @__PURE__ */ i(u, { label: a, variant: r, size: e }),
28
+ o && /* @__PURE__ */ i("span", { className: "loading-overlay-message", children: o })
29
+ ] })
30
+ }
31
+ );
32
+ }
33
+ export {
34
+ V as LoadingOverlay
35
+ };
36
+ //# sourceMappingURL=LoadingOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingOverlay.js","sources":["../../../../../src/ui/components/LoadingOverlay/LoadingOverlay.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport {\n defaultLoadingDelayMs,\n defaultLoadingMinVisibleMs,\n useLoadingVisibility,\n} from \"hooks\";\nimport {\n BrandLoader,\n DialogModal,\n type BrandLoaderSize,\n type BrandLoaderVariant,\n} from \"primitives\";\nimport { Dialog as RACDialog } from \"react-aria-components\";\nimport \"./loading-overlay.css\";\n\nexport type LoadingOverlayProps = {\n isOpen: boolean;\n label: string;\n message?: string;\n variant?: BrandLoaderVariant;\n size?: BrandLoaderSize;\n delayMs?: number;\n minVisibleMs?: number;\n className?: string;\n};\n\nexport function LoadingOverlay({\n isOpen,\n label,\n message,\n variant = \"trace\",\n size = \"64\",\n delayMs = defaultLoadingDelayMs,\n minVisibleMs = defaultLoadingMinVisibleMs,\n className,\n}: LoadingOverlayProps) {\n const isVisible = useLoadingVisibility(isOpen, { delayMs, minVisibleMs });\n\n return (\n <DialogModal\n isOpen={isVisible}\n isDismissable={false}\n isKeyboardDismissDisabled\n className={clsx(\"loading-overlay\", className)}\n >\n <RACDialog aria-label={label} className=\"loading-overlay-content\">\n <BrandLoader label={label} variant={variant} size={size} />\n {message && <span className=\"loading-overlay-message\">{message}</span>}\n </RACDialog>\n </DialogModal>\n );\n}\n"],"names":["LoadingOverlay","isOpen","label","message","variant","size","delayMs","defaultLoadingDelayMs","minVisibleMs","defaultLoadingMinVisibleMs","className","isVisible","useLoadingVisibility","jsx","DialogModal","clsx","jsxs","RACDialog","BrandLoader"],"mappings":";;;;;;;AA0BO,SAASA,EAAe;AAAA,EAC7B,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAUC;AAAA,EACV,cAAAC,IAAeC;AAAA,EACf,WAAAC;AACF,GAAwB;AACtB,QAAMC,IAAYC,EAAqBX,GAAQ,EAAE,SAAAK,GAAS,cAAAE,GAAc;AAExE,SACE,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,QAAQH;AAAA,MACR,eAAe;AAAA,MACf,2BAAyB;AAAA,MACzB,WAAWI,EAAK,mBAAmBL,CAAS;AAAA,MAE5C,UAAA,gBAAAM,EAACC,GAAA,EAAU,cAAYf,GAAO,WAAU,2BACtC,UAAA;AAAA,QAAA,gBAAAW,EAACK,GAAA,EAAY,OAAAhB,GAAc,SAAAE,GAAkB,MAAAC,EAAA,CAAY;AAAA,QACxDF,KAAW,gBAAAU,EAAC,QAAA,EAAK,WAAU,2BAA2B,UAAAV,EAAA,CAAQ;AAAA,MAAA,EAAA,CACjE;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),i=require("../../../vendor/clsx/dist/clsx.cjs");;/* empty css */const n=require("../../primitives/LoadingState/LoadingState.cjs");function r({className:e,...t}){return a.jsx(n.LoadingState,{size:"64",className:i.clsx("page-loading-state",e),...t})}exports.PageLoadingState=r;
2
+ //# sourceMappingURL=PageLoadingState.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageLoadingState.cjs","sources":["../../../../../src/ui/components/PageLoadingState/PageLoadingState.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { LoadingState, type LoadingStateProps } from \"primitives\";\nimport \"./page-loading-state.css\";\n\nexport type PageLoadingStateProps = Omit<LoadingStateProps, \"size\">;\n\nexport function PageLoadingState({ className, ...props }: PageLoadingStateProps) {\n return (\n <LoadingState\n size=\"64\"\n className={clsx(\"page-loading-state\", className)}\n {...props}\n />\n );\n}\n"],"names":["PageLoadingState","className","props","jsx","LoadingState","clsx"],"mappings":"+QAMO,SAASA,EAAiB,CAAE,UAAAC,EAAW,GAAGC,GAAgC,CAC/E,OACEC,EAAAA,IAACC,EAAAA,aAAA,CACC,KAAK,KACL,UAAWC,EAAAA,KAAK,qBAAsBJ,CAAS,EAC9C,GAAGC,CAAA,CAAA,CAGV"}
@@ -0,0 +1,18 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { clsx as r } from "../../../vendor/clsx/dist/clsx.js";
3
+ /* empty css */
4
+ import { LoadingState as e } from "../../primitives/LoadingState/LoadingState.js";
5
+ function s({ className: t, ...o }) {
6
+ return /* @__PURE__ */ a(
7
+ e,
8
+ {
9
+ size: "64",
10
+ className: r("page-loading-state", t),
11
+ ...o
12
+ }
13
+ );
14
+ }
15
+ export {
16
+ s as PageLoadingState
17
+ };
18
+ //# sourceMappingURL=PageLoadingState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageLoadingState.js","sources":["../../../../../src/ui/components/PageLoadingState/PageLoadingState.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { LoadingState, type LoadingStateProps } from \"primitives\";\nimport \"./page-loading-state.css\";\n\nexport type PageLoadingStateProps = Omit<LoadingStateProps, \"size\">;\n\nexport function PageLoadingState({ className, ...props }: PageLoadingStateProps) {\n return (\n <LoadingState\n size=\"64\"\n className={clsx(\"page-loading-state\", className)}\n {...props}\n />\n );\n}\n"],"names":["PageLoadingState","className","props","jsx","LoadingState","clsx"],"mappings":";;;;AAMO,SAASA,EAAiB,EAAE,WAAAC,GAAW,GAAGC,KAAgC;AAC/E,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAWC,EAAK,sBAAsBJ,CAAS;AAAA,MAC9C,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),t=new Set;let n=null;function a(e){n=requestAnimationFrame(a),t.forEach(r=>r(e))}function o(e){return t.add(e),n===null&&(n=requestAnimationFrame(a)),()=>{t.delete(e),t.size===0&&n!==null&&(cancelAnimationFrame(n),n=null)}}function f(e,r=!0){const i=u.useRef(e);u.useEffect(()=>{i.current=e}),u.useEffect(()=>{if(r)return o(c=>i.current(c))},[r])}exports.useAnimationFrame=f;
2
+ //# sourceMappingURL=useAnimationFrame.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimationFrame.cjs","sources":["../../../../src/ui/hooks/useAnimationFrame.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\ntype FrameSubscriber = (now: number) => void;\n\nconst frameSubscribers = new Set<FrameSubscriber>();\nlet pendingFrameId: number | null = null;\n\nfunction runFrame(now: number) {\n pendingFrameId = requestAnimationFrame(runFrame);\n frameSubscribers.forEach((subscriber) => subscriber(now));\n}\n\nfunction subscribeToFrames(subscriber: FrameSubscriber) {\n frameSubscribers.add(subscriber);\n if (pendingFrameId === null) {\n pendingFrameId = requestAnimationFrame(runFrame);\n }\n return () => {\n frameSubscribers.delete(subscriber);\n if (frameSubscribers.size === 0 && pendingFrameId !== null) {\n cancelAnimationFrame(pendingFrameId);\n pendingFrameId = null;\n }\n };\n}\n\nexport function useAnimationFrame(onFrame: FrameSubscriber, isEnabled = true) {\n const onFrameRef = useRef(onFrame);\n\n useEffect(() => {\n onFrameRef.current = onFrame;\n });\n\n useEffect(() => {\n if (!isEnabled) return;\n return subscribeToFrames((now) => onFrameRef.current(now));\n }, [isEnabled]);\n}\n"],"names":["frameSubscribers","pendingFrameId","runFrame","now","subscriber","subscribeToFrames","useAnimationFrame","onFrame","isEnabled","onFrameRef","useRef","useEffect"],"mappings":"yGAIMA,MAAuB,IAC7B,IAAIC,EAAgC,KAEpC,SAASC,EAASC,EAAa,CAC7BF,EAAiB,sBAAsBC,CAAQ,EAC/CF,EAAiB,QAASI,GAAeA,EAAWD,CAAG,CAAC,CAC1D,CAEA,SAASE,EAAkBD,EAA6B,CACtD,OAAAJ,EAAiB,IAAII,CAAU,EAC3BH,IAAmB,OACrBA,EAAiB,sBAAsBC,CAAQ,GAE1C,IAAM,CACXF,EAAiB,OAAOI,CAAU,EAC9BJ,EAAiB,OAAS,GAAKC,IAAmB,OACpD,qBAAqBA,CAAc,EACnCA,EAAiB,KAErB,CACF,CAEO,SAASK,EAAkBC,EAA0BC,EAAY,GAAM,CAC5E,MAAMC,EAAaC,EAAAA,OAAOH,CAAO,EAEjCI,EAAAA,UAAU,IAAM,CACdF,EAAW,QAAUF,CACvB,CAAC,EAEDI,EAAAA,UAAU,IAAM,CACd,GAAKH,EACL,OAAOH,EAAmBF,GAAQM,EAAW,QAAQN,CAAG,CAAC,CAC3D,EAAG,CAACK,CAAS,CAAC,CAChB"}
@@ -0,0 +1,24 @@
1
+ import { useRef as o, useEffect as i } from "react";
2
+ const t = /* @__PURE__ */ new Set();
3
+ let n = null;
4
+ function a(e) {
5
+ n = requestAnimationFrame(a), t.forEach((r) => r(e));
6
+ }
7
+ function f(e) {
8
+ return t.add(e), n === null && (n = requestAnimationFrame(a)), () => {
9
+ t.delete(e), t.size === 0 && n !== null && (cancelAnimationFrame(n), n = null);
10
+ };
11
+ }
12
+ function l(e, r = !0) {
13
+ const u = o(e);
14
+ i(() => {
15
+ u.current = e;
16
+ }), i(() => {
17
+ if (r)
18
+ return f((m) => u.current(m));
19
+ }, [r]);
20
+ }
21
+ export {
22
+ l as useAnimationFrame
23
+ };
24
+ //# sourceMappingURL=useAnimationFrame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimationFrame.js","sources":["../../../../src/ui/hooks/useAnimationFrame.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\ntype FrameSubscriber = (now: number) => void;\n\nconst frameSubscribers = new Set<FrameSubscriber>();\nlet pendingFrameId: number | null = null;\n\nfunction runFrame(now: number) {\n pendingFrameId = requestAnimationFrame(runFrame);\n frameSubscribers.forEach((subscriber) => subscriber(now));\n}\n\nfunction subscribeToFrames(subscriber: FrameSubscriber) {\n frameSubscribers.add(subscriber);\n if (pendingFrameId === null) {\n pendingFrameId = requestAnimationFrame(runFrame);\n }\n return () => {\n frameSubscribers.delete(subscriber);\n if (frameSubscribers.size === 0 && pendingFrameId !== null) {\n cancelAnimationFrame(pendingFrameId);\n pendingFrameId = null;\n }\n };\n}\n\nexport function useAnimationFrame(onFrame: FrameSubscriber, isEnabled = true) {\n const onFrameRef = useRef(onFrame);\n\n useEffect(() => {\n onFrameRef.current = onFrame;\n });\n\n useEffect(() => {\n if (!isEnabled) return;\n return subscribeToFrames((now) => onFrameRef.current(now));\n }, [isEnabled]);\n}\n"],"names":["frameSubscribers","pendingFrameId","runFrame","now","subscriber","subscribeToFrames","useAnimationFrame","onFrame","isEnabled","onFrameRef","useRef","useEffect"],"mappings":";AAIA,MAAMA,wBAAuB,IAAA;AAC7B,IAAIC,IAAgC;AAEpC,SAASC,EAASC,GAAa;AAC7B,EAAAF,IAAiB,sBAAsBC,CAAQ,GAC/CF,EAAiB,QAAQ,CAACI,MAAeA,EAAWD,CAAG,CAAC;AAC1D;AAEA,SAASE,EAAkBD,GAA6B;AACtD,SAAAJ,EAAiB,IAAII,CAAU,GAC3BH,MAAmB,SACrBA,IAAiB,sBAAsBC,CAAQ,IAE1C,MAAM;AACX,IAAAF,EAAiB,OAAOI,CAAU,GAC9BJ,EAAiB,SAAS,KAAKC,MAAmB,SACpD,qBAAqBA,CAAc,GACnCA,IAAiB;AAAA,EAErB;AACF;AAEO,SAASK,EAAkBC,GAA0BC,IAAY,IAAM;AAC5E,QAAMC,IAAaC,EAAOH,CAAO;AAEjC,EAAAI,EAAU,MAAM;AACd,IAAAF,EAAW,UAAUF;AAAA,EACvB,CAAC,GAEDI,EAAU,MAAM;AACd,QAAKH;AACL,aAAOH,EAAkB,CAACF,MAAQM,EAAW,QAAQN,CAAG,CAAC;AAAA,EAC3D,GAAG,CAACK,CAAS,CAAC;AAChB;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),a=200,c=400;function b(t,{delayMs:i=a,minVisibleMs:o=c}={}){const[e,n]=s.useState(t&&i<=0),r=s.useRef(e?Date.now():null);return s.useEffect(()=>{if(t){if(e){r.current=Date.now();return}const d=setTimeout(()=>{r.current=Date.now(),n(!0)},Math.max(i,0));return()=>clearTimeout(d)}if(!e)return;const l=Date.now()-(r.current??0),u=o-l;if(u<=0){n(!1);return}const f=setTimeout(()=>n(!1),u);return()=>clearTimeout(f)},[t,e,i,o]),e}exports.defaultLoadingDelayMs=a;exports.defaultLoadingMinVisibleMs=c;exports.useLoadingVisibility=b;
2
+ //# sourceMappingURL=useLoadingVisibility.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoadingVisibility.cjs","sources":["../../../../src/ui/hooks/useLoadingVisibility.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\nexport type LoadingVisibilityOptions = {\n delayMs?: number;\n minVisibleMs?: number;\n};\n\nexport const defaultLoadingDelayMs = 200;\nexport const defaultLoadingMinVisibleMs = 400;\n\nexport function useLoadingVisibility(\n isLoading: boolean,\n {\n delayMs = defaultLoadingDelayMs,\n minVisibleMs = defaultLoadingMinVisibleMs,\n }: LoadingVisibilityOptions = {},\n) {\n const [isVisible, setIsVisible] = useState(isLoading && delayMs <= 0);\n const shownAtRef = useRef<number | null>(isVisible ? Date.now() : null);\n\n useEffect(() => {\n if (isLoading) {\n if (isVisible) {\n shownAtRef.current = Date.now();\n return;\n }\n const showTimer = setTimeout(() => {\n shownAtRef.current = Date.now();\n setIsVisible(true);\n }, Math.max(delayMs, 0));\n return () => clearTimeout(showTimer);\n }\n\n if (!isVisible) return;\n const visibleFor = Date.now() - (shownAtRef.current ?? 0);\n const remaining = minVisibleMs - visibleFor;\n if (remaining <= 0) {\n setIsVisible(false);\n return;\n }\n const hideTimer = setTimeout(() => setIsVisible(false), remaining);\n return () => clearTimeout(hideTimer);\n }, [isLoading, isVisible, delayMs, minVisibleMs]);\n\n return isVisible;\n}\n"],"names":["defaultLoadingDelayMs","defaultLoadingMinVisibleMs","useLoadingVisibility","isLoading","delayMs","minVisibleMs","isVisible","setIsVisible","useState","shownAtRef","useRef","useEffect","showTimer","visibleFor","remaining","hideTimer"],"mappings":"yGAOaA,EAAwB,IACxBC,EAA6B,IAEnC,SAASC,EACdC,EACA,CACE,QAAAC,EAAUJ,EACV,aAAAK,EAAeJ,CACjB,EAA8B,GAC9B,CACA,KAAM,CAACK,EAAWC,CAAY,EAAIC,EAAAA,SAASL,GAAaC,GAAW,CAAC,EAC9DK,EAAaC,EAAAA,OAAsBJ,EAAY,KAAK,IAAA,EAAQ,IAAI,EAEtEK,OAAAA,EAAAA,UAAU,IAAM,CACd,GAAIR,EAAW,CACb,GAAIG,EAAW,CACbG,EAAW,QAAU,KAAK,IAAA,EAC1B,MACF,CACA,MAAMG,EAAY,WAAW,IAAM,CACjCH,EAAW,QAAU,KAAK,IAAA,EAC1BF,EAAa,EAAI,CACnB,EAAG,KAAK,IAAIH,EAAS,CAAC,CAAC,EACvB,MAAO,IAAM,aAAaQ,CAAS,CACrC,CAEA,GAAI,CAACN,EAAW,OAChB,MAAMO,EAAa,KAAK,IAAA,GAASJ,EAAW,SAAW,GACjDK,EAAYT,EAAeQ,EACjC,GAAIC,GAAa,EAAG,CAClBP,EAAa,EAAK,EAClB,MACF,CACA,MAAMQ,EAAY,WAAW,IAAMR,EAAa,EAAK,EAAGO,CAAS,EACjE,MAAO,IAAM,aAAaC,CAAS,CACrC,EAAG,CAACZ,EAAWG,EAAWF,EAASC,CAAY,CAAC,EAEzCC,CACT"}
@@ -0,0 +1,34 @@
1
+ import { useState as f, useRef as l, useEffect as m } from "react";
2
+ const w = 200, T = 400;
3
+ function b(t, {
4
+ delayMs: n = w,
5
+ minVisibleMs: o = T
6
+ } = {}) {
7
+ const [e, r] = f(t && n <= 0), i = l(e ? Date.now() : null);
8
+ return m(() => {
9
+ if (t) {
10
+ if (e) {
11
+ i.current = Date.now();
12
+ return;
13
+ }
14
+ const a = setTimeout(() => {
15
+ i.current = Date.now(), r(!0);
16
+ }, Math.max(n, 0));
17
+ return () => clearTimeout(a);
18
+ }
19
+ if (!e) return;
20
+ const u = Date.now() - (i.current ?? 0), s = o - u;
21
+ if (s <= 0) {
22
+ r(!1);
23
+ return;
24
+ }
25
+ const c = setTimeout(() => r(!1), s);
26
+ return () => clearTimeout(c);
27
+ }, [t, e, n, o]), e;
28
+ }
29
+ export {
30
+ w as defaultLoadingDelayMs,
31
+ T as defaultLoadingMinVisibleMs,
32
+ b as useLoadingVisibility
33
+ };
34
+ //# sourceMappingURL=useLoadingVisibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoadingVisibility.js","sources":["../../../../src/ui/hooks/useLoadingVisibility.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\n\nexport type LoadingVisibilityOptions = {\n delayMs?: number;\n minVisibleMs?: number;\n};\n\nexport const defaultLoadingDelayMs = 200;\nexport const defaultLoadingMinVisibleMs = 400;\n\nexport function useLoadingVisibility(\n isLoading: boolean,\n {\n delayMs = defaultLoadingDelayMs,\n minVisibleMs = defaultLoadingMinVisibleMs,\n }: LoadingVisibilityOptions = {},\n) {\n const [isVisible, setIsVisible] = useState(isLoading && delayMs <= 0);\n const shownAtRef = useRef<number | null>(isVisible ? Date.now() : null);\n\n useEffect(() => {\n if (isLoading) {\n if (isVisible) {\n shownAtRef.current = Date.now();\n return;\n }\n const showTimer = setTimeout(() => {\n shownAtRef.current = Date.now();\n setIsVisible(true);\n }, Math.max(delayMs, 0));\n return () => clearTimeout(showTimer);\n }\n\n if (!isVisible) return;\n const visibleFor = Date.now() - (shownAtRef.current ?? 0);\n const remaining = minVisibleMs - visibleFor;\n if (remaining <= 0) {\n setIsVisible(false);\n return;\n }\n const hideTimer = setTimeout(() => setIsVisible(false), remaining);\n return () => clearTimeout(hideTimer);\n }, [isLoading, isVisible, delayMs, minVisibleMs]);\n\n return isVisible;\n}\n"],"names":["defaultLoadingDelayMs","defaultLoadingMinVisibleMs","useLoadingVisibility","isLoading","delayMs","minVisibleMs","isVisible","setIsVisible","useState","shownAtRef","useRef","useEffect","showTimer","visibleFor","remaining","hideTimer"],"mappings":";AAOO,MAAMA,IAAwB,KACxBC,IAA6B;AAEnC,SAASC,EACdC,GACA;AAAA,EACE,SAAAC,IAAUJ;AAAA,EACV,cAAAK,IAAeJ;AACjB,IAA8B,IAC9B;AACA,QAAM,CAACK,GAAWC,CAAY,IAAIC,EAASL,KAAaC,KAAW,CAAC,GAC9DK,IAAaC,EAAsBJ,IAAY,KAAK,IAAA,IAAQ,IAAI;AAEtE,SAAAK,EAAU,MAAM;AACd,QAAIR,GAAW;AACb,UAAIG,GAAW;AACb,QAAAG,EAAW,UAAU,KAAK,IAAA;AAC1B;AAAA,MACF;AACA,YAAMG,IAAY,WAAW,MAAM;AACjC,QAAAH,EAAW,UAAU,KAAK,IAAA,GAC1BF,EAAa,EAAI;AAAA,MACnB,GAAG,KAAK,IAAIH,GAAS,CAAC,CAAC;AACvB,aAAO,MAAM,aAAaQ,CAAS;AAAA,IACrC;AAEA,QAAI,CAACN,EAAW;AAChB,UAAMO,IAAa,KAAK,IAAA,KAASJ,EAAW,WAAW,IACjDK,IAAYT,IAAeQ;AACjC,QAAIC,KAAa,GAAG;AAClB,MAAAP,EAAa,EAAK;AAClB;AAAA,IACF;AACA,UAAMQ,IAAY,WAAW,MAAMR,EAAa,EAAK,GAAGO,CAAS;AACjE,WAAO,MAAM,aAAaC,CAAS;AAAA,EACrC,GAAG,CAACZ,GAAWG,GAAWF,GAASC,CAAY,CAAC,GAEzCC;AACT;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),e={tablet:600,desktop:1024};function s(n){const[o,i]=r.useMemo(()=>{const t=globalThis.matchMedia(n);function a(c){return t.addEventListener("change",c),()=>t.removeEventListener("change",c)}return[a,()=>t.matches]},[n]);return r.useSyncExternalStore(o,i)}const d=()=>{const n=s(`(max-width: ${e.tablet-1}px)`),o=s(`(min-width: ${e.tablet}px) and (max-width: ${e.desktop-1}px)`),i=s(`(min-width: ${e.desktop}px)`),t=s(`(min-width: ${e.tablet}px)`),a=s(`(max-width: ${e.desktop-1}px)`);return r.useMemo(()=>({isMobile:n,isTablet:o,isDesktop:i,isTabletUp:t,isTabletDown:a}),[n,o,i,t,a])};exports.useCustomMediaQuery=s;exports.useMediaQuery=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),e={tablet:600,desktop:1024};function s(n){const[i,o]=r.useMemo(()=>{if(typeof globalThis.matchMedia!="function")return[()=>()=>{},()=>!1];const t=globalThis.matchMedia(n);function a(c){return t.addEventListener("change",c),()=>t.removeEventListener("change",c)}return[a,()=>t.matches]},[n]);return r.useSyncExternalStore(i,o)}const d=()=>{const n=s(`(max-width: ${e.tablet-1}px)`),i=s(`(min-width: ${e.tablet}px) and (max-width: ${e.desktop-1}px)`),o=s(`(min-width: ${e.desktop}px)`),t=s(`(min-width: ${e.tablet}px)`),a=s(`(max-width: ${e.desktop-1}px)`);return r.useMemo(()=>({isMobile:n,isTablet:i,isDesktop:o,isTabletUp:t,isTabletDown:a}),[n,i,o,t,a])};exports.useCustomMediaQuery=s;exports.useMediaQuery=d;
2
2
  //# sourceMappingURL=useMediaQuery.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMediaQuery.cjs","sources":["../../../../src/ui/hooks/useMediaQuery.tsx"],"sourcesContent":["import { useMemo, useSyncExternalStore } from \"react\";\n\nconst breakpoints = {\n mobile: 375,\n tablet: 600,\n desktop: 1024,\n};\n\nexport function useCustomMediaQuery(mediaQuery: string): boolean {\n const [subscribe, getSnapshot] = useMemo(() => {\n const mediaQueryList = globalThis.matchMedia(mediaQuery);\n\n function subscribe(onStoreChange: () => void) {\n mediaQueryList.addEventListener(\"change\", onStoreChange);\n return () => mediaQueryList.removeEventListener(\"change\", onStoreChange);\n }\n\n const getSnapshot = () => mediaQueryList.matches;\n\n return [subscribe, getSnapshot];\n }, [mediaQuery]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport const useMediaQuery = () => {\n const isMobile = useCustomMediaQuery(\n `(max-width: ${breakpoints.tablet - 1}px)`,\n );\n const isTablet = useCustomMediaQuery(\n `(min-width: ${breakpoints.tablet}px) and (max-width: ${breakpoints.desktop - 1}px)`,\n );\n const isDesktop = useCustomMediaQuery(\n `(min-width: ${breakpoints.desktop}px)`,\n );\n const isTabletUp = useCustomMediaQuery(\n `(min-width: ${breakpoints.tablet}px)`,\n );\n const isTabletDown = useCustomMediaQuery(\n `(max-width: ${breakpoints.desktop - 1}px)`,\n );\n\n const matches = useMemo(() => {\n return {\n isMobile,\n isTablet,\n isDesktop,\n isTabletUp,\n isTabletDown,\n };\n }, [isMobile, isTablet, isDesktop, isTabletUp, isTabletDown]);\n\n return matches;\n};\n"],"names":["breakpoints","useCustomMediaQuery","mediaQuery","subscribe","getSnapshot","useMemo","mediaQueryList","onStoreChange","useSyncExternalStore","useMediaQuery","isMobile","isTablet","isDesktop","isTabletUp","isTabletDown"],"mappings":"yGAEMA,EAAc,CAElB,OAAQ,IACR,QAAS,IACX,EAEO,SAASC,EAAoBC,EAA6B,CAC/D,KAAM,CAACC,EAAWC,CAAW,EAAIC,EAAAA,QAAQ,IAAM,CAC7C,MAAMC,EAAiB,WAAW,WAAWJ,CAAU,EAEvD,SAASC,EAAUI,EAA2B,CAC5C,OAAAD,EAAe,iBAAiB,SAAUC,CAAa,EAChD,IAAMD,EAAe,oBAAoB,SAAUC,CAAa,CACzE,CAIA,MAAO,CAACJ,EAFY,IAAMG,EAAe,OAEX,CAChC,EAAG,CAACJ,CAAU,CAAC,EAEf,OAAOM,EAAAA,qBAAqBL,EAAWC,CAAW,CACpD,CAEO,MAAMK,EAAgB,IAAM,CACjC,MAAMC,EAAWT,EACf,eAAeD,EAAY,OAAS,CAAC,KAAA,EAEjCW,EAAWV,EACf,eAAeD,EAAY,MAAM,uBAAuBA,EAAY,QAAU,CAAC,KAAA,EAE3EY,EAAYX,EAChB,eAAeD,EAAY,OAAO,KAAA,EAE9Ba,EAAaZ,EACjB,eAAeD,EAAY,MAAM,KAAA,EAE7Bc,EAAeb,EACnB,eAAeD,EAAY,QAAU,CAAC,KAAA,EAaxC,OAVgBK,EAAAA,QAAQ,KACf,CACL,SAAAK,EACA,SAAAC,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,CAAA,GAED,CAACJ,EAAUC,EAAUC,EAAWC,EAAYC,CAAY,CAAC,CAG9D"}
1
+ {"version":3,"file":"useMediaQuery.cjs","sources":["../../../../src/ui/hooks/useMediaQuery.tsx"],"sourcesContent":["import { useMemo, useSyncExternalStore } from \"react\";\n\nconst breakpoints = {\n mobile: 375,\n tablet: 600,\n desktop: 1024,\n};\n\nexport function useCustomMediaQuery(mediaQuery: string): boolean {\n const [subscribe, getSnapshot] = useMemo(() => {\n if (typeof globalThis.matchMedia !== \"function\") {\n return [() => () => {}, () => false] as const;\n }\n const mediaQueryList = globalThis.matchMedia(mediaQuery);\n\n function subscribe(onStoreChange: () => void) {\n mediaQueryList.addEventListener(\"change\", onStoreChange);\n return () => mediaQueryList.removeEventListener(\"change\", onStoreChange);\n }\n\n const getSnapshot = () => mediaQueryList.matches;\n\n return [subscribe, getSnapshot];\n }, [mediaQuery]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport const useMediaQuery = () => {\n const isMobile = useCustomMediaQuery(\n `(max-width: ${breakpoints.tablet - 1}px)`,\n );\n const isTablet = useCustomMediaQuery(\n `(min-width: ${breakpoints.tablet}px) and (max-width: ${breakpoints.desktop - 1}px)`,\n );\n const isDesktop = useCustomMediaQuery(\n `(min-width: ${breakpoints.desktop}px)`,\n );\n const isTabletUp = useCustomMediaQuery(\n `(min-width: ${breakpoints.tablet}px)`,\n );\n const isTabletDown = useCustomMediaQuery(\n `(max-width: ${breakpoints.desktop - 1}px)`,\n );\n\n const matches = useMemo(() => {\n return {\n isMobile,\n isTablet,\n isDesktop,\n isTabletUp,\n isTabletDown,\n };\n }, [isMobile, isTablet, isDesktop, isTabletUp, isTabletDown]);\n\n return matches;\n};\n"],"names":["breakpoints","useCustomMediaQuery","mediaQuery","subscribe","getSnapshot","useMemo","mediaQueryList","onStoreChange","useSyncExternalStore","useMediaQuery","isMobile","isTablet","isDesktop","isTabletUp","isTabletDown"],"mappings":"yGAEMA,EAAc,CAElB,OAAQ,IACR,QAAS,IACX,EAEO,SAASC,EAAoBC,EAA6B,CAC/D,KAAM,CAACC,EAAWC,CAAW,EAAIC,EAAAA,QAAQ,IAAM,CAC7C,GAAI,OAAO,WAAW,YAAe,WACnC,MAAO,CAAC,IAAM,IAAM,CAAC,EAAG,IAAM,EAAK,EAErC,MAAMC,EAAiB,WAAW,WAAWJ,CAAU,EAEvD,SAASC,EAAUI,EAA2B,CAC5C,OAAAD,EAAe,iBAAiB,SAAUC,CAAa,EAChD,IAAMD,EAAe,oBAAoB,SAAUC,CAAa,CACzE,CAIA,MAAO,CAACJ,EAFY,IAAMG,EAAe,OAEX,CAChC,EAAG,CAACJ,CAAU,CAAC,EAEf,OAAOM,EAAAA,qBAAqBL,EAAWC,CAAW,CACpD,CAEO,MAAMK,EAAgB,IAAM,CACjC,MAAMC,EAAWT,EACf,eAAeD,EAAY,OAAS,CAAC,KAAA,EAEjCW,EAAWV,EACf,eAAeD,EAAY,MAAM,uBAAuBA,EAAY,QAAU,CAAC,KAAA,EAE3EY,EAAYX,EAChB,eAAeD,EAAY,OAAO,KAAA,EAE9Ba,EAAaZ,EACjB,eAAeD,EAAY,MAAM,KAAA,EAE7Bc,EAAeb,EACnB,eAAeD,EAAY,QAAU,CAAC,KAAA,EAaxC,OAVgBK,EAAAA,QAAQ,KACf,CACL,SAAAK,EACA,SAAAC,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,CAAA,GAED,CAACJ,EAAUC,EAAUC,EAAWC,EAAYC,CAAY,CAAC,CAG9D"}
@@ -1,17 +1,20 @@
1
- import { useMemo as r, useSyncExternalStore as d } from "react";
1
+ import { useMemo as r, useSyncExternalStore as u } from "react";
2
2
  const e = {
3
3
  tablet: 600,
4
4
  desktop: 1024
5
5
  };
6
6
  function n(s) {
7
7
  const [o, i] = r(() => {
8
+ if (typeof globalThis.matchMedia != "function")
9
+ return [() => () => {
10
+ }, () => !1];
8
11
  const t = globalThis.matchMedia(s);
9
12
  function a(c) {
10
13
  return t.addEventListener("change", c), () => t.removeEventListener("change", c);
11
14
  }
12
15
  return [a, () => t.matches];
13
16
  }, [s]);
14
- return d(o, i);
17
+ return u(o, i);
15
18
  }
16
19
  const h = () => {
17
20
  const s = n(
@@ -1 +1 @@
1
- {"version":3,"file":"useMediaQuery.js","sources":["../../../../src/ui/hooks/useMediaQuery.tsx"],"sourcesContent":["import { useMemo, useSyncExternalStore } from \"react\";\n\nconst breakpoints = {\n mobile: 375,\n tablet: 600,\n desktop: 1024,\n};\n\nexport function useCustomMediaQuery(mediaQuery: string): boolean {\n const [subscribe, getSnapshot] = useMemo(() => {\n const mediaQueryList = globalThis.matchMedia(mediaQuery);\n\n function subscribe(onStoreChange: () => void) {\n mediaQueryList.addEventListener(\"change\", onStoreChange);\n return () => mediaQueryList.removeEventListener(\"change\", onStoreChange);\n }\n\n const getSnapshot = () => mediaQueryList.matches;\n\n return [subscribe, getSnapshot];\n }, [mediaQuery]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport const useMediaQuery = () => {\n const isMobile = useCustomMediaQuery(\n `(max-width: ${breakpoints.tablet - 1}px)`,\n );\n const isTablet = useCustomMediaQuery(\n `(min-width: ${breakpoints.tablet}px) and (max-width: ${breakpoints.desktop - 1}px)`,\n );\n const isDesktop = useCustomMediaQuery(\n `(min-width: ${breakpoints.desktop}px)`,\n );\n const isTabletUp = useCustomMediaQuery(\n `(min-width: ${breakpoints.tablet}px)`,\n );\n const isTabletDown = useCustomMediaQuery(\n `(max-width: ${breakpoints.desktop - 1}px)`,\n );\n\n const matches = useMemo(() => {\n return {\n isMobile,\n isTablet,\n isDesktop,\n isTabletUp,\n isTabletDown,\n };\n }, [isMobile, isTablet, isDesktop, isTabletUp, isTabletDown]);\n\n return matches;\n};\n"],"names":["breakpoints","useCustomMediaQuery","mediaQuery","subscribe","getSnapshot","useMemo","mediaQueryList","onStoreChange","useSyncExternalStore","useMediaQuery","isMobile","isTablet","isDesktop","isTabletUp","isTabletDown"],"mappings":";AAEA,MAAMA,IAAc;AAAA,EAElB,QAAQ;AAAA,EACR,SAAS;AACX;AAEO,SAASC,EAAoBC,GAA6B;AAC/D,QAAM,CAACC,GAAWC,CAAW,IAAIC,EAAQ,MAAM;AAC7C,UAAMC,IAAiB,WAAW,WAAWJ,CAAU;AAEvD,aAASC,EAAUI,GAA2B;AAC5C,aAAAD,EAAe,iBAAiB,UAAUC,CAAa,GAChD,MAAMD,EAAe,oBAAoB,UAAUC,CAAa;AAAA,IACzE;AAIA,WAAO,CAACJ,GAFY,MAAMG,EAAe,OAEX;AAAA,EAChC,GAAG,CAACJ,CAAU,CAAC;AAEf,SAAOM,EAAqBL,GAAWC,CAAW;AACpD;AAEO,MAAMK,IAAgB,MAAM;AACjC,QAAMC,IAAWT;AAAA,IACf,eAAeD,EAAY,SAAS,CAAC;AAAA,EAAA,GAEjCW,IAAWV;AAAA,IACf,eAAeD,EAAY,MAAM,uBAAuBA,EAAY,UAAU,CAAC;AAAA,EAAA,GAE3EY,IAAYX;AAAA,IAChB,eAAeD,EAAY,OAAO;AAAA,EAAA,GAE9Ba,IAAaZ;AAAA,IACjB,eAAeD,EAAY,MAAM;AAAA,EAAA,GAE7Bc,IAAeb;AAAA,IACnB,eAAeD,EAAY,UAAU,CAAC;AAAA,EAAA;AAaxC,SAVgBK,EAAQ,OACf;AAAA,IACL,UAAAK;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IAED,CAACJ,GAAUC,GAAUC,GAAWC,GAAYC,CAAY,CAAC;AAG9D;"}
1
+ {"version":3,"file":"useMediaQuery.js","sources":["../../../../src/ui/hooks/useMediaQuery.tsx"],"sourcesContent":["import { useMemo, useSyncExternalStore } from \"react\";\n\nconst breakpoints = {\n mobile: 375,\n tablet: 600,\n desktop: 1024,\n};\n\nexport function useCustomMediaQuery(mediaQuery: string): boolean {\n const [subscribe, getSnapshot] = useMemo(() => {\n if (typeof globalThis.matchMedia !== \"function\") {\n return [() => () => {}, () => false] as const;\n }\n const mediaQueryList = globalThis.matchMedia(mediaQuery);\n\n function subscribe(onStoreChange: () => void) {\n mediaQueryList.addEventListener(\"change\", onStoreChange);\n return () => mediaQueryList.removeEventListener(\"change\", onStoreChange);\n }\n\n const getSnapshot = () => mediaQueryList.matches;\n\n return [subscribe, getSnapshot];\n }, [mediaQuery]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n}\n\nexport const useMediaQuery = () => {\n const isMobile = useCustomMediaQuery(\n `(max-width: ${breakpoints.tablet - 1}px)`,\n );\n const isTablet = useCustomMediaQuery(\n `(min-width: ${breakpoints.tablet}px) and (max-width: ${breakpoints.desktop - 1}px)`,\n );\n const isDesktop = useCustomMediaQuery(\n `(min-width: ${breakpoints.desktop}px)`,\n );\n const isTabletUp = useCustomMediaQuery(\n `(min-width: ${breakpoints.tablet}px)`,\n );\n const isTabletDown = useCustomMediaQuery(\n `(max-width: ${breakpoints.desktop - 1}px)`,\n );\n\n const matches = useMemo(() => {\n return {\n isMobile,\n isTablet,\n isDesktop,\n isTabletUp,\n isTabletDown,\n };\n }, [isMobile, isTablet, isDesktop, isTabletUp, isTabletDown]);\n\n return matches;\n};\n"],"names":["breakpoints","useCustomMediaQuery","mediaQuery","subscribe","getSnapshot","useMemo","mediaQueryList","onStoreChange","useSyncExternalStore","useMediaQuery","isMobile","isTablet","isDesktop","isTabletUp","isTabletDown"],"mappings":";AAEA,MAAMA,IAAc;AAAA,EAElB,QAAQ;AAAA,EACR,SAAS;AACX;AAEO,SAASC,EAAoBC,GAA6B;AAC/D,QAAM,CAACC,GAAWC,CAAW,IAAIC,EAAQ,MAAM;AAC7C,QAAI,OAAO,WAAW,cAAe;AACnC,aAAO,CAAC,MAAM,MAAM;AAAA,MAAC,GAAG,MAAM,EAAK;AAErC,UAAMC,IAAiB,WAAW,WAAWJ,CAAU;AAEvD,aAASC,EAAUI,GAA2B;AAC5C,aAAAD,EAAe,iBAAiB,UAAUC,CAAa,GAChD,MAAMD,EAAe,oBAAoB,UAAUC,CAAa;AAAA,IACzE;AAIA,WAAO,CAACJ,GAFY,MAAMG,EAAe,OAEX;AAAA,EAChC,GAAG,CAACJ,CAAU,CAAC;AAEf,SAAOM,EAAqBL,GAAWC,CAAW;AACpD;AAEO,MAAMK,IAAgB,MAAM;AACjC,QAAMC,IAAWT;AAAA,IACf,eAAeD,EAAY,SAAS,CAAC;AAAA,EAAA,GAEjCW,IAAWV;AAAA,IACf,eAAeD,EAAY,MAAM,uBAAuBA,EAAY,UAAU,CAAC;AAAA,EAAA,GAE3EY,IAAYX;AAAA,IAChB,eAAeD,EAAY,OAAO;AAAA,EAAA,GAE9Ba,IAAaZ;AAAA,IACjB,eAAeD,EAAY,MAAM;AAAA,EAAA,GAE7Bc,IAAeb;AAAA,IACnB,eAAeD,EAAY,UAAU,CAAC;AAAA,EAAA;AAaxC,SAVgBK,EAAQ,OACf;AAAA,IACL,UAAAK;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IAED,CAACJ,GAAUC,GAAUC,GAAWC,GAAYC,CAAY,CAAC;AAG9D;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),w=require("../../../vendor/clsx/dist/clsx.cjs"),r=require("react"),N=require("../../hooks/useAnimationFrame.cjs"),n=require("./brandLoaderVariants.cjs"),q=require("./brandLoaderSymbolContext.cjs");;/* empty css */const A=require("../../hooks/useMediaQuery.cjs");function B(){return typeof window<"u"&&typeof window.requestAnimationFrame=="function"&&typeof SVGPathElement<"u"&&typeof SVGPathElement.prototype.getPointAtLength=="function"}function S(s,o){return typeof s.getTotalLength=="function"?s.getTotalLength():o}function $({label:s,"aria-hidden":o,variant:t="trace",size:a="32",tone:i="accent",speed:b=1,isPaused:f=!1,symbol:p,className:h,...m}){const g=q.useBrandLoaderSymbol(),c=p??g,x=A.useCustomMediaQuery("(prefers-reduced-motion: reduce)"),d=!f&&!x;return e.jsx("span",{role:o?void 0:"status","aria-label":s,"aria-hidden":o||void 0,className:w.clsx("brand-loader",`brand-loader-size-${a}`,`brand-loader-tone-${i}`,`brand-loader-${c}`,`brand-loader-variant-${t}`,!d&&"brand-loader-paused",h),...m,children:c==="neutral"?e.jsx(C,{}):e.jsx(E,{variant:t,speed:b,isAnimating:d&&B()},t)})}function C(){return e.jsxs("svg",{className:"brand-loader-neutral-glyph",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{className:"brand-loader-neutral-track",cx:"12",cy:"12",r:"9"}),e.jsx("circle",{className:"brand-loader-neutral-arc",cx:"12",cy:"12",r:"9",pathLength:100})]})}function E({variant:s,speed:o,isAnimating:t}){const a=n.brandLoaderVariants[s],i=`brand-loader-sweep-${r.useId().replace(/:/g,"")}`,b=r.useRef(null),f=r.useRef(null),p=r.useRef(null),h=r.useRef(null),m=r.useRef(null),g=r.useRef(null),c=r.useRef(null),x=r.useRef(null),d=r.useRef(0),y=r.useRef(null),P=()=>d.current%a.period/a.period;return r.useLayoutEffect(()=>{const u=b.current,l=f.current,L=p.current,R=h.current;if(!u||!l||!L||!R)return;const j={strokes:u,slash:l,big:L,tri:R,ball:m.current,sweepClip:g.current,sweepEdge:c.current,lengths:{slash:S(l,n.brandLoaderPathLengths.slash),big:S(L,n.brandLoaderPathLengths.big),tri:S(R,n.brandLoaderPathLengths.tri)}};x.current=j,y.current=null,t?a.render(d.current%a.period/a.period,j):a.renderRest(j)},[a,t]),N.useAnimationFrame(u=>{const l=x.current;l&&(y.current!==null&&(d.current+=(u-y.current)*o),y.current=u,a.render(P(),l))},t),e.jsxs("svg",{className:"brand-loader-symbol",viewBox:n.brandLoaderViewBox,"aria-hidden":"true",focusable:"false",children:[s==="sweep"&&e.jsx("defs",{children:e.jsx("clipPath",{id:i,children:e.jsx("polygon",{ref:g})})}),e.jsxs("g",{ref:b,className:"brand-loader-strokes",clipPath:s==="sweep"?`url(#${i})`:void 0,children:[s==="comet"&&e.jsxs("g",{className:"brand-loader-ghost",children:[e.jsx("path",{d:n.brandLoaderSymbolPaths.slash}),e.jsx("path",{d:n.brandLoaderSymbolPaths.big}),e.jsx("path",{d:n.brandLoaderSymbolPaths.tri})]}),e.jsx("path",{ref:f,className:"brand-loader-piece brand-loader-slash",d:n.brandLoaderSymbolPaths.slash}),e.jsx("path",{ref:p,className:"brand-loader-piece brand-loader-big",d:n.brandLoaderSymbolPaths.big}),e.jsx("path",{ref:h,className:"brand-loader-piece brand-loader-tri",d:n.brandLoaderSymbolPaths.tri})]}),s==="bounce"&&e.jsx("ellipse",{ref:m,className:"brand-loader-ball"}),s==="sweep"&&e.jsx("line",{ref:c,className:"brand-loader-sweep-edge"})]})}exports.BrandLoader=$;
2
+ //# sourceMappingURL=BrandLoader.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrandLoader.cjs","sources":["../../../../../src/ui/primitives/BrandLoader/BrandLoader.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useCustomMediaQuery } from \"hooks\";\nimport {\n type ComponentPropsWithoutRef,\n useId,\n useLayoutEffect,\n useRef,\n} from \"react\";\nimport { useAnimationFrame } from \"../../hooks/useAnimationFrame\";\nimport {\n brandLoaderPathLengths,\n brandLoaderSymbolPaths,\n brandLoaderVariants,\n brandLoaderViewBox,\n type BrandLoaderElements,\n type BrandLoaderVariant,\n} from \"./brandLoaderVariants\";\nimport { type BrandLoaderSymbol, useBrandLoaderSymbol } from \"./brandLoaderSymbolContext\";\nimport \"./brand-loader.css\";\n\nexport type { BrandLoaderVariant } from \"./brandLoaderVariants\";\nexport { BrandLoaderProvider, type BrandLoaderProviderProps } from \"./BrandLoaderProvider\";\nexport type { BrandLoaderSymbol } from \"./brandLoaderSymbolContext\";\n\nexport type BrandLoaderSize = \"16\" | \"24\" | \"32\" | \"64\";\n\nexport type BrandLoaderTone = \"accent\" | \"brand\" | \"current\";\n\ntype BrandLoaderAccessibilityProps =\n | { label: string; \"aria-hidden\"?: false }\n | { label?: undefined; \"aria-hidden\": true };\n\nexport type BrandLoaderProps = Omit<\n ComponentPropsWithoutRef<\"span\">,\n \"children\" | \"aria-hidden\"\n> &\n BrandLoaderAccessibilityProps & {\n variant?: BrandLoaderVariant;\n size?: BrandLoaderSize;\n tone?: BrandLoaderTone;\n speed?: number;\n isPaused?: boolean;\n symbol?: BrandLoaderSymbol;\n };\n\nfunction supportsScriptedSvgAnimation() {\n return (\n typeof window !== \"undefined\" &&\n typeof window.requestAnimationFrame === \"function\" &&\n typeof SVGPathElement !== \"undefined\" &&\n typeof SVGPathElement.prototype.getPointAtLength === \"function\"\n );\n}\n\nfunction measurePath(path: SVGPathElement, fallbackLength: number) {\n return typeof path.getTotalLength === \"function\"\n ? path.getTotalLength()\n : fallbackLength;\n}\n\nexport function BrandLoader({\n label,\n \"aria-hidden\": isDecorative,\n variant = \"trace\",\n size = \"32\",\n tone = \"accent\",\n speed = 1,\n isPaused = false,\n symbol,\n className,\n ...props\n}: BrandLoaderProps) {\n const providedSymbol = useBrandLoaderSymbol();\n const resolvedSymbol = symbol ?? providedSymbol;\n const prefersReducedMotion = useCustomMediaQuery(\n \"(prefers-reduced-motion: reduce)\",\n );\n const isAnimating = !isPaused && !prefersReducedMotion;\n\n return (\n <span\n role={isDecorative ? undefined : \"status\"}\n aria-label={label}\n aria-hidden={isDecorative || undefined}\n className={clsx(\n \"brand-loader\",\n `brand-loader-size-${size}`,\n `brand-loader-tone-${tone}`,\n `brand-loader-${resolvedSymbol}`,\n `brand-loader-variant-${variant}`,\n !isAnimating && \"brand-loader-paused\",\n className,\n )}\n {...props}\n >\n {resolvedSymbol === \"neutral\" ? (\n <NeutralSymbol />\n ) : (\n <ApipassSymbol\n key={variant}\n variant={variant}\n speed={speed}\n isAnimating={isAnimating && supportsScriptedSvgAnimation()}\n />\n )}\n </span>\n );\n}\n\nfunction NeutralSymbol() {\n return (\n <svg\n className=\"brand-loader-neutral-glyph\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle className=\"brand-loader-neutral-track\" cx=\"12\" cy=\"12\" r=\"9\" />\n <circle\n className=\"brand-loader-neutral-arc\"\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n pathLength={100}\n />\n </svg>\n );\n}\n\ntype ApipassSymbolProps = {\n variant: BrandLoaderVariant;\n speed: number;\n isAnimating: boolean;\n};\n\nfunction ApipassSymbol({ variant, speed, isAnimating }: ApipassSymbolProps) {\n const definition = brandLoaderVariants[variant];\n const sweepClipId = `brand-loader-sweep-${useId().replace(/:/g, \"\")}`;\n\n const strokesRef = useRef<SVGGElement>(null);\n const slashRef = useRef<SVGPathElement>(null);\n const bigRef = useRef<SVGPathElement>(null);\n const triRef = useRef<SVGPathElement>(null);\n const ballRef = useRef<SVGEllipseElement>(null);\n const sweepClipRef = useRef<SVGPolygonElement>(null);\n const sweepEdgeRef = useRef<SVGLineElement>(null);\n\n const elementsRef = useRef<BrandLoaderElements | null>(null);\n const elapsedRef = useRef(0);\n const lastFrameRef = useRef<number | null>(null);\n\n const currentProgress = () =>\n (elapsedRef.current % definition.period) / definition.period;\n\n useLayoutEffect(() => {\n const strokes = strokesRef.current;\n const slash = slashRef.current;\n const big = bigRef.current;\n const tri = triRef.current;\n if (!strokes || !slash || !big || !tri) return;\n\n const elements: BrandLoaderElements = {\n strokes,\n slash,\n big,\n tri,\n ball: ballRef.current,\n sweepClip: sweepClipRef.current,\n sweepEdge: sweepEdgeRef.current,\n lengths: {\n slash: measurePath(slash, brandLoaderPathLengths.slash),\n big: measurePath(big, brandLoaderPathLengths.big),\n tri: measurePath(tri, brandLoaderPathLengths.tri),\n },\n };\n elementsRef.current = elements;\n lastFrameRef.current = null;\n\n if (isAnimating) {\n definition.render(\n (elapsedRef.current % definition.period) / definition.period,\n elements,\n );\n } else {\n definition.renderRest(elements);\n }\n }, [definition, isAnimating]);\n\n useAnimationFrame((now) => {\n const elements = elementsRef.current;\n if (!elements) return;\n if (lastFrameRef.current !== null) {\n elapsedRef.current += (now - lastFrameRef.current) * speed;\n }\n lastFrameRef.current = now;\n definition.render(currentProgress(), elements);\n }, isAnimating);\n\n return (\n <svg\n className=\"brand-loader-symbol\"\n viewBox={brandLoaderViewBox}\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {variant === \"sweep\" && (\n <defs>\n <clipPath id={sweepClipId}>\n <polygon ref={sweepClipRef} />\n </clipPath>\n </defs>\n )}\n <g\n ref={strokesRef}\n className=\"brand-loader-strokes\"\n clipPath={variant === \"sweep\" ? `url(#${sweepClipId})` : undefined}\n >\n {variant === \"comet\" && (\n <g className=\"brand-loader-ghost\">\n <path d={brandLoaderSymbolPaths.slash} />\n <path d={brandLoaderSymbolPaths.big} />\n <path d={brandLoaderSymbolPaths.tri} />\n </g>\n )}\n <path\n ref={slashRef}\n className=\"brand-loader-piece brand-loader-slash\"\n d={brandLoaderSymbolPaths.slash}\n />\n <path\n ref={bigRef}\n className=\"brand-loader-piece brand-loader-big\"\n d={brandLoaderSymbolPaths.big}\n />\n <path\n ref={triRef}\n className=\"brand-loader-piece brand-loader-tri\"\n d={brandLoaderSymbolPaths.tri}\n />\n </g>\n {variant === \"bounce\" && (\n <ellipse ref={ballRef} className=\"brand-loader-ball\" />\n )}\n {variant === \"sweep\" && (\n <line ref={sweepEdgeRef} className=\"brand-loader-sweep-edge\" />\n )}\n </svg>\n );\n}\n"],"names":["supportsScriptedSvgAnimation","measurePath","path","fallbackLength","BrandLoader","label","isDecorative","variant","size","tone","speed","isPaused","symbol","className","props","providedSymbol","useBrandLoaderSymbol","resolvedSymbol","prefersReducedMotion","useCustomMediaQuery","isAnimating","jsx","clsx","NeutralSymbol","ApipassSymbol","jsxs","definition","brandLoaderVariants","sweepClipId","useId","strokesRef","useRef","slashRef","bigRef","triRef","ballRef","sweepClipRef","sweepEdgeRef","elementsRef","elapsedRef","lastFrameRef","currentProgress","useLayoutEffect","strokes","slash","big","tri","elements","brandLoaderPathLengths","useAnimationFrame","now","brandLoaderViewBox","brandLoaderSymbolPaths"],"mappings":"6YA6CA,SAASA,GAA+B,CACtC,OACE,OAAO,OAAW,KAClB,OAAO,OAAO,uBAA0B,YACxC,OAAO,eAAmB,KAC1B,OAAO,eAAe,UAAU,kBAAqB,UAEzD,CAEA,SAASC,EAAYC,EAAsBC,EAAwB,CACjE,OAAO,OAAOD,EAAK,gBAAmB,WAClCA,EAAK,iBACLC,CACN,CAEO,SAASC,EAAY,CAC1B,MAAAC,EACA,cAAeC,EACf,QAAAC,EAAU,QACV,KAAAC,EAAO,KACP,KAAAC,EAAO,SACP,MAAAC,EAAQ,EACR,SAAAC,EAAW,GACX,OAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAqB,CACnB,MAAMC,EAAiBC,EAAAA,qBAAA,EACjBC,EAAiBL,GAAUG,EAC3BG,EAAuBC,EAAAA,oBAC3B,kCAAA,EAEIC,EAAc,CAACT,GAAY,CAACO,EAElC,OACEG,EAAAA,IAAC,OAAA,CACC,KAAMf,EAAe,OAAY,SACjC,aAAYD,EACZ,cAAaC,GAAgB,OAC7B,UAAWgB,EAAAA,KACT,eACA,qBAAqBd,CAAI,GACzB,qBAAqBC,CAAI,GACzB,gBAAgBQ,CAAc,GAC9B,wBAAwBV,CAAO,GAC/B,CAACa,GAAe,sBAChBP,CAAA,EAED,GAAGC,EAEH,SAAAG,IAAmB,UAClBI,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AAG+B,EAAAA,uBAAuB,GAAA,CAAK,EACrC/B,EAAAA,IAAC,OAAA,CAAK,EAAG+B,EAAAA,uBAAuB,GAAA,CAAK,CAAA,EACvC,EAEF/B,EAAAA,IAAC,OAAA,CACC,IAAKW,EACL,UAAU,wCACV,EAAGoB,EAAAA,uBAAuB,KAAA,CAAA,EAE5B/B,EAAAA,IAAC,OAAA,CACC,IAAKY,EACL,UAAU,sCACV,EAAGmB,EAAAA,uBAAuB,GAAA,CAAA,EAE5B/B,EAAAA,IAAC,OAAA,CACC,IAAKa,EACL,UAAU,sCACV,EAAGkB,EAAAA,uBAAuB,GAAA,CAAA,CAC5B,CAAA,CAAA,EAED7C,IAAY,UACXc,EAAAA,IAAC,WAAQ,IAAKc,EAAS,UAAU,oBAAoB,EAEtD5B,IAAY,SACXc,EAAAA,IAAC,QAAK,IAAKgB,EAAc,UAAU,yBAAA,CAA0B,CAAA,CAAA,CAAA,CAIrE"}
@@ -0,0 +1,165 @@
1
+ import { jsx as e, jsxs as N } from "react/jsx-runtime";
2
+ import { clsx as A } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { useId as B, useRef as t, useLayoutEffect as E } from "react";
4
+ import { useAnimationFrame as k } from "../../hooks/useAnimationFrame.js";
5
+ import { brandLoaderVariants as C, brandLoaderViewBox as V, brandLoaderSymbolPaths as d, brandLoaderPathLengths as x } from "./brandLoaderVariants.js";
6
+ import { useBrandLoaderSymbol as v } from "./brandLoaderSymbolContext.js";
7
+ /* empty css */
8
+ import { useCustomMediaQuery as F } from "../../hooks/useMediaQuery.js";
9
+ function j() {
10
+ return typeof window < "u" && typeof window.requestAnimationFrame == "function" && typeof SVGPathElement < "u" && typeof SVGPathElement.prototype.getPointAtLength == "function";
11
+ }
12
+ function P(r, o) {
13
+ return typeof r.getTotalLength == "function" ? r.getTotalLength() : o;
14
+ }
15
+ function O({
16
+ label: r,
17
+ "aria-hidden": o,
18
+ variant: a = "trace",
19
+ size: n = "32",
20
+ tone: u = "accent",
21
+ speed: p = 1,
22
+ isPaused: f = !1,
23
+ symbol: m,
24
+ className: b,
25
+ ...h
26
+ }) {
27
+ const g = v(), c = m ?? g, y = F(
28
+ "(prefers-reduced-motion: reduce)"
29
+ ), s = !f && !y;
30
+ return /* @__PURE__ */ e(
31
+ "span",
32
+ {
33
+ role: o ? void 0 : "status",
34
+ "aria-label": r,
35
+ "aria-hidden": o || void 0,
36
+ className: A(
37
+ "brand-loader",
38
+ `brand-loader-size-${n}`,
39
+ `brand-loader-tone-${u}`,
40
+ `brand-loader-${c}`,
41
+ `brand-loader-variant-${a}`,
42
+ !s && "brand-loader-paused",
43
+ b
44
+ ),
45
+ ...h,
46
+ children: c === "neutral" ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ e(
47
+ I,
48
+ {
49
+ variant: a,
50
+ speed: p,
51
+ isAnimating: s && j()
52
+ },
53
+ a
54
+ )
55
+ }
56
+ );
57
+ }
58
+ function G() {
59
+ return /* @__PURE__ */ N(
60
+ "svg",
61
+ {
62
+ className: "brand-loader-neutral-glyph",
63
+ viewBox: "0 0 24 24",
64
+ "aria-hidden": "true",
65
+ focusable: "false",
66
+ children: [
67
+ /* @__PURE__ */ e("circle", { className: "brand-loader-neutral-track", cx: "12", cy: "12", r: "9" }),
68
+ /* @__PURE__ */ e(
69
+ "circle",
70
+ {
71
+ className: "brand-loader-neutral-arc",
72
+ cx: "12",
73
+ cy: "12",
74
+ r: "9",
75
+ pathLength: 100
76
+ }
77
+ )
78
+ ]
79
+ }
80
+ );
81
+ }
82
+ function I({ variant: r, speed: o, isAnimating: a }) {
83
+ const n = C[r], u = `brand-loader-sweep-${B().replace(/:/g, "")}`, p = t(null), f = t(null), m = t(null), b = t(null), h = t(null), g = t(null), c = t(null), y = t(null), s = t(0), w = t(null), $ = () => s.current % n.period / n.period;
84
+ return E(() => {
85
+ const i = p.current, l = f.current, R = m.current, L = b.current;
86
+ if (!i || !l || !R || !L) return;
87
+ const S = {
88
+ strokes: i,
89
+ slash: l,
90
+ big: R,
91
+ tri: L,
92
+ ball: h.current,
93
+ sweepClip: g.current,
94
+ sweepEdge: c.current,
95
+ lengths: {
96
+ slash: P(l, x.slash),
97
+ big: P(R, x.big),
98
+ tri: P(L, x.tri)
99
+ }
100
+ };
101
+ y.current = S, w.current = null, a ? n.render(
102
+ s.current % n.period / n.period,
103
+ S
104
+ ) : n.renderRest(S);
105
+ }, [n, a]), k((i) => {
106
+ const l = y.current;
107
+ l && (w.current !== null && (s.current += (i - w.current) * o), w.current = i, n.render($(), l));
108
+ }, a), /* @__PURE__ */ N(
109
+ "svg",
110
+ {
111
+ className: "brand-loader-symbol",
112
+ viewBox: V,
113
+ "aria-hidden": "true",
114
+ focusable: "false",
115
+ children: [
116
+ r === "sweep" && /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e("clipPath", { id: u, children: /* @__PURE__ */ e("polygon", { ref: g }) }) }),
117
+ /* @__PURE__ */ N(
118
+ "g",
119
+ {
120
+ ref: p,
121
+ className: "brand-loader-strokes",
122
+ clipPath: r === "sweep" ? `url(#${u})` : void 0,
123
+ children: [
124
+ r === "comet" && /* @__PURE__ */ N("g", { className: "brand-loader-ghost", children: [
125
+ /* @__PURE__ */ e("path", { d: d.slash }),
126
+ /* @__PURE__ */ e("path", { d: d.big }),
127
+ /* @__PURE__ */ e("path", { d: d.tri })
128
+ ] }),
129
+ /* @__PURE__ */ e(
130
+ "path",
131
+ {
132
+ ref: f,
133
+ className: "brand-loader-piece brand-loader-slash",
134
+ d: d.slash
135
+ }
136
+ ),
137
+ /* @__PURE__ */ e(
138
+ "path",
139
+ {
140
+ ref: m,
141
+ className: "brand-loader-piece brand-loader-big",
142
+ d: d.big
143
+ }
144
+ ),
145
+ /* @__PURE__ */ e(
146
+ "path",
147
+ {
148
+ ref: b,
149
+ className: "brand-loader-piece brand-loader-tri",
150
+ d: d.tri
151
+ }
152
+ )
153
+ ]
154
+ }
155
+ ),
156
+ r === "bounce" && /* @__PURE__ */ e("ellipse", { ref: h, className: "brand-loader-ball" }),
157
+ r === "sweep" && /* @__PURE__ */ e("line", { ref: c, className: "brand-loader-sweep-edge" })
158
+ ]
159
+ }
160
+ );
161
+ }
162
+ export {
163
+ O as BrandLoader
164
+ };
165
+ //# sourceMappingURL=BrandLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrandLoader.js","sources":["../../../../../src/ui/primitives/BrandLoader/BrandLoader.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useCustomMediaQuery } from \"hooks\";\nimport {\n type ComponentPropsWithoutRef,\n useId,\n useLayoutEffect,\n useRef,\n} from \"react\";\nimport { useAnimationFrame } from \"../../hooks/useAnimationFrame\";\nimport {\n brandLoaderPathLengths,\n brandLoaderSymbolPaths,\n brandLoaderVariants,\n brandLoaderViewBox,\n type BrandLoaderElements,\n type BrandLoaderVariant,\n} from \"./brandLoaderVariants\";\nimport { type BrandLoaderSymbol, useBrandLoaderSymbol } from \"./brandLoaderSymbolContext\";\nimport \"./brand-loader.css\";\n\nexport type { BrandLoaderVariant } from \"./brandLoaderVariants\";\nexport { BrandLoaderProvider, type BrandLoaderProviderProps } from \"./BrandLoaderProvider\";\nexport type { BrandLoaderSymbol } from \"./brandLoaderSymbolContext\";\n\nexport type BrandLoaderSize = \"16\" | \"24\" | \"32\" | \"64\";\n\nexport type BrandLoaderTone = \"accent\" | \"brand\" | \"current\";\n\ntype BrandLoaderAccessibilityProps =\n | { label: string; \"aria-hidden\"?: false }\n | { label?: undefined; \"aria-hidden\": true };\n\nexport type BrandLoaderProps = Omit<\n ComponentPropsWithoutRef<\"span\">,\n \"children\" | \"aria-hidden\"\n> &\n BrandLoaderAccessibilityProps & {\n variant?: BrandLoaderVariant;\n size?: BrandLoaderSize;\n tone?: BrandLoaderTone;\n speed?: number;\n isPaused?: boolean;\n symbol?: BrandLoaderSymbol;\n };\n\nfunction supportsScriptedSvgAnimation() {\n return (\n typeof window !== \"undefined\" &&\n typeof window.requestAnimationFrame === \"function\" &&\n typeof SVGPathElement !== \"undefined\" &&\n typeof SVGPathElement.prototype.getPointAtLength === \"function\"\n );\n}\n\nfunction measurePath(path: SVGPathElement, fallbackLength: number) {\n return typeof path.getTotalLength === \"function\"\n ? path.getTotalLength()\n : fallbackLength;\n}\n\nexport function BrandLoader({\n label,\n \"aria-hidden\": isDecorative,\n variant = \"trace\",\n size = \"32\",\n tone = \"accent\",\n speed = 1,\n isPaused = false,\n symbol,\n className,\n ...props\n}: BrandLoaderProps) {\n const providedSymbol = useBrandLoaderSymbol();\n const resolvedSymbol = symbol ?? providedSymbol;\n const prefersReducedMotion = useCustomMediaQuery(\n \"(prefers-reduced-motion: reduce)\",\n );\n const isAnimating = !isPaused && !prefersReducedMotion;\n\n return (\n <span\n role={isDecorative ? undefined : \"status\"}\n aria-label={label}\n aria-hidden={isDecorative || undefined}\n className={clsx(\n \"brand-loader\",\n `brand-loader-size-${size}`,\n `brand-loader-tone-${tone}`,\n `brand-loader-${resolvedSymbol}`,\n `brand-loader-variant-${variant}`,\n !isAnimating && \"brand-loader-paused\",\n className,\n )}\n {...props}\n >\n {resolvedSymbol === \"neutral\" ? (\n <NeutralSymbol />\n ) : (\n <ApipassSymbol\n key={variant}\n variant={variant}\n speed={speed}\n isAnimating={isAnimating && supportsScriptedSvgAnimation()}\n />\n )}\n </span>\n );\n}\n\nfunction NeutralSymbol() {\n return (\n <svg\n className=\"brand-loader-neutral-glyph\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle className=\"brand-loader-neutral-track\" cx=\"12\" cy=\"12\" r=\"9\" />\n <circle\n className=\"brand-loader-neutral-arc\"\n cx=\"12\"\n cy=\"12\"\n r=\"9\"\n pathLength={100}\n />\n </svg>\n );\n}\n\ntype ApipassSymbolProps = {\n variant: BrandLoaderVariant;\n speed: number;\n isAnimating: boolean;\n};\n\nfunction ApipassSymbol({ variant, speed, isAnimating }: ApipassSymbolProps) {\n const definition = brandLoaderVariants[variant];\n const sweepClipId = `brand-loader-sweep-${useId().replace(/:/g, \"\")}`;\n\n const strokesRef = useRef<SVGGElement>(null);\n const slashRef = useRef<SVGPathElement>(null);\n const bigRef = useRef<SVGPathElement>(null);\n const triRef = useRef<SVGPathElement>(null);\n const ballRef = useRef<SVGEllipseElement>(null);\n const sweepClipRef = useRef<SVGPolygonElement>(null);\n const sweepEdgeRef = useRef<SVGLineElement>(null);\n\n const elementsRef = useRef<BrandLoaderElements | null>(null);\n const elapsedRef = useRef(0);\n const lastFrameRef = useRef<number | null>(null);\n\n const currentProgress = () =>\n (elapsedRef.current % definition.period) / definition.period;\n\n useLayoutEffect(() => {\n const strokes = strokesRef.current;\n const slash = slashRef.current;\n const big = bigRef.current;\n const tri = triRef.current;\n if (!strokes || !slash || !big || !tri) return;\n\n const elements: BrandLoaderElements = {\n strokes,\n slash,\n big,\n tri,\n ball: ballRef.current,\n sweepClip: sweepClipRef.current,\n sweepEdge: sweepEdgeRef.current,\n lengths: {\n slash: measurePath(slash, brandLoaderPathLengths.slash),\n big: measurePath(big, brandLoaderPathLengths.big),\n tri: measurePath(tri, brandLoaderPathLengths.tri),\n },\n };\n elementsRef.current = elements;\n lastFrameRef.current = null;\n\n if (isAnimating) {\n definition.render(\n (elapsedRef.current % definition.period) / definition.period,\n elements,\n );\n } else {\n definition.renderRest(elements);\n }\n }, [definition, isAnimating]);\n\n useAnimationFrame((now) => {\n const elements = elementsRef.current;\n if (!elements) return;\n if (lastFrameRef.current !== null) {\n elapsedRef.current += (now - lastFrameRef.current) * speed;\n }\n lastFrameRef.current = now;\n definition.render(currentProgress(), elements);\n }, isAnimating);\n\n return (\n <svg\n className=\"brand-loader-symbol\"\n viewBox={brandLoaderViewBox}\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n {variant === \"sweep\" && (\n <defs>\n <clipPath id={sweepClipId}>\n <polygon ref={sweepClipRef} />\n </clipPath>\n </defs>\n )}\n <g\n ref={strokesRef}\n className=\"brand-loader-strokes\"\n clipPath={variant === \"sweep\" ? `url(#${sweepClipId})` : undefined}\n >\n {variant === \"comet\" && (\n <g className=\"brand-loader-ghost\">\n <path d={brandLoaderSymbolPaths.slash} />\n <path d={brandLoaderSymbolPaths.big} />\n <path d={brandLoaderSymbolPaths.tri} />\n </g>\n )}\n <path\n ref={slashRef}\n className=\"brand-loader-piece brand-loader-slash\"\n d={brandLoaderSymbolPaths.slash}\n />\n <path\n ref={bigRef}\n className=\"brand-loader-piece brand-loader-big\"\n d={brandLoaderSymbolPaths.big}\n />\n <path\n ref={triRef}\n className=\"brand-loader-piece brand-loader-tri\"\n d={brandLoaderSymbolPaths.tri}\n />\n </g>\n {variant === \"bounce\" && (\n <ellipse ref={ballRef} className=\"brand-loader-ball\" />\n )}\n {variant === \"sweep\" && (\n <line ref={sweepEdgeRef} className=\"brand-loader-sweep-edge\" />\n )}\n </svg>\n );\n}\n"],"names":["supportsScriptedSvgAnimation","measurePath","path","fallbackLength","BrandLoader","label","isDecorative","variant","size","tone","speed","isPaused","symbol","className","props","providedSymbol","useBrandLoaderSymbol","resolvedSymbol","prefersReducedMotion","useCustomMediaQuery","isAnimating","jsx","clsx","NeutralSymbol","ApipassSymbol","jsxs","definition","brandLoaderVariants","sweepClipId","useId","strokesRef","useRef","slashRef","bigRef","triRef","ballRef","sweepClipRef","sweepEdgeRef","elementsRef","elapsedRef","lastFrameRef","currentProgress","useLayoutEffect","strokes","slash","big","tri","elements","brandLoaderPathLengths","useAnimationFrame","now","brandLoaderViewBox","brandLoaderSymbolPaths"],"mappings":";;;;;;;;AA6CA,SAASA,IAA+B;AACtC,SACE,OAAO,SAAW,OAClB,OAAO,OAAO,yBAA0B,cACxC,OAAO,iBAAmB,OAC1B,OAAO,eAAe,UAAU,oBAAqB;AAEzD;AAEA,SAASC,EAAYC,GAAsBC,GAAwB;AACjE,SAAO,OAAOD,EAAK,kBAAmB,aAClCA,EAAK,mBACLC;AACN;AAEO,SAASC,EAAY;AAAA,EAC1B,OAAAC;AAAA,EACA,eAAeC;A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A/B;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,KAAKY;AAAA,kBACL,WAAU;AAAA,kBACV,GAAGmB,EAAuB;AAAA,gBAAA;AAAA,cAAA;AAAA,cAE5B,gBAAA/B;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,KAAKa;AAAA,kBACL,WAAU;AAAA,kBACV,GAAGkB,EAAuB;AAAA,gBAAA;AAAA,cAAA;AAAA,YAC5B;AAAA,UAAA;AAAA,QAAA;AAAA,QAED7C,MAAY,YACX,gBAAAc,EAAC,aAAQ,KAAKc,GAAS,WAAU,qBAAoB;AAAA,QAEtD5B,MAAY,WACX,gBAAAc,EAAC,UAAK,KAAKgB,GAAc,WAAU,0BAAA,CAA0B;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIrE;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("./brandLoaderSymbolContext.cjs");function n({symbol:r,children:e}){return o.jsx(t.BrandLoaderSymbolContext.Provider,{value:r,children:e})}exports.BrandLoaderProvider=n;
2
+ //# sourceMappingURL=BrandLoaderProvider.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrandLoaderProvider.cjs","sources":["../../../../../src/ui/primitives/BrandLoader/BrandLoaderProvider.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { BrandLoaderSymbolContext, type BrandLoaderSymbol } from \"./brandLoaderSymbolContext\";\n\nexport type BrandLoaderProviderProps = {\n symbol: BrandLoaderSymbol;\n children: ReactNode;\n};\n\nexport function BrandLoaderProvider({ symbol, children }: BrandLoaderProviderProps) {\n return (\n <BrandLoaderSymbolContext.Provider value={symbol}>\n {children}\n </BrandLoaderSymbolContext.Provider>\n );\n}\n"],"names":["BrandLoaderProvider","symbol","children","BrandLoaderSymbolContext"],"mappings":"iKAQO,SAASA,EAAoB,CAAE,OAAAC,EAAQ,SAAAC,GAAsC,CAClF,aACGC,EAAAA,yBAAyB,SAAzB,CAAkC,MAAOF,EACvC,SAAAC,EACH,CAEJ"}
@@ -0,0 +1,9 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { BrandLoaderSymbolContext as t } from "./brandLoaderSymbolContext.js";
3
+ function a({ symbol: r, children: o }) {
4
+ return /* @__PURE__ */ e(t.Provider, { value: r, children: o });
5
+ }
6
+ export {
7
+ a as BrandLoaderProvider
8
+ };
9
+ //# sourceMappingURL=BrandLoaderProvider.js.map