@postenbring/hedwig-react 2.1.4 → 2.2.1

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 (148) hide show
  1. package/dist/accordion/accordion-content.d.ts.map +1 -1
  2. package/dist/accordion/accordion-content.js +22 -6
  3. package/dist/accordion/accordion-content.js.map +1 -1
  4. package/dist/accordion/accordion-content.mjs +4 -1
  5. package/dist/accordion/accordion.js +24 -6
  6. package/dist/accordion/accordion.js.map +1 -1
  7. package/dist/accordion/accordion.mjs +5 -2
  8. package/dist/accordion/index.js +24 -6
  9. package/dist/accordion/index.js.map +1 -1
  10. package/dist/accordion/index.mjs +5 -2
  11. package/dist/alert/alert.d.ts +36 -0
  12. package/dist/alert/alert.d.ts.map +1 -0
  13. package/dist/alert/alert.js +186 -0
  14. package/dist/alert/alert.js.map +1 -0
  15. package/dist/alert/alert.mjs +13 -0
  16. package/dist/alert/alert.mjs.map +1 -0
  17. package/dist/alert/index.d.ts +3 -0
  18. package/dist/alert/index.d.ts.map +1 -0
  19. package/dist/alert/index.js +188 -0
  20. package/dist/alert/index.js.map +1 -0
  21. package/dist/alert/index.mjs +14 -0
  22. package/dist/alert/index.mjs.map +1 -0
  23. package/dist/{chunk-GVO57ZWU.mjs → chunk-23IZCRJA.mjs} +2 -2
  24. package/dist/chunk-4P4GPVKZ.mjs +63 -0
  25. package/dist/chunk-4P4GPVKZ.mjs.map +1 -0
  26. package/dist/{chunk-KNGG6M2I.mjs → chunk-5RXT5GLF.mjs} +2 -2
  27. package/dist/{chunk-ILFK3VKS.mjs → chunk-77M2ZTP7.mjs} +6 -3
  28. package/dist/chunk-77M2ZTP7.mjs.map +1 -0
  29. package/dist/{chunk-5FWY7FIX.mjs → chunk-AGIY7SFP.mjs} +5 -2
  30. package/dist/chunk-AGIY7SFP.mjs.map +1 -0
  31. package/dist/{chunk-WLESNP6Z.mjs → chunk-B6T36QDV.mjs} +5 -2
  32. package/dist/chunk-B6T36QDV.mjs.map +1 -0
  33. package/dist/{chunk-GXIKHXWC.mjs → chunk-EQFY63YP.mjs} +2 -2
  34. package/dist/{chunk-6SVLMQUW.mjs → chunk-FUIKSOJF.mjs} +4 -4
  35. package/dist/{chunk-KCEWKQ4W.mjs → chunk-GYI4NCUY.mjs} +2 -2
  36. package/dist/{chunk-J5SCUELT.mjs → chunk-HBGFFKP3.mjs} +2 -2
  37. package/dist/{chunk-4C76JM3T.mjs → chunk-I4NL4ESV.mjs} +2 -2
  38. package/dist/{chunk-DTU7AXY3.mjs → chunk-NUP7ZBVE.mjs} +2 -2
  39. package/dist/chunk-OVKUPO5U.mjs +1 -0
  40. package/dist/chunk-OVKUPO5U.mjs.map +1 -0
  41. package/dist/{chunk-CKG2XRMX.mjs → chunk-R6MQFVHE.mjs} +2 -2
  42. package/dist/{chunk-YQMTDQSQ.mjs → chunk-TC5PD4TA.mjs} +4 -4
  43. package/dist/{chunk-DRSAVDIE.mjs → chunk-W6CFPK2C.mjs} +5 -4
  44. package/dist/chunk-W6CFPK2C.mjs.map +1 -0
  45. package/dist/{chunk-4YCM72TQ.mjs → chunk-W7CPW23K.mjs} +27 -18
  46. package/dist/chunk-W7CPW23K.mjs.map +1 -0
  47. package/dist/footer/footer.js +37 -19
  48. package/dist/footer/footer.js.map +1 -1
  49. package/dist/footer/footer.mjs +6 -3
  50. package/dist/footer/index.js +37 -19
  51. package/dist/footer/index.js.map +1 -1
  52. package/dist/footer/index.mjs +6 -3
  53. package/dist/form/date-picker/date-picker.js +1 -0
  54. package/dist/form/date-picker/date-picker.js.map +1 -1
  55. package/dist/form/date-picker/date-picker.mjs +2 -2
  56. package/dist/form/date-picker/index.js +1 -0
  57. package/dist/form/date-picker/index.js.map +1 -1
  58. package/dist/form/date-picker/index.mjs +2 -2
  59. package/dist/form/error-summary/error-summary.d.ts +5 -5
  60. package/dist/form/error-summary/error-summary.d.ts.map +1 -1
  61. package/dist/form/error-summary/error-summary.js +47 -93
  62. package/dist/form/error-summary/error-summary.js.map +1 -1
  63. package/dist/form/error-summary/error-summary.mjs +5 -6
  64. package/dist/form/error-summary/index.js +47 -93
  65. package/dist/form/error-summary/index.js.map +1 -1
  66. package/dist/form/error-summary/index.mjs +5 -6
  67. package/dist/form/index.js +75 -121
  68. package/dist/form/index.js.map +1 -1
  69. package/dist/form/index.mjs +15 -16
  70. package/dist/index.d.ts +1 -0
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +784 -713
  73. package/dist/index.js.map +1 -1
  74. package/dist/index.mjs +86 -75
  75. package/dist/layout/grid/grid.mjs +2 -2
  76. package/dist/layout/grid/index.mjs +2 -2
  77. package/dist/layout/index.mjs +9 -9
  78. package/dist/layout/stack/index.mjs +2 -2
  79. package/dist/layout/stack/stack.mjs +2 -2
  80. package/dist/modal/index.js +1 -0
  81. package/dist/modal/index.js.map +1 -1
  82. package/dist/modal/index.mjs +2 -2
  83. package/dist/modal/modal.js +1 -0
  84. package/dist/modal/modal.js.map +1 -1
  85. package/dist/modal/modal.mjs +2 -2
  86. package/dist/navbar/index.js +3 -1
  87. package/dist/navbar/index.js.map +1 -1
  88. package/dist/navbar/index.mjs +3 -3
  89. package/dist/navbar/navbar-expandable-menu.d.ts.map +1 -1
  90. package/dist/navbar/navbar-expandable-menu.js +3 -1
  91. package/dist/navbar/navbar-expandable-menu.js.map +1 -1
  92. package/dist/navbar/navbar-expandable-menu.mjs +2 -2
  93. package/dist/navbar/navbar.js +3 -1
  94. package/dist/navbar/navbar.js.map +1 -1
  95. package/dist/navbar/navbar.mjs +3 -3
  96. package/dist/skeleton/index.js +20 -2
  97. package/dist/skeleton/index.js.map +1 -1
  98. package/dist/skeleton/index.mjs +4 -1
  99. package/dist/skeleton/skeleton.d.ts.map +1 -1
  100. package/dist/skeleton/skeleton.js +20 -2
  101. package/dist/skeleton/skeleton.js.map +1 -1
  102. package/dist/skeleton/skeleton.mjs +4 -1
  103. package/dist/tabs/index.js +1 -0
  104. package/dist/tabs/index.js.map +1 -1
  105. package/dist/tabs/index.mjs +3 -3
  106. package/dist/tabs/tabs-list.js +1 -0
  107. package/dist/tabs/tabs-list.js.map +1 -1
  108. package/dist/tabs/tabs-list.mjs +2 -2
  109. package/dist/tabs/tabs.js +1 -0
  110. package/dist/tabs/tabs.js.map +1 -1
  111. package/dist/tabs/tabs.mjs +3 -3
  112. package/dist/text/text.d.ts +1 -1
  113. package/dist/utils/auto-animate-height.js +1 -0
  114. package/dist/utils/auto-animate-height.js.map +1 -1
  115. package/dist/utils/auto-animate-height.mjs +2 -2
  116. package/dist/utils/index.js +4 -0
  117. package/dist/utils/index.js.map +1 -1
  118. package/dist/utils/index.mjs +4 -2
  119. package/dist/utils/utils.d.ts +4 -0
  120. package/dist/utils/utils.d.ts.map +1 -1
  121. package/dist/utils/utils.js +4 -0
  122. package/dist/utils/utils.js.map +1 -1
  123. package/dist/utils/utils.mjs +3 -1
  124. package/package.json +5 -5
  125. package/src/accordion/accordion-content.tsx +2 -1
  126. package/src/alert/alert.stories.tsx +36 -0
  127. package/src/alert/alert.tsx +83 -0
  128. package/src/alert/index.tsx +2 -0
  129. package/src/form/error-summary/error-summary.tsx +32 -31
  130. package/src/index.ts +1 -0
  131. package/src/navbar/navbar-expandable-menu.tsx +3 -2
  132. package/src/skeleton/skeleton.tsx +2 -1
  133. package/src/utils/utils.ts +14 -1
  134. package/dist/chunk-4YCM72TQ.mjs.map +0 -1
  135. package/dist/chunk-5FWY7FIX.mjs.map +0 -1
  136. package/dist/chunk-DRSAVDIE.mjs.map +0 -1
  137. package/dist/chunk-ILFK3VKS.mjs.map +0 -1
  138. package/dist/chunk-WLESNP6Z.mjs.map +0 -1
  139. /package/dist/{chunk-GVO57ZWU.mjs.map → chunk-23IZCRJA.mjs.map} +0 -0
  140. /package/dist/{chunk-KNGG6M2I.mjs.map → chunk-5RXT5GLF.mjs.map} +0 -0
  141. /package/dist/{chunk-GXIKHXWC.mjs.map → chunk-EQFY63YP.mjs.map} +0 -0
  142. /package/dist/{chunk-6SVLMQUW.mjs.map → chunk-FUIKSOJF.mjs.map} +0 -0
  143. /package/dist/{chunk-KCEWKQ4W.mjs.map → chunk-GYI4NCUY.mjs.map} +0 -0
  144. /package/dist/{chunk-J5SCUELT.mjs.map → chunk-HBGFFKP3.mjs.map} +0 -0
  145. /package/dist/{chunk-4C76JM3T.mjs.map → chunk-I4NL4ESV.mjs.map} +0 -0
  146. /package/dist/{chunk-DTU7AXY3.mjs.map → chunk-NUP7ZBVE.mjs.map} +0 -0
  147. /package/dist/{chunk-CKG2XRMX.mjs.map → chunk-R6MQFVHE.mjs.map} +0 -0
  148. /package/dist/{chunk-YQMTDQSQ.mjs.map → chunk-TC5PD4TA.mjs.map} +0 -0
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var utils_exports = {};
32
32
  __export(utils_exports, {
33
33
  focusTrap: () => focusTrap,
34
+ inertPropValue: () => inertPropValue,
34
35
  useHydrated: () => useHydrated,
35
36
  useMergeRefs: () => useMergeRefs,
36
37
  useResize: () => useResize
@@ -113,9 +114,12 @@ function releaseFocusTrap(inertElements) {
113
114
  el.removeAttribute("inert");
114
115
  }
115
116
  }
117
+ var inertBooleanSupported = Number(import_react.version.split(".")[0]) >= 19;
118
+ var inertPropValue = inertBooleanSupported ? (x) => x : (x) => x ? "" : void 0;
116
119
  // Annotate the CommonJS export names for ESM import in node:
117
120
  0 && (module.exports = {
118
121
  focusTrap,
122
+ inertPropValue,
119
123
  useHydrated,
120
124
  useMergeRefs,
121
125
  useResize
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,mBAAiD;AAM1C,SAAS,aACd,MACoC;AACpC,SAAa,cAAQ,MAAM;AACzB,QAAI,KAAK,MAAM,CAAC,QAAQ,QAAQ,IAAI,GAAG;AACrC,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,UAAU;AAChB,WAAK,QAAQ,CAAC,QAAQ;AACpB,YAAI,OAAO,QAAQ,YAAY;AAC7B,cAAI,KAAK;AAAA,QACX,WAAW,QAAQ,MAAM;AACvB,UAAC,IAAgD,UAAU;AAAA,QAC7D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAEF,GAAG,IAAI;AACT;AAEO,SAAS,UACd,KACmC;AACnC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAiB,CAAC;AAC5C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAiB,CAAC;AAC9C,QAAM,mBAAe,0BAAY,MAAM;AAjCzC;AAkCI,SAAI,2BAAK,aAAY,MAAM;AACzB,gBAAS,sCAAK,YAAL,mBAAc,gBAAd,YAA6B,CAAC;AACvC,iBAAU,sCAAK,YAAL,mBAAc,iBAAd,YAA8B,CAAC;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AACR,8BAAU,MAAM;AACd,WAAO,iBAAiB,QAAQ,YAAY;AAC5C,WAAO,iBAAiB,UAAU,YAAY;AAC9C,WAAO,MAAM;AACX,aAAO,oBAAoB,QAAQ,YAAY;AAC/C,aAAO,oBAAoB,UAAU,YAAY;AAAA,IACnD;AAAA,EACF,GAAG,CAAC,KAAK,YAAY,CAAC;AACtB,8BAAU,MAAM;AACd,iBAAa;AAAA,EAEf,GAAG,CAAC,CAAC;AACL,SAAO,EAAE,OAAO,OAAO;AACzB;AAEA,SAAS,YAAY;AAEnB,SAAO,MAAM;AAAA,EAAC;AAChB;AAEO,SAAS,cAAc;AAC5B,SAAa;AAAA,IACX;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAaO,SAAS,UAAU,SAAsB;AA9EhD;AAgFE,MAAI,YAAY,SAAS,KAAM,QAAO,MAAM;AAAA,EAAC;AAE7C,MAAI,gBAA+B,CAAC;AACpC,WAAS,KAAyB,SAAS,IAAI,KAAK,GAAG,eAAe;AACpE,QAAI,OAAO,SAAS,KAAM;AAE1B,eAAW,YAAW,cAAG,kBAAH,mBAAkB,aAAlB,YAA8B,CAAC,GAAG;AACtD,UAAI,YAAY,GAAI;AACpB,UAAI,EAAE,mBAAmB,aAAc;AACvC,UAAI,QAAQ,aAAa,OAAO,EAAG;AAEnC,cAAQ,aAAa,SAAS,MAAM;AACpC,oBAAc,KAAK,OAAO;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO,MAAM;AACX,qBAAiB,aAAa;AAC9B,oBAAgB,CAAC;AAAA,EACnB;AACF;AAKA,SAAS,iBAAiB,eAAsC;AAC9D,aAAW,MAAM,eAAe;AAC9B,OAAG,gBAAgB,OAAO;AAAA,EAC5B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,mBAA0D;AAMnD,SAAS,aACd,MACoC;AACpC,SAAa,cAAQ,MAAM;AACzB,QAAI,KAAK,MAAM,CAAC,QAAQ,QAAQ,IAAI,GAAG;AACrC,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,UAAU;AAChB,WAAK,QAAQ,CAAC,QAAQ;AACpB,YAAI,OAAO,QAAQ,YAAY;AAC7B,cAAI,KAAK;AAAA,QACX,WAAW,QAAQ,MAAM;AACvB,UAAC,IAAgD,UAAU;AAAA,QAC7D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAEF,GAAG,IAAI;AACT;AAEO,SAAS,UACd,KACmC;AACnC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAiB,CAAC;AAC5C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAiB,CAAC;AAC9C,QAAM,mBAAe,0BAAY,MAAM;AAjCzC;AAkCI,SAAI,2BAAK,aAAY,MAAM;AACzB,gBA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IAAM,wBAAiC,OAAO,qBAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK;AAKjE,IAAM,iBAA2D,wBACpE,CAAC,MAAwB,IACzB,CAAC,MAAgC,IAAI,KAAK;","names":[]}
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  focusTrap,
3
+ inertPropValue,
3
4
  useHydrated,
4
5
  useMergeRefs,
5
6
  useResize
6
- } from "../chunk-ILFK3VKS.mjs";
7
+ } from "../chunk-77M2ZTP7.mjs";
7
8
  import "../chunk-YOSPWY5K.mjs";
8
9
  export {
9
10
  focusTrap,
11
+ inertPropValue,
10
12
  useHydrated,
11
13
  useMergeRefs,
12
14
  useResize
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postenbring/hedwig-react",
3
- "version": "2.1.4",
3
+ "version": "2.2.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "@types/react-dom": "^18.3.1",
18
18
  "react": "^18.3.1",
19
19
  "react-dom": "18.3.1",
20
- "tsup": "^8.4.0",
20
+ "tsup": "^8.5.0",
21
21
  "typescript": "^5.8.3",
22
22
  "eslint-config-custom": "0.0.1",
23
23
  "hedwig-tsconfig": "0.0.0"
@@ -29,9 +29,9 @@
29
29
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
30
30
  },
31
31
  "dependencies": {
32
- "@radix-ui/react-popover": "1.1.13",
33
- "@radix-ui/react-slot": "1.2.2",
34
- "@postenbring/hedwig-css": "2.1.4"
32
+ "@radix-ui/react-popover": "1.1.14",
33
+ "@radix-ui/react-slot": "1.2.3",
34
+ "@postenbring/hedwig-css": "2.2.1"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import { forwardRef, useContext } from "react";
3
3
  import { clsx } from "@postenbring/hedwig-css/typed-classname";
4
+ import { inertPropValue } from "../utils";
4
5
  import { AccordionItemContext } from "./context";
5
6
 
6
7
  export interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -17,7 +18,7 @@ export const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps
17
18
  <div
18
19
  id={context.contentId}
19
20
  data-state={context.open ? "open" : "closed"}
20
- {...{ inert: context.open ? undefined : "true" }}
21
+ {...{ inert: inertPropValue(!context.open) }}
21
22
  className={clsx("hds-accordion-item-content", className as undefined)}
22
23
  ref={ref}
23
24
  {...rest}
@@ -0,0 +1,36 @@
1
+ /* eslint-disable import/no-extraneous-dependencies -- storybook story */
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Alert } from ".";
4
+
5
+ const meta: Meta<typeof Alert> = {
6
+ title: "Alert",
7
+ component: Alert,
8
+
9
+ argTypes: {
10
+ variant: {
11
+ options: ["info", "success", "warning", "error", "neutral"],
12
+ control: {
13
+ type: "radio",
14
+ },
15
+ },
16
+ },
17
+ };
18
+
19
+ export default meta;
20
+
21
+ type Story = StoryObj<typeof Alert>;
22
+ export const Preview: Story = {
23
+ tags: ["!dev"],
24
+ args: {
25
+ variant: "success",
26
+ children: (
27
+ <>
28
+ <Alert.Title>Alert header</Alert.Title>
29
+ <Alert.Description>
30
+ Alert header Alert description. A more detailed explanation of whats happening, but not
31
+ too long.
32
+ </Alert.Description>
33
+ </>
34
+ ),
35
+ },
36
+ };
@@ -0,0 +1,83 @@
1
+ import React, { forwardRef, type HTMLAttributes } from "react";
2
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import { Box, type BoxProps } from "../box/box";
5
+
6
+ export interface AlertTitleProps extends HTMLAttributes<HTMLParagraphElement> {
7
+ /**
8
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
9
+ *
10
+ * @default false
11
+ */
12
+ asChild?: boolean;
13
+ }
14
+ export const AlertTitle = forwardRef<HTMLParagraphElement, AlertTitleProps>(
15
+ ({ asChild, className, ...rest }, ref) => {
16
+ const Component = asChild ? Slot : "div";
17
+ return (
18
+ <Component className={clsx("hds-alert__title", className as undefined)} ref={ref} {...rest} />
19
+ );
20
+ },
21
+ );
22
+ AlertTitle.displayName = "Alert.Title";
23
+
24
+ export interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {
25
+ /**
26
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
27
+ *
28
+ * @default false
29
+ */
30
+ asChild?: boolean;
31
+ }
32
+ export const AlertDescription = forwardRef<HTMLParagraphElement, AlertDescriptionProps>(
33
+ ({ asChild, className, ...rest }, ref) => {
34
+ const Component = asChild ? Slot : "div";
35
+ return (
36
+ <Component
37
+ className={clsx("hds-alert__description", className as undefined)}
38
+ ref={ref}
39
+ {...rest}
40
+ />
41
+ );
42
+ },
43
+ );
44
+ AlertDescription.displayName = "Alert.Description";
45
+
46
+ export type AlertProps = (
47
+ | {
48
+ variant?: "info" | "success" | "warning" | "error";
49
+ icon?: never;
50
+ iconClassName?: never;
51
+ }
52
+ | {
53
+ variant: "neutral";
54
+ icon?: React.ReactNode;
55
+ iconClassName?: string;
56
+ }
57
+ ) &
58
+ Omit<BoxProps, "variant" | "asChild">;
59
+
60
+ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
61
+ ({ children, className, variant = "success", icon, iconClassName, ...rest }, ref) => {
62
+ return (
63
+ <Box
64
+ className={clsx(`hds-alert`, `hds-alert--${variant}`, className as undefined)}
65
+ ref={ref}
66
+ {...rest}
67
+ >
68
+ {variant === "neutral" && (
69
+ <div className={clsx("hds-alert--neutral__icon", iconClassName as undefined)}>{icon}</div>
70
+ )}
71
+ {children}
72
+ </Box>
73
+ );
74
+ },
75
+ ) as AlertType;
76
+ Alert.displayName = "Alert";
77
+
78
+ type AlertType = ReturnType<typeof forwardRef<HTMLDivElement, AlertProps>> & {
79
+ Title: typeof AlertTitle;
80
+ Description: typeof AlertDescription;
81
+ };
82
+ Alert.Title = AlertTitle;
83
+ Alert.Description = AlertDescription;
@@ -0,0 +1,2 @@
1
+ export { Alert, AlertTitle, AlertDescription } from "./alert";
2
+ export type * from "./alert";
@@ -1,5 +1,7 @@
1
- import { forwardRef, useEffect, useRef } from "react";
2
- import { Message, type MessageProps, type MessageTitleProps } from "../../message";
1
+ import { forwardRef, useEffect, useRef, type HTMLAttributes } from "react";
2
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import { Box, type BoxProps } from "../../box";
3
5
  import { UnorderedList, type ListProps } from "../../list";
