@postenbring/hedwig-react 0.0.41 → 0.0.43
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.js +4 -10
- package/dist/accordion/accordion-content.mjs +2 -2
- package/dist/accordion/accordion-header.d.mts +9 -0
- package/dist/accordion/accordion-header.d.ts +9 -0
- package/dist/accordion/{accordion-trigger.js → accordion-header.js} +12 -36
- package/dist/accordion/accordion-header.mjs +8 -0
- package/dist/accordion/accordion-item.d.mts +15 -3
- package/dist/accordion/accordion-item.d.ts +15 -3
- package/dist/accordion/accordion-item.js +21 -26
- package/dist/accordion/accordion-item.mjs +2 -2
- package/dist/accordion/accordion.d.mts +4 -12
- package/dist/accordion/accordion.d.ts +4 -12
- package/dist/accordion/accordion.js +15 -28
- package/dist/accordion/accordion.mjs +1 -2
- package/dist/accordion/index.d.mts +4 -4
- package/dist/accordion/index.d.ts +4 -4
- package/dist/accordion/index.js +53 -71
- package/dist/accordion/index.mjs +6 -6
- package/dist/chunk-45BJGKVZ.mjs +5 -0
- package/dist/chunk-6KVF3ELJ.mjs +59 -0
- package/dist/chunk-6XTXM4YQ.mjs +47 -0
- package/dist/{chunk-PWHALENY.mjs → chunk-DOJ2ZKNV.mjs} +1 -0
- package/dist/chunk-K3BGDNWO.mjs +35 -0
- package/dist/{chunk-GSYDQFIT.mjs → chunk-KYCCTJI6.mjs} +7 -7
- package/dist/{chunk-NXFD7TFE.mjs → chunk-PF6PZIZS.mjs} +1 -0
- package/dist/chunk-PHTGLF6Y.mjs +7 -0
- package/dist/{chunk-JKZ3OR7W.mjs → chunk-Q3SWHAU3.mjs} +5 -3
- package/dist/chunk-QAYPCD5Z.mjs +95 -0
- package/dist/{chunk-XAIX3HTW.mjs → chunk-QC72RAQS.mjs} +23 -21
- package/dist/chunk-SDJXW6U7.mjs +32 -0
- package/dist/{chunk-R5ISWMI6.mjs → chunk-SX37JSDS.mjs} +1 -0
- package/dist/chunk-Y2KP4RF2.mjs +36 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +319 -322
- package/dist/index.mjs +25 -23
- package/dist/input/index.d.mts +1 -0
- package/dist/input/index.d.ts +1 -0
- package/dist/input/index.js +105 -30
- package/dist/input/index.mjs +4 -2
- package/dist/input/input.d.mts +3 -8
- package/dist/input/input.d.ts +3 -8
- package/dist/input/input.js +102 -28
- package/dist/input/input.mjs +3 -1
- package/dist/input-group/index.d.mts +2 -0
- package/dist/input-group/index.d.ts +2 -0
- package/dist/input-group/index.js +148 -0
- package/dist/input-group/index.mjs +8 -0
- package/dist/input-group/input-group.d.mts +25 -0
- package/dist/input-group/input-group.d.ts +25 -0
- package/dist/input-group/input-group.js +142 -0
- package/dist/input-group/input-group.mjs +7 -0
- package/dist/list/index.mjs +3 -3
- package/dist/select/index.d.mts +2 -1
- package/dist/select/index.d.ts +2 -1
- package/dist/select/index.js +92 -19
- package/dist/select/index.mjs +4 -2
- package/dist/select/select.d.mts +5 -11
- package/dist/select/select.d.ts +5 -11
- package/dist/select/select.js +89 -17
- package/dist/select/select.mjs +3 -1
- package/dist/tabs/index.mjs +2 -2
- package/dist/textarea/index.d.mts +1 -0
- package/dist/textarea/index.d.ts +1 -0
- package/dist/textarea/index.js +82 -27
- package/dist/textarea/index.mjs +4 -2
- package/dist/textarea/textarea.d.mts +3 -8
- package/dist/textarea/textarea.d.ts +3 -8
- package/dist/textarea/textarea.js +79 -25
- package/dist/textarea/textarea.mjs +3 -1
- package/package.json +2 -2
- package/dist/accordion/accordion-trigger.d.mts +0 -9
- package/dist/accordion/accordion-trigger.d.ts +0 -9
- package/dist/accordion/accordion-trigger.mjs +0 -8
- package/dist/chunk-2V6SWZ5G.mjs +0 -16
- package/dist/chunk-4WI2BHHB.mjs +0 -63
- package/dist/chunk-5YF6SR4S.mjs +0 -73
- package/dist/chunk-GMGUONH5.mjs +0 -34
- package/dist/chunk-IT4L33S6.mjs +0 -54
- package/dist/chunk-MRJYCUBY.mjs +0 -76
- package/dist/{chunk-BSX4IA3X.mjs → chunk-WUMZCEIJ.mjs} +3 -3
package/dist/accordion/index.js
CHANGED
|
@@ -58,37 +58,24 @@ var import_body = require("@postenbring/hedwig-css/dist/body.css");
|
|
|
58
58
|
var import_accordion = require("@postenbring/hedwig-css/dist/accordion.css");
|
|
59
59
|
|
|
60
60
|
// src/accordion/accordion.tsx
|
|
61
|
-
var import_react2 = require("react");
|
|
62
|
-
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
63
|
-
|
|
64
|
-
// src/accordion/context.ts
|
|
65
61
|
var import_react = require("react");
|
|
66
|
-
var
|
|
67
|
-
variant: "multiple",
|
|
68
|
-
mounted: false,
|
|
69
|
-
openItems: [],
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling
|
|
71
|
-
toggleOpenItem: (id) => {
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var AccordionItemContext = (0, import_react.createContext)(null);
|
|
75
|
-
|
|
76
|
-
// src/accordion/accordion.tsx
|
|
62
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
77
63
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
78
|
-
var Accordion = (0,
|
|
64
|
+
var Accordion = (0, import_react.forwardRef)(
|
|
79
65
|
(_a, ref) => {
|
|
80
|
-
var _b = _a, { as: Component = "div", children, className,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
66
|
+
var _b = _a, { as: Component = "div", children, className, indent = true } = _b, rest = __objRest(_b, ["as", "children", "className", "indent"]);
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
Component,
|
|
69
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
70
|
+
className: (0, import_typed_classname.clsx)(
|
|
71
|
+
"hds-accordion",
|
|
72
|
+
!indent && "hds-accordion--no-indent",
|
|
73
|
+
className
|
|
74
|
+
),
|
|
75
|
+
ref,
|
|
76
|
+
children
|
|
77
|
+
})
|
|
78
|
+
);
|
|
92
79
|
}
|
|
93
80
|
);
|
|
94
81
|
Accordion.displayName = "Accordion";
|
|
@@ -96,30 +83,39 @@ Accordion.displayName = "Accordion";
|
|
|
96
83
|
// src/accordion/accordion-item.tsx
|
|
97
84
|
var import_react3 = require("react");
|
|
98
85
|
var import_typed_classname2 = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
86
|
+
|
|
87
|
+
// src/accordion/context.ts
|
|
88
|
+
var import_react2 = require("react");
|
|
89
|
+
var AccordionItemContext = (0, import_react2.createContext)(null);
|
|
90
|
+
|
|
91
|
+
// src/accordion/accordion-item.tsx
|
|
99
92
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
100
93
|
var AccordionItem = (0, import_react3.forwardRef)(
|
|
101
94
|
(_a, ref) => {
|
|
102
|
-
var _b = _a, {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
var _b = _a, {
|
|
96
|
+
as: Component = "div",
|
|
97
|
+
children,
|
|
98
|
+
defaultOpen,
|
|
99
|
+
open: outerOpen,
|
|
100
|
+
onOpenChange,
|
|
101
|
+
className
|
|
102
|
+
} = _b, rest = __objRest(_b, [
|
|
103
|
+
"as",
|
|
104
|
+
"children",
|
|
105
|
+
"defaultOpen",
|
|
106
|
+
"open",
|
|
107
|
+
"onOpenChange",
|
|
108
|
+
"className"
|
|
109
|
+
]);
|
|
110
|
+
const [innerOpen, setInnerOpen] = (0, import_react3.useState)(defaultOpen != null ? defaultOpen : false);
|
|
111
|
+
const open = outerOpen != null ? outerOpen : innerOpen;
|
|
106
112
|
const handleOpen = () => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
if (outerOpen !== void 0) {
|
|
114
|
+
onOpenChange && onOpenChange(!open);
|
|
115
|
+
} else {
|
|
116
|
+
setInnerOpen(!open);
|
|
110
117
|
}
|
|
111
118
|
};
|
|
112
|
-
if (!context.mounted) {
|
|
113
|
-
throw new Error("Context required. Did you use <AccordionItem/> outside of <Accordion/>?");
|
|
114
|
-
}
|
|
115
|
-
(0, import_react3.useEffect)(() => {
|
|
116
|
-
if (context.variant === "multiple") {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (open && !context.openItems.includes(accordionItemId)) {
|
|
120
|
-
setOpen(false);
|
|
121
|
-
}
|
|
122
|
-
}, [context.openItems]);
|
|
123
119
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
124
120
|
Component,
|
|
125
121
|
__spreadProps(__spreadValues({}, rest), {
|
|
@@ -138,11 +134,11 @@ var AccordionItem = (0, import_react3.forwardRef)(
|
|
|
138
134
|
);
|
|
139
135
|
AccordionItem.displayName = "Accordion.Item";
|
|
140
136
|
|
|
141
|
-
// src/accordion/accordion-
|
|
137
|
+
// src/accordion/accordion-header.tsx
|
|
142
138
|
var import_react4 = require("react");
|
|
143
139
|
var import_typed_classname3 = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
144
140
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
145
|
-
var
|
|
141
|
+
var AccordionHeader = (0, import_react4.forwardRef)((_a, ref) => {
|
|
146
142
|
var _b = _a, { as: Component = "button", children, className, onClick } = _b, rest = __objRest(_b, ["as", "children", "className", "onClick"]);
|
|
147
143
|
const itemContext = (0, import_react4.useContext)(AccordionItemContext);
|
|
148
144
|
if (itemContext === null) {
|
|
@@ -157,37 +153,21 @@ var AccordionTrigger = (0, import_react4.forwardRef)((_a, ref) => {
|
|
|
157
153
|
__spreadProps(__spreadValues({}, rest), {
|
|
158
154
|
"aria-expanded": itemContext.open,
|
|
159
155
|
className: (0, import_typed_classname3.clsx)(
|
|
160
|
-
"hds-accordion-item-
|
|
161
|
-
{ "hds-accordion-item-
|
|
156
|
+
"hds-accordion-item-header",
|
|
157
|
+
{ "hds-accordion-item-header--open": itemContext.open },
|
|
162
158
|
className
|
|
163
159
|
),
|
|
164
160
|
onClick: expandOrCollapse,
|
|
165
161
|
ref,
|
|
166
162
|
type: "button",
|
|
167
163
|
children: [
|
|
168
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: (0, import_typed_classname3.clsx)("hds-accordion-item-
|
|
169
|
-
"svg",
|
|
170
|
-
{
|
|
171
|
-
fill: "none",
|
|
172
|
-
height: "24",
|
|
173
|
-
viewBox: "0 0 24 24",
|
|
174
|
-
width: "24",
|
|
175
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
176
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { className: "hds-accordion-item-trigger--icon-chevron", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
177
|
-
"path",
|
|
178
|
-
{
|
|
179
|
-
className: "hds-accordion-item-trigger--icon-chevron_down",
|
|
180
|
-
d: "M19.6289 9.15625L18.9609 8.45312C18.7852 8.27734 18.5039 8.27734 18.3633 8.45312L12 14.8164L5.60156 8.45312C5.46094 8.27734 5.17969 8.27734 5.00391 8.45312L4.33594 9.15625C4.16016 9.29688 4.16016 9.57812 4.33594 9.75391L11.6836 17.1016C11.8594 17.2773 12.1055 17.2773 12.2812 17.1016L19.6289 9.75391C19.8047 9.57812 19.8047 9.29688 19.6289 9.15625Z"
|
|
181
|
-
}
|
|
182
|
-
) })
|
|
183
|
-
}
|
|
184
|
-
) }),
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: (0, import_typed_classname3.clsx)("hds-accordion-item-header--icon"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { height: "24", viewBox: "0 0 24 24", width: "24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M19.6289 9.15625L18.9609 8.45312C18.7852 8.27734 18.5039 8.27734 18.3633 8.45312L12 14.8164L5.60156 8.45312C5.46094 8.27734 5.17969 8.27734 5.00391 8.45312L4.33594 9.15625C4.16016 9.29688 4.16016 9.57812 4.33594 9.75391L11.6836 17.1016C11.8594 17.2773 12.1055 17.2773 12.2812 17.1016L19.6289 9.75391C19.8047 9.57812 19.8047 9.29688 19.6289 9.15625Z" }) }) }) }),
|
|
185
165
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children })
|
|
186
166
|
]
|
|
187
167
|
})
|
|
188
168
|
);
|
|
189
169
|
});
|
|
190
|
-
|
|
170
|
+
AccordionHeader.displayName = "Accordion.Header";
|
|
191
171
|
|
|
192
172
|
// src/accordion/accordion-content.tsx
|
|
193
173
|
var import_react5 = require("react");
|
|
@@ -201,7 +181,9 @@ var AccordionContent = (0, import_react5.forwardRef)((_a, ref) => {
|
|
|
201
181
|
}
|
|
202
182
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
203
183
|
Component,
|
|
204
|
-
__spreadProps(__spreadValues({
|
|
184
|
+
__spreadProps(__spreadValues({
|
|
185
|
+
"aria-hidden": !context.open
|
|
186
|
+
}, rest), {
|
|
205
187
|
className: (0, import_typed_classname4.clsx)(
|
|
206
188
|
"hds-accordion-item-content",
|
|
207
189
|
{
|
|
@@ -210,7 +192,7 @@ var AccordionContent = (0, import_react5.forwardRef)((_a, ref) => {
|
|
|
210
192
|
className
|
|
211
193
|
),
|
|
212
194
|
ref,
|
|
213
|
-
children
|
|
195
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_typed_classname4.clsx)("hds-accordion-item-content-inner"), children })
|
|
214
196
|
})
|
|
215
197
|
);
|
|
216
198
|
});
|
|
@@ -219,7 +201,7 @@ AccordionContent.displayName = "Accordion.Content";
|
|
|
219
201
|
// src/accordion/index.tsx
|
|
220
202
|
var AccordionComponent = Accordion;
|
|
221
203
|
AccordionComponent.Item = AccordionItem;
|
|
222
|
-
AccordionComponent.
|
|
204
|
+
AccordionComponent.Header = AccordionHeader;
|
|
223
205
|
AccordionComponent.Content = AccordionContent;
|
|
224
206
|
// Annotate the CommonJS export names for ESM import in node:
|
|
225
207
|
0 && (module.exports = {
|
package/dist/accordion/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccordionComponent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-KYCCTJI6.mjs";
|
|
4
|
+
import "../chunk-Q3SWHAU3.mjs";
|
|
5
|
+
import "../chunk-6XTXM4YQ.mjs";
|
|
6
|
+
import "../chunk-QC72RAQS.mjs";
|
|
7
|
+
import "../chunk-PHTGLF6Y.mjs";
|
|
8
|
+
import "../chunk-SDJXW6U7.mjs";
|
|
9
9
|
import "../chunk-FUJQIYOF.mjs";
|
|
10
10
|
export {
|
|
11
11
|
AccordionComponent as Accordion
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InputGroup
|
|
3
|
+
} from "./chunk-QAYPCD5Z.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
9
|
+
|
|
10
|
+
// src/input/input.tsx
|
|
11
|
+
import { forwardRef } from "react";
|
|
12
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var Input = forwardRef(function Input2(_a, ref) {
|
|
15
|
+
var _b = _a, {
|
|
16
|
+
className,
|
|
17
|
+
variant,
|
|
18
|
+
errorMessage,
|
|
19
|
+
labelProps,
|
|
20
|
+
label,
|
|
21
|
+
id,
|
|
22
|
+
style,
|
|
23
|
+
disabled,
|
|
24
|
+
readOnly,
|
|
25
|
+
_unstableAriaLiveOnErrorMessage
|
|
26
|
+
} = _b, rest = __objRest(_b, [
|
|
27
|
+
"className",
|
|
28
|
+
"variant",
|
|
29
|
+
"errorMessage",
|
|
30
|
+
"labelProps",
|
|
31
|
+
"label",
|
|
32
|
+
"id",
|
|
33
|
+
"style",
|
|
34
|
+
"disabled",
|
|
35
|
+
"readOnly",
|
|
36
|
+
"_unstableAriaLiveOnErrorMessage"
|
|
37
|
+
]);
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
InputGroup,
|
|
40
|
+
{
|
|
41
|
+
_unstableAriaLiveOnErrorMessage,
|
|
42
|
+
className: clsx("hds-input", className),
|
|
43
|
+
disabled,
|
|
44
|
+
errorMessage,
|
|
45
|
+
id,
|
|
46
|
+
label,
|
|
47
|
+
labelProps,
|
|
48
|
+
readOnly,
|
|
49
|
+
style,
|
|
50
|
+
variant,
|
|
51
|
+
children: /* @__PURE__ */ jsx("input", __spreadProps(__spreadValues({}, rest), { disabled, readOnly, ref }))
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
Input.displayName = "Input";
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
Input
|
|
59
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccordionItemContext
|
|
3
|
+
} from "./chunk-PHTGLF6Y.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
9
|
+
|
|
10
|
+
// src/accordion/accordion-header.tsx
|
|
11
|
+
import { forwardRef, useContext } from "react";
|
|
12
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
var AccordionHeader = forwardRef((_a, ref) => {
|
|
15
|
+
var _b = _a, { as: Component = "button", children, className, onClick } = _b, rest = __objRest(_b, ["as", "children", "className", "onClick"]);
|
|
16
|
+
const itemContext = useContext(AccordionItemContext);
|
|
17
|
+
if (itemContext === null) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const expandOrCollapse = (e) => {
|
|
21
|
+
itemContext.setOpen(!itemContext.open);
|
|
22
|
+
onClick && onClick(e);
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
Component,
|
|
26
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
27
|
+
"aria-expanded": itemContext.open,
|
|
28
|
+
className: clsx(
|
|
29
|
+
"hds-accordion-item-header",
|
|
30
|
+
{ "hds-accordion-item-header--open": itemContext.open },
|
|
31
|
+
className
|
|
32
|
+
),
|
|
33
|
+
onClick: expandOrCollapse,
|
|
34
|
+
ref,
|
|
35
|
+
type: "button",
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsx("span", { className: clsx("hds-accordion-item-header--icon"), children: /* @__PURE__ */ jsx("svg", { height: "24", viewBox: "0 0 24 24", width: "24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("g", { children: /* @__PURE__ */ jsx("path", { d: "M19.6289 9.15625L18.9609 8.45312C18.7852 8.27734 18.5039 8.27734 18.3633 8.45312L12 14.8164L5.60156 8.45312C5.46094 8.27734 5.17969 8.27734 5.00391 8.45312L4.33594 9.15625C4.16016 9.29688 4.16016 9.57812 4.33594 9.75391L11.6836 17.1016C11.8594 17.2773 12.1055 17.2773 12.2812 17.1016L19.6289 9.75391C19.8047 9.57812 19.8047 9.29688 19.6289 9.15625Z" }) }) }) }),
|
|
38
|
+
/* @__PURE__ */ jsx("span", { children })
|
|
39
|
+
]
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
AccordionHeader.displayName = "Accordion.Header";
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
AccordionHeader
|
|
47
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InputGroup
|
|
3
|
+
} from "./chunk-QAYPCD5Z.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
9
|
+
|
|
10
|
+
// src/select/select.tsx
|
|
11
|
+
import { forwardRef } from "react";
|
|
12
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var Select = forwardRef(function Select2(_a, ref) {
|
|
15
|
+
var _b = _a, { className, variant, errorMessage, labelProps, label, id, style, disabled, children } = _b, rest = __objRest(_b, ["className", "variant", "errorMessage", "labelProps", "label", "id", "style", "disabled", "children"]);
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
InputGroup,
|
|
18
|
+
{
|
|
19
|
+
className: clsx("hds-select", className),
|
|
20
|
+
disabled,
|
|
21
|
+
errorMessage,
|
|
22
|
+
id,
|
|
23
|
+
label,
|
|
24
|
+
labelProps,
|
|
25
|
+
style,
|
|
26
|
+
variant,
|
|
27
|
+
children: /* @__PURE__ */ jsx("select", __spreadProps(__spreadValues({}, rest), { disabled, ref, children }))
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
Select.displayName = "Select";
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
Select
|
|
35
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccordionContent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q3SWHAU3.mjs";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
AccordionHeader
|
|
6
|
+
} from "./chunk-6XTXM4YQ.mjs";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
AccordionItem
|
|
9
|
+
} from "./chunk-QC72RAQS.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Accordion
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SDJXW6U7.mjs";
|
|
13
13
|
|
|
14
14
|
// src/accordion/index.tsx
|
|
15
15
|
import "@postenbring/hedwig-css/dist/fonts.css";
|
|
@@ -18,7 +18,7 @@ import "@postenbring/hedwig-css/dist/body.css";
|
|
|
18
18
|
import "@postenbring/hedwig-css/dist/accordion.css";
|
|
19
19
|
var AccordionComponent = Accordion;
|
|
20
20
|
AccordionComponent.Item = AccordionItem;
|
|
21
|
-
AccordionComponent.
|
|
21
|
+
AccordionComponent.Header = AccordionHeader;
|
|
22
22
|
AccordionComponent.Content = AccordionContent;
|
|
23
23
|
|
|
24
24
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AccordionItemContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PHTGLF6Y.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -19,7 +19,9 @@ var AccordionContent = forwardRef((_a, ref) => {
|
|
|
19
19
|
}
|
|
20
20
|
return /* @__PURE__ */ jsx(
|
|
21
21
|
Component,
|
|
22
|
-
__spreadProps(__spreadValues({
|
|
22
|
+
__spreadProps(__spreadValues({
|
|
23
|
+
"aria-hidden": !context.open
|
|
24
|
+
}, rest), {
|
|
23
25
|
className: clsx(
|
|
24
26
|
"hds-accordion-item-content",
|
|
25
27
|
{
|
|
@@ -28,7 +30,7 @@ var AccordionContent = forwardRef((_a, ref) => {
|
|
|
28
30
|
className
|
|
29
31
|
),
|
|
30
32
|
ref,
|
|
31
|
-
children
|
|
33
|
+
children: /* @__PURE__ */ jsx("div", { className: clsx("hds-accordion-item-content-inner"), children })
|
|
32
34
|
})
|
|
33
35
|
);
|
|
34
36
|
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
6
|
+
|
|
7
|
+
// src/input-group/input-group.tsx
|
|
8
|
+
import { useId, forwardRef, Children, isValidElement, cloneElement } from "react";
|
|
9
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var InputGroup = forwardRef(function InputGroup2(_a, ref) {
|
|
12
|
+
var _b = _a, {
|
|
13
|
+
id,
|
|
14
|
+
className,
|
|
15
|
+
style,
|
|
16
|
+
variant = "default",
|
|
17
|
+
errorMessage,
|
|
18
|
+
labelProps,
|
|
19
|
+
label,
|
|
20
|
+
disabled,
|
|
21
|
+
readOnly,
|
|
22
|
+
children,
|
|
23
|
+
_unstableAriaLiveOnErrorMessage = false
|
|
24
|
+
} = _b, rest = __objRest(_b, [
|
|
25
|
+
"id",
|
|
26
|
+
"className",
|
|
27
|
+
"style",
|
|
28
|
+
"variant",
|
|
29
|
+
"errorMessage",
|
|
30
|
+
"labelProps",
|
|
31
|
+
"label",
|
|
32
|
+
"disabled",
|
|
33
|
+
"readOnly",
|
|
34
|
+
"children",
|
|
35
|
+
"_unstableAriaLiveOnErrorMessage"
|
|
36
|
+
]);
|
|
37
|
+
const errorMessageId = useId();
|
|
38
|
+
const inputId = useId();
|
|
39
|
+
const renderInput = () => {
|
|
40
|
+
const input = Children.toArray(children)[0];
|
|
41
|
+
if (!isValidElement(input)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
return cloneElement(input, __spreadProps(__spreadValues({
|
|
45
|
+
"aria-describedby": errorMessage ? errorMessageId : void 0,
|
|
46
|
+
"aria-invalid": errorMessage ? true : void 0,
|
|
47
|
+
id: id || inputId
|
|
48
|
+
}, input.props), {
|
|
49
|
+
className: clsx("hds-input-group__input", input.props.className)
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ jsxs(
|
|
53
|
+
"div",
|
|
54
|
+
__spreadProps(__spreadValues({
|
|
55
|
+
className: clsx(
|
|
56
|
+
"hds-input-group",
|
|
57
|
+
{
|
|
58
|
+
[`hds-input-group--${variant}`]: variant,
|
|
59
|
+
"hds-input-group--error": errorMessage
|
|
60
|
+
},
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
ref,
|
|
64
|
+
style
|
|
65
|
+
}, rest), {
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx("label", __spreadProps(__spreadValues({ className: "hds-input-group__label" }, labelProps), { htmlFor: id || inputId, children: label })),
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: clsx("hds-input-group__input-wrapper"),
|
|
72
|
+
"data-disabled": disabled,
|
|
73
|
+
"data-readonly": readOnly,
|
|
74
|
+
children: renderInput()
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
"div",
|
|
79
|
+
__spreadProps(__spreadValues({}, _unstableAriaLiveOnErrorMessage && {
|
|
80
|
+
"aria-live": "polite",
|
|
81
|
+
"aria-relevant": "additions removals"
|
|
82
|
+
}), {
|
|
83
|
+
className: "hds-input-group__error-message",
|
|
84
|
+
id: errorMessageId,
|
|
85
|
+
children: !!errorMessage && errorMessage
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
InputGroup
|
|
95
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AccordionContext,
|
|
3
2
|
AccordionItemContext
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PHTGLF6Y.mjs";
|
|
5
4
|
import {
|
|
6
5
|
__objRest,
|
|
7
6
|
__spreadProps,
|
|
@@ -9,32 +8,35 @@ import {
|
|
|
9
8
|
} from "./chunk-FUJQIYOF.mjs";
|
|
10
9
|
|
|
11
10
|
// src/accordion/accordion-item.tsx
|
|
12
|
-
import { forwardRef,
|
|
11
|
+
import { forwardRef, useState } from "react";
|
|
13
12
|
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
14
13
|
import { jsx } from "react/jsx-runtime";
|
|
15
14
|
var AccordionItem = forwardRef(
|
|
16
15
|
(_a, ref) => {
|
|
17
|
-
var _b = _a, {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
var _b = _a, {
|
|
17
|
+
as: Component = "div",
|
|
18
|
+
children,
|
|
19
|
+
defaultOpen,
|
|
20
|
+
open: outerOpen,
|
|
21
|
+
onOpenChange,
|
|
22
|
+
className
|
|
23
|
+
} = _b, rest = __objRest(_b, [
|
|
24
|
+
"as",
|
|
25
|
+
"children",
|
|
26
|
+
"defaultOpen",
|
|
27
|
+
"open",
|
|
28
|
+
"onOpenChange",
|
|
29
|
+
"className"
|
|
30
|
+
]);
|
|
31
|
+
const [innerOpen, setInnerOpen] = useState(defaultOpen != null ? defaultOpen : false);
|
|
32
|
+
const open = outerOpen != null ? outerOpen : innerOpen;
|
|
21
33
|
const handleOpen = () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
if (outerOpen !== void 0) {
|
|
35
|
+
onOpenChange && onOpenChange(!open);
|
|
36
|
+
} else {
|
|
37
|
+
setInnerOpen(!open);
|
|
25
38
|
}
|
|
26
39
|
};
|
|
27
|
-
if (!context.mounted) {
|
|
28
|
-
throw new Error("Context required. Did you use <AccordionItem/> outside of <Accordion/>?");
|
|
29
|
-
}
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (context.variant === "multiple") {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (open && !context.openItems.includes(accordionItemId)) {
|
|
35
|
-
setOpen(false);
|
|
36
|
-
}
|
|
37
|
-
}, [context.openItems]);
|
|
38
40
|
return /* @__PURE__ */ jsx(
|
|
39
41
|
Component,
|
|
40
42
|
__spreadProps(__spreadValues({}, rest), {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-FUJQIYOF.mjs";
|
|
6
|
+
|
|
7
|
+
// src/accordion/accordion.tsx
|
|
8
|
+
import { forwardRef } from "react";
|
|
9
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var Accordion = forwardRef(
|
|
12
|
+
(_a, ref) => {
|
|
13
|
+
var _b = _a, { as: Component = "div", children, className, indent = true } = _b, rest = __objRest(_b, ["as", "children", "className", "indent"]);
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Component,
|
|
16
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
17
|
+
className: clsx(
|
|
18
|
+
"hds-accordion",
|
|
19
|
+
!indent && "hds-accordion--no-indent",
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
ref,
|
|
23
|
+
children
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
Accordion.displayName = "Accordion";
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
Accordion
|
|
32
|
+
};
|