@clubmed/trident-ui 2.0.0-beta.2 → 2.0.0-beta.21

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 (87) hide show
  1. package/chunks/DateField.js +36 -35
  2. package/chunks/DateField.js.map +1 -1
  3. package/examples/button-demo.js +2 -2
  4. package/examples/button-demo.js.map +1 -1
  5. package/examples/checkbox-demo.js +16 -20
  6. package/examples/checkbox-demo.js.map +1 -1
  7. package/examples/checkboxes-demo.js +6 -6
  8. package/examples/checkboxes-demo.js.map +1 -1
  9. package/examples/choice-expander-demo.js +4 -67
  10. package/examples/choice-expander-demo.js.map +1 -1
  11. package/examples/dropdown-demo.js +9 -1
  12. package/examples/dropdown-demo.js.map +1 -1
  13. package/examples/elastic-height-demo.js +2 -1
  14. package/examples/elastic-height-demo.js.map +1 -1
  15. package/examples/frame-demo.d.ts +1 -0
  16. package/examples/frame-demo.js +18 -0
  17. package/examples/frame-demo.js.map +1 -0
  18. package/examples/frame-horizontal-demo.d.ts +1 -0
  19. package/examples/frame-horizontal-demo.js +18 -0
  20. package/examples/frame-horizontal-demo.js.map +1 -0
  21. package/examples/frame-vertical-demo.d.ts +1 -0
  22. package/examples/frame-vertical-demo.js +18 -0
  23. package/examples/frame-vertical-demo.js.map +1 -0
  24. package/examples/frame-with-tag-demo.d.ts +1 -0
  25. package/examples/frame-with-tag-demo.js +23 -0
  26. package/examples/frame-with-tag-demo.js.map +1 -0
  27. package/examples/sidebar-layout-demo.js +5 -5
  28. package/examples/sidebar-layout-demo.js.map +1 -1
  29. package/examples/sidebar-layout-minimal-demo.js +2 -2
  30. package/examples/sidebar-layout-minimal-demo.js.map +1 -1
  31. package/examples/sidebar-layout-with-header-demo.js +2 -2
  32. package/examples/sidebar-layout-with-header-demo.js.map +1 -1
  33. package/package.json +2 -1
  34. package/styles/animate.css +19 -19
  35. package/styles/theme.css +23 -18
  36. package/styles/ui/button.css +18 -24
  37. package/styles/ui/controls.css +1 -11
  38. package/styles/variants.css +0 -2
  39. package/ui/AdvancedToast.js +11 -11
  40. package/ui/AdvancedToast.js.map +1 -1
  41. package/ui/BasicToast.js +1 -1
  42. package/ui/BasicToast.js.map +1 -1
  43. package/ui/Breadcrumb.d.ts +2 -2
  44. package/ui/Breadcrumb.js +31 -35
  45. package/ui/Breadcrumb.js.map +1 -1
  46. package/ui/ChoiceExpander.js +1 -1
  47. package/ui/ChoiceExpander.js.map +1 -1
  48. package/ui/Dropdown.d.ts +20 -3
  49. package/ui/Dropdown.js +57 -23
  50. package/ui/Dropdown.js.map +1 -1
  51. package/ui/ElasticHeight.d.ts +0 -1
  52. package/ui/ElasticHeight.js +14 -23
  53. package/ui/ElasticHeight.js.map +1 -1
  54. package/ui/Frame.d.ts +15 -0
  55. package/ui/Frame.js +39 -0
  56. package/ui/Frame.js.map +1 -0
  57. package/ui/Loader.d.ts +5 -4
  58. package/ui/Loader.js +11 -10
  59. package/ui/Loader.js.map +1 -1
  60. package/ui/Popin.js +2 -2
  61. package/ui/Popin.js.map +1 -1
  62. package/ui/SidebarLayout.d.ts +11 -7
  63. package/ui/SidebarLayout.js +55 -34
  64. package/ui/SidebarLayout.js.map +1 -1
  65. package/ui/arrows/Arrows.d.ts +1 -0
  66. package/ui/arrows/Arrows.js +19 -17
  67. package/ui/arrows/Arrows.js.map +1 -1
  68. package/ui/buttons/Button.type.d.ts +1 -1
  69. package/ui/buttons/Button.type.js.map +1 -1
  70. package/ui/forms/Filter.d.ts +8 -4
  71. package/ui/forms/Filter.js +23 -45
  72. package/ui/forms/Filter.js.map +1 -1
  73. package/ui/forms/FormControl.js +6 -6
  74. package/ui/forms/NumberField.d.ts +10 -10
  75. package/ui/forms/checkboxes/Checkbox.d.ts +10 -12
  76. package/ui/forms/checkboxes/Checkbox.js +38 -55
  77. package/ui/forms/checkboxes/Checkbox.js.map +1 -1
  78. package/ui/forms/checkboxes/Checkboxes.js +2 -2
  79. package/ui/forms/checkboxes/Checkboxes.js.map +1 -1
  80. package/ui/helpers/colors/colors.d.ts +4 -0
  81. package/ui/helpers/colors/colors.js +6 -1
  82. package/ui/helpers/colors/colors.js.map +1 -1
  83. package/ui/hooks/useValue.js +1 -1
  84. package/ui/hooks/useValue.js.map +1 -1
  85. package/ui/Breadcrumb.themes.d.ts +0 -8
  86. package/ui/Breadcrumb.themes.js +0 -16
  87. package/ui/Breadcrumb.themes.js.map +0 -1
package/ui/Loader.js CHANGED
@@ -33,8 +33,8 @@ var o = /* @__PURE__ */ a("svg", {
33
33
  })]
34
34
  })]
35
35
  })]