4
6
  import { Link } from "../../link";
5
7
  import { useMergeRefs } from "../../utils";
@@ -35,16 +37,17 @@ interface ErrorSummaryHeadingPropsAsChild {
35
37
  as?: never;
36
38
  }
37
39
 
38
- export type ErrorSummaryHeadingProps = MessageTitleProps &
40
+ export type ErrorSummaryHeadingProps = HTMLAttributes<HTMLElement> &
39
41
  ErrorSummaryHeadingPropsAutoFocus &
40
42
  (ErrorSummaryHeadingPropsAs | ErrorSummaryHeadingPropsAsChild);
41
43
 
42
44
  export const ErrorSummaryHeading = forwardRef<
43
45
  HTMLParagraphElement,
44
46
  ErrorSummaryHeadingProps & (ErrorSummaryHeadingPropsAs | ErrorSummaryHeadingPropsAsChild)
45
- >(({ children, as: Tag, autoFocus = true, ...rest }, ref) => {
47
+ >(({ asChild, children, as: Tag, autoFocus = true, ...rest }, ref) => {
46
48
  const focusRef = useRef<HTMLElement>(null);
47
49
  const mergedRef = useMergeRefs([focusRef, ref]);
50
+ const Component = asChild ? Slot : Tag;
48
51
 
49
52
  useEffect(() => {
50
53
  /**
@@ -60,9 +63,9 @@ export const ErrorSummaryHeading = forwardRef<
60
63
  }, []);
61
64
 
62
65
  return (
63
- <Message.Title ref={mergedRef} tabIndex={-1} asChild {...rest}>
64
- {Tag ? <Tag>{children}</Tag> : children}
65
- </Message.Title>
66
+ <Component className={clsx(`hds-error-summary__title`)} ref={mergedRef} tabIndex={-1} {...rest}>
67
+ {children}
68
+ </Component>
66
69
  );
67
70
  });
68
71
  ErrorSummaryHeading.displayName = "ErrorSummary.Heading";
@@ -76,20 +79,11 @@ export interface ErrorSummaryListProps extends ListProps {
76
79
  size?: ListProps["size"];
77
80
  }
78
81
  export const ErrorSummaryList = forwardRef<HTMLUListElement, ErrorSummaryListProps>(
79
- ({ children, style: _style, size = "small", ...rest }, ref) => {
80
- const style = {
81
- // Match the link `solid` style, which black underline
82
- "--_hds-list-marker-color": "var(--hds-ui-colors-black)",
83
- ..._style,
84
- };
85
- return (
86
- <Message.Description asChild>
87
- <UnorderedList size={size} ref={ref} style={style} {...rest}>
88
- {children}
89
- </UnorderedList>
90
- </Message.Description>
91
- );
92
- },
82
+ ({ children, size = "small", ...rest }, ref) => (
83
+ <UnorderedList size={size} ref={ref} {...rest}>
84
+ {children}
85
+ </UnorderedList>
86
+ ),
93
87
  );
94
88
  ErrorSummaryList.displayName = "ErrorSummary.List";
95
89
 
@@ -118,8 +112,14 @@ export const ErrorSummaryItem = forwardRef<HTMLLIElement, ErrorSummaryItemProps>
118
112
  }
119
113
 
120
114
  return (
121
- <li ref={ref} {...rest}>
122
- <Link size="small" href={href} variant="solid" {...linkProps} onClick={onClick}>
115
+ <li className={clsx(`hds-error-summary__list-item`)} ref={ref} {...rest}>
116
+ <Link
117
+ size="small"
118
+ href={href}
119
+ variant="inverted-no-underline"
120
+ {...linkProps}
121
+ onClick={onClick}
122
+ >
123
123
  {children}
124
124
  </Link>
125
125
  </li>
@@ -128,16 +128,17 @@ export const ErrorSummaryItem = forwardRef<HTMLLIElement, ErrorSummaryItemProps>
128
128
  );
129
129
  ErrorSummaryItem.displayName = "ErrorSummary.Item";
130
130
 
131
- export type ErrorSummaryProps = Omit<MessageProps, "variant" | "icon" | "iconClassName">;
131
+ export type ErrorSummaryProps = Omit<
132
+ BoxProps,
133
+ "variant" | "closeable" | "onClose" | "closed" | "closeButtonProps"
134
+ >;
132
135
 
133
136
  export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
134
- ({ children, ...rest }, ref) => {
135
- return (
136
- <Message variant="warning" ref={ref} {...rest}>
137
- {children}
138
- </Message>
139
- );
140
- },
137
+ ({ children, className, ...rest }, ref) => (
138
+ <Box ref={ref} {...rest} className={clsx(`hds-error-summary`, className as undefined)}>
139
+ {children}
140
+ </Box>
141
+ ),
141
142
  ) as ErrorSummaryType;
142
143
  ErrorSummary.displayName = "ErrorSummary";
143
144
 
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./accordion";
2
+ export * from "./alert";
2
3
  export * from "./badge";
3
4
  export * from "./blockquote";
4
5
  export * from "./box";
@@ -1,6 +1,6 @@
1
1
  import { createContext, useContext, forwardRef, useState, useEffect, useId } from "react";
2
2
  import { clsx } from "@postenbring/hedwig-css/typed-classname";
3
- import { focusTrap } from "../utils/utils";
3
+ import { focusTrap, inertPropValue } from "../utils/utils";
4
4
  import { CloseIcon, MenuIcon } from "./icons";
5
5
 
6
6
  interface ExpandableMenuContextProps {
@@ -137,13 +137,14 @@ export const NavbarExpandableMenuContent = forwardRef<
137
137
  NavbarExpandableMenuContentProps
138
138
  >(({ children, className, ...rest }, ref) => {
139
139
  const { contentId, open } = useNavbarExpendableMenuContext();
140
+
140
141
  return (
141
142
  <section
142
143
  {...rest}
143
144
  id={contentId}
144
145
  className={clsx("hds-navbar__expandable-menu-content", className as undefined)}
145
146
  data-state={open ? "open" : "closed"}
146
- {...{ inert: open ? undefined : "true" }}
147
+ {...{ inert: inertPropValue(!open) }}
147
148
  ref={ref}
148
149
  >
149
150
  <div className={clsx("hds-navbar__expandable-menu-content-inner")}>{children}</div>
@@ -4,6 +4,7 @@
4
4
  import { clsx } from "@postenbring/hedwig-css/typed-classname";
5
5
  import { Slot } from "@radix-ui/react-slot";
6
6
  import { forwardRef } from "react";
7
+ import { inertPropValue } from "../utils";
7
8
 
8
9
  interface DimensionsFromWidthAndHeight {
9
10
  height?: number | string;
@@ -102,7 +103,7 @@ export const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(
102
103
  )}
103
104
  style={{ ...style, width, height }}
104
105
  aria-hidden
105
- {...{ inert: "true" }}
106
+ {...{ inert: inertPropValue(true) }}
106
107
  ref={ref as any}
107
108
  {...(rest as any)}
108
109
  >
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { useCallback, useEffect, useState } from "react";
2
+ import { useCallback, useEffect, useState, version } from "react";
3
3
 
4
4
  /**
5
5
  * Merges an array of refs into a single memoized callback ref or `null`.
@@ -108,3 +108,16 @@ function releaseFocusTrap(inertElements: Iterable<HTMLElement>) {
108
108
  el.removeAttribute("inert");
109
109
  }
110
110
  }
111
+
112
+ /**
113
+ * React 19 supports inert prop
114
+ * React 18 needs inert to be a string
115
+ */
116
+ const inertBooleanSupported: boolean = Number(version.split(".")[0]) >= 19;
117
+
118
+ /**
119
+ * Returns the inert prop value based on the React version.
120
+ */
121
+ export const inertPropValue: (x: boolean) => boolean | "" | undefined = inertBooleanSupported
122
+ ? (x: boolean): boolean => x
123
+ : (x: boolean): "" | undefined => (x ? "" : undefined);
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/form/error-summary/error-summary.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef } from \"react\";\nimport { Message, type MessageProps, type MessageTitleProps } from \"../../message\";\nimport { UnorderedList, type ListProps } from \"../../list\";\nimport { Link } from \"../../link\";\nimport { useMergeRefs } from \"../../utils\";\nimport { focusWithLegendOrLabelInViewport } from \"./focus\";\n\ninterface ErrorSummaryHeadingPropsAutoFocus {\n /**\n * The heading will be focused when the component mounts\n *\n * On following errornous form submissions you should manually focus the heading\n * e.g. by passing a ref and calling `ref.current.focus()`\n *\n * @default true\n */\n autoFocus?: boolean;\n}\n\ninterface ErrorSummaryHeadingPropsAs {\n /**\n * A heading level must be selected, or optionally opting out for a different element\n *\n * Use {@link ErrorSummaryHeadingPropsAsChild.asChild} if you need more control of the rendered element.\n */\n as: \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"span\" | \"div\" | \"label\" | \"p\";\n asChild?: never;\n}\n\ninterface ErrorSummaryHeadingPropsAsChild {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild: true;\n as?: never;\n}\n\nexport type ErrorSummaryHeadingProps = MessageTitleProps &\n ErrorSummaryHeadingPropsAutoFocus &\n (ErrorSummaryHeadingPropsAs | ErrorSummaryHeadingPropsAsChild);\n\nexport const ErrorSummaryHeading = forwardRef<\n HTMLParagraphElement,\n ErrorSummaryHeadingProps & (ErrorSummaryHeadingPropsAs | ErrorSummaryHeadingPropsAsChild)\n>(({ children, as: Tag, autoFocus = true, ...rest }, ref) => {\n const focusRef = useRef<HTMLElement>(null);\n const mergedRef = useMergeRefs([focusRef, ref]);\n\n useEffect(() => {\n /**\n * Hack: Safari 18 on mac at the time of writing\n * does not correctly focus it with VoiceOver without the timeout\n */\n setTimeout(() => {\n if (focusRef.current && autoFocus) {\n focusRef.current.focus();\n }\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- Only on initial render\n }, []);\n\n return (\n <Message.Title ref={mergedRef} tabIndex={-1} asChild {...rest}>\n {Tag ? <Tag>{children}</Tag> : children}\n </Message.Title>\n );\n});\nErrorSummaryHeading.displayName = \"ErrorSummary.Heading\";\n\nexport interface ErrorSummaryListProps extends ListProps {\n /**\n * Sets the size of the items (font)\n *\n * @default \"small\"\n */\n size?: ListProps[\"size\"];\n}\nexport const ErrorSummaryList = forwardRef<HTMLUListElement, ErrorSummaryListProps>(\n ({ children, style: _style, size = \"small\", ...rest }, ref) => {\n const style = {\n // Match the link `solid` style, which black underline\n \"--_hds-list-marker-color\": \"var(--hds-ui-colors-black)\",\n ..._style,\n };\n return (\n <Message.Description asChild>\n <UnorderedList size={size} ref={ref} style={style} {...rest}>\n {children}\n </UnorderedList>\n </Message.Description>\n );\n },\n);\nErrorSummaryList.displayName = \"ErrorSummary.List\";\n\nexport interface ErrorSummaryItemProps extends React.HTMLAttributes<HTMLLIElement> {\n /**\n * A hash link to the element that the error message refers to\n *\n * Must start with \"#\" as it's passed to the `href` attribute of an anchor element\n *\n * @example \"#email\"\n */\n href: `#${string}`;\n\n /**\n * Extra props to pass to the link element\n */\n linkProps?: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n}\nexport const ErrorSummaryItem = forwardRef<HTMLLIElement, ErrorSummaryItemProps>(\n ({ children, href, linkProps, ...rest }, ref) => {\n function onClick(e: React.MouseEvent<HTMLAnchorElement>) {\n linkProps?.onClick?.(e);\n if (focusWithLegendOrLabelInViewport(href.replace(\"#\", \"\"))) {\n e.preventDefault();\n }\n }\n\n return (\n <li ref={ref} {...rest}>\n <Link size=\"small\" href={href} variant=\"solid\" {...linkProps} onClick={onClick}>\n {children}\n </Link>\n </li>\n );\n },\n);\nErrorSummaryItem.displayName = \"ErrorSummary.Item\";\n\nexport type ErrorSummaryProps = Omit<MessageProps, \"variant\" | \"icon\" | \"iconClassName\">;\n\nexport const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(\n ({ children, ...rest }, ref) => {\n return (\n <Message variant=\"warning\" ref={ref} {...rest}>\n {children}\n </Message>\n );\n },\n) as ErrorSummaryType;\nErrorSummary.displayName = \"ErrorSummary\";\n\ntype ErrorSummaryType = ReturnType<typeof forwardRef<HTMLDivElement, ErrorSummaryProps>> & {\n Heading: typeof ErrorSummaryHeading;\n List: typeof ErrorSummaryList;\n Item: typeof ErrorSummaryItem;\n};\nErrorSummary.Heading = ErrorSummaryHeading;\nErrorSummary.List = ErrorSummaryList;\nErrorSummary.Item = ErrorSummaryItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,WAAW,cAAc;AA+DjC;AAtBN,IAAM,sBAAsB,WAGjC,CAAC,IAAkD,QAAQ;AAA1D,eAAE,YAAU,IAAI,KAAK,YAAY,KA5CpC,IA4CG,IAA0C,iBAA1C,IAA0C,CAAxC,YAAU,MAAS;AACtB,QAAM,WAAW,OAA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AM,eAAe;AAAA,EAC1B,CAAC,IAAuB,QAAQ;AAA/B,iBAAE,WArIL,IAqIG,IAAe,iBAAf,IAAe,CAAb;AACD,WACE,oBAAC,wCAAQ,SAAQ,WAAU,OAAc,OAAxC,EACE,WACH;AAAA,EAEJ;AACF;AACA,aAAa,cAAc;AAO3B,aAAa,UAAU;AACvB,aAAa,OAAO;AACpB,aAAa,OAAO;","names":["_a"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/accordion/accordion-content.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ children, className, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n return (\n <div\n id={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n {...{ inert: context.open ? undefined : \"true\" }}\n className={clsx(\"hds-accordion-item-content\", className as undefined)}\n ref={ref}\n {...rest}\n >\n <div className={clsx(\"hds-accordion-item-content-inner\")}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionContent.displayName = \"Accordion.Content\";\n"],"mappings":";;;;;;;;;;AACA,SAAS,YAAY,kBAAkB;AACvC,SAAS,YAAY;AAsBb;AAfD,IAAM,mBAAmB;AAAA,EAC9B,CAAC,IAAkC,QAAQ;AAA1C,iBAAE,YAAU,UAVf,IAUG,IAA0B,iBAA1B,IAA0B,CAAxB,YAAU;AACX,UAAM,UAAU,WAAW,oBAAoB;AAC/C,QAAI,YAAY,MAAM;AACpB,aAAO;AAAA,IACT;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,QAAQ;AAAA,QACZ,cAAY,QAAQ,OAAO,SAAS;AAAA,SAChC,EAAE,OAAO,QAAQ,OAAO,SAAY,OAAO,IAHhD;AAAA,QAIC,WAAW,KAAK,8BAA8B,SAAsB;AAAA,QACpE;AAAA,UACI,OANL;AAAA,QAQC,8BAAC,SAAI,WAAW,KAAK,kCAAkC,GAAI,UAAS;AAAA;AAAA,IACtE;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/navbar/navbar-expandable-menu.tsx"],"sourcesContent":["import { createContext, useContext, forwardRef, useState, useEffect, useId } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { focusTrap } from \"../utils/utils\";\nimport { CloseIcon, MenuIcon } from \"./icons\";\n\ninterface ExpandableMenuContextProps {\n open: boolean;\n setOpen: (open: boolean) => void;\n contentId: string;\n}\n\nconst ExpandableMenuContext = createContext<ExpandableMenuContextProps | null>(null);\nexport const useNavbarExpendableMenuContext = () => {\n const value = useContext(ExpandableMenuContext);\n if (value === null) {\n throw new Error(\"useNavbarExpendableMenuContext must be used within a Navbar.ExpandableMenu\");\n }\n return value;\n};\n\nexport interface NavbarExpandableMenuProps {\n children: React.ReactNode;\n}\n\n/**\n * Expandable Menu Provider\n * Handles scroll and focus locking,\n * as well as scrolling the user to the top of the page.\n *\n * If we want a sticky header in the future the scrolling should be configurable\n */\nexport function NavbarExpandableMenu({ children }: NavbarExpandableMenuProps) {\n const contentId = useId();\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n if (open) {\n window.scrollTo(0, 0);\n document.body.classList.add(clsx(\"hds-navbar-scroll-lock\"));\n const releaseFocusTrap = focusTrap(\n document.getElementsByClassName(clsx(\"hds-navbar\"))[0] as HTMLElement,\n );\n\n return () => {\n document.body.classList.remove(clsx(\"hds-navbar-scroll-lock\"));\n releaseFocusTrap();\n };\n }\n }, [open]);\n\n return (\n <ExpandableMenuContext.Provider value={{ contentId, open, setOpen }}>\n {children}\n </ExpandableMenuContext.Provider>\n );\n}\n\nNavbarExpandableMenu.displayName = \"NavbarExpandableMenu\";\n\n/**\n * Trigger\n */\nexport interface NavbarExpandableMenuTriggerProps\n extends Omit<React.HTMLAttributes<HTMLButtonElement>, \"children\"> {\n whenClosedText: React.ReactNode;\n whenClosedHelperTitle?: string;\n\n whenOpenText: React.ReactNode;\n whenOpenHelperTitle?: string;\n}\n\nexport const NavbarExpandableMenuTrigger = forwardRef<\n HTMLButtonElement,\n NavbarExpandableMenuTriggerProps\n>(\n (\n {\n whenClosedText,\n whenClosedHelperTitle,\n\n whenOpenText,\n whenOpenHelperTitle,\n\n style,\n className,\n ...rest\n },\n ref,\n ) => {\n const { contentId, open, setOpen } = useNavbarExpendableMenuContext();\n\n function toggleOpen() {\n setOpen(!open);\n }\n\n return (\n <button\n aria-expanded={open}\n aria-controls={contentId}\n className={clsx(\n \"hds-navbar__item\",\n className as undefined,\n open ? \"hds-navbar__item--open\" : \"hds-navbar__item--closed\",\n )}\n onClick={toggleOpen}\n ref={ref}\n title={open ? whenOpenHelperTitle : whenClosedHelperTitle}\n type=\"button\"\n style={{ position: \"relative\", ...style }}\n {...rest}\n >\n <span className=\"hds-navbar__item-responsive-text\">\n <span aria-hidden={!open} className={clsx(\"hds-navbar__item-whenopentext\")}>\n {whenOpenText}\n </span>\n <span aria-hidden={open} className={clsx(\"hds-navbar__item-whenclosedtext\")}>\n {whenClosedText}\n </span>\n </span>\n <span style={{ width: 32, height: 32 }}>{open ? <CloseIcon /> : <MenuIcon />}</span>\n </button>\n );\n },\n);\nNavbarExpandableMenuTrigger.displayName = \"Navbar.ExpandableMenuTrigger\";\n\n/**\n * Content\n */\nexport interface NavbarExpandableMenuContentProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport const NavbarExpandableMenuContent = forwardRef<\n HTMLDivElement,\n NavbarExpandableMenuContentProps\n>(({ children, className, ...rest }, ref) => {\n const { contentId, open } = useNavbarExpendableMenuContext();\n return (\n <section\n {...rest}\n id={contentId}\n className={clsx(\"hds-navbar__expandable-menu-content\", className as undefined)}\n data-state={open ? \"open\" : \"closed\"}\n {...{ inert: open ? undefined : \"true\" }}\n ref={ref}\n >\n <div className={clsx(\"hds-navbar__expandable-menu-content-inner\")}>{children}</div>\n </section>\n );\n});\nNavbarExpandableMenuContent.displayName = \"Navbar.ExpandableMenuContent\";\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,eAAe,YAAY,YAAY,UAAU,WAAW,aAAa;AAClF,SAAS,YAAY;AAkDjB,cA4DI,YA5DJ;AAxCJ,IAAM,wBAAwB,cAAiD,IAAI;AAC5E,IAAM,iCAAiC,MAAM;AAClD,QAAM,QAAQ,WAAW,qBAAqB;AAC9C,MAAI,UAAU,MAAM;AAClB,UAAM,IAAI,MAAM,4EAA4E;AAAA,EAC9F;AACA,SAAO;AACT;AAaO,SAAS,qBAAqB,EAAE,SAAS,GAA8B;AAC5E,QAAM,YAAY,MAAM;AACxB,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AAEtC,YAAU,MAAM;AACd,QAAI,MAAM;AACR,aAAO,SAAS,GAAG,CAAC;AACpB,eAAS,KAAK,UAAU,IAAI,KAAK,wBAAwB,CAAC;AAC1D,YAAM,mBAAmB;AAAA,QACvB,SAAS,uBAAuB,KAAK,YAAY,CAAC,EAAE,CAAC;AAAA,MACvD;AAEA,aAAO,MAAM;AACX,iBAAS,KAAK,UAAU,OAAO,KAAK,wBAAwB,CAAC;AAC7D,yBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,WAAW,MAAM,QAAQ,GAC/D,UACH;AAEJ;AAEA,qBAAqB,cAAc;AAc5B,IAAM,8BAA8B;AAAA,EAIzC,CACE,IAWA,QACG;AAZH,iBACE;AAAA;AAAA,MACA;AAAA,MAEA;AAAA,MACA;AAAA,MAEA;AAAA,MACA;AAAA,IApFN,IA4EI,IASK,iBATL,IASK;AAAA,MARH;AAAA,MACA;AAAA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CAAC;AACD,4BAA4B,cAAc;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,aAAa,WAAW,gBAAgB;AAM1C,SAAS,aACd,MACoC;AACpC,SAAa,cAAQ,MAAM;AACzB,QAAI,KAAK,MAAM,CAAC,QAAQ,QAAQ,IAAI,GAAG;AACrC,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,UAAU;AAChB,WAAK,QAAQ,CAAC,QAAQ;AACpB,YAAI,OAAO,QAAQ,YAAY;AAC7B,cAAI,KAAK;AAAA,QACX,WAAW,QAAQ,MAAM;AACvB,UAAC,IAAgD,UAAU;AAAA,QAC7D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAEF,GAAG,IAAI;AACT;AAEO,SAAS,UACd,KACmC;AACnC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAiB,CAAC;AAC5C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAiB,CAAC;AAC9C,QAAM,eAAe,YAAY,MAAM;AAjCzC;AAkCI,SAAI,2BAAK,aAAY,MAAM;AACzB,gBAAS,sCAAK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,0 @@
1
- {"version":3,"sources":["../src/skeleton/skeleton.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment -- Typings for the differnt html elements */\n/* eslint-disable @typescript-eslint/no-explicit-any -- Typings for the differnt html elements */\n\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\ninterface DimensionsFromWidthAndHeight {\n height?: number | string;\n width?: number | string;\n}\n\ninterface SkeletonPropsInner extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The visual style of the Skeleton\n */\n variant?: \"text\" | \"circle\" | \"rectangle\" | \"rounded\";\n\n /**\n * Whether to show animation or not\n * In the future the animation effect might become configurable\n *\n * default true\n */\n animation?: boolean;\n\n children?: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n\n /**\n * Convienence prop to change the rendered element.\n *\n * Use {@link SkeletonProps.asChild} if you need more control of the rendered element.\n */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"span\" | \"div\" | \"label\" | \"p\";\n}\n\nexport type SkeletonProps = SkeletonPropsInner & DimensionsFromWidthAndHeight;\n\n/**\n * Make skeleton loading states as placeholders for your content while waiting for data to load.\n *\n * **Note**\n *\n * Consider if this is really needed. The best experience is to avoid loading states altogether.\n * If your loading takes under 1 second, it better to not show anything at all.\n *\n * - Make your backend faster\n * - Preload/prefetch data\n * - Avoid data loading waterfalls\n * - Use optimistic ui when doing mutations\n *\n * **Usage**\n *\n * ```tsx\n * <Skeleton variant=\"circle\" width=\"2rem\" height=\"2rem\" />\n * <Skeleton variant=\"text\" />\n * <Skeleton variant=\"text\" width=\"80%\" />\n * <Skeleton variant=\"text\">Uses content to determine width</Skeleton>\n * <Skeleton variant=\"rectangle\" width=\"300px\" height=\"400px\" />\n * ```\n *\n * Remember to set `aria-hidden` on top level components you use that are not the `Skeleton` component.\n *\n * The `Skeleton` component does this for it self, but if you are using other components higher up in the tree, it might cause problems with screen readers\n *\n * **References**\n * - https://aksel.nav.no/komponenter/core/skeleton\n * - https://chakra-ui.com/docs/components/skeleton\n * - https://mui.com/material-ui/react-skeleton/\n */\nexport const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(\n (\n {\n as: Tag = \"div\",\n asChild,\n children,\n animation = true,\n variant = \"text\",\n width,\n height,\n className,\n style,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : Tag;\n return (\n <Component\n className={clsx(\n \"hds-skeleton\",\n `hds-skeleton--${variant}`,\n !animation && `hds-skeleton--no-animation`,\n className as undefined,\n )}\n style={{ ...style, width, height }}\n aria-hidden\n {...{ inert: \"true\" }}\n ref={ref as any}\n {...(rest as any)}\n >\n {children}\n </Component>\n );\n },\n);\nSkeleton.displayName = \"Skeleton\";\n"],"mappings":";;;;;;;AAGA,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AA0FrB;AAlBC,IAAM,WAAW;AAAA,EACtB,CACE,IAYA,QACG;AAbH,iBACE;AAAA,UAAI,MAAM;AAAA,MACV;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAxFN,IA+EI,IAUK,iBAVL,IAUK;AAAA,MATH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,YAAY,UAAU,OAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,iBAAiB,OAAO;AAAA,UACxB,CAAC,aAAa;AAAA,UACd;AAAA,QACF;AAAA,QACA,OAAO,iCAAK,QAAL,EAAY,OAAO,OAAO;AAAA,QACjC,eAAW;AAAA,SACP,EAAE,OAAO,OAAO,IATrB;AAAA,QAUC;AAAA,UACK,OAXN;AAAA,QAaE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":[]}