@postenbring/hedwig-react 4.5.2 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/alert/alert.js +82 -33
  2. package/dist/alert/alert.js.map +1 -1
  3. package/dist/alert/alert.mjs +3 -2
  4. package/dist/alert/index.js +82 -33
  5. package/dist/alert/index.js.map +1 -1
  6. package/dist/alert/index.mjs +3 -2
  7. package/dist/box/box.d.ts.map +1 -1
  8. package/dist/box/box.js +69 -20
  9. package/dist/box/box.js.map +1 -1
  10. package/dist/box/box.mjs +2 -1
  11. package/dist/box/index.js +69 -20
  12. package/dist/box/index.js.map +1 -1
  13. package/dist/box/index.mjs +2 -1
  14. package/dist/{chunk-ILN2L5NX.mjs → chunk-B2DZ6JJ4.mjs} +2 -2
  15. package/dist/{chunk-INDTHGWZ.mjs → chunk-KAVKFO2R.mjs} +2 -2
  16. package/dist/{chunk-DEABU7DB.mjs → chunk-P4AKOVM7.mjs} +9 -9
  17. package/dist/chunk-P4AKOVM7.mjs.map +1 -0
  18. package/dist/{chunk-NAXSP4VU.mjs → chunk-PKEPSKTZ.mjs} +2 -2
  19. package/dist/{chunk-YQT2TN3U.mjs → chunk-QQKPLLCE.mjs} +4 -3
  20. package/dist/chunk-QQKPLLCE.mjs.map +1 -0
  21. package/dist/{chunk-QDG2QLFV.mjs → chunk-UXZKGAZ2.mjs} +4 -4
  22. package/dist/{chunk-PZUJLRG4.mjs → chunk-WFIS2ZYQ.mjs} +2 -2
  23. package/dist/footer/footer.mjs +2 -2
  24. package/dist/footer/index.mjs +2 -2
  25. package/dist/form/error-summary/error-summary.js +104 -55
  26. package/dist/form/error-summary/error-summary.js.map +1 -1
  27. package/dist/form/error-summary/error-summary.mjs +3 -2
  28. package/dist/form/error-summary/index.js +104 -55
  29. package/dist/form/error-summary/index.js.map +1 -1
  30. package/dist/form/error-summary/index.mjs +3 -2
  31. package/dist/form/index.js +166 -117
  32. package/dist/form/index.js.map +1 -1
  33. package/dist/form/index.mjs +10 -9
  34. package/dist/help-text/help-text.js +79 -30
  35. package/dist/help-text/help-text.js.map +1 -1
  36. package/dist/help-text/help-text.mjs +3 -2
  37. package/dist/help-text/index.js +79 -30
  38. package/dist/help-text/index.js.map +1 -1
  39. package/dist/help-text/index.mjs +3 -2
  40. package/dist/index.js +104 -104
  41. package/dist/index.js.map +1 -1
  42. package/dist/index.mjs +53 -53
  43. package/dist/layout/index.mjs +3 -3
  44. package/dist/message/index.js +83 -34
  45. package/dist/message/index.js.map +1 -1
  46. package/dist/message/index.mjs +3 -2
  47. package/dist/message/message.js +83 -34
  48. package/dist/message/message.js.map +1 -1
  49. package/dist/message/message.mjs +3 -2
  50. package/dist/modal/index.js +95 -45
  51. package/dist/modal/index.js.map +1 -1
  52. package/dist/modal/index.mjs +3 -2
  53. package/dist/modal/modal.d.ts +5 -0
  54. package/dist/modal/modal.d.ts.map +1 -1
  55. package/dist/modal/modal.js +95 -45
  56. package/dist/modal/modal.js.map +1 -1
  57. package/dist/modal/modal.mjs +3 -2
  58. package/dist/navbar/icons.d.ts +2 -2
  59. package/dist/navbar/icons.d.ts.map +1 -1
  60. package/dist/navbar/navbar-expandable-menu.d.ts +1 -1
  61. package/dist/navbar/navbar-expandable-menu.d.ts.map +1 -1
  62. package/package.json +2 -2
  63. package/src/box/box.tsx +8 -8
  64. package/src/modal/modal.tsx +12 -1
  65. package/dist/chunk-DEABU7DB.mjs.map +0 -1
  66. package/dist/chunk-YQT2TN3U.mjs.map +0 -1
  67. /package/dist/{chunk-ILN2L5NX.mjs.map → chunk-B2DZ6JJ4.mjs.map} +0 -0
  68. /package/dist/{chunk-INDTHGWZ.mjs.map → chunk-KAVKFO2R.mjs.map} +0 -0
  69. /package/dist/{chunk-NAXSP4VU.mjs.map → chunk-PKEPSKTZ.mjs.map} +0 -0
  70. /package/dist/{chunk-QDG2QLFV.mjs.map → chunk-UXZKGAZ2.mjs.map} +0 -0
  71. /package/dist/{chunk-PZUJLRG4.mjs.map → chunk-WFIS2ZYQ.mjs.map} +0 -0
@@ -54,35 +54,84 @@ __export(message_exports, {
54
54
  MessageTitle: () => MessageTitle
55
55
  });
56
56
  module.exports = __toCommonJS(message_exports);
57
+ var import_react3 = require("react");
58
+ var import_typed_classname3 = require("@postenbring/hedwig-css/typed-classname");
59
+ var import_react_slot3 = require("@radix-ui/react-slot");
60
+
61
+ // src/box/box.tsx
57
62
  var import_react2 = require("react");
58
63
  var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname");
59
64
  var import_react_slot2 = require("@radix-ui/react-slot");
60
65
 
61
- // src/box/box.tsx
66
+ // src/button/button.tsx
62
67
  var import_react = require("react");
63
68
  var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
64
69
  var import_react_slot = require("@radix-ui/react-slot");
65
70
  var import_jsx_runtime = require("react/jsx-runtime");
