@postenbring/hedwig-react 2.1.4 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-4P4GPVKZ.mjs +63 -0
- package/dist/chunk-4P4GPVKZ.mjs.map +1 -0
- package/dist/{chunk-6SVLMQUW.mjs → chunk-FUIKSOJF.mjs} +4 -4
- package/dist/chunk-OVKUPO5U.mjs +1 -0
- package/dist/chunk-OVKUPO5U.mjs.map +1 -0
- package/dist/{chunk-YQMTDQSQ.mjs → chunk-TC5PD4TA.mjs} +4 -4
- package/dist/{chunk-4YCM72TQ.mjs → chunk-ZSYBCM2L.mjs} +4 -4
- package/dist/form/error-summary/error-summary.mjs +3 -3
- package/dist/form/error-summary/index.mjs +3 -3
- package/dist/form/index.mjs +15 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +628 -572
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -61
- 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/text/text.d.ts +1 -1
- package/package.json +5 -5
- package/src/alert/alert.stories.tsx +36 -0
- package/src/alert/alert.tsx +83 -0
- package/src/alert/index.tsx +2 -0
- package/src/index.ts +1 -0
- /package/dist/{chunk-6SVLMQUW.mjs.map → chunk-FUIKSOJF.mjs.map} +0 -0
- /package/dist/{chunk-YQMTDQSQ.mjs.map → chunk-TC5PD4TA.mjs.map} +0 -0
- /package/dist/{chunk-4YCM72TQ.mjs.map → chunk-ZSYBCM2L.mjs.map} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { forwardRef, type HTMLAttributes } from "react";
|
|
2
|
+
import { type BoxProps } from "../box/box";
|
|
3
|
+
export interface AlertTitleProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
6
|
+
*
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const AlertTitle: React.ForwardRefExoticComponent<AlertTitleProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
12
|
+
export interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
13
|
+
/**
|
|
14
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const AlertDescription: React.ForwardRefExoticComponent<AlertDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
21
|
+
export type AlertProps = ({
|
|
22
|
+
variant?: "info" | "success" | "warning" | "error";
|
|
23
|
+
icon?: never;
|
|
24
|
+
iconClassName?: never;
|
|
25
|
+
} | {
|
|
26
|
+
variant: "neutral";
|
|
27
|
+
icon?: React.ReactNode;
|
|
28
|
+
iconClassName?: string;
|
|
29
|
+
}) & Omit<BoxProps, "variant" | "asChild">;
|
|
30
|
+
export declare const Alert: AlertType;
|
|
31
|
+
type AlertType = ReturnType<typeof forwardRef<HTMLDivElement, AlertProps>> & {
|
|
32
|
+
Title: typeof AlertTitle;
|
|
33
|
+
Description: typeof AlertDescription;
|
|
34
|
+
};
|
|
35
|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"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAAuD;AACvD,IAAAC,0BAAqB;AACrB,IAAAC,qBAAqB;;;ACFrB,mBAAkD;AAClD,6BAAqB;AACrB,wBAAgC;AAM1B;AAHC,IAAM,qBAAiB;AAAA,EAC5B,CAAC,IAAwB,QAAQ;AAAhC,iBAAE,YANL,IAMG,IAAgB,iBAAhB,IAAgB,CAAd;AACD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,6BAAK,yBAAyB,SAAsB;AAAA,QAC/D;AAAA,QACA,MAAK;AAAA,SACD;AAAA,IACN;AAAA,EAEJ;AACF;AACA,eAAe,cAAc;AAmDtB,IAAM,UAAM;AAAA,EACjB,CACE,IAWA,QACG;AAZH,iBACE;AAAA;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IA9EN,IAsEI,IASK,iBATL,IASK;AAAA,MARH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,KAAK;AACpD,UAAM,cAAU,0BAAY,MAAM;AAChC,UAAI,aAAa;AACf,cAAM,SAAS,YAAY;AAC3B,YAAI,WAAW,MAAM;AACnB,yBAAe,IAAI;AAAA,QACrB;AAAA,MACF,OAAO;AACL,uBAAe,IAAI;AAAA,MACrB;AAAA,IAEF,GAAG,CAAC,CAAC;AACL,UAAM,SAAS,kCAAc;AAC7B,UAAM,YAAY,UAAU,yBAAO;AAEnC,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CAAC,SAAI,eAAW,8BAAK,4BAA4B,aAA0B,GAAI,gBAAK;AAAA,UAErF;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;AAMpB,MAAM,QAAQ;AACd,MAAM,cAAc;","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAuD;AACvD,IAAAC,0BAAqB;AACrB,IAAAC,qBAAqB;;;ACFrB,mBAAkD;AAClD,6BAAqB;AACrB,wBAAgC;AAM1B;AAHC,IAAM,qBAAiB;AAAA,EAC5B,CAAC,IAAwB,QAAQ;AAAhC,iBAAE,YANL,IAMG,IAAgB,iBAAhB,IAAgB,CAAd;AACD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,6BAAK,yBAAyB,SAAsB;AAAA,QAC/D;AAAA,QACA,MAAK;AAAA,SACD;AAAA,IACN;AAAA,E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EAEhG;AACF;AACA,WAAW,cAAc;AAUlB,IAAM,uBAAmB;AAAA,EAC9B,CAAC,IAAiC,QAAQ;AAAzC,iBAAE,WAAS,UAhCd,IAgCG,IAAyB,iBAAzB,IAAyB,CAAvB,WAAS;AACV,UAAM,YAAY,UAAU,0BAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,8BAAK,0BAA0B,SAAsB;AAAA,QAChE;AAAA,SACI;AAAA,IACN;AAAA,EAEJ;AACF;AACA,iBAAiB,cAAc;AAgBxB,IAAM,YAAQ;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,eAAW,8BAAK,aAAa,cAAc,OAAO,IAAI,SAAsB;AAAA,QAC5E;AAAA,SACI,OAHL;AAAA,QAKE;AAAA,sBAAY,aACX,6CAAC,SAAI,eAAW,8BAAK,4BAA4B,aAA0B,GAAI,gBAAK;AAAA,UAErF;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;AAMpB,MAAM,QAAQ;AACd,MAAM,cAAc;","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":[]}
|
|
@@ -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":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getSpacingVariable
|
|
3
|
-
} from "./chunk-NE6W2PCD.mjs";
|
|
4
1
|
import {
|
|
5
2
|
getResponsiveProps
|
|
6
3
|
} from "./chunk-7ROE6ADK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getSpacingVariable
|
|
6
|
+
} from "./chunk-NE6W2PCD.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__objRest,
|
|
9
9
|
__spreadProps,
|
|
@@ -72,4 +72,4 @@ export {
|
|
|
72
72
|
HStack,
|
|
73
73
|
VStack
|
|
74
74
|
};
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
75
|
+
//# sourceMappingURL=chunk-FUIKSOJF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-OVKUPO5U.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getSpacingVariable
|
|
3
|
-
} from "./chunk-NE6W2PCD.mjs";
|
|
4
1
|
import {
|
|
5
2
|
getResponsiveProps
|
|
6
3
|
} from "./chunk-7ROE6ADK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getSpacingVariable
|
|
6
|
+
} from "./chunk-NE6W2PCD.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__objRest,
|
|
9
9
|
__spreadProps,
|
|
@@ -57,4 +57,4 @@ export {
|
|
|
57
57
|
GridItem,
|
|
58
58
|
Grid
|
|
59
59
|
};
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-TC5PD4TA.mjs.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
focusWithLegendOrLabelInViewport
|
|
3
3
|
} from "./chunk-CKAL5ZJZ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Message
|
|
6
|
+
} from "./chunk-BYFBK3J7.mjs";
|
|
4
7
|
import {
|
|
5
8
|
useMergeRefs
|
|
6
9
|
} from "./chunk-ILFK3VKS.mjs";
|
|
7
10
|
import {
|
|
8
11
|
Link
|
|
9
12
|
} from "./chunk-OHDHIRAW.mjs";
|
|
10
|
-
import {
|
|
11
|
-
Message
|
|
12
|
-
} from "./chunk-BYFBK3J7.mjs";
|
|
13
13
|
import {
|
|
14
14
|
UnorderedList
|
|
15
15
|
} from "./chunk-3QHKPEXO.mjs";
|
|
@@ -78,4 +78,4 @@ export {
|
|
|
78
78
|
ErrorSummaryItem,
|
|
79
79
|
ErrorSummary
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-ZSYBCM2L.mjs.map
|