@stihl-design-system/components 1.0.0-RC.0 → 1.0.0-RC.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +10 -1
  2. package/assets/Asterisk.288a3f48.css +1 -0
  3. package/assets/Button.c09c516e.css +1 -0
  4. package/assets/ButtonRound.fd628e54.css +1 -0
  5. package/assets/Checkbox.cde01607.css +1 -0
  6. package/assets/CustomReactSelect.cdb5f164.css +1 -0
  7. package/assets/Fieldset.729910fe.css +1 -0
  8. package/assets/Heading.50f5e903.css +1 -0
  9. package/assets/Input.92913cfe.css +1 -0
  10. package/assets/InputPassword.d7b9c937.css +1 -0
  11. package/assets/InputSearch.888f630a.css +1 -0
  12. package/assets/InputStepper.969db0d2.css +1 -0
  13. package/assets/Link.75834750.css +1 -0
  14. package/assets/LinkStandalone.19bdab0d.css +1 -0
  15. package/assets/OptionCheckbox.c56568a3.css +1 -0
  16. package/assets/Radio.79d98dde.css +1 -0
  17. package/assets/Select.b9c135c2.css +1 -0
  18. package/assets/Switch.781e3de6.css +1 -0
  19. package/assets/SystemFeedback.c30264c0.css +1 -0
  20. package/assets/Text.ac70cc84.css +1 -0
  21. package/assets/Textarea.12046393.css +1 -0
  22. package/assets/Title.e9e5a7e6.css +1 -0
  23. package/asterisk.cb74ea72.js +8 -0
  24. package/button.87ad387c.js +135 -0
  25. package/buttonround.ecb24c29.js +118 -0
  26. package/checkbox.42617f46.js +112 -0
  27. package/{checkboxgroup.e9e25471.js → checkboxgroup.fa110fdf.js} +2 -2
  28. package/chunks/{CustomReactSelect.9d0a378a.js → CustomReactSelect.2e4e7ba0.js} +342 -338
  29. package/chunks/Link.module.15dedc23.js +37 -0
  30. package/{combobox.f98a4472.js → combobox.d93091e0.js} +1 -1
  31. package/{customreactselect.a53f9932.js → customreactselect.7c77375a.js} +4 -4
  32. package/fieldset.fdd84bda.js +98 -0
  33. package/heading.c02dcb70.js +44 -0
  34. package/index.es.js +19 -19
  35. package/input.064e0bbf.js +230 -0
  36. package/inputpassword.f76c2f62.js +139 -0
  37. package/inputsearch.6e913fc6.js +188 -0
  38. package/inputstepper.2047ec77.js +286 -0
  39. package/{link.cd3720d1.js → link.5eb13d6e.js} +1 -1
  40. package/linkstandalone.edfd6288.js +80 -0
  41. package/optioncheckbox.2369560b.js +43 -0
  42. package/package.json +10 -1
  43. package/radio.fd841ab0.js +79 -0
  44. package/{radiogroup.6a22fe96.js → radiogroup.e1c8ea3d.js} +2 -2
  45. package/select.88d40c51.js +188 -0
  46. package/styles/fonts/STIHLContrafaceDigitalDisplayTitling.woff +0 -0
  47. package/styles/fonts/STIHLContrafaceDigitalDisplayTitling.woff2 +0 -0
  48. package/styles/fonts/STIHLContrafaceDigitalText-Bold.woff +0 -0
  49. package/styles/fonts/STIHLContrafaceDigitalText-Bold.woff2 +0 -0
  50. package/styles/fonts/STIHLContrafaceDigitalText.woff +0 -0
  51. package/styles/fonts/STIHLContrafaceDigitalText.woff2 +0 -0
  52. package/styles/fonts/font-face.min.css +1 -1
  53. package/styles/scss/lib/_heading.scss +14 -6
  54. package/styles/scss/lib/_text.scss +12 -12
  55. package/switch.96fd1689.js +65 -0
  56. package/{systemfeedback.6bbd1505.js → systemfeedback.8515a4e0.js} +10 -10
  57. package/text.de8facb9.js +57 -0
  58. package/textarea.b8c40c8b.js +189 -0
  59. package/title.7be43d50.js +36 -0
  60. package/assets/Asterisk.582f2067.css +0 -1
  61. package/assets/Button.684e8bda.css +0 -1
  62. package/assets/ButtonRound.ca8748cf.css +0 -1
  63. package/assets/Checkbox.84cf6398.css +0 -1
  64. package/assets/CustomReactSelect.d89ccccb.css +0 -1
  65. package/assets/Fieldset.5297efb8.css +0 -1
  66. package/assets/Heading.32278621.css +0 -1
  67. package/assets/Input.2c508b2f.css +0 -1
  68. package/assets/InputPassword.a534f047.css +0 -1
  69. package/assets/InputSearch.8f986307.css +0 -1
  70. package/assets/InputStepper.52fb45ca.css +0 -1
  71. package/assets/Link.03deeca0.css +0 -1
  72. package/assets/LinkStandalone.7e23a8ac.css +0 -1
  73. package/assets/OptionCheckbox.9c20f6f1.css +0 -1
  74. package/assets/Radio.be8f06f5.css +0 -1
  75. package/assets/Select.b2423b5f.css +0 -1
  76. package/assets/Switch.f3ab20de.css +0 -1
  77. package/assets/SystemFeedback.f4421d60.css +0 -1
  78. package/assets/Text.4756effe.css +0 -1
  79. package/assets/Textarea.eecf04b3.css +0 -1
  80. package/assets/Title.60d50d3e.css +0 -1
  81. package/asterisk.91abccec.js +0 -8
  82. package/button.89b2675b.js +0 -135
  83. package/buttonround.c60c8034.js +0 -118
  84. package/checkbox.7d414047.js +0 -112
  85. package/chunks/Link.module.b8230547.js +0 -37
  86. package/fieldset.fb7b7e49.js +0 -98
  87. package/heading.cb7698f4.js +0 -44
  88. package/input.abb902e3.js +0 -228
  89. package/inputpassword.11c12c66.js +0 -139
  90. package/inputsearch.0c88e71a.js +0 -188
  91. package/inputstepper.b74dac4d.js +0 -284
  92. package/linkstandalone.26b52de0.js +0 -80
  93. package/optioncheckbox.7195f001.js +0 -43
  94. package/radio.1b205d64.js +0 -79
  95. package/select.2ff31eab.js +0 -188
  96. package/styles/fonts/STIHLContrafaceDisplayTitling.woff +0 -0
  97. package/styles/fonts/STIHLContrafaceDisplayTitling.woff2 +0 -0
  98. package/styles/fonts/STIHLContrafaceText-Bold.woff +0 -0
  99. package/styles/fonts/STIHLContrafaceText-Bold.woff2 +0 -0
  100. package/styles/fonts/STIHLContrafaceText.woff +0 -0
  101. package/styles/fonts/STIHLContrafaceText.woff2 +0 -0
  102. package/switch.2f011fcc.js +0 -65
  103. package/text.8d80704f.js +0 -57
  104. package/textarea.e156b0ce.js +0 -189
  105. package/title.d855a8e4.js +0 -36
