@stihl-design-system/components 1.0.0-RC.34 → 1.0.0-RC.36
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/Placeholder.svg +1 -1
- package/{actionbutton.DLQJU6AV.js → actionbutton.Du5CT-Mt.js} +2 -2
- package/{actionlink.DEBrWfN3.js → actionlink.BK9CaQUY.js} +2 -2
- package/assets/Button.CmeGVEAY.css +1 -0
- package/assets/CustomReactSelect.BihX36Uo.css +1 -0
- package/assets/Fieldset.Oqu7pOBv.css +1 -0
- package/assets/InputFile.D7Ihod7B.css +1 -0
- package/assets/InputNumber.z_UqRYdv.css +1 -0
- package/assets/InputPassword.DZENjxJ9.css +1 -0
- package/assets/InputSearch.GBH9Eh6F.css +1 -0
- package/assets/LinkButton.88j5ckLu.css +1 -0
- package/assets/RadioGroup.q1lQ-HIZ.css +1 -0
- package/assets/Select.CL0fqx7X.css +1 -0
- package/assets/Slider.DWLuIsNj.css +1 -0
- package/assets/Textarea.B1HOakic.css +1 -0
- package/assets/buttonround.DBpMesfr.css +1 -0
- package/assets/input.RPDR8qdT.css +1 -0
- package/assets/radio.CsfCywxz.css +1 -0
- package/{banner.CI5HnDqD.js → banner.AhUeW3HM.js} +1 -1
- package/{breadcrumb.CtwAux3P.js → breadcrumb.DpIAQk3r.js} +3 -3
- package/button.CqNYOfSj.js +12 -0
- package/buttonround.9IS0tUqw.js +96 -0
- package/{checkbox.DwccD0Mp.js → checkbox.XYQI-ubx.js} +2 -2
- package/{checkboxgroup.ZiUFfCJ1.js → checkboxgroup.C66ZwglF.js} +2 -2
- package/{chip.B0s_fS8L.js → chip.B-pxhsdb.js} +2 -2
- package/{chipgroup.Dpu66bo5.js → chipgroup.CY3pWyLO.js} +4 -3
- package/chunks/{ActionButton.DOYsEHPr.js → ActionButton.BOYQYo5M.js} +1 -1
- package/chunks/{ActionLink.DbyciN3Y.js → ActionLink.BlwvrnPN.js} +1 -1
- package/chunks/{Breadcrumb.BgnpTo01.js → Breadcrumb.C_Yaz_vw.js} +2 -2
- package/chunks/Button.CQlIao-Z.js +139 -0
- package/chunks/{Checkbox.BcGXAuuP.js → Checkbox.D5X5T6Yg.js} +1 -1
- package/chunks/CheckboxGroup.BIspWqeW.js +74 -0
- package/chunks/{Chip.D6pubCZV.js → Chip.DIp5hdRH.js} +1 -1
- package/chunks/{CustomReactSelect.Dg3wC_VH.js → CustomReactSelect.D4kopDzX.js} +816 -800
- package/chunks/{Dialog.DpqSVrYR.js → Dialog.DMxHRrxo.js} +1 -1
- package/chunks/{Drawer.DISWybOa.js → Drawer.CatmvDHJ.js} +1 -1
- package/chunks/Fieldset.Bk8W5h13.js +81 -0
- package/chunks/{Header.7TQL_J9t.js → Header.18sOO0Gf.js} +1 -1
- package/chunks/{Input.utils.Dkw7gRrr.js → Input.utils.CL1u4Ctq.js} +27 -25
- package/chunks/InputFile.CjK3gEst.js +236 -0
- package/chunks/InputNumber.wfDjnz58.js +242 -0
- package/chunks/InputPassword.Ctb0xbwg.js +121 -0
- package/chunks/InputSearch.C-r5ktR8.js +149 -0
- package/chunks/LinkButton.CWibqvhs.js +140 -0
- package/chunks/{MegaMenu.CQbOeaib.js → MegaMenu.qttkjGbD.js} +7 -8
- package/chunks/{NavigationTabs.BwM-6CRm.js → NavigationTabs.SBNLx87A.js} +1 -1
- package/chunks/{Notification.CrojkJ0E.js → Notification.DYl1rcGu.js} +1 -1
- package/chunks/{Popover.Bb0Pjmvg.js → Popover.C9tT8xkE.js} +9 -10
- package/chunks/RadioGroup.BDsVAhCK.js +125 -0
- package/chunks/Select.BjBPN-6W.js +147 -0
- package/chunks/Slider.Bh2jhGKn.js +306 -0
- package/chunks/{Stepper.PTQdQBYf.js → Stepper.D1Yzw-gL.js} +2 -2
- package/chunks/{Tabs.DyP4whX0.js → Tabs.BvG-OPWa.js} +1 -1
- package/chunks/Textarea.DibBqiam.js +181 -0
- package/chunks/{Toast.ug_RjGgF.js → Toast.ldZRNpGM.js} +1 -1
- package/chunks/floating-ui.react.COTL3jH5.js +2984 -0
- package/chunks/{useBreakpoint.BzR_yaIv.js → useBreakpoint.1txsny17.js} +8 -5
- package/combobox.C2XUM4fM.js +67 -0
- package/components/Button/Button.d.ts +5 -0
- package/components/Button/Button.utils.d.ts +4 -5
- package/components/CheckboxGroup/CheckboxGroup.d.ts +14 -1
- package/components/Combobox/Combobox.utils.d.ts +3 -2
- package/components/Combobox/CustomReactSelect/CustomReactSelect.d.ts +13 -0
- package/components/Fieldset/Fieldset.d.ts +14 -1
- package/components/Input/Input.d.ts +13 -0
- package/components/Input/Input.utils.d.ts +2 -2
- package/components/InputFile/InputFile.d.ts +13 -0
- package/components/InputFile/InputFile.utils.d.ts +4 -2
- package/components/InputNumber/InputNumber.d.ts +17 -4
- package/components/InputNumber/InputNumber.utils.d.ts +2 -2
- package/components/InputPassword/InputPassword.d.ts +13 -0
- package/components/InputPassword/InputPassword.utils.d.ts +2 -2
- package/components/InputSearch/InputSearch.d.ts +13 -0
- package/components/InputSearch/InputSearch.utils.d.ts +2 -2
- package/components/LinkButton/LinkButton.d.ts +5 -0
- package/components/LinkButton/LinkButton.utils.d.ts +4 -5
- package/components/RadioGroup/RadioGroup.d.ts +13 -0
- package/components/RadioGroup/RadioGroup.utils.d.ts +3 -2
- package/components/Scroller/Scroller.test.d.ts +1 -0
- package/components/Select/Select.d.ts +13 -0
- package/components/Select/Select.utils.d.ts +2 -2
- package/components/Slider/Slider.d.ts +13 -0
- package/components/Textarea/Textarea.d.ts +13 -0
- package/components/Textarea/Textarea.utils.d.ts +2 -2
- package/{customreactselect.BFN8cYJi.js → customreactselect.BNwzk8Qi.js} +4 -3
- package/{dialog.CzM_Cxp0.js → dialog.D5geKDtZ.js} +2 -2
- package/{drawer._A9MQ8Cj.js → drawer.ucjhpIF4.js} +2 -2
- package/{fieldset.CId-NtI5.js → fieldset.Crx4Cb9a.js} +3 -2
- package/{filelist.DgVuWpR3.js → filelist.Bcu6TZRj.js} +1 -1
- package/{floatingactionbutton.Bsnncudt.js → floatingactionbutton.B5hJ2At2.js} +1 -1
- package/{header.CelAkqtp.js → header.A77yIAH3.js} +1 -1
- package/index.es.js +103 -102
- package/input.DL_M_Pg3.js +190 -0
- package/{inputfile.BjgJGefV.js → inputfile.iwsNHjrc.js} +6 -5
- package/{inputnumber.BcrxBVv0.js → inputnumber.raC_7KIP.js} +7 -6
- package/{inputpassword.CddmBW-T.js → inputpassword.Brte78Sr.js} +4 -4
- package/{inputsearch.CFOASqrd.js → inputsearch.BP0EzFcF.js} +6 -5
- package/{link.f8MMZo-w.js → link.BtZeNdii.js} +2 -2
- package/{linkbutton.BYAvi-_V.js → linkbutton.In_ROT0Z.js} +4 -4
- package/{logo100years.B4d_DIiB.js → logo100years.DDzCrczW.js} +10 -10
- package/{megamenu.Cy9Cc-mC.js → megamenu.BurL9MfF.js} +3 -3
- package/{navigationtabs.Dp7D2fnc.js → navigationtabs.EbmfKv1R.js} +2 -2
- package/{notification.B-norGiB.js → notification.tadg6lCc.js} +2 -2
- package/package.json +4 -3
- package/partials/index.js +32 -32
- package/{popover.DFVDZY-m.js → popover.CXq7VoZt.js} +3 -3
- package/radio.pyM5ma9s.js +134 -0
- package/{radiogroup.DaThoMfq.js → radiogroup.sdob0iPE.js} +3 -3
- package/{scroller.Cu7H_VCT.js → scroller.B1LijjCF.js} +1 -1
- package/{select.CMdKf7tC.js → select.CZ0C3yJD.js} +5 -4
- package/{skiptocontent.CHVh0hbr.js → skiptocontent.CAQy194o.js} +1 -1
- package/slider.B3u5du_Q.js +12 -0
- package/{step.DKf4CHGr.js → step.DaJFsafj.js} +1 -1
- package/{stepper.CCP_igpJ.js → stepper.DcaZESJi.js} +3 -3
- package/styles/scss/ds/lib/ds-internal/_input.scss +12 -3
- package/styles/scss/ds/lib/ds-internal/_link-button.scss +10 -2
- package/styles/scss/ds/lib/link-button.scss +11 -3
- package/{tablist.DZgo49nZ.js → tablist.mX5nQWwH.js} +1 -1
- package/{tabs.BkoT7feH.js → tabs.DjWfks34.js} +2 -2
- package/{textarea.DMn20z4p.js → textarea.69r-5faY.js} +4 -3
- package/{toast.Dvs8woTH.js → toast.FzO5KoiK.js} +2 -2
- package/{toastmanager.pi_Fhd5t.js → toastmanager.BGIYNKkT.js} +1 -1
- package/{tooltip.QJe_bfO-.js → tooltip.Cj3AvYgB.js} +22 -23
- package/{topbar.Bxwvp9Lf.js → topbar.CAujTZAE.js} +2 -2
- package/utils/useIsomorphicLayoutEffect.d.ts +2 -2
- package/assets/Button.C8sNwIeW.css +0 -1
- package/assets/CustomReactSelect.E_jJFVew.css +0 -1
- package/assets/Fieldset.CW9dBvAo.css +0 -1
- package/assets/InputFile.BnIvK65P.css +0 -1
- package/assets/InputNumber.BoiCIR1f.css +0 -1
- package/assets/InputPassword.Dk3_vNLV.css +0 -1
- package/assets/InputSearch.C1_4cVCi.css +0 -1
- package/assets/LinkButton.B86yacK5.css +0 -1
- package/assets/RadioGroup.CM2mYOzc.css +0 -1
- package/assets/Select.COxLltX7.css +0 -1
- package/assets/Slider.DPEmJ3HD.css +0 -1
- package/assets/Textarea.y3MW7VW0.css +0 -1
- package/assets/buttonround.BN3vUDc_.css +0 -1
- package/assets/input.DTu4g_iA.css +0 -1
- package/assets/radio.CgpGvYc-.css +0 -1
- package/button.DHuKanZP.js +0 -13
- package/buttonround.CMlmEDaN.js +0 -96
- package/chunks/Button.DCZgBNmA.js +0 -142
- package/chunks/CheckboxGroup.BuFd1luB.js +0 -72
- package/chunks/Fieldset.DiMtr6Vw.js +0 -74
- package/chunks/InputFile.C8nt9Fu8.js +0 -218
- package/chunks/InputNumber.CbH1XJfl.js +0 -267
- package/chunks/InputPassword.DbdjuSiJ.js +0 -136
- package/chunks/InputSearch.joxmugiv.js +0 -173
- package/chunks/LinkButton.BZgIGgc8.js +0 -132
- package/chunks/RadioGroup.CexC4v2Z.js +0 -104
- package/chunks/Select.BEIdNMML.js +0 -164
- package/chunks/Slider.CR0zYHeZ.js +0 -291
- package/chunks/Textarea.Du2RII5u.js +0 -168
- package/chunks/floating-ui.dom.BT8pKtCQ.js +0 -1005
- package/chunks/floating-ui.react.3FjeMiuN.js +0 -1999
- package/combobox.jG5GRA7C.js +0 -65
- package/input.DuEbg7d6.js +0 -206
- package/radio.DHUfSPai.js +0 -126
- package/slider.C5dK6KcG.js +0 -11
- /package/components/InputNumber/{InputNumberutils.test.d.ts → InputNumber.utils.test.d.ts} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as n, jsxs as E } from "react/jsx-runtime";
|
|
3
3
|
import { c as r } from "./index.DL9mof6u.js";
|
|
4
4
|
import { useRef as g, useState as F, useEffect as v } from "react";
|
|
5
|
-
import { D as W } from "./Button.
|
|
5
|
+
import { D as W } from "./Button.CQlIao-Z.js";
|
|
6
6
|
import { g as x } from "./helpers.CexwVao7.js";
|
|
7
7
|
import "./index.D-sRdssb.js";
|
|
8
8
|
import '../assets/Dialog.DJkn65Es.css';const R = "ds-dialog_root_kvopn_5", y = "ds-dialog_content-wrapper_kvopn_166", z = "ds-dialog_content-wrapper--no-footer_kvopn_172", L = "ds-dialog_close-button_kvopn_180", M = "ds-dialog_header_kvopn_193", j = "ds-dialog_content_kvopn_166", H = "ds-dialog_footer_kvopn_195", I = "ds-dialog_header--scrollable_kvopn_216", O = "ds-dialog_header--close-button_kvopn_225", P = "ds-dialog_content--no-footer_kvopn_238", T = "ds-dialog_footer--scrollable_kvopn_245", o = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as t, jsxs as F } from "react/jsx-runtime";
|
|
3
3
|
import { c as n } from "./index.DL9mof6u.js";
|
|
4
4
|
import { useRef as p, useState as R, useEffect as v } from "react";
|
|
5
|
-
import { D as k } from "./Button.
|
|
5
|
+
import { D as k } from "./Button.CQlIao-Z.js";
|
|
6
6
|
import { g as x } from "./helpers.CexwVao7.js";
|
|
7
7
|
import "./index.D-sRdssb.js";
|
|
8
8
|
import '../assets/Drawer.x3BCQvWE.css';const I = "ds-drawer_root_4nbv0_10", O = "ds-drawer_root--end_4nbv0_68", y = "ds-drawer_content-wrapper_4nbv0_169", z = "ds-drawer_content-wrapper--no-footer_4nbv0_175", L = "ds-drawer_close-button_4nbv0_178", M = "ds-drawer_header_4nbv0_191", P = "ds-drawer_content_4nbv0_169", j = "ds-drawer_footer_4nbv0_193", H = "ds-drawer_header--scrollable_4nbv0_214", T = "ds-drawer_header--close-button_4nbv0_223", A = "ds-drawer_content--no-footer_4nbv0_237", V = "ds-drawer_footer--scrollable_4nbv0_244", o = {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, jsx as r, Fragment as M } from "react/jsx-runtime";
|
|
3
|
+
import { c as m } from "./index.DL9mof6u.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { Asterisk as S } from "../asterisk.B2ih8VwF.js";
|
|
6
|
+
import { DSHeading as P } from "../heading.DHLpT4dc.js";
|
|
7
|
+
import { D as x } from "./Popover.C9tT8xkE.js";
|
|
8
|
+
import { D as E } from "./SystemFeedback.CjlARKki.js";
|
|
9
|
+
import { g as y } from "./helpers.CexwVao7.js";
|
|
10
|
+
import "./index.D-sRdssb.js";
|
|
11
|
+
import '../assets/Fieldset.Oqu7pOBv.css';const q = "ds-fieldset_root_1rlhb_1", A = "ds-fieldset_child-wrapper_1rlhb_98", T = "ds-fieldset_legend-wrapper_1rlhb_105", U = "ds-fieldset_legend_1rlhb_105", z = "ds-fieldset_legend--utility--m_1rlhb_116", B = "ds-fieldset_description_1rlhb_128", C = "ds-fieldset_description--small_1rlhb_142", I = "ds-fieldset_system-feedback_1rlhb_146", e = {
|
|
12
|
+
root: q,
|
|
13
|
+
childWrapper: A,
|
|
14
|
+
legendWrapper: T,
|
|
15
|
+
legend: U,
|
|
16
|
+
legendUtilityM: z,
|
|
17
|
+
description: B,
|
|
18
|
+
descriptionSmall: C,
|
|
19
|
+
systemFeedback: I
|
|
20
|
+
}, O = ({
|
|
21
|
+
description: a,
|
|
22
|
+
id: s,
|
|
23
|
+
legend: n,
|
|
24
|
+
systemFeedback: t
|
|
25
|
+
}) => {
|
|
26
|
+
if (!s && (a || t))
|
|
27
|
+
throw new Error(y("DSFieldset", 'A unique "id" prop is required when providing the description or systemFeedback property. Please add a unique "id" prop to the DSFieldset component.'));
|
|
28
|
+
if (!n)
|
|
29
|
+
throw new Error(y("DSFieldset", "The legend prop is required. Please add the legend prop to the DSFieldset component."));
|
|
30
|
+
}, X = ({
|
|
31
|
+
children: a,
|
|
32
|
+
legend: s,
|
|
33
|
+
className: n,
|
|
34
|
+
description: t,
|
|
35
|
+
disabled: u = !1,
|
|
36
|
+
id: c,
|
|
37
|
+
invalid: p = !1,
|
|
38
|
+
popoverContent: h,
|
|
39
|
+
popoverInfoButtonProps: F,
|
|
40
|
+
required: f = !1,
|
|
41
|
+
systemFeedback: i,
|
|
42
|
+
...N
|
|
43
|
+
}) => {
|
|
44
|
+
process.env.NODE_ENV !== "production" && O({
|
|
45
|
+
description: t,
|
|
46
|
+
id: c,
|
|
47
|
+
legend: s,
|
|
48
|
+
systemFeedback: i
|
|
49
|
+
});
|
|
50
|
+
let l, g, _;
|
|
51
|
+
const o = typeof s == "object" && s !== void 0;
|
|
52
|
+
o && ({
|
|
53
|
+
headingSize: l,
|
|
54
|
+
headingTag: g,
|
|
55
|
+
headingText: _
|
|
56
|
+
} = s);
|
|
57
|
+
const b = `${c}-feedback`, D = `${c}-description`, v = [p && i && b, t && D].filter(Boolean).join(" ") || void 0, w = !o || l === "small" || l === "small-uppercase", k = m(e.root, n), W = m(e.legend, {
|
|
58
|
+
[e.legendUtilityM]: !o
|
|
59
|
+
}), j = m(e.description, {
|
|
60
|
+
[e.descriptionSmall]: w
|
|
61
|
+
});
|
|
62
|
+
return /* @__PURE__ */ d("fieldset", { className: k, disabled: u, ...N, "aria-invalid": p, "aria-describedby": v, children: [
|
|
63
|
+
/* @__PURE__ */ d("legend", { className: W, children: [
|
|
64
|
+
/* @__PURE__ */ r("span", { className: e.legendWrapper, children: o ? /* @__PURE__ */ d(P, { tag: g, size: l, children: [
|
|
65
|
+
_,
|
|
66
|
+
f && /* @__PURE__ */ r(S, {})
|
|
67
|
+
] }) : /* @__PURE__ */ d(M, { children: [
|
|
68
|
+
s,
|
|
69
|
+
f && /* @__PURE__ */ r(S, {})
|
|
70
|
+
] }) }),
|
|
71
|
+
h && /* @__PURE__ */ r(x, { placement: "top", defaultAnchorButtonProps: F, children: h })
|
|
72
|
+
] }),
|
|
73
|
+
t && /* @__PURE__ */ r("span", { id: D, className: j, children: t }),
|
|
74
|
+
p && i && /* @__PURE__ */ r(E, { id: b, variant: "error", message: i, className: e.systemFeedback }),
|
|
75
|
+
/* @__PURE__ */ r("div", { className: e.childWrapper, children: a })
|
|
76
|
+
] });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
X as D,
|
|
80
|
+
O as v
|
|
81
|
+
};
|
|
@@ -6,7 +6,7 @@ import { useState as O, useEffect as ae, useContext as re, createContext as xe,
|
|
|
6
6
|
import { g as Y, c as F, p as he } from "./helpers.CexwVao7.js";
|
|
7
7
|
import { u as De } from "./useIsomorphicLayoutEffect.CnJ9AMFS.js";
|
|
8
8
|
import { DSLogo as Pe } from "../logo.DprmD8HU.js";
|
|
9
|
-
import { Logo100Years as Te } from "../logo100years.
|
|
9
|
+
import { Logo100Years as Te } from "../logo100years.DDzCrczW.js";
|
|
10
10
|
import '../assets/Header.CNqtWTxB.css';const Ee = (s) => {
|
|
11
11
|
const e = T.c(3), t = 0, [n, r] = O("down");
|
|
12
12
|
let a, d;
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
import { g as t } from "./helpers.CexwVao7.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "./index.D-sRdssb.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const r = 8, d = 5, I = ["medium", "small"], u = ["color", "date", "datetime-local", "email", "month", "number", "range", "tel", "text", "time", "url"], l = ["week", "file", "hidden", "button", "checkbox", "password", "radio", "search", "reset", "submit", "image", "datetime"], T = ({
|
|
6
|
+
hideLabel: e,
|
|
7
|
+
id: o,
|
|
7
8
|
label: a,
|
|
8
|
-
prefix:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
prefix: s,
|
|
10
|
+
popoverContent: c,
|
|
11
|
+
suffix: i,
|
|
12
|
+
leadingIconName: m,
|
|
13
|
+
leadingIconSource: p,
|
|
12
14
|
actionButtonProps: n
|
|
13
15
|
}) => {
|
|
14
|
-
if (!
|
|
16
|
+
if (!o)
|
|
15
17
|
throw new Error(t("DSInput", 'A unique "id" prop is required. Please add a unique "id" prop to the DSInput component.'));
|
|
16
18
|
if (!a)
|
|
17
19
|
throw new Error(t("DSInput", `A label is always required for a11y reasons. Please add a descriptive "label" prop to the DSInput component. If you don't want to display a label, set hideLabel={true}.`));
|
|
@@ -19,13 +21,13 @@ const i = 8, r = 5, w = ["medium", "small"], m = ["color", "date", "datetime-loc
|
|
|
19
21
|
throw new Error(t("DSInput", "The action button needs to have a label for a11y reasons. Please add a label to the actionButtonProps."));
|
|
20
22
|
if (n && !n?.iconName && !n?.iconSource)
|
|
21
23
|
throw new Error(t("DSInput", "The action button needs to have an iconName or iconSource. Please add an iconName or iconSource to the actionButtonProps."));
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
if (!
|
|
24
|
+
s && s.length > r && console.warn(t("DSInput", `Prefix length must not exceed ${r} characters.`)), i && i.length > d && console.warn(t("DSInput", `Suffix length must not exceed ${d} characters.`)), s && (m || p) && console.warn(t("DSInput", "Prefix and a leading Icon cannot be used at the same time.")), i && (n?.iconName || n?.iconSource) && console.warn(t("DSInput", "Suffix and an action button cannot be used at the same time.")), e && c && console.warn(t("DSInput", "Using a popover when hideLabel is set to true is not supported."));
|
|
25
|
+
}, D = (e, o) => {
|
|
26
|
+
if (!u.includes(e) && !l.includes(e))
|
|
25
27
|
throw new Error(t("DSInput", `The type "${e}" is not supported by the DSInput component.`));
|
|
26
|
-
if (
|
|
28
|
+
if (o === "off" && e === "number")
|
|
27
29
|
return;
|
|
28
|
-
const
|
|
30
|
+
const a = {
|
|
29
31
|
number: "Type number is not recommended. Use type text with inputmode numeric/decimal or DSInputNumber component instead.",
|
|
30
32
|
button: "Type button is not recommended. Use DSButton component instead.",
|
|
31
33
|
file: "Type file is not recommended. Use DSInputFile component instead.",
|
|
@@ -40,18 +42,18 @@ const i = 8, r = 5, w = ["medium", "small"], m = ["color", "date", "datetime-loc
|
|
|
40
42
|
week: "Type week is not recommended. Mobile safari does not support type week.",
|
|
41
43
|
hidden: 'Type hidden is not supported by DSInput component. Use a default <input type="hidden" /> element instead.'
|
|
42
44
|
};
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
+
a[e] && console.warn(t("DSInput", a[e]));
|
|
46
|
+
}, h = () => "showPicker" in HTMLInputElement.prototype && !!window.navigator.userAgent.match(/chrome|chromium|crios|edg/i), f = (e, o) => h() && (e || o), y = (e) => e === "date" || e === "datetime-local" || e === "month", U = (e) => e === "time";
|
|
45
47
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
I,
|
|
49
|
+
r as M,
|
|
50
|
+
u as S,
|
|
51
|
+
l as U,
|
|
52
|
+
d as a,
|
|
53
|
+
D as b,
|
|
54
|
+
U as c,
|
|
55
|
+
h,
|
|
56
|
+
y as i,
|
|
57
|
+
f as s,
|
|
58
|
+
T as v
|
|
57
59
|
};
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as D, jsx as r, Fragment as _e } from "react/jsx-runtime";
|
|
3
|
+
import { c as f } from "./index.DL9mof6u.js";
|
|
4
|
+
import { forwardRef as he, useState as Q, useRef as Ie, useCallback as ve } from "react";
|
|
5
|
+
import { t as we } from "./translate.nuU7uChI.js";
|
|
6
|
+
import { u as P } from "./useBreakpoint.1txsny17.js";
|
|
7
|
+
import "./index.D-sRdssb.js";
|
|
8
|
+
import { g as Se } from "./AriaLiveRegions.utils.CybNIBSa.js";
|
|
9
|
+
import { Asterisk as Fe } from "../asterisk.B2ih8VwF.js";
|
|
10
|
+
import { D as ze } from "./Button.CQlIao-Z.js";
|
|
11
|
+
import { FileList as Ne } from "../filelist.Bcu6TZRj.js";
|
|
12
|
+
import { D as Le } from "./Icon.CDLyB7Pv.js";
|
|
13
|
+
import { D as ke } from "./Popover.C9tT8xkE.js";
|
|
14
|
+
import { D as ye } from "./SystemFeedback.CjlARKki.js";
|
|
15
|
+
import { g as _ } from "./helpers.CexwVao7.js";
|
|
16
|
+
import '../assets/InputFile.D7Ihod7B.css';const Be = "ds-input-file_root_ad2pg_1", Te = "ds-input-file_browse-button--is-dragging-filled_ad2pg_1", Ae = "ds-input-file_browse-button--is-dragging_ad2pg_1", Pe = "ds-input-file_hint_ad2pg_14", $e = "ds-input-file_label-wrapper_ad2pg_14", Ce = "ds-input-file_label_ad2pg_14", Re = "ds-input-file_label--disabled_ad2pg_33", Ee = "ds-input-file_label-wrapper--hidden_ad2pg_45", We = "ds-input-file_feedback_ad2pg_73", qe = "ds-input-file_dropzone_ad2pg_77", xe = "ds-input-file_dropzone--disabled_ad2pg_83", He = "ds-input-file_dropzone--invalid_ad2pg_97", Oe = "ds-input-file_dropzone--is-dragging_ad2pg_100", Ve = "ds-input-file_hint-drop-zone_ad2pg_103", je = "ds-input-file_upload-icon_ad2pg_106", Me = "ds-input-file_browse-button-dropzone--is-dragging_ad2pg_109", Ue = "ds-input-file_instructions_ad2pg_112", Ze = "ds-input-file_input_ad2pg_149", Ge = "ds-input-file_required-sr-info_ad2pg_153", t = {
|
|
17
|
+
root: Be,
|
|
18
|
+
browseButtonIsDraggingFilled: Te,
|
|
19
|
+
browseButtonIsDragging: Ae,
|
|
20
|
+
hint: Pe,
|
|
21
|
+
labelWrapper: $e,
|
|
22
|
+
label: Ce,
|
|
23
|
+
labelDisabled: Re,
|
|
24
|
+
labelWrapperHidden: Ee,
|
|
25
|
+
feedback: We,
|
|
26
|
+
dropzone: qe,
|
|
27
|
+
dropzoneDisabled: xe,
|
|
28
|
+
dropzoneInvalid: He,
|
|
29
|
+
dropzoneIsDragging: Oe,
|
|
30
|
+
hintDropZone: Ve,
|
|
31
|
+
uploadIcon: je,
|
|
32
|
+
browseButtonDropzoneIsDragging: Me,
|
|
33
|
+
instructions: Ue,
|
|
34
|
+
input: Ze,
|
|
35
|
+
requiredSrInfo: Ge
|
|
36
|
+
}, Je = {
|
|
37
|
+
dragAndDropInstructions: "Drag and drop files here or",
|
|
38
|
+
feedbackFileSize: "File too large. Maximum file size is",
|
|
39
|
+
feedbackFileType: "File type not allowed",
|
|
40
|
+
// {0} is the file name
|
|
41
|
+
fileListRemoveSelectionButtonLabel: "Remove {0} from selected files",
|
|
42
|
+
fileListPreviewAltText: "Preview of",
|
|
43
|
+
filesSelectedHint: "The following files are selected",
|
|
44
|
+
required: "required",
|
|
45
|
+
togglePopover: "Toggle popover"
|
|
46
|
+
}, Ke = {
|
|
47
|
+
dragAndDropInstructions: "Dateien hier hin ziehen oder",
|
|
48
|
+
feedbackFileSize: "Datei zu groß. Maximale Dateigröße ist",
|
|
49
|
+
feedbackFileType: "Dateityp nicht zugelassen",
|
|
50
|
+
// {0} is the file name
|
|
51
|
+
fileListRemoveSelectionButtonLabel: "Datei {0} aus der Auswahl entfernen",
|
|
52
|
+
fileListPreviewAltText: "Vorschau von",
|
|
53
|
+
filesSelectedHint: "Die folgenden Dateien sind ausgewählt",
|
|
54
|
+
required: "erforderlich",
|
|
55
|
+
togglePopover: "Popover öffnen/schließen"
|
|
56
|
+
}, X = {
|
|
57
|
+
en: Je,
|
|
58
|
+
de: Ke
|
|
59
|
+
}, Qe = (a, d) => {
|
|
60
|
+
const o = d.split(",").map((l) => l.trim().toLowerCase()).filter(Boolean), g = a.name.toLowerCase(), n = a.type.toLowerCase();
|
|
61
|
+
return o.some((l) => {
|
|
62
|
+
if (l.startsWith("."))
|
|
63
|
+
return g.endsWith(l);
|
|
64
|
+
if (l.endsWith("/*")) {
|
|
65
|
+
const [h] = n.split("/");
|
|
66
|
+
return h === l.slice(0, -2);
|
|
67
|
+
}
|
|
68
|
+
return n === l;
|
|
69
|
+
});
|
|
70
|
+
}, Xe = ({
|
|
71
|
+
id: a,
|
|
72
|
+
label: d,
|
|
73
|
+
inputFileButtonProps: o,
|
|
74
|
+
hideLabel: g,
|
|
75
|
+
popoverContent: n
|
|
76
|
+
}) => {
|
|
77
|
+
if (!a)
|
|
78
|
+
throw new Error(_("DSInputFile", 'A unique "id" prop is required. Please add a unique "id" prop to the DSInputFile component.'));
|
|
79
|
+
if (!d)
|
|
80
|
+
throw new Error(_("DSInputFile", `A label is always required for a11y reasons. Please add a descriptive "label" prop to the DSInputFile component. If you don't want to display a label, set hideLabel={true}.`));
|
|
81
|
+
if (o && o.label?.trim() === "")
|
|
82
|
+
throw new Error(_("DSInputFile", "The input file button needs to have a label for a11y reasons. Please add a label to the inputFileButtonProps."));
|
|
83
|
+
if (o && o.variant && o.variant !== "outline" && o.variant !== "filled")
|
|
84
|
+
throw new Error(_("DSInputFile", "The inputFileButtonProps variant value can only be 'outline' for DSInputFile components inside forms or 'filled' for standalone DSInputFile components."));
|
|
85
|
+
g && n && console.warn(_("DSInputFile", "Using a popover when hideLabel is set to true is not supported."));
|
|
86
|
+
}, Ye = he(({
|
|
87
|
+
id: a,
|
|
88
|
+
label: d,
|
|
89
|
+
accept: o,
|
|
90
|
+
className: g,
|
|
91
|
+
disabled: n = !1,
|
|
92
|
+
fileListItemRemoveButtonProps: l,
|
|
93
|
+
hideLabel: h = !1,
|
|
94
|
+
hint: b,
|
|
95
|
+
inputFileButtonProps: $,
|
|
96
|
+
invalid: I = !1,
|
|
97
|
+
isHintOutsideDropzone: Y = {
|
|
98
|
+
base: !0,
|
|
99
|
+
m: !1
|
|
100
|
+
},
|
|
101
|
+
lang: S = "en",
|
|
102
|
+
maxSizeInMb: F = 7,
|
|
103
|
+
multiple: m = !1,
|
|
104
|
+
popoverContent: z,
|
|
105
|
+
popoverInfoButtonProps: C,
|
|
106
|
+
required: R = !1,
|
|
107
|
+
showFileList: ee = !0,
|
|
108
|
+
showDropzone: p = !1,
|
|
109
|
+
systemFeedback: N,
|
|
110
|
+
translations: L,
|
|
111
|
+
onFilesSelect: E,
|
|
112
|
+
...te
|
|
113
|
+
}, v) => {
|
|
114
|
+
const c = we(L || X[S]);
|
|
115
|
+
process.env.NODE_ENV !== "production" && Xe({
|
|
116
|
+
id: a,
|
|
117
|
+
label: d,
|
|
118
|
+
inputFileButtonProps: $,
|
|
119
|
+
hideLabel: P(h),
|
|
120
|
+
popoverContent: z
|
|
121
|
+
});
|
|
122
|
+
const {
|
|
123
|
+
label: ne = S === "en" ? `Choose File${m ? "s" : ""}` : `Datei${m ? "en" : ""} auswählen`,
|
|
124
|
+
variant: k = "outline",
|
|
125
|
+
...oe
|
|
126
|
+
} = $ || {}, ie = {
|
|
127
|
+
...C,
|
|
128
|
+
label: L && L.togglePopover || C?.label || X[S].togglePopover
|
|
129
|
+
}, [W, q] = Q([]), w = Ie(null), [u, y] = Q(!1), re = F * 1024 * 1024, B = `${a}-label`, x = `${a}-feedback`, T = `${a}-hint`, H = b ? ` ${T}` : "", O = P(h), V = P(Y), ae = f(t.root, g), se = f(t.dropzone, {
|
|
130
|
+
[t.dropzoneDisabled]: n,
|
|
131
|
+
[t.dropzoneInvalid]: I,
|
|
132
|
+
[t.dropzoneIsDragging]: u
|
|
133
|
+
}), le = f(t.label, {
|
|
134
|
+
[t.labelDisabled]: n
|
|
135
|
+
}), de = f(t.labelWrapper, {
|
|
136
|
+
// hide label only visually to keep them available for assistive technologies
|
|
137
|
+
[t.labelWrapperHidden]: O
|
|
138
|
+
}), pe = f(t.browseButton, {
|
|
139
|
+
[t.browseButtonIsDragging]: u && k === "outline",
|
|
140
|
+
[t.browseButtonIsDraggingFilled]: u && k === "filled"
|
|
141
|
+
}), ce = f(t.browseButtonDropzone, {
|
|
142
|
+
[t.browseButtonDropzoneIsDragging]: u
|
|
143
|
+
}), ue = [I && N && x].filter(Boolean).join(" ") || void 0, fe = (e) => {
|
|
144
|
+
w.current = e, typeof v == "function" ? v(e) : v && (v.current = e);
|
|
145
|
+
}, j = (e) => {
|
|
146
|
+
if (!e)
|
|
147
|
+
return;
|
|
148
|
+
const s = [];
|
|
149
|
+
for (const i of e)
|
|
150
|
+
if (o && !Qe(i, o) && (i.feedback = `${c("feedbackFileType")}: ${i.type}.`), i.size > re && (i.feedback = `${c("feedbackFileSize")} ${F} MB.`), s.push(i), !m && s.length > 0)
|
|
151
|
+
break;
|
|
152
|
+
s.length > 0 && (q(() => {
|
|
153
|
+
const i = [...s], K = i.map(({
|
|
154
|
+
name: A,
|
|
155
|
+
feedback: De = ""
|
|
156
|
+
}) => `${A} ${De}`).join(", ");
|
|
157
|
+
return setTimeout(() => {
|
|
158
|
+
me(`${c("filesSelectedHint")}: ${K}.`);
|
|
159
|
+
}, 1e3), i;
|
|
160
|
+
}), E?.(s));
|
|
161
|
+
}, M = (e) => {
|
|
162
|
+
n || (w.current?.click(), e.stopPropagation());
|
|
163
|
+
}, U = (e) => {
|
|
164
|
+
e.preventDefault(), u || y(!0);
|
|
165
|
+
}, Z = (e) => {
|
|
166
|
+
e.preventDefault(), u && y(!1);
|
|
167
|
+
}, G = ve((e) => {
|
|
168
|
+
e.preventDefault(), !n && (y(!1), j(e.dataTransfer.files));
|
|
169
|
+
}, [m, o, F, n]), ge = (e) => {
|
|
170
|
+
j(e.target.files), w?.current && (w.current.value = "");
|
|
171
|
+
}, be = (e) => {
|
|
172
|
+
q((s) => {
|
|
173
|
+
const i = s.filter((K, A) => A !== e);
|
|
174
|
+
return E?.(i), i;
|
|
175
|
+
});
|
|
176
|
+
}, me = (e) => {
|
|
177
|
+
const s = Se();
|
|
178
|
+
s && (s.innerText = e, setTimeout(() => {
|
|
179
|
+
s.innerText = "";
|
|
180
|
+
}, 350));
|
|
181
|
+
}, J = () => /* @__PURE__ */ r(ze, { ...oe, className: p ? ce : pe, type: "button", variant: k, size: p ? "small" : "medium", disabled: n, iconName: p ? void 0 : "upload", onClick: M, "aria-describedby": ue, "aria-invalid": I, children: ne });
|
|
182
|
+
return /* @__PURE__ */ D("div", { className: ae, children: [
|
|
183
|
+
/* @__PURE__ */ D("div", { className: de, children: [
|
|
184
|
+
/* @__PURE__ */ D("label", { className: le, id: B, htmlFor: a, children: [
|
|
185
|
+
d,
|
|
186
|
+
R && /* @__PURE__ */ D(_e, { children: [
|
|
187
|
+
/* @__PURE__ */ r(Fe, {}),
|
|
188
|
+
/* @__PURE__ */ r("span", { className: t.requiredSrInfo, children: c("required") })
|
|
189
|
+
] })
|
|
190
|
+
] }),
|
|
191
|
+
z && !O && /* @__PURE__ */ r(ke, { placement: "top", defaultAnchorButtonProps: ie, children: z })
|
|
192
|
+
] }),
|
|
193
|
+
b && (V || !p) && /* @__PURE__ */ r("div", { className: t.hint, id: T, children: b }),
|
|
194
|
+
!p && /* @__PURE__ */ r(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
onDragOver: U,
|
|
198
|
+
onDragLeave: Z,
|
|
199
|
+
onDrop: G,
|
|
200
|
+
"aria-labelledby": `${B}${H}`,
|
|
201
|
+
"aria-disabled": n,
|
|
202
|
+
children: J()
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
p && /* @__PURE__ */ D(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
className: se,
|
|
209
|
+
onClick: (e) => M(e),
|
|
210
|
+
onDragOver: U,
|
|
211
|
+
onDragLeave: Z,
|
|
212
|
+
onDrop: G,
|
|
213
|
+
"aria-labelledby": `${B}${H}`,
|
|
214
|
+
"aria-disabled": n,
|
|
215
|
+
children: [
|
|
216
|
+
/* @__PURE__ */ r(Le, { name: "upload", className: t.uploadIcon, size: "x-large" }),
|
|
217
|
+
/* @__PURE__ */ r("p", { id: "file-upload-instructions", className: t.instructions, children: c("dragAndDropInstructions") }),
|
|
218
|
+
J(),
|
|
219
|
+
b && !V && /* @__PURE__ */ r("div", { className: t.hintDropZone, id: T, children: b })
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
/* @__PURE__ */ r("input", { ...te, type: "file", className: t.input, id: a, ref: fe, accept: o, multiple: m, "aria-hidden": "true", required: R, disabled: n, onChange: ge }),
|
|
224
|
+
I && N && /* @__PURE__ */ r(ye, { className: t.feedback, message: N, variant: "error", id: x }),
|
|
225
|
+
W.length > 0 && ee && /* @__PURE__ */ r(Ne, { files: W, onRemoveFile: be, fileListItemRemoveButtonProps: l, t: c })
|
|
226
|
+
] });
|
|
227
|
+
});
|
|
228
|
+
Ye.displayName = "DSInputFile";
|
|
229
|
+
export {
|
|
230
|
+
Ye as D,
|
|
231
|
+
Je as a,
|
|
232
|
+
Ke as b,
|
|
233
|
+
X as c,
|
|
234
|
+
Qe as f,
|
|
235
|
+
Xe as v
|
|
236
|
+
};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as N, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { c as r } from "./index.DL9mof6u.js";
|
|
4
|
+
import { forwardRef as Be, useState as m, useRef as E, useEffect as W } from "react";
|
|
5
|
+
import { h as Le } from "./has-window.ut_-aShB.js";
|
|
6
|
+
import { u as J } from "./useBreakpoint.1txsny17.js";
|
|
7
|
+
import { u as K } from "./useIsomorphicLayoutEffect.CnJ9AMFS.js";
|
|
8
|
+
import "./index.D-sRdssb.js";
|
|
9
|
+
import { Asterisk as Re } from "../asterisk.B2ih8VwF.js";
|
|
10
|
+
import { D as Q } from "./Button.CQlIao-Z.js";
|
|
11
|
+
import { M as k, a as P } from "./Input.utils.CL1u4Ctq.js";
|
|
12
|
+
import { D as Ee } from "./Popover.C9tT8xkE.js";
|
|
13
|
+
import { D as We } from "./SystemFeedback.CjlARKki.js";
|
|
14
|
+
import { g as f } from "./helpers.CexwVao7.js";
|
|
15
|
+
import '../assets/InputNumber.z_UqRYdv.css';const ke = "ds-input-number_input_1nvt0_1", Pe = "ds-input-number_input--small_1nvt0_9", Ce = "ds-input-number_input--invalid_1nvt0_121", Ve = "ds-input-number_input--has-affix_1nvt0_197", $e = "ds-input-number_input--is-ready_1nvt0_211", He = "ds-input-number_root_1nvt0_222", Fe = "ds-input-number_hint_1nvt0_222", Te = "ds-input-number_label-wrapper_1nvt0_222", Me = "ds-input-number_wrapper_1nvt0_226", Xe = "ds-input-number_affix_1nvt0_232", je = "ds-input-number_affix--small_1nvt0_253", qe = "ds-input-number_prefix_1nvt0_266", Ue = "ds-input-number_suffix_1nvt0_272", Ge = "ds-input-number_affix--disabled_1nvt0_278", Oe = "ds-input-number_affix--readonly_1nvt0_289", Je = "ds-input-number_action-button_1nvt0_325", Ke = "ds-input-number_label_1nvt0_222", Qe = "ds-input-number_label--disabled_1nvt0_344", Ye = "ds-input-number_label-wrapper--hidden_1nvt0_356", Ze = "ds-input-number_feedback_1nvt0_384", ze = "ds-input-number_second-action-button_1nvt0_397", et = "ds-input-number_value-announcer_1nvt0_401", e = {
|
|
16
|
+
input: ke,
|
|
17
|
+
inputSmall: Pe,
|
|
18
|
+
inputInvalid: Ce,
|
|
19
|
+
inputHasAffix: Ve,
|
|
20
|
+
inputIsReady: $e,
|
|
21
|
+
root: He,
|
|
22
|
+
hint: Fe,
|
|
23
|
+
labelWrapper: Te,
|
|
24
|
+
wrapper: Me,
|
|
25
|
+
affix: Xe,
|
|
26
|
+
affixSmall: je,
|
|
27
|
+
prefix: qe,
|
|
28
|
+
suffix: Ue,
|
|
29
|
+
affixDisabled: Ge,
|
|
30
|
+
affixReadonly: Oe,
|
|
31
|
+
actionButton: Je,
|
|
32
|
+
label: Ke,
|
|
33
|
+
labelDisabled: Qe,
|
|
34
|
+
labelWrapperHidden: Ye,
|
|
35
|
+
feedback: Ze,
|
|
36
|
+
secondActionButton: ze,
|
|
37
|
+
valueAnnouncer: et
|
|
38
|
+
}, Y = (n) => n != null && n !== "", tt = ({
|
|
39
|
+
id: n,
|
|
40
|
+
label: b,
|
|
41
|
+
prefix: _,
|
|
42
|
+
suffix: h,
|
|
43
|
+
hideLabel: s,
|
|
44
|
+
popoverContent: x
|
|
45
|
+
}) => {
|
|
46
|
+
if (!n)
|
|
47
|
+
throw new Error(f("DSInputNumber", 'A unique "id" prop is required. Please add a unique "id" prop to the DSInputNumber component.'));
|
|
48
|
+
if (!b)
|
|
49
|
+
throw new Error(f("DSInputNumber", `A label is always required for a11y reasons. Please add a descriptive "label" prop to the DSInputNumber component. If you don't want to display a label, set hideLabel={true}.`));
|
|
50
|
+
_ && _.length > k && console.warn(f("DSInputNumber", `Prefix length must not exceed ${k} characters.`)), h && h.length > P && console.warn(f("DSInputNumber", `Suffix length must not exceed ${P} characters.`)), s && x && console.warn(f("DSInputNumber", "Using a popover when hideLabel is set to true is not supported."));
|
|
51
|
+
}, nt = Be(({
|
|
52
|
+
id: n,
|
|
53
|
+
label: b,
|
|
54
|
+
announcementText: _ = "Value changed to",
|
|
55
|
+
className: h,
|
|
56
|
+
disabled: s = !1,
|
|
57
|
+
decreaseAmountButtonProps: x,
|
|
58
|
+
hint: y,
|
|
59
|
+
hideLabel: C = !1,
|
|
60
|
+
invalid: v = !1,
|
|
61
|
+
increaseAmountButtonProps: Z,
|
|
62
|
+
prefix: u,
|
|
63
|
+
max: V = 100,
|
|
64
|
+
min: $ = 0,
|
|
65
|
+
popoverContent: D,
|
|
66
|
+
popoverInfoButtonProps: z,
|
|
67
|
+
readonly: l = !1,
|
|
68
|
+
required: H = !1,
|
|
69
|
+
size: i = "medium",
|
|
70
|
+
step: ee = 1,
|
|
71
|
+
suffix: c,
|
|
72
|
+
systemFeedback: A,
|
|
73
|
+
value: S,
|
|
74
|
+
onChange: F,
|
|
75
|
+
...te
|
|
76
|
+
}, I) => {
|
|
77
|
+
process.env.NODE_ENV !== "production" && tt({
|
|
78
|
+
id: n,
|
|
79
|
+
label: b,
|
|
80
|
+
prefix: u,
|
|
81
|
+
suffix: c,
|
|
82
|
+
hideLabel: J(C),
|
|
83
|
+
popoverContent: D
|
|
84
|
+
});
|
|
85
|
+
const {
|
|
86
|
+
label: ne = "Decrease",
|
|
87
|
+
tooltip: ae,
|
|
88
|
+
...se
|
|
89
|
+
} = x || {}, {
|
|
90
|
+
label: oe = "Increase",
|
|
91
|
+
tooltip: re,
|
|
92
|
+
...ie
|
|
93
|
+
} = Z || {}, [ue, le] = m(!1), [p, g] = m(S), [w, T] = m(""), [ce, pe] = m(!1), [de, me] = m({}), o = E(null), fe = (t) => {
|
|
94
|
+
o.current = t, typeof I == "function" ? I(t) : I && (I.current = t);
|
|
95
|
+
}, be = u?.substring(0, k), B = E(null), _e = c?.substring(0, P), L = E(null), M = J(C);
|
|
96
|
+
W(() => {
|
|
97
|
+
g(S);
|
|
98
|
+
}, [S]), W(() => {
|
|
99
|
+
if (w) {
|
|
100
|
+
const t = setTimeout(() => {
|
|
101
|
+
T("");
|
|
102
|
+
}, 3e3);
|
|
103
|
+
return () => clearTimeout(t);
|
|
104
|
+
}
|
|
105
|
+
}, [w]), W(() => {
|
|
106
|
+
const t = (d) => {
|
|
107
|
+
d.preventDefault();
|
|
108
|
+
};
|
|
109
|
+
return o.current?.addEventListener("wheel", t, {
|
|
110
|
+
// The { passive: false } option is used to indicate that the event listener wants to cancel the event, allowing preventDefault to work as expected.
|
|
111
|
+
passive: !1
|
|
112
|
+
}), () => {
|
|
113
|
+
o.current?.removeEventListener("wheel", t);
|
|
114
|
+
};
|
|
115
|
+
}, []), K(() => {
|
|
116
|
+
const t = i === "medium" ? 16 : 8, d = {};
|
|
117
|
+
if (B.current) {
|
|
118
|
+
const R = B.current.offsetWidth;
|
|
119
|
+
d.paddingInlineStart = t + R + "px";
|
|
120
|
+
}
|
|
121
|
+
if (L.current) {
|
|
122
|
+
const R = L.current.offsetWidth;
|
|
123
|
+
d.paddingInlineEnd = t + R + "px";
|
|
124
|
+
}
|
|
125
|
+
me(d), le(!0);
|
|
126
|
+
}, [u, c, i, ce]), K(() => {
|
|
127
|
+
Le && (async () => {
|
|
128
|
+
"fonts" in document && (await document.fonts.load('1em "STIHL Contraface Digital Text Regular"'), pe(!0));
|
|
129
|
+
})();
|
|
130
|
+
}, []);
|
|
131
|
+
const X = r(e.affix, {
|
|
132
|
+
[e.affixSmall]: i === "small",
|
|
133
|
+
[e.affixDisabled]: s,
|
|
134
|
+
[e.affixReadonly]: l
|
|
135
|
+
}), j = `${n}-label`, q = `${n}-feedback`, U = `${n}-hint`, G = `${n}-value-announcer`, he = y ? ` ${U}` : "", ve = r(e.root, h), Ie = r(e.input, {
|
|
136
|
+
// small input
|
|
137
|
+
[e.inputSmall]: i === "small",
|
|
138
|
+
// invalid state
|
|
139
|
+
[e.inputInvalid]: v,
|
|
140
|
+
// prefix/suffix
|
|
141
|
+
[e.inputHasAffix]: u || c,
|
|
142
|
+
[e.inputIsReady]: ue
|
|
143
|
+
}), Ne = r(e.label, {
|
|
144
|
+
[e.labelDisabled]: s
|
|
145
|
+
}), xe = r(e.labelWrapper, {
|
|
146
|
+
// hide label only visually to keep them available for assistive technologies
|
|
147
|
+
[e.labelWrapperHidden]: M
|
|
148
|
+
}), ye = r(e.secondActionButton, {
|
|
149
|
+
[e.secondActionButtonSmall]: i === "small"
|
|
150
|
+
}), De = r(e.actionButton, {
|
|
151
|
+
[e.actionButtonSmall]: i === "small"
|
|
152
|
+
}), Ae = () => {
|
|
153
|
+
const t = [G];
|
|
154
|
+
return v && A && t.push(q), t.join(" ");
|
|
155
|
+
}, O = () => {
|
|
156
|
+
if (o.current) {
|
|
157
|
+
g(o.current.value);
|
|
158
|
+
const t = new Event("change", {
|
|
159
|
+
bubbles: !0
|
|
160
|
+
});
|
|
161
|
+
o.current?.dispatchEvent(t), T(`${_} ${o.current.value}`);
|
|
162
|
+
}
|
|
163
|
+
}, Se = () => {
|
|
164
|
+
o.current?.stepDown(), O();
|
|
165
|
+
}, ge = () => {
|
|
166
|
+
o.current?.stepUp(), O();
|
|
167
|
+
}, we = (t) => {
|
|
168
|
+
g(t.target.value), F && F(t);
|
|
169
|
+
};
|
|
170
|
+
return /* @__PURE__ */ N("div", { className: ve, children: [
|
|
171
|
+
/* @__PURE__ */ N("div", { className: xe, children: [
|
|
172
|
+
/* @__PURE__ */ N("label", { className: Ne, id: j, htmlFor: n, children: [
|
|
173
|
+
b,
|
|
174
|
+
H && /* @__PURE__ */ a(Re, {})
|
|
175
|
+
] }),
|
|
176
|
+
D && !M && /* @__PURE__ */ a(Ee, { placement: "top", defaultAnchorButtonProps: z, children: D })
|
|
177
|
+
] }),
|
|
178
|
+
y && /* @__PURE__ */ a("div", { className: e.hint, id: U, children: y }),
|
|
179
|
+
/* @__PURE__ */ a(
|
|
180
|
+
"div",
|
|
181
|
+
{
|
|
182
|
+
"aria-live": "polite",
|
|
183
|
+
"aria-atomic": "true",
|
|
184
|
+
className: e.valueAnnouncer,
|
|
185
|
+
id: G,
|
|
186
|
+
children: w
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ N("div", { className: e.wrapper, children: [
|
|
190
|
+
u && /* @__PURE__ */ a(
|
|
191
|
+
"span",
|
|
192
|
+
{
|
|
193
|
+
className: r(X, e.prefix),
|
|
194
|
+
ref: B,
|
|
195
|
+
"aria-disabled": s,
|
|
196
|
+
children: be
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ a(
|
|
200
|
+
"input",
|
|
201
|
+
{
|
|
202
|
+
className: Ie,
|
|
203
|
+
id: n,
|
|
204
|
+
...te,
|
|
205
|
+
style: de,
|
|
206
|
+
ref: fe,
|
|
207
|
+
"aria-labelledby": `${j}${he}`,
|
|
208
|
+
"aria-describedby": Ae(),
|
|
209
|
+
"aria-invalid": v,
|
|
210
|
+
"aria-disabled": l,
|
|
211
|
+
disabled: s,
|
|
212
|
+
min: $,
|
|
213
|
+
max: V,
|
|
214
|
+
readOnly: l,
|
|
215
|
+
required: H,
|
|
216
|
+
step: ee,
|
|
217
|
+
type: "number",
|
|
218
|
+
value: p,
|
|
219
|
+
onChange: we
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
c && /* @__PURE__ */ a(
|
|
223
|
+
"span",
|
|
224
|
+
{
|
|
225
|
+
className: r(X, e.suffix),
|
|
226
|
+
ref: L,
|
|
227
|
+
"aria-disabled": s,
|
|
228
|
+
children: _e
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ a(Q, { ...se, hideLabel: !0, theme: "light", iconName: "minus", variant: "filled", className: ye, size: i, onClick: Se, tooltip: ae, disabled: s || l || Y(p) && Number(p) <= Number($), type: "button", children: ne }),
|
|
232
|
+
/* @__PURE__ */ a(Q, { ...ie, hideLabel: !0, theme: "light", iconName: "plus", variant: "filled", tooltip: re, className: De, size: i, onClick: ge, disabled: s || l || Y(p) && Number(p) >= Number(V), type: "button", children: oe })
|
|
233
|
+
] }),
|
|
234
|
+
v && A && /* @__PURE__ */ a(We, { className: e.feedback, message: A, variant: "error", id: q })
|
|
235
|
+
] });
|
|
236
|
+
});
|
|
237
|
+
nt.displayName = "DSInputNumber";
|
|
238
|
+
export {
|
|
239
|
+
nt as D,
|
|
240
|
+
Y as i,
|
|
241
|
+
tt as v
|
|
242
|
+
};
|