@stihl-design-system/components 1.0.0-RC.2 → 1.0.0-RC.3

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 (102) hide show
  1. package/README.md +1 -1
  2. package/assets/CustomReactSelect.BdwXfLLO.css +1 -0
  3. package/assets/RadioGroup.Ur8Ro-XL.css +1 -0
  4. package/assets/asterisk.C-o6rbGQ.css +1 -0
  5. package/assets/button.DJvR-58w.css +1 -0
  6. package/assets/buttonround.BlfQkmMV.css +1 -0
  7. package/assets/checkbox.BsFEWfQe.css +1 -0
  8. package/assets/fieldset.xazpUXJX.css +1 -0
  9. package/assets/heading.CGFucb-C.css +1 -0
  10. package/assets/input.BcP5kkZ2.css +1 -0
  11. package/assets/inputpassword.C3Uyj7oA.css +1 -0
  12. package/assets/inputsearch.tL3e9-Ob.css +1 -0
  13. package/assets/inputstepper.paPJix5A.css +1 -0
  14. package/assets/link.V7pJOW1p.css +1 -0
  15. package/assets/linkstandalone.D3RbBp23.css +1 -0
  16. package/assets/radio.CSHQGdpr.css +1 -0
  17. package/assets/select.D2qBxaHP.css +1 -0
  18. package/assets/switch.sqve8ApJ.css +1 -0
  19. package/assets/textarea.BKbocznb.css +1 -0
  20. package/assets/title.CE0Dm7PI.css +1 -0
  21. package/asterisk.DU8THnoC.js +8 -0
  22. package/button.BUUGRxIp.js +135 -0
  23. package/buttonround.CKc-a-hd.js +118 -0
  24. package/{checkbox.Bx5D_GAe.js → checkbox.C2Ga9yTK.js} +28 -28
  25. package/{checkboxgroup.gQwSHy4i.js → checkboxgroup.Cfxz9bk6.js} +3 -3
  26. package/chunks/{CustomReactSelect.Pvkkof1f.js → CustomReactSelect.uzWNynay.js} +222 -222
  27. package/chunks/RadioGroup.module.bi3leRes.js +11 -0
  28. package/chunks/whatsapp.CPpu-7Nn.js +10 -0
  29. package/{combobox.BOJ7aq_B.js → combobox.BXHAo4Wx.js} +1 -1
  30. package/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  31. package/components/Fieldset/Fieldset.d.ts +1 -1
  32. package/components/Heading/Heading.utils.d.ts +1 -1
  33. package/components/Logo/Logo.d.ts +4 -2
  34. package/components/Logo/Logo.utils.d.ts +1 -0
  35. package/components/RadioGroup/RadioGroup.d.ts +1 -1
  36. package/customreactselect.CipgVXTR.js +13 -0
  37. package/fieldset.DGcIKzDI.js +98 -0
  38. package/{floatingactionbutton.BtQVIj6W.js → floatingactionbutton.DzHD39NY.js} +2 -2
  39. package/heading.DqGbFfj2.js +50 -0
  40. package/{icon.CmAhxgHK.js → icon.PX9_1kNB.js} +1 -1
  41. package/index.es.js +22 -22
  42. package/input.o8OT6rxJ.js +236 -0
  43. package/inputpassword.-MXq8baU.js +139 -0
  44. package/inputsearch.CoYTSjox.js +188 -0
  45. package/inputstepper.BBMQr6kM.js +290 -0
  46. package/link.BN6AZfhG.js +115 -0
  47. package/linkstandalone.4-fyRd08.js +79 -0
  48. package/{logo.DXWgPUY4.js → logo.C_oJ8isW.js} +25 -24
  49. package/{optioncheckbox.CYikfEsE.js → optioncheckbox.-DRnW_ch.js} +1 -1
  50. package/package.json +2 -2
  51. package/radio.Bhu9OUY-.js +79 -0
  52. package/{radiogroup.7ptQiohb.js → radiogroup.oILRMrX-.js} +3 -3
  53. package/select.OGcreXnT.js +190 -0
  54. package/{spinner.CSzQEBx2.js → spinner.Diy_EeFY.js} +1 -1
  55. package/styles/scss/lib/_grid-extended.scss +2 -2
  56. package/styles/scss/lib/_grid-sidebar-sidebar.scss +2 -2
  57. package/styles/scss/lib/_grid-sidebar.scss +6 -6
  58. package/styles/scss/lib/_heading.scss +14 -1
  59. package/styles/scss/lib/_link.scss +9 -9
  60. package/styles/scss/lib/_text.scss +4 -0
  61. package/switch.BjoFKMQC.js +65 -0
  62. package/{systemfeedback.rBgdiL5T.js → systemfeedback.C7iXO5A1.js} +1 -1
  63. package/textarea.kc_Sfbgr.js +193 -0
  64. package/title.icX0VDiO.js +36 -0
  65. package/types/icon-types.d.ts +1 -1
  66. package/assets/CustomReactSelect.bVnR5yBP.css +0 -1
  67. package/assets/RadioGroup.SF2fv4CL.css +0 -1
  68. package/assets/asterisk.Bz7RZnKb.css +0 -1
  69. package/assets/button.C6ZbQtZ-.css +0 -1
  70. package/assets/buttonround.CjJUeMND.css +0 -1
  71. package/assets/checkbox.Bbc6PYDK.css +0 -1
  72. package/assets/fieldset.DTFs_koU.css +0 -1
  73. package/assets/heading.5HpYs7wS.css +0 -1
  74. package/assets/input.GpXQJqEO.css +0 -1
  75. package/assets/inputpassword.B9J1hCcj.css +0 -1
  76. package/assets/inputsearch.BY0BGFPK.css +0 -1
  77. package/assets/inputstepper.B0oC1URa.css +0 -1
  78. package/assets/link.Di4qXro5.css +0 -1
  79. package/assets/linkstandalone.239FeO2E.css +0 -1
  80. package/assets/radio.pqc9u_wx.css +0 -1
  81. package/assets/select.DLOQ6wu0.css +0 -1
  82. package/assets/switch.DVlaePGM.css +0 -1
  83. package/assets/textarea.BNOpd7Nf.css +0 -1
  84. package/assets/title.1dq1eWy9.css +0 -1
  85. package/asterisk.BlYjsfkN.js +0 -8
  86. package/button.Di5XtChf.js +0 -135
  87. package/buttonround._w4KDbHE.js +0 -118
  88. package/chunks/RadioGroup.module.B35YQcsb.js +0 -11
  89. package/customreactselect.DPHXAssl.js +0 -13
  90. package/fieldset.yE6WV6Ls.js +0 -98
  91. package/heading.C6k7Gakb.js +0 -44
  92. package/input.vP5xcwzV.js +0 -236
  93. package/inputpassword.BiQ8ORmn.js +0 -139
  94. package/inputsearch.BA9N3RRc.js +0 -188
  95. package/inputstepper.Cyxeg2Cj.js +0 -290
  96. package/link.BoSdsZHj.js +0 -115
  97. package/linkstandalone.BoN7nARO.js +0 -79
  98. package/radio.DTO5-Yzf.js +0 -79
  99. package/select.Dx80W7cW.js +0 -190
  100. package/switch.BwGtQdnx.js +0 -65
  101. package/textarea.C8tp1ciU.js +0 -193
  102. package/title.BT-uIobN.js +0 -36