@@ -1,284 +0,0 @@
1
- import "./assets/InputStepper.52fb45ca.css";
2
- import { j as n } from "./chunks/jsx-runtime.5c071667.js";
3
- import { c } from "./chunks/index.8021d3e0.js";
4
- import { useState as _, useRef as B, useEffect as N, useLayoutEffect as M } from "react";
5
- import { u as fe } from "./chunks/useBreakpoint.6c1b06c2.js";
6
- import { Asterisk as me } from "./asterisk.91abccec.js";
7
- import { DSButton as X } from "./button.89b2675b.js";
8
- import { M as D, b as L } from "./chunks/Input.utils.f8f3286f.js";
9
- import { DSSystemFeedback as he } from "./systemfeedback.6bbd1505.js";
10
- import { g as x } from "./chunks/helpers.ea3ca41a.js";
11
- const be = "_input_e09kw_73", we = "_input--invalid_e09kw_184", ke = "_input--small_e09kw_191", xe = "_input--has-leading-icon_e09kw_237", Se = "_input--has-action-button_e09kw_240", ve = "_input--has-second-action-button_e09kw_243", Ie = "_input--has-affix_e09kw_255", ye = "_input--is-ready_e09kw_267", ge = "_root_e09kw_274", Ae = "_hint_e09kw_282", Be = "_label_e09kw_282", Ne = "_wrapper_e09kw_286", De = "_affix_e09kw_292", Le = "_affix--small_e09kw_310", He = "_affix--disabled_e09kw_322", je = "_prefix_e09kw_326", Ee = "_suffix_e09kw_332", Re = "_action-button_e09kw_337", Ce = "_label--hidden_e09kw_354", $e = "_feedback_e09kw_381", Fe = "_second-action-button_e09kw_395", Ve = "_value-announcer_e09kw_399", t = {
12
- input: be,
13
- "input--invalid": "_input--invalid_e09kw_184",
14
- inputInvalid: we,
15
- "input--small": "_input--small_e09kw_191",
16
- inputSmall: ke,
17
- "input--has-leading-icon": "_input--has-leading-icon_e09kw_237",
18
- inputHasLeadingIcon: xe,
19
- "input--has-action-button": "_input--has-action-button_e09kw_240",
20
- inputHasActionButton: Se,
21
- "input--has-second-action-button": "_input--has-second-action-button_e09kw_243",
22
- inputHasSecondActionButton: ve,
23
- "input--has-affix": "_input--has-affix_e09kw_255",
24
- inputHasAffix: Ie,
25
- "input--is-ready": "_input--is-ready_e09kw_267",
26
- inputIsReady: ye,
27
- root: ge,
28
- hint: Ae,
29
- label: Be,
30
- wrapper: Ne,
31
- affix: De,
32
- "affix--small": "_affix--small_e09kw_310",
33
- affixSmall: Le,
34
- "affix--disabled": "_affix--disabled_e09kw_322",
35
- affixDisabled: He,
36
- prefix: je,
37
- suffix: Ee,
38
- "action-button": "_action-button_e09kw_337",
39
- actionButton: Re,
40
- "label--hidden": "_label--hidden_e09kw_354",
41
- labelHidden: Ce,
42
- feedback: $e,
43
- "second-action-button": "_second-action-button_e09kw_395",
44
- secondActionButton: Fe,
45
- "value-announcer": "_value-announcer_e09kw_399",
46
- valueAnnouncer: Ve
47
- }, Pe = ({
48
- id: a,
49
- label: f,
50
- prefix: m,
51
- suffix: h
52
- }) => {
53
- if (!a)
54
- throw new Error(
55
- x(
56
- "DSInputStepper",
57
- 'A unique "id" prop is required. Please add an unique "id" prop to the DSInputStepper component.'
58
- )
59
- );
60
- if (!f)
61
- throw new Error(
62
- x(
63
- "DSInputStepper",
64
- `A label is always required for a11y reasons. Please add a descriptive "label" prop to the DSInputStepper component. If you don't want to display a label, set hideLabel={true}.`
65
- )
66
- );
67
- m && m.length > D && console.warn(
68
- x(
69
- "DSInputStepper",
70
- `Prefix length must not exceed ${D} characters.`
71
- )
72
- ), h && h.length > L && console.warn(
73
- x(
74
- "DSInputStepper",
75
- `Suffix length must not exceed ${L} characters.`
76
- )
77
- );
78
- }, Qe = ({
79
- id: a,
80
- label: f,
81
- announcementText: m = "Value changed to",
82
- className: h,
83
- disabled: d = !1,
84
- decreaseAmountButtonLabel: q = "Decrease",
85
- hint: S,
86
- hideLabel: G = !1,
87
- invalid: b = !1,
88
- increaseAmountButtonLabel: O = "Increase",
89
- prefix: u,
90
- max: H = 100,
91
- min: j = 0,
92
- readonly: w = !1,
93
- required: E = !1,
94
- size: o = "medium",
95
- step: U = 1,
96
- suffix: r,
97
- systemFeedback: v,
98
- value: k,
99
- onChange: R,
100
- ...J
101
- }) => {
102
- process.env.NODE_ENV !== "production" && Pe({
103
- id: a,
104
- label: f,
105
- prefix: u,
106
- suffix: r
107
- });
108
- const [K, Q] = _(!1), [p, I] = _(k), [y, C] = _(""), [Y, Z] = _(!1), [z, ee] = _({}), s = B(null), te = u == null ? void 0 : u.substring(0, D), g = B(null), ne = r == null ? void 0 : r.substring(0, L), A = B(null), ae = fe(G);
109
- N(() => {
110
- k && I(k);
111
- }, [k]), N(() => {
112
- if (y) {
113
- const e = setTimeout(() => {
114
- C("");
115
- }, 3e3);
116
- return () => clearTimeout(e);
117
- }
118
- }, [y]), N(() => {
119
- var i;
120
- const e = (l) => {
121
- l.preventDefault();
122
- };
123
- return (i = s.current) == null || i.addEventListener("wheel", e, {
124
- // The { passive: false } option is used to indicate that the event listener wants to cancel the event, allowing preventDefault to work as expected.
125
- passive: !1
126
- }), () => {
127
- var l;
128
- (l = s.current) == null || l.removeEventListener("wheel", e);
129
- };
130
- }, []), M(() => {
131
- const e = o === "medium" ? 16 : 8, i = {};
132
- if (g.current) {
133
- const l = g.current.offsetWidth;
134
- i.paddingLeft = e + l + "px";
135
- }
136
- if (A.current) {
137
- const l = A.current.offsetWidth;
138
- i.paddingRight = e + l + "px";
139
- }
140
- ee(i), Q(!0);
141
- }, [u, r, o, Y]), M(() => {
142
- (async () => {
143
- "fonts" in document && (await document.fonts.load('1em "STIHL Contraface Text Regular"'), Z(!0));
144
- })();
145
- }, []);
146
- const $ = c(t.affix, {
147
- [t.affixSmall]: o === "small"
148
- }), F = `${a}-label`, V = `${a}-feedback`, P = `${a}-hint`, T = `${a}-value-announcer`, se = S ? ` ${P}` : "", oe = c(t.root, h), ie = c(t.input, {
149
- // small input
150
- [t.inputSmall]: o === "small",
151
- // invalid state
152
- [t.inputInvalid]: b,
153
- // prefix/suffix
154
- [t.inputHasAffix]: u || r,
155
- [t.inputIsReady]: K
156
- }), le = c(t.label, {
157
- // hide label only visually to keep them available for assistive technologies
158
- [t.labelHidden]: ae
159
- }), ce = c(t.secondActionButton, {
160
- [t.secondActionButtonSmall]: o === "small"
161
- }), ue = c(t.actionButton, {
162
- [t.actionButtonSmall]: o === "small"
163
- }), re = () => {
164
- const e = [T];
165
- return b && v && e.push(V), e.join(" ");
166
- }, W = () => {
167
- var e;
168
- if (s.current) {
169
- I(s.current.value);
170
- const i = new Event("change", { bubbles: !0 });
171
- (e = s.current) == null || e.dispatchEvent(i), C(`${m} ${s.current.value}`);
172
- }
173
- }, de = () => {
174
- var e;
175
- (e = s.current) == null || e.stepDown(), W();
176
- }, pe = () => {
177
- var e;
178
- (e = s.current) == null || e.stepUp(), W();
179
- }, _e = (e) => {
180
- I(e.target.value), R && R(e);
181
- };
182
- return /* @__PURE__ */ n.jsxs("div", { className: oe, children: [
183
- /* @__PURE__ */ n.jsxs("label", { className: le, id: F, htmlFor: a, children: [
184
- f,
185
- E && /* @__PURE__ */ n.jsx(me, {})
186
- ] }),
187
- S && /* @__PURE__ */ n.jsx("div", { className: t.hint, id: P, children: S }),
188
- /* @__PURE__ */ n.jsx(
189
- "div",
190
- {
191
- "aria-live": "polite",
192
- "aria-atomic": "true",
193
- className: t.valueAnnouncer,
194
- id: T,
195
- children: y
196
- }
197
- ),
198
- b && v && /* @__PURE__ */ n.jsx(
199
- he,
200
- {
201
- className: t.feedback,
202
- message: v,
203
- type: "invalid",
204
- id: V
205
- }
206
- ),
207
- /* @__PURE__ */ n.jsxs("div", { className: t.wrapper, children: [
208
- u && /* @__PURE__ */ n.jsx(
209
- "span",
210
- {
211
- className: c($, t.prefix),
212
- ref: g,
213
- "aria-disabled": d,
214
- children: te
215
- }
216
- ),
217
- /* @__PURE__ */ n.jsx(
218
- "input",
219
- {
220
- className: ie,
221
- id: a,
222
- ref: s,
223
- ...J,
224
- style: z,
225
- "aria-labelledby": `${F}${se}`,
226
- "aria-describedby": re(),
227
- "aria-invalid": b,
228
- "aria-disabled": w,
229
- disabled: d,
230
- min: j,
231
- max: H,
232
- readOnly: w,
233
- required: E,
234
- step: U,
235
- type: "number",
236
- value: p,
237
- onChange: _e
238
- }
239
- ),
240
- r && /* @__PURE__ */ n.jsx(
241
- "span",
242
- {
243
- className: c($, t.suffix),
244
- ref: A,
245
- "aria-disabled": d,
246
- children: ne
247
- }
248
- ),
249
- /* @__PURE__ */ n.jsx(
250
- X,
251
- {
252
- hideLabel: !0,
253
- theme: "light",
254
- iconName: "minus",
255
- variant: "filled",
256
- className: ce,
257
- size: o,
258
- onClick: de,
259
- disabled: d || w || !!p && Number(p) <= j,
260
- type: "button",
261
- children: q
262
- }
263
- ),
264
- /* @__PURE__ */ n.jsx(
265
- X,
266
- {
267
- hideLabel: !0,
268
- theme: "light",
269
- iconName: "plus",
270
- variant: "filled",
271
- className: ue,
272
- size: o,
273
- onClick: pe,
274
- disabled: d || w || !!p && Number(p) >= H,
275
- type: "button",
276
- children: O
277
- }
278
- )
279
- ] })
280
- ] });
281
- };
282
- export {
283
- Qe as DSInputStepper
284
- };
@@ -1,80 +0,0 @@
1
- import "./assets/LinkStandalone.7e23a8ac.css";
2
- import { j as i } from "./chunks/jsx-runtime.5c071667.js";
3
- import { c as D } from "./chunks/index.8021d3e0.js";
4
- import { DSIcon as x } from "./icon.b4211784.js";
5
- import "react";
6
- import "./chunks/Link.module.b8230547.js";
7
- const H = "_root_19try_25", j = "_root--highlight_19try_96", v = "_root--neutral-dark_19try_167", L = "_root--highlight-dark_19try_238", N = "_root--active_19try_309", I = "_root--icon-left_19try_315", t = {
8
- root: H,
9
- "root--highlight": "_root--highlight_19try_96",
10
- rootHighlight: j,
11
- "root--neutral-dark": "_root--neutral-dark_19try_167",
12
- rootNeutralDark: v,
13
- "root--highlight-dark": "_root--highlight-dark_19try_238",
14
- rootHighlightDark: L,
15
- "root--active": "_root--active_19try_309",
16
- rootActive: N,
17
- "root--icon-left": "_root--icon-left_19try_315",
18
- rootIconLeft: I
19
- }, R = ({
20
- children: e,
21
- aria: _,
22
- active: g,
23
- className: n,
24
- dataTrackingid: c,
25
- download: k,
26
- href: a,
27
- iconName: l,
28
- iconPosition: d = "left",
29
- iconSource: h,
30
- referrerPolicy: m,
31
- rel: u,
32
- target: y = "_self",
33
- theme: o = "light",
34
- variant: r = "neutral",
35
- ...f
36
- }) => {
37
- const p = D(t.root, n, {
38
- // variant
39
- [t.rootHighlight]: r === "highlight",
40
- // theme
41
- [t.rootNeutralDark]: o === "dark" && r === "neutral",
42
- [t.rootHighlightDark]: o === "dark" && r === "highlight",
43
- // active
44
- [t.rootActive]: g,
45
- // icon position
46
- [t.rootIconLeft]: d === "left"
47
- }), s = a === void 0 ? "span" : "a";
48
- return /* @__PURE__ */ i.jsxs(
49
- s,
50
- {
51
- className: p,
52
- "data-trackingid": c,
53
- ...s === "a" && {
54
- href: a,
55
- target: y,
56
- rel: u,
57
- referrerPolicy: m,
58
- download: k
59
- },
60
- ..._,
61
- ...f,
62
- children: [
63
- /* @__PURE__ */ i.jsx("span", { className: t.label, children: e }),
64
- (l || h) && /* @__PURE__ */ i.jsx(
65
- x,
66
- {
67
- name: l,
68
- theme: o,
69
- source: h,
70
- size: "medium",
71
- "aria-hidden": "true"
72
- }
73
- )
74
- ]
75
- }
76
- );
77
- };
78
- export {
79
- R as DSLinkStandalone
80
- };
@@ -1,43 +0,0 @@
1
- import "./assets/OptionCheckbox.9c20f6f1.css";
2
- import { j as e } from "./chunks/jsx-runtime.5c071667.js";
3
- import { c as s } from "./chunks/index.8021d3e0.js";
4
- import { DSIcon as _ } from "./icon.b4211784.js";
5
- const i = "_root_bdq8c_49", l = "_root--disabled_bdq8c_68", k = "_checkbox_bdq8c_72", n = "_icon-check_bdq8c_86", r = "_checkbox--checked_bdq8c_105", x = "_checkbox--disabled_bdq8c_108", m = "_label_bdq8c_125", c = {
6
- root: i,
7
- "root--disabled": "_root--disabled_bdq8c_68",
8
- rootDisabled: l,
9
- checkbox: k,
10
- "icon-check": "_icon-check_bdq8c_86",
11
- iconCheck: n,
12
- "checkbox--checked": "_checkbox--checked_bdq8c_105",
13
- checkboxChecked: r,
14
- "checkbox--disabled": "_checkbox--disabled_bdq8c_108",
15
- checkboxDisabled: x,
16
- label: m
17
- }, D = ({
18
- label: b,
19
- checked: d,
20
- className: h,
21
- disabled: o
22
- }) => {
23
- const a = s(c.root, {
24
- [c.rootDisabled]: o
25
- }), t = s(c.checkbox, {
26
- [c.checkboxDisabled]: o,
27
- [c.checkboxChecked]: d
28
- });
29
- return /* @__PURE__ */ e.jsx("div", { className: h, children: /* @__PURE__ */ e.jsxs("div", { className: a, children: [
30
- /* @__PURE__ */ e.jsx("span", { className: t, children: /* @__PURE__ */ e.jsx(
31
- _,
32
- {
33
- name: "check",
34
- className: c.iconCheck,
35
- "aria-hidden": "true"
36
- }
37
- ) }),
38
- /* @__PURE__ */ e.jsx("span", { className: c.label, children: b })
39
- ] }) });
40
- };
41
- export {
42
- D as OptionCheckbox
43
- };
package/radio.1b205d64.js DELETED
@@ -1,79 +0,0 @@
1
- import "./assets/Radio.be8f06f5.css";
2
- import { j as a } from "./chunks/jsx-runtime.5c071667.js";
3
- import { c as d } from "./chunks/index.8021d3e0.js";
4
- import { forwardRef as H, useRef as I, useState as R, useCallback as S } from "react";
5
- import { u as g } from "./chunks/useBreakpoint.6c1b06c2.js";
6
- const B = "_root_11cbi_25", V = "_root--disabled_11cbi_44", w = "_radio_11cbi_48", E = "_dot_11cbi_63", L = "_radio--invalid_11cbi_85", O = "_label_11cbi_90", P = "_label--hidden_11cbi_100", U = "_input_11cbi_113", o = {
7
- root: B,
8
- "root--disabled": "_root--disabled_11cbi_44",
9
- rootDisabled: V,
10
- radio: w,
11
- dot: E,
12
- "radio--invalid": "_radio--invalid_11cbi_85",
13
- radioInvalid: L,
14
- label: O,
15
- "label--hidden": "_label--hidden_11cbi_100",
16
- labelHidden: P,
17
- input: U
18
- }, q = H(
19
- ({
20
- label: l,
21
- name: c,
22
- value: _,
23
- defaultChecked: b = !1,
24
- disabled: e = !1,
25
- hideLabel: u = !1,
26
- checked: r,
27
- invalid: f = !1,
28
- className: m,
29
- onChange: t,
30
- ...p
31
- }, s) => {
32
- const h = I(null), [v, x] = R(b), n = r !== void 0, C = n ? r : v, j = g(u), k = d(
33
- o.root,
34
- {
35
- [o.rootDisabled]: e
36
- },
37
- m
38
- ), N = d(o.label, {
39
- // hide label only visually to keep them available for assistive technologies
40
- [o.labelHidden]: j
41
- }), D = d(o.radio, {
42
- [o.radioInvalid]: f
43
- }), y = S(
44
- (i) => {
45
- if (e) {
46
- i.preventDefault();
47
- return;
48
- }
49
- n || x(i.target.checked), t && t(i);
50
- },
51
- [e, n, t]
52
- );
53
- return /* @__PURE__ */ a.jsxs("label", { className: k, children: [
54
- /* @__PURE__ */ a.jsx(
55
- "input",
56
- {
57
- type: "radio",
58
- value: _,
59
- name: c,
60
- className: o.input,
61
- ref: (i) => {
62
- typeof s == "function" ? s(i) : s !== null && (s.current = i), h.current = i;
63
- },
64
- onChange: y,
65
- ...p,
66
- disabled: e,
67
- checked: C,
68
- "aria-label": typeof l == "string" ? l : void 0
69
- }
70
- ),
71
- /* @__PURE__ */ a.jsx("span", { className: D, children: /* @__PURE__ */ a.jsx("div", { className: o.dot }) }),
72
- /* @__PURE__ */ a.jsx("span", { className: N, children: l })
73
- ] });
74
- }
75
- );
76
- q.displayName = "DSRadio";
77
- export {
78
- q as DSRadio
79
- };
@@ -1,188 +0,0 @@
1
- import "./assets/Select.b2423b5f.css";
2
- import { j as s } from "./chunks/jsx-runtime.5c071667.js";
3
- import { c as _ } from "./chunks/index.8021d3e0.js";
4
- import { useRef as C, useState as R, useEffect as W } from "react";
5
- import { u as F } from "./chunks/useBreakpoint.6c1b06c2.js";
6
- import { Asterisk as M } from "./asterisk.91abccec.js";
7
- import { DSIcon as O } from "./icon.b4211784.js";
8
- import { DSSystemFeedback as V } from "./systemfeedback.6bbd1505.js";
9
- import { g as q } from "./chunks/helpers.ea3ca41a.js";
10
- const J = "_root_fqmqk_73", K = "_hint_fqmqk_81", Q = "_label_fqmqk_81", T = "_wrapper_fqmqk_85", U = "_affix_fqmqk_91", X = "_affix--small_fqmqk_109", Y = "_affix--disabled_fqmqk_121", Z = "_prefix_fqmqk_125", z = "_suffix_fqmqk_131", G = "_action-button_fqmqk_136", ee = "_label--hidden_fqmqk_153", te = "_feedback_fqmqk_180", se = "_select-wrapper_fqmqk_185", ne = "_select_fqmqk_185", ae = "_select--invalid_fqmqk_304", le = "_select--small_fqmqk_311", ce = "_input--has-leading-icon_fqmqk_357", oe = "_input--has-action-button_fqmqk_360", ie = "_input--has-second-action-button_fqmqk_363", re = "_select--has-leading-icon_fqmqk_366", _e = "_select--has-action-button_fqmqk_369", fe = "_select--has-second-action-button_fqmqk_372", de = "_select--has-affix_fqmqk_375", me = "_select--is-ready_fqmqk_387", qe = "_select--placeholder_fqmqk_399", ue = "_chevron_fqmqk_408", he = "_chevron--small_fqmqk_412", pe = "_chevron--disabled_fqmqk_415", e = {
11
- root: J,
12
- hint: K,
13
- label: Q,
14
- wrapper: T,
15
- affix: U,
16
- "affix--small": "_affix--small_fqmqk_109",
17
- affixSmall: X,
18
- "affix--disabled": "_affix--disabled_fqmqk_121",
19
- affixDisabled: Y,
20
- prefix: Z,
21
- suffix: z,
22
- "action-button": "_action-button_fqmqk_136",
23
- actionButton: G,
24
- "label--hidden": "_label--hidden_fqmqk_153",
25
- labelHidden: ee,
26
- feedback: te,
27
- "select-wrapper": "_select-wrapper_fqmqk_185",
28
- selectWrapper: se,
29
- select: ne,
30
- "select--invalid": "_select--invalid_fqmqk_304",
31
- selectInvalid: ae,
32
- "select--small": "_select--small_fqmqk_311",
33
- selectSmall: le,
34
- "input--has-leading-icon": "_input--has-leading-icon_fqmqk_357",
35
- inputHasLeadingIcon: ce,
36
- "input--has-action-button": "_input--has-action-button_fqmqk_360",
37
- inputHasActionButton: oe,
38
- "input--has-second-action-button": "_input--has-second-action-button_fqmqk_363",
39
- inputHasSecondActionButton: ie,
40
- "select--has-leading-icon": "_select--has-leading-icon_fqmqk_366",
41
- selectHasLeadingIcon: re,
42
- "select--has-action-button": "_select--has-action-button_fqmqk_369",
43
- selectHasActionButton: _e,
44
- "select--has-second-action-button": "_select--has-second-action-button_fqmqk_372",
45
- selectHasSecondActionButton: fe,
46
- "select--has-affix": "_select--has-affix_fqmqk_375",
47
- selectHasAffix: de,
48
- "select--is-ready": "_select--is-ready_fqmqk_387",
49
- selectIsReady: me,
50
- "select--placeholder": "_select--placeholder_fqmqk_399",
51
- selectPlaceholder: qe,
52
- chevron: ue,
53
- "chevron--small": "_chevron--small_fqmqk_412",
54
- chevronSmall: he,
55
- "chevron--disabled": "_chevron--disabled_fqmqk_415",
56
- chevronDisabled: pe
57
- }, be = ({
58
- id: t,
59
- label: l,
60
- options: a
61
- }) => {
62
- if (!t)
63
- throw new Error(
64
- q(
65
- "DSSelect",
66
- 'A unique "id" prop is required. Please add an unique "id" prop to the DSSelect component.'
67
- )
68
- );
69
- if (!l)
70
- throw new Error(
71
- q(
72
- "DSSelect",
73
- `A label is always required for a11y reasons. Please add a descriptive "label" prop to the DSSelect component. If you don't want to display a label, set hideLabel={true}.`
74
- )
75
- );
76
- if (!a || a.length === 0)
77
- throw new Error(
78
- q(
79
- "DSSelect",
80
- 'Options are always required. Please add an "options" prop to the DSSelect component.'
81
- )
82
- );
83
- }, ke = (t, l, a) => t === "" || l !== void 0 && l !== "" ? !1 : !(a !== void 0 && a !== ""), je = ({
84
- id: t,
85
- label: l,
86
- options: a,
87
- className: H,
88
- defaultValue: u,
89
- disabled: h = !1,
90
- hideLabel: w = !1,
91
- hint: f,
92
- invalid: r = !1,
93
- placeholder: d = "Select",
94
- required: p = !1,
95
- size: b = "medium",
96
- systemFeedback: m,
97
- value: k,
98
- ...D
99
- }) => {
100
- process.env.NODE_ENV !== "production" && be({
101
- id: t,
102
- label: l,
103
- options: a
104
- });
105
- const i = C(null), [I, y] = R(
106
- ke(d, u, k)
107
- );
108
- W(() => {
109
- if (!i.current)
110
- return;
111
- const c = () => {
112
- if (!i.current)
113
- return;
114
- const o = i.current.value;
115
- y(o === "");
116
- }, n = i.current;
117
- return n.addEventListener("change", c), () => {
118
- n.removeEventListener("change", c);
119
- };
120
- }, []);
121
- const j = F(w), v = `${t}-label`, x = `${t}-feedback`, S = `${t}-hint`, A = f ? ` ${S}` : "", B = (c) => [
122
- d && /* @__PURE__ */ s.jsx("option", { value: "", children: d }, `${t}-hidden-option-disabled-placeholder`),
123
- ...c.map((n) => {
124
- if ("options" in n) {
125
- const { label: o, options: $ } = n;
126
- return /* @__PURE__ */ s.jsx("optgroup", { label: o, children: $.map(g) }, o);
127
- } else
128
- return g(n);
129
- })
130
- ], g = ({ label: c, value: n, isDisabled: o }) => /* @__PURE__ */ s.jsx("option", { value: n, disabled: o, children: c }, n), N = _(e.root, H), P = _(e.select, {
131
- [e.selectSmall]: b === "small",
132
- [e.selectInvalid]: r,
133
- [e.selectPlaceholder]: I
134
- }), E = _(e.label, {
135
- // hide label only visually to keep them available for assistive technologies
136
- [e.labelHidden]: j
137
- }), L = _(e.chevron, {
138
- [e.chevronSmall]: b === "small",
139
- [e.chevronDisabled]: h
140
- });
141
- return /* @__PURE__ */ s.jsxs("div", { className: N, children: [
142
- /* @__PURE__ */ s.jsxs("label", { className: E, id: v, htmlFor: t, children: [
143
- l,
144
- p && /* @__PURE__ */ s.jsx(M, {})
145
- ] }),
146
- f && /* @__PURE__ */ s.jsx("div", { className: e.hint, id: S, children: f }),
147
- r && m && /* @__PURE__ */ s.jsx(
148
- V,
149
- {
150
- className: e.feedback,
151
- message: m,
152
- type: "invalid",
153
- id: x,
154
- "aria-live": "assertive"
155
- }
156
- ),
157
- /* @__PURE__ */ s.jsxs("div", { className: e.selectWrapper, children: [
158
- /* @__PURE__ */ s.jsx(
159
- "select",
160
- {
161
- ...D,
162
- id: t,
163
- ref: i,
164
- className: P,
165
- "aria-labelledby": `${v}${A}`,
166
- "aria-describedby": r && m ? x : void 0,
167
- "aria-invalid": r,
168
- defaultValue: u,
169
- value: k,
170
- disabled: h,
171
- required: p,
172
- children: B(a)
173
- }
174
- ),
175
- /* @__PURE__ */ s.jsx(
176
- O,
177
- {
178
- name: "chevron-down",
179
- className: L,
180
- "aria-hidden": "true"
181
- }
182
- )
183
- ] })
184
- ] });
185
- };
186
- export {
187
- je as DSSelect
188
- };