71
+ var Button = (0, import_react.forwardRef)(
72
+ (_a, ref) => {
73
+ var _b = _a, {
74
+ asChild,
75
+ children,
76
+ variant = "primary",
77
+ size = "large",
78
+ fullWidth = false,
79
+ icon = false,
80
+ className
81
+ } = _b, rest = __objRest(_b, [
82
+ "asChild",
83
+ "children",
84
+ "variant",
85
+ "size",
86
+ "fullWidth",
87
+ "icon",
88
+ "className"
89
+ ]);
90
+ const Component = asChild ? import_react_slot.Slot : "button";
91
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
+ Component,
93
+ __spreadProps(__spreadValues({
94
+ className: (0, import_typed_classname.clsx)(
95
+ "hds-button",
96
+ `hds-button--${size}`,
97
+ `hds-button--${variant}`,
98
+ {
99
+ "hds-button--full": fullWidth === true,
100
+ "hds-button--mobile-full": fullWidth === "mobile",
101
+ "hds-button--only-icon": icon === true,
102
+ "hds-button--leading-icon": icon === "leading",
103
+ "hds-button--trailing-icon": icon === "trailing"
104
+ },
105
+ className
106
+ ),
107
+ ref
108
+ }, rest), {
109
+ children
110
+ })
111
+ );
112
+ }
113
+ );
114
+ Button.displayName = "Button";
115
+
116
+ // src/box/box.tsx
117
+ var import_jsx_runtime2 = require("react/jsx-runtime");
66
118
  function CloseIcon() {
67
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { "aria-hidden": true, xmlns: "http://www.w3.org/2000/svg", width: 32, height: 32, viewBox: "0 0 32 32", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
68
- "path",
69
- {
70
- d: "M17.5469 16.3333L22.375 11.5521L23.3594 10.5677C23.5 10.4271 23.5 10.1927 23.3594 10.0052L22.3281 8.97394C22.1406 8.83331 21.9062 8.83331 21.7656 8.97394L16 14.7864L10.1875 8.97394C10.0469 8.83331 9.8125 8.83331 9.625 8.97394L8.59375 10.0052C8.45312 10.1927 8.45312 10.4271 8.59375 10.5677L14.4062 16.3333L8.59375 22.1458C8.45312 22.2864 8.45312 22.5208 8.59375 22.7083L9.625 23.7396C9.8125 23.8802 10.0469 23.8802 10.1875 23.7396L16 17.9271L20.7812 22.7552L21.7656 23.7396C21.9062 23.8802 22.1406 23.8802 22.3281 23.7396L23.3594 22.7083C23.5 22.5208 23.5 22.2864 23.3594 22.1458L17.5469 16.3333Z",
71
- fill: "currentColor"
72
- }
73
- ) });
119
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 640 640", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M183.1 137.4C170.6 124.9 150.3 124.9 137.8 137.4C125.3 149.9 125.3 170.2 137.8 182.7L275.2 320L137.9 457.4C125.4 469.9 125.4 490.2 137.9 502.7C150.4 515.2 170.7 515.2 183.2 502.7L320.5 365.3L457.9 502.6C470.4 515.1 490.7 515.1 503.2 502.6C515.7 490.1 515.7 469.8 503.2 457.3L365.8 320L503.1 182.6C515.6 170.1 515.6 149.8 503.1 137.3C490.6 124.8 470.3 124.8 457.8 137.3L320.5 274.7L183.1 137.4z" }) });
74
120
  }
75
- var BoxCloseButton = (0, import_react.forwardRef)(
121
+ var BoxCloseButton = (0, import_react2.forwardRef)(
76
122
  (_a, ref) => {
77
123
  var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
78
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
- "button",
124
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
125
+ Button,
80
126
  __spreadProps(__spreadValues({
81
- className: (0, import_typed_classname.clsx)("hds-box__close-button", className),
127
+ className: (0, import_typed_classname2.clsx)("hds-box__close-button", className),
128
+ variant: "tertiary",
129
+ size: "small",
130
+ icon: true,
82
131
  ref,
83
132
  type: "button"
84
133
  }, rest), {
85
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CloseIcon, {})
134
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CloseIcon, {})
86
135
  })
87
136
  );
88
137
  }
@@ -100,7 +149,7 @@ var convertVariantToColor = (variant) => {
100
149
  return "neutral";
101
150
  }
102
151
  };
