@postenbring/hedwig-react 2.1.4 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/accordion-content.d.ts.map +1 -1
- package/dist/accordion/accordion-content.js +22 -6
- package/dist/accordion/accordion-content.js.map +1 -1
- package/dist/accordion/accordion-content.mjs +4 -1
- package/dist/accordion/accordion.js +24 -6
- package/dist/accordion/accordion.js.map +1 -1
- package/dist/accordion/accordion.mjs +5 -2
- package/dist/accordion/index.js +24 -6
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +5 -2
- package/dist/alert/alert.d.ts +36 -0
- package/dist/alert/alert.d.ts.map +1 -0
- package/dist/alert/alert.js +186 -0
- package/dist/alert/alert.js.map +1 -0
- package/dist/alert/alert.mjs +13 -0
- package/dist/alert/alert.mjs.map +1 -0
- package/dist/alert/index.d.ts +3 -0
- package/dist/alert/index.d.ts.map +1 -0
- package/dist/alert/index.js +188 -0
- package/dist/alert/index.js.map +1 -0
- package/dist/alert/index.mjs +14 -0
- package/dist/alert/index.mjs.map +1 -0
- package/dist/{chunk-GVO57ZWU.mjs → chunk-23IZCRJA.mjs} +2 -2
- package/dist/chunk-4P4GPVKZ.mjs +63 -0
- package/dist/chunk-4P4GPVKZ.mjs.map +1 -0
- package/dist/{chunk-KNGG6M2I.mjs → chunk-5RXT5GLF.mjs} +2 -2
- package/dist/{chunk-ILFK3VKS.mjs → chunk-77M2ZTP7.mjs} +6 -3
- package/dist/chunk-77M2ZTP7.mjs.map +1 -0
- package/dist/{chunk-5FWY7FIX.mjs → chunk-AGIY7SFP.mjs} +5 -2
- package/dist/chunk-AGIY7SFP.mjs.map +1 -0
- package/dist/{chunk-WLESNP6Z.mjs → chunk-B6T36QDV.mjs} +5 -2
- package/dist/chunk-B6T36QDV.mjs.map +1 -0
- package/dist/{chunk-GXIKHXWC.mjs → chunk-EQFY63YP.mjs} +2 -2
- package/dist/{chunk-6SVLMQUW.mjs → chunk-FUIKSOJF.mjs} +4 -4
- package/dist/{chunk-KCEWKQ4W.mjs → chunk-GYI4NCUY.mjs} +2 -2
- package/dist/{chunk-J5SCUELT.mjs → chunk-HBGFFKP3.mjs} +2 -2
- package/dist/{chunk-4C76JM3T.mjs → chunk-I4NL4ESV.mjs} +2 -2
- package/dist/{chunk-DTU7AXY3.mjs → chunk-NUP7ZBVE.mjs} +2 -2
- package/dist/chunk-OVKUPO5U.mjs +1 -0
- package/dist/chunk-OVKUPO5U.mjs.map +1 -0
- package/dist/{chunk-CKG2XRMX.mjs → chunk-R6MQFVHE.mjs} +2 -2
- package/dist/{chunk-YQMTDQSQ.mjs → chunk-TC5PD4TA.mjs} +4 -4
- package/dist/{chunk-DRSAVDIE.mjs → chunk-W6CFPK2C.mjs} +5 -4
- package/dist/chunk-W6CFPK2C.mjs.map +1 -0
- package/dist/{chunk-4YCM72TQ.mjs → chunk-W7CPW23K.mjs} +27 -18
- package/dist/chunk-W7CPW23K.mjs.map +1 -0
- package/dist/footer/footer.js +37 -19
- package/dist/footer/footer.js.map +1 -1
- package/dist/footer/footer.mjs +6 -3
- package/dist/footer/index.js +37 -19
- package/dist/footer/index.js.map +1 -1
- package/dist/footer/index.mjs +6 -3
- package/dist/form/date-picker/date-picker.js +1 -0
- package/dist/form/date-picker/date-picker.js.map +1 -1
- package/dist/form/date-picker/date-picker.mjs +2 -2
- package/dist/form/date-picker/index.js +1 -0
- package/dist/form/date-picker/index.js.map +1 -1
- package/dist/form/date-picker/index.mjs +2 -2
- package/dist/form/error-summary/error-summary.d.ts +5 -5
- package/dist/form/error-summary/error-summary.d.ts.map +1 -1
- package/dist/form/error-summary/error-summary.js +47 -93
- package/dist/form/error-summary/error-summary.js.map +1 -1
- package/dist/form/error-summary/error-summary.mjs +5 -6
- package/dist/form/error-summary/index.js +47 -93
- package/dist/form/error-summary/index.js.map +1 -1
- package/dist/form/error-summary/index.mjs +5 -6
- package/dist/form/index.js +75 -121
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +15 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +784 -713
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -75
- package/dist/layout/grid/grid.mjs +2 -2
- package/dist/layout/grid/index.mjs +2 -2
- package/dist/layout/index.mjs +9 -9
- package/dist/layout/stack/index.mjs +2 -2
- package/dist/layout/stack/stack.mjs +2 -2
- package/dist/modal/index.js +1 -0
- package/dist/modal/index.js.map +1 -1
- package/dist/modal/index.mjs +2 -2
- package/dist/modal/modal.js +1 -0
- package/dist/modal/modal.js.map +1 -1
- package/dist/modal/modal.mjs +2 -2
- package/dist/navbar/index.js +3 -1
- package/dist/navbar/index.js.map +1 -1
- package/dist/navbar/index.mjs +3 -3
- package/dist/navbar/navbar-expandable-menu.d.ts.map +1 -1
- package/dist/navbar/navbar-expandable-menu.js +3 -1
- package/dist/navbar/navbar-expandable-menu.js.map +1 -1
- package/dist/navbar/navbar-expandable-menu.mjs +2 -2
- package/dist/navbar/navbar.js +3 -1
- package/dist/navbar/navbar.js.map +1 -1
- package/dist/navbar/navbar.mjs +3 -3
- package/dist/skeleton/index.js +20 -2
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs +4 -1
- package/dist/skeleton/skeleton.d.ts.map +1 -1
- package/dist/skeleton/skeleton.js +20 -2
- package/dist/skeleton/skeleton.js.map +1 -1
- package/dist/skeleton/skeleton.mjs +4 -1
- package/dist/tabs/index.js +1 -0
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +3 -3
- package/dist/tabs/tabs-list.js +1 -0
- package/dist/tabs/tabs-list.js.map +1 -1
- package/dist/tabs/tabs-list.mjs +2 -2
- package/dist/tabs/tabs.js +1 -0
- package/dist/tabs/tabs.js.map +1 -1
- package/dist/tabs/tabs.mjs +3 -3
- package/dist/text/text.d.ts +1 -1
- package/dist/utils/auto-animate-height.js +1 -0
- package/dist/utils/auto-animate-height.js.map +1 -1
- package/dist/utils/auto-animate-height.mjs +2 -2
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +4 -2
- package/dist/utils/utils.d.ts +4 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +4 -0
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/utils.mjs +3 -1
- package/package.json +5 -5
- package/src/accordion/accordion-content.tsx +2 -1
- package/src/alert/alert.stories.tsx +36 -0
- package/src/alert/alert.tsx +83 -0
- package/src/alert/index.tsx +2 -0
- package/src/form/error-summary/error-summary.tsx +32 -31
- package/src/index.ts +1 -0
- package/src/navbar/navbar-expandable-menu.tsx +3 -2
- package/src/skeleton/skeleton.tsx +2 -1
- package/src/utils/utils.ts +14 -1
- package/dist/chunk-4YCM72TQ.mjs.map +0 -1
- package/dist/chunk-5FWY7FIX.mjs.map +0 -1
- package/dist/chunk-DRSAVDIE.mjs.map +0 -1
- package/dist/chunk-ILFK3VKS.mjs.map +0 -1
- package/dist/chunk-WLESNP6Z.mjs.map +0 -1
- /package/dist/{chunk-GVO57ZWU.mjs.map → chunk-23IZCRJA.mjs.map} +0 -0
- /package/dist/{chunk-KNGG6M2I.mjs.map → chunk-5RXT5GLF.mjs.map} +0 -0
- /package/dist/{chunk-GXIKHXWC.mjs.map → chunk-EQFY63YP.mjs.map} +0 -0
- /package/dist/{chunk-6SVLMQUW.mjs.map → chunk-FUIKSOJF.mjs.map} +0 -0
- /package/dist/{chunk-KCEWKQ4W.mjs.map → chunk-GYI4NCUY.mjs.map} +0 -0
- /package/dist/{chunk-J5SCUELT.mjs.map → chunk-HBGFFKP3.mjs.map} +0 -0
- /package/dist/{chunk-4C76JM3T.mjs.map → chunk-I4NL4ESV.mjs.map} +0 -0
- /package/dist/{chunk-DTU7AXY3.mjs.map → chunk-NUP7ZBVE.mjs.map} +0 -0
- /package/dist/{chunk-CKG2XRMX.mjs.map → chunk-R6MQFVHE.mjs.map} +0 -0
- /package/dist/{chunk-YQMTDQSQ.mjs.map → chunk-TC5PD4TA.mjs.map} +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/alert/alert.tsx
|
|
50
|
+
var alert_exports = {};
|
|
51
|
+
__export(alert_exports, {
|
|
52
|
+
Alert: () => Alert,
|
|
53
|
+
AlertDescription: () => AlertDescription,
|
|
54
|
+
AlertTitle: () => AlertTitle
|
|
55
|
+
});
|
|
56
|
+
module.exports = __toCommonJS(alert_exports);
|
|
57
|
+
var import_react2 = require("react");
|
|
58
|
+
var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname");
|
|
59
|
+
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
60
|
+
|
|
61
|
+
// src/box/box.tsx
|
|
62
|
+
var import_react = require("react");
|
|
63
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
64
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
65
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
66
|
+
var BoxCloseButton = (0, import_react.forwardRef)(
|
|
67
|
+
(_a, ref) => {
|
|
68
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
|
+
"button",
|
|
71
|
+
__spreadValues({
|
|
72
|
+
className: (0, import_typed_classname.clsx)("hds-box__close-button", className),
|
|
73
|
+
ref,
|
|
74
|
+
type: "button"
|
|
75
|
+
}, rest)
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
BoxCloseButton.displayName = "Box.CloseButton";
|
|
80
|
+
var Box = (0, import_react.forwardRef)(
|
|
81
|
+
(_a, ref) => {
|
|
82
|
+
var _b = _a, {
|
|
83
|
+
asChild,
|
|
84
|
+
variant,
|
|
85
|
+
closeable = false,
|
|
86
|
+
onClose: onCloseProp,
|
|
87
|
+
closed: closedProp,
|
|
88
|
+
closeButtonProps,
|
|
89
|
+
children,
|
|
90
|
+
className
|
|
91
|
+
} = _b, rest = __objRest(_b, [
|
|
92
|
+
"asChild",
|
|
93
|
+
"variant",
|
|
94
|
+
"closeable",
|
|
95
|
+
"onClose",
|
|
96
|
+
"closed",
|
|
97
|
+
"closeButtonProps",
|
|
98
|
+
"children",
|
|
99
|
+
"className"
|
|
100
|
+
]);
|
|
101
|
+
const [closedState, setClosedState] = (0, import_react.useState)(false);
|
|
102
|
+
const onClose = (0, import_react.useCallback)(() => {
|
|
103
|
+
if (onCloseProp) {
|
|
104
|
+
const result = onCloseProp();
|
|
105
|
+
if (result === true) {
|
|
106
|
+
setClosedState(true);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
setClosedState(true);
|
|
110
|
+
}
|
|
111
|
+
}, []);
|
|
112
|
+
const closed = closedProp != null ? closedProp : closedState;
|
|
113
|
+
const Component = asChild ? import_react_slot.Slot : "div";
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
115
|
+
Component,
|
|
116
|
+
__spreadProps(__spreadValues({
|
|
117
|
+
className: (0, import_typed_classname.clsx)(
|
|
118
|
+
"hds-box",
|
|
119
|
+
variant && `hds-box--${variant}`,
|
|
120
|
+
{ "hds-box--closed": closed },
|
|
121
|
+
className
|
|
122
|
+
),
|
|
123
|
+
ref
|
|
124
|
+
}, rest), {
|
|
125
|
+
children: [
|
|
126
|
+
closeable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children })
|
|
128
|
+
]
|
|
129
|
+
})
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
Box.displayName = "Box";
|
|
134
|
+
Box.CloseButton = BoxCloseButton;
|
|
135
|
+
|
|
136
|
+
// src/alert/alert.tsx
|
|
137
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
138
|
+
var AlertTitle = (0, import_react2.forwardRef)(
|
|
139
|
+
(_a, ref) => {
|
|
140
|
+
var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
|
|
141
|
+
const Component = asChild ? import_react_slot2.Slot : "div";
|
|
142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, __spreadValues({ className: (0, import_typed_classname2.clsx)("hds-alert__title", className), ref }, rest));
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
AlertTitle.displayName = "Alert.Title";
|
|
146
|
+
var AlertDescription = (0, import_react2.forwardRef)(
|
|
147
|
+
(_a, ref) => {
|
|
148
|
+
var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
|
|
149
|
+
const Component = asChild ? import_react_slot2.Slot : "div";
|
|
150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
151
|
+
Component,
|
|
152
|
+
__spreadValues({
|
|
153
|
+
className: (0, import_typed_classname2.clsx)("hds-alert__description", className),
|
|
154
|
+
ref
|
|
155
|
+
}, rest)
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
AlertDescription.displayName = "Alert.Description";
|
|
160
|
+
var Alert = (0, import_react2.forwardRef)(
|
|
161
|
+
(_a, ref) => {
|
|
162
|
+
var _b = _a, { children, className, variant = "success", icon, iconClassName } = _b, rest = __objRest(_b, ["children", "className", "variant", "icon", "iconClassName"]);
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
164
|
+
Box,
|
|
165
|
+
__spreadProps(__spreadValues({
|
|
166
|
+
className: (0, import_typed_classname2.clsx)(`hds-alert`, `hds-alert--${variant}`, className),
|
|
167
|
+
ref
|
|
168
|
+
}, rest), {
|
|
169
|
+
children: [
|
|
170
|
+
variant === "neutral" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-alert--neutral__icon", iconClassName), children: icon }),
|
|
171
|
+
children
|
|
172
|
+
]
|
|
173
|
+
})
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
Alert.displayName = "Alert";
|
|
178
|
+
Alert.Title = AlertTitle;
|
|
179
|
+
Alert.Description = AlertDescription;
|
|
180
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
181
|
+
0 && (module.exports = {
|
|
182
|
+
Alert,
|
|
183
|
+
AlertDescription,
|
|
184
|
+
AlertTitle
|
|
185
|
+
});
|
|
186
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/alert/alert.tsx","../../src/box/box.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\nexport interface AlertTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const AlertTitle = forwardRef<HTMLParagraphElement, AlertTitleProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component className={clsx(\"hds-alert__title\", className as undefined)} ref={ref} {...rest} />\n );\n },\n);\nAlertTitle.displayName = \"Alert.Title\";\n\nexport interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const AlertDescription = forwardRef<HTMLParagraphElement, AlertDescriptionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-alert__description\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nAlertDescription.displayName = \"Alert.Description\";\n\nexport type AlertProps = (\n | {\n variant?: \"info\" | \"success\" | \"warning\" | \"error\";\n icon?: never;\n iconClassName?: never;\n }\n | {\n variant: \"neutral\";\n icon?: React.ReactNode;\n iconClassName?: string;\n }\n) &\n Omit<BoxProps, \"variant\" | \"asChild\">;\n\nexport const Alert = forwardRef<HTMLDivElement, AlertProps>(\n ({ children, className, variant = \"success\", icon, iconClassName, ...rest }, ref) => {\n return (\n <Box\n className={clsx(`hds-alert`, `hds-alert--${variant}`, className as undefined)}\n ref={ref}\n {...rest}\n >\n {variant === \"neutral\" && (\n <div className={clsx(\"hds-alert--neutral__icon\", iconClassName as undefined)}>{icon}</div>\n )}\n {children}\n </Box>\n );\n },\n) as AlertType;\nAlert.displayName = \"Alert\";\n\ntype AlertType = ReturnType<typeof forwardRef<HTMLDivElement, AlertProps>> & {\n Title: typeof AlertTitle;\n Description: typeof AlertDescription;\n};\nAlert.Title = AlertTitle;\nAlert.Description = AlertDescription;\n","import { forwardRef, useCallback, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot, Slottable } from \"@radix-ui/react-slot\";\n\nexport type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, \"children\">;\nexport const BoxCloseButton = forwardRef<HTMLButtonElement, BoxCloseButtonProps>(\n ({ className, ...rest }, ref) => {\n return (\n <button\n className={clsx(\"hds-box__close-button\", className as undefined)}\n ref={ref}\n type=\"button\"\n {...rest}\n />\n );\n },\n);\nBoxCloseButton.displayName = \"Box.CloseButton\";\n\nexport interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n\n /**\n * Color variant of the box\n *\n * @default \"light-grey\"\n */\n variant?: \"light-grey\" | \"lighter\" | \"white\" | \"warning\";\n\n /**\n * If `true`, a close button will be shown.\n * Use when you want to control the close button using the BoxCloseButton component.\n *\n * @default false\n */\n closeable?: boolean;\n\n /**\n * Callback fired when the component requests to be closed.\n * If not set, the component will be closed without any user interaction.\n *\n * If set, and the handler returns non-true value, the component will not be closed.\n * Use this if you want to control the closing of the component, using the `closed` prop\n *\n * If set, and the handler returns the true, the component will be closed.\n * Use this with `window.confirm()` to ask the user to confirm closing the component.\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- It's fine, I want to have the boolean in the type\n onClose?: () => boolean | unknown;\n\n /**\n * If `true`, the box will be closed and hidden from view\n */\n closed?: boolean;\n\n /**\n * Props applied to the close button element.\n */\n closeButtonProps?: BoxCloseButtonProps;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(\n (\n {\n asChild,\n variant,\n closeable = false,\n onClose: onCloseProp,\n closed: closedProp,\n closeButtonProps,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const [closedState, setClosedState] = useState(false);\n const onClose = useCallback(() => {\n if (onCloseProp) {\n const result = onCloseProp();\n if (result === true) {\n setClosedState(true);\n }\n } else {\n setClosedState(true);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, []);\n const closed = closedProp ?? closedState;\n const Component = asChild ? Slot : \"div\";\n\n return (\n <Component\n className={clsx(\n \"hds-box\",\n variant && `hds-box--${variant}`,\n { \"hds-box--closed\": closed },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {closeable ? <BoxCloseButton onClick={onClose} {...closeButtonProps} /> : null}\n <Slottable>{children}</Slottable>\n </Component>\n );\n },\n) as BoxType;\nBox.displayName = \"Box\";\n\nBox.CloseButton = BoxCloseButton;\n\ntype BoxType = ReturnType<typeof forwardRef<HTMLDivElement, BoxProps>> & {\n CloseButton: typeof BoxCloseButton;\n};\n"],"mappings":"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","names":["import_react","import_typed_classname","import_react_slot","import_jsx_runtime"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/alert/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC9D,mBAAmB,SAAS,CAAC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/alert/index.tsx
|
|
50
|
+
var alert_exports = {};
|
|
51
|
+
__export(alert_exports, {
|
|
52
|
+
Alert: () => Alert,
|
|
53
|
+
AlertDescription: () => AlertDescription,
|
|
54
|
+
AlertTitle: () => AlertTitle
|
|
55
|
+
});
|
|
56
|
+
module.exports = __toCommonJS(alert_exports);
|
|
57
|
+
|
|
58
|
+
// src/alert/alert.tsx
|
|
59
|
+
var import_react2 = require("react");
|
|
60
|
+
var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname");
|
|
61
|
+
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
62
|
+
|
|
63
|
+
// src/box/box.tsx
|
|
64
|
+
var import_react = require("react");
|
|
65
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
66
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
67
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
68
|
+
var BoxCloseButton = (0, import_react.forwardRef)(
|
|
69
|
+
(_a, ref) => {
|
|
70
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
"button",
|
|
73
|
+
__spreadValues({
|
|
74
|
+
className: (0, import_typed_classname.clsx)("hds-box__close-button", className),
|
|
75
|
+
ref,
|
|
76
|
+
type: "button"
|
|
77
|
+
}, rest)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
BoxCloseButton.displayName = "Box.CloseButton";
|
|
82
|
+
var Box = (0, import_react.forwardRef)(
|
|
83
|
+
(_a, ref) => {
|
|
84
|
+
var _b = _a, {
|
|
85
|
+
asChild,
|
|
86
|
+
variant,
|
|
87
|
+
closeable = false,
|
|
88
|
+
onClose: onCloseProp,
|
|
89
|
+
closed: closedProp,
|
|
90
|
+
closeButtonProps,
|
|
91
|
+
children,
|
|
92
|
+
className
|
|
93
|
+
} = _b, rest = __objRest(_b, [
|
|
94
|
+
"asChild",
|
|
95
|
+
"variant",
|
|
96
|
+
"closeable",
|
|
97
|
+
"onClose",
|
|
98
|
+
"closed",
|
|
99
|
+
"closeButtonProps",
|
|
100
|
+
"children",
|
|
101
|
+
"className"
|
|
102
|
+
]);
|
|
103
|
+
const [closedState, setClosedState] = (0, import_react.useState)(false);
|
|
104
|
+
const onClose = (0, import_react.useCallback)(() => {
|
|
105
|
+
if (onCloseProp) {
|
|
106
|
+
const result = onCloseProp();
|
|
107
|
+
if (result === true) {
|
|
108
|
+
setClosedState(true);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
setClosedState(true);
|
|
112
|
+
}
|
|
113
|
+
}, []);
|
|
114
|
+
const closed = closedProp != null ? closedProp : closedState;
|
|
115
|
+
const Component = asChild ? import_react_slot.Slot : "div";
|
|
116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
117
|
+
Component,
|
|
118
|
+
__spreadProps(__spreadValues({
|
|
119
|
+
className: (0, import_typed_classname.clsx)(
|
|
120
|
+
"hds-box",
|
|
121
|
+
variant && `hds-box--${variant}`,
|
|
122
|
+
{ "hds-box--closed": closed },
|
|
123
|
+
className
|
|
124
|
+
),
|
|
125
|
+
ref
|
|
126
|
+
}, rest), {
|
|
127
|
+
children: [
|
|
128
|
+
closeable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BoxCloseButton, __spreadValues({ onClick: onClose }, closeButtonProps)) : null,
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children })
|
|
130
|
+
]
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
Box.displayName = "Box";
|
|
136
|
+
Box.CloseButton = BoxCloseButton;
|
|
137
|
+
|
|
138
|
+
// src/alert/alert.tsx
|
|
139
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
140
|
+
var AlertTitle = (0, import_react2.forwardRef)(
|
|
141
|
+
(_a, ref) => {
|
|
142
|
+
var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
|
|
143
|
+
const Component = asChild ? import_react_slot2.Slot : "div";
|
|
144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, __spreadValues({ className: (0, import_typed_classname2.clsx)("hds-alert__title", className), ref }, rest));
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
AlertTitle.displayName = "Alert.Title";
|
|
148
|
+
var AlertDescription = (0, import_react2.forwardRef)(
|
|
149
|
+
(_a, ref) => {
|
|
150
|
+
var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
|
|
151
|
+
const Component = asChild ? import_react_slot2.Slot : "div";
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
153
|
+
Component,
|
|
154
|
+
__spreadValues({
|
|
155
|
+
className: (0, import_typed_classname2.clsx)("hds-alert__description", className),
|
|
156
|
+
ref
|
|
157
|
+
}, rest)
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
AlertDescription.displayName = "Alert.Description";
|
|
162
|
+
var Alert = (0, import_react2.forwardRef)(
|
|
163
|
+
(_a, ref) => {
|
|
164
|
+
var _b = _a, { children, className, variant = "success", icon, iconClassName } = _b, rest = __objRest(_b, ["children", "className", "variant", "icon", "iconClassName"]);
|
|
165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
166
|
+
Box,
|
|
167
|
+
__spreadProps(__spreadValues({
|
|
168
|
+
className: (0, import_typed_classname2.clsx)(`hds-alert`, `hds-alert--${variant}`, className),
|
|
169
|
+
ref
|
|
170
|
+
}, rest), {
|
|
171
|
+
children: [
|
|
172
|
+
variant === "neutral" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_typed_classname2.clsx)("hds-alert--neutral__icon", iconClassName), children: icon }),
|
|
173
|
+
children
|
|
174
|
+
]
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
Alert.displayName = "Alert";
|
|
180
|
+
Alert.Title = AlertTitle;
|
|
181
|
+
Alert.Description = AlertDescription;
|
|
182
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
183
|
+
0 && (module.exports = {
|
|
184
|
+
Alert,
|
|
185
|
+
AlertDescription,
|
|
186
|
+
AlertTitle
|
|
187
|
+
});
|
|
188
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/alert/index.tsx","../../src/alert/alert.tsx","../../src/box/box.tsx"],"sourcesContent":["export { Alert, AlertTitle, AlertDescription } from \"./alert\";\nexport type * from \"./alert\";\n","import React, { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\nexport interface AlertTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const AlertTitle = forwardRef<HTMLParagraphElement, AlertTitleProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component className={clsx(\"hds-alert__title\", className as undefined)} ref={ref} {...rest} />\n );\n },\n);\nAlertTitle.displayName = \"Alert.Title\";\n\nexport interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const AlertDescription = forwardRef<HTMLParagraphElement, AlertDescriptionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-alert__description\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nAlertDescription.displayName = \"Alert.Description\";\n\nexport type AlertProps = (\n | {\n variant?: \"info\" | \"success\" | \"warning\" | \"error\";\n icon?: never;\n iconClassName?: never;\n }\n | {\n variant: \"neutral\";\n icon?: React.ReactNode;\n iconClassName?: string;\n }\n) &\n Omit<BoxProps, \"variant\" | \"asChild\">;\n\nexport const Alert = forwardRef<HTMLDivElement, AlertProps>(\n ({ children, className, variant = \"success\", icon, iconClassName, ...rest }, ref) => {\n return (\n <Box\n className={clsx(`hds-alert`, `hds-alert--${variant}`, className as undefined)}\n ref={ref}\n {...rest}\n >\n {variant === \"neutral\" && (\n <div className={clsx(\"hds-alert--neutral__icon\", iconClassName as undefined)}>{icon}</div>\n )}\n {children}\n </Box>\n );\n },\n) as AlertType;\nAlert.displayName = \"Alert\";\n\ntype AlertType = ReturnType<typeof forwardRef<HTMLDivElement, AlertProps>> & {\n Title: typeof AlertTitle;\n Description: typeof AlertDescription;\n};\nAlert.Title = AlertTitle;\nAlert.Description = AlertDescription;\n","import { forwardRef, useCallback, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot, Slottable } from \"@radix-ui/react-slot\";\n\nexport type BoxCloseButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement>, \"children\">;\nexport const BoxCloseButton = forwardRef<HTMLButtonElement, BoxCloseButtonProps>(\n ({ className, ...rest }, ref) => {\n return (\n <button\n className={clsx(\"hds-box__close-button\", className as undefined)}\n ref={ref}\n type=\"button\"\n {...rest}\n />\n );\n },\n);\nBoxCloseButton.displayName = \"Box.CloseButton\";\n\nexport interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n\n /**\n * Color variant of the box\n *\n * @default \"light-grey\"\n */\n variant?: \"light-grey\" | \"lighter\" | \"white\" | \"warning\";\n\n /**\n * If `true`, a close button will be shown.\n * Use when you want to control the close button using the BoxCloseButton component.\n *\n * @default false\n */\n closeable?: boolean;\n\n /**\n * Callback fired when the component requests to be closed.\n * If not set, the component will be closed without any user interaction.\n *\n * If set, and the handler returns non-true value, the component will not be closed.\n * Use this if you want to control the closing of the component, using the `closed` prop\n *\n * If set, and the handler returns the true, the component will be closed.\n * Use this with `window.confirm()` to ask the user to confirm closing the component.\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- It's fine, I want to have the boolean in the type\n onClose?: () => boolean | unknown;\n\n /**\n * If `true`, the box will be closed and hidden from view\n */\n closed?: boolean;\n\n /**\n * Props applied to the close button element.\n */\n closeButtonProps?: BoxCloseButtonProps;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport const Box = forwardRef<HTMLDivElement, BoxProps>(\n (\n {\n asChild,\n variant,\n closeable = false,\n onClose: onCloseProp,\n closed: closedProp,\n closeButtonProps,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const [closedState, setClosedState] = useState(false);\n const onClose = useCallback(() => {\n if (onCloseProp) {\n const result = onCloseProp();\n if (result === true) {\n setClosedState(true);\n }\n } else {\n setClosedState(true);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, []);\n const closed = closedProp ?? closedState;\n const Component = asChild ? Slot : \"div\";\n\n return (\n <Component\n className={clsx(\n \"hds-box\",\n variant && `hds-box--${variant}`,\n { \"hds-box--closed\": closed },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {closeable ? <BoxCloseButton onClick={onClose} {...closeButtonProps} /> : null}\n <Slottable>{children}</Slottable>\n </Component>\n );\n },\n) as BoxType;\nBox.displayName = \"Box\";\n\nBox.CloseButton = BoxCloseButton;\n\ntype BoxType = ReturnType<typeof forwardRef<HTMLDivElement, BoxProps>> & {\n CloseButton: typeof BoxCloseButton;\n};\n"],"mappings":"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","names":["import_react","import_typed_classname","import_react_slot","import_jsx_runtime"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../chunk-OVKUPO5U.mjs";
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
AlertDescription,
|
|
5
|
+
AlertTitle
|
|
6
|
+
} from "../chunk-4P4GPVKZ.mjs";
|
|
7
|
+
import "../chunk-3OGHJOJF.mjs";
|
|
8
|
+
import "../chunk-YOSPWY5K.mjs";
|
|
9
|
+
export {
|
|
10
|
+
Alert,
|
|
11
|
+
AlertDescription,
|
|
12
|
+
AlertTitle
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-XZ43OSZ5.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useMergeRefs
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-77M2ZTP7.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__objRest,
|
|
9
9
|
__spreadProps,
|
|
@@ -83,4 +83,4 @@ DatePicker.displayName = "DatePicker";
|
|
|
83
83
|
export {
|
|
84
84
|
DatePicker
|
|
85
85
|
};
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
86
|
+
//# sourceMappingURL=chunk-23IZCRJA.mjs.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box
|
|
3
|
+
} from "./chunk-3OGHJOJF.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-YOSPWY5K.mjs";
|
|
9
|
+
|
|
10
|
+
// src/alert/alert.tsx
|
|
11
|
+
import { forwardRef } from "react";
|
|
12
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
13
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var AlertTitle = forwardRef(
|
|
16
|
+
(_a, ref) => {
|
|
17
|
+
var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
|
|
18
|
+
const Component = asChild ? Slot : "div";
|
|
19
|
+
return /* @__PURE__ */ jsx(Component, __spreadValues({ className: clsx("hds-alert__title", className), ref }, rest));
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
AlertTitle.displayName = "Alert.Title";
|
|
23
|
+
var AlertDescription = forwardRef(
|
|
24
|
+
(_a, ref) => {
|
|
25
|
+
var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
|
|
26
|
+
const Component = asChild ? Slot : "div";
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
Component,
|
|
29
|
+
__spreadValues({
|
|
30
|
+
className: clsx("hds-alert__description", className),
|
|
31
|
+
ref
|
|
32
|
+
}, rest)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
AlertDescription.displayName = "Alert.Description";
|
|
37
|
+
var Alert = forwardRef(
|
|
38
|
+
(_a, ref) => {
|
|
39
|
+
var _b = _a, { children, className, variant = "success", icon, iconClassName } = _b, rest = __objRest(_b, ["children", "className", "variant", "icon", "iconClassName"]);
|
|
40
|
+
return /* @__PURE__ */ jsxs(
|
|
41
|
+
Box,
|
|
42
|
+
__spreadProps(__spreadValues({
|
|
43
|
+
className: clsx(`hds-alert`, `hds-alert--${variant}`, className),
|
|
44
|
+
ref
|
|
45
|
+
}, rest), {
|
|
46
|
+
children: [
|
|
47
|
+
variant === "neutral" && /* @__PURE__ */ jsx("div", { className: clsx("hds-alert--neutral__icon", iconClassName), children: icon }),
|
|
48
|
+
children
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
Alert.displayName = "Alert";
|
|
55
|
+
Alert.Title = AlertTitle;
|
|
56
|
+
Alert.Description = AlertDescription;
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
AlertTitle,
|
|
60
|
+
AlertDescription,
|
|
61
|
+
Alert
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=chunk-4P4GPVKZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/alert/alert.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\nexport interface AlertTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const AlertTitle = forwardRef<HTMLParagraphElement, AlertTitleProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component className={clsx(\"hds-alert__title\", className as undefined)} ref={ref} {...rest} />\n );\n },\n);\nAlertTitle.displayName = \"Alert.Title\";\n\nexport interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const AlertDescription = forwardRef<HTMLParagraphElement, AlertDescriptionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-alert__description\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nAlertDescription.displayName = \"Alert.Description\";\n\nexport type AlertProps = (\n | {\n variant?: \"info\" | \"success\" | \"warning\" | \"error\";\n icon?: never;\n iconClassName?: never;\n }\n | {\n variant: \"neutral\";\n icon?: React.ReactNode;\n iconClassName?: string;\n }\n) &\n Omit<BoxProps, \"variant\" | \"asChild\">;\n\nexport const Alert = forwardRef<HTMLDivElement, AlertProps>(\n ({ children, className, variant = \"success\", icon, iconClassName, ...rest }, ref) => {\n return (\n <Box\n className={clsx(`hds-alert`, `hds-alert--${variant}`, className as undefined)}\n ref={ref}\n {...rest}\n >\n {variant === \"neutral\" && (\n <div className={clsx(\"hds-alert--neutral__icon\", iconClassName as undefined)}>{icon}</div>\n )}\n {children}\n </Box>\n );\n },\n) as AlertType;\nAlert.displayName = \"Alert\";\n\ntype AlertType = ReturnType<typeof forwardRef<HTMLDivElement, AlertProps>> & {\n Title: typeof AlertTitle;\n Description: typeof AlertDescription;\n};\nAlert.Title = AlertTitle;\nAlert.Description = AlertDescription;\n"],"mappings":";;;;;;;;;;AAAA,SAAgB,kBAAuC;AACvD,SAAS,YAAY;AACrB,SAAS,YAAY;AAef,cA6CA,YA7CA;AAJC,IAAM,aAAa;AAAA,EACxB,CAAC,IAAiC,QAAQ;AAAzC,iBAAE,WAAS,UAdd,IAcG,IAAyB,iBAAzB,IAAyB,CAAvB,WAAS;AACV,UAAM,YAAY,UAAU,OAAO;AACnC,WACE,oBAAC,4BAAU,WAAW,KAAK,oBAAoB,SAAsB,GAAG,OAAc,KAAM;AAAA,EAEhG;AACF;AACA,WAAW,cAAc;AAUlB,IAAM,mBAAmB;AAAA,EAC9B,CAAC,IAAiC,QAAQ;AAAzC,iBAAE,WAAS,UAhCd,IAgCG,IAAyB,iBAAzB,IAAyB,CAAvB,WAAS;AACV,UAAM,YAAY,UAAU,OAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,KAAK,0BAA0B,SAAsB;AAAA,QAChE;AAAA,SACI;AAAA,IACN;AAAA,EAEJ;AACF;AACA,iBAAiB,cAAc;AAgBxB,IAAM,QAAQ;AAAA,EACnB,CAAC,IAA4E,QAAQ;AAApF,iBAAE,YAAU,WAAW,UAAU,WAAW,MAAM,cA5DrD,IA4DG,IAAoE,iBAApE,IAAoE,CAAlE,YAAU,aAAW,WAAqB,QAAM;AACjD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,KAAK,aAAa,cAAc,OAAO,IAAI,SAAsB;AAAA,QAC5E;AAAA,SACI,OAHL;AAAA,QAKE;AAAA,sBAAY,aACX,oBAAC,SAAI,WAAW,KAAK,4BAA4B,aAA0B,GAAI,gBAAK;AAAA,UAErF;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;AAMpB,MAAM,QAAQ;AACd,MAAM,cAAc;","names":[]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
TabsList,
|
|
7
7
|
TabsTab
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HBGFFKP3.mjs";
|
|
9
9
|
import {
|
|
10
10
|
TabsContext
|
|
11
11
|
} from "./chunk-KQITCS3U.mjs";
|
|
@@ -37,4 +37,4 @@ Tabs.Content = TabsContent;
|
|
|
37
37
|
export {
|
|
38
38
|
Tabs
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-5RXT5GLF.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/utils/utils.ts
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useCallback, useEffect, useState } from "react";
|
|
3
|
+
import { useCallback, useEffect, useState, version } from "react";
|
|
4
4
|
function useMergeRefs(refs) {
|
|
5
5
|
return React.useMemo(() => {
|
|
6
6
|
if (refs.every((ref) => ref === null)) {
|
|
@@ -76,11 +76,14 @@ function releaseFocusTrap(inertElements) {
|
|
|
76
76
|
el.removeAttribute("inert");
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
var inertBooleanSupported = Number(version.split(".")[0]) >= 19;
|
|
80
|
+
var inertPropValue = inertBooleanSupported ? (x) => x : (x) => x ? "" : void 0;
|
|
79
81
|
|
|
80
82
|
export {
|
|
81
83
|
useMergeRefs,
|
|
82
84
|
useResize,
|
|
83
85
|
useHydrated,
|
|
84
|
-
focusTrap
|
|
86
|
+
focusTrap,
|
|
87
|
+
inertPropValue
|
|
85
88
|
};
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
89
|
+
//# sourceMappingURL=chunk-77M2ZTP7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/utils.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,aAAa,WAAW,UAAU,eAAe;AAMnD,SAAS,aACd,MACoC;AACpC,SAAa,cAAQ,MAAM;AACzB,QAAI,KAAK,MAAM,CAAC,QAAQ,QAAQ,IAAI,GAAG;AACrC,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,UAAU;AAChB,WAAK,QAAQ,CAAC,QAAQ;AACpB,YAAI,OAAO,QAAQ,YAAY;AAC7B,cAAI,KAAK;AAAA,QACX,WAAW,QAAQ,MAAM;AACvB,UAAC,IAAgD,UAAU;AAAA,QAC7D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAEF,GAAG,IAAI;AACT;AAEO,SAAS,UACd,KACmC;AACnC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAiB,CAAC;AAC5C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAiB,CAAC;AAC9C,QAAM,eAAe,YAAY,MAAM;AAjCzC;AAkCI,SAAI,2BAAK,aAAY,MAAM;AACzB,gBAAS,sCAAK,YAAL,mBAAc,gBAAd,YAA6B,CAAC;AACvC,iBAAU,sCAAK,YAAL,mBAAc,iBAAd,YAA8B,CAAC;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AACR,YAAU,MAAM;AACd,WAAO,iBAAiB,QAAQ,YAAY;AAC5C,WAAO,iBAAiB,UAAU,YAAY;AAC9C,WAAO,MAAM;AACX,aAAO,oBAAoB,QAAQ,YAAY;AAC/C,aAAO,oBAAoB,UAAU,YAAY;AAAA,IACnD;AAAA,EACF,GAAG,CAAC,KAAK,YAAY,CAAC;AACtB,YAAU,MAAM;AACd,iBAAa;AAAA,EAEf,GAAG,CAAC,CAAC;AACL,SAAO,EAAE,OAAO,OAAO;AACzB;AAEA,SAAS,YAAY;AAEnB,SAAO,MAAM;AAAA,EAAC;AAChB;AAEO,SAAS,cAAc;AAC5B,SAAa;AAAA,IACX;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAaO,SAAS,UAAU,SAAsB;AA9EhD;AAgFE,MAAI,YAAY,SAAS,KAAM,QAAO,MAAM;AAAA,EAAC;AAE7C,MAAI,gBAA+B,CAAC;AACpC,WAAS,KAAyB,SAAS,IAAI,KAAK,GAAG,eAAe;AACpE,QAAI,OAAO,SAAS,KAAM;AAE1B,eAAW,YAAW,cAAG,kBAAH,mBAAkB,aAAlB,YAA8B,CAAC,GAAG;AACtD,UAAI,YAAY,GAAI;AACpB,UAAI,EAAE,mBAAmB,aAAc;AACvC,UAAI,QAAQ,aAAa,OAAO,EAAG;AAEnC,cAAQ,aAAa,SAAS,MAAM;AACpC,oBAAc,KAAK,OAAO;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO,MAAM;AACX,qBAAiB,aAAa;AAC9B,oBAAgB,CAAC;AAAA,EACnB;AACF;AAKA,SAAS,iBAAiB,eAAsC;AAC9D,aAAW,MAAM,eAAe;AAC9B,OAAG,gBAAgB,OAAO;AAAA,EAC5B;AACF;AAMA,IAAM,wBAAiC,OAAO,QAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK;AAKjE,IAAM,iBAA2D,wBACpE,CAAC,MAAwB,IACzB,CAAC,MAAgC,IAAI,KAAK;","names":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
inertPropValue
|
|
3
|
+
} from "./chunk-77M2ZTP7.mjs";
|
|
1
4
|
import {
|
|
2
5
|
AccordionItemContext
|
|
3
6
|
} from "./chunk-YQFL5UN4.mjs";
|
|
@@ -23,7 +26,7 @@ var AccordionContent = forwardRef(
|
|
|
23
26
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
24
27
|
id: context.contentId,
|
|
25
28
|
"data-state": context.open ? "open" : "closed"
|
|
26
|
-
}, { inert: context.open
|
|
29
|
+
}, { inert: inertPropValue(!context.open) }), {
|
|
27
30
|
className: clsx("hds-accordion-item-content", className),
|
|
28
31
|
ref
|
|
29
32
|
}), rest), {
|
|
@@ -37,4 +40,4 @@ AccordionContent.displayName = "Accordion.Content";
|
|
|
37
40
|
export {
|
|
38
41
|
AccordionContent
|
|
39
42
|
};
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-AGIY7SFP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/accordion/accordion-content.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { forwardRef, useContext } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { inertPropValue } from \"../utils\";\nimport { AccordionItemContext } from \"./context\";\n\nexport interface AccordionContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n}\n\nexport const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps>(\n ({ children, className, ...rest }, ref) => {\n const context = useContext(AccordionItemContext);\n if (context === null) {\n return null;\n }\n return (\n <div\n id={context.contentId}\n data-state={context.open ? \"open\" : \"closed\"}\n {...{ inert: inertPropValue(!context.open) }}\n className={clsx(\"hds-accordion-item-content\", className as undefined)}\n ref={ref}\n {...rest}\n >\n <div className={clsx(\"hds-accordion-item-content-inner\")}>{children}</div>\n </div>\n );\n },\n);\n\nAccordionContent.displayName = \"Accordion.Content\";\n"],"mappings":";;;;;;;;;;;;;AACA,SAAS,YAAY,kBAAkB;AACvC,SAAS,YAAY;AAuBb;AAfD,IAAM,mBAAmB;AAAA,EAC9B,CAAC,IAAkC,QAAQ;AAA1C,iBAAE,YAAU,UAXf,IAWG,IAA0B,iBAA1B,IAA0B,CAAxB,YAAU;AACX,UAAM,UAAU,WAAW,oBAAoB;AAC/C,QAAI,YAAY,MAAM;AACpB,aAAO;AAAA,IACT;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,QAAQ;AAAA,QACZ,cAAY,QAAQ,OAAO,SAAS;AAAA,SAChC,EAAE,OAAO,eAAe,CAAC,QAAQ,IAAI,EAAE,IAH5C;AAAA,QAIC,WAAW,KAAK,8BAA8B,SAAsB;AAAA,QACpE;AAAA,UACI,OANL;AAAA,QAQC,8BAAC,SAAI,WAAW,KAAK,kCAAkC,GAAI,UAAS;AAAA;AAAA,IACtE;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;","names":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
inertPropValue
|
|
3
|
+
} from "./chunk-77M2ZTP7.mjs";
|
|
1
4
|
import {
|
|
2
5
|
__objRest,
|
|
3
6
|
__spreadProps,
|
|
@@ -44,7 +47,7 @@ var Skeleton = forwardRef(
|
|
|
44
47
|
),
|
|
45
48
|
style: __spreadProps(__spreadValues({}, style), { width, height }),
|
|
46
49
|
"aria-hidden": true
|
|
47
|
-
}, { inert:
|
|
50
|
+
}, { inert: inertPropValue(true) }), {
|
|
48
51
|
ref
|
|
49
52
|
}), rest), {
|
|
50
53
|
children
|
|
@@ -57,4 +60,4 @@ Skeleton.displayName = "Skeleton";
|
|
|
57
60
|
export {
|
|
58
61
|
Skeleton
|
|
59
62
|
};
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-B6T36QDV.mjs.map
|