@@ -0,0 +1,236 @@
1
+ "use client";
2
+ import { j as i } from "./chunks/jsx-runtime.C-kxDJ4g.js";
3
+ import { c as l } from "./chunks/index.CvOaL64Y.js";
4
+ import { useState as m, useRef as k, useLayoutEffect as B, useEffect as as } from "react";
5
+ import { u as ts } from "./chunks/useBreakpoint.5xBNDiCf.js";
6
+ import { Asterisk as es } from "./asterisk.DU8THnoC.js";
7
+ import { DSButton as E } from "./button.BUUGRxIp.js";
8
+ import { DSIcon as ls } from "./icon.PX9_1kNB.js";
9
+ import { DSSystemFeedback as os } from "./systemfeedback.C7iXO5A1.js";
10
+ import { v as cs, a as ds, M as _s, b as us, s as fs, i as v, c as rs } from "./chunks/Input.utils.Bly6ZzLI.js";
11
+ import './assets/input.BcP5kkZ2.css';const ps = "_input_1swsi_187", ms = "_input--invalid_1swsi_297", hs = "_input--small_1swsi_304", bs = "_input--has-leading-icon_1swsi_350", ws = "_input--has-action-button_1swsi_353", xs = "_input--has-second-action-button_1swsi_356", gs = "_input--has-affix_1swsi_368", Is = "_input--is-ready_1swsi_380", Ss = "_root_1swsi_387", ys = "_hint_1swsi_395", Hs = "_label_1swsi_395", ks = "_wrapper_1swsi_399", vs = "_affix_1swsi_405", Cs = "_affix--small_1swsi_425", Rs = "_affix--disabled_1swsi_437", js = "_prefix_1swsi_440", Ls = "_affix--readonly_1swsi_443", As = "_suffix_1swsi_453", Ds = "_leading-icon_1swsi_460", Ns = "_leading-icon--small_1swsi_472", Bs = "_leading-icon--disabled_1swsi_475", Es = "_action-button_1swsi_484", Ts = "_label--hidden_1swsi_501", Fs = "_feedback_1swsi_528", s = {
12
+ input: ps,
13
+ "input--invalid": "_input--invalid_1swsi_297",
14
+ inputInvalid: ms,
15
+ "input--small": "_input--small_1swsi_304",
16
+ inputSmall: hs,
17
+ "input--has-leading-icon": "_input--has-leading-icon_1swsi_350",
18
+ inputHasLeadingIcon: bs,
19
+ "input--has-action-button": "_input--has-action-button_1swsi_353",
20
+ inputHasActionButton: ws,
21
+ "input--has-second-action-button": "_input--has-second-action-button_1swsi_356",
22
+ inputHasSecondActionButton: xs,
23
+ "input--has-affix": "_input--has-affix_1swsi_368",
24
+ inputHasAffix: gs,
25
+ "input--is-ready": "_input--is-ready_1swsi_380",
26
+ inputIsReady: Is,
27
+ root: Ss,
28
+ hint: ys,
29
+ label: Hs,
30
+ wrapper: ks,
31
+ affix: vs,
32
+ "affix--small": "_affix--small_1swsi_425",
33
+ affixSmall: Cs,
34
+ "affix--disabled": "_affix--disabled_1swsi_437",
35
+ affixDisabled: Rs,
36
+ prefix: js,
37
+ "affix--readonly": "_affix--readonly_1swsi_443",
38
+ affixReadonly: Ls,
39
+ suffix: As,
40
+ "leading-icon": "_leading-icon_1swsi_460",
41
+ leadingIcon: Ds,
42
+ "leading-icon--small": "_leading-icon--small_1swsi_472",
43
+ leadingIconSmall: Ns,
44
+ "leading-icon--disabled": "_leading-icon--disabled_1swsi_475",
45
+ leadingIconDisabled: Bs,
46
+ "action-button": "_action-button_1swsi_484",
47
+ actionButton: Es,
48
+ "label--hidden": "_label--hidden_1swsi_501",
49
+ labelHidden: Ts,
50
+ feedback: Fs
51
+ }, Js = ({
52
+ id: d,
53
+ label: C,
54
+ actionButtonLabel: T,
55
+ actionButtonIconName: u,
56
+ actionButtonIconSource: h,
57
+ actionButtonOnClick: F,
58
+ className: P,
59
+ disabled: a = !1,
60
+ hint: b,
61
+ hideLabel: O = !1,
62
+ invalid: f = !1,
63
+ leadingIconName: r,
64
+ leadingIconSource: p,
65
+ prefix: t,
66
+ readonly: _ = !1,
67
+ required: R = !1,
68
+ size: e = "medium",
69
+ suffix: n,
70
+ systemFeedback: w,
71
+ type: o = "text",
72
+ ...$
73
+ }) => {
74
+ process.env.NODE_ENV !== "production" && (cs({
75
+ id: d,
76
+ label: C,
77
+ prefix: t,
78
+ suffix: n,
79
+ leadingIconName: r,
80
+ leadingIconSource: p,
81
+ actionButtonIconName: u,
82
+ actionButtonIconSource: h
83
+ }), ds(o));
84
+ const [W, X] = m(!1), [M, V] = m(!1), [x, G] = m(!1), [U, J] = m({}), g = k(null), K = t == null ? void 0 : t.substring(0, _s), I = k(null), Q = n == null ? void 0 : n.substring(0, us), S = k(null), Y = ts(O);
85
+ B(() => {
86
+ const c = e === "medium" ? 16 : 8, y = {};
87
+ if (I.current) {
88
+ const H = I.current.offsetWidth;
89
+ y.paddingInlineStart = c + H + "px";
90
+ }
91
+ if (S.current) {
92
+ const H = S.current.offsetWidth;
93
+ y.paddingInlineEnd = c + H + "px";
94
+ }
95
+ J(y), X(!0);
96
+ }, [t, n, e, M]), B(() => {
97
+ (async () => {
98
+ "fonts" in document && (await document.fonts.load(
99
+ '1em "STIHL Contraface Digital Text Regular"'
100
+ ), V(!0));
101
+ })();
102
+ }, []), as(() => {
103
+ const c = fs(
104
+ v(o),
105
+ rs(o)
106
+ );
107
+ G(c);
108
+ }, [o]);
109
+ const j = l(s.affix, {
110
+ [s.affixSmall]: e === "small",
111
+ [s.affixDisabled]: a,
112
+ [s.affixReadonly]: _
113
+ }), L = `${d}-label`, A = `${d}-feedback`, D = `${d}-hint`, Z = b ? ` ${D}` : "", q = l(s.root, P), z = l(s.input, {
114
+ // small input
115
+ [s.inputSmall]: e === "small",
116
+ // invalid state
117
+ [s.inputInvalid]: f,
118
+ // leading icon
119
+ [s.inputHasLeadingIcon]: r || p,
120
+ // prefix/suffix
121
+ [s.inputHasAffix]: t || n,
122
+ // action button
123
+ [s.inputHasActionButton]: u || h || x,
124
+ [s.inputIsReady]: W
125
+ }), ss = l(s.label, {
126
+ // hide label only visually to keep them available for assistive technologies
127
+ [s.labelHidden]: Y
128
+ }), is = l(s.leadingIcon, {
129
+ [s.leadingIconSmall]: e === "small",
130
+ [s.leadingIconDisabled]: a
131
+ }), N = l(s.actionButton, {
132
+ [s.actionButtonSmall]: e === "small"
133
+ }), ns = (c) => {
134
+ g.current && !a && !_ && g.current.showPicker(), c.preventDefault();
135
+ };
136
+ return /* @__PURE__ */ i.jsxs("div", { className: q, children: [
137
+ /* @__PURE__ */ i.jsxs("label", { className: ss, id: L, htmlFor: d, children: [
138
+ C,
139
+ R && /* @__PURE__ */ i.jsx(es, {})
140
+ ] }),
141
+ b && /* @__PURE__ */ i.jsx("div", { className: s.hint, id: D, children: b }),
142
+ f && w && /* @__PURE__ */ i.jsx(
143
+ os,
144
+ {
145
+ className: s.feedback,
146
+ message: w,
147
+ type: "invalid",
148
+ id: A
149
+ }
150
+ ),
151
+ /* @__PURE__ */ i.jsxs("div", { className: s.wrapper, children: [
152
+ t && /* @__PURE__ */ i.jsx(
153
+ "span",
154
+ {
155
+ className: l(j, s.prefix),
156
+ ref: I,
157
+ "aria-disabled": a,
158
+ children: K
159
+ }
160
+ ),
161
+ !t && (r || p) && /* @__PURE__ */ i.jsx(
162
+ ls,
163
+ {
164
+ name: r,
165
+ theme: "light",
166
+ source: p,
167
+ className: is,
168
+ "aria-hidden": "true"
169
+ }
170
+ ),
171
+ /* @__PURE__ */ i.jsx(
172
+ "input",
173
+ {
174
+ type: o,
175
+ className: z,
176
+ id: d,
177
+ ref: g,
178
+ ...$,
179
+ style: U,
180
+ "aria-labelledby": `${L}${Z}`,
181
+ "aria-describedby": f && w ? A : void 0,
182
+ "aria-invalid": f,
183
+ "aria-disabled": _,
184
+ readOnly: _,
185
+ required: R,
186
+ disabled: a
187
+ }
188
+ ),
189
+ n && /* @__PURE__ */ i.jsx(
190
+ "span",
191
+ {
192
+ className: l(j, s.suffix),
193
+ ref: S,
194
+ "aria-disabled": a,
195
+ children: Q
196
+ }
197
+ ),
198
+ !n && !x && (u || h) && /* @__PURE__ */ i.jsx(
199
+ E,
200
+ {
201
+ hideLabel: !0,
202
+ theme: "light",
203
+ iconName: u,
204
+ variant: "ghost",
205
+ className: N,
206
+ size: e,
207
+ onClick: F,
208
+ type: "button",
209
+ disabled: a || _,
210
+ children: T
211
+ }
212
+ ),
213
+ !n && x && !_ && !a && /* @__PURE__ */ i.jsxs(
214
+ E,
215
+ {
216
+ hideLabel: !0,
217
+ theme: "light",
218
+ iconName: v(o) ? "calendar" : "clock",
219
+ variant: "ghost",
220
+ className: N,
221
+ size: e,
222
+ onClick: ns,
223
+ type: "button",
224
+ children: [
225
+ "Open ",
226
+ v(o) ? "date" : "time",
227
+ " picker"
228
+ ]
229
+ }
230
+ )
231
+ ] })
232
+ ] });
233
+ };
234
+ export {
235
+ Js as DSInput
236
+ };
@@ -0,0 +1,139 @@
1
+ "use client";
2
+ import { j as a } from "./chunks/jsx-runtime.C-kxDJ4g.js";
3
+ import { c as i } from "./chunks/index.CvOaL64Y.js";
4
+ import { useState as A } from "react";
5
+ import { u as D } from "./chunks/useBreakpoint.5xBNDiCf.js";
6
+ import { Asterisk as C } from "./asterisk.DU8THnoC.js";
7
+ import { DSButton as L } from "./button.BUUGRxIp.js";
8
+ import { DSSystemFeedback as $ } from "./systemfeedback.C7iXO5A1.js";
9
+ import { g as b } from "./chunks/helpers.B1JT5ShS.js";
10
+ import './assets/inputpassword.C3Uyj7oA.css';const E = "_input_8z84y_187", q = "_input--invalid_8z84y_297", R = "_input--small_8z84y_304", V = "_input--has-leading-icon_8z84y_350", O = "_input--has-action-button_8z84y_353", F = "_input--has-second-action-button_8z84y_356", M = "_input--has-affix_8z84y_368", T = "_input--is-ready_8z84y_380", G = "_root_8z84y_387", J = "_hint_8z84y_395", K = "_label_8z84y_395", Q = "_wrapper_8z84y_399", U = "_action-button_8z84y_405", W = "_label--hidden_8z84y_422", X = "_feedback_8z84y_449", t = {
11
+ input: E,
12
+ "input--invalid": "_input--invalid_8z84y_297",
13
+ inputInvalid: q,
14
+ "input--small": "_input--small_8z84y_304",
15
+ inputSmall: R,
16
+ "input--has-leading-icon": "_input--has-leading-icon_8z84y_350",
17
+ inputHasLeadingIcon: V,
18
+ "input--has-action-button": "_input--has-action-button_8z84y_353",
19
+ inputHasActionButton: O,
20
+ "input--has-second-action-button": "_input--has-second-action-button_8z84y_356",
21
+ inputHasSecondActionButton: F,
22
+ "input--has-affix": "_input--has-affix_8z84y_368",
23
+ inputHasAffix: M,
24
+ "input--is-ready": "_input--is-ready_8z84y_380",
25
+ inputIsReady: T,
26
+ root: G,
27
+ hint: J,
28
+ label: K,
29
+ wrapper: Q,
30
+ "action-button": "_action-button_8z84y_405",
31
+ actionButton: U,
32
+ "label--hidden": "_label--hidden_8z84y_422",
33
+ labelHidden: W,
34
+ feedback: X
35
+ }, Y = ({ id: n, label: s }) => {
36
+ if (!n)
37
+ throw new Error(
38
+ b(
39
+ "DSInputPassword",
40
+ 'A unique "id" prop is required. Please add an unique "id" prop to the DSInputPassword component.'
41
+ )
42
+ );
43
+ if (!s)
44
+ throw new Error(
45
+ b(
46
+ "DSInputPassword",
47
+ `A label is always required for a11y reasons. Please add a descriptive "label" prop to the DSInputPassword component. If you don't want to display a label, set hideLabel={true}.`
48
+ )
49
+ );
50
+ }, lt = ({
51
+ id: n,
52
+ label: s,
53
+ autocomplete: h = "new-password",
54
+ className: f,
55
+ disabled: c = !1,
56
+ hidePasswordText: w = "Hide password",
57
+ hint: e,
58
+ hideLabel: z = !1,
59
+ invalid: o = !1,
60
+ readonly: r = !1,
61
+ required: d = !1,
62
+ showPasswordText: S = "Show password",
63
+ size: l = "medium",
64
+ systemFeedback: u,
65
+ ...x
66
+ }) => {
67
+ process.env.NODE_ENV !== "production" && Y({
68
+ id: n,
69
+ label: s
70
+ });
71
+ const [p, I] = A(!1), _ = `${n}-label`, m = `${n}-feedback`, y = `${n}-hint`, B = e ? ` ${y}` : "", H = D(z), g = i(t.root, f), v = i(t.input, {
72
+ // small input
73
+ [t.inputSmall]: l === "small",
74
+ // invalid state
75
+ [t.inputInvalid]: o,
76
+ // action button - input password always has an action button
77
+ [t.inputHasActionButton]: !0
78
+ }), P = i(t.label, {
79
+ // hide label only visually to keep them available for assistive technologies
80
+ [t.labelHidden]: H
81
+ }), N = i(t.actionButton, {
82
+ [t.actionButtonSmall]: l === "small"
83
+ }), j = () => {
84
+ I((k) => !k);
85
+ };
86
+ return /* @__PURE__ */ a.jsxs("div", { className: g, children: [
87
+ /* @__PURE__ */ a.jsxs("label", { className: P, id: _, htmlFor: n, children: [
88
+ s,
89
+ d && /* @__PURE__ */ a.jsx(C, {})
90
+ ] }),
91
+ e && /* @__PURE__ */ a.jsx("div", { className: t.hint, id: y, children: e }),
92
+ o && u && /* @__PURE__ */ a.jsx(
93
+ $,
94
+ {
95
+ className: t.feedback,
96
+ message: u,
97
+ type: "invalid",
98
+ id: m
99
+ }
100
+ ),
101
+ /* @__PURE__ */ a.jsxs("div", { className: t.wrapper, children: [
102
+ /* @__PURE__ */ a.jsx(
103
+ "input",
104
+ {
105
+ className: v,
106
+ id: n,
107
+ ...x,
108
+ "aria-labelledby": `${_}${B}`,
109
+ "aria-describedby": o && u ? m : void 0,
110
+ "aria-invalid": o,
111
+ "aria-disabled": r,
112
+ readOnly: r,
113
+ required: d,
114
+ disabled: c,
115
+ autoComplete: h,
116
+ type: p ? "text" : "password"
117
+ }
118
+ ),
119
+ /* @__PURE__ */ a.jsx(
120
+ L,
121
+ {
122
+ hideLabel: !0,
123
+ theme: "light",
124
+ iconName: p ? "eye-closed" : "eye",
125
+ variant: "ghost",
126
+ className: N,
127
+ size: l,
128
+ onClick: j,
129
+ type: "button",
130
+ disabled: c,
131
+ children: p ? w : S
132
+ }
133
+ )
134
+ ] })
135
+ ] });
136
+ };
137
+ export {
138
+ lt as DSInputPassword
139
+ };
@@ -0,0 +1,188 @@
1
+ "use client";
2
+ import { j as e } from "./chunks/jsx-runtime.C-kxDJ4g.js";
3
+ import { c } from "./chunks/index.CvOaL64Y.js";
4
+ import { useState as J, useRef as w, useEffect as A } from "react";
5
+ import { g as y, a as K } from "./chunks/helpers.B1JT5ShS.js";
6
+ import { u as Q } from "./chunks/useBreakpoint.5xBNDiCf.js";
7
+ import { Asterisk as U } from "./asterisk.DU8THnoC.js";
8
+ import { DSButton as D } from "./button.BUUGRxIp.js";
9
+ import { DSSystemFeedback as X } from "./systemfeedback.C7iXO5A1.js";
10
+ import './assets/inputsearch.tL3e9-Ob.css';const Y = "_input_17rym_187", Z = "_input--invalid_17rym_297", z = "_input--small_17rym_304", tt = "_input--has-leading-icon_17rym_350", nt = "_input--has-action-button_17rym_353", et = "_input--has-second-action-button_17rym_356", at = "_input--has-affix_17rym_368", st = "_input--is-ready_17rym_380", ot = "_root_17rym_387", it = "_hint_17rym_395", ct = "_label_17rym_395", rt = "_wrapper_17rym_399", ut = "_action-button_17rym_405", lt = "_second-action-button_17rym_409", pt = "_label--hidden_17rym_426", mt = "_feedback_17rym_453", t = {
11
+ input: Y,
12
+ "input--invalid": "_input--invalid_17rym_297",
13
+ inputInvalid: Z,
14
+ "input--small": "_input--small_17rym_304",
15
+ inputSmall: z,
16
+ "input--has-leading-icon": "_input--has-leading-icon_17rym_350",
17
+ inputHasLeadingIcon: tt,
18
+ "input--has-action-button": "_input--has-action-button_17rym_353",
19
+ inputHasActionButton: nt,
20
+ "input--has-second-action-button": "_input--has-second-action-button_17rym_356",
21
+ inputHasSecondActionButton: et,
22
+ "input--has-affix": "_input--has-affix_17rym_368",
23
+ inputHasAffix: at,
24
+ "input--is-ready": "_input--is-ready_17rym_380",
25
+ inputIsReady: st,
26
+ root: ot,
27
+ hint: it,
28
+ label: ct,
29
+ wrapper: rt,
30
+ "action-button": "_action-button_17rym_405",
31
+ actionButton: ut,
32
+ "second-action-button": "_second-action-button_17rym_409",
33
+ secondActionButton: lt,
34
+ "label--hidden": "_label--hidden_17rym_426",
35
+ labelHidden: pt,
36
+ feedback: mt
37
+ }, _t = ({ id: n, label: r }) => {
38
+ if (!n)
39
+ throw new Error(
40
+ y(
41
+ "DSInputSearch",
42
+ 'A unique "id" prop is required. Please add an unique "id" prop to the DSInputSearch component.'
43
+ )
44
+ );
45
+ if (!r)
46
+ throw new Error(
47
+ y(
48
+ "DSInputSearch",
49
+ `A label is always required for a11y reasons. Please add a descriptive "label" prop to the DSInputSearch component. If you don't want to display a label, set hideLabel={true}.`
50
+ )
51
+ );
52
+ }, dt = (n) => !!K(n, "form"), Bt = ({
53
+ id: n,
54
+ label: r,
55
+ className: H,
56
+ clearButtonLabel: E = "Clear search field",
57
+ disabled: u = !1,
58
+ hint: d,
59
+ hideLabel: j = !1,
60
+ invalid: l = !1,
61
+ readonly: s = !1,
62
+ required: S = !1,
63
+ size: o = "medium",
64
+ submitButtonLabel: C = "Search",
65
+ systemFeedback: h,
66
+ value: b,
67
+ submitButtonOnClick: k,
68
+ onChange: I,
69
+ ...L
70
+ }) => {
71
+ process.env.NODE_ENV !== "production" && _t({
72
+ id: n,
73
+ label: r
74
+ });
75
+ const [p, g] = J(b), f = w(null), m = w(null), V = Q(j);
76
+ A(() => {
77
+ g(b);
78
+ }, [b]), A(() => {
79
+ f.current && !dt(f.current) && process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && console.warn(
80
+ y(
81
+ "DSInputSearch",
82
+ `The DSInputSearch component with the id "${n}" is not within a form element. This may cause issues with form submission. Please ensure the DSInputSearch component is within a form element.`
83
+ )
84
+ );
85
+ }, []);
86
+ const v = `${n}-label`, B = `${n}-feedback`, x = `${n}-hint`, O = d ? ` ${x}` : "", N = p !== "" && p !== void 0 && p !== null, P = c(t.root, H), $ = c(t.input, {
87
+ // small input
88
+ [t.inputSmall]: o === "small",
89
+ // invalid state
90
+ [t.inputInvalid]: l,
91
+ // action button - input password always has an action button
92
+ [t.inputHasActionButton]: !0,
93
+ // action second action button
94
+ [t.inputHasSecondActionButton]: N && !s && !u
95
+ }), R = c(t.label, {
96
+ // hide label only visually to keep them available for assistive technologies
97
+ [t.labelHidden]: V
98
+ }), q = c(t.actionButton, {
99
+ [t.actionButtonSmall]: o === "small"
100
+ }), T = c(t.secondActionButton, {
101
+ [t.secondActionButtonSmall]: o === "small"
102
+ }), F = (a, i) => {
103
+ const G = Object.getPrototypeOf(a), _ = Object.getOwnPropertyDescriptor(
104
+ G,
105
+ "value"
106
+ );
107
+ _ != null && _.set ? _.set.call(a, i) : a.value = i;
108
+ }, M = () => {
109
+ var i;
110
+ if (!m.current)
111
+ return;
112
+ F(m.current, "");
113
+ const a = new Event("change", { bubbles: !0 });
114
+ (i = m.current) == null || i.dispatchEvent(a);
115
+ }, W = (a) => {
116
+ g(a.target.value), I && I(a);
117
+ };
118
+ return /* @__PURE__ */ e.jsxs("div", { className: P, ref: f, children: [
119
+ /* @__PURE__ */ e.jsxs("label", { className: R, id: v, htmlFor: n, children: [
120
+ r,
121
+ S && /* @__PURE__ */ e.jsx(U, {})
122
+ ] }),
123
+ d && /* @__PURE__ */ e.jsx("div", { className: t.hint, id: x, children: d }),
124
+ l && h && /* @__PURE__ */ e.jsx(
125
+ X,
126
+ {
127
+ className: t.feedback,
128
+ message: h,
129
+ type: "invalid",
130
+ id: B
131
+ }
132
+ ),
133
+ /* @__PURE__ */ e.jsxs("div", { className: t.wrapper, children: [
134
+ /* @__PURE__ */ e.jsx(
135
+ "input",
136
+ {
137
+ className: $,
138
+ id: n,
139
+ ref: m,
140
+ ...L,
141
+ "aria-labelledby": `${v}${O}`,
142
+ "aria-describedby": l && h ? B : void 0,
143
+ "aria-invalid": l,
144
+ "aria-disabled": s,
145
+ readOnly: s,
146
+ required: S,
147
+ disabled: u,
148
+ type: "search",
149
+ value: p,
150
+ onChange: W
151
+ }
152
+ ),
153
+ N && !s && !u && /* @__PURE__ */ e.jsx(
154
+ D,
155
+ {
156
+ hideLabel: !0,
157
+ theme: "light",
158
+ iconName: "cross",
159
+ className: T,
160
+ variant: "ghost",
161
+ size: o,
162
+ onClick: M,
163
+ type: "button",
164
+ tabIndex: -1,
165
+ children: E
166
+ }
167
+ ),
168
+ /* @__PURE__ */ e.jsx(
169
+ D,
170
+ {
171
+ hideLabel: !0,
172
+ theme: "light",
173
+ iconName: "magnifying-glass",
174
+ className: q,
175
+ variant: "ghost",
176
+ size: o,
177
+ onClick: k,
178
+ type: "submit",
179
+ disabled: u || s,
180
+ children: C
181
+ }
182
+ )
183
+ ] })
184
+ ] });
185
+ };
186
+ export {
187
+ Bt as DSInputSearch
188
+ };