@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
package/input.abb902e3.js DELETED
@@ -1,228 +0,0 @@
1
- import "./assets/Input.2c508b2f.css";
2
- import { j as n } from "./chunks/jsx-runtime.5c071667.js";
3
- import { c as e } from "./chunks/index.8021d3e0.js";
4
- import { useState as m, useRef as k, useLayoutEffect as w, useEffect as st } from "react";
5
- import { u as it } from "./chunks/useBreakpoint.6c1b06c2.js";
6
- import { Asterisk as et } from "./asterisk.91abccec.js";
7
- import { DSButton as D } from "./button.89b2675b.js";
8
- import { DSIcon as lt } from "./icon.b4211784.js";
9
- import { DSSystemFeedback as ot } from "./systemfeedback.6bbd1505.js";
10
- import { v as ut, a as ct, M as dt, b as _t, s as rt, i as v, c as pt } from "./chunks/Input.utils.f8f3286f.js";
11
- const ft = "_input_qu78q_73", mt = "_input--invalid_qu78q_183", qt = "_input--small_qu78q_190", ht = "_input--has-leading-icon_qu78q_236", bt = "_input--has-action-button_qu78q_239", xt = "_input--has-second-action-button_qu78q_242", gt = "_input--has-affix_qu78q_254", St = "_input--is-ready_qu78q_266", It = "_root_qu78q_273", Ht = "_hint_qu78q_281", yt = "_label_qu78q_281", kt = "_wrapper_qu78q_285", vt = "_affix_qu78q_291", Ct = "_affix--small_qu78q_309", Lt = "_affix--disabled_qu78q_321", jt = "_prefix_qu78q_325", At = "_suffix_qu78q_331", Rt = "_leading-icon_qu78q_336", Nt = "_leading-icon--small_qu78q_341", Bt = "_action-button_qu78q_345", wt = "_label--hidden_qu78q_362", Dt = "_feedback_qu78q_389", t = {
12
- input: ft,
13
- "input--invalid": "_input--invalid_qu78q_183",
14
- inputInvalid: mt,
15
- "input--small": "_input--small_qu78q_190",
16
- inputSmall: qt,
17
- "input--has-leading-icon": "_input--has-leading-icon_qu78q_236",
18
- inputHasLeadingIcon: ht,
19
- "input--has-action-button": "_input--has-action-button_qu78q_239",
20
- inputHasActionButton: bt,
21
- "input--has-second-action-button": "_input--has-second-action-button_qu78q_242",
22
- inputHasSecondActionButton: xt,
23
- "input--has-affix": "_input--has-affix_qu78q_254",
24
- inputHasAffix: gt,
25
- "input--is-ready": "_input--is-ready_qu78q_266",
26
- inputIsReady: St,
27
- root: It,
28
- hint: Ht,
29
- label: yt,
30
- wrapper: kt,
31
- affix: vt,
32
- "affix--small": "_affix--small_qu78q_309",
33
- affixSmall: Ct,
34
- "affix--disabled": "_affix--disabled_qu78q_321",
35
- affixDisabled: Lt,
36
- prefix: jt,
37
- suffix: At,
38
- "leading-icon": "_leading-icon_qu78q_336",
39
- leadingIcon: Rt,
40
- "leading-icon--small": "_leading-icon--small_qu78q_341",
41
- leadingIconSmall: Nt,
42
- "action-button": "_action-button_qu78q_345",
43
- actionButton: Bt,
44
- "label--hidden": "_label--hidden_qu78q_362",
45
- labelHidden: wt,
46
- feedback: Dt
47
- }, Gt = ({
48
- id: c,
49
- label: C,
50
- actionButtonLabel: T,
51
- actionButtonIconName: _,
52
- actionButtonIconSource: q,
53
- actionButtonOnClick: E,
54
- className: F,
55
- disabled: l = !1,
56
- hint: h,
57
- hideLabel: P = !1,
58
- invalid: r = !1,
59
- leadingIconName: p,
60
- leadingIconSource: f,
61
- prefix: s,
62
- readonly: d = !1,
63
- required: L = !1,
64
- size: i = "medium",
65
- suffix: a,
66
- systemFeedback: b,
67
- type: o = "text",
68
- ...O
69
- }) => {
70
- process.env.NODE_ENV !== "production" && (ut({
71
- id: c,
72
- label: C,
73
- prefix: s,
74
- suffix: a,
75
- leadingIconName: p,
76
- leadingIconSource: f,
77
- actionButtonIconName: _,
78
- actionButtonIconSource: q
79
- }), ct(o));
80
- const [$, W] = m(!1), [X, M] = m(!1), [x, V] = m(!1), [G, U] = m({}), g = k(null), J = s == null ? void 0 : s.substring(0, dt), S = k(null), K = a == null ? void 0 : a.substring(0, _t), I = k(null), Q = it(P);
81
- w(() => {
82
- const u = i === "medium" ? 16 : 8, H = {};
83
- if (S.current) {
84
- const y = S.current.offsetWidth;
85
- H.paddingLeft = u + y + "px";
86
- }
87
- if (I.current) {
88
- const y = I.current.offsetWidth;
89
- H.paddingRight = u + y + "px";
90
- }
91
- U(H), W(!0);
92
- }, [s, a, i, X]), w(() => {
93
- (async () => {
94
- "fonts" in document && (await document.fonts.load('1em "STIHL Contraface Text Regular"'), M(!0));
95
- })();
96
- }, []), st(() => {
97
- const u = rt(
98
- v(o),
99
- pt(o)
100
- );
101
- V(u);
102
- }, [o]);
103
- const j = e(t.affix, {
104
- [t.affixSmall]: i === "small",
105
- [t.affixDisabled]: l
106
- }), A = `${c}-label`, R = `${c}-feedback`, N = `${c}-hint`, Y = h ? ` ${N}` : "", Z = e(t.root, F), z = e(t.input, {
107
- // small input
108
- [t.inputSmall]: i === "small",
109
- // invalid state
110
- [t.inputInvalid]: r,
111
- // leading icon
112
- [t.inputHasLeadingIcon]: p || f,
113
- // prefix/suffix
114
- [t.inputHasAffix]: s || a,
115
- // action button
116
- [t.inputHasActionButton]: _ || q || x,
117
- [t.inputIsReady]: $
118
- }), tt = e(t.label, {
119
- // hide label only visually to keep them available for assistive technologies
120
- [t.labelHidden]: Q
121
- }), nt = e(t.leadingIcon, {
122
- [t.leadingIconSmall]: i === "small"
123
- }), B = e(t.actionButton, {
124
- [t.actionButtonSmall]: i === "small"
125
- }), at = (u) => {
126
- g.current && !l && !d && g.current.showPicker(), u.preventDefault();
127
- };
128
- return /* @__PURE__ */ n.jsxs("div", { className: Z, children: [
129
- /* @__PURE__ */ n.jsxs("label", { className: tt, id: A, htmlFor: c, children: [
130
- C,
131
- L && /* @__PURE__ */ n.jsx(et, {})
132
- ] }),
133
- h && /* @__PURE__ */ n.jsx("div", { className: t.hint, id: N, children: h }),
134
- r && b && /* @__PURE__ */ n.jsx(
135
- ot,
136
- {
137
- className: t.feedback,
138
- message: b,
139
- type: "invalid",
140
- id: R
141
- }
142
- ),
143
- /* @__PURE__ */ n.jsxs("div", { className: t.wrapper, children: [
144
- s && /* @__PURE__ */ n.jsx(
145
- "span",
146
- {
147
- className: e(j, t.prefix),
148
- ref: S,
149
- "aria-disabled": l,
150
- children: J
151
- }
152
- ),
153
- !s && (p || f) && /* @__PURE__ */ n.jsx(
154
- lt,
155
- {
156
- name: p,
157
- theme: "light",
158
- source: f,
159
- className: nt,
160
- "aria-hidden": "true"
161
- }
162
- ),
163
- /* @__PURE__ */ n.jsx(
164
- "input",
165
- {
166
- type: o,
167
- className: z,
168
- id: c,
169
- ref: g,
170
- ...O,
171
- style: G,
172
- "aria-labelledby": `${A}${Y}`,
173
- "aria-describedby": r && b ? R : void 0,
174
- "aria-invalid": r,
175
- "aria-disabled": d,
176
- readOnly: d,
177
- required: L,
178
- disabled: l
179
- }
180
- ),
181
- a && /* @__PURE__ */ n.jsx(
182
- "span",
183
- {
184
- className: e(j, t.suffix),
185
- ref: I,
186
- "aria-disabled": l,
187
- children: K
188
- }
189
- ),
190
- !a && !x && (_ || q) && /* @__PURE__ */ n.jsx(
191
- D,
192
- {
193
- hideLabel: !0,
194
- theme: "light",
195
- iconName: _,
196
- variant: "ghost",
197
- className: B,
198
- size: i,
199
- onClick: E,
200
- type: "button",
201
- disabled: l || d,
202
- children: T
203
- }
204
- ),
205
- !a && x && !d && !l && /* @__PURE__ */ n.jsxs(
206
- D,
207
- {
208
- hideLabel: !0,
209
- theme: "light",
210
- iconName: v(o) ? "calendar" : "clock",
211
- variant: "ghost",
212
- className: B,
213
- size: i,
214
- onClick: at,
215
- type: "button",
216
- children: [
217
- "Open ",
218
- v(o) ? "date" : "time",
219
- " picker"
220
- ]
221
- }
222
- )
223
- ] })
224
- ] });
225
- };
226
- export {
227
- Gt as DSInput
228
- };
@@ -1,139 +0,0 @@
1
- import "./assets/InputPassword.a534f047.css";
2
- import { j as a } from "./chunks/jsx-runtime.5c071667.js";
3
- import { c as i } from "./chunks/index.8021d3e0.js";
4
- import { useState as A } from "react";
5
- import { u as D } from "./chunks/useBreakpoint.6c1b06c2.js";
6
- import { Asterisk as C } from "./asterisk.91abccec.js";
7
- import { DSButton as L } from "./button.89b2675b.js";
8
- import { DSSystemFeedback as $ } from "./systemfeedback.6bbd1505.js";
9
- import { g as b } from "./chunks/helpers.ea3ca41a.js";
10
- const E = "_input_2ztxt_73", q = "_input--invalid_2ztxt_183", R = "_input--small_2ztxt_190", V = "_input--has-leading-icon_2ztxt_236", O = "_input--has-action-button_2ztxt_239", F = "_input--has-second-action-button_2ztxt_242", M = "_input--has-affix_2ztxt_254", T = "_input--is-ready_2ztxt_266", G = "_root_2ztxt_273", J = "_hint_2ztxt_281", K = "_label_2ztxt_281", Q = "_wrapper_2ztxt_285", U = "_action-button_2ztxt_291", W = "_label--hidden_2ztxt_308", X = "_feedback_2ztxt_335", t = {
11
- input: E,
12
- "input--invalid": "_input--invalid_2ztxt_183",
13
- inputInvalid: q,
14
- "input--small": "_input--small_2ztxt_190",
15
- inputSmall: R,
16
- "input--has-leading-icon": "_input--has-leading-icon_2ztxt_236",
17
- inputHasLeadingIcon: V,
18
- "input--has-action-button": "_input--has-action-button_2ztxt_239",
19
- inputHasActionButton: O,
20
- "input--has-second-action-button": "_input--has-second-action-button_2ztxt_242",
21
- inputHasSecondActionButton: F,
22
- "input--has-affix": "_input--has-affix_2ztxt_254",
23
- inputHasAffix: M,
24
- "input--is-ready": "_input--is-ready_2ztxt_266",
25
- inputIsReady: T,
26
- root: G,
27
- hint: J,
28
- label: K,
29
- wrapper: Q,
30
- "action-button": "_action-button_2ztxt_291",
31
- actionButton: U,
32
- "label--hidden": "_label--hidden_2ztxt_308",
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
- }, pt = ({
51
- id: n,
52
- label: s,
53
- autocomplete: h = "new-password",
54
- className: f,
55
- disabled: r = !1,
56
- hidePasswordText: w = "Hide password",
57
- hint: e,
58
- hideLabel: z = !1,
59
- invalid: o = !1,
60
- readonly: c = !1,
61
- required: d = !1,
62
- showPasswordText: y = "Show password",
63
- size: l = "medium",
64
- systemFeedback: p,
65
- ...S
66
- }) => {
67
- process.env.NODE_ENV !== "production" && Y({
68
- id: n,
69
- label: s
70
- });
71
- const [u, I] = A(!1), _ = `${n}-label`, m = `${n}-feedback`, x = `${n}-hint`, B = e ? ` ${x}` : "", 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: x, children: e }),
92
- o && p && /* @__PURE__ */ a.jsx(
93
- $,
94
- {
95
- className: t.feedback,
96
- message: p,
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
- ...S,
108
- "aria-labelledby": `${_}${B}`,
109
- "aria-describedby": o && p ? m : void 0,
110
- "aria-invalid": o,
111
- "aria-disabled": c,
112
- readOnly: c,
113
- required: d,
114
- disabled: r,
115
- autoComplete: h,
116
- type: u ? "text" : "password"
117
- }
118
- ),
119
- /* @__PURE__ */ a.jsx(
120
- L,
121
- {
122
- hideLabel: !0,
123
- theme: "light",
124
- iconName: u ? "eye-closed" : "eye",
125
- variant: "ghost",
126
- className: N,
127
- size: l,
128
- onClick: j,
129
- type: "button",
130
- disabled: r,
131
- children: u ? w : y
132
- }
133
- )
134
- ] })
135
- ] });
136
- };
137
- export {
138
- pt as DSInputPassword
139
- };
@@ -1,188 +0,0 @@
1
- import "./assets/InputSearch.8f986307.css";
2
- import { j as a } from "./chunks/jsx-runtime.5c071667.js";
3
- import { c as l } from "./chunks/index.8021d3e0.js";
4
- import { useState as J, useRef as w, useEffect as A } from "react";
5
- import { g as S, a as K } from "./chunks/helpers.ea3ca41a.js";
6
- import { u as Q } from "./chunks/useBreakpoint.6c1b06c2.js";
7
- import { Asterisk as U } from "./asterisk.91abccec.js";
8
- import { DSButton as D } from "./button.89b2675b.js";
9
- import { DSSystemFeedback as X } from "./systemfeedback.6bbd1505.js";
10
- const Y = "_input_ps4al_73", Z = "_input--invalid_ps4al_183", z = "_input--small_ps4al_190", tt = "_input--has-leading-icon_ps4al_236", nt = "_input--has-action-button_ps4al_239", at = "_input--has-second-action-button_ps4al_242", et = "_input--has-affix_ps4al_254", st = "_input--is-ready_ps4al_266", ot = "_root_ps4al_273", it = "_hint_ps4al_281", lt = "_label_ps4al_281", ct = "_wrapper_ps4al_285", ut = "_action-button_ps4al_291", pt = "_second-action-button_ps4al_295", rt = "_label--hidden_ps4al_312", _t = "_feedback_ps4al_339", t = {
11
- input: Y,
12
- "input--invalid": "_input--invalid_ps4al_183",
13
- inputInvalid: Z,
14
- "input--small": "_input--small_ps4al_190",
15
- inputSmall: z,
16
- "input--has-leading-icon": "_input--has-leading-icon_ps4al_236",
17
- inputHasLeadingIcon: tt,
18
- "input--has-action-button": "_input--has-action-button_ps4al_239",
19
- inputHasActionButton: nt,
20
- "input--has-second-action-button": "_input--has-second-action-button_ps4al_242",
21
- inputHasSecondActionButton: at,
22
- "input--has-affix": "_input--has-affix_ps4al_254",
23
- inputHasAffix: et,
24
- "input--is-ready": "_input--is-ready_ps4al_266",
25
- inputIsReady: st,
26
- root: ot,
27
- hint: it,
28
- label: lt,
29
- wrapper: ct,
30
- "action-button": "_action-button_ps4al_291",
31
- actionButton: ut,
32
- "second-action-button": "_second-action-button_ps4al_295",
33
- secondActionButton: pt,
34
- "label--hidden": "_label--hidden_ps4al_312",
35
- labelHidden: rt,
36
- feedback: _t
37
- }, dt = ({ id: n, label: c }) => {
38
- if (!n)
39
- throw new Error(
40
- S(
41
- "DSInputSearch",
42
- 'A unique "id" prop is required. Please add an unique "id" prop to the DSInputSearch component.'
43
- )
44
- );
45
- if (!c)
46
- throw new Error(
47
- S(
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
- }, ht = (n) => !!K(n, "form"), xt = ({
53
- id: n,
54
- label: c,
55
- className: H,
56
- clearButtonLabel: E = "Clear search field",
57
- disabled: u = !1,
58
- hint: h,
59
- hideLabel: j = !1,
60
- invalid: p = !1,
61
- readonly: s = !1,
62
- required: I = !1,
63
- size: o = "medium",
64
- submitButtonLabel: C = "Search",
65
- systemFeedback: m,
66
- value: b,
67
- submitButtonOnClick: k,
68
- onChange: g,
69
- ...L
70
- }) => {
71
- process.env.NODE_ENV !== "production" && dt({
72
- id: n,
73
- label: c
74
- });
75
- const [r, v] = J(b), f = w(null), _ = w(null), V = Q(j);
76
- A(() => {
77
- v(b);
78
- }, [b]), A(() => {
79
- f.current && !ht(f.current) && process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && console.warn(
80
- S(
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 B = `${n}-label`, y = `${n}-feedback`, x = `${n}-hint`, O = h ? ` ${x}` : "", N = r !== "" && r !== void 0 && r !== null, P = l(t.root, H), $ = l(t.input, {
87
- // small input
88
- [t.inputSmall]: o === "small",
89
- // invalid state
90
- [t.inputInvalid]: p,
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 = l(t.label, {
96
- // hide label only visually to keep them available for assistive technologies
97
- [t.labelHidden]: V
98
- }), q = l(t.actionButton, {
99
- [t.actionButtonSmall]: o === "small"
100
- }), T = l(t.secondActionButton, {
101
- [t.secondActionButtonSmall]: o === "small"
102
- }), F = (e, i) => {
103
- const G = Object.getPrototypeOf(e), d = Object.getOwnPropertyDescriptor(
104
- G,
105
- "value"
106
- );
107
- d != null && d.set ? d.set.call(e, i) : e.value = i;
108
- }, M = () => {
109
- var i;
110
- if (!_.current)
111
- return;
112
- F(_.current, "");
113
- const e = new Event("change", { bubbles: !0 });
114
- (i = _.current) == null || i.dispatchEvent(e);
115
- }, W = (e) => {
116
- v(e.target.value), g && g(e);
117
- };
118
- return /* @__PURE__ */ a.jsxs("div", { className: P, ref: f, children: [
119
- /* @__PURE__ */ a.jsxs("label", { className: R, id: B, htmlFor: n, children: [
120
- c,
121
- I && /* @__PURE__ */ a.jsx(U, {})
122
- ] }),
123
- h && /* @__PURE__ */ a.jsx("div", { className: t.hint, id: x, children: h }),
124
- p && m && /* @__PURE__ */ a.jsx(
125
- X,
126
- {
127
- className: t.feedback,
128
- message: m,
129
- type: "invalid",
130
- id: y
131
- }
132
- ),
133
- /* @__PURE__ */ a.jsxs("div", { className: t.wrapper, children: [
134
- /* @__PURE__ */ a.jsx(
135
- "input",
136
- {
137
- className: $,
138
- id: n,
139
- ref: _,
140
- ...L,
141
- "aria-labelledby": `${B}${O}`,
142
- "aria-describedby": p && m ? y : void 0,
143
- "aria-invalid": p,
144
- "aria-disabled": s,
145
- readOnly: s,
146
- required: I,
147
- disabled: u,
148
- type: "search",
149
- value: r,
150
- onChange: W
151
- }
152
- ),
153
- N && !s && !u && /* @__PURE__ */ a.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__ */ a.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
- xt as DSInputSearch
188
- };