@postenbring/hedwig-react 0.0.84 → 0.0.86

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.
@@ -1,2622 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __getProtoOf = Object.getPrototypeOf;
10
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __objRest = (source, exclude) => {
26
- var target = {};
27
- for (var prop in source)
28
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
- target[prop] = source[prop];
30
- if (source != null && __getOwnPropSymbols)
31
- for (var prop of __getOwnPropSymbols(source)) {
32
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
- target[prop] = source[prop];
34
- }
35
- return target;
36
- };
37
- var __export = (target, all) => {
38
- for (var name in all)
39
- __defProp(target, name, { get: all[name], enumerable: true });
40
- };
41
- var __copyProps = (to, from, except, desc) => {
42
- if (from && typeof from === "object" || typeof from === "function") {
43
- for (let key of __getOwnPropNames(from))
44
- if (!__hasOwnProp.call(to, key) && key !== except)
45
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
- }
47
- return to;
48
- };
49
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
- // If the importer is in node compatibility mode or this is not an ESM
51
- // file that has been converted to a CommonJS file using a Babel-
52
- // compatible transform (i.e. "__esModule" has not been set), then set
53
- // "default" to the CommonJS "module.exports" for node compatibility.
54
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
55
- mod
56
- ));
57
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
58
-
59
- // src/index-no-css.tsx
60
- var index_no_css_exports = {};
61
- __export(index_no_css_exports, {
62
- Accordion: () => Accordion,
63
- AccordionContent: () => AccordionContent,
64
- AccordionHeader: () => AccordionHeader,
65
- AccordionItem: () => AccordionItem,
66
- AutoAnimateHeight: () => AutoAnimateHeight,
67
- Badge: () => Badge,
68
- Box: () => Box,
69
- BoxCloseButton: () => BoxCloseButton,
70
- Breadcrumbs: () => Breadcrumbs,
71
- Button: () => Button,
72
- Card: () => Card,
73
- CardBody: () => CardBody,
74
- CardBodyAction: () => CardBodyAction,
75
- CardBodyActionArrow: () => CardBodyActionArrow,
76
- CardBodyDescription: () => CardBodyDescription,
77
- CardBodyHeader: () => CardBodyHeader,
78
- CardBodyHeaderOverline: () => CardBodyHeaderOverline,
79
- CardBodyHeaderTitle: () => CardBodyHeaderTitle,
80
- CardMedia: () => CardMedia,
81
- CardMediaImg: () => CardMediaImg,
82
- Checkbox: () => Checkbox,
83
- Container: () => Container,
84
- DatePicker: () => DatePicker,
85
- DescriptionList: () => DescriptionList,
86
- ErrorMessage: () => ErrorMessage,
87
- Fieldset: () => Fieldset,
88
- Footer: () => Footer,
89
- FooterButtonLink: () => FooterButtonLink,
90
- FooterLinkSection: () => FooterLinkSection,
91
- FooterLinkSections: () => FooterLinkSections,
92
- FooterLogo: () => FooterLogo,
93
- Grid: () => Grid,
94
- GridItem: () => GridItem,
95
- HStack: () => HStack,
96
- HelpText: () => HelpText,
97
- Input: () => Input,
98
- Link: () => Link,
99
- LinkList: () => LinkList,
100
- Message: () => Message,
101
- MessageDescription: () => MessageDescription,
102
- MessageTitle: () => MessageTitle,
103
- Modal: () => Modal,
104
- ModalContent: () => ModalContent,
105
- ModalFooter: () => ModalFooter,
106
- ModalHeader: () => ModalHeader,
107
- Navbar: () => Navbar,
108
- NavbarButtonItem: () => NavbarButtonItem,
109
- NavbarExpandableMenu: () => NavbarExpandableMenu,
110
- NavbarExpandableMenuContent: () => NavbarExpandableMenuContent,
111
- NavbarExpandableMenuTrigger: () => NavbarExpandableMenuTrigger,
112
- NavbarItem: () => NavbarItem,
113
- NavbarItemIcon: () => NavbarItemIcon,
114
- NavbarLinkItem: () => NavbarLinkItem,
115
- NavbarLogo: () => NavbarLogo,
116
- NavbarLogoAndServiceText: () => NavbarLogoAndServiceText,
117
- NavbarNavigation: () => NavbarNavigation,
118
- OrderedList: () => OrderedList,
119
- RadioGroup: () => RadioGroup,
120
- Radiobutton: () => Radiobutton,
121
- Select: () => Select,
122
- ShowMoreButton: () => ShowMoreButton,
123
- Skeleton: () => Skeleton,
124
- Stack: () => Stack,
125
- StepIndicator: () => StepIndicator,
126
- StyledHtml: () => StyledHtml,
127
- Table: () => Table,
128
- Tabs: () => Tabs,
129
- TabsContent: () => TabsContent,
130
- TabsContents: () => TabsContents,
131
- TabsList: () => TabsList,
132
- TabsTab: () => TabsTab,
133
- Text: () => Text,
134
- Textarea: () => Textarea,
135
- UnorderedList: () => UnorderedList,
136
- VStack: () => VStack,
137
- WarningBanner: () => WarningBanner,
138
- focusTrap: () => focusTrap,
139
- useFieldsetContext: () => useFieldsetContext,
140
- useHydrated: () => useHydrated,
141
- useMergeRefs: () => useMergeRefs,
142
- useNavbarExpendableMenuContext: () => useNavbarExpendableMenuContext,
143
- useRadioGroupContext: () => useRadioGroupContext,
144
- useResize: () => useResize
145
- });
146
- module.exports = __toCommonJS(index_no_css_exports);
147
-
148
- // src/accordion/accordion.tsx
149
- var import_react5 = require("react");
150
- var import_typed_classname4 = require("@postenbring/hedwig-css/typed-classname");
151
-
152
- // src/accordion/accordion-item.tsx
153
- var import_react2 = require("react");
154
- var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
155
-
156
- // src/accordion/context.ts
157
- var import_react = require("react");
158
- var AccordionItemContext = (0, import_react.createContext)(null);
159
-
160
- // src/accordion/accordion-item.tsx
161
- var import_jsx_runtime = require("react/jsx-runtime");
162
- var AccordionItem = (0, import_react2.forwardRef)(
163
- (_a, ref) => {
164
- var _b = _a, { children, defaultOpen, open: outerOpen, onOpenChange, className } = _b, rest = __objRest(_b, ["children", "defaultOpen", "open", "onOpenChange", "className"]);
165
- const contentId = (0, import_react2.useId)();
166
- const [innerOpen, setInnerOpen] = (0, import_react2.useState)(defaultOpen != null ? defaultOpen : false);
167
- const open = outerOpen != null ? outerOpen : innerOpen;
168
- const handleOpen = () => {
169
- if (outerOpen !== void 0) {
170
- onOpenChange && onOpenChange(!open);
171
- } else {
172
- setInnerOpen(!open);
173
- }
174
- };
175
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
- "div",
177
- __spreadProps(__spreadValues({}, rest), {
178
- "data-state": open ? "open" : "closed",
179
- className: (0, import_typed_classname.clsx)("hds-accordion-item", className),
180
- ref,
181
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionItemContext.Provider, { value: { contentId, open, setOpen: handleOpen }, children })
182
- })
183
- );
184
- }
185
- );
186
- AccordionItem.displayName = "Accordion.Item";
187
-
188
- // src/accordion/accordion-header.tsx
189
- var import_react3 = require("react");
190
- var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname");
191
- var import_jsx_runtime2 = require("react/jsx-runtime");
192
- var AccordionHeader = (0, import_react3.forwardRef)(
193
- (_a, ref) => {
194
- var _b = _a, { children, className, onClick } = _b, rest = __objRest(_b, ["children", "className", "onClick"]);
195
- const context = (0, import_react3.useContext)(AccordionItemContext);
196
- if (context === null) {
197
- return null;
198
- }
199
- const expandOrCollapse = (e) => {
200
- context.setOpen(!context.open);
201
- onClick == null ? void 0 : onClick(e);
202
- };
203
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
204
- "button",
205
- __spreadProps(__spreadValues({}, rest), {
206
- "aria-expanded": context.open,
207
- "aria-controls": context.contentId,
208
- "data-state": context.open ? "open" : "closed",
209
- className: (0, import_typed_classname2.clsx)("hds-accordion-item-header", className),
210
- onClick: expandOrCollapse,
211
- ref,
212
- type: "button",
213
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children })
214
- })
215
- );
216
- }
217
- );
218
- AccordionHeader.displayName = "Accordion.Header";
219
-
220
- // src/accordion/accordion-content.tsx
221
- var import_react4 = require("react");
222
- var import_typed_classname3 = require("@postenbring/hedwig-css/typed-classname");
223
- var import_jsx_runtime3 = require("react/jsx-runtime");
224
- var AccordionContent = (0, import_react4.forwardRef)(
225
- (_a, ref) => {
226
- var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
227
- const context = (0, import_react4.useContext)(AccordionItemContext);
228
- if (context === null) {
229
- return null;
230
- }
231
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
232
- "div",
233
- __spreadProps(__spreadValues(__spreadProps(__spreadValues({
234
- id: context.contentId,
235
- "aria-hidden": !context.open,
236
- "data-state": context.open ? "open" : "closed"
237
- }, { inert: context.open ? void 0 : "true" }), {
238
- className: (0, import_typed_classname3.clsx)("hds-accordion-item-content", className),
239
- ref
240
- }), rest), {
241
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_typed_classname3.clsx)("hds-accordion-item-content-inner"), children })
242
- })
243
- );
244
- }
245
- );
246
- AccordionContent.displayName = "Accordion.Content";
247
-
248
- // src/accordion/accordion.tsx
249
- var import_jsx_runtime4 = require("react/jsx-runtime");
250
- var Accordion = (0, import_react5.forwardRef)(
251
- (_a, ref) => {
252
- var _b = _a, { children, className, indent = true } = _b, rest = __objRest(_b, ["children", "className", "indent"]);
253
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
254
- "div",
255
- __spreadProps(__spreadValues({}, rest), {
256
- className: (0, import_typed_classname4.clsx)(
257
- "hds-accordion",
258
- !indent && "hds-accordion--no-indent",
259
- className
260
- ),
261
- ref,
262
- children
263
- })
264
- );
265
- }
266
- );
267
- Accordion.displayName = "Accordion";
268
- Accordion.Item = AccordionItem;
269
- Accordion.Header = AccordionHeader;
270
- Accordion.Content = AccordionContent;
271
-
272
- // src/badge/badge.tsx
273
- var import_typed_classname5 = require("@postenbring/hedwig-css/typed-classname");
274
- var import_react_slot = require("@radix-ui/react-slot");
275
- var import_react6 = require("react");
276
- var import_jsx_runtime5 = require("react/jsx-runtime");
277
- var Badge = (0, import_react6.forwardRef)(
278
- (_a, ref) => {
279
- var _b = _a, { children, asChild, variant = "lighter", size = "small", className } = _b, rest = __objRest(_b, ["children", "asChild", "variant", "size", "className"]);
280
- const Component = asChild ? import_react_slot.Slot : "span";
281
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
282
- Component,
283
- __spreadProps(__spreadValues({
284
- ref,
285
- className: (0, import_typed_classname5.clsx)(
286
- "hds-badge",
287
- `hds-badge--${size}`,
288
- `hds-badge--${variant}`,
289
- className
290
- )
291
- }, rest), {
292
- children
293
- })
294
- );
295
- }
296
- );
297
- Badge.displayName = "Badge";
298
-
299
- // src/box/box.tsx
300
- var import_react7 = require("react");
301
- var import_typed_classname6 = require("@postenbring/hedwig-css/typed-classname");
302
- var import_react_slot2 = require("@radix-ui/react-slot");
303
- var import_jsx_runtime6 = require("react/jsx-runtime");
304
- var BoxCloseButton = (0, import_react7.forwardRef)(
305
- (_a, ref) => {
306
- var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
307
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
308
- "button",
309
- __spreadValues({
310
- className: (0, import_typed_classname6.clsx)("hds-box__close-button", className),
311
- ref,
312
- type: "button"
313
- }, rest)
314
- );
315
- }
316
- );
317
- BoxCloseButton.displayName = "Box.CloseButton";
318
- var Box = (0, import_react7.forwardRef)(
319
- (_a, ref) => {
320
- var _b = _a, {
321
- asChild,
322
- variant,
323
- closeable = false,
324
- onClose: onCloseProp,
325
- closed: closedProp,
326
- closeButtonProps,
327
- children,
328
- className
329
- } = _b, rest = __objRest(_b, [
330
- "asChild",
331
- "variant",
332
- "closeable",
333
- "onClose",
334
- "closed",
335
- "closeButtonProps",
336
- "children",
337
- "className"
338
- ]);
339
- const [closedState, setClosedState] = (0, import_react7.useState)(false);
340
- const onClose = (0, import_react7.useCallback)(() => {
341
- if (onCloseProp) {
342
- const result = onCloseProp();
343
- if (result === true) {
344
- setClosedState(true);
345
- }
346
- } else {
347
- setClosedState(true);
348
- }
349
- }, []);
350
- const closed = closedProp != null ? closedProp : closedState;
351
- const Component = asChild ? import_react_slot2.Slot : "div";
352
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
353
- Component,
354
- __spreadProps(__spreadValues({
355
- className: (0, import_typed_classname6.clsx)(
356
- "hds-box",
357
- variant && `hds-box--${variant}`,
358
- { "hds-box--closed": closed },
359
- className
360
- ),
361
- ref
362
- }, rest), {
363
- children: [
364
- closeable ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
365
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_slot2.Slottable, { children })
366
- ]
367
- })
368
- );
369
- }
370
- );
371
- Box.displayName = "Box";
372
- Box.CloseButton = BoxCloseButton;
373
-
374
- // src/breadcrumbs/breadcrumbs.tsx
375
- var import_react8 = require("react");
376
- var import_typed_classname7 = require("@postenbring/hedwig-css/typed-classname");
377
- var import_jsx_runtime7 = require("react/jsx-runtime");
378
- var Breadcrumbs = (0, import_react8.forwardRef)(
379
- (_a, ref) => {
380
- var _b = _a, { olProps, children } = _b, rest = __objRest(_b, ["olProps", "children"]);
381
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("nav", __spreadProps(__spreadValues({ ref }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ol", __spreadProps(__spreadValues({}, olProps), { className: (0, import_typed_classname7.clsx)("hds-breadcrumbs", olProps == null ? void 0 : olProps.className), children })) }));
382
- }
383
- );
384
- Breadcrumbs.displayName = "Breadcrumbs";
385
-
386
- // src/button/button.tsx
387
- var import_react9 = require("react");
388
- var import_typed_classname8 = require("@postenbring/hedwig-css/typed-classname");
389
- var import_react_slot3 = require("@radix-ui/react-slot");
390
- var import_jsx_runtime8 = require("react/jsx-runtime");
391
- var Button = (0, import_react9.forwardRef)(
392
- (_a, ref) => {
393
- var _b = _a, {
394
- asChild,
395
- children,
396
- variant = "primary",
397
- size = "medium",
398
- fullWidth = false,
399
- icon,
400
- className
401
- } = _b, rest = __objRest(_b, [
402
- "asChild",
403
- "children",
404
- "variant",
405
- "size",
406
- "fullWidth",
407
- "icon",
408
- "className"
409
- ]);
410
- const Component = asChild ? import_react_slot3.Slot : "button";
411
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
412
- Component,
413
- __spreadProps(__spreadValues({
414
- className: (0, import_typed_classname8.clsx)(
415
- "hds-button",
416
- `hds-button--${size}`,
417
- `hds-button--${variant}`,
418
- {
419
- "hds-button--full": fullWidth === true,
420
- "hds-button--mobile-full": fullWidth === "mobile",
421
- "hds-button--icon-only": icon
422
- },
423
- className
424
- ),
425
- ref
426
- }, rest), {
427
- children
428
- })
429
- );
430
- }
431
- );
432
- Button.displayName = "Button";
433
-
434
- // src/card/card.tsx
435
- var import_react10 = require("react");
436
- var import_typed_classname9 = require("@postenbring/hedwig-css/typed-classname");
437
- var import_react_slot4 = require("@radix-ui/react-slot");
438
- var import_jsx_runtime9 = require("react/jsx-runtime");
439
- var CardMedia = (0, import_react10.forwardRef)(
440
- (_a, ref) => {
441
- var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
442
- const Component = asChild ? import_react_slot4.Slot : "div";
443
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_typed_classname9.clsx)("hds-card__media", className), ref, children }));
444
- }
445
- );
446
- CardMedia.displayName = "Card.Media";
447
- var CardMediaImg = (0, import_react10.forwardRef)(
448
- (_a, ref) => {
449
- var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
450
- const Component = asChild ? import_react_slot4.Slot : "img";
451
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
452
- Component,
453
- __spreadProps(__spreadValues({}, rest), {
454
- className: (0, import_typed_classname9.clsx)("hds-card__media__img", className),
455
- ref
456
- })
457
- );
458
- }
459
- );
460
- CardMediaImg.displayName = "Card.MediaImg";
461
- var CardBody = (0, import_react10.forwardRef)(
462
- (_a, ref) => {
463
- var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
464
- const Component = asChild ? import_react_slot4.Slot : "div";
465
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_typed_classname9.clsx)("hds-card__body", className), ref, children }));
466
- }
467
- );
468
- CardBody.displayName = "Card.Body";
469
- var CardBodyHeader = (0, import_react10.forwardRef)((_a, ref) => {
470
- var _b = _a, { as: Tag, asChild, className, children } = _b, rest = __objRest(_b, ["as", "asChild", "className", "children"]);
471
- const Component = asChild ? import_react_slot4.Slot : Tag;
472
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
473
- Component,
474
- __spreadProps(__spreadValues({}, rest), {
475
- className: (0, import_typed_classname9.clsx)("hds-card__body-header", className),
476
- ref,
477
- children
478
- })
479
- );
480
- });
481
- CardBodyHeader.displayName = "Card.BodyHeader";
482
- var CardBodyHeaderOverline = (0, import_react10.forwardRef)(
483
- (_a, ref) => {
484
- var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
485
- const Component = asChild ? import_react_slot4.Slot : "span";
486
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
487
- Component,
488
- __spreadProps(__spreadValues({}, rest), {
489
- className: (0, import_typed_classname9.clsx)("hds-card__body-header-overline", className),
490
- ref,
491
- children
492
- })
493
- );
494
- }
495
- );
496
- CardBodyHeaderOverline.displayName = "Card.BodyHeaderOverline";
497
- var CardBodyHeaderTitle = (0, import_react10.forwardRef)(
498
- (_a, ref) => {
499
- var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
500
- const Component = asChild ? import_react_slot4.Slot : "div";
501
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
502
- Component,
503
- __spreadProps(__spreadValues({}, rest), {
504
- className: (0, import_typed_classname9.clsx)("hds-card__body-header-title", className),
505
- ref,
506
- children
507
- })
508
- );
509
- }
510
- );
511
- CardBodyHeaderTitle.displayName = "Card.BodyHeaderTitle";
512
- var CardBodyDescription = (0, import_react10.forwardRef)(
513
- (_a, ref) => {
514
- var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
515
- const Component = asChild ? import_react_slot4.Slot : "p";
516
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
517
- Component,
518
- __spreadProps(__spreadValues({}, rest), {
519
- className: (0, import_typed_classname9.clsx)("hds-card__body-description", className),
520
- ref,
521
- children
522
- })
523
- );
524
- }
525
- );
526
- CardBodyDescription.displayName = "Card.BodyDescription";
527
- var CardBodyAction = (0, import_react10.forwardRef)(
528
- (_a, ref) => {
529
- var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
530
- const Component = asChild ? import_react_slot4.Slot : "div";
531
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
532
- Component,
533
- __spreadProps(__spreadValues({}, rest), {
534
- className: (0, import_typed_classname9.clsx)("hds-card__body-action", className),
535
- ref,
536
- children
537
- })
538
- );
539
- }
540
- );
541
- CardBodyAction.displayName = "Card.BodyAction";
542
- var CardBodyActionArrow = (0, import_react10.forwardRef)(
543
- (_a, ref) => {
544
- var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
545
- const Component = asChild ? import_react_slot4.Slot : "span";
546
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
547
- Component,
548
- __spreadProps(__spreadValues({}, rest), {
549
- className: (0, import_typed_classname9.clsx)("hds-card__body-action-arrow", className),
550
- ref
551
- })
552
- );
553
- }
554
- );
555
- CardBodyActionArrow.displayName = "Card.BodyActionArrow";
556
- var Card = (0, import_react10.forwardRef)(
557
- (_a, ref) => {
558
- var _b = _a, { as: Tag = "section", asChild, className, children } = _b, rest = __objRest(_b, ["as", "asChild", "className", "children"]);
559
- const Component = asChild ? import_react_slot4.Slot : Tag;
560
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_typed_classname9.clsx)("hds-card", className), ref, children }));
561
- }
562
- );
563
- Card.displayName = "Card";
564
- Card.Media = CardMedia;
565
- Card.MediaImg = CardMediaImg;
566
- Card.Body = CardBody;
567
- Card.BodyHeader = CardBodyHeader;
568
- Card.BodyHeaderOverline = CardBodyHeaderOverline;
569
- Card.BodyHeaderTitle = CardBodyHeaderTitle;
570
- Card.BodyDescription = CardBodyDescription;
571
- Card.BodyAction = CardBodyAction;
572
- Card.BodyActionArrow = CardBodyActionArrow;
573
-
574
- // src/description-list/description-list.tsx
575
- var import_react11 = require("react");
576
- var import_typed_classname10 = require("@postenbring/hedwig-css/typed-classname");
577
- var import_jsx_runtime10 = require("react/jsx-runtime");
578
- var DescriptionList = (0, import_react11.forwardRef)(
579
- (_a, ref) => {
580
- var _b = _a, { variant = "vertical", className } = _b, rest = __objRest(_b, ["variant", "className"]);
581
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
582
- "dl",
583
- __spreadValues({
584
- ref,
585
- className: (0, import_typed_classname10.clsx)(
586
- "hds-description-list",
587
- {
588
- "hds-description-list--horizontal": variant === "horizontal"
589
- },
590
- className
591
- )
592
- }, rest)
593
- );
594
- }
595
- );
596
- DescriptionList.displayName = "DescriptionList";
597
-
598
- // src/form/checkbox/checkbox.tsx
599
- var import_react14 = require("react");
600
- var import_typed_classname13 = require("@postenbring/hedwig-css/typed-classname");
601
-
602
- // src/form/error-message/error-message.tsx
603
- var import_typed_classname11 = require("@postenbring/hedwig-css/typed-classname");
604
- var import_react12 = require("react");
605
- var import_jsx_runtime11 = require("react/jsx-runtime");
606
- var ErrorMessage = (0, import_react12.forwardRef)(
607
- (_a, ref) => {
608
- var _b = _a, { children, id, className } = _b, rest = __objRest(_b, ["children", "id", "className"]);
609
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
610
- "div",
611
- __spreadProps(__spreadValues({
612
- "aria-live": "assertive",
613
- className: (0, import_typed_classname11.clsx)("hds-error-message", className),
614
- id,
615
- ref
616
- }, rest), {
617
- children
618
- })
619
- );
620
- }
621
- );
622
- ErrorMessage.displayName = "ErrorMessage";
623
-
624
- // src/form/fieldset/fieldset.tsx
625
- var import_react13 = require("react");
626
- var import_typed_classname12 = require("@postenbring/hedwig-css/typed-classname");
627
- var import_jsx_runtime12 = require("react/jsx-runtime");
628
- var FieldsetContext = (0, import_react13.createContext)({ hasError: false });
629
- var useFieldsetContext = () => (0, import_react13.useContext)(FieldsetContext);
630
- var Fieldset = (0, import_react13.forwardRef)(function Fieldset2(_a, ref) {
631
- var _b = _a, {
632
- className,
633
- style,
634
- errorMessage,
635
- legendProps: _c = {}
636
- } = _b, _d = _c, { size: legendSize = "default", className: legendClassName } = _d, legendProps = __objRest(_d, ["size", "className"]), _e = _b, {
637
- legend,
638
- children
639
- } = _e, rest = __objRest(_e, [
640
- "className",
641
- "style",
642
- "errorMessage",
643
- "legendProps",
644
- "legend",
645
- "children"
646
- ]);
647
- const errorMessageId = (0, import_react13.useId)();
648
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
649
- "fieldset",
650
- __spreadProps(__spreadValues({
651
- "aria-describedby": errorMessage ? errorMessageId : void 0,
652
- "aria-invalid": errorMessage ? true : void 0,
653
- className: (0, import_typed_classname12.clsx)("hds-fieldset", className),
654
- ref,
655
- style
656
- }, rest), {
657
- children: [
658
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
659
- "legend",
660
- __spreadProps(__spreadValues({
661
- className: (0, import_typed_classname12.clsx)(
662
- "hds-fieldset__legend",
663
- { [`hds-fieldset__legend--${legendSize}`]: legendSize },
664
- legendClassName
665
- )
666
- }, legendProps), {
667
- children: legend
668
- })
669
- ),
670
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FieldsetContext.Provider, { value: { hasError: Boolean(errorMessage) }, children }),
671
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ErrorMessage, { id: errorMessageId, children: errorMessage })
672
- ]
673
- })
674
- );
675
- });
676
-
677
- // src/form/checkbox/checkbox.tsx
678
- var import_jsx_runtime13 = require("react/jsx-runtime");
679
- var Checkbox = (0, import_react14.forwardRef)(
680
- (_a, ref) => {
681
- var _b = _a, {
682
- variant = "plain",
683
- hasError: hasErrorProp,
684
- errorMessage,
685
- title,
686
- children,
687
- className
688
- } = _b, rest = __objRest(_b, [
689
- "variant",
690
- "hasError",
691
- "errorMessage",
692
- "title",
693
- "children",
694
- "className"
695
- ]);
696
- const errorMessageId = (0, import_react14.useId)();
697
- const { hasError: hasFieldsetError } = useFieldsetContext();
698
- const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;
699
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_typed_classname13.clsx)("hds-checkbox-wrapper"), children: [
700
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
701
- "div",
702
- {
703
- className: (0, import_typed_classname13.clsx)(
704
- "hds-checkbox",
705
- {
706
- [`hds-checkbox--${variant}`]: variant === "bounding-box",
707
- "hds-checkbox--error": hasError
708
- },
709
- className
710
- ),
711
- children: [
712
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { children: [
713
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
714
- "input",
715
- __spreadProps(__spreadValues({}, rest), {
716
- "aria-invalid": hasError ? true : void 0,
717
- "aria-describedby": errorMessage ? errorMessageId : void 0,
718
- ref,
719
- type: "checkbox"
720
- })
721
- ),
722
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": true, className: "hds-checkbox__checkmark" }),
723
- title ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "hds-checkbox__title", children: title }) : children
724
- ] }),
725
- title ? children : null
726
- ]
727
- }
728
- ),
729
- errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ErrorMessage, { id: errorMessageId, children: errorMessage }) : null
730
- ] });
731
- }
732
- );
733
- Checkbox.displayName = "Checkbox";
734
-
735
- // src/form/date-picker/date-picker.tsx
736
- var import_react17 = require("react");
737
- var import_typed_classname15 = require("@postenbring/hedwig-css/typed-classname");
738
-
739
- // src/form/input-group/input-group.tsx
740
- var import_react15 = require("react");
741
- var import_typed_classname14 = require("@postenbring/hedwig-css/typed-classname");
742
- var import_jsx_runtime14 = require("react/jsx-runtime");
743
- var InputGroup = (0, import_react15.forwardRef)(function InputGroup2(_a, ref) {
744
- var _b = _a, {
745
- id,
746
- className,
747
- style,
748
- variant = "default",
749
- errorMessage,
750
- labelProps: _c = {}
751
- } = _b, _d = _c, { className: labelClassName } = _d, labelProps = __objRest(_d, ["className"]), _e = _b, {
752
- label,
753
- disabled,
754
- readOnly,
755
- children
756
- } = _e, rest = __objRest(_e, [
757
- "id",
758
- "className",
759
- "style",
760
- "variant",
761
- "errorMessage",
762
- "labelProps",
763
- "label",
764
- "disabled",
765
- "readOnly",
766
- "children"
767
- ]);
768
- const errorMessageId = (0, import_react15.useId)();
769
- const inputId = (0, import_react15.useId)();
770
- const renderInput = () => {
771
- var _a2;
772
- const inputProps = {
773
- "aria-describedby": errorMessage ? errorMessageId : void 0,
774
- "aria-invalid": errorMessage ? true : void 0,
775
- id: id != null ? id : inputId,
776
- className: (0, import_typed_classname14.clsx)("hds-input-group__input")
777
- };
778
- if (typeof children === "function") {
779
- return children(inputProps);
780
- }
781
- const input = import_react15.Children.toArray(children)[0];
782
- if (!(0, import_react15.isValidElement)(input)) {
783
- return;
784
- }
785
- return (0, import_react15.cloneElement)(input, __spreadProps(__spreadValues(__spreadValues({}, inputProps), input.props), {
786
- className: `${inputProps.className} ${(_a2 = input.props.className) != null ? _a2 : ""}`
787
- }));
788
- };
789
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
790
- "div",
791
- __spreadProps(__spreadValues({
792
- className: (0, import_typed_classname14.clsx)(
793
- "hds-input-group",
794
- {
795
- [`hds-input-group--${variant}`]: variant,
796
- "hds-input-group--error": errorMessage
797
- },
798
- className
799
- ),
800
- ref,
801
- style
802
- }, rest), {
803
- children: [
804
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
805
- "label",
806
- __spreadProps(__spreadValues({
807
- className: (0, import_typed_classname14.clsx)("hds-input-group__label", labelClassName)
808
- }, labelProps), {
809
- htmlFor: id != null ? id : inputId,
810
- children: label
811
- })
812
- ),
813
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
814
- "div",
815
- {
816
- className: (0, import_typed_classname14.clsx)("hds-input-group__input-wrapper"),
817
- "data-disabled": disabled,
818
- "data-readonly": readOnly,
819
- children: renderInput()
820
- }
821
- ),
822
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorMessage, { id: errorMessageId, children: errorMessage })
823
- ]
824
- })
825
- );
826
- });
827
-
828
- // src/utils/utils.ts
829
- var React = __toESM(require("react"));
830
- var import_react16 = require("react");
831
- function useMergeRefs(refs) {
832
- return React.useMemo(() => {
833
- if (refs.every((ref) => ref === null)) {
834
- return null;
835
- }
836
- return (value) => {
837
- refs.forEach((ref) => {
838
- if (typeof ref === "function") {
839
- ref(value);
840
- } else if (ref !== null) {
841
- ref.current = value;
842
- }
843
- });
844
- };
845
- }, refs);
846
- }
847
- function useResize(ref) {
848
- const [width, setWidth] = (0, import_react16.useState)(0);
849
- const [height, setHeight] = (0, import_react16.useState)(0);
850
- const handleResize = (0, import_react16.useCallback)(() => {
851
- var _a, _b, _c, _d;
852
- if ((ref == null ? void 0 : ref.current) !== null) {
853
- setWidth((_b = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.offsetWidth) != null ? _b : 0);
854
- setHeight((_d = (_c = ref == null ? void 0 : ref.current) == null ? void 0 : _c.offsetHeight) != null ? _d : 0);
855
- }
856
- }, [ref]);
857
- (0, import_react16.useEffect)(() => {
858
- window.addEventListener("load", handleResize);
859
- window.addEventListener("resize", handleResize);
860
- return () => {
861
- window.removeEventListener("load", handleResize);
862
- window.removeEventListener("resize", handleResize);
863
- };
864
- }, [ref, handleResize]);
865
- (0, import_react16.useEffect)(() => {
866
- handleResize();
867
- }, []);
868
- return { width, height };
869
- }
870
- function subscribe() {
871
- return () => {
872
- };
873
- }
874
- function useHydrated() {
875
- return React.useSyncExternalStore(
876
- subscribe,
877
- () => true,
878
- () => false
879
- );
880
- }
881
- function focusTrap(element) {
882
- var _a, _b;
883
- if (element === document.body)
884
- return () => {
885
- };
886
- let inertElements = [];
887
- for (let el = element; el; el = el.parentElement) {
888
- if (el === document.body)
889
- break;
890
- for (const sibling of (_b = (_a = el.parentElement) == null ? void 0 : _a.children) != null ? _b : []) {
891
- if (sibling === el)
892
- continue;
893
- if (!(sibling instanceof HTMLElement))
894
- continue;
895
- if (sibling.hasAttribute("inert"))
896
- continue;
897
- sibling.setAttribute("inert", "true");
898
- inertElements.push(sibling);
899
- }
900
- }
901
- return () => {
902
- releaseFocusTrap(inertElements);
903
- inertElements = [];
904
- };
905
- }
906
- function releaseFocusTrap(inertElements) {
907
- for (const el of inertElements) {
908
- el.removeAttribute("inert");
909
- }
910
- }
911
-
912
- // src/form/date-picker/date-picker.tsx
913
- var import_jsx_runtime15 = require("react/jsx-runtime");
914
- var DatePicker = (0, import_react17.forwardRef)(function DatePicker2(_a, ref) {
915
- var _b = _a, {
916
- className,
917
- variant,
918
- errorMessage,
919
- labelProps,
920
- label,
921
- id,
922
- style,
923
- disabled,
924
- readOnly,
925
- calendarButtonTitle = "\xC5pne kalender"
926
- } = _b, rest = __objRest(_b, [
927
- "className",
928
- "variant",
929
- "errorMessage",
930
- "labelProps",
931
- "label",
932
- "id",
933
- "style",
934
- "disabled",
935
- "readOnly",
936
- "calendarButtonTitle"
937
- ]);
938
- const inputRef = (0, import_react17.useRef)(null);
939
- const mergedRef = useMergeRefs([inputRef, ref]);
940
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
941
- InputGroup,
942
- {
943
- className: (0, import_typed_classname15.clsx)("hds-date-picker", className),
944
- disabled,
945
- errorMessage,
946
- id,
947
- label,
948
- labelProps,
949
- readOnly,
950
- style,
951
- variant,
952
- children: (inputProps) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
953
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
954
- "input",
955
- __spreadProps(__spreadValues(__spreadValues({}, rest), inputProps), {
956
- disabled,
957
- readOnly,
958
- ref: mergedRef,
959
- type: "date"
960
- })
961
- ),
962
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
963
- "button",
964
- {
965
- className: (0, import_typed_classname15.clsx)("hds-date-picker__calendar-button"),
966
- type: "button",
967
- title: calendarButtonTitle,
968
- onClick: () => {
969
- var _a2;
970
- (_a2 = inputRef.current) == null ? void 0 : _a2.showPicker();
971
- }
972
- }
973
- )
974
- ] })
975
- }
976
- );
977
- });
978
- DatePicker.displayName = "DatePicker";
979
-
980
- // src/form/input/input.tsx
981
- var import_react18 = require("react");
982
- var import_typed_classname16 = require("@postenbring/hedwig-css/typed-classname");
983
- var import_jsx_runtime16 = require("react/jsx-runtime");
984
- var Input = (0, import_react18.forwardRef)(function Input2(_a, ref) {
985
- var _b = _a, { className, variant, errorMessage, labelProps, label, id, style, disabled, readOnly } = _b, rest = __objRest(_b, ["className", "variant", "errorMessage", "labelProps", "label", "id", "style", "disabled", "readOnly"]);
986
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
987
- InputGroup,
988
- {
989
- className: (0, import_typed_classname16.clsx)("hds-input", className),
990
- disabled,
991
- errorMessage,
992
- id,
993
- label,
994
- labelProps,
995
- readOnly,
996
- style,
997
- variant,
998
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", __spreadProps(__spreadValues({}, rest), { disabled, readOnly, ref }))
999
- }
1000
- );
1001
- });
1002
- Input.displayName = "Input";
1003
-
1004
- // src/form/radiobutton/radiobutton.tsx
1005
- var import_react20 = require("react");
1006
- var import_typed_classname17 = require("@postenbring/hedwig-css/typed-classname");
1007
-
1008
- // src/form/radiobutton/radiogroup.tsx
1009
- var import_react19 = require("react");
1010
- var import_jsx_runtime17 = require("react/jsx-runtime");
1011
- var RadioGroupContext = (0, import_react19.createContext)({
1012
- hasError: false,
1013
- onChange: () => {
1014
- return void 0;
1015
- }
1016
- });
1017
- var useRadioGroupContext = () => (0, import_react19.useContext)(RadioGroupContext);
1018
- var RadioGroup = (0, import_react19.forwardRef)(function RadioGroup2(_a, ref) {
1019
- var _b = _a, { name, value, errorMessage, onChange, children } = _b, rest = __objRest(_b, ["name", "value", "errorMessage", "onChange", "children"]);
1020
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RadioGroupContext.Provider, { value: { name, value, hasError: Boolean(errorMessage), onChange }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Fieldset, __spreadProps(__spreadValues({ errorMessage }, rest), { ref, children })) });
1021
- });
1022
- RadioGroup.displayName = "RadioGroup";
1023
-
1024
- // src/form/radiobutton/radiobutton.tsx
1025
- var import_jsx_runtime18 = require("react/jsx-runtime");
1026
- var isChecked = ({
1027
- checked,
1028
- selectedValue,
1029
- value
1030
- }) => {
1031
- if (typeof checked !== "undefined")
1032
- return checked;
1033
- if (typeof selectedValue !== "undefined")
1034
- return value === selectedValue;
1035
- return void 0;
1036
- };
1037
- var Radiobutton = (0, import_react20.forwardRef)(
1038
- (_a, ref) => {
1039
- var _b = _a, {
1040
- checked,
1041
- value,
1042
- variant = "plain",
1043
- hasError: hasErrorProp,
1044
- title,
1045
- children,
1046
- className
1047
- } = _b, rest = __objRest(_b, [
1048
- "checked",
1049
- "value",
1050
- "variant",
1051
- "hasError",
1052
- "title",
1053
- "children",
1054
- "className"
1055
- ]);
1056
- const _a2 = useRadioGroupContext(), {
1057
- value: selectedValue,
1058
- hasError: hasRadioGroupError
1059
- } = _a2, context = __objRest(_a2, [
1060
- "value",
1061
- "hasError"
1062
- ]);
1063
- const { hasError: hasFieldsetError } = useFieldsetContext();
1064
- const hasError = hasFieldsetError || hasRadioGroupError || hasErrorProp;
1065
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1066
- "div",
1067
- {
1068
- className: (0, import_typed_classname17.clsx)(
1069
- "hds-radiobutton",
1070
- {
1071
- [`hds-radiobutton--${variant}`]: variant === "bounding-box",
1072
- "hds-radiobutton--error": hasError
1073
- },
1074
- className
1075
- ),
1076
- children: [
1077
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { children: [
1078
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1079
- "input",
1080
- __spreadProps(__spreadValues(__spreadValues({}, context), rest), {
1081
- checked: isChecked({ checked, selectedValue, value }),
1082
- value,
1083
- ref,
1084
- type: "radio"
1085
- })
1086
- ),
1087
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "aria-hidden": true, className: "hds-radiobutton__checkmark" }),
1088
- title ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "hds-radiobutton__title", children: title }) : children
1089
- ] }),
1090
- title ? children : null
1091
- ]
1092
- }
1093
- );
1094
- }
1095
- );
1096
- Radiobutton.displayName = "Radiobutton";
1097
-
1098
- // src/form/select/select.tsx
1099
- var import_react21 = require("react");
1100
- var import_typed_classname18 = require("@postenbring/hedwig-css/typed-classname");
1101
- var import_jsx_runtime19 = require("react/jsx-runtime");
1102
- var Select = (0, import_react21.forwardRef)(function Select2(_a, ref) {
1103
- var _b = _a, { className, variant, errorMessage, labelProps, label, id, style, disabled, children } = _b, rest = __objRest(_b, ["className", "variant", "errorMessage", "labelProps", "label", "id", "style", "disabled", "children"]);
1104
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1105
- InputGroup,
1106
- {
1107
- className: (0, import_typed_classname18.clsx)("hds-select", className),
1108
- disabled,
1109
- errorMessage,
1110
- id,
1111
- label,
1112
- labelProps,
1113
- style,
1114
- variant,
1115
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("select", __spreadProps(__spreadValues({}, rest), { disabled, ref, children }))
1116
- }
1117
- );
1118
- });
1119
- Select.displayName = "Select";
1120
-
1121
- // src/form/textarea/textarea.tsx
1122
- var import_react22 = require("react");
1123
- var import_typed_classname19 = require("@postenbring/hedwig-css/typed-classname");
1124
- var import_jsx_runtime20 = require("react/jsx-runtime");
1125
- var Textarea = (0, import_react22.forwardRef)(function Textarea2(_a, ref) {
1126
- var _b = _a, { className, variant, errorMessage, labelProps, label, id, style, disabled, readOnly } = _b, rest = __objRest(_b, ["className", "variant", "errorMessage", "labelProps", "label", "id", "style", "disabled", "readOnly"]);
1127
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1128
- InputGroup,
1129
- {
1130
- className: (0, import_typed_classname19.clsx)("hds-textarea", className),
1131
- disabled,
1132
- errorMessage,
1133
- id,
1134
- label,
1135
- labelProps,
1136
- readOnly,
1137
- style,
1138
- variant,
1139
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("textarea", __spreadProps(__spreadValues({}, rest), { disabled, readOnly, ref }))
1140
- }
1141
- );
1142
- });
1143
- Textarea.displayName = "Textarea";
1144
-
1145
- // src/footer/footer.tsx
1146
- var import_react25 = require("react");
1147
- var import_typed_classname22 = require("@postenbring/hedwig-css/typed-classname");
1148
- var import_react_slot5 = require("@radix-ui/react-slot");
1149
-
1150
- // src/list/link-list.tsx
1151
- var import_typed_classname21 = require("@postenbring/hedwig-css/typed-classname");
1152
- var import_react24 = require("react");
1153
-
1154
- // src/list/list.tsx
1155
- var import_react23 = require("react");
1156
- var import_typed_classname20 = require("@postenbring/hedwig-css/typed-classname");
1157
- var import_jsx_runtime21 = require("react/jsx-runtime");
1158
- var UnorderedList = (0, import_react23.forwardRef)(
1159
- (_a, ref) => {
1160
- var _b = _a, { size = "medium", className } = _b, rest = __objRest(_b, ["size", "className"]);
1161
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1162
- "ul",
1163
- __spreadValues({
1164
- ref,
1165
- className: (0, import_typed_classname20.clsx)("hds-list", `hds-list--${size}`, className)
1166
- }, rest)
1167
- );
1168
- }
1169
- );
1170
- UnorderedList.displayName = "UnorderedList";
1171
- var OrderedList = (0, import_react23.forwardRef)(
1172
- (_a, ref) => {
1173
- var _b = _a, { size = "medium", className } = _b, rest = __objRest(_b, ["size", "className"]);
1174
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1175
- "ol",
1176
- __spreadValues({
1177
- ref,
1178
- className: (0, import_typed_classname20.clsx)("hds-list", `hds-list--${size}`, className)
1179
- }, rest)
1180
- );
1181
- }
1182
- );
1183
- OrderedList.displayName = "OrderedList";
1184
-
1185
- // src/list/link-list.tsx
1186
- var import_jsx_runtime22 = require("react/jsx-runtime");
1187
- var LinkList = (0, import_react24.forwardRef)(
1188
- (_a, ref) => {
1189
- var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
1190
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1191
- UnorderedList,
1192
- __spreadValues({
1193
- ref,
1194
- className: (0, import_typed_classname21.clsx)("hds-list--link-list", className)
1195
- }, rest)
1196
- );
1197
- }
1198
- );
1199
- LinkList.displayName = "LinkList";
1200
-
1201
- // src/footer/footer.tsx
1202
- var import_jsx_runtime23 = require("react/jsx-runtime");
1203
- var FooterLogo = (0, import_react25.forwardRef)(
1204
- (_a, ref) => {
1205
- var _b = _a, { children, className, asChild } = _b, rest = __objRest(_b, ["children", "className", "asChild"]);
1206
- const Component = asChild ? import_react_slot5.Slot : "div";
1207
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Component, __spreadProps(__spreadValues({ className: (0, import_typed_classname22.clsx)(`hds-footer__logo`, className), ref }, rest), { children }));
1208
- }
1209
- );
1210
- FooterLogo.displayName = "Footer.Logo";
1211
- var FooterButtonLink = (0, import_react25.forwardRef)(
1212
- (_a, ref) => {
1213
- var _b = _a, { children, className, asChild } = _b, rest = __objRest(_b, ["children", "className", "asChild"]);
1214
- const Component = asChild ? import_react_slot5.Slot : "a";
1215
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Button, { asChild: true, variant: "primary-outline", className: (0, import_typed_classname22.clsx)(className), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Component, __spreadProps(__spreadValues({ ref }, rest), { children })) });
1216
- }
1217
- );
1218
- FooterButtonLink.displayName = "FooterButton";
1219
- var FooterLinkSections = (0, import_react25.forwardRef)(
1220
- (_a, ref) => {
1221
- var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
1222
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1223
- Accordion,
1224
- __spreadProps(__spreadValues({
1225
- className: (0, import_typed_classname22.clsx)("hds-footer__link-sections", className),
1226
- ref
1227
- }, rest), {
1228
- children
1229
- })
1230
- ) });
1231
- }
1232
- );
1233
- FooterLinkSections.displayName = "Footer.LinkSections";
1234
- var FooterLinkSection = (0, import_react25.forwardRef)(
1235
- (_a, ref) => {
1236
- var _b = _a, { heading, children, className } = _b, rest = __objRest(_b, ["heading", "children", "className"]);
1237
- const linkListChildren = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LinkList, { children });
1238
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
1239
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1240
- Accordion.Item,
1241
- __spreadProps(__spreadValues({
1242
- className: (0, import_typed_classname22.clsx)(`hds-footer__link-section`, className),
1243
- ref
1244
- }, rest), {
1245
- children: [
1246
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Accordion.Header, { children: heading }),
1247
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Accordion.Content, { children: linkListChildren })
1248
- ]
1249
- })
1250
- ),
1251
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: (0, import_typed_classname22.clsx)(`hds-footer__link-section`, className), children: [
1252
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { children: heading }),
1253
- linkListChildren
1254
- ] })
1255
- ] });
1256
- }
1257
- );
1258
- FooterLinkSection.displayName = "Footer.LinkSection";
1259
- var Footer = (0, import_react25.forwardRef)(
1260
- (_a, ref) => {
1261
- var _b = _a, { children, className, variant, asChild } = _b, rest = __objRest(_b, ["children", "className", "variant", "asChild"]);
1262
- const Component = asChild ? import_react_slot5.Slot : "footer";
1263
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1264
- Component,
1265
- __spreadProps(__spreadValues({
1266
- className: (0, import_typed_classname22.clsx)(
1267
- `hds-footer`,
1268
- variant === "slim" && "hds-footer--slim",
1269
- className
1270
- ),
1271
- ref
1272
- }, rest), {
1273
- children
1274
- })
1275
- );
1276
- }
1277
- );
1278
- Footer.displayName = "Footer";
1279
- Footer.Logo = FooterLogo;
1280
- Footer.ButtonLink = FooterButtonLink;
1281
- Footer.LinkSections = FooterLinkSections;
1282
- Footer.LinkSection = FooterLinkSection;
1283
-
1284
- // src/help-text/help-text.tsx
1285
- var Popover = __toESM(require("@radix-ui/react-popover"));
1286
- var import_typed_classname23 = require("@postenbring/hedwig-css/typed-classname");
1287
- var import_react26 = require("react");
1288
- var import_jsx_runtime24 = require("react/jsx-runtime");
1289
- var HelpText = (0, import_react26.forwardRef)(
1290
- (_a, ref) => {
1291
- var _b = _a, { children, className, helpText, title, side = "top", align = "start", boxProps } = _b, rest = __objRest(_b, ["children", "className", "helpText", "title", "side", "align", "boxProps"]);
1292
- return (
1293
- // NOTE: Using radix's [Popover component](https://www.radix-ui.com/primitives/docs/components/popover)
1294
- // In the future we can use the native popover api, but as of writing, though all browsers support it
1295
- // it's not far enough back to be used in production
1296
- // https://caniuse.com/mdn-html_elements_input_popovertarget
1297
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Popover.Root, { children: [
1298
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1299
- "button",
1300
- __spreadProps(__spreadValues({
1301
- ref,
1302
- className: (0, import_typed_classname23.clsx)("hds-help-text-button", className),
1303
- title,
1304
- type: "button"
1305
- }, rest), {
1306
- children
1307
- })
1308
- ) }),
1309
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Popover.Content, { asChild: true, side, align, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1310
- Box,
1311
- __spreadProps(__spreadValues({}, boxProps), {
1312
- className: (0, import_typed_classname23.clsx)("hds-help-text-box", boxProps == null ? void 0 : boxProps.className),
1313
- children: [
1314
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Popover.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Box.CloseButton, {}) }),
1315
- helpText
1316
- ]
1317
- })
1318
- ) }) })
1319
- ] })
1320
- );
1321
- }
1322
- );
1323
- HelpText.displayName = "HelpText";
1324
-
1325
- // src/layout/container/container.tsx
1326
- var import_typed_classname24 = require("@postenbring/hedwig-css/typed-classname");
1327
- var import_react_slot6 = require("@radix-ui/react-slot");
1328
- var import_react27 = require("react");
1329
- var import_jsx_runtime25 = require("react/jsx-runtime");
1330
- var Container = (0, import_react27.forwardRef)(
1331
- (_a, ref) => {
1332
- var _b = _a, { as: Tag = "div", asChild, className, children, variant } = _b, rest = __objRest(_b, ["as", "asChild", "className", "children", "variant"]);
1333
- const Component = asChild ? import_react_slot6.Slot : Tag;
1334
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1335
- Component,
1336
- __spreadProps(__spreadValues({}, rest), {
1337
- className: (0, import_typed_classname24.clsx)(
1338
- "hds-container",
1339
- { "hds-container--slim": variant === "slim" },
1340
- className
1341
- ),
1342
- ref,
1343
- children
1344
- })
1345
- );
1346
- }
1347
- );
1348
- Container.displayName = "Container";
1349
-
1350
- // src/layout/grid/grid.tsx
1351
- var import_typed_classname25 = require("@postenbring/hedwig-css/typed-classname");
1352
- var import_react_slot7 = require("@radix-ui/react-slot");
1353
- var import_react28 = require("react");
1354
-
1355
- // src/layout/responsive.ts
1356
- function getResponsiveProps(variable, inputValues, valueTransformer = (value) => String(value)) {
1357
- if (!inputValues)
1358
- return {};
1359
- if (typeof inputValues !== "object") {
1360
- return { [`${variable}-initial`]: valueTransformer(inputValues) };
1361
- }
1362
- const result = {};
1363
- for (const [key, value] of Object.entries(inputValues)) {
1364
- result[`${variable}-${key}`] = valueTransformer(value);
1365
- }
1366
- return result;
1367
- }
1368
-
1369
- // src/layout/spacing.ts
1370
- function getSpacingVariable(size) {
1371
- return `var(--hds-spacing-${size})`;
1372
- }
1373
-
1374
- // src/layout/grid/grid.tsx
1375
- var import_jsx_runtime26 = require("react/jsx-runtime");
1376
- var GridItem = (0, import_react28.forwardRef)(
1377
- (_a, ref) => {
1378
- var _b = _a, { children, asChild, className, span, center, style: _style } = _b, rest = __objRest(_b, ["children", "asChild", "className", "span", "center", "style"]);
1379
- const Component = asChild ? import_react_slot7.Slot : "div";
1380
- const style = __spreadValues(__spreadValues(__spreadValues({}, _style), getResponsiveProps("--hds-grid-item-span", span)), getResponsiveProps("--hds-grid-item-center", center, (value) => value ? "1" : "0"));
1381
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1382
- Component,
1383
- __spreadProps(__spreadValues({
1384
- style,
1385
- className: (0, import_typed_classname25.clsx)("hds-grid__item", className),
1386
- ref
1387
- }, rest), {
1388
- children
1389
- })
1390
- );
1391
- }
1392
- );
1393
- GridItem.displayName = "Grid.Item";
1394
- var Grid = (0, import_react28.forwardRef)(
1395
- (_a, ref) => {
1396
- var _b = _a, { children, asChild, className, span, center, style: _style, gap, gapX, gapY } = _b, rest = __objRest(_b, ["children", "asChild", "className", "span", "center", "style", "gap", "gapX", "gapY"]);
1397
- const Component = asChild ? import_react_slot7.Slot : "div";
1398
- const style = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, _style), getResponsiveProps("--hds-grid-gap", gap, getSpacingVariable)), getResponsiveProps("--hds-grid-gap-x", gapX, getSpacingVariable)), getResponsiveProps("--hds-grid-gap-y", gapY, getSpacingVariable)), getResponsiveProps("--hds-grid-span", span)), getResponsiveProps("--hds-grid-center", center, (value) => value ? "1" : "0"));
1399
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1400
- Component,
1401
- __spreadProps(__spreadValues({
1402
- style,
1403
- className: (0, import_typed_classname25.clsx)("hds-grid", className),
1404
- ref
1405
- }, rest), {
1406
- children
1407
- })
1408
- );
1409
- }
1410
- );
1411
- Grid.displayName = "Grid";
1412
- Grid.Item = GridItem;
1413
-
1414
- // src/layout/stack/stack.tsx
1415
- var React2 = require("react");
1416
- var import_typed_classname26 = require("@postenbring/hedwig-css/typed-classname");
1417
- var import_react29 = require("react");
1418
- var import_react_slot8 = require("@radix-ui/react-slot");
1419
- var import_jsx_runtime27 = require("react/jsx-runtime");
1420
- var Stack = (0, import_react29.forwardRef)(
1421
- (_a, ref) => {
1422
- var _b = _a, {
1423
- children,
1424
- asChild,
1425
- className,
1426
- style: _style,
1427
- gap,
1428
- gapX,
1429
- gapY,
1430
- direction,
1431
- wrap,
1432
- align,
1433
- justify
1434
- } = _b, rest = __objRest(_b, [
1435
- "children",
1436
- "asChild",
1437
- "className",
1438
- "style",
1439
- "gap",
1440
- "gapX",
1441
- "gapY",
1442
- "direction",
1443
- "wrap",
1444
- "align",
1445
- "justify"
1446
- ]);
1447
- const Component = asChild ? import_react_slot8.Slot : "div";
1448
- const style = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, _style), getResponsiveProps("--hds-stack-gap", gap, getSpacingVariable)), getResponsiveProps("--hds-stack-gap-x", gapX, getSpacingVariable)), getResponsiveProps("--hds-stack-gap-y", gapY, getSpacingVariable)), getResponsiveProps("--hds-stack-direction", direction)), getResponsiveProps("--hds-stack-wrap", wrap, (value) => value ? "wrap" : "nowrap")), getResponsiveProps("--hds-stack-align", align)), getResponsiveProps("--hds-stack-justify", justify));
1449
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1450
- Component,
1451
- __spreadProps(__spreadValues({
1452
- style,
1453
- className: (0, import_typed_classname26.clsx)("hds-stack", className),
1454
- ref
1455
- }, rest), {
1456
- children
1457
- })
1458
- );
1459
- }
1460
- );
1461
- Stack.displayName = "Stack";
1462
- var HStack = (0, import_react29.forwardRef)((props, ref) => {
1463
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Stack, __spreadProps(__spreadValues({ ref }, props), { direction: "row" }));
1464
- });
1465
- HStack.displayName = "HStack";
1466
- var VStack = (0, import_react29.forwardRef)((props, ref) => {
1467
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Stack, __spreadProps(__spreadValues({ ref }, props), { direction: "column" }));
1468
- });
1469
- VStack.displayName = "VStack";
1470
-
1471
- // src/link/link.tsx
1472
- var React3 = require("react");
1473
- var import_typed_classname27 = require("@postenbring/hedwig-css/typed-classname");
1474
- var import_react30 = require("react");
1475
- var import_react_slot9 = require("@radix-ui/react-slot");
1476
- var import_jsx_runtime28 = require("react/jsx-runtime");
1477
- var Link = (0, import_react30.forwardRef)(
1478
- (_a, ref) => {
1479
- var _b = _a, { asChild, children, variant = "underline", size = "medium", className } = _b, rest = __objRest(_b, ["asChild", "children", "variant", "size", "className"]);
1480
- const Component = asChild ? import_react_slot9.Slot : "a";
1481
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1482
- Component,
1483
- __spreadProps(__spreadValues({
1484
- className: (0, import_typed_classname27.clsx)(
1485
- "hds-link",
1486
- variant !== "underline" && `hds-link--${variant}`,
1487
- size !== "medium" && `hds-link--${size}`,
1488
- className
1489
- ),
1490
- ref
1491
- }, rest), {
1492
- children
1493
- })
1494
- );
1495
- }
1496
- );
1497
- Link.displayName = "Link";
1498
-
1499
- // src/message/message.tsx
1500
- var import_react31 = require("react");
1501
- var import_typed_classname28 = require("@postenbring/hedwig-css/typed-classname");
1502
- var import_react_slot10 = require("@radix-ui/react-slot");
1503
- var import_jsx_runtime29 = require("react/jsx-runtime");
1504
- var MessageTitle = (0, import_react31.forwardRef)(
1505
- (_a, ref) => {
1506
- var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
1507
- const Component = asChild ? import_react_slot10.Slot : "div";
1508
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1509
- Component,
1510
- __spreadValues({
1511
- className: (0, import_typed_classname28.clsx)("hds-message__title", className),
1512
- ref
1513
- }, rest)
1514
- );
1515
- }
1516
- );
1517
- MessageTitle.displayName = "Message.Title";
1518
- var MessageDescription = (0, import_react31.forwardRef)(
1519
- (_a, ref) => {
1520
- var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
1521
- const Component = asChild ? import_react_slot10.Slot : "div";
1522
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1523
- Component,
1524
- __spreadValues({
1525
- className: (0, import_typed_classname28.clsx)("hds-message__description", className),
1526
- ref
1527
- }, rest)
1528
- );
1529
- }
1530
- );
1531
- MessageDescription.displayName = "Message.Description";
1532
- var Message = (0, import_react31.forwardRef)(
1533
- (_a, ref) => {
1534
- var _b = _a, { children, className, variant = "success", icon, iconClassName } = _b, rest = __objRest(_b, ["children", "className", "variant", "icon", "iconClassName"]);
1535
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
1536
- Box,
1537
- __spreadProps(__spreadValues({
1538
- className: (0, import_typed_classname28.clsx)(`hds-message`, `hds-message--${variant}`, className),
1539
- ref
1540
- }, rest), {
1541
- children: [
1542
- variant === "neutral" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: (0, import_typed_classname28.clsx)("hds-message--neutral__icon", iconClassName), children: icon }),
1543
- children
1544
- ]
1545
- })
1546
- );
1547
- }
1548
- );
1549
- Message.displayName = "Message";
1550
- Message.Title = MessageTitle;
1551
- Message.Description = MessageDescription;
1552
-
1553
- // src/modal/modal.tsx
1554
- var import_react32 = require("react");
1555
- var import_typed_classname29 = require("@postenbring/hedwig-css/typed-classname");
1556
- var import_react_slot11 = require("@radix-ui/react-slot");
1557
- var import_jsx_runtime30 = require("react/jsx-runtime");
1558
- var ModalHeader = (0, import_react32.forwardRef)(
1559
- (_a, ref) => {
1560
- var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
1561
- const Component = asChild ? import_react_slot11.Slot : "h1";
1562
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1563
- Component,
1564
- __spreadValues({
1565
- className: (0, import_typed_classname29.clsx)("hds-modal__header", className),
1566
- ref
1567
- }, rest)
1568
- );
1569
- }
1570
- );
1571
- ModalHeader.displayName = "Modal.Header";
1572
- var ModalContent = (0, import_react32.forwardRef)(
1573
- (_a, ref) => {
1574
- var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
1575
- const Component = asChild ? import_react_slot11.Slot : "div";
1576
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1577
- Component,
1578
- __spreadValues({
1579
- className: (0, import_typed_classname29.clsx)("hds-modal__content", className),
1580
- ref
1581
- }, rest)
1582
- );
1583
- }
1584
- );
1585
- ModalContent.displayName = "Modal.Content";
1586
- var ModalFooter = (0, import_react32.forwardRef)(
1587
- (_a, ref) => {
1588
- var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
1589
- const Component = asChild ? import_react_slot11.Slot : "footer";
1590
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1591
- Component,
1592
- __spreadValues({
1593
- className: (0, import_typed_classname29.clsx)("hds-modal__footer", className),
1594
- ref
1595
- }, rest)
1596
- );
1597
- }
1598
- );
1599
- ModalFooter.displayName = "Modal.Footer";
1600
- var Modal = (0, import_react32.forwardRef)(
1601
- (_a, ref) => {
1602
- var _b = _a, { children, className, open, closeOnBackdropClick, onClick } = _b, rest = __objRest(_b, ["children", "className", "open", "closeOnBackdropClick", "onClick"]);
1603
- const modalRef = (0, import_react32.useRef)(null);
1604
- const mergedRef = useMergeRefs([modalRef, ref]);
1605
- function onCloseButtonClick() {
1606
- var _a2;
1607
- (_a2 = modalRef.current) == null ? void 0 : _a2.close();
1608
- return false;
1609
- }
1610
- useScrollLock(modalRef, "hds-modal-scroll-lock");
1611
- (0, import_react32.useEffect)(() => {
1612
- if (modalRef.current && open !== void 0) {
1613
- if (open && !modalRef.current.open) {
1614
- modalRef.current.showModal();
1615
- } else if (!open && modalRef.current.open) {
1616
- modalRef.current.close();
1617
- }
1618
- }
1619
- }, [modalRef, open]);
1620
- function onDialogClick(e) {
1621
- if (closeOnBackdropClick && e.target === modalRef.current) {
1622
- modalRef.current.close();
1623
- }
1624
- onClick == null ? void 0 : onClick(e);
1625
- }
1626
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1627
- Box,
1628
- {
1629
- asChild: true,
1630
- className: (0, import_typed_classname29.clsx)("hds-modal", className),
1631
- closeable: true,
1632
- onClick: onDialogClick,
1633
- onClose: onCloseButtonClick,
1634
- variant: "white",
1635
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("dialog", __spreadProps(__spreadValues({ ref: mergedRef }, rest), { children }))
1636
- }
1637
- );
1638
- }
1639
- );
1640
- Modal.displayName = "Modal";
1641
- Modal.Header = ModalHeader;
1642
- Modal.Content = ModalContent;
1643
- Modal.Footer = ModalFooter;
1644
- function useScrollLock(modalRef, bodyClass) {
1645
- (0, import_react32.useEffect)(() => {
1646
- if (!modalRef.current)
1647
- return;
1648
- if (modalRef.current.open)
1649
- document.body.classList.add(bodyClass);
1650
- const observer = new MutationObserver(() => {
1651
- var _a;
1652
- if ((_a = modalRef.current) == null ? void 0 : _a.open)
1653
- document.body.classList.add(bodyClass);
1654
- else
1655
- document.body.classList.remove(bodyClass);
1656
- });
1657
- observer.observe(modalRef.current, {
1658
- attributes: true,
1659
- attributeFilter: ["open"]
1660
- });
1661
- return () => {
1662
- observer.disconnect();
1663
- document.body.classList.remove(bodyClass);
1664
- };
1665
- }, [bodyClass, modalRef]);
1666
- }
1667
-
1668
- // src/navbar/navbar.tsx
1669
- var import_react34 = require("react");
1670
- var import_typed_classname31 = require("@postenbring/hedwig-css/typed-classname");
1671
- var import_react_slot12 = require("@radix-ui/react-slot");
1672
-
1673
- // src/navbar/navbar-expandable-menu.tsx
1674
- var import_react33 = require("react");
1675
- var import_typed_classname30 = require("@postenbring/hedwig-css/typed-classname");
1676
-
1677
- // src/navbar/icons.tsx
1678
- var import_jsx_runtime31 = require("react/jsx-runtime");
1679
- function CloseIcon() {
1680
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("svg", { "aria-hidden": true, xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1681
- "path",
1682
- {
1683
- fill: "currentColor",
1684
- d: "m13.16 12.25 3.621-3.586.739-.738c.105-.106.105-.281 0-.422l-.774-.774c-.14-.105-.316-.105-.422 0L12 11.09 7.64 6.73c-.105-.105-.28-.105-.421 0l-.774.774c-.105.14-.105.316 0 .422l4.36 4.324-4.36 4.36c-.105.105-.105.28 0 .421l.774.774c.14.105.316.105.422 0L12 13.445l3.586 3.621.738.739c.106.105.281.105.422 0l.774-.774c.105-.14.105-.316 0-.422l-4.36-4.359Z"
1685
- }
1686
- ) });
1687
- }
1688
- function MenuIcon() {
1689
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("svg", { "aria-hidden": true, xmlns: "http://www.w3.org/2000/svg", width: 32, height: 32, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1690
- "path",
1691
- {
1692
- fill: "currentColor",
1693
- d: "M25.938 10.146a.57.57 0 0 0 .562-.563v-1.5c0-.281-.281-.562-.563-.562H6.063a.57.57 0 0 0-.562.562v1.5c0 .328.234.563.563.563h19.875Zm0 7.5a.57.57 0 0 0 .562-.563v-1.5c0-.281-.281-.563-.563-.563H6.063a.57.57 0 0 0-.562.563v1.5c0 .328.234.563.563.563h19.875Zm0 7.5a.57.57 0 0 0 .562-.563v-1.5c0-.281-.281-.563-.563-.563H6.063a.57.57 0 0 0-.562.563v1.5c0 .328.234.563.563.563h19.875Z"
1694
- }
1695
- ) });
1696
- }
1697
-
1698
- // src/navbar/navbar-expandable-menu.tsx
1699
- var import_jsx_runtime32 = require("react/jsx-runtime");
1700
- var ExpandableMenuContext = (0, import_react33.createContext)(null);
1701
- var useNavbarExpendableMenuContext = () => {
1702
- const value = (0, import_react33.useContext)(ExpandableMenuContext);
1703
- if (value === null) {
1704
- throw new Error("useNavbarExpendableMenuContext must be used within a Navbar.ExpandableMenu");
1705
- }
1706
- return value;
1707
- };
1708
- function NavbarExpandableMenu({ children }) {
1709
- const contentId = (0, import_react33.useId)();
1710
- const [open, setOpen] = (0, import_react33.useState)(false);
1711
- (0, import_react33.useEffect)(() => {
1712
- if (open) {
1713
- window.scrollTo(0, 0);
1714
- document.body.classList.add((0, import_typed_classname30.clsx)("hds-navbar-scroll-lock"));
1715
- const releaseFocusTrap2 = focusTrap(
1716
- document.getElementsByClassName((0, import_typed_classname30.clsx)("hds-navbar"))[0]
1717
- );
1718
- return () => {
1719
- document.body.classList.remove((0, import_typed_classname30.clsx)("hds-navbar-scroll-lock"));
1720
- releaseFocusTrap2();
1721
- };
1722
- }
1723
- }, [open]);
1724
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ExpandableMenuContext.Provider, { value: { contentId, open, setOpen }, children });
1725
- }
1726
- NavbarExpandableMenu.displayName = "NavbarExpandableMenu";
1727
- var NavbarExpandableMenuTrigger = (0, import_react33.forwardRef)(
1728
- (_a, ref) => {
1729
- var _b = _a, {
1730
- whenClosedText,
1731
- whenClosedHelperTitle,
1732
- whenOpenText,
1733
- whenOpenHelperTitle,
1734
- style,
1735
- className
1736
- } = _b, rest = __objRest(_b, [
1737
- "whenClosedText",
1738
- "whenClosedHelperTitle",
1739
- "whenOpenText",
1740
- "whenOpenHelperTitle",
1741
- "style",
1742
- "className"
1743
- ]);
1744
- const { contentId, open, setOpen } = useNavbarExpendableMenuContext();
1745
- const [textWidth, setTextWidth] = (0, import_react33.useState)(void 0);
1746
- const measurementId = (0, import_react33.useId)();
1747
- (0, import_react33.useEffect)(() => {
1748
- var _a2, _b2, _c, _d;
1749
- const widthWhenOpen = (_b2 = (_a2 = document.getElementById(`${measurementId}-when-open`)) == null ? void 0 : _a2.getBoundingClientRect().width) != null ? _b2 : 0;
1750
- const widthWhenClosed = (_d = (_c = document.getElementById(`${measurementId}-when-closed`)) == null ? void 0 : _c.getBoundingClientRect().width) != null ? _d : 0;
1751
- setTextWidth(widthWhenOpen < widthWhenClosed ? widthWhenClosed : widthWhenOpen);
1752
- }, [measurementId]);
1753
- const text = open ? whenOpenText : whenClosedText;
1754
- const title = open ? whenOpenHelperTitle : whenClosedHelperTitle;
1755
- const icon = open ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MenuIcon, {});
1756
- function toggleOpen() {
1757
- setOpen(!open);
1758
- }
1759
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
1760
- "button",
1761
- __spreadProps(__spreadValues({
1762
- "aria-expanded": open,
1763
- "aria-controls": contentId,
1764
- className: (0, import_typed_classname30.clsx)("hds-navbar__item", className),
1765
- onClick: toggleOpen,
1766
- ref,
1767
- title,
1768
- type: "button",
1769
- style: __spreadValues({ position: "relative" }, style)
1770
- }, rest), {
1771
- children: [
1772
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1773
- "span",
1774
- {
1775
- id: `${measurementId}-when-closed`,
1776
- "aria-hidden": true,
1777
- style: {
1778
- position: "absolute",
1779
- visibility: "hidden",
1780
- pointerEvents: "none",
1781
- whiteSpace: "nowrap"
1782
- },
1783
- children: whenOpenText
1784
- }
1785
- ),
1786
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1787
- "span",
1788
- {
1789
- id: `${measurementId}-when-open`,
1790
- "aria-hidden": true,
1791
- style: {
1792
- position: "absolute",
1793
- visibility: "hidden",
1794
- pointerEvents: "none",
1795
- whiteSpace: "nowrap"
1796
- },
1797
- children: whenClosedText
1798
- }
1799
- ),
1800
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1801
- "span",
1802
- {
1803
- style: { width: textWidth, whiteSpace: "nowrap" },
1804
- className: (0, import_typed_classname30.clsx)("hds-navbar__item-responsive-text"),
1805
- children: text
1806
- }
1807
- ),
1808
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { style: { width: 32, height: 32 }, children: icon })
1809
- ]
1810
- })
1811
- );
1812
- }
1813
- );
1814
- NavbarExpandableMenuTrigger.displayName = "Navbar.ExpandableMenuTrigger";
1815
- var NavbarExpandableMenuContent = (0, import_react33.forwardRef)((_a, ref) => {
1816
- var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
1817
- const { contentId, open } = useNavbarExpendableMenuContext();
1818
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1819
- "section",
1820
- __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
1821
- id: contentId,
1822
- className: (0, import_typed_classname30.clsx)("hds-navbar__expandable-menu-content", className),
1823
- "data-state": open ? "open" : "closed"
1824
- }), { inert: open ? void 0 : "true" }), {
1825
- ref,
1826
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: (0, import_typed_classname30.clsx)("hds-navbar__expandable-menu-content-inner"), children })
1827
- })
1828
- );
1829
- });
1830
- NavbarExpandableMenuContent.displayName = "Navbar.ExpandableMenuContent";
1831
-
1832
- // src/navbar/navbar.tsx
1833
- var import_jsx_runtime33 = require("react/jsx-runtime");
1834
- var NavbarLogo = (0, import_react34.forwardRef)(
1835
- (_a, ref) => {
1836
- var _b = _a, { children, className, asChild } = _b, rest = __objRest(_b, ["children", "className", "asChild"]);
1837
- const Component = asChild ? import_react_slot12.Slot : "div";
1838
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Component, __spreadProps(__spreadValues({ className: (0, import_typed_classname31.clsx)(`hds-navbar__logo`, className), ref }, rest), { children }));
1839
- }
1840
- );
1841
- NavbarLogo.displayName = "Navbar.Logo";
1842
- var NavbarLogoAndServiceText = (0, import_react34.forwardRef)(
1843
- (_a, ref) => {
1844
- var _b = _a, { children, asChild, variant, className } = _b, rest = __objRest(_b, ["children", "asChild", "variant", "className"]);
1845
- const Component = asChild ? import_react_slot12.Slot : "div";
1846
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1847
- Component,
1848
- __spreadProps(__spreadValues({
1849
- ref,
1850
- className: (0, import_typed_classname31.clsx)(
1851
- "hds-navbar__logo-and-service-text",
1852
- `hds-navbar__logo-and-service-text--${variant}`,
1853
- className
1854
- )
1855
- }, rest), {
1856
- children
1857
- })
1858
- );
1859
- }
1860
- );
1861
- NavbarLogoAndServiceText.displayName = "Navbar.NavbarLogoAndText";
1862
- var NavbarItemIcon = (0, import_react34.forwardRef)(
1863
- (_a, ref) => {
1864
- var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
1865
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_slot12.Slot, __spreadProps(__spreadValues({ className: (0, import_typed_classname31.clsx)("hds-navbar__item-icon", className), ref }, rest), { children }));
1866
- }
1867
- );
1868
- NavbarItemIcon.displayName = "Navbar.ItemIcon";
1869
- var NavbarItem = (0, import_react34.forwardRef)(
1870
- (_a, ref) => {
1871
- var _b = _a, { asChild, children, className } = _b, rest = __objRest(_b, ["asChild", "children", "className"]);
1872
- const Component = asChild ? import_react_slot12.Slot : "div";
1873
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Component, __spreadProps(__spreadValues({ className: (0, import_typed_classname31.clsx)("hds-navbar__item", className), ref }, rest), { children }));
1874
- }
1875
- );
1876
- NavbarItem.displayName = "Navbar.Item";
1877
- var NavbarButtonItem = (0, import_react34.forwardRef)(
1878
- (_a, ref) => {
1879
- var _b = _a, { asChild, children, className } = _b, rest = __objRest(_b, ["asChild", "children", "className"]);
1880
- const Component = asChild ? import_react_slot12.Slot : "button";
1881
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1882
- Component,
1883
- __spreadProps(__spreadValues({
1884
- className: (0, import_typed_classname31.clsx)("hds-navbar__item", className),
1885
- ref,
1886
- type: "button"
1887
- }, rest), {
1888
- children
1889
- })
1890
- );
1891
- }
1892
- );
1893
- NavbarButtonItem.displayName = "Navbar.ButtonItem";
1894
- var NavbarLinkItem = (0, import_react34.forwardRef)(
1895
- (_a, ref) => {
1896
- var _b = _a, { asChild, children, className } = _b, rest = __objRest(_b, ["asChild", "children", "className"]);
1897
- const Component = asChild ? import_react_slot12.Slot : "a";
1898
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Component, __spreadProps(__spreadValues({ className: (0, import_typed_classname31.clsx)("hds-navbar__item", className), ref }, rest), { children }));
1899
- }
1900
- );
1901
- NavbarLinkItem.displayName = "Navbar.LinkItem";
1902
- var NavbarNavigation = (0, import_react34.forwardRef)(
1903
- (_a, ref) => {
1904
- var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
1905
- const Component = asChild ? import_react_slot12.Slot : "div";
1906
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1907
- Component,
1908
- __spreadValues({
1909
- className: (0, import_typed_classname31.clsx)("hds-navbar__navigation", className),
1910
- ref
1911
- }, rest)
1912
- );
1913
- }
1914
- );
1915
- NavbarNavigation.displayName = "Navbar.Navigation";
1916
- var Navbar = (0, import_react34.forwardRef)(
1917
- (_a, ref) => {
1918
- var _b = _a, { asChild, children, className, variant } = _b, rest = __objRest(_b, ["asChild", "children", "className", "variant"]);
1919
- const Component = asChild ? import_react_slot12.Slot : "header";
1920
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1921
- Component,
1922
- __spreadProps(__spreadValues({
1923
- className: (0, import_typed_classname31.clsx)("hds-navbar", variant && `hds-navbar--${variant}`, className),
1924
- ref
1925
- }, rest), {
1926
- children
1927
- })
1928
- );
1929
- }
1930
- );
1931
- Navbar.displayName = "Navbar";
1932
- Navbar.Logo = NavbarLogo;
1933
- Navbar.LogoAndServiceText = NavbarLogoAndServiceText;
1934
- Navbar.ExpandableMenu = NavbarExpandableMenu;
1935
- Navbar.ExpandableMenuTrigger = NavbarExpandableMenuTrigger;
1936
- Navbar.ExpandableMenuContent = NavbarExpandableMenuContent;
1937
- Navbar.Item = NavbarItem;
1938
- Navbar.ButtonItem = NavbarButtonItem;
1939
- Navbar.LinkItem = NavbarLinkItem;
1940
- Navbar.ItemIcon = NavbarItemIcon;
1941
- Navbar.Navigation = NavbarNavigation;
1942
-
1943
- // src/show-more/show-more.tsx
1944
- var import_typed_classname32 = require("@postenbring/hedwig-css/typed-classname");
1945
- var import_react35 = require("react");
1946
- var import_jsx_runtime34 = require("react/jsx-runtime");
1947
- var ShowMoreButton = (0, import_react35.forwardRef)(
1948
- (_a, ref) => {
1949
- var _b = _a, { text, variant, expanded, className } = _b, rest = __objRest(_b, ["text", "variant", "expanded", "className"]);
1950
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
1951
- "button",
1952
- __spreadProps(__spreadValues({
1953
- ref,
1954
- className: (0, import_typed_classname32.clsx)(
1955
- "hds-show-more",
1956
- variant === "show-more-show-less" && "hds-show-more--show-less",
1957
- className
1958
- ),
1959
- "data-state": expanded ? "expanded" : void 0,
1960
- type: "button"
1961
- }, rest), {
1962
- children: [
1963
- text,
1964
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: (0, import_typed_classname32.clsx)("hds-show-more__icon") })
1965
- ]
1966
- })
1967
- );
1968
- }
1969
- );
1970
- ShowMoreButton.displayName = "ShowMoreButton";
1971
-
1972
- // src/skeleton/skeleton.tsx
1973
- var import_typed_classname33 = require("@postenbring/hedwig-css/typed-classname");
1974
- var import_react_slot13 = require("@radix-ui/react-slot");
1975
- var import_react36 = require("react");
1976
- var import_jsx_runtime35 = require("react/jsx-runtime");
1977
- var Skeleton = (0, import_react36.forwardRef)(
1978
- (_a, ref) => {
1979
- var _b = _a, {
1980
- as: Tag = "div",
1981
- asChild,
1982
- children,
1983
- animation = true,
1984
- variant = "text",
1985
- width,
1986
- height,
1987
- className,
1988
- style
1989
- } = _b, rest = __objRest(_b, [
1990
- "as",
1991
- "asChild",
1992
- "children",
1993
- "animation",
1994
- "variant",
1995
- "width",
1996
- "height",
1997
- "className",
1998
- "style"
1999
- ]);
2000
- const Component = asChild ? import_react_slot13.Slot : Tag;
2001
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2002
- Component,
2003
- __spreadProps(__spreadValues(__spreadProps(__spreadValues({
2004
- className: (0, import_typed_classname33.clsx)(
2005
- "hds-skeleton",
2006
- `hds-skeleton--${variant}`,
2007
- !animation && `hds-skeleton--no-animation`,
2008
- className
2009
- ),
2010
- style: __spreadProps(__spreadValues({}, style), { width, height }),
2011
- "aria-hidden": true
2012
- }, { inert: "true" }), {
2013
- ref
2014
- }), rest), {
2015
- children
2016
- })
2017
- );
2018
- }
2019
- );
2020
- Skeleton.displayName = "Skeleton";
2021
-
2022
- // src/step-indicator/step-indicator.tsx
2023
- var import_typed_classname34 = require("@postenbring/hedwig-css/typed-classname");
2024
- var import_react37 = require("react");
2025
- var import_jsx_runtime36 = require("react/jsx-runtime");
2026
- var StepIndicator = (0, import_react37.forwardRef)(
2027
- (_a, ref) => {
2028
- var _b = _a, {
2029
- activeStep,
2030
- totalSteps,
2031
- className,
2032
- label,
2033
- lang = "en",
2034
- title,
2035
- titleAs: TitleComponent
2036
- } = _b, rest = __objRest(_b, [
2037
- "activeStep",
2038
- "totalSteps",
2039
- "className",
2040
- "label",
2041
- "lang",
2042
- "title",
2043
- "titleAs"
2044
- ]);
2045
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
2046
- "div",
2047
- __spreadProps(__spreadValues({
2048
- ref,
2049
- className: (0, import_typed_classname34.clsx)("hds-step-indicator", className),
2050
- lang
2051
- }, rest), {
2052
- children: [
2053
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: (0, import_typed_classname34.clsx)("hds-step-indicator__header"), children: [
2054
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: (0, import_typed_classname34.clsx)("hds-step-indicator__left-label"), children: label }),
2055
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: stepLabelTranslations[lang](activeStep, totalSteps) })
2056
- ] }),
2057
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: (0, import_typed_classname34.clsx)("hds-step-indicator__steps"), children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2058
- "div",
2059
- {
2060
- className: (0, import_typed_classname34.clsx)("hds-step-indicator__step"),
2061
- "data-state": getStepState(i + 1, activeStep)
2062
- },
2063
- i
2064
- )) }),
2065
- title ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TitleComponent, { className: (0, import_typed_classname34.clsx)("hds-step-indicator__title"), children: title }) : null
2066
- ]
2067
- })
2068
- );
2069
- }
2070
- );
2071
- StepIndicator.displayName = "StepIndicator";
2072
- var stepLabelTranslations = {
2073
- no: (activeStep, totalSteps) => `steg ${activeStep} av ${totalSteps}`,
2074
- en: (activeStep, totalSteps) => `step ${activeStep} of ${totalSteps}`,
2075
- da: (activeStep, totalSteps) => `trin ${activeStep} af ${totalSteps}`,
2076
- sv: (activeStep, totalSteps) => `steg ${activeStep} av ${totalSteps}`
2077
- };
2078
- function getStepState(renderedStep, activeStep) {
2079
- if (renderedStep < activeStep) {
2080
- return "previous";
2081
- }
2082
- if (renderedStep === activeStep) {
2083
- return "active";
2084
- }
2085
- return "next";
2086
- }
2087
-
2088
- // src/styled-html/styled-html.tsx
2089
- var import_react38 = require("react");
2090
- var import_typed_classname35 = require("@postenbring/hedwig-css/typed-classname");
2091
- var import_react_slot14 = require("@radix-ui/react-slot");
2092
- var import_jsx_runtime37 = require("react/jsx-runtime");
2093
- var StyledHtml = (0, import_react38.forwardRef)(
2094
- (_a, ref) => {
2095
- var _b = _a, { asChild, children, size, darkmode = false, className } = _b, rest = __objRest(_b, ["asChild", "children", "size", "darkmode", "className"]);
2096
- const Component = asChild ? import_react_slot14.Slot : "div";
2097
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2098
- Component,
2099
- __spreadProps(__spreadValues({
2100
- className: (0, import_typed_classname35.clsx)(
2101
- `hds-styled-html`,
2102
- size === "small" && "hds-styled-html--small",
2103
- darkmode && "hds-styled-html--darkmode",
2104
- className
2105
- ),
2106
- ref
2107
- }, rest), {
2108
- children
2109
- })
2110
- );
2111
- }
2112
- );
2113
- StyledHtml.displayName = "StyledHtml";
2114
-
2115
- // src/table/table.tsx
2116
- var import_typed_classname36 = require("@postenbring/hedwig-css/typed-classname");
2117
- var import_react39 = require("react");
2118
- var import_jsx_runtime38 = require("react/jsx-runtime");
2119
- var Table = (0, import_react39.forwardRef)(
2120
- (_a, ref) => {
2121
- var _b = _a, { children, className, size, caption, description } = _b, rest = __objRest(_b, ["children", "className", "size", "caption", "description"]);
2122
- const descriptionId = (0, import_react39.useId)();
2123
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
2124
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
2125
- "table",
2126
- __spreadProps(__spreadValues({
2127
- "aria-describedby": description ? descriptionId : void 0,
2128
- ref,
2129
- className: (0, import_typed_classname36.clsx)(
2130
- "hds-table",
2131
- {
2132
- "hds-table--compressed": size === "compressed",
2133
- "hds-table--mobile-compressed": size === "mobile-compressed"
2134
- },
2135
- className
2136
- )
2137
- }, rest), {
2138
- children: [
2139
- caption ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("caption", { children: caption }) : null,
2140
- children
2141
- ]
2142
- })
2143
- ),
2144
- description ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: (0, import_typed_classname36.clsx)("hds-table-description"), id: descriptionId, children: description }) : null
2145
- ] });
2146
- }
2147
- );
2148
- Table.displayName = "Table";
2149
-
2150
- // src/tabs/tabs.tsx
2151
- var import_react43 = require("react");
2152
- var import_typed_classname39 = require("@postenbring/hedwig-css/typed-classname");
2153
- var import_react_slot16 = require("@radix-ui/react-slot");
2154
-
2155
- // src/tabs/context.ts
2156
- var import_react40 = require("react");
2157
- var TabsContext = (0, import_react40.createContext)(null);
2158
- function useTabsContext() {
2159
- const context = (0, import_react40.useContext)(TabsContext);
2160
- if (!context) {
2161
- throw new Error(
2162
- "Tabs context required. Did you use `<Tabs.List />`, `<Tabs.Tab />`, or `<Tabs.Content />` outside of <Tabs/>?"
2163
- );
2164
- }
2165
- return context;
2166
- }
2167
-
2168
- // src/tabs/tabs-content.tsx
2169
- var import_react41 = require("react");
2170
- var import_typed_classname37 = require("@postenbring/hedwig-css/typed-classname");
2171
- var import_react_slot15 = require("@radix-ui/react-slot");
2172
- var import_jsx_runtime39 = require("react/jsx-runtime");
2173
- var TabsContents = (0, import_react41.forwardRef)(
2174
- (_a, ref) => {
2175
- var _b = _a, { asChild, children } = _b, rest = __objRest(_b, ["asChild", "children"]);
2176
- const Component = asChild ? import_react_slot15.Slot : "div";
2177
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Component, __spreadProps(__spreadValues({ ref, className: (0, import_typed_classname37.clsx)("hds-tabs__contents") }, rest), { children }));
2178
- }
2179
- );
2180
- TabsContents.displayName = "Tabs.Contents";
2181
- var TabsContent = (0, import_react41.forwardRef)(
2182
- (_a, ref) => {
2183
- var _b = _a, { asChild, forTabId, children } = _b, rest = __objRest(_b, ["asChild", "forTabId", "children"]);
2184
- const context = useTabsContext();
2185
- const Component = asChild ? import_react_slot15.Slot : "div";
2186
- if (context.activeTabId === forTabId) {
2187
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Component, __spreadProps(__spreadValues({}, rest), { ref, children }));
2188
- }
2189
- return null;
2190
- }
2191
- );
2192
- TabsContent.displayName = "Tabs.Content";
2193
-
2194
- // src/tabs/tabs-list.tsx
2195
- var import_react42 = require("react");
2196
- var import_typed_classname38 = require("@postenbring/hedwig-css/typed-classname");
2197
- var import_jsx_runtime40 = require("react/jsx-runtime");
2198
- var TabsList = (0, import_react42.forwardRef)(
2199
- (_a, ref) => {
2200
- var _b = _a, { children, direction = "horizontal", className } = _b, rest = __objRest(_b, ["children", "direction", "className"]);
2201
- const { activeTabId } = useTabsContext();
2202
- const tabsListRef = (0, import_react42.useRef)(null);
2203
- const mergedRef = useMergeRefs([tabsListRef, ref]);
2204
- const { width: tabsWidth } = useResize(tabsListRef);
2205
- const isClientSide = useHydrated();
2206
- const { innerWidth } = isClientSide ? window : { innerWidth: 1e3 };
2207
- const wideEnough = innerWidth >= tabsWidth;
2208
- const previousTabId = (0, import_react42.useRef)(activeTabId);
2209
- (0, import_react42.useEffect)(() => {
2210
- const tabList = tabsListRef.current;
2211
- const activeTab = tabList == null ? void 0 : tabList.querySelector(`[data-tabid="${activeTabId}"]`);
2212
- if (!activeTab || !tabList)
2213
- return;
2214
- const { offsetHeight: containerHeight, offsetWidth: containerWidth } = tabList;
2215
- const { offsetHeight, offsetWidth, offsetTop, offsetLeft } = activeTab;
2216
- const height = offsetHeight / containerHeight;
2217
- const width = offsetWidth / containerWidth;
2218
- tabsListRef.current.style.setProperty("--_hds-tabs-marker-height", String(height));
2219
- tabsListRef.current.style.setProperty("--_hds-tabs-marker-width", String(width));
2220
- tabsListRef.current.style.setProperty("--_hds-tabs-marker-top", `${offsetTop}px`);
2221
- tabsListRef.current.style.setProperty("--_hds-tabs-marker-left", `${offsetLeft}px`);
2222
- if (previousTabId.current !== activeTabId) {
2223
- tabsListRef.current.style.setProperty(
2224
- "--_hds-tabs-marker-animated-color",
2225
- "var(--_hds-tabs-marker-color)"
2226
- );
2227
- tabsListRef.current.style.setProperty(
2228
- "--_hds-tabs-marker-border-fallback-color",
2229
- "transparent"
2230
- );
2231
- }
2232
- previousTabId.current = activeTabId;
2233
- }, [activeTabId, innerWidth]);
2234
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2235
- "div",
2236
- __spreadProps(__spreadValues({
2237
- className: (0, import_typed_classname38.clsx)(
2238
- "hds-tabs__list",
2239
- direction === "horizontal" ? {
2240
- "hds-tabs__list--horizontal": wideEnough,
2241
- "hds-tabs__list--vertical": !wideEnough
2242
- } : {
2243
- "hds-tabs__list--vertical": true
2244
- },
2245
- className
2246
- ),
2247
- ref: mergedRef,
2248
- role: "tablist"
2249
- }, rest), {
2250
- children
2251
- })
2252
- );
2253
- }
2254
- );
2255
- TabsList.displayName = "Tabs.List";
2256
- var TabsTab = (0, import_react42.forwardRef)(
2257
- (_a, ref) => {
2258
- var _b = _a, { children, tabId, className, onClick } = _b, rest = __objRest(_b, ["children", "tabId", "className", "onClick"]);
2259
- const context = useTabsContext();
2260
- const toggleTab = (e) => {
2261
- e.preventDefault();
2262
- context.toggleActiveTabId(tabId);
2263
- onClick == null ? void 0 : onClick(e);
2264
- };
2265
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2266
- "button",
2267
- __spreadProps(__spreadValues({
2268
- className: (0, import_typed_classname38.clsx)(
2269
- "hds-tabs__tab",
2270
- { "hds-tabs__tab--active": context.activeTabId === tabId },
2271
- className
2272
- ),
2273
- "data-tabid": tabId,
2274
- onClick: toggleTab,
2275
- ref,
2276
- type: "button",
2277
- role: "tab"
2278
- }, rest), {
2279
- children
2280
- })
2281
- );
2282
- }
2283
- );
2284
- TabsTab.displayName = "Tabs.Tab";
2285
-
2286
- // src/tabs/tabs.tsx
2287
- var import_jsx_runtime41 = require("react/jsx-runtime");
2288
- var Tabs = (0, import_react43.forwardRef)(
2289
- (_a, ref) => {
2290
- var _b = _a, { asChild, defaultTab, children } = _b, rest = __objRest(_b, ["asChild", "defaultTab", "children"]);
2291
- const [activeTabId, setActiveTabId] = (0, import_react43.useState)(defaultTab);
2292
- const Component = asChild ? import_react_slot16.Slot : "div";
2293
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Component, __spreadProps(__spreadValues({ className: (0, import_typed_classname39.clsx)("hds-tabs"), ref }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TabsContext.Provider, { value: { activeTabId, toggleActiveTabId: setActiveTabId }, children }) }));
2294
- }
2295
- );
2296
- Tabs.displayName = "Tabs";
2297
- Tabs.List = TabsList;
2298
- Tabs.Tab = TabsTab;
2299
- Tabs.Contents = TabsContents;
2300
- Tabs.Content = TabsContent;
2301
-
2302
- // src/text/text.tsx
2303
- var import_react44 = require("react");
2304
- var import_typed_classname40 = require("@postenbring/hedwig-css/typed-classname");
2305
- var import_react_slot17 = require("@radix-ui/react-slot");
2306
- var import_jsx_runtime42 = require("react/jsx-runtime");
2307
- var defaultHTMLTag = {
2308
- "h1-display": "h1",
2309
- h1: "h1",
2310
- h2: "h2",
2311
- h3: "h3",
2312
- "h3-title": "h3",
2313
- body: "p",
2314
- "body-title": "p",
2315
- "body-small": "p",
2316
- "body-small-title": "p",
2317
- technical: "p",
2318
- "technical-title": "p",
2319
- caption: "p",
2320
- "caption-title": "p"
2321
- };
2322
- var Text = (0, import_react44.forwardRef)(
2323
- (_a, ref) => {
2324
- var _b = _a, {
2325
- as: Tag,
2326
- asChild,
2327
- variant = "body",
2328
- size = "fluid",
2329
- _unstableSpacing: spacing,
2330
- children,
2331
- className
2332
- } = _b, rest = __objRest(_b, [
2333
- "as",
2334
- "asChild",
2335
- "variant",
2336
- "size",
2337
- "_unstableSpacing",
2338
- "children",
2339
- "className"
2340
- ]);
2341
- const Component = asChild ? import_react_slot17.Slot : Tag != null ? Tag : defaultHTMLTag[variant];
2342
- const sizeModifier = size !== "fluid" && variant !== "caption" && variant !== "caption-title" && size;
2343
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2344
- Component,
2345
- __spreadProps(__spreadValues({
2346
- className: (0, import_typed_classname40.clsx)(
2347
- `hds-text-${variant}`,
2348
- sizeModifier && `hds-text--${sizeModifier}`,
2349
- spacing && "hds-text--spacing",
2350
- className
2351
- ),
2352
- ref
2353
- }, rest), {
2354
- children
2355
- })
2356
- );
2357
- }
2358
- );
2359
- Text.displayName = "Text";
2360
-
2361
- // src/utils/auto-animate-height.tsx
2362
- var import_react45 = require("react");
2363
- var import_jsx_runtime43 = require("react/jsx-runtime");
2364
- var AutoAnimateHeight = (0, import_react45.forwardRef)(
2365
- (_a, ref) => {
2366
- var _b = _a, {
2367
- children,
2368
- style,
2369
- animationDuration = "quick",
2370
- animationEasing = "normal",
2371
- onTransitionEnd
2372
- } = _b, rest = __objRest(_b, [
2373
- "children",
2374
- "style",
2375
- "animationDuration",
2376
- "animationEasing",
2377
- "onTransitionEnd"
2378
- ]);
2379
- var _a2, _b2;
2380
- const rootRef = (0, import_react45.useRef)(null);
2381
- const mergedRef = useMergeRefs([rootRef, ref]);
2382
- const measurementRef = (0, import_react45.useRef)(null);
2383
- const [height, setHeight] = (0, import_react45.useState)(
2384
- void 0
2385
- );
2386
- const [clonedChildren, setClonedChildren] = (0, import_react45.useState)(
2387
- () => (0, import_react45.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_jsx_runtime43.Fragment, { children }), {})
2388
- );
2389
- (0, import_react45.useEffect)(() => {
2390
- var _a3;
2391
- if (!rootRef.current)
2392
- return;
2393
- if (!measurementRef.current)
2394
- return;
2395
- if (document.body.scrollHeight === 0)
2396
- return;
2397
- const currentMeasurement = measurementRef.current;
2398
- const { height: newHeight } = currentMeasurement.getBoundingClientRect();
2399
- let previouslyObservedHeight = newHeight;
2400
- const resizeObserver = new ResizeObserver(() => {
2401
- const { height: resizedHeight } = currentMeasurement.getBoundingClientRect();
2402
- if (resizedHeight === previouslyObservedHeight)
2403
- return;
2404
- previouslyObservedHeight = resizedHeight;
2405
- setHeight({ height: resizedHeight, shouldAnimate: false });
2406
- });
2407
- resizeObserver.observe(currentMeasurement);
2408
- setHeight({ height: newHeight, shouldAnimate: true });
2409
- const nextClonedChildren = (0, import_react45.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_jsx_runtime43.Fragment, { children }), {});
2410
- if (newHeight >= ((_a3 = height == null ? void 0 : height.height) != null ? _a3 : 0)) {
2411
- setClonedChildren(nextClonedChildren);
2412
- return () => {
2413
- resizeObserver.disconnect();
2414
- };
2415
- }
2416
- const currentRoot = rootRef.current;
2417
- function onTransitionEndHandler(e) {
2418
- if (e.propertyName !== "height")
2419
- return;
2420
- setClonedChildren(nextClonedChildren);
2421
- }
2422
- currentRoot.addEventListener("transitionend", onTransitionEndHandler);
2423
- return () => {
2424
- resizeObserver.disconnect();
2425
- currentRoot.removeEventListener("transitionend", onTransitionEndHandler);
2426
- };
2427
- }, [children]);
2428
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
2429
- "div",
2430
- __spreadProps(__spreadValues({
2431
- ref: mergedRef,
2432
- onTransitionEnd,
2433
- style: __spreadValues({
2434
- position: "relative",
2435
- overflow: "hidden",
2436
- height: (_b2 = height == null ? void 0 : height.height) != null ? _b2 : (_a2 = measurementRef.current) == null ? void 0 : _a2.getBoundingClientRect().height,
2437
- transitionProperty: (height == null ? void 0 : height.shouldAnimate) ? "height" : "none",
2438
- transitionDuration: `var(--hds-micro-animation-duration-${animationDuration})`,
2439
- transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})`,
2440
- willChange: "height"
2441
- }, style)
2442
- }, rest), {
2443
- children: [
2444
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2445
- "div",
2446
- {
2447
- "aria-hidden": true,
2448
- ref: measurementRef,
2449
- style: {
2450
- position: "absolute",
2451
- visibility: "hidden",
2452
- pointerEvents: "none"
2453
- },
2454
- children
2455
- }
2456
- ),
2457
- clonedChildren
2458
- ]
2459
- })
2460
- );
2461
- }
2462
- );
2463
- AutoAnimateHeight.displayName = "AutoAnimateHeight";
2464
-
2465
- // src/warning-banner/warning-banner.tsx
2466
- var import_react46 = require("react");
2467
- var import_typed_classname41 = require("@postenbring/hedwig-css/typed-classname");
2468
- var import_jsx_runtime44 = require("react/jsx-runtime");
2469
- var WarningBanner = (0, import_react46.forwardRef)(
2470
- (_a, ref) => {
2471
- var _b = _a, { title, description, className } = _b, rest = __objRest(_b, ["title", "description", "className"]);
2472
- const descriptionId = (0, import_react46.useId)();
2473
- const expandable = !!description;
2474
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", __spreadProps(__spreadValues({}, rest), { className: (0, import_typed_classname41.clsx)("hds-warning-banner", className), ref, children: [
2475
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2476
- WarningBannerTitle,
2477
- {
2478
- variant: expandable ? "expandable" : "default",
2479
- descriptionId,
2480
- children: title
2481
- }
2482
- ),
2483
- expandable ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(WarningBannerDescription, { id: descriptionId, children: description }) : null
2484
- ] }));
2485
- }
2486
- );
2487
- WarningBanner.displayName = "WarningBanner";
2488
- var WarningBannerTitle = (0, import_react46.forwardRef)((_a, ref) => {
2489
- var _b = _a, { variant, descriptionId, children, className } = _b, rest = __objRest(_b, ["variant", "descriptionId", "children", "className"]);
2490
- const [open, setOpen] = (0, import_react46.useState)(false);
2491
- if (variant === "expandable") {
2492
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2493
- "button",
2494
- __spreadProps(__spreadValues({}, rest), {
2495
- "aria-expanded": open,
2496
- "aria-controls": descriptionId,
2497
- "data-state": open ? "open" : "closed",
2498
- className: (0, import_typed_classname41.clsx)(
2499
- "hds-warning-banner__title",
2500
- "hds-warning-banner__title-trigger",
2501
- className
2502
- ),
2503
- onClick: () => {
2504
- setOpen((prev) => !prev);
2505
- },
2506
- ref,
2507
- type: "button",
2508
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children })
2509
- })
2510
- );
2511
- }
2512
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2513
- "p",
2514
- __spreadProps(__spreadValues({}, rest), {
2515
- className: (0, import_typed_classname41.clsx)("hds-warning-banner__title", className),
2516
- ref,
2517
- children
2518
- })
2519
- );
2520
- });
2521
- WarningBannerTitle.displayName = "WarningBannerTitle";
2522
- var WarningBannerDescription = (0, import_react46.forwardRef)(
2523
- (_a, ref) => {
2524
- var _b = _a, { className, id } = _b, rest = __objRest(_b, ["className", "id"]);
2525
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
2526
- "p",
2527
- __spreadValues({
2528
- id,
2529
- className: (0, import_typed_classname41.clsx)("hds-warning-banner__description", className),
2530
- ref
2531
- }, rest)
2532
- );
2533
- }
2534
- );
2535
- WarningBannerDescription.displayName = "WarningBannerDescription";
2536
- // Annotate the CommonJS export names for ESM import in node:
2537
- 0 && (module.exports = {
2538
- Accordion,
2539
- AccordionContent,
2540
- AccordionHeader,
2541
- AccordionItem,
2542
- AutoAnimateHeight,
2543
- Badge,
2544
- Box,
2545
- BoxCloseButton,
2546
- Breadcrumbs,
2547
- Button,
2548
- Card,
2549
- CardBody,
2550
- CardBodyAction,
2551
- CardBodyActionArrow,
2552
- CardBodyDescription,
2553
- CardBodyHeader,
2554
- CardBodyHeaderOverline,
2555
- CardBodyHeaderTitle,
2556
- CardMedia,
2557
- CardMediaImg,
2558
- Checkbox,
2559
- Container,
2560
- DatePicker,
2561
- DescriptionList,
2562
- ErrorMessage,
2563
- Fieldset,
2564
- Footer,
2565
- FooterButtonLink,
2566
- FooterLinkSection,
2567
- FooterLinkSections,
2568
- FooterLogo,
2569
- Grid,
2570
- GridItem,
2571
- HStack,
2572
- HelpText,
2573
- Input,
2574
- Link,
2575
- LinkList,
2576
- Message,
2577
- MessageDescription,
2578
- MessageTitle,
2579
- Modal,
2580
- ModalContent,
2581
- ModalFooter,
2582
- ModalHeader,
2583
- Navbar,
2584
- NavbarButtonItem,
2585
- NavbarExpandableMenu,
2586
- NavbarExpandableMenuContent,
2587
- NavbarExpandableMenuTrigger,
2588
- NavbarItem,
2589
- NavbarItemIcon,
2590
- NavbarLinkItem,
2591
- NavbarLogo,
2592
- NavbarLogoAndServiceText,
2593
- NavbarNavigation,
2594
- OrderedList,
2595
- RadioGroup,
2596
- Radiobutton,
2597
- Select,
2598
- ShowMoreButton,
2599
- Skeleton,
2600
- Stack,
2601
- StepIndicator,
2602
- StyledHtml,
2603
- Table,
2604
- Tabs,
2605
- TabsContent,
2606
- TabsContents,
2607
- TabsList,
2608
- TabsTab,
2609
- Text,
2610
- Textarea,
2611
- UnorderedList,
2612
- VStack,
2613
- WarningBanner,
2614
- focusTrap,
2615
- useFieldsetContext,
2616
- useHydrated,
2617
- useMergeRefs,
2618
- useNavbarExpendableMenuContext,
2619
- useRadioGroupContext,
2620
- useResize
2621
- });
2622
- //# sourceMappingURL=index-no-css.js.map