36
- }), s = ({ isVisible: s, label: c }) => {
37
- let [{ status: l, isMounted: u }, d] = t({
36
+ }), s = ({ isVisible: s, label: c, portalId: l }) => {
37
+ let [{ status: u, isMounted: d }, f] = t({
38
38
  timeout: {
39
39
  enter: 250,
40
40
  exit: 250
@@ -44,16 +44,17 @@ var o = /* @__PURE__ */ a("svg", {
44
44
  preEnter: !0
45
45
  });
46
46
  r(() => {
47
- d(s);
48
- }, [s, d]);
49
- let f = l === "preEnter" || l === "entering", p = l === "exiting";
47
+ f(s);
48
+ }, [s, f]);
49
+ let p = u === "preEnter" || u === "entering", m = u === "exiting";
50
50
  return /* @__PURE__ */ i(n, {
51
51
  isVisible: s,
52
+ target: l,
52
53
  sweep: !0,
53
- children: u && /* @__PURE__ */ a("div", {
54
+ children: d && /* @__PURE__ */ a("div", {
54
55
  className: e("flex flex-col items-center transition-all duration-500", {
55
- "-translate-x-full opacity-0": f,
56
- "translate-x-full opacity-100": p
56
+ "-translate-x-full opacity-0": p,
57
+ "translate-x-full opacity-100": m
57
58
  }),
58
59
  role: "alert",
59
60
  children: [/* @__PURE__ */ i("div", {
@@ -65,8 +66,8 @@ var o = /* @__PURE__ */ a("svg", {
65
66
  children: o
66
67
  }), /* @__PURE__ */ i("div", {
67
68
  className: e("mx-auto max-w-[320px] px-20 text-center text-b3 transition-all delay-100 duration-400", {
68
- "-translate-x-full opacity-0": f,
69
- "translate-x-full opacity-100": p
69
+ "-translate-x-full opacity-0": p,
70
+ "translate-x-full opacity-100": m
70
71
  }),
71
72
  children: c
72
73
  })]
package/ui/Loader.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Loader.js","names":[],"sources":["../../lib/ui/Loader.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useEffect, type FunctionComponent } from 'react';\nimport { useTransitionState } from 'react-transition-state';\n\nimport { Backdrop } from './Backdrop';\n\ninterface Props {\n isVisible?: boolean;\n label?: string;\n}\n\nconst loaderSVG = (\n <svg viewBox=\"0 0 140 140\" width={140}>\n <defs>\n <path\n id=\"a\"\n d=\"m70 74.1-9.6 9.6 9.6 9.5 9.5-9.5L70 74Zm6.6-70.7c-.7-2.7-6.9 1.1-20.1 13 5.3 5.8 7.9 2.5 12.1 1 3.4 6.4 4.8 35.4-17.3 44 .6-29.1.9-60.4.9-60.4a1 1 0 0 0-1.3-1c-6.1.8-17 11.6-25.3 20.6 4.6 7.5 10.4.8 15-1.1 0 1.2-1 22.8-.6 44.7C17.3 66 21 19.5 22.2 13.6 22.8 8.9 7.6 19.3 0 26.4c2.4 4.3 5.7 3.4 10 1.8C8.3 49 23 67.9 40 67.5c.6 21.4 2.9 42.2 9 43.7 1 .2 1.6-21.8 2-46.1C92 52.4 76.5 3.4 76.5 3.4\"\n />\n </defs>\n <g fill=\"none\" fillRule=\"evenodd\" transform=\"translate(27 14)\">\n <mask id=\"b\" fill=\"#fff\">\n <use xlinkHref=\"#a\" />\n </mask>\n <g mask=\"url(#b)\">\n <path\n fill=\"#1E2643\"\n fillRule=\"nonzero\"\n d=\"M-83.1-23s6.7 3 11.2 3c4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3 4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3 4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3C.2-20 2.3-23 7-23c4.5 0 6.7 3 11.2 3 4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 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 27c.6 1.1 1.3 2 2.2 2.6a5 5 0 0 0 2.8 1c2 .1 4-.6 6-1.4l-.6-1.8c-2.1.8-3.8 1.3-5.2 1.2-.7 0-1.3-.2-1.9-.6-.5-.4-1-1-1.6-2l-1.8 1Zm9.6 1a41.8 41.8 0 0 0 8.4 28.3c5.7 7.5 14 12.3 22.9 12v-2a26 26 0 0 1-21.3-11.2 40 40 0 0 1-8-27H9ZM39 67.4c.3 10.7 1 21.3 2.5 29.5.7 4 1.6 7.5 2.7 10.1 1.1 2.6 2.6 4.6 4.7 5l.4-2c-1-.2-2.2-1.3-3.2-3.8-1-2.3-2-5.7-2.7-9.7-1.4-8-2-18.5-2.4-29.1h-2Zm9.8 44.6c.7.2 1.1-.3 1.2-.4l.2-.4.2-.9.3-2.8.5-10.2.9-32.3h-2a1859.2 1859.2 0 0 1-1.4 42.3 38 38 0 0 1-.4 3.2c0-.1.4-.6 1-.4l-.5 2Zm2.6-46a39.2 39.2 0 0 0 21.8-15.4 46 46 0 0 0 7-21.1 73 73 0 0 0-2.6-25.9l-.1-.4v-.1l-1 .2-1 .3a14.2 14.2 0 0 1 .2.6 51 51 0 0 1 1.6 7.1 71 71 0 0 1 .9 18A37.2 37.2 0 0 1 50.8 64l.6 2Z\"\n mask=\"url(#a)\"\n />\n </g>\n </g>\n </svg>\n);\n\nexport const Loader: FunctionComponent<Props> = ({ isVisible, label }) => {\n const [{ status, isMounted }, toggle] = useTransitionState({\n timeout: { enter: 250, exit: 250 },\n mountOnEnter: true,\n unmountOnExit: true,\n preEnter: true,\n });\n\n useEffect(() => {\n toggle(isVisible);\n }, [isVisible, toggle]);\n\n const entering = status === 'preEnter' || status === 'entering';\n const exiting = status === 'exiting';\n\n return (\n <Backdrop isVisible={isVisible} sweep>\n {isMounted && (\n <div\n className={clsx('flex flex-col items-center transition-all duration-500', {\n '-translate-x-full opacity-0': entering,\n 'translate-x-full opacity-100': exiting,\n })}\n role=\"alert\"\n >\n <div\n className=\"relative isolate\"\n style={{\n maskImage: `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 2'%3E%3Cellipse cx='1' cy='1' rx='1' ry='1'/%3E%3C/svg%3E\")`,\n WebkitMaskImage: `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 2'%3E%3Cellipse cx='1' cy='1' rx='1' ry='1'/%3E%3C/svg%3E\")`,\n }}\n >\n {loaderSVG}\n </div>\n <div\n className={clsx(\n 'mx-auto max-w-[320px] px-20 text-center text-b3 transition-all delay-100 duration-400',\n {\n '-translate-x-full opacity-0': entering,\n 'translate-x-full opacity-100': exiting,\n },\n )}\n >\n {label}\n </div>\n </div>\n )}\n </Backdrop>\n );\n};\n"],"mappings":";;;;;;AAaA,IAAM,IACJ,kBAAC,OAAD;CAAK,SAAQ;CAAc,OAAO;WAAlC,CACE,kBAAC,QAAD,EAAA,UACE,kBAAC,QAAD;EACE,IAAG;EACH,GAAE;EACF,CAAA,EACG,CAAA,EACP,kBAAC,KAAD;EAAG,MAAK;EAAO,UAAS;EAAU,WAAU;YAA5C,CACE,kBAAC,QAAD;GAAM,IAAG;GAAI,MAAK;aAChB,kBAAC,OAAD,EAAK,WAAU,MAAO,CAAA;GACjB,CAAA,EACP,kBAAC,KAAD;GAAG,MAAK;aAAR,CACE,kBAAC,QAAD;IACE,MAAK;IACL,UAAS;IACT,GAAE;IACF,WAAU;IACV,CAAA,EACF,kBAAC,QAAD;IACE,MAAK;IACL,UAAS;IACT,GAAE;IACF,MAAK;IACL,CAAA,CAAA;;;IAMG,KAAoC,EAAE,cAAW,eAAY;CACxE,IAAM,CAAC,EAAE,WAAQ,gBAAa,KAAU,EAAmB;EACzD,SAAS;GAAE,OAAO;GAAK,MAAM;GAAK;EAClC,cAAc;EACd,eAAe;EACf,UAAU;EACX,CAAC;AAEF,SAAgB;AACd,IAAO,EAAU;IAChB,CAAC,GAAW,EAAO,CAAC;CAEvB,IAAM,IAAW,MAAW,cAAc,MAAW,YAC/C,IAAU,MAAW;AAE3B,QACE,kBAAC,GAAD;EAAqB;EAAW,OAAA;YAC7B,KACC,kBAAC,OAAD;GACE,WAAW,EAAK,0DAA0D;IACxE,+BAA+B;IAC/B,gCAAgC;IACjC,CAAC;GACF,MAAK;aALP,CAOE,kBAAC,OAAD;IACE,WAAU;IACV,OAAO;KACL,WAAW;KACX,iBAAiB;KAClB;cAEA;IACG,CAAA,EACN,kBAAC,OAAD;IACE,WAAW,EACT,yFACA;KACE,+BAA+B;KAC/B,gCAAgC;KACjC,CACF;cAEA;IACG,CAAA,CAAA;;EAGD,CAAA"}
1
+ {"version":3,"file":"Loader.js","names":[],"sources":["../../lib/ui/Loader.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useEffect, type ComponentProps, type FunctionComponent } from 'react';\nimport { useTransitionState } from 'react-transition-state';\n\nimport { Backdrop } from './Backdrop';\n\nexport interface LoaderProps {\n isVisible?: boolean;\n label?: string;\n portalId?: ComponentProps<typeof Backdrop>['target'];\n}\n\nconst loaderSVG = (\n <svg viewBox=\"0 0 140 140\" width={140}>\n <defs>\n <path\n id=\"a\"\n d=\"m70 74.1-9.6 9.6 9.6 9.5 9.5-9.5L70 74Zm6.6-70.7c-.7-2.7-6.9 1.1-20.1 13 5.3 5.8 7.9 2.5 12.1 1 3.4 6.4 4.8 35.4-17.3 44 .6-29.1.9-60.4.9-60.4a1 1 0 0 0-1.3-1c-6.1.8-17 11.6-25.3 20.6 4.6 7.5 10.4.8 15-1.1 0 1.2-1 22.8-.6 44.7C17.3 66 21 19.5 22.2 13.6 22.8 8.9 7.6 19.3 0 26.4c2.4 4.3 5.7 3.4 10 1.8C8.3 49 23 67.9 40 67.5c.6 21.4 2.9 42.2 9 43.7 1 .2 1.6-21.8 2-46.1C92 52.4 76.5 3.4 76.5 3.4\"\n />\n </defs>\n <g fill=\"none\" fillRule=\"evenodd\" transform=\"translate(27 14)\">\n <mask id=\"b\" fill=\"#fff\">\n <use xlinkHref=\"#a\" />\n </mask>\n <g mask=\"url(#b)\">\n <path\n fill=\"#1E2643\"\n fillRule=\"nonzero\"\n d=\"M-83.1-23s6.7 3 11.2 3c4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3 4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3 4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3C.2-20 2.3-23 7-23c4.5 0 6.7 3 11.2 3 4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3 4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3 4.6 0 6.7-3 11.3-3 4.5 0 6.7 3 11.2 3 4.6 0 11.3-3 11.3-3v138H-83V-23Z\"\n className=\"animate-wave\"\n />\n <path\n fill=\"#1E2643\"\n fillRule=\"nonzero\"\n d=\"m70 74.1.7-.7-.7-.7-.7.7.7.7Zm-9.6 9.6-.7-.7-.7.7.7.7.7-.7Zm9.6 9.5-.7.7.7.7.7-.7-.7-.7Zm9.5-9.5.7.7.7-.7-.7-.7-.7.7Zm-23-67.3-.7-.7-.7.6.7.8.7-.7Zm12.1 1 1-.5-.5-.8-.8.3.3 1Zm-17.3 44h-1V63l1.4-.6-.4-1ZM52.2 1h1-1Zm-1.3-1v1h.2L51 0ZM25.6 20.6l-.7-.7-.5.5.4.7.8-.5Zm15-1.1h1V18l-1.4.5.4 1ZM40 64.2l.1 1h1v-1h-1ZM22.2 13.6l1 .2-1-.2ZM0 26.4l-.7-.8-.6.6.4.7.9-.5Zm10 1.8h1v-1.5l-1.4.6.3.9Zm30 39.3h1v-1h-1v1Zm9 43.7.3-1-.2 1Zm2-46.1-.2-1-.7.2v.8h1Zm18.2 8.3L59.7 83l1.4 1.4 9.6-9.6-1.4-1.4Zm-9.6 11 9.6 9.5 1.4-1.4L61 83l-1.4 1.4Zm11 9.5 9.5-9.5-1.4-1.4-9.5 9.5 1.4 1.4Zm9.5-11-9.5-9.5-1.4 1.4 9.5 9.6 1.4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6-2.7-4-4.3-9.6-5.2-15.6-1.8-12-.5-25 .1-27.8l-2-.4c-.6 3-1.9 16.3-.1 28.5.9 6.1 2.6 12.1 5.5 16.5a14 14 0 0 0 13.5 6.8l-.2-2ZM23.2 13.7l-.1-1.2a2 2 0 0 0-1-1c-.7-.2-1.6 0-2.3.1a28 28 0 0 0-6.2 3.1 106 106 0 0 0-14.3 11L.7 27c3.7-3.5 9.4-7.8 14-10.7a26.4 26.4 0 0 1 6.4-3h.3l-.2-.1v.2l2 .2ZM-.8 27c.6 1.1 1.3 2 2.2 2.6a5 5 0 0 0 2.8 1c2 .1 4-.6 6-1.4l-.6-1.8c-2.1.8-3.8 1.3-5.2 1.2-.7 0-1.3-.2-1.9-.6-.5-.4-1-1-1.6-2l-1.8 1Zm9.6 1a41.8 41.8 0 0 0 8.4 28.3c5.7 7.5 14 12.3 22.9 12v-2a26 26 0 0 1-21.3-11.2 40 40 0 0 1-8-27H9ZM39 67.4c.3 10.7 1 21.3 2.5 29.5.7 4 1.6 7.5 2.7 10.1 1.1 2.6 2.6 4.6 4.7 5l.4-2c-1-.2-2.2-1.3-3.2-3.8-1-2.3-2-5.7-2.7-9.7-1.4-8-2-18.5-2.4-29.1h-2Zm9.8 44.6c.7.2 1.1-.3 1.2-.4l.2-.4.2-.9.3-2.8.5-10.2.9-32.3h-2a1859.2 1859.2 0 0 1-1.4 42.3 38 38 0 0 1-.4 3.2c0-.1.4-.6 1-.4l-.5 2Zm2.6-46a39.2 39.2 0 0 0 21.8-15.4 46 46 0 0 0 7-21.1 73 73 0 0 0-2.6-25.9l-.1-.4v-.1l-1 .2-1 .3a14.2 14.2 0 0 1 .2.6 51 51 0 0 1 1.6 7.1 71 71 0 0 1 .9 18A37.2 37.2 0 0 1 50.8 64l.6 2Z\"\n mask=\"url(#a)\"\n />\n </g>\n </g>\n </svg>\n);\n\nexport const Loader: FunctionComponent<LoaderProps> = ({ isVisible, label, portalId }) => {\n const [{ status, isMounted }, toggle] = useTransitionState({\n timeout: { enter: 250, exit: 250 },\n mountOnEnter: true,\n unmountOnExit: true,\n preEnter: true,\n });\n\n useEffect(() => {\n toggle(isVisible);\n }, [isVisible, toggle]);\n\n const entering = status === 'preEnter' || status === 'entering';\n const exiting = status === 'exiting';\n\n return (\n <Backdrop isVisible={isVisible} target={portalId} sweep>\n {isMounted && (\n <div\n className={clsx('flex flex-col items-center transition-all duration-500', {\n '-translate-x-full opacity-0': entering,\n 'translate-x-full opacity-100': exiting,\n })}\n role=\"alert\"\n >\n <div\n className=\"relative isolate\"\n style={{\n maskImage: `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 2'%3E%3Cellipse cx='1' cy='1' rx='1' ry='1'/%3E%3C/svg%3E\")`,\n WebkitMaskImage: `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 2'%3E%3Cellipse cx='1' cy='1' rx='1' ry='1'/%3E%3C/svg%3E\")`,\n }}\n >\n {loaderSVG}\n </div>\n <div\n className={clsx(\n 'mx-auto max-w-[320px] px-20 text-center text-b3 transition-all delay-100 duration-400',\n {\n '-translate-x-full opacity-0': entering,\n 'translate-x-full opacity-100': exiting,\n },\n )}\n >\n {label}\n </div>\n </div>\n )}\n </Backdrop>\n );\n};\n"],"mappings":";;;;;;AAcA,IAAM,IACJ,kBAAC,OAAD;CAAK,SAAQ;CAAc,OAAO;WAAlC,CACE,kBAAC,QAAD,EAAA,UACE,kBAAC,QAAD;EACE,IAAG;EACH,GAAE;EACF,CAAA,EACG,CAAA,EACP,kBAAC,KAAD;EAAG,MAAK;EAAO,UAAS;EAAU,WAAU;YAA5C,CACE,kBAAC,QAAD;GAAM,IAAG;GAAI,MAAK;aAChB,kBAAC,OAAD,EAAK,WAAU,MAAO,CAAA;GACjB,CAAA,EACP,kBAAC,KAAD;GAAG,MAAK;aAAR,CACE,kBAAC,QAAD;IACE,MAAK;IACL,UAAS;IACT,GAAE;IACF,WAAU;IACV,CAAA,EACF,kBAAC,QAAD;IACE,MAAK;IACL,UAAS;IACT,GAAE;IACF,MAAK;IACL,CAAA,CAAA;;;IAMG,KAA0C,EAAE,cAAW,UAAO,kBAAe;CACxF,IAAM,CAAC,EAAE,WAAQ,gBAAa,KAAU,EAAmB;EACzD,SAAS;GAAE,OAAO;GAAK,MAAM;GAAK;EAClC,cAAc;EACd,eAAe;EACf,UAAU;EACX,CAAC;AAEF,SAAgB;AACd,IAAO,EAAU;IAChB,CAAC,GAAW,EAAO,CAAC;CAEvB,IAAM,IAAW,MAAW,cAAc,MAAW,YAC/C,IAAU,MAAW;AAE3B,QACE,kBAAC,GAAD;EAAqB;EAAW,QAAQ;EAAU,OAAA;YAC/C,KACC,kBAAC,OAAD;GACE,WAAW,EAAK,0DAA0D;IACxE,+BAA+B;IAC/B,gCAAgC;IACjC,CAAC;GACF,MAAK;aALP,CAOE,kBAAC,OAAD;IACE,WAAU;IACV,OAAO;KACL,WAAW;KACX,iBAAiB;KAClB;cAEA;IACG,CAAA,EACN,kBAAC,OAAD;IACE,WAAW,EACT,yFACA;KACE,+BAA+B;KAC/B,gCAAgC;KACjC,CACF;cAEA;IACG,CAAA,CAAA;;EAGD,CAAA"}
package/ui/Popin.js CHANGED
@@ -20,8 +20,8 @@ var c = ({ closeLabel: e, onClose: n }) => /* @__PURE__ */ o(t, {
20
20
  onClose: d,
21
21
  children: /* @__PURE__ */ o("div", {
22
22
  className: r(e("border-lightGrey rounded-16 pointer-events-auto mx-20 w-full border bg-white origin-center will-change[transform,opacity]", {
23
- "animate-zoomIn": f,
24
- "animate-zoomOut": !f && b,
23
+ "animate-zoom-in": f,
24
+ "animate-zoom-out": !f && b,
25
25
  "opacity-0 scale-90": !f && !b
26
26
  }), p),
27
27
  children: /* @__PURE__ */ s("div", {
package/ui/Popin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Popin.js","names":[],"sources":["../../lib/ui/Popin.tsx"],"sourcesContent":["import type { FunctionComponent, PropsWithChildren, ReactNode } from 'react';\nimport { useRef } from 'react';\nimport { twMerge } from './helpers/twMerge';\nimport { Backdrop, type BackdropProps } from './Backdrop';\nimport { Button } from './buttons/Button';\nimport clsx from 'clsx';\nimport { useSlots } from './hooks/useSlots';\n\nexport type ClosePopinCallback = () => void;\n\nexport interface PopinFooterProps {\n closeLabel?: string;\n onClose: ClosePopinCallback;\n}\n\nconst PopinFooter = ({ closeLabel, onClose }: PopinFooterProps) => {\n return (\n <Button\n color=\"black\"\n variant=\"circle\"\n icon=\"CrossDefault\"\n className=\"mx-auto\"\n aria-label={closeLabel}\n onClick={onClose}\n />\n );\n};\n\nexport interface PopinProps {\n title?: ReactNode;\n closeLabel?: string;\n onClose: ClosePopinCallback;\n isVisible: boolean;\n className?: string;\n bodyClassName?: string;\n showCloseButton?: boolean;\n target?: BackdropProps['target'];\n /**\n * @deprecated use popinFooter slot instead\n */\n Footer?: FunctionComponent<PopinFooterProps> | false;\n}\n\nexport const Popin: FunctionComponent<PropsWithChildren<PopinProps>> = ({\n title,\n children,\n closeLabel,\n onClose,\n isVisible,\n className = 'sm:w-360',\n bodyClassName,\n Footer = PopinFooter,\n}) => {\n const { children: popinBody, popinFooter } = useSlots(children, ['popinFooter']);\n\n // Prevent initial mount flash when closed: only animate leave if it was visible before\n const wasVisibleRef = useRef(isVisible);\n const wasVisible = wasVisibleRef.current;\n const isLeaving = !isVisible && wasVisible;\n\n // update ref for next render\n wasVisibleRef.current = isVisible;\n return (\n <Backdrop isVisible={isVisible} onClose={onClose}>\n <div\n className={twMerge(\n clsx(\n 'border-lightGrey rounded-16 pointer-events-auto mx-20 w-full border bg-white origin-center will-change[transform,opacity]',\n {\n 'animate-zoomIn': isVisible,\n 'animate-zoomOut': !isVisible && isLeaving,\n 'opacity-0 scale-90': !isVisible && !isLeaving,\n },\n ),\n className,\n )}\n >\n <div\n className={twMerge('text-center max-h-[90vh] flex flex-col p-40 gap-40', bodyClassName)}\n >\n {title && <div className=\"text-h5 mt-0 -mb-20 text-start font-serif\">{title}</div>}\n <div className=\"text-start overflow-auto\">{popinBody}</div>\n {!popinFooter?.length && Footer && (\n <div>\n <Footer closeLabel={closeLabel} onClose={onClose} />\n </div>\n )}\n\n {popinFooter}\n </div>\n </div>\n </Backdrop>\n );\n};\n"],"mappings":";;;;;;;;AAeA,IAAM,KAAe,EAAE,eAAY,iBAE/B,kBAAC,GAAD;CACE,OAAM;CACN,SAAQ;CACR,MAAK;CACL,WAAU;CACV,cAAY;CACZ,SAAS;CACT,CAAA,EAmBO,KAA2D,EACtE,UACA,aACA,eACA,YACA,cACA,eAAY,YACZ,kBACA,YAAS,QACL;CACJ,IAAM,EAAE,UAAU,GAAW,mBAAgB,EAAS,GAAU,CAAC,cAAc,CAAC,EAG1E,IAAgB,EAAO,EAAU,EACjC,IAAa,EAAc,SAC3B,IAAY,CAAC,KAAa;AAIhC,QADA,EAAc,UAAU,GAEtB,kBAAC,GAAD;EAAqB;EAAoB;YACvC,kBAAC,OAAD;GACE,WAAW,EACT,EACE,6HACA;IACE,kBAAkB;IAClB,mBAAmB,CAAC,KAAa;IACjC,sBAAsB,CAAC,KAAa,CAAC;IACtC,CACF,EACD,EACD;aAED,kBAAC,OAAD;IACE,WAAW,EAAQ,sDAAsD,EAAc;cADzF;KAGG,KAAS,kBAAC,OAAD;MAAK,WAAU;gBAA6C;MAAY,CAAA;KAClF,kBAAC,OAAD;MAAK,WAAU;gBAA4B;MAAgB,CAAA;KAC1D,CAAC,GAAa,UAAU,KACvB,kBAAC,OAAD,EAAA,UACE,kBAAC,GAAD;MAAoB;MAAqB;MAAW,CAAA,EAChD,CAAA;KAGP;KACG;;GACF,CAAA;EACG,CAAA"}
1
+ {"version":3,"file":"Popin.js","names":[],"sources":["../../lib/ui/Popin.tsx"],"sourcesContent":["import type { FunctionComponent, PropsWithChildren, ReactNode } from 'react';\nimport { useRef } from 'react';\nimport { twMerge } from './helpers/twMerge';\nimport { Backdrop, type BackdropProps } from './Backdrop';\nimport { Button } from './buttons/Button';\nimport clsx from 'clsx';\nimport { useSlots } from './hooks/useSlots';\n\nexport type ClosePopinCallback = () => void;\n\nexport interface PopinFooterProps {\n closeLabel?: string;\n onClose: ClosePopinCallback;\n}\n\nconst PopinFooter = ({ closeLabel, onClose }: PopinFooterProps) => {\n return (\n <Button\n color=\"black\"\n variant=\"circle\"\n icon=\"CrossDefault\"\n className=\"mx-auto\"\n aria-label={closeLabel}\n onClick={onClose}\n />\n );\n};\n\nexport interface PopinProps {\n title?: ReactNode;\n closeLabel?: string;\n onClose: ClosePopinCallback;\n isVisible: boolean;\n className?: string;\n bodyClassName?: string;\n showCloseButton?: boolean;\n target?: BackdropProps['target'];\n /**\n * @deprecated use popinFooter slot instead\n */\n Footer?: FunctionComponent<PopinFooterProps> | false;\n}\n\nexport const Popin: FunctionComponent<PropsWithChildren<PopinProps>> = ({\n title,\n children,\n closeLabel,\n onClose,\n isVisible,\n className = 'sm:w-360',\n bodyClassName,\n Footer = PopinFooter,\n}) => {\n const { children: popinBody, popinFooter } = useSlots(children, ['popinFooter']);\n\n // Prevent initial mount flash when closed: only animate leave if it was visible before\n const wasVisibleRef = useRef(isVisible);\n const wasVisible = wasVisibleRef.current;\n const isLeaving = !isVisible && wasVisible;\n\n // update ref for next render\n wasVisibleRef.current = isVisible;\n return (\n <Backdrop isVisible={isVisible} onClose={onClose}>\n <div\n className={twMerge(\n clsx(\n 'border-lightGrey rounded-16 pointer-events-auto mx-20 w-full border bg-white origin-center will-change[transform,opacity]',\n {\n 'animate-zoom-in': isVisible,\n 'animate-zoom-out': !isVisible && isLeaving,\n 'opacity-0 scale-90': !isVisible && !isLeaving,\n },\n ),\n className,\n )}\n >\n <div\n className={twMerge('text-center max-h-[90vh] flex flex-col p-40 gap-40', bodyClassName)}\n >\n {title && <div className=\"text-h5 mt-0 -mb-20 text-start font-serif\">{title}</div>}\n <div className=\"text-start overflow-auto\">{popinBody}</div>\n {!popinFooter?.length && Footer && (\n <div>\n <Footer closeLabel={closeLabel} onClose={onClose} />\n </div>\n )}\n\n {popinFooter}\n </div>\n </div>\n </Backdrop>\n );\n};\n"],"mappings":";;;;;;;;AAeA,IAAM,KAAe,EAAE,eAAY,iBAE/B,kBAAC,GAAD;CACE,OAAM;CACN,SAAQ;CACR,MAAK;CACL,WAAU;CACV,cAAY;CACZ,SAAS;CACT,CAAA,EAmBO,KAA2D,EACtE,UACA,aACA,eACA,YACA,cACA,eAAY,YACZ,kBACA,YAAS,QACL;CACJ,IAAM,EAAE,UAAU,GAAW,mBAAgB,EAAS,GAAU,CAAC,cAAc,CAAC,EAG1E,IAAgB,EAAO,EAAU,EACjC,IAAa,EAAc,SAC3B,IAAY,CAAC,KAAa;AAIhC,QADA,EAAc,UAAU,GAEtB,kBAAC,GAAD;EAAqB;EAAoB;YACvC,kBAAC,OAAD;GACE,WAAW,EACT,EACE,6HACA;IACE,mBAAmB;IACnB,oBAAoB,CAAC,KAAa;IAClC,sBAAsB,CAAC,KAAa,CAAC;IACtC,CACF,EACD,EACD;aAED,kBAAC,OAAD;IACE,WAAW,EAAQ,sDAAsD,EAAc;cADzF;KAGG,KAAS,kBAAC,OAAD;MAAK,WAAU;gBAA6C;MAAY,CAAA;KAClF,kBAAC,OAAD;MAAK,WAAU;gBAA4B;MAAgB,CAAA;KAC1D,CAAC,GAAa,UAAU,KACvB,kBAAC,OAAD,EAAA,UACE,kBAAC,GAAD;MAAoB;MAAqB;MAAW,CAAA,EAChD,CAAA;KAGP;KACG;;GACF,CAAA;EACG,CAAA"}
@@ -1,14 +1,16 @@
1
1
  import { IconicNames } from '@clubmed/trident-icons';
2
2
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
3
+ type SidebarSubItem = {
4
+ label: string;
5
+ href: string;
6
+ } & ComponentPropsWithoutRef<'a'>;
3
7
  type SidebarItem = {
4
8
  label: string;
5
9
  icon: IconicNames;
6
- url?: string;
7
- items?: {
8
- label: string;
9
- url: string;
10
- }[];
11
- };
10
+ items?: SidebarSubItem[];
11
+ } & ((ComponentPropsWithoutRef<'a'> & {
12
+ href: string;
13
+ }) | ComponentPropsWithoutRef<'button'>);
12
14
  interface SidebarItemProps {
13
15
  item: SidebarItem;
14
16
  isActive?: boolean;
@@ -24,6 +26,8 @@ export interface SidebarLayoutProps extends ComponentPropsWithoutRef<'div'> {
24
26
  items: SidebarItem[];
25
27
  children: ReactNode;
26
28
  activeIndex?: number;
29
+ isCollapsed?: boolean;
30
+ onCollapsedChange?: (isCollapsed: boolean) => void;
27
31
  }
28
- export declare const SidebarLayout: ({ items, children: initialChildren, className, activeIndex, ...attrs }: SidebarLayoutProps) => import("react/jsx-runtime").JSX.Element;
32
+ export declare const SidebarLayout: ({ items, children: initialChildren, className, activeIndex, isCollapsed: initialCollapsedValue, onCollapsedChange, ...attrs }: SidebarLayoutProps) => import("react/jsx-runtime").JSX.Element;
29
33
  export {};
@@ -6,15 +6,28 @@ import { useCallback as i, useRef as a, useState as o } from "react";
6
6
  import { Icon as s } from "@clubmed/trident-icons";
7
7
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  //#region lib/ui/SidebarLayout.tsx
9
- var u = ({ item: e, isActive: n = !1, isCollapsed: r = !1, anchorName: i, onItemClick: a }) => {
9
+ function u(e) {
10
+ if ("href" in e) {
11
+ let { children: t, icon: n, label: r, ...i } = e;
12
+ return /* @__PURE__ */ c("a", {
13
+ ...i,
14
+ className: "flex whitespace-nowrap items-center text-white hover:text-saffron transition-colors outline-none focus-visible:bg-white/20 rounded-pill relative group/sidebar-item",
15
+ children: t
16
+ });
17
+ }
18
+ let { children: t, icon: n, label: r, ...i } = e;
19
+ return /* @__PURE__ */ c("button", {
20
+ ...i,
21
+ className: "flex whitespace-nowrap items-center text-white outline-none rounded-pill relative group/sidebar-item",
22
+ children: t
23
+ });
24
+ }
25
+ var d = ({ item: e, isActive: n = !1, isCollapsed: r = !1, anchorName: i, onItemClick: a }) => {
10
26
  let o = e.items && e.items.length > 0;
11
27
  return /* @__PURE__ */ l("div", {
12
28
  className: "col-start-1 col-end-3",
13
- children: [/* @__PURE__ */ l(e.url ? "a" : "button", {
14
- ...e.url ? {
15
- href: e.url,
16
- className: "flex whitespace-nowrap items-center text-white hover:text-saffron transition-colors outline-none focus-visible:bg-white/20 rounded-pill relative group/sidebar-item"
17
- } : { className: "flex whitespace-nowrap items-center text-white outline-none rounded-pill relative group/sidebar-item" },
29
+ children: [/* @__PURE__ */ l(u, {
30
+ ...e,
18
31
  onClick: (e) => {
19
32
  o && a && (e.preventDefault(), a());
20
33
  },
@@ -49,14 +62,14 @@ var u = ({ item: e, isActive: n = !1, isCollapsed: r = !1, anchorName: i, onItem
49
62
  children: /* @__PURE__ */ c("div", {
50
63
  className: "outline-none relative overflow-hidden flex flex-col gap-8 ps-48 font-normal",
51
64
  children: e.items.map((e, t) => /* @__PURE__ */ c("a", {
52
- href: e.url,
65
+ href: e.href,
53
66
  className: "text-white hover:text-saffron transition-colors text-b4 whitespace-nowrap outline-none focus-visible:bg-white/20 ps-8 pe-16 rounded-pill",
54
67
  children: e.label
55
68
  }, t))
56
69
  })
57
70
  })]
58
71
  });
59
- }, d = ({ isCollapsed: e }) => /* @__PURE__ */ c("svg", {
72
+ }, f = ({ isCollapsed: e }) => /* @__PURE__ */ c("svg", {
60
73
  xmlns: "http://www.w3.org/2000/svg",
61
74
  width: "33",
62
75
  height: "48",
@@ -75,19 +88,27 @@ var u = ({ item: e, isActive: n = !1, isCollapsed: r = !1, anchorName: i, onItem
75
88
  })]
76
89
  })
77
90
  });
78
- function f() {
79
- let [e, t] = o(!0);
91
+ function p({ isCollapsed: e, onCollapsedChange: t }) {
92
+ let [n, r] = o(() => e ?? !0), s = a(null), c = i((e) => {
93
+ r((n) => {
94
+ let r = typeof e == "function" ? e(n) : e;
95
+ return r !== n && t?.(r), r;
96
+ });
97
+ }, [t]);
80
98
  return {
81
- isCollapsed: e,
82
- setIsCollapsed: t,
83
- overlayRef: a(null),
99
+ isCollapsed: n,
100
+ setIsCollapsed: c,
101
+ overlayRef: s,
84
102
  handleToggleCollapse: i(() => {
85
- t((e) => !e);
86
- }, [])
103
+ c((e) => !e);
104
+ }, [c])
87
105
  };
88
106
  }
89
- var p = ({ items: i, children: a, className: o, activeIndex: s = 0, ...p }) => {
90
- let { isCollapsed: m, setIsCollapsed: h, handleToggleCollapse: g } = f(), { "header-logo": _, header: v, "header-actions": y, children: b } = n(a, [
107
+ var m = ({ items: i, children: a, className: o, activeIndex: s = 0, isCollapsed: u, onCollapsedChange: m, ...h }) => {
108
+ let { isCollapsed: g, setIsCollapsed: _, handleToggleCollapse: v } = p({
109
+ isCollapsed: u,
110
+ onCollapsedChange: m
111
+ }), { "header-logo": y, header: b, "header-actions": x, children: S } = n(a, [
91
112
  "header-logo",
92
113
  "header",
93
114
  "header-actions"
@@ -95,50 +116,50 @@ var p = ({ items: i, children: a, className: o, activeIndex: s = 0, ...p }) => {
95
116
  return /* @__PURE__ */ l("div", {
96
117
  "data-name": "SidebarLayout",
97
118
  className: e("h-screen overflow-clip flex flex-col bg-ultramarine", o),
98
- ...p,
119
+ ...h,
99
120
  children: [/* @__PURE__ */ l("header", {
100
121
  className: "bg-ultramarine h-64 flex items-center justify-between gap-8 p-8 ps-20 md:px-24 text-white shrink-0",
101
122
  children: [
102
- _,
103
- v,
104
123
  y,
124
+ b,
125
+ x,
105
126
  /* @__PURE__ */ c("button", {
106
127
  className: "md:hidden w-48 h-48 focus-visible:ring-8 focus-visible:ring-lavender/20 rounded-full flex items-center justify-center text-white transition-opacity outline-none",
107
- "aria-label": m ? "Open the navigation menu" : "Close the navigation menu",
108
- onClick: g,
109
- children: /* @__PURE__ */ c(r, { isActive: !m })
128
+ "aria-label": g ? "Open the navigation menu" : "Close the navigation menu",
129
+ onClick: v,
130
+ children: /* @__PURE__ */ c(r, { isActive: !g })
110
131
  })
111
132
  ]
112
133
  }), /* @__PURE__ */ l("div", {
113
134
  className: "flex h-full overflow-x-clip overflow-y-hidden",
114
135
  children: [/* @__PURE__ */ l("aside", {
115
- className: t("max-md:absolute max-md:top-64 max-md:h-[calc(100dvh-64px)] max-md:w-screen flex bg-ultramarine px-8 md:py-16 md:ps-28 md:pe-16 text-white flex-col gap-24 transition-all duration-300 ease-in-out relative h-full shrink-0", m ? "max-md:-translate-x-full" : "md:pe-24"),
136
+ className: t("z-10 max-md:absolute max-md:top-64 max-md:h-[calc(100dvh-64px)] max-md:w-screen flex bg-ultramarine px-8 md:py-16 md:ps-28 md:pe-16 text-white flex-col gap-24 transition-all duration-300 ease-in-out relative h-full shrink-0", g ? "max-md:-translate-x-full" : "md:pe-24"),
116
137
  children: [/* @__PURE__ */ c("button", {
117
138
  className: "hidden md:block absolute transition-top duration-300 ease-in-out rounded-pill outline-none focus-visible:ring-8 focus-visible:ring-lavender/20 [--indicatorYPos:anchor(top)] top-[max(var(--indicatorYPos,24px),24px)] left-[max(calc(100%_-_10px),86px)]",
118
- onClick: g,
119
- "aria-label": m ? "Expand sidebar" : "Collapse sidebar",
139
+ onClick: v,
140
+ "aria-label": g ? "Expand sidebar" : "Collapse sidebar",
120
141
  style: { positionAnchor: `--sidebar-item-${s}` },
121
- children: /* @__PURE__ */ c(d, { isCollapsed: m })
142
+ children: /* @__PURE__ */ c(f, { isCollapsed: g })
122
143
  }), /* @__PURE__ */ c("nav", {
123
- className: t("max-md:divide-y-1 p-8 max-md:h-full max-md:overflow-auto md:gap-y-20 grid overflow-hidden text-b3 font-semibold relative transition-grid-template-columns duration-300 ease-in-out", m ? "grid-cols-[48px_0fr]" : "grid-cols-[48px_1fr]"),
124
- children: i.map((e, t) => /* @__PURE__ */ c(u, {
144
+ className: t("max-md:divide-y-1 p-8 max-md:h-full max-md:overflow-auto md:gap-y-20 grid overflow-hidden text-b3 font-semibold relative transition-grid-template-columns duration-300 ease-in-out", g ? "grid-cols-[48px_0fr]" : "grid-cols-[48px_1fr]"),
145
+ children: i.map((e, t) => /* @__PURE__ */ c(d, {
125
146
  item: e,
126
147
  isActive: t === s,
127
- isCollapsed: m,
148
+ isCollapsed: g,
128
149
  anchorName: `sidebar-item-${t}`,
129
150
  onItemClick: () => {
130
- e.items && e.items.length > 0 && h((e) => e && !1);
151
+ e.items && e.items.length > 0 && _((e) => e && !1);
131
152
  }
132
153
  }, t))
133
154
  })]
134
155
  }), /* @__PURE__ */ c("main", {
135
- className: "min-w-full md:min-w-0 md:w-[calc(100%-96px)] bg-white p-24 overflow-auto md:rounded-ss-16 h-full shrink-0",
136
- children: b
156
+ className: "w-full md:min-w-0 md:w-[calc(100%-108px)] bg-white p-24 overflow-auto md:rounded-ss-16 h-full shrink-0",
157
+ children: S
137
158
  })]
138
159
  })]
139
160
  });
140
161
  };
141
162
  //#endregion
142
- export { d as CollapseIndicatorSVG, p as SidebarLayout };
163
+ export { f as CollapseIndicatorSVG, m as SidebarLayout };
143
164
 
144
165
  //# sourceMappingURL=SidebarLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarLayout.js","names":[],"sources":["../../lib/ui/SidebarLayout.tsx"],"sourcesContent":["import { Icon, type IconicNames } from '@clubmed/trident-icons';\nimport clsx from 'clsx';\nimport {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type ReactNode,\n useCallback,\n useRef,\n useState,\n} from 'react';\nimport { twMerge } from 'tailwind-merge';\nimport { HamburgerIcon } from './HamburgerIcon';\nimport { useSlots } from '@/ui/hooks/useSlots';\n\ntype SidebarItem = {\n label: string;\n icon: IconicNames;\n url?: string;\n items?: {\n label: string;\n url: string;\n }[];\n};\n\ninterface SidebarItemProps {\n item: SidebarItem;\n isActive?: boolean;\n isCollapsed?: boolean;\n anchorName: string;\n onItemClick?: () => void;\n}\n\nconst SidebarItem = ({\n item,\n isActive = false,\n isCollapsed = false,\n anchorName,\n onItemClick,\n}: SidebarItemProps) => {\n const hasSubItems = item.items && item.items.length > 0;\n\n const Comp = item.url ? 'a' : 'button';\n\n const componentProps = item.url\n ? {\n href: item.url,\n className:\n 'flex whitespace-nowrap items-center text-white hover:text-saffron transition-colors outline-none focus-visible:bg-white/20 rounded-pill relative group/sidebar-item',\n }\n : {\n className:\n 'flex whitespace-nowrap items-center text-white outline-none rounded-pill relative group/sidebar-item',\n };\n\n return (\n <div className=\"col-start-1 col-end-3\">\n <Comp\n {...componentProps}\n onClick={(e) => {\n if (hasSubItems && onItemClick) {\n e.preventDefault();\n onItemClick();\n }\n }}\n style={{ anchorName: `--${anchorName}` } as React.CSSProperties}\n >\n <div className=\"relative\">\n <div\n className={twMerge('aspect-square w-48 rounded-full flex items-center justify-center')}\n >\n <Icon name={item.icon} className=\"w-24 text-white\" />\n </div>\n <div className=\"absolute inset-0 pointer-events-none\" aria-hidden=\"true\" inert>\n <div\n className={twMerge(\n 'max-md:hidden aspect-square w-48 rounded-full flex items-center justify-center bg-lightSand text-black',\n '[clip-path:circle(var(--sidebarItem_clipCircle))] transition-all duration-200 delay-100 ease-in-out group-focus-visible/sidebar-item:ring-8 group-focus-visible/sidebar-item:ring-lavender/20',\n isActive ? '[--sidebarItem_clipCircle:100%]' : '[--sidebarItem_clipCircle:0%]',\n 'group-hover/sidebar-item:[--sidebarItem_clipCircle:100%] group-focus-within/sidebar-item:[--sidebarItem_clipCircle:100%]',\n !isActive &&\n 'group-hover/sidebar-item:bg-lightSand/80 group-focus-within/sidebar-item:bg-lightSand/80',\n )}\n >\n <Icon name={item.icon} className=\"w-24\" />\n </div>\n </div>\n </div>\n <span\n className={twMerge(\n 'transition-all duration-300 ease-in-out whitespace-nowrap ps-8 pe-12 truncate md:max-w-240',\n isCollapsed ? 'opacity-0' : 'opacity-100',\n )}\n >\n {item.label}\n </span>\n </Comp>\n {hasSubItems && (\n <div\n className={twMerge(\n 'grid transition-[grid-template-rows,opacity] duration-300 ease-in-out overflow-hidden max-md:grid-rows-[1fr] max-md:opacity-100',\n isCollapsed ? 'grid-rows-[0fr] opacity-0' : 'grid-rows-[1fr] opacity-100 pb-12',\n )}\n inert={isCollapsed}\n >\n <div className=\"outline-none relative overflow-hidden flex flex-col gap-8 ps-48 font-normal\">\n {item.items!.map((subItem, subIndex) => (\n <a\n key={subIndex}\n href={subItem.url}\n className=\"text-white hover:text-saffron transition-colors text-b4 whitespace-nowrap outline-none focus-visible:bg-white/20 ps-8 pe-16 rounded-pill\"\n >\n {subItem.label}\n </a>\n ))}\n </div>\n </div>\n )}\n </div>\n );\n};\n\nexport const CollapseIndicatorSVG = ({ isCollapsed }: { isCollapsed: boolean }) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"33\" height=\"48\">\n <g fill=\"none\" fillRule=\"nonzero\">\n <path\n fill=\"#FFF\"\n d=\"M10.008 48v-1.829c0-4.116-1.722-8.045-4.75-10.835-6.331-5.837-6.331-15.835 0-21.672a14.736 14.736 0 0 0 4.75-10.835V0h27.417v48H10.008Z\"\n />\n <g\n className={twMerge(\n 'transition-transform duration-500 ease-in-out origin-center [transform-box:fill-box]',\n isCollapsed ? 'rotate-180' : 'rotate-0',\n )}\n >\n <path\n fill=\"#1E2643\"\n d=\"M19.686 12.547c6.617 0 12 5.383 12 12s-5.383 12-12 12-12-5.383-12-12 5.383-12 12-12Zm0 1.986c-5.522 0-10.015 4.492-10.015 10.014 0 5.523 4.493 10.015 10.016 10.015 5.52 0 10.012-4.492 10.012-10.015 0-5.522-4.492-10.014-10.012-10.014Zm-2.097 4.382c.376-.366 1.032-.366 1.409 0l5.037 4.895a.948.948 0 0 1 0 1.37l-5.037 4.894a1.002 1.002 0 0 1-.705.285 1 1 0 0 1-.704-.285.947.947 0 0 1 0-1.369l4.332-4.21-4.332-4.21a.95.95 0 0 1 0-1.37Z\"\n />\n </g>\n </g>\n </svg>\n);\n\nexport interface SidebarLayoutProps extends ComponentPropsWithoutRef<'div'> {\n items: SidebarItem[];\n children: ReactNode;\n activeIndex?: number;\n}\n\nfunction useSidebarLayout() {\n const [isCollapsed, setIsCollapsed] = useState(true);\n const overlayRef = useRef<HTMLDivElement>(null);\n\n const handleToggleCollapse = useCallback(() => {\n setIsCollapsed((prev) => !prev);\n }, []);\n\n return {\n isCollapsed,\n setIsCollapsed,\n overlayRef,\n handleToggleCollapse,\n };\n}\n\nexport const SidebarLayout = ({\n items,\n children: initialChildren,\n className,\n activeIndex = 0,\n ...attrs\n}: SidebarLayoutProps) => {\n const { isCollapsed, setIsCollapsed, handleToggleCollapse } = useSidebarLayout();\n const {\n 'header-logo': headerLogo,\n header,\n ['header-actions']: headerActions,\n children,\n } = useSlots(initialChildren, ['header-logo', 'header', 'header-actions']);\n\n return (\n <div\n data-name=\"SidebarLayout\"\n className={clsx('h-screen overflow-clip flex flex-col bg-ultramarine', className)}\n {...attrs}\n >\n {/* Header */}\n <header className=\"bg-ultramarine h-64 flex items-center justify-between gap-8 p-8 ps-20 md:px-24 text-white shrink-0\">\n {headerLogo}\n {header}\n {headerActions}\n <button\n className=\"md:hidden w-48 h-48 focus-visible:ring-8 focus-visible:ring-lavender/20 rounded-full flex items-center justify-center text-white transition-opacity outline-none\"\n aria-label={isCollapsed ? 'Open the navigation menu' : 'Close the navigation menu'}\n onClick={handleToggleCollapse}\n >\n <HamburgerIcon isActive={!isCollapsed} />\n </button>\n </header>\n\n {/* Main container with sidebar and content */}\n <div className=\"flex h-full overflow-x-clip overflow-y-hidden\">\n {/* Sidebar */}\n <aside\n className={twMerge(\n 'max-md:absolute max-md:top-64 max-md:h-[calc(100dvh-64px)] max-md:w-screen flex bg-ultramarine px-8 md:py-16 md:ps-28 md:pe-16 text-white flex-col gap-24 transition-all duration-300 ease-in-out relative h-full shrink-0',\n isCollapsed ? 'max-md:-translate-x-full' : 'md:pe-24',\n )}\n >\n {/* Indicator */}\n <button\n className=\"hidden md:block absolute transition-top duration-300 ease-in-out rounded-pill outline-none focus-visible:ring-8 focus-visible:ring-lavender/20 [--indicatorYPos:anchor(top)] top-[max(var(--indicatorYPos,24px),24px)] left-[max(calc(100%_-_10px),86px)]\"\n onClick={handleToggleCollapse}\n aria-label={isCollapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n style={\n {\n positionAnchor: `--sidebar-item-${activeIndex}`,\n } as CSSProperties\n }\n >\n <CollapseIndicatorSVG isCollapsed={isCollapsed} />\n </button>\n\n <nav\n className={twMerge(\n 'max-md:divide-y-1 p-8 max-md:h-full max-md:overflow-auto md:gap-y-20 grid overflow-hidden text-b3 font-semibold relative transition-grid-template-columns duration-300 ease-in-out',\n isCollapsed ? 'grid-cols-[48px_0fr]' : 'grid-cols-[48px_1fr]',\n )}\n >\n {items.map((item, index) => (\n <SidebarItem\n key={index}\n item={item}\n isActive={index === activeIndex}\n isCollapsed={isCollapsed}\n anchorName={`sidebar-item-${index}`}\n onItemClick={() => {\n if (item.items && item.items.length > 0) {\n setIsCollapsed((prev) => (prev ? false : prev));\n }\n }}\n />\n ))}\n </nav>\n </aside>\n\n <main className=\"min-w-full md:min-w-0 md:w-[calc(100%-96px)] bg-white p-24 overflow-auto md:rounded-ss-16 h-full shrink-0\">\n {children}\n </main>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAgCA,IAAM,KAAe,EACnB,SACA,cAAW,IACX,iBAAc,IACd,eACA,qBACsB;CACtB,IAAM,IAAc,EAAK,SAAS,EAAK,MAAM,SAAS;AAetD,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAfS,EAAK,MAAM,MAAM,UAe1B;GACE,GAdiB,EAAK,MACxB;IACE,MAAM,EAAK;IACX,WACE;IACH,GACD,EACE,WACE,wGACH;GAMC,UAAU,MAAM;AACd,IAAI,KAAe,MACjB,EAAE,gBAAgB,EAClB,GAAa;;GAGjB,OAAO,EAAE,YAAY,KAAK,KAAc;aAR1C,CAUE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KACE,WAAW,EAAQ,mEAAmE;eAEtF,kBAAC,GAAD;MAAM,MAAM,EAAK;MAAM,WAAU;MAAoB,CAAA;KACjD,CAAA,EACN,kBAAC,OAAD;KAAK,WAAU;KAAuC,eAAY;KAAO,OAAA;eACvE,kBAAC,OAAD;MACE,WAAW,EACT,0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ACE,aAAU;EACV,WAAW,EAAK,uDAAuD,EAAU;EACjF,GAAI;YAHN,CAME,kBAAC,UAAD;GAAQ,WAAU;aAAlB;IACG;IACA;IACA;IACD,kBAAC,UAAD;KACE,WAAU;KACV,cAAY,IAAc,6BAA6B;KACvD,SAAS;eAET,kBAAC,GAAD,EAAe,UAAU,CAAC,GAAe,CAAA;KAClC,CAAA;IACF;MAGT,kBAAC,OAAD;GAAK,WAAU;aAAf,CAEE,kBAAC,SAAD;IACE,WAAW,EACT,8NACA,IAAc,6BAA6B,WAC5C;cAJH,CAOE,kBAAC,UAAD;KACE,WAAU;KACV,SAAS;KACT,cAAY,IAAc,mBAAmB;KAC7C,OACE,EACE,gBAAgB,kBAAkB,KACnC;eAGH,kBAAC,GAAD,EAAmC,gBAAe,CAAA;KAC3C,CAAA,EAET,kBAAC,OAAD;KACE,WAAW,EACT,sLACA,IAAc,yBAAyB,uBACxC;eAEA,EAAM,KAAK,GAAM,MAChB,kBAAC,GAAD;MAEQ;MACN,UAAU,MAAU;MACP;MACb,YAAY,gBAAgB;MAC5B,mBAAmB;AACjB,OAAI,EAAK,SAAS,EAAK,MAAM,SAAS,KACpC,GAAgB,MAAU,KAAO,GAAc;;MAGnD,EAVK,EAUL,CACF;KACE,CAAA,CACA;OAER,kBAAC,QAAD;IAAM,WAAU;IACb;IACI,CAAA,CACH;KACF"}
1
+ {"version":3,"file":"SidebarLayout.js","names":[],"sources":["../../lib/ui/SidebarLayout.tsx"],"sourcesContent":["import { Icon, type IconicNames } from '@clubmed/trident-icons';\nimport clsx from 'clsx';\nimport {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type Dispatch,\n type PropsWithChildren,\n type ReactNode,\n type SetStateAction,\n type MouseEvent,\n useCallback,\n useRef,\n useState,\n} from 'react';\nimport { twMerge } from 'tailwind-merge';\nimport { HamburgerIcon } from './HamburgerIcon';\nimport { useSlots } from '@/ui/hooks/useSlots';\n\ntype SidebarSubItem = {\n label: string;\n href: string;\n} & ComponentPropsWithoutRef<'a'>;\n\ntype SidebarItem = {\n label: string;\n icon: IconicNames;\n items?: SidebarSubItem[];\n} & ((ComponentPropsWithoutRef<'a'> & { href: string }) | ComponentPropsWithoutRef<'button'>);\n\ninterface SidebarItemProps {\n item: SidebarItem;\n isActive?: boolean;\n isCollapsed?: boolean;\n anchorName: string;\n onItemClick?: () => void;\n}\n\nfunction Cta(item: PropsWithChildren<SidebarItem>) {\n if ('href' in item) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { children, icon, label, ...attrs } = item;\n\n return (\n <a\n {...attrs}\n className=\"flex whitespace-nowrap items-center text-white hover:text-saffron transition-colors outline-none focus-visible:bg-white/20 rounded-pill relative group/sidebar-item\"\n >\n {children}\n </a>\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { children, icon, label, ...attrs } = item;\n\n return (\n <button\n {...attrs}\n className=\"flex whitespace-nowrap items-center text-white outline-none rounded-pill relative group/sidebar-item\"\n >\n {children}\n </button>\n );\n}\n\nconst SidebarItem = ({\n item,\n isActive = false,\n isCollapsed = false,\n anchorName,\n onItemClick,\n}: SidebarItemProps) => {\n const hasSubItems = item.items && item.items.length > 0;\n\n return (\n <div className=\"col-start-1 col-end-3\">\n <Cta\n {...item}\n onClick={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n if (hasSubItems && onItemClick) {\n e.preventDefault();\n onItemClick();\n }\n }}\n style={{ anchorName: `--${anchorName}` } as CSSProperties}\n >\n <div className=\"relative\">\n <div\n className={twMerge('aspect-square w-48 rounded-full flex items-center justify-center')}\n >\n <Icon name={item.icon} className=\"w-24 text-white\" />\n </div>\n <div className=\"absolute inset-0 pointer-events-none\" aria-hidden=\"true\" inert>\n <div\n className={twMerge(\n 'max-md:hidden aspect-square w-48 rounded-full flex items-center justify-center bg-lightSand text-black',\n '[clip-path:circle(var(--sidebarItem_clipCircle))] transition-all duration-200 delay-100 ease-in-out group-focus-visible/sidebar-item:ring-8 group-focus-visible/sidebar-item:ring-lavender/20',\n isActive ? '[--sidebarItem_clipCircle:100%]' : '[--sidebarItem_clipCircle:0%]',\n 'group-hover/sidebar-item:[--sidebarItem_clipCircle:100%] group-focus-within/sidebar-item:[--sidebarItem_clipCircle:100%]',\n !isActive &&\n 'group-hover/sidebar-item:bg-lightSand/80 group-focus-within/sidebar-item:bg-lightSand/80',\n )}\n >\n <Icon name={item.icon} className=\"w-24\" />\n </div>\n </div>\n </div>\n <span\n className={twMerge(\n 'transition-all duration-300 ease-in-out whitespace-nowrap ps-8 pe-12 truncate md:max-w-240',\n isCollapsed ? 'opacity-0' : 'opacity-100',\n )}\n >\n {item.label}\n </span>\n </Cta>\n {hasSubItems && (\n <div\n className={twMerge(\n 'grid transition-[grid-template-rows,opacity] duration-300 ease-in-out overflow-hidden max-md:grid-rows-[1fr] max-md:opacity-100',\n isCollapsed ? 'grid-rows-[0fr] opacity-0' : 'grid-rows-[1fr] opacity-100 pb-12',\n )}\n inert={isCollapsed}\n >\n <div className=\"outline-none relative overflow-hidden flex flex-col gap-8 ps-48 font-normal\">\n {item.items!.map((subItem, subIndex) => (\n <a\n key={subIndex}\n href={subItem.href}\n className=\"text-white hover:text-saffron transition-colors text-b4 whitespace-nowrap outline-none focus-visible:bg-white/20 ps-8 pe-16 rounded-pill\"\n >\n {subItem.label}\n </a>\n ))}\n </div>\n </div>\n )}\n </div>\n );\n};\n\nexport const CollapseIndicatorSVG = ({ isCollapsed }: { isCollapsed: boolean }) => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"33\" height=\"48\">\n <g fill=\"none\" fillRule=\"nonzero\">\n <path\n fill=\"#FFF\"\n d=\"M10.008 48v-1.829c0-4.116-1.722-8.045-4.75-10.835-6.331-5.837-6.331-15.835 0-21.672a14.736 14.736 0 0 0 4.75-10.835V0h27.417v48H10.008Z\"\n />\n <g\n className={twMerge(\n 'transition-transform duration-500 ease-in-out origin-center [transform-box:fill-box]',\n isCollapsed ? 'rotate-180' : 'rotate-0',\n )}\n >\n <path\n fill=\"#1E2643\"\n d=\"M19.686 12.547c6.617 0 12 5.383 12 12s-5.383 12-12 12-12-5.383-12-12 5.383-12 12-12Zm0 1.986c-5.522 0-10.015 4.492-10.015 10.014 0 5.523 4.493 10.015 10.016 10.015 5.52 0 10.012-4.492 10.012-10.015 0-5.522-4.492-10.014-10.012-10.014Zm-2.097 4.382c.376-.366 1.032-.366 1.409 0l5.037 4.895a.948.948 0 0 1 0 1.37l-5.037 4.894a1.002 1.002 0 0 1-.705.285 1 1 0 0 1-.704-.285.947.947 0 0 1 0-1.369l4.332-4.21-4.332-4.21a.95.95 0 0 1 0-1.37Z\"\n />\n </g>\n </g>\n </svg>\n);\n\nexport interface SidebarLayoutProps extends ComponentPropsWithoutRef<'div'> {\n items: SidebarItem[];\n children: ReactNode;\n activeIndex?: number;\n isCollapsed?: boolean;\n onCollapsedChange?: (isCollapsed: boolean) => void;\n}\n\nfunction useSidebarLayout({\n isCollapsed: initialCollapsedValue,\n onCollapsedChange,\n}: {\n isCollapsed?: boolean;\n onCollapsedChange?: (isCollapsed: boolean) => void;\n}) {\n const [isCollapsed, setIsCollapsedState] = useState(() => initialCollapsedValue ?? true);\n const overlayRef = useRef<HTMLDivElement>(null);\n\n const setIsCollapsed = useCallback<Dispatch<SetStateAction<boolean>>>(\n (value) => {\n setIsCollapsedState((previousState) => {\n const nextState = typeof value === 'function' ? value(previousState) : value;\n if (nextState !== previousState) {\n onCollapsedChange?.(nextState);\n }\n return nextState;\n });\n },\n [onCollapsedChange],\n );\n\n const handleToggleCollapse = useCallback(() => {\n setIsCollapsed((prev) => !prev);\n }, [setIsCollapsed]);\n\n return {\n isCollapsed,\n setIsCollapsed,\n overlayRef,\n handleToggleCollapse,\n };\n}\n\nexport const SidebarLayout = ({\n items,\n children: initialChildren,\n className,\n activeIndex = 0,\n isCollapsed: initialCollapsedValue,\n onCollapsedChange,\n ...attrs\n}: SidebarLayoutProps) => {\n const { isCollapsed, setIsCollapsed, handleToggleCollapse } = useSidebarLayout({\n isCollapsed: initialCollapsedValue,\n onCollapsedChange,\n });\n const {\n 'header-logo': headerLogo,\n header,\n ['header-actions']: headerActions,\n children,\n } = useSlots(initialChildren, ['header-logo', 'header', 'header-actions']);\n\n return (\n <div\n data-name=\"SidebarLayout\"\n className={clsx('h-screen overflow-clip flex flex-col bg-ultramarine', className)}\n {...attrs}\n >\n {/* Header */}\n <header className=\"bg-ultramarine h-64 flex items-center justify-between gap-8 p-8 ps-20 md:px-24 text-white shrink-0\">\n {headerLogo}\n {header}\n {headerActions}\n <button\n className=\"md:hidden w-48 h-48 focus-visible:ring-8 focus-visible:ring-lavender/20 rounded-full flex items-center justify-center text-white transition-opacity outline-none\"\n aria-label={isCollapsed ? 'Open the navigation menu' : 'Close the navigation menu'}\n onClick={handleToggleCollapse}\n >\n <HamburgerIcon isActive={!isCollapsed} />\n </button>\n </header>\n\n {/* Main container with sidebar and content */}\n <div className=\"flex h-full overflow-x-clip overflow-y-hidden\">\n {/* Sidebar */}\n <aside\n className={twMerge(\n 'z-10 max-md:absolute max-md:top-64 max-md:h-[calc(100dvh-64px)] max-md:w-screen flex bg-ultramarine px-8 md:py-16 md:ps-28 md:pe-16 text-white flex-col gap-24 transition-all duration-300 ease-in-out relative h-full shrink-0',\n isCollapsed ? 'max-md:-translate-x-full' : 'md:pe-24',\n )}\n >\n {/* Indicator */}\n <button\n className=\"hidden md:block absolute transition-top duration-300 ease-in-out rounded-pill outline-none focus-visible:ring-8 focus-visible:ring-lavender/20 [--indicatorYPos:anchor(top)] top-[max(var(--indicatorYPos,24px),24px)] left-[max(calc(100%_-_10px),86px)]\"\n onClick={handleToggleCollapse}\n aria-label={isCollapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n style={\n {\n positionAnchor: `--sidebar-item-${activeIndex}`,\n } as CSSProperties\n }\n >\n <CollapseIndicatorSVG isCollapsed={isCollapsed} />\n </button>\n\n <nav\n className={twMerge(\n 'max-md:divide-y-1 p-8 max-md:h-full max-md:overflow-auto md:gap-y-20 grid overflow-hidden text-b3 font-semibold relative transition-grid-template-columns duration-300 ease-in-out',\n isCollapsed ? 'grid-cols-[48px_0fr]' : 'grid-cols-[48px_1fr]',\n )}\n >\n {items.map((item, index) => (\n <SidebarItem\n key={index}\n item={item}\n isActive={index === activeIndex}\n isCollapsed={isCollapsed}\n anchorName={`sidebar-item-${index}`}\n onItemClick={() => {\n if (item.items && item.items.length > 0) {\n setIsCollapsed((prev) => (prev ? false : prev));\n }\n }}\n />\n ))}\n </nav>\n </aside>\n\n <main className=\"w-full md:min-w-0 md:w-[calc(100%-108px)] bg-white p-24 overflow-auto md:rounded-ss-16 h-full shrink-0\">\n {children}\n </main>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAqCA,SAAS,EAAI,GAAsC;AACjD,KAAI,UAAU,GAAM;EAElB,IAAM,EAAE,aAAU,SAAM,UAAO,GAAG,MAAU;AAE5C,SACE,kBAAC,KAAD;GACE,GAAI;GACJ,WAAU;GAET;GACC,CAAA;;CAKR,IAAM,EAAE,aAAU,SAAM,UAAO,GAAG,MAAU;AAE5C,QACE,kBAAC,UAAD;EACE,GAAI;EACJ,WAAU;EAET;EACM,CAAA;;AAIb,IAAM,KAAe,EACnB,SACA,cAAW,IACX,iBAAc,IACd,eACA,qBACsB;CACtB,IAAM,IAAc,EAAK,SAAS,EAAK,MAAM,SAAS;AAEtD,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,GAAD;GACE,GAAI;GACJ,UAAU,MAAyD;AACjE,IAAI,KAAe,MACjB,EAAE,gBAAgB,EAClB,GAAa;;GAGjB,OAAO,EAAE,YAAY,KAAK,KAAc;aAR1C,CAUE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KACE,WAAW,EAAQ,mEAAmE;eAEtF,kBAAC,GAAD;MAAM,MAAM,EAAK;MAAM,WAAU;MAAoB,CAAA;KACjD,CAAA,EACN,kBAAC,OAAD;KAAK,W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rowButton } from '../buttons/ArrowButton';
4
4
  export interface ArrowsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
5
5
  color?: ComponentProps<typeof ArrowButton>['color'];
6
+ describedby?: string;
6
7
  iconType?: 'ArrowDefault' | 'ArrowTail';
7
8
  isDisabledHidden?: boolean;
8
9
  isNextDisabled?: boolean;
@@ -2,31 +2,33 @@ import { t as e } from "../../chunks/clsx.js";
2
2
  import { ArrowButton as t } from "../buttons/ArrowButton.js";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  //#region lib/ui/arrows/Arrows.tsx
5
- var i = ({ className: i, color: a, iconType: o = "ArrowDefault", isDisabledHidden: s = !1, isNextDisabled: c = !1, isPrevDisabled: l = !1, labels: u = {
5
+ var i = ({ className: i, color: a, describedby: o, iconType: s = "ArrowDefault", isDisabledHidden: c = !1, isNextDisabled: l = !1, isPrevDisabled: u = !1, labels: d = {
6
6
  next: "",
7
7
  previous: ""
8
- }, onNext: d, onPrev: f, size: p, theme: m, ...h }) => /* @__PURE__ */ r("div", {
9
- ...h,
8
+ }, onNext: f, onPrev: p, size: m, theme: h, ...g }) => /* @__PURE__ */ r("div", {
9
+ ...g,
10
10
  className: e("pointer-events-none flex w-full items-center justify-between gap-x-20", i),
11
11
  "data-name": "Arrows",
12
12
  children: [/* @__PURE__ */ n(t, {
13
- className: e("pointer-events-auto transition-opacity", { "opacity-0": s && l }),
13
+ className: e("pointer-events-auto transition-opacity", { "opacity-0": c && u }),
14
14
  color: a,
15
- disabled: l,
16
- icon: `${o}Left`,
17
- onClick: f,
18
- size: p,
19
- theme: m,
20
- children: u.previous
15
+ disabled: u,
16
+ icon: `${s}Left`,
17
+ onClick: p,
18
+ size: m,
19
+ theme: h,
20
+ "aria-describedby": o,
21
+ children: d.previous
21
22
  }), /* @__PURE__ */ n(t, {
22
- className: e("pointer-events-auto transition-opacity", { "opacity-0": s && c }),
23
+ className: e("pointer-events-auto transition-opacity", { "opacity-0": c && l }),
23
24
  color: a,
24
- disabled: c,
25
- icon: `${o}Right`,
26
- onClick: d,
27
- size: p,
28
- theme: m,
29
- children: u.next
25
+ disabled: l,
26
+ icon: `${s}Right`,
27
+ onClick: f,
28
+ size: m,
29
+ theme: h,
30
+ "aria-describedby": o,
31
+ children: d.next
30
32
  })]
31
33
  });
32
34
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"Arrows.js","names":[],"sources":["../../../lib/ui/arrows/Arrows.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport type { ComponentProps, ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport type { ArrowsLabels } from './ArrowsLabels';\n// TODO: We need to migrate ArrowButton\nimport { ArrowButton } from '../buttons/ArrowButton';\n\nexport interface ArrowsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {\n color?: ComponentProps<typeof ArrowButton>['color'];\n iconType?: 'ArrowDefault' | 'ArrowTail';\n isDisabledHidden?: boolean;\n isNextDisabled?: boolean;\n isPrevDisabled?: boolean;\n labels?: ArrowsLabels;\n onNext: ComponentProps<typeof ArrowButton>['onClick'];\n onPrev: ComponentProps<typeof ArrowButton>['onClick'];\n size?: ComponentProps<typeof ArrowButton>['size'];\n theme?: ComponentProps<typeof ArrowButton>['theme'];\n}\n\nexport const Arrows: FunctionComponent<ArrowsProps> = ({\n className,\n color,\n iconType = 'ArrowDefault',\n isDisabledHidden = false,\n isNextDisabled = false,\n isPrevDisabled = false,\n labels = {\n next: '',\n previous: '',\n },\n onNext,\n onPrev,\n size,\n theme,\n ...attrs\n}) => {\n return (\n <div\n {...attrs}\n className={clsx(\n 'pointer-events-none flex w-full items-center justify-between gap-x-20',\n className,\n )}\n data-name=\"Arrows\"\n >\n <ArrowButton\n className={clsx('pointer-events-auto transition-opacity', {\n 'opacity-0': isDisabledHidden && isPrevDisabled,\n })}\n color={color}\n disabled={isPrevDisabled}\n icon={`${iconType}Left`}\n onClick={onPrev}\n size={size}\n theme={theme}\n >\n {labels.previous}\n </ArrowButton>\n <ArrowButton\n className={clsx('pointer-events-auto transition-opacity', {\n 'opacity-0': isDisabledHidden && isNextDisabled,\n })}\n color={color}\n disabled={isNextDisabled}\n icon={`${iconType}Right`}\n onClick={onNext}\n size={size}\n theme={theme}\n >\n {labels.next}\n </ArrowButton>\n </div>\n );\n};\n"],"mappings":";;;;AAoBA,IAAa,KAA0C,EACrD,cACA,UACA,cAAW,gBACX,sBAAmB,IACnB,oBAAiB,IACjB,oBAAiB,IACjB,YAAS;CACP,MAAM;CACN,UAAU;CACX,EACD,WACA,WACA,SACA,UACA,GAAG,QAGD,kBAAC,OAAD;CACE,GAAI;CACJ,WAAW,EACT,yEACA,EACD;CACD,aAAU;WANZ,CAQE,kBAAC,GAAD;EACE,WAAW,EAAK,0CAA0C,EACxD,aAAa,KAAoB,GAClC,CAAC;EACK;EACP,UAAU;EACV,MAAM,GAAG,EAAS;EAClB,SAAS;EACH;EACC;YAEN,EAAO;EACI,CAAA,EACd,kBAAC,GAAD;EACE,WAAW,EAAK,0CAA0C,EACxD,aAAa,KAAoB,GAClC,CAAC;EACK;EACP,UAAU;EACV,MAAM,GAAG,EAAS;EAClB,SAAS;EACH;EACC;YAEN,EAAO;EACI,CAAA,CACV"}
1
+ {"version":3,"file":"Arrows.js","names":[],"sources":["../../../lib/ui/arrows/Arrows.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport type { ComponentProps, ComponentPropsWithoutRef, FunctionComponent } from 'react';\n\nimport type { ArrowsLabels } from './ArrowsLabels';\n// TODO: We need to migrate ArrowButton\nimport { ArrowButton } from '../buttons/ArrowButton';\n\nexport interface ArrowsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {\n color?: ComponentProps<typeof ArrowButton>['color'];\n describedby?: string;\n iconType?: 'ArrowDefault' | 'ArrowTail';\n isDisabledHidden?: boolean;\n isNextDisabled?: boolean;\n isPrevDisabled?: boolean;\n labels?: ArrowsLabels;\n onNext: ComponentProps<typeof ArrowButton>['onClick'];\n onPrev: ComponentProps<typeof ArrowButton>['onClick'];\n size?: ComponentProps<typeof ArrowButton>['size'];\n theme?: ComponentProps<typeof ArrowButton>['theme'];\n}\n\nexport const Arrows: FunctionComponent<ArrowsProps> = ({\n className,\n color,\n describedby,\n iconType = 'ArrowDefault',\n isDisabledHidden = false,\n isNextDisabled = false,\n isPrevDisabled = false,\n labels = {\n next: '',\n previous: '',\n },\n onNext,\n onPrev,\n size,\n theme,\n ...attrs\n}) => {\n return (\n <div\n {...attrs}\n className={clsx(\n 'pointer-events-none flex w-full items-center justify-between gap-x-20',\n className,\n )}\n data-name=\"Arrows\"\n >\n <ArrowButton\n className={clsx('pointer-events-auto transition-opacity', {\n 'opacity-0': isDisabledHidden && isPrevDisabled,\n })}\n color={color}\n disabled={isPrevDisabled}\n icon={`${iconType}Left`}\n onClick={onPrev}\n size={size}\n theme={theme}\n aria-describedby={describedby}\n >\n {labels.previous}\n </ArrowButton>\n <ArrowButton\n className={clsx('pointer-events-auto transition-opacity', {\n 'opacity-0': isDisabledHidden && isNextDisabled,\n })}\n color={color}\n disabled={isNextDisabled}\n icon={`${iconType}Right`}\n onClick={onNext}\n size={size}\n theme={theme}\n aria-describedby={describedby}\n >\n {labels.next}\n </ArrowButton>\n </div>\n );\n};\n"],"mappings":";;;;AAqBA,IAAa,KAA0C,EACrD,cACA,UACA,gBACA,cAAW,gBACX,sBAAmB,IACnB,oBAAiB,IACjB,oBAAiB,IACjB,YAAS;CACP,MAAM;CACN,UAAU;CACX,EACD,WACA,WACA,SACA,UACA,GAAG,QAGD,kBAAC,OAAD;CACE,GAAI;CACJ,WAAW,EACT,yEACA,EACD;CACD,aAAU;WANZ,CAQE,kBAAC,GAAD;EACE,WAAW,EAAK,0CAA0C,EACxD,aAAa,KAAoB,GAClC,CAAC;EACK;EACP,UAAU;EACV,MAAM,GAAG,EAAS;EAClB,SAAS;EACH;EACC;EACP,oBAAkB;YAEjB,EAAO;EACI,CAAA,EACd,kBAAC,GAAD;EACE,WAAW,EAAK,0CAA0C,EACxD,aAAa,KAAoB,GAClC,CAAC;EACK;EACP,UAAU;EACV,MAAM,GAAG,EAAS;EAClB,SAAS;EACH;EACC;EACP,oBAAkB;YAEjB,EAAO;EACI,CAAA,CACV"}
@@ -5,7 +5,7 @@ export interface ButtonProps extends PropsWithChildren {
5
5
  color?: Colors;
6
6
  icon?: IconicNames;
7
7
  iconWidth?: string;
8
- size?: 'small' | 'medium' | 'large';
8
+ size?: 'small' | 'medium' | 'large' | 'primary' | 'secondary' | 'tertiary';
9
9
  theme?: 'outline' | 'solid';
10
10
  variant?: 'circle' | 'pill';
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Button.type.js","names":[],"sources":["../../../lib/ui/buttons/Button.type.ts"],"sourcesContent":["import clsx from 'clsx';\n\nimport type { IconicNames } from '@clubmed/trident-icons';\nimport type { Colors } from '../types/Colors';\nimport type { PropsWithChildren } from 'react';\n\nexport interface ButtonProps extends PropsWithChildren {\n color?: Colors;\n icon?: IconicNames;\n iconWidth?: string;\n size?: 'small' | 'medium' | 'large';\n theme?: 'outline' | 'solid';\n variant?: 'circle' | 'pill';\n}\n\ntype Params = {\n color: ButtonProps['color'];\n size: ButtonProps['size'];\n theme: ButtonProps['theme'];\n variant: ButtonProps['variant'];\n};\n\nexport const BUTTON_COLORS = {\n black: 'button-black',\n green: 'button-green',\n lavender: 'button-lavender',\n lightSand: 'button-lightSand',\n marygold: 'button-marygold',\n pearl: 'button-pearl',\n orange: 'button-orange',\n red: 'button-red',\n saffron: 'button-saffron',\n sand: 'button-sand',\n sienna: 'button-sienna',\n ultramarine: 'button-ultramarine',\n verdigris: 'button-verdigris',\n wave: 'button-wave',\n white: 'button-white',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst colorGuard = (color: string | undefined): color is keyof typeof BUTTON_COLORS => {\n return color != undefined && color in BUTTON_COLORS;\n};\n\nconst getButtonColor = (color: string | undefined) => {\n if (colorGuard(color)) {\n return BUTTON_COLORS[color];\n }\n\n return BUTTON_COLORS.saffron;\n};\n\nexport const BUTTON_THEMES = {\n outline: 'button-outline',\n solid: 'button-solid',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst themeGuard = (color: string | undefined): color is keyof typeof BUTTON_THEMES => {\n return color != undefined && color in BUTTON_THEMES;\n};\n\nconst getButtonTheme = (theme: string | undefined) => {\n if (themeGuard(theme)) {\n return BUTTON_THEMES[theme];\n }\n\n return BUTTON_THEMES.solid;\n};\n\nexport const BUTTON_VARIANTS = {\n circle: 'button-circle',\n pill: 'button-pill',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst variantGuard = (color: string | undefined): color is keyof typeof BUTTON_VARIANTS => {\n return color != undefined && color in BUTTON_VARIANTS;\n};\n\nconst getButtonVariant = (variant: string | undefined) => {\n if (variantGuard(variant)) {\n return BUTTON_VARIANTS[variant];\n }\n\n return BUTTON_VARIANTS.pill;\n};\n\nexport const BUTTON_SIZES = {\n small: 'button-small',\n medium: 'button-medium',\n large: 'button-large',\n primary: 'button-medium',\n secondary: 'button-secondary',\n tertiary: 'button-tertiary',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst sizeGuard = (color: string | undefined): color is keyof typeof BUTTON_SIZES => {\n return color != undefined && color in BUTTON_SIZES;\n};\n\nconst getButtonSize = (size: ButtonProps['size']) => {\n if (sizeGuard(size)) {\n return BUTTON_SIZES[size];\n }\n\n return BUTTON_SIZES.medium;\n};\n\nexport const getButtonClasses = ({ color, size, theme, variant }: Params) => {\n /* keep the \"flex\" class outside of \"button-*\" so that it can be overridden in responsive */\n return clsx(\n 'flex',\n 'button',\n getButtonTheme(theme),\n getButtonColor(color),\n getButtonVariant(variant),\n getButtonSize(size),\n );\n};\n"],"mappings":";;AAsBA,IAAa,IAAgB;CAC3B,OAAO;CACP,OAAO;CACP,UAAU;CACV,WAAW;CACX,UAAU;CACV,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;CACT,MAAM;CACN,QAAQ;CACR,aAAa;CACb,WAAW;CACX,MAAM;CACN,OAAO;CACR,EAEK,KAAc,MACX,KAAS,QAAa,KAAS,GAGlC,KAAkB,MAClB,EAAW,EAAM,GACZ,EAAc,KAGhB,EAAc,SAGV,IAAgB;CAC3B,SAAS;CACT,OAAO;CACR,EAEK,KAAc,MACX,KAAS,QAAa,KAAS,GAGlC,KAAkB,MAClB,EAAW,EAAM,GACZ,EAAc,KAGhB,EAAc,OAGV,IAAkB;CAC7B,QAAQ;CACR,MAAM;CACP,EAEK,KAAgB,MACb,KAAS,QAAa,KAAS,GAGlC,KAAoB,MACpB,EAAa,EAAQ,GAChB,EAAgB,KAGlB,EAAgB,MAGZ,IAAe;CAC1B,OAAO;CACP,QAAQ;CACR,OAAO;CACP,SAAS;CACT,WAAW;CACX,UAAU;CACX,EAEK,KAAa,MACV,KAAS,QAAa,KAAS,GAGlC,KAAiB,MACjB,EAAU,EAAK,GACV,EAAa,KAGf,EAAa,QAGT,KAAoB,EAAE,UAAO,SAAM,UAAO,iBAE9C,EACL,QACA,UACA,EAAe,EAAM,EACrB,EAAe,EAAM,EACrB,EAAiB,EAAQ,EACzB,EAAc,EAAK,CACpB"}
1
+ {"version":3,"file":"Button.type.js","names":[],"sources":["../../../lib/ui/buttons/Button.type.ts"],"sourcesContent":["import clsx from 'clsx';\n\nimport type { IconicNames } from '@clubmed/trident-icons';\nimport type { Colors } from '../types/Colors';\nimport type { PropsWithChildren } from 'react';\n\nexport interface ButtonProps extends PropsWithChildren {\n color?: Colors;\n icon?: IconicNames;\n iconWidth?: string;\n size?: 'small' | 'medium' | 'large' | 'primary' | 'secondary' | 'tertiary';\n theme?: 'outline' | 'solid';\n variant?: 'circle' | 'pill';\n}\n\ntype Params = {\n color: ButtonProps['color'];\n size: ButtonProps['size'];\n theme: ButtonProps['theme'];\n variant: ButtonProps['variant'];\n};\n\nexport const BUTTON_COLORS = {\n black: 'button-black',\n green: 'button-green',\n lavender: 'button-lavender',\n lightSand: 'button-lightSand',\n marygold: 'button-marygold',\n pearl: 'button-pearl',\n orange: 'button-orange',\n red: 'button-red',\n saffron: 'button-saffron',\n sand: 'button-sand',\n sienna: 'button-sienna',\n ultramarine: 'button-ultramarine',\n verdigris: 'button-verdigris',\n wave: 'button-wave',\n white: 'button-white',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst colorGuard = (color: string | undefined): color is keyof typeof BUTTON_COLORS => {\n return color != undefined && color in BUTTON_COLORS;\n};\n\nconst getButtonColor = (color: string | undefined) => {\n if (colorGuard(color)) {\n return BUTTON_COLORS[color];\n }\n\n return BUTTON_COLORS.saffron;\n};\n\nexport const BUTTON_THEMES = {\n outline: 'button-outline',\n solid: 'button-solid',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst themeGuard = (color: string | undefined): color is keyof typeof BUTTON_THEMES => {\n return color != undefined && color in BUTTON_THEMES;\n};\n\nconst getButtonTheme = (theme: string | undefined) => {\n if (themeGuard(theme)) {\n return BUTTON_THEMES[theme];\n }\n\n return BUTTON_THEMES.solid;\n};\n\nexport const BUTTON_VARIANTS = {\n circle: 'button-circle',\n pill: 'button-pill',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst variantGuard = (color: string | undefined): color is keyof typeof BUTTON_VARIANTS => {\n return color != undefined && color in BUTTON_VARIANTS;\n};\n\nconst getButtonVariant = (variant: string | undefined) => {\n if (variantGuard(variant)) {\n return BUTTON_VARIANTS[variant];\n }\n\n return BUTTON_VARIANTS.pill;\n};\n\nexport const BUTTON_SIZES = {\n small: 'button-small',\n medium: 'button-medium',\n large: 'button-large',\n primary: 'button-medium',\n secondary: 'button-secondary',\n tertiary: 'button-tertiary',\n} as const satisfies Record<string, `button-${string}`>;\n\nconst sizeGuard = (color: string | undefined): color is keyof typeof BUTTON_SIZES => {\n return color != undefined && color in BUTTON_SIZES;\n};\n\nconst getButtonSize = (size: ButtonProps['size']) => {\n if (sizeGuard(size)) {\n return BUTTON_SIZES[size];\n }\n\n return BUTTON_SIZES.medium;\n};\n\nexport const getButtonClasses = ({ color, size, theme, variant }: Params) => {\n /* keep the \"flex\" class outside of \"button-*\" so that it can be overridden in responsive */\n return clsx(\n 'flex',\n 'button',\n getButtonTheme(theme),\n getButtonColor(color),\n getButtonVariant(variant),\n getButtonSize(size),\n );\n};\n"],"mappings":";;AAsBA,IAAa,IAAgB;CAC3B,OAAO;CACP,OAAO;CACP,UAAU;CACV,WAAW;CACX,UAAU;CACV,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;CACT,MAAM;CACN,QAAQ;CACR,aAAa;CACb,WAAW;CACX,MAAM;CACN,OAAO;CACR,EAEK,KAAc,MACX,KAAS,QAAa,KAAS,GAGlC,KAAkB,MAClB,EAAW,EAAM,GACZ,EAAc,KAGhB,EAAc,SAGV,IAAgB;CAC3B,SAAS;CACT,OAAO;CACR,EAEK,KAAc,MACX,KAAS,QAAa,KAAS,GAGlC,KAAkB,MAClB,EAAW,EAAM,GACZ,EAAc,KAGhB,EAAc,OAGV,IAAkB;CAC7B,QAAQ;CACR,MAAM;CACP,EAEK,KAAgB,MACb,KAAS,QAAa,KAAS,GAGlC,KAAoB,MACpB,EAAa,EAAQ,GAChB,EAAgB,KAGlB,EAAgB,MAGZ,IAAe;CAC1B,OAAO;CACP,QAAQ;CACR,OAAO;CACP,SAAS;CACT,WAAW;CACX,UAAU;CACX,EAEK,KAAa,MACV,KAAS,QAAa,KAAS,GAGlC,KAAiB,MACjB,EAAU,EAAK,GACV,EAAa,KAGf,EAAa,QAGT,KAAoB,EAAE,UAAO,SAAM,UAAO,iBAE9C,EACL,QACA,UACA,EAAe,EAAM,EACrB,EAAe,EAAM,EACrB,EAAiB,EAAQ,EACzB,EAAc,EAAK,CACpB"}
@@ -1,9 +1,13 @@
1
- import { FormControlProps } from './FormControl';
2
- export interface FilterProps<Value = string> extends FormControlProps<Value> {
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ export interface FilterProps extends Omit<ComponentPropsWithoutRef<'input'>, 'size'> {
3
3
  /**
4
4
  * Is it attached to a dropdown?
5
5
  */
6
6
  hasDropdown?: boolean;
7
- onChange?: (name: string, value: Value | null) => void;
7
+ /**
8
+ * @deprecated use ["data-testid"] instead
9
+ */
10
+ dataTestId?: string;
11
+ 'data-testid'?: string;
8
12
  }
9
- export declare function Filter<Value = string>(props: FilterProps<Value>): import("react/jsx-runtime").JSX.Element;
13
+ export declare function Filter(props: FilterProps): import("react/jsx-runtime").JSX.Element;
@@ -1,68 +1,46 @@
1
1
  import { t as e } from "../../chunks/clsx.js";
2
- import { useInternalStatus as t } from "../hooks/useInternalStatus.js";
3
- import { useValue as n } from "../hooks/useValue.js";
4
- import { useId as r } from "react";
5
- import { Icon as i } from "@clubmed/trident-icons";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
+ import { useId as t } from "react";
3
+ import { Icon as n } from "@clubmed/trident-icons";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
7
5
  //#region lib/ui/forms/Filter.tsx
8
- function s(s) {
9
- let c = r(), { id: l = c, name: u = l, className: d, dataTestId: f, disabled: p = !1, checked: m = !1, value: h, tabIndex: g = 0, validationStatus: _ = "default", errorMessage: v, onChange: y, hasDropdown: b, children: x, ...S } = s, { value: C, setValue: w } = n({
10
- name: u,
11
- initialValue: m,
12
- onChange(e, t) {
13
- y?.(e, t ? h === void 0 ? t : h : null);
14
- }
15
- }), T = t({
16
- isDisabled: p,
17
- validationStatus: _
18
- }) === "error" && v;
19
- return /* @__PURE__ */ o("div", {
20
- className: e(d, "relative"),
21
- children: [/* @__PURE__ */ o("label", {
22
- "data-testid": `filter-container-${l}`,
6
+ function a(a) {
7
+ let o = t(), { id: s = o, name: c = s, className: l, dataTestId: u, disabled: d = !1, "data-testid": f, tabIndex: p = 0, hasDropdown: m, children: h, ...g } = a;
8
+ return /* @__PURE__ */ r("div", {
9
+ className: e(l, "relative"),
10
+ children: /* @__PURE__ */ i("label", {
11
+ "data-testid": `filter-container-${s}`,
23
12
  className: "relative",
24
- children: [/* @__PURE__ */ a("input", {
25
- ...S,
26
- name: u,
27
- "data-testid": f,
13
+ children: [/* @__PURE__ */ r("input", {
14
+ ...g,
15
+ id: s,
16
+ name: c,
17
+ "data-testid": f ?? u,
28
18
  type: "checkbox",
29
- tabIndex: g,
30
- onChange: () => {
31
- p || w(!C);
32
- },
33
- checked: C,
19
+ tabIndex: p,
34
20
  "data-name": "Filter",
35
- disabled: p,
36
- value: h
37
- }), /* @__PURE__ */ o("span", { children: [
38
- /* @__PURE__ */ a("span", {
21
+ disabled: d
22
+ }), /* @__PURE__ */ i("span", { children: [
23
+ /* @__PURE__ */ r("span", {
39
24
  className: "font-semibold",
40
- children: x
25
+ children: h
41
26
  }),
42
- /* @__PURE__ */ a(i, {
27
+ /* @__PURE__ */ r(n, {
43
28
  className: "check",
44
29
  width: null,
45
30
  name: "CheckDefault",
46
31
  color: "black"
47
32
  }),
48
- b && /* @__PURE__ */ a(i, {
33
+ m && /* @__PURE__ */ r(n, {
49
34
  name: "ArrowDefaultDown",
50
35
  className: "ml-8",
51
36
  width: "24px",
52
37
  color: "black"
53
38
  })
54
39
  ] })]
55
- }), T && /* @__PURE__ */ o("span", {
56
- className: "text-red text-b4 flex items-start space-x-4 ps-20",
57
- role: "alert",
58
- children: [/* @__PURE__ */ a(i, {
59
- name: "Error",
60
- width: "20px"
61
- }), v]
62
- })]
40
+ })
63
41
  });
64
42
  }
65
43
  //#endregion
66
- export { s as Filter };
44
+ export { a as Filter };
67
45
 
68
46
  //# sourceMappingURL=Filter.js.map