103
- var Box = (0, import_react.forwardRef)(
152
+ var Box = (0, import_react2.forwardRef)(
104
153
  (_a, ref) => {
105
154
  var _b = _a, {
106
155
  "data-color": color = "",
@@ -123,8 +172,8 @@ var Box = (0, import_react.forwardRef)(
123
172
  "children",
124
173
  "className"
125
174
  ]);
126
- const [closedState, setClosedState] = (0, import_react.useState)(false);
127
- const onClose = (0, import_react.useCallback)(() => {
175
+ const [closedState, setClosedState] = (0, import_react2.useState)(false);
176
+ const onClose = (0, import_react2.useCallback)(() => {
128
177
  if (onCloseProp) {
129
178
  const result = onCloseProp();
130
179
  if (result === true) {
@@ -135,13 +184,13 @@ var Box = (0, import_react.forwardRef)(
135
184
  }
136
185
  }, []);
137
186
  const closed = closedProp != null ? closedProp : closedState;
138
- const Component = asChild ? import_react_slot.Slot : "div";
187
+ const Component = asChild ? import_react_slot2.Slot : "div";
139
188
  const resolvedColor = color && color !== "" ? color : convertVariantToColor(variant);
140
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
189
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
141
190
  Component,
142
191
  __spreadProps(__spreadValues({
143
192
  "data-color": resolvedColor,
144
- className: (0, import_typed_classname.clsx)(
193
+ className: (0, import_typed_classname2.clsx)(
145
194
  "hds-box",
146
195
  { "hds-box--lighter": variant === "lighter" },
147
196
  { "hds-box--white": variant === "white" },
@@ -151,8 +200,8 @@ var Box = (0, import_react.forwardRef)(
151
200
  ref
152
201
  }, rest), {
153
202
  children: [
154
- closeable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
155
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children })
203
+ closeable ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
204
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_slot2.Slottable, { children })
156
205
  ]
157
206
  })
158
207
  );
@@ -162,46 +211,46 @@ Box.displayName = "Box";
162
211
  Box.CloseButton = BoxCloseButton;
163
212
 
164
213
  // src/message/message.tsx
165
- var import_jsx_runtime2 = require("react/jsx-runtime");
166
- var MessageTitle = (0, import_react2.forwardRef)(
214
+ var import_jsx_runtime3 = require("react/jsx-runtime");
215
+ var MessageTitle = (0, import_react3.forwardRef)(
167
216
  (_a, ref) => {
168
217
  var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
169
- const Component = asChild ? import_react_slot2.Slot : "div";
170
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
218
+ const Component = asChild ? import_react_slot3.Slot : "div";
219
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
171
220
  Component,
172
221
  __spreadValues({
173
- className: (0, import_typed_classname2.clsx)("hds-message__title", className),
222
+ className: (0, import_typed_classname3.clsx)("hds-message__title", className),
174
223
  ref
175
224
  }, rest)
176
225
  );
177
226
  }
178
227
  );
179
228
  MessageTitle.displayName = "Message.Title";
180
- var MessageDescription = (0, import_react2.forwardRef)(
229
+ var MessageDescription = (0, import_react3.forwardRef)(
181
230
  (_a, ref) => {
182
231
  var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
183
- const Component = asChild ? import_react_slot2.Slot : "div";
184
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
232
+ const Component = asChild ? import_react_slot3.Slot : "div";
233
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
185
234
  Component,
186
235
  __spreadValues({
187
- className: (0, import_typed_classname2.clsx)("hds-message__description", className),
236
+ className: (0, import_typed_classname3.clsx)("hds-message__description", className),
188
237
  ref
189
238
  }, rest)
190
239
  );
191
240
  }
192
241
  );
193
242
  MessageDescription.displayName = "Message.Description";
194
- var Message = (0, import_react2.forwardRef)(
243
+ var Message = (0, import_react3.forwardRef)(
195
244
  (_a, ref) => {
196
245
  var _b = _a, { children, className, variant = "success", icon, iconClassName } = _b, rest = __objRest(_b, ["children", "className", "variant", "icon", "iconClassName"]);
197
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
246
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
198
247
  Box,
199
248
  __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, variant === "warning" ? { "data-color-scheme": "light" } : {}), {
200
- className: (0, import_typed_classname2.clsx)(`hds-message`, `hds-message--${variant}`, className),
249
+ className: (0, import_typed_classname3.clsx)(`hds-message`, `hds-message--${variant}`, className),
201
250
  ref
202
251
  }), rest), {
203
252
  children: [
204
- variant === "neutral" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-message--neutral__icon", iconClassName), children: icon }),
253
+ variant === "neutral" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_typed_classname3.clsx)("hds-message--neutral__icon", iconClassName), children: icon }),
205
254
  children
206
255
  ]
207
256
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/message/message.tsx","../../src/box/box.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\nexport interface MessageTitleProps extends React.HTMLAttributes<HTMLParagraphElement> {\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}\nexport const MessageTitle = forwardRef<HTMLParagraphElement, MessageTitleProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-message__title\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nMessageTitle.displayName = \"Message.Title\";\n\nexport interface MessageDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {\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}\nexport const MessageDescription = forwardRef<HTMLParagraphElement, MessageDescriptionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-message__description\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nMessageDescription.displayName = \"Message.Description\";\n\nexport type MessageProps = (\n | {\n variant?: \"success\" | \"attention\" | \"warning\" | \"info\";\n icon?: never;\n iconClassName?: never;\n }\n | {\n variant: \"neutral\";\n icon?: React.ReactNode;\n iconClassName?: string;\n }\n) &\n Omit<BoxProps, \"variant\" | \"asChild\">;\n\n/** @deprecated Use Alert component instead */\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(\n ({ children, className, variant = \"success\", icon, iconClassName, ...rest }, ref) => {\n return (\n <Box\n {...(variant === \"warning\" ? { \"data-color-scheme\": \"light\" } : {})}\n className={clsx(`hds-message`, `hds-message--${variant}`, className as undefined)}\n ref={ref}\n {...rest}\n >\n {variant === \"neutral\" && (\n <div className={clsx(\"hds-message--neutral__icon\", iconClassName as undefined)}>\n {icon}\n </div>\n )}\n {children}\n </Box>\n );\n },\n) as MessageType;\nMessage.displayName = \"Message\";\n\ntype MessageType = ReturnType<typeof forwardRef<HTMLDivElement, MessageProps>> & {\n Title: typeof MessageTitle;\n Description: typeof MessageDescription;\n};\nMessage.Title = MessageTitle;\nMessage.Description = MessageDescription;\n","import { forwardRef, useCallback, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot, Slottable } from \"@radix-ui/react-slot\";\n\nfunction CloseIcon() {\n return (\n <svg aria-hidden xmlns=\"http://www.w3.org/2000/svg\" width={32} height={32} viewBox=\"0 0 32 32\">\n <path\n d=\"M17.5469 16.3333L22.375 11.5521L23.3594 10.5677C23.5 10.4271 23.5 10.1927 23.3594 10.0052L22.3281 8.97394C22.1406 8.83331 21.9062 8.83331 21.7656 8.97394L16 14.7864L10.1875 8.97394C10.0469 8.83331 9.8125 8.83331 9.625 8.97394L8.59375 10.0052C8.45312 10.1927 8.45312 10.4271 8.59375 10.5677L14.4062 16.3333L8.59375 22.1458C8.45312 22.2864 8.45312 22.5208 8.59375 22.7083L9.625 23.7396C9.8125 23.8802 10.0469 23.8802 10.1875 23.7396L16 17.9271L20.7812 22.7552L21.7656 23.7396C21.9062 23.8802 22.1406 23.8802 22.3281 23.7396L23.3594 22.7083C23.5 22.5208 23.5 22.2864 23.3594 22.1458L17.5469 16.3333Z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n}\n\nexport type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, \"children\">;\nexport const BoxCloseButton = forwardRef<HTMLButtonElement, BoxCloseButtonProps>(\n ({ className, ...rest }, ref) => {\n return (\n <button\n className={clsx(\"hds-box__close-button\", className as undefined)}\n ref={ref}\n type=\"button\"\n {...rest}\n >\n <CloseIcon />\n </button>\n );\n },\n);\nBoxCloseButton.displayName = \"Box.CloseButton\";\n\nexport interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n\n /**\n * Posten/Bring-spesific variant of the box. NB: warning variant is deprecated, use data-color=\"warning\" instead.\n *\n * @default \"light-grey\"\n */\n variant?:\n | \"light-grey\"\n | \"lighter\"\n | \"white\"\n /** @deprecated use data-color=\"warning\" instead */\n | \"warning\";\n\n /**\n * Color variant of the box\n *\n */\n\n \"data-color\"?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"error\";\n\n /**\n * If `true`, a close button will be shown.\n * Use when you want to control the close button using the BoxCloseButton component.\n *\n * @default false\n */\n closeable?: boolean;\n\n /**\n * Callback fired when the component requests to be closed.\n * If not set, the component will be closed without any user interaction.\n *\n * If set, and the handler returns non-true value, the component will not be closed.\n * Use this if you want to control the closing of the component, using the `closed` prop\n *\n * If set, and the handler returns the true, the component will be closed.\n * Use this with `window.confirm()` to ask the user to confirm closing the component.\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- It's fine, I want to have the boolean in the type\n onClose?: () => boolean | unknown;\n\n /**\n * If `true`, the box will be closed and hidden from view\n */\n closed?: boolean;\n\n /**\n * Props applied to the close button element.\n */\n closeButtonProps?: BoxCloseButtonProps;\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\nconst convertVariantToColor = (variant: BoxProps[\"variant\"] | \"\") => {\n switch (variant) {\n case \"lighter\":\n return \"\";\n case \"white\":\n return \"\";\n case \"warning\":\n return \"warning\";\n default:\n return \"neutral\";\n }\n};\n\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(\n (\n {\n \"data-color\": color = \"\",\n asChild,\n variant,\n closeable = false,\n onClose: onCloseProp,\n closed: closedProp,\n closeButtonProps,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const [closedState, setClosedState] = useState(false);\n const onClose = useCallback(() => {\n if (onCloseProp) {\n const result = onCloseProp();\n if (result === true) {\n setClosedState(true);\n }\n } else {\n setClosedState(true);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, []);\n const closed = closedProp ?? closedState;\n const Component = asChild ? Slot : \"div\";\n\n const resolvedColor = color && color !== \"\" ? color : convertVariantToColor(variant);\n\n return (\n <Component\n data-color={resolvedColor}\n className={clsx(\n \"hds-box\",\n { \"hds-box--lighter\": variant === \"lighter\" },\n { \"hds-box--white\": variant === \"white\" },\n { \"hds-box--closed\": closed },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {closeable ? <BoxCloseButton onClick={onClose} {...closeButtonProps} /> : null}\n <Slottable>{children}</Slottable>\n </Component>\n );\n },\n) as BoxType;\nBox.displayName = \"Box\";\n\nBox.CloseButton = BoxCloseButton;\n\ntype BoxType = ReturnType<typeof forwardRef<HTMLDivElement, BoxProps>> & {\n CloseButton: typeof BoxCloseButton;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA2B;AAC3B,IAAAC,0BAAqB;AACrB,IAAAC,qBAAqB;;;ACFrB,mBAAkD;AAClD,6BAAqB;AACrB,wBAAgC;AAK1B;AAHN,SAAS,YAAY;AACnB,SACE,4CAAC,SAAI,eAAW,MAAC,OAAM,8BAA6B,OAAO,IAAI,QAAQ,IAAI,SAAQ,aACjF;AAAA,IAAC;AAAA;AAAA,MACC,GAAE;AAAA,MACF,MAAK;AAAA;AAAA,EACP,GACF;AAEJ;AAGO,IAAM,qBAAiB;AAAA,EAC5B,CAAC,IAAwB,QAAQ;AAAhC,iBAAE,YAjBL,IAiBG,IAAgB,iBAAhB,IAAgB,CAAd;AACD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,6BAAK,yBAAyB,SAAsB;AAAA,QAC/D;AAAA,QACA,MAAK;AAAA,SACD,OAJL;AAAA,QAMC,sDAAC,aAAU;AAAA;AAAA,IACb;AAAA,E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names":["import_react","import_typed_classname","import_react_slot","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../src/message/message.tsx","../../src/box/box.tsx","../../src/button/button.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\nexport interface MessageTitleProps extends React.HTMLAttributes<HTMLParagraphElement> {\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}\nexport const MessageTitle = forwardRef<HTMLParagraphElement, MessageTitleProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-message__title\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nMessageTitle.displayName = \"Message.Title\";\n\nexport interface MessageDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {\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}\nexport const MessageDescription = forwardRef<HTMLParagraphElement, MessageDescriptionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-message__description\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nMessageDescription.displayName = \"Message.Description\";\n\nexport type MessageProps = (\n | {\n variant?: \"success\" | \"attention\" | \"warning\" | \"info\";\n icon?: never;\n iconClassName?: never;\n }\n | {\n variant: \"neutral\";\n icon?: React.ReactNode;\n iconClassName?: string;\n }\n) &\n Omit<BoxProps, \"variant\" | \"asChild\">;\n\n/** @deprecated Use Alert component instead */\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(\n ({ children, className, variant = \"success\", icon, iconClassName, ...rest }, ref) => {\n return (\n <Box\n {...(variant === \"warning\" ? { \"data-color-scheme\": \"light\" } : {})}\n className={clsx(`hds-message`, `hds-message--${variant}`, className as undefined)}\n ref={ref}\n {...rest}\n >\n {variant === \"neutral\" && (\n <div className={clsx(\"hds-message--neutral__icon\", iconClassName as undefined)}>\n {icon}\n </div>\n )}\n {children}\n </Box>\n );\n },\n) as MessageType;\nMessage.displayName = \"Message\";\n\ntype MessageType = ReturnType<typeof forwardRef<HTMLDivElement, MessageProps>> & {\n Title: typeof MessageTitle;\n Description: typeof MessageDescription;\n};\nMessage.Title = MessageTitle;\nMessage.Description = MessageDescription;\n","import { forwardRef, useCallback, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot, Slottable } from \"@radix-ui/react-slot\";\nimport { Button } from \"../button/button\";\n\nfunction CloseIcon() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 640 640\">\n <path d=\"M183.1 137.4C170.6 124.9 150.3 124.9 137.8 137.4C125.3 149.9 125.3 170.2 137.8 182.7L275.2 320L137.9 457.4C125.4 469.9 125.4 490.2 137.9 502.7C150.4 515.2 170.7 515.2 183.2 502.7L320.5 365.3L457.9 502.6C470.4 515.1 490.7 515.1 503.2 502.6C515.7 490.1 515.7 469.8 503.2 457.3L365.8 320L503.1 182.6C515.6 170.1 515.6 149.8 503.1 137.3C490.6 124.8 470.3 124.8 457.8 137.3L320.5 274.7L183.1 137.4z\" />\n </svg>\n );\n}\nexport type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, \"children\">;\nexport const BoxCloseButton = forwardRef<HTMLButtonElement, BoxCloseButtonProps>(\n ({ className, ...rest }, ref) => {\n return (\n <Button\n className={clsx(\"hds-box__close-button\", className as undefined)}\n variant=\"tertiary\"\n size=\"small\"\n icon\n ref={ref}\n type=\"button\"\n {...rest}\n >\n <CloseIcon />\n </Button>\n );\n },\n);\nBoxCloseButton.displayName = \"Box.CloseButton\";\n\nexport interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n\n /**\n * Posten/Bring-spesific variant of the box. NB: warning variant is deprecated, use data-color=\"warning\" instead.\n *\n * @default \"light-grey\"\n */\n variant?:\n | \"light-grey\"\n | \"lighter\"\n | \"white\"\n /** @deprecated use data-color=\"warning\" instead */\n | \"warning\";\n\n /**\n * Color variant of the box\n *\n */\n\n \"data-color\"?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"error\";\n\n /**\n * If `true`, a close button will be shown.\n * Use when you want to control the close button using the BoxCloseButton component.\n *\n * @default false\n */\n closeable?: boolean;\n\n /**\n * Callback fired when the component requests to be closed.\n * If not set, the component will be closed without any user interaction.\n *\n * If set, and the handler returns non-true value, the component will not be closed.\n * Use this if you want to control the closing of the component, using the `closed` prop\n *\n * If set, and the handler returns the true, the component will be closed.\n * Use this with `window.confirm()` to ask the user to confirm closing the component.\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- It's fine, I want to have the boolean in the type\n onClose?: () => boolean | unknown;\n\n /**\n * If `true`, the box will be closed and hidden from view\n */\n closed?: boolean;\n\n /**\n * Props applied to the close button element.\n */\n closeButtonProps?: BoxCloseButtonProps;\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\nconst convertVariantToColor = (variant: BoxProps[\"variant\"] | \"\") => {\n switch (variant) {\n case \"lighter\":\n return \"\";\n case \"white\":\n return \"\";\n case \"warning\":\n return \"warning\";\n default:\n return \"neutral\";\n }\n};\n\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(\n (\n {\n \"data-color\": color = \"\",\n asChild,\n variant,\n closeable = false,\n onClose: onCloseProp,\n closed: closedProp,\n closeButtonProps,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const [closedState, setClosedState] = useState(false);\n const onClose = useCallback(() => {\n if (onCloseProp) {\n const result = onCloseProp();\n if (result === true) {\n setClosedState(true);\n }\n } else {\n setClosedState(true);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, []);\n const closed = closedProp ?? closedState;\n const Component = asChild ? Slot : \"div\";\n\n const resolvedColor = color && color !== \"\" ? color : convertVariantToColor(variant);\n\n return (\n <Component\n data-color={resolvedColor}\n className={clsx(\n \"hds-box\",\n { \"hds-box--lighter\": variant === \"lighter\" },\n { \"hds-box--white\": variant === \"white\" },\n { \"hds-box--closed\": closed },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {closeable ? <BoxCloseButton onClick={onClose} {...closeButtonProps} /> : null}\n <Slottable>{children}</Slottable>\n </Component>\n );\n },\n) as BoxType;\nBox.displayName = \"Box\";\n\nBox.CloseButton = BoxCloseButton;\n\ntype BoxType = ReturnType<typeof forwardRef<HTMLDivElement, BoxProps>> & {\n CloseButton: typeof BoxCloseButton;\n};\n","import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\n/**\n * @deprecated The \"inverted\" variant is deprecated. Use \"primary\", \"secondary\", or \"tertiary\" instead.\n */\nexport type DeprecatedVariant = \"inverted\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n *\n * @default \"large\"\n */\n size?: \"small\" | \"large\";\n\n /**\n * The background and fill of the button\n *\n * @default \"primary\"\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\" | DeprecatedVariant;\n\n /**\n * Make the button use 100% width available.\n * Using the \"mobile\" it only stretch to full width on smaller screens\n */\n fullWidth?: boolean | \"mobile\";\n\n /**\n * Specify that there is an icon in the button.\n * `icon`: There is only an icon in the button.\n * `icon=\"leading\"`: There is an icon before the text.\n * `icon=\"trailing\"`: There is an icon after the text.\n *\n * @default false\n */\n icon?: boolean | \"leading\" | \"trailing\";\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/**\n * Button component\n *\n * @example\n * <Button variant=\"primary\">Primary</Button>\n * <Button variant=\"secondary\" size=\"large\">Secondary</Button>\n * <Button variant=\"tertiary\" fullWidth=\"mobile\">Tertiary</Button>\n * <Button icon=\"leading\"><LeadingIcon />Leading icon</Button>\n *\n * @example\n * // If used for navigation use the `asChild` prop with a anchor element as a child.\n * <Button asChild><a href=\"/home\">Home</a></Button>\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n asChild,\n children,\n variant = \"primary\",\n size = \"large\",\n fullWidth = false,\n icon = false,\n className,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : \"button\";\n\n return (\n <Component\n className={clsx(\n \"hds-button\",\n `hds-button--${size}`,\n `hds-button--${variant}`,\n {\n \"hds-button--full\": fullWidth === true,\n \"hds-button--mobile-full\": fullWidth === \"mobile\",\n \"hds-button--only-icon\": icon === true,\n \"hds-button--leading-icon\": icon === \"leading\",\n \"hds-button--trailing-icon\": icon === \"trailing\",\n },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nButton.displayName = \"Button\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA2B;AAC3B,IAAAC,0BAAqB;AACrB,IAAAC,qBAAqB;;;ACFrB,IAAAC,gBAAkD;AAClD,IAAAC,0BAAqB;AACrB,IAAAC,qBAAgC;;;ACFhC,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AA4Ef;AAjBC,IAAM,aAAS;AAAA,EACpB,CACE,IAUA,QACG;AAXH,iBACE;AAAA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,OAAO;AAAA,MACP;AAAA,IAtEN,IA+DI,IAQK,iBARL,IAQK;AAAA,MAPH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,YAAY,UAAU,yB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A,aAAa,cAAc;AAUpB,IAAM,yBAAqB;AAAA,EAChC,CAAC,IAAiC,QAAQ;AAAzC,iBAAE,WAAS,UApCd,IAoCG,IAAyB,iBAAzB,IAAyB,CAAvB,WAAS;AACV,UAAM,YAAY,UAAU,0BAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,8BAAK,4BAA4B,SAAsB;AAAA,QAClE;AAAA,SACI;AAAA,IACN;AAAA,EAEJ;AACF;AACA,mBAAmB,cAAc;AAiB1B,IAAM,cAAU;AAAA,EACrB,CAAC,IAA4E,QAAQ;AAApF,iBAAE,YAAU,WAAW,UAAU,WAAW,MAAM,cAjErD,IAiEG,IAAoE,iBAApE,IAAoE,CAAlE,YAAU,aAAW,WAAqB,QAAM;AACjD,WACE;AAAA,MAAC;AAAA,oEACM,YAAY,YAAY,EAAE,qBAAqB,QAAQ,IAAI,CAAC,IADlE;AAAA,QAEC,eAAW,8BAAK,eAAe,gBAAgB,OAAO,IAAI,SAAsB;AAAA,QAChF;AAAA,UACI,OAJL;AAAA,QAME;AAAA,sBAAY,aACX,6CAAC,SAAI,eAAW,8BAAK,8BAA8B,aAA0B,GAC1E,gBACH;AAAA,UAED;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,QAAQ,cAAc;AAMtB,QAAQ,QAAQ;AAChB,QAAQ,cAAc;","names":["import_react","import_typed_classname","import_react_slot","import_react","import_typed_classname","import_react_slot","import_jsx_runtime","import_jsx_runtime"]}
@@ -2,8 +2,9 @@ import {
2
2
  Message,
3
3
  MessageDescription,
4
4
  MessageTitle
5
- } from "../chunk-ILN2L5NX.mjs";
6
- import "../chunk-DEABU7DB.mjs";
5
+ } from "../chunk-B2DZ6JJ4.mjs";
6
+ import "../chunk-P4AKOVM7.mjs";
7
+ import "../chunk-45Q2TCH6.mjs";
7
8
  import "../chunk-YOSPWY5K.mjs";
8
9
  export {
9
10
  Message,
@@ -67,35 +67,84 @@ __export(modal_exports, {
67
67
  module.exports = __toCommonJS(modal_exports);
68
68
 
69
69
  // src/modal/modal.tsx
70
- var import_react3 = require("react");
70
+ var import_react4 = require("react");
71
+ var import_typed_classname3 = require("@postenbring/hedwig-css/typed-classname");
72
+ var import_react_slot3 = require("@radix-ui/react-slot");
73
+
74
+ // src/box/box.tsx
75
+ var import_react2 = require("react");
71
76
  var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname");
72
77
  var import_react_slot2 = require("@radix-ui/react-slot");
73
78
 
74
- // src/box/box.tsx
79
+ // src/button/button.tsx
75
80
  var import_react = require("react");
76
81
  var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
77
82
  var import_react_slot = require("@radix-ui/react-slot");
78
83
  var import_jsx_runtime = require("react/jsx-runtime");
84
+ var Button = (0, import_react.forwardRef)(
85
+ (_a, ref) => {
86
+ var _b = _a, {
87
+ asChild,
88
+ children,
89
+ variant = "primary",
90
+ size = "large",
91
+ fullWidth = false,
92
+ icon = false,
93
+ className
94
+ } = _b, rest = __objRest(_b, [
95
+ "asChild",
96
+ "children",
97
+ "variant",
98
+ "size",
99
+ "fullWidth",
100
+ "icon",
101
+ "className"
102
+ ]);
103
+ const Component = asChild ? import_react_slot.Slot : "button";
104
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
105
+ Component,
106
+ __spreadProps(__spreadValues({
107
+ className: (0, import_typed_classname.clsx)(
108
+ "hds-button",
109
+ `hds-button--${size}`,
110
+ `hds-button--${variant}`,
111
+ {
112
+ "hds-button--full": fullWidth === true,
113
+ "hds-button--mobile-full": fullWidth === "mobile",
114
+ "hds-button--only-icon": icon === true,
115
+ "hds-button--leading-icon": icon === "leading",
116
+ "hds-button--trailing-icon": icon === "trailing"
117
+ },
118
+ className
119
+ ),
120
+ ref
121
+ }, rest), {
122
+ children
123
+ })
124
+ );
125
+ }
126
+ );
127
+ Button.displayName = "Button";
128
+
129
+ // src/box/box.tsx
130
+ var import_jsx_runtime2 = require("react/jsx-runtime");
79
131
  function CloseIcon() {
80
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { "aria-hidden": true, xmlns: "http://www.w3.org/2000/svg", width: 32, height: 32, viewBox: "0 0 32 32", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
- "path",
82
- {
83
- d: "M17.5469 16.3333L22.375 11.5521L23.3594 10.5677C23.5 10.4271 23.5 10.1927 23.3594 10.0052L22.3281 8.97394C22.1406 8.83331 21.9062 8.83331 21.7656 8.97394L16 14.7864L10.1875 8.97394C10.0469 8.83331 9.8125 8.83331 9.625 8.97394L8.59375 10.0052C8.45312 10.1927 8.45312 10.4271 8.59375 10.5677L14.4062 16.3333L8.59375 22.1458C8.45312 22.2864 8.45312 22.5208 8.59375 22.7083L9.625 23.7396C9.8125 23.8802 10.0469 23.8802 10.1875 23.7396L16 17.9271L20.7812 22.7552L21.7656 23.7396C21.9062 23.8802 22.1406 23.8802 22.3281 23.7396L23.3594 22.7083C23.5 22.5208 23.5 22.2864 23.3594 22.1458L17.5469 16.3333Z",
84
- fill: "currentColor"
85
- }
86
- ) });
132
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 640 640", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M183.1 137.4C170.6 124.9 150.3 124.9 137.8 137.4C125.3 149.9 125.3 170.2 137.8 182.7L275.2 320L137.9 457.4C125.4 469.9 125.4 490.2 137.9 502.7C150.4 515.2 170.7 515.2 183.2 502.7L320.5 365.3L457.9 502.6C470.4 515.1 490.7 515.1 503.2 502.6C515.7 490.1 515.7 469.8 503.2 457.3L365.8 320L503.1 182.6C515.6 170.1 515.6 149.8 503.1 137.3C490.6 124.8 470.3 124.8 457.8 137.3L320.5 274.7L183.1 137.4z" }) });
87
133
  }
