@postenbring/hedwig-react 1.2.2 → 1.3.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/accordion/accordion-content.d.ts.map +1 -1
- package/dist/accordion/accordion-content.js +0 -1
- package/dist/accordion/accordion-content.js.map +1 -1
- package/dist/accordion/accordion-content.mjs +1 -1
- package/dist/accordion/accordion.js +0 -1
- package/dist/accordion/accordion.js.map +1 -1
- package/dist/accordion/accordion.mjs +2 -2
- package/dist/accordion/index.js +0 -1
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +2 -2
- package/dist/{chunk-JZXZYEPG.mjs → chunk-5FWY7FIX.mjs} +1 -2
- package/dist/chunk-5FWY7FIX.mjs.map +1 -0
- package/dist/{chunk-ROQH67YP.mjs → chunk-6DWIJEHQ.mjs} +2 -2
- package/dist/{chunk-6BXKRPR3.mjs → chunk-AXEAIXG7.mjs} +2 -2
- package/dist/{chunk-QRGGURVO.mjs → chunk-BO3EWZGA.mjs} +6 -4
- package/dist/chunk-BO3EWZGA.mjs.map +1 -0
- package/dist/{chunk-TWUAXAMR.mjs → chunk-BYFBK3J7.mjs} +1 -1
- package/dist/chunk-BYFBK3J7.mjs.map +1 -0
- package/dist/chunk-CKAL5ZJZ.mjs +45 -0
- package/dist/chunk-CKAL5ZJZ.mjs.map +1 -0
- package/dist/{chunk-CXX4SXJG.mjs → chunk-CKG2XRMX.mjs} +2 -2
- package/dist/{chunk-YS7HBWOI.mjs → chunk-E6OOFTRQ.mjs} +2 -2
- package/dist/{chunk-WUPLEZEY.mjs → chunk-GVO57ZWU.mjs} +2 -2
- package/dist/{chunk-UL2V2Z5B.mjs → chunk-HEDGKRGC.mjs} +3 -3
- package/dist/chunk-IJSEJZ3W.mjs +1 -0
- package/dist/{chunk-S3QSGJX2.mjs → chunk-ITLZQ47H.mjs} +2 -2
- package/dist/{chunk-NIYDN3Y3.mjs → chunk-JEAGKB4V.mjs} +2 -2
- package/dist/{chunk-Z2TMKU5V.mjs → chunk-KNGG6M2I.mjs} +5 -5
- package/dist/chunk-KPPLVGZ3.mjs +1 -0
- package/dist/chunk-KPPLVGZ3.mjs.map +1 -0
- package/dist/{chunk-CC5QWW52.mjs → chunk-LHIG6RW7.mjs} +2 -2
- package/dist/chunk-LHIG6RW7.mjs.map +1 -0
- package/dist/chunk-VU2GCAM4.mjs +81 -0
- package/dist/chunk-VU2GCAM4.mjs.map +1 -0
- package/dist/{chunk-5UGT7L7R.mjs → chunk-XZ43OSZ5.mjs} +5 -3
- package/dist/chunk-XZ43OSZ5.mjs.map +1 -0
- package/dist/{chunk-JQGB77SS.mjs → chunk-Z2ZPTZ6F.mjs} +5 -3
- package/dist/chunk-Z2ZPTZ6F.mjs.map +1 -0
- package/dist/footer/footer.js +0 -1
- package/dist/footer/footer.js.map +1 -1
- package/dist/footer/footer.mjs +3 -3
- package/dist/footer/index.js +0 -1
- package/dist/footer/index.js.map +1 -1
- package/dist/footer/index.mjs +3 -3
- package/dist/form/checkbox/checkbox.d.ts +2 -0
- package/dist/form/checkbox/checkbox.d.ts.map +1 -1
- package/dist/form/checkbox/checkbox.js +7 -3
- package/dist/form/checkbox/checkbox.js.map +1 -1
- package/dist/form/checkbox/checkbox.mjs +3 -3
- package/dist/form/checkbox/index.js +7 -3
- package/dist/form/checkbox/index.js.map +1 -1
- package/dist/form/checkbox/index.mjs +3 -3
- package/dist/form/date-picker/date-picker.js +4 -2
- package/dist/form/date-picker/date-picker.js.map +1 -1
- package/dist/form/date-picker/date-picker.mjs +3 -3
- package/dist/form/date-picker/index.js +4 -2
- package/dist/form/date-picker/index.js.map +1 -1
- package/dist/form/date-picker/index.mjs +3 -3
- package/dist/form/error-message/error-message.js +1 -1
- package/dist/form/error-message/error-message.js.map +1 -1
- package/dist/form/error-message/error-message.mjs +1 -1
- package/dist/form/error-message/index.js +1 -1
- package/dist/form/error-message/index.js.map +1 -1
- package/dist/form/error-message/index.mjs +1 -1
- package/dist/form/error-summary/error-summary.d.ts +65 -0
- package/dist/form/error-summary/error-summary.d.ts.map +1 -0
- package/dist/form/error-summary/error-summary.js +379 -0
- package/dist/form/error-summary/error-summary.js.map +1 -0
- package/dist/form/error-summary/error-summary.mjs +26 -0
- package/dist/form/error-summary/error-summary.mjs.map +1 -0
- package/dist/form/error-summary/focus.d.ts +9 -0
- package/dist/form/error-summary/focus.d.ts.map +1 -0
- package/dist/form/error-summary/focus.js +69 -0
- package/dist/form/error-summary/focus.js.map +1 -0
- package/dist/form/error-summary/focus.mjs +8 -0
- package/dist/form/error-summary/focus.mjs.map +1 -0
- package/dist/form/error-summary/index.d.ts +3 -0
- package/dist/form/error-summary/index.d.ts.map +1 -0
- package/dist/form/error-summary/index.js +375 -0
- package/dist/form/error-summary/index.js.map +1 -0
- package/dist/form/error-summary/index.mjs +21 -0
- package/dist/form/error-summary/index.mjs.map +1 -0
- package/dist/form/fieldset/fieldset.d.ts +2 -0
- package/dist/form/fieldset/fieldset.d.ts.map +1 -1
- package/dist/form/fieldset/fieldset.js +4 -2
- package/dist/form/fieldset/fieldset.js.map +1 -1
- package/dist/form/fieldset/fieldset.mjs +2 -2
- package/dist/form/fieldset/index.js +4 -2
- package/dist/form/fieldset/index.js.map +1 -1
- package/dist/form/fieldset/index.mjs +2 -2
- package/dist/form/index.d.ts +1 -0
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +333 -39
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +29 -13
- package/dist/form/input/index.js +4 -2
- package/dist/form/input/index.js.map +1 -1
- package/dist/form/input/index.mjs +3 -3
- package/dist/form/input/input.js +4 -2
- package/dist/form/input/input.js.map +1 -1
- package/dist/form/input/input.mjs +3 -3
- package/dist/form/input-group/index.js +4 -2
- package/dist/form/input-group/index.js.map +1 -1
- package/dist/form/input-group/index.mjs +2 -2
- package/dist/form/input-group/input-group.d.ts +2 -0
- package/dist/form/input-group/input-group.d.ts.map +1 -1
- package/dist/form/input-group/input-group.js +4 -2
- package/dist/form/input-group/input-group.js.map +1 -1
- package/dist/form/input-group/input-group.mjs +2 -2
- package/dist/form/radio-button/index.js +4 -2
- package/dist/form/radio-button/index.js.map +1 -1
- package/dist/form/radio-button/index.mjs +4 -4
- package/dist/form/radio-button/radio-button.js +4 -2
- package/dist/form/radio-button/radio-button.js.map +1 -1
- package/dist/form/radio-button/radio-button.mjs +4 -4
- package/dist/form/radio-button/radio-group.js +4 -2
- package/dist/form/radio-button/radio-group.js.map +1 -1
- package/dist/form/radio-button/radio-group.mjs +3 -3
- package/dist/form/select/index.js +4 -2
- package/dist/form/select/index.js.map +1 -1
- package/dist/form/select/index.mjs +3 -3
- package/dist/form/select/select.js +4 -2
- package/dist/form/select/select.js.map +1 -1
- package/dist/form/select/select.mjs +3 -3
- package/dist/form/textarea/index.js +4 -2
- package/dist/form/textarea/index.js.map +1 -1
- package/dist/form/textarea/index.mjs +3 -3
- package/dist/form/textarea/textarea.js +4 -2
- package/dist/form/textarea/textarea.js.map +1 -1
- package/dist/form/textarea/textarea.mjs +3 -3
- package/dist/index.js +573 -474
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -42
- package/dist/layout/index.mjs +3 -3
- package/dist/message/index.js.map +1 -1
- package/dist/message/index.mjs +1 -1
- package/dist/message/message.d.ts +2 -2
- package/dist/message/message.d.ts.map +1 -1
- package/dist/message/message.js.map +1 -1
- package/dist/message/message.mjs +1 -1
- package/dist/tabs/index.mjs +5 -5
- package/dist/tabs/tabs.mjs +2 -2
- package/package.json +3 -3
- package/src/accordion/accordion-content.tsx +0 -1
- package/src/form/checkbox/checkbox.tsx +6 -2
- package/src/form/error-message/error-message.tsx +1 -1
- package/src/form/error-summary/error-summary.stories.tsx +29 -0
- package/src/form/error-summary/error-summary.tsx +151 -0
- package/src/form/error-summary/focus.ts +66 -0
- package/src/form/error-summary/index.tsx +2 -0
- package/src/form/fieldset/fieldset.tsx +6 -2
- package/src/form/index.tsx +1 -0
- package/src/form/input-group/input-group.tsx +6 -2
- package/src/message/message.tsx +2 -2
- package/dist/chunk-5UGT7L7R.mjs.map +0 -1
- package/dist/chunk-CC5QWW52.mjs.map +0 -1
- package/dist/chunk-JQGB77SS.mjs.map +0 -1
- package/dist/chunk-JZXZYEPG.mjs.map +0 -1
- package/dist/chunk-QRGGURVO.mjs.map +0 -1
- package/dist/chunk-TWUAXAMR.mjs.map +0 -1
- package/dist/chunk-XFKD6EEJ.mjs +0 -1
- /package/dist/{chunk-ROQH67YP.mjs.map → chunk-6DWIJEHQ.mjs.map} +0 -0
- /package/dist/{chunk-6BXKRPR3.mjs.map → chunk-AXEAIXG7.mjs.map} +0 -0
- /package/dist/{chunk-CXX4SXJG.mjs.map → chunk-CKG2XRMX.mjs.map} +0 -0
- /package/dist/{chunk-YS7HBWOI.mjs.map → chunk-E6OOFTRQ.mjs.map} +0 -0
- /package/dist/{chunk-WUPLEZEY.mjs.map → chunk-GVO57ZWU.mjs.map} +0 -0
- /package/dist/{chunk-UL2V2Z5B.mjs.map → chunk-HEDGKRGC.mjs.map} +0 -0
- /package/dist/{chunk-XFKD6EEJ.mjs.map → chunk-IJSEJZ3W.mjs.map} +0 -0
- /package/dist/{chunk-S3QSGJX2.mjs.map → chunk-ITLZQ47H.mjs.map} +0 -0
- /package/dist/{chunk-NIYDN3Y3.mjs.map → chunk-JEAGKB4V.mjs.map} +0 -0
- /package/dist/{chunk-Z2TMKU5V.mjs.map → chunk-KNGG6M2I.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import "./chunk-3D2MWIEX.mjs";
|
|
2
|
-
import {
|
|
3
|
-
WarningBanner
|
|
4
|
-
} from "./chunk-EMQB6JIS.mjs";
|
|
5
1
|
import "./chunk-CSXSUQ2M.mjs";
|
|
6
2
|
import {
|
|
7
3
|
Text
|
|
8
4
|
} from "./chunk-DMOMTRIY.mjs";
|
|
9
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-3D2MWIEX.mjs";
|
|
10
6
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
7
|
+
WarningBanner
|
|
8
|
+
} from "./chunk-EMQB6JIS.mjs";
|
|
13
9
|
import "./chunk-7YWW46R3.mjs";
|
|
14
10
|
import {
|
|
15
11
|
Tabs
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import {
|
|
18
|
-
TabsList,
|
|
19
|
-
TabsTab
|
|
20
|
-
} from "./chunk-J5SCUELT.mjs";
|
|
12
|
+
} from "./chunk-KNGG6M2I.mjs";
|
|
21
13
|
import {
|
|
22
14
|
TabsContent,
|
|
23
15
|
TabsContents
|
|
24
16
|
} from "./chunk-35QRZSEV.mjs";
|
|
17
|
+
import {
|
|
18
|
+
TabsList,
|
|
19
|
+
TabsTab
|
|
20
|
+
} from "./chunk-J5SCUELT.mjs";
|
|
25
21
|
import "./chunk-KQITCS3U.mjs";
|
|
26
22
|
import "./chunk-AJFQHFQT.mjs";
|
|
27
23
|
import {
|
|
@@ -65,16 +61,6 @@ import "./chunk-JTZPQHKD.mjs";
|
|
|
65
61
|
import {
|
|
66
62
|
Skeleton
|
|
67
63
|
} from "./chunk-WLESNP6Z.mjs";
|
|
68
|
-
import "./chunk-XLLYMQLW.mjs";
|
|
69
|
-
import {
|
|
70
|
-
Link
|
|
71
|
-
} from "./chunk-VYS2QNTL.mjs";
|
|
72
|
-
import "./chunk-RC76SXBP.mjs";
|
|
73
|
-
import {
|
|
74
|
-
Message,
|
|
75
|
-
MessageDescription,
|
|
76
|
-
MessageTitle
|
|
77
|
-
} from "./chunk-TWUAXAMR.mjs";
|
|
78
64
|
import "./chunk-FYFJ75NX.mjs";
|
|
79
65
|
import {
|
|
80
66
|
Modal,
|
|
@@ -83,46 +69,62 @@ import {
|
|
|
83
69
|
ModalHeader
|
|
84
70
|
} from "./chunk-6VKQ6IRG.mjs";
|
|
85
71
|
import "./chunk-HQVL3ZJ2.mjs";
|
|
86
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-IJSEJZ3W.mjs";
|
|
73
|
+
import "./chunk-AGZHQDCQ.mjs";
|
|
74
|
+
import {
|
|
75
|
+
Textarea
|
|
76
|
+
} from "./chunk-JEAGKB4V.mjs";
|
|
87
77
|
import "./chunk-XAFNJELJ.mjs";
|
|
88
78
|
import {
|
|
89
79
|
RadioButton
|
|
90
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-HEDGKRGC.mjs";
|
|
91
81
|
import {
|
|
92
82
|
RadioGroup,
|
|
93
83
|
useRadioGroupContext
|
|
94
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-E6OOFTRQ.mjs";
|
|
95
85
|
import "./chunk-BYEJZSG5.mjs";
|
|
96
86
|
import {
|
|
97
87
|
Select
|
|
98
|
-
} from "./chunk-
|
|
99
|
-
import "./chunk-
|
|
88
|
+
} from "./chunk-AXEAIXG7.mjs";
|
|
89
|
+
import "./chunk-KPPLVGZ3.mjs";
|
|
100
90
|
import {
|
|
101
|
-
|
|
102
|
-
} from "./chunk-
|
|
91
|
+
ErrorSummary
|
|
92
|
+
} from "./chunk-VU2GCAM4.mjs";
|
|
93
|
+
import "./chunk-CKAL5ZJZ.mjs";
|
|
103
94
|
import "./chunk-7LPYJC6S.mjs";
|
|
104
95
|
import {
|
|
105
96
|
Input
|
|
106
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-ITLZQ47H.mjs";
|
|
107
98
|
import "./chunk-YJOOSTJC.mjs";
|
|
108
99
|
import {
|
|
109
100
|
Checkbox
|
|
110
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-BO3EWZGA.mjs";
|
|
111
102
|
import "./chunk-LMF3QGSF.mjs";
|
|
112
103
|
import {
|
|
113
104
|
Fieldset,
|
|
114
105
|
useFieldsetContext
|
|
115
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-Z2ZPTZ6F.mjs";
|
|
116
107
|
import "./chunk-TDLSHJ4Z.mjs";
|
|
117
108
|
import {
|
|
118
109
|
DatePicker
|
|
119
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-GVO57ZWU.mjs";
|
|
120
111
|
import "./chunk-Y5SUMFYJ.mjs";
|
|
121
|
-
import "./chunk-
|
|
112
|
+
import "./chunk-XZ43OSZ5.mjs";
|
|
122
113
|
import "./chunk-NSLSA7F7.mjs";
|
|
123
114
|
import {
|
|
124
115
|
ErrorMessage
|
|
125
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-LHIG6RW7.mjs";
|
|
117
|
+
import "./chunk-CYDWEPFL.mjs";
|
|
118
|
+
import {
|
|
119
|
+
AutoAnimateHeight
|
|
120
|
+
} from "./chunk-KCEWKQ4W.mjs";
|
|
121
|
+
import "./chunk-6QV3OV66.mjs";
|
|
122
|
+
import "./chunk-RC76SXBP.mjs";
|
|
123
|
+
import {
|
|
124
|
+
Message,
|
|
125
|
+
MessageDescription,
|
|
126
|
+
MessageTitle
|
|
127
|
+
} from "./chunk-BYFBK3J7.mjs";
|
|
126
128
|
import {
|
|
127
129
|
focusTrap,
|
|
128
130
|
useHydrated,
|
|
@@ -134,6 +136,9 @@ import {
|
|
|
134
136
|
HelpText
|
|
135
137
|
} from "./chunk-YZDURLEY.mjs";
|
|
136
138
|
import "./chunk-BVG5VSZK.mjs";
|
|
139
|
+
import {
|
|
140
|
+
Container
|
|
141
|
+
} from "./chunk-4QZR2H72.mjs";
|
|
137
142
|
import "./chunk-G65EYZFQ.mjs";
|
|
138
143
|
import {
|
|
139
144
|
Grid,
|
|
@@ -145,12 +150,12 @@ import {
|
|
|
145
150
|
Stack,
|
|
146
151
|
VStack
|
|
147
152
|
} from "./chunk-FUIKSOJF.mjs";
|
|
148
|
-
import {
|
|
149
|
-
Container
|
|
150
|
-
} from "./chunk-4QZR2H72.mjs";
|
|
151
153
|
import "./chunk-7ROE6ADK.mjs";
|
|
152
154
|
import "./chunk-NE6W2PCD.mjs";
|
|
153
|
-
import "./chunk-
|
|
155
|
+
import "./chunk-XLLYMQLW.mjs";
|
|
156
|
+
import {
|
|
157
|
+
Link
|
|
158
|
+
} from "./chunk-VYS2QNTL.mjs";
|
|
154
159
|
import "./chunk-ARHJZUZG.mjs";
|
|
155
160
|
import {
|
|
156
161
|
Card,
|
|
@@ -178,7 +183,7 @@ import {
|
|
|
178
183
|
FooterLinkSection,
|
|
179
184
|
FooterLinkSections,
|
|
180
185
|
FooterLogo
|
|
181
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-6DWIJEHQ.mjs";
|
|
182
187
|
import {
|
|
183
188
|
LinkList
|
|
184
189
|
} from "./chunk-Z2ZCM4BE.mjs";
|
|
@@ -207,10 +212,10 @@ import {
|
|
|
207
212
|
import "./chunk-ZKMFJZSH.mjs";
|
|
208
213
|
import {
|
|
209
214
|
Accordion
|
|
210
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-CKG2XRMX.mjs";
|
|
211
216
|
import {
|
|
212
217
|
AccordionContent
|
|
213
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-5FWY7FIX.mjs";
|
|
214
219
|
import {
|
|
215
220
|
AccordionHeader
|
|
216
221
|
} from "./chunk-MYVC3HMO.mjs";
|
|
@@ -249,6 +254,7 @@ export {
|
|
|
249
254
|
DatePicker,
|
|
250
255
|
DescriptionList,
|
|
251
256
|
ErrorMessage,
|
|
257
|
+
ErrorSummary,
|
|
252
258
|
Fieldset,
|
|
253
259
|
Figure,
|
|
254
260
|
Footer,
|
package/dist/layout/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import "../chunk-BVG5VSZK.mjs";
|
|
2
|
+
import {
|
|
3
|
+
Container
|
|
4
|
+
} from "../chunk-4QZR2H72.mjs";
|
|
2
5
|
import "../chunk-G65EYZFQ.mjs";
|
|
3
6
|
import {
|
|
4
7
|
Grid,
|
|
@@ -10,9 +13,6 @@ import {
|
|
|
10
13
|
Stack,
|
|
11
14
|
VStack
|
|
12
15
|
} from "../chunk-FUIKSOJF.mjs";
|
|
13
|
-
import {
|
|
14
|
-
Container
|
|
15
|
-
} from "../chunk-4QZR2H72.mjs";
|
|
16
16
|
import "../chunk-7ROE6ADK.mjs";
|
|
17
17
|
import "../chunk-NE6W2PCD.mjs";
|
|
18
18
|
import "../chunk-YOSPWY5K.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/message/index.tsx","../../src/message/message.tsx","../../src/box/box.tsx"],"sourcesContent":["export { Message, MessageTitle, MessageDescription } from \"./message\";\nexport type * from \"./message\";\n","import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\
|
|
1
|
+
{"version":3,"sources":["../../src/message/index.tsx","../../src/message/message.tsx","../../src/box/box.tsx"],"sourcesContent":["export { Message, MessageTitle, MessageDescription } from \"./message\";\nexport type * from \"./message\";\n","import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\nexport interface MessageTitleProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const MessageTitle = forwardRef<HTMLParagraphElement, MessageTitleProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-message__title\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nMessageTitle.displayName = \"Message.Title\";\n\nexport interface MessageDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const MessageDescription = forwardRef<HTMLParagraphElement, MessageDescriptionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-message__description\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nMessageDescription.displayName = \"Message.Description\";\n\nexport type MessageProps = (\n | {\n variant?: \"success\" | \"attention\" | \"warning\" | \"info\";\n icon?: never;\n iconClassName?: never;\n }\n | {\n variant: \"neutral\";\n icon?: React.ReactNode;\n iconClassName?: string;\n }\n) &\n Omit<BoxProps, \"variant\" | \"asChild\">;\n\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(\n ({ children, className, variant = \"success\", icon, iconClassName, ...rest }, ref) => {\n return (\n <Box\n className={clsx(`hds-message`, `hds-message--${variant}`, className as undefined)}\n ref={ref}\n {...rest}\n >\n {variant === \"neutral\" && (\n <div className={clsx(\"hds-message--neutral__icon\", iconClassName as undefined)}>\n {icon}\n </div>\n )}\n {children}\n </Box>\n );\n },\n) as MessageType;\nMessage.displayName = \"Message\";\n\ntype MessageType = ReturnType<typeof forwardRef<HTMLDivElement, MessageProps>> & {\n Title: typeof MessageTitle;\n Description: typeof MessageDescription;\n};\nMessage.Title = MessageTitle;\nMessage.Description = MessageDescription;\n","import { forwardRef, useCallback, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot, Slottable } from \"@radix-ui/react-slot\";\n\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;A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","import_typed_classname","import_react_slot","import_jsx_runtime"]}
|
package/dist/message/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from "react";
|
|
2
2
|
import { type BoxProps } from "../box/box";
|
|
3
|
-
interface MessageTitleProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
3
|
+
export interface MessageTitleProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
4
4
|
/**
|
|
5
5
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
6
6
|
*
|
|
@@ -9,7 +9,7 @@ interface MessageTitleProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export declare const MessageTitle: import("react").ForwardRefExoticComponent<MessageTitleProps & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
12
|
-
interface MessageDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
12
|
+
export interface MessageDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
13
13
|
/**
|
|
14
14
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
15
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/message/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEhD,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/message/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC;IACnF;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AACD,eAAO,MAAM,YAAY,oHAWxB,CAAC;AAGF,MAAM,WAAW,uBAAwB,SAAQ,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC;IACzF;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AACD,eAAO,MAAM,kBAAkB,0HAW9B,CAAC;AAGF,MAAM,MAAM,YAAY,GAAG,CACvB;IACE,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;IACvD,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,GACD;IACE,OAAO,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CACJ,GACC,IAAI,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;AAExC,eAAO,MAAM,OAAO,EAiBf,WAAW,CAAC;AAGjB,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,GAAG;IAC/E,KAAK,EAAE,OAAO,YAAY,CAAC;IAC3B,WAAW,EAAE,OAAO,kBAAkB,CAAC;CACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/message/message.tsx","../../src/box/box.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\
|
|
1
|
+
{"version":3,"sources":["../../src/message/message.tsx","../../src/box/box.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Box, type BoxProps } from \"../box/box\";\n\nexport interface MessageTitleProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const MessageTitle = forwardRef<HTMLParagraphElement, MessageTitleProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-message__title\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nMessageTitle.displayName = \"Message.Title\";\n\nexport interface MessageDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const MessageDescription = forwardRef<HTMLParagraphElement, MessageDescriptionProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n className={clsx(\"hds-message__description\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\nMessageDescription.displayName = \"Message.Description\";\n\nexport type MessageProps = (\n | {\n variant?: \"success\" | \"attention\" | \"warning\" | \"info\";\n icon?: never;\n iconClassName?: never;\n }\n | {\n variant: \"neutral\";\n icon?: React.ReactNode;\n iconClassName?: string;\n }\n) &\n Omit<BoxProps, \"variant\" | \"asChild\">;\n\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(\n ({ children, className, variant = \"success\", icon, iconClassName, ...rest }, ref) => {\n return (\n <Box\n className={clsx(`hds-message`, `hds-message--${variant}`, className as undefined)}\n ref={ref}\n {...rest}\n >\n {variant === \"neutral\" && (\n <div className={clsx(\"hds-message--neutral__icon\", iconClassName as undefined)}>\n {icon}\n </div>\n )}\n {children}\n </Box>\n );\n },\n) as MessageType;\nMessage.displayName = \"Message\";\n\ntype MessageType = ReturnType<typeof forwardRef<HTMLDivElement, MessageProps>> & {\n Title: typeof MessageTitle;\n Description: typeof MessageDescription;\n};\nMessage.Title = MessageTitle;\nMessage.Description = MessageDescription;\n","import { forwardRef, useCallback, useState } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot, Slottable } from \"@radix-ui/react-slot\";\n\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,gBAA2B;AAC3B,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;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IACN;AAAA,EAEJ;AACF;AACA,mBAAmB,cAAc;AAgB1B,IAAM,cAAU;AAAA,EACrB,CAAC,IAA4E,QAAQ;AAApF,iBAAE,YAAU,WAAW,UAAU,WAAW,MAAM,cAhErD,IAgEG,IAAoE,iBAApE,IAAoE,CAAlE,YAAU,aAAW,WAAqB,QAAM;AACjD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,8BAAK,eAAe,gBAAgB,OAAO,IAAI,SAAsB;AAAA,QAChF;AAAA,SACI,OAHL;AAAA,QAKE;AAAA,sBAAY,aACX,6CAAC,SAAI,eAAW,8BAAK,8BAA8B,aAA0B,GAC1E,gBACH;AAAA,UAED;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,QAAQ,cAAc;AAMtB,QAAQ,QAAQ;AAChB,QAAQ,cAAc;","names":["import_react","import_typed_classname","import_react_slot","import_jsx_runtime"]}
|
package/dist/message/message.mjs
CHANGED
package/dist/tabs/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "../chunk-7YWW46R3.mjs";
|
|
2
2
|
import {
|
|
3
3
|
Tabs
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import {
|
|
6
|
-
TabsList,
|
|
7
|
-
TabsTab
|
|
8
|
-
} from "../chunk-J5SCUELT.mjs";
|
|
4
|
+
} from "../chunk-KNGG6M2I.mjs";
|
|
9
5
|
import {
|
|
10
6
|
TabsContent,
|
|
11
7
|
TabsContents
|
|
12
8
|
} from "../chunk-35QRZSEV.mjs";
|
|
9
|
+
import {
|
|
10
|
+
TabsList,
|
|
11
|
+
TabsTab
|
|
12
|
+
} from "../chunk-J5SCUELT.mjs";
|
|
13
13
|
import "../chunk-KQITCS3U.mjs";
|
|
14
14
|
import "../chunk-ILFK3VKS.mjs";
|
|
15
15
|
import "../chunk-YOSPWY5K.mjs";
|
package/dist/tabs/tabs.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Tabs
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-J5SCUELT.mjs";
|
|
3
|
+
} from "../chunk-KNGG6M2I.mjs";
|
|
5
4
|
import "../chunk-35QRZSEV.mjs";
|
|
5
|
+
import "../chunk-J5SCUELT.mjs";
|
|
6
6
|
import "../chunk-KQITCS3U.mjs";
|
|
7
7
|
import "../chunk-ILFK3VKS.mjs";
|
|
8
8
|
import "../chunk-YOSPWY5K.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postenbring/hedwig-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/react": "^18.3.11",
|
|
17
|
-
"@types/react-dom": "^18.3.
|
|
17
|
+
"@types/react-dom": "^18.3.1",
|
|
18
18
|
"react": "^18.3.1",
|
|
19
19
|
"react-dom": "18.3.1",
|
|
20
20
|
"tsup": "^8.3.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@radix-ui/react-popover": "1.1.2",
|
|
33
33
|
"@radix-ui/react-slot": "1.1.0",
|
|
34
|
-
"@postenbring/hedwig-css": "1.
|
|
34
|
+
"@postenbring/hedwig-css": "1.3.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
@@ -16,7 +16,6 @@ export const AccordionContent = forwardRef<HTMLDivElement, AccordionContentProps
|
|
|
16
16
|
return (
|
|
17
17
|
<div
|
|
18
18
|
id={context.contentId}
|
|
19
|
-
aria-hidden={!context.open}
|
|
20
19
|
data-state={context.open ? "open" : "closed"}
|
|
21
20
|
{...{ inert: context.open ? undefined : "true" }}
|
|
22
21
|
className={clsx("hds-accordion-item-content", className as undefined)}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
2
|
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
3
|
-
import { ErrorMessage } from "../error-message";
|
|
3
|
+
import { ErrorMessage, type ErrorMessageProps } from "../error-message";
|
|
4
4
|
import { useFieldsetContext } from "../fieldset";
|
|
5
5
|
|
|
6
6
|
export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, "defaultValue"> & {
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
variant?: "plain" | "bounding-box";
|
|
9
9
|
title?: string;
|
|
10
|
+
errorMessageProps?: Partial<ErrorMessageProps>;
|
|
10
11
|
} & (
|
|
11
12
|
| {
|
|
12
13
|
/**
|
|
@@ -38,6 +39,7 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
38
39
|
variant = "plain",
|
|
39
40
|
hasError: hasErrorProp,
|
|
40
41
|
errorMessage,
|
|
42
|
+
errorMessageProps,
|
|
41
43
|
title,
|
|
42
44
|
children,
|
|
43
45
|
className,
|
|
@@ -74,7 +76,9 @@ export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
|
74
76
|
</label>
|
|
75
77
|
{title ? children : null}
|
|
76
78
|
</div>
|
|
77
|
-
<ErrorMessage id={errorMessageId}
|
|
79
|
+
<ErrorMessage id={errorMessageId} {...errorMessageProps}>
|
|
80
|
+
{errorMessage}
|
|
81
|
+
</ErrorMessage>
|
|
78
82
|
</div>
|
|
79
83
|
);
|
|
80
84
|
},
|
|
@@ -11,7 +11,7 @@ export const ErrorMessage = forwardRef<HTMLDivElement, ErrorMessageProps>(
|
|
|
11
11
|
({ children, id, className, ...rest }, ref) => {
|
|
12
12
|
return (
|
|
13
13
|
<div
|
|
14
|
-
aria-live="
|
|
14
|
+
aria-live="polite"
|
|
15
15
|
className={clsx("hds-error-message", className as undefined)}
|
|
16
16
|
id={id}
|
|
17
17
|
ref={ref}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies -- storybook story */
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { ErrorSummary } from ".";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ErrorSummary> = {
|
|
6
|
+
title: "Form/Error Summary",
|
|
7
|
+
component: ErrorSummary,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof ErrorSummary>;
|
|
13
|
+
|
|
14
|
+
export const Preview: Story = {
|
|
15
|
+
tags: ["!dev"],
|
|
16
|
+
args: {
|
|
17
|
+
children: (
|
|
18
|
+
<>
|
|
19
|
+
<ErrorSummary.Heading as="h2">
|
|
20
|
+
To continue please correct the following issues
|
|
21
|
+
</ErrorSummary.Heading>
|
|
22
|
+
<ErrorSummary.List>
|
|
23
|
+
<ErrorSummary.Item href="#firstname">First name is required</ErrorSummary.Item>
|
|
24
|
+
<ErrorSummary.Item href="#surname">Surname is required</ErrorSummary.Item>
|
|
25
|
+
</ErrorSummary.List>
|
|
26
|
+
</>
|
|
27
|
+
),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { forwardRef, useEffect, useRef } from "react";
|
|
2
|
+
import { Message, type MessageProps, type MessageTitleProps } from "../../message";
|
|
3
|
+
import { UnorderedList, type ListProps } from "../../list";
|
|
4
|
+
import { Link } from "../../link";
|
|
5
|
+
import { useMergeRefs } from "../../utils";
|
|
6
|
+
import { focusWithLegendOrLabelInViewport } from "./focus";
|
|
7
|
+
|
|
8
|
+
interface ErrorSummaryHeadingPropsAutoFocus {
|
|
9
|
+
/**
|
|
10
|
+
* The heading will be focused when the component mounts
|
|
11
|
+
*
|
|
12
|
+
* On following errornous form submissions you should manually focus the heading
|
|
13
|
+
* e.g. by passing a ref and calling `ref.current.focus()`
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface ErrorSummaryHeadingPropsAs {
|
|
21
|
+
/**
|
|
22
|
+
* A heading level must be selected, or optionally opting out for a different element
|
|
23
|
+
*
|
|
24
|
+
* Use {@link ErrorSummaryHeadingPropsAsChild.asChild} if you need more control of the rendered element.
|
|
25
|
+
*/
|
|
26
|
+
as: "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "div" | "label" | "p";
|
|
27
|
+
asChild?: never;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface ErrorSummaryHeadingPropsAsChild {
|
|
31
|
+
/**
|
|
32
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
33
|
+
*/
|
|
34
|
+
asChild: true;
|
|
35
|
+
as?: never;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ErrorSummaryHeadingProps = MessageTitleProps &
|
|
39
|
+
ErrorSummaryHeadingPropsAutoFocus &
|
|
40
|
+
(ErrorSummaryHeadingPropsAs | ErrorSummaryHeadingPropsAsChild);
|
|
41
|
+
|
|
42
|
+
export const ErrorSummaryHeading = forwardRef<
|
|
43
|
+
HTMLParagraphElement,
|
|
44
|
+
ErrorSummaryHeadingProps & (ErrorSummaryHeadingPropsAs | ErrorSummaryHeadingPropsAsChild)
|
|
45
|
+
>(({ children, as: Tag, autoFocus = true, ...rest }, ref) => {
|
|
46
|
+
const focusRef = useRef<HTMLElement>(null);
|
|
47
|
+
const mergedRef = useMergeRefs([focusRef, ref]);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
/**
|
|
51
|
+
* Hack: Safari 18 on mac at the time of writing
|
|
52
|
+
* does not correctly focus it with VoiceOver without the timeout
|
|
53
|
+
*/
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
if (focusRef.current && autoFocus) {
|
|
56
|
+
focusRef.current.focus();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- Only on initial render
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Message.Title ref={mergedRef} tabIndex={-1} asChild {...rest}>
|
|
64
|
+
{Tag ? <Tag>{children}</Tag> : children}
|
|
65
|
+
</Message.Title>
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
ErrorSummaryHeading.displayName = "ErrorSummary.Heading";
|
|
69
|
+
|
|
70
|
+
export interface ErrorSummaryListProps extends ListProps {
|
|
71
|
+
/**
|
|
72
|
+
* Sets the size of the items (font)
|
|
73
|
+
*
|
|
74
|
+
* @default "small"
|
|
75
|
+
*/
|
|
76
|
+
size?: ListProps["size"];
|
|
77
|
+
}
|
|
78
|
+
export const ErrorSummaryList = forwardRef<HTMLUListElement, ErrorSummaryListProps>(
|
|
79
|
+
({ children, style: _style, size = "small", ...rest }, ref) => {
|
|
80
|
+
const style = {
|
|
81
|
+
// Match the link `solid` style, which black underline
|
|
82
|
+
"--_hds-list-marker-color": "var(--hds-ui-colors-black)",
|
|
83
|
+
..._style,
|
|
84
|
+
};
|
|
85
|
+
return (
|
|
86
|
+
<Message.Description asChild>
|
|
87
|
+
<UnorderedList size={size} ref={ref} style={style} {...rest}>
|
|
88
|
+
{children}
|
|
89
|
+
</UnorderedList>
|
|
90
|
+
</Message.Description>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
ErrorSummaryList.displayName = "ErrorSummary.List";
|
|
95
|
+
|
|
96
|
+
export interface ErrorSummaryItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
97
|
+
/**
|
|
98
|
+
* A hash link to the element that the error message refers to
|
|
99
|
+
*
|
|
100
|
+
* Must start with "#" as it's passed to the `href` attribute of an anchor element
|
|
101
|
+
*
|
|
102
|
+
* @example "#email"
|
|
103
|
+
*/
|
|
104
|
+
href: `#${string}`;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Extra props to pass to the link element
|
|
108
|
+
*/
|
|
109
|
+
linkProps?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
110
|
+
}
|
|
111
|
+
export const ErrorSummaryItem = forwardRef<HTMLLIElement, ErrorSummaryItemProps>(
|
|
112
|
+
({ children, href, linkProps, ...rest }, ref) => {
|
|
113
|
+
function onClick(e: React.MouseEvent<HTMLAnchorElement>) {
|
|
114
|
+
linkProps?.onClick?.(e);
|
|
115
|
+
if (focusWithLegendOrLabelInViewport(href.replace("#", ""))) {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<li ref={ref} {...rest}>
|
|
122
|
+
<Link size="small" href={href} variant="solid" {...linkProps} onClick={onClick}>
|
|
123
|
+
{children}
|
|
124
|
+
</Link>
|
|
125
|
+
</li>
|
|
126
|
+
);
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
ErrorSummaryItem.displayName = "ErrorSummary.Item";
|
|
130
|
+
|
|
131
|
+
export type ErrorSummaryProps = Omit<MessageProps, "variant" | "icon" | "iconClassName">;
|
|
132
|
+
|
|
133
|
+
export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
|
|
134
|
+
({ children, ...rest }, ref) => {
|
|
135
|
+
return (
|
|
136
|
+
<Message variant="warning" ref={ref} {...rest}>
|
|
137
|
+
{children}
|
|
138
|
+
</Message>
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
) as ErrorSummaryType;
|
|
142
|
+
ErrorSummary.displayName = "ErrorSummary";
|
|
143
|
+
|
|
144
|
+
type ErrorSummaryType = ReturnType<typeof forwardRef<HTMLDivElement, ErrorSummaryProps>> & {
|
|
145
|
+
Heading: typeof ErrorSummaryHeading;
|
|
146
|
+
List: typeof ErrorSummaryList;
|
|
147
|
+
Item: typeof ErrorSummaryItem;
|
|
148
|
+
};
|
|
149
|
+
ErrorSummary.Heading = ErrorSummaryHeading;
|
|
150
|
+
ErrorSummary.List = ErrorSummaryList;
|
|
151
|
+
ErrorSummary.Item = ErrorSummaryItem;
|