88
- var BoxCloseButton = (0, import_react.forwardRef)(
134
+ var BoxCloseButton = (0, import_react2.forwardRef)(
89
135
  (_a, ref) => {
90
136
  var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
91
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
- "button",
137
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
138
+ Button,
93
139
  __spreadProps(__spreadValues({
94
- className: (0, import_typed_classname.clsx)("hds-box__close-button", className),
140
+ className: (0, import_typed_classname2.clsx)("hds-box__close-button", className),
141
+ variant: "tertiary",
142
+ size: "small",
143
+ icon: true,
95
144
  ref,
96
145
  type: "button"
97
146
  }, rest), {
98
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CloseIcon, {})
147
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CloseIcon, {})
99
148
  })
100
149
  );
101
150
  }
@@ -113,7 +162,7 @@ var convertVariantToColor = (variant) => {
113
162
  return "neutral";
114
163
  }
115
164
  };
116
- var Box = (0, import_react.forwardRef)(
165
+ var Box = (0, import_react2.forwardRef)(
117
166
  (_a, ref) => {
118
167
  var _b = _a, {
119
168
  "data-color": color = "",
@@ -136,8 +185,8 @@ var Box = (0, import_react.forwardRef)(
136
185
  "children",
137
186
  "className"
138
187
  ]);
139
- const [closedState, setClosedState] = (0, import_react.useState)(false);
140
- const onClose = (0, import_react.useCallback)(() => {
188
+ const [closedState, setClosedState] = (0, import_react2.useState)(false);
189
+ const onClose = (0, import_react2.useCallback)(() => {
141
190
  if (onCloseProp) {
142
191
  const result = onCloseProp();
143
192
  if (result === true) {
@@ -148,13 +197,13 @@ var Box = (0, import_react.forwardRef)(
148
197
  }
149
198
  }, []);
150
199
  const closed = closedProp != null ? closedProp : closedState;
151
- const Component = asChild ? import_react_slot.Slot : "div";
200
+ const Component = asChild ? import_react_slot2.Slot : "div";
152
201
  const resolvedColor = color && color !== "" ? color : convertVariantToColor(variant);
153
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
202
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
154
203
  Component,
155
204
  __spreadProps(__spreadValues({
156
205
  "data-color": resolvedColor,
157
- className: (0, import_typed_classname.clsx)(
206
+ className: (0, import_typed_classname2.clsx)(
158
207
  "hds-box",
159
208
  { "hds-box--lighter": variant === "lighter" },
160
209
  { "hds-box--white": variant === "white" },
@@ -164,8 +213,8 @@ var Box = (0, import_react.forwardRef)(
164
213
  ref
165
214
  }, rest), {
166
215
  children: [
167
- closeable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
168
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children })
216
+ closeable ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
217
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_slot2.Slottable, { children })
169
218
  ]
170
219
  })
171
220
  );
@@ -176,7 +225,7 @@ Box.CloseButton = BoxCloseButton;
176
225
 
177
226
  // src/utils/utils.ts
178
227
  var React = __toESM(require("react"));
179
- var import_react2 = require("react");
228
+ var import_react3 = require("react");
180
229
  function useMergeRefs(refs) {
181
230
  return React.useMemo(() => {
182
231
  if (refs.every((ref) => ref === null)) {
@@ -193,56 +242,56 @@ function useMergeRefs(refs) {
193
242
  };
194
243
  }, refs);
195
244
  }
196
- var inertBooleanSupported = Number(import_react2.version.split(".")[0]) >= 19;
245
+ var inertBooleanSupported = Number(import_react3.version.split(".")[0]) >= 19;
197
246
 
198
247
  // src/modal/modal.tsx
199
- var import_jsx_runtime2 = require("react/jsx-runtime");
200
- var ModalHeader = (0, import_react3.forwardRef)(
248
+ var import_jsx_runtime3 = require("react/jsx-runtime");
249
+ var ModalHeader = (0, import_react4.forwardRef)(
201
250
  (_a, ref) => {
202
251
  var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
203
- const Component = asChild ? import_react_slot2.Slot : "h1";
204
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
252
+ const Component = asChild ? import_react_slot3.Slot : "h1";
253
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
205
254
  Component,
206
255
  __spreadValues({
207
- className: (0, import_typed_classname2.clsx)("hds-modal__header", className),
256
+ className: (0, import_typed_classname3.clsx)("hds-modal__header", className),
208
257
  ref
209
258
  }, rest)
210
259
  );
211
260
  }
212
261
  );
213
262
  ModalHeader.displayName = "Modal.Header";
214
- var ModalContent = (0, import_react3.forwardRef)(
263
+ var ModalContent = (0, import_react4.forwardRef)(
215
264
  (_a, ref) => {
216
265
  var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
217
- const Component = asChild ? import_react_slot2.Slot : "div";
218
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
266
+ const Component = asChild ? import_react_slot3.Slot : "div";
267
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
219
268
  Component,
220
269
  __spreadValues({
221
- className: (0, import_typed_classname2.clsx)("hds-modal__content", className),
270
+ className: (0, import_typed_classname3.clsx)("hds-modal__content", className),
222
271
  ref
223
272
  }, rest)
224
273
  );
225
274
  }
226
275
  );
227
276
  ModalContent.displayName = "Modal.Content";
228
- var ModalFooter = (0, import_react3.forwardRef)(
277
+ var ModalFooter = (0, import_react4.forwardRef)(
229
278
  (_a, ref) => {
230
279
  var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
231
- const Component = asChild ? import_react_slot2.Slot : "footer";
232
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
280
+ const Component = asChild ? import_react_slot3.Slot : "footer";
281
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
233
282
  Component,
234
283
  __spreadValues({
235
- className: (0, import_typed_classname2.clsx)("hds-modal__footer", className),
284
+ className: (0, import_typed_classname3.clsx)("hds-modal__footer", className),
236
285
  ref
237
286
  }, rest)
238
287
  );
239
288
  }
240
289
  );
241
290
  ModalFooter.displayName = "Modal.Footer";
242
- var Modal = (0, import_react3.forwardRef)(
291
+ var Modal = (0, import_react4.forwardRef)(
243
292
  (_a, ref) => {
244
- var _b = _a, { children, className, open, closeOnBackdropClick, onClick } = _b, rest = __objRest(_b, ["children", "className", "open", "closeOnBackdropClick", "onClick"]);
245
- const modalRef = (0, import_react3.useRef)(null);
293
+ var _b = _a, { children, className, open, closeOnBackdropClick, closeButtonProps, onClick } = _b, rest = __objRest(_b, ["children", "className", "open", "closeOnBackdropClick", "closeButtonProps", "onClick"]);
294
+ const modalRef = (0, import_react4.useRef)(null);
246
295
  const mergedRef = useMergeRefs([modalRef, ref]);
247
296
  function onCloseButtonClick() {
248
297
  var _a2;
@@ -250,7 +299,7 @@ var Modal = (0, import_react3.forwardRef)(
250
299
  return false;
251
300
  }
252
301
  useScrollLock(modalRef, "hds-modal-scroll-lock");
253
- (0, import_react3.useEffect)(() => {
302
+ (0, import_react4.useEffect)(() => {
254
303
  if (modalRef.current && open !== void 0) {
255
304
  if (open && !modalRef.current.open) {
256
305
  modalRef.current.showModal();
@@ -265,16 +314,17 @@ var Modal = (0, import_react3.forwardRef)(
265
314
  }
266
315
  onClick == null ? void 0 : onClick(e);
267
316
  }
268
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
317
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
269
318
  Box,
270
319
  {
271
320
  asChild: true,
272
- className: (0, import_typed_classname2.clsx)("hds-modal", className),
321
+ className: (0, import_typed_classname3.clsx)("hds-modal", className),
273
322
  closeable: true,
274
323
  onClick: onDialogClick,
275
324
  onClose: onCloseButtonClick,
276
325
  variant: "white",
277
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dialog", __spreadProps(__spreadValues({ ref: mergedRef }, rest), { children }))
326
+ closeButtonProps,
327
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dialog", __spreadProps(__spreadValues({ ref: mergedRef }, rest), { children }))
278
328
  }
279
329
  );
280
330
  }
@@ -284,7 +334,7 @@ Modal.Header = ModalHeader;
284
334
  Modal.Content = ModalContent;
285
335
  Modal.Footer = ModalFooter;
286
336
  function useScrollLock(modalRef, bodyClass) {
287
- (0, import_react3.useEffect)(() => {
337
+ (0, import_react4.useEffect)(() => {
288
338
  if (!modalRef.current) return;
289
339
  if (modalRef.current.open) document.body.classList.add(bodyClass);
290
340
  const observer = new MutationObserver(() => {