@tedi-design-system/react 18.1.0-rc.20 → 18.1.0-rc.22
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/bundle-stats.html +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/package.json +1 -1
- package/src/tedi/components/buttons/button-content/button-content.cjs.js +1 -1
- package/src/tedi/components/buttons/button-content/button-content.es.js +31 -30
- package/src/tedi/components/form/number-field/number-field.cjs.js +1 -1
- package/src/tedi/components/form/number-field/number-field.es.js +117 -112
- package/src/tedi/components/loaders/spinner/spinner.cjs.js +1 -1
- package/src/tedi/components/loaders/spinner/spinner.d.ts +7 -0
- package/src/tedi/components/loaders/spinner/spinner.es.js +29 -18
- package/src/tedi/components/overlays/overlay/overlay-content.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-content.es.js +14 -12
- package/src/tedi/components/overlays/overlay/overlay-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-trigger.es.js +16 -16
- package/src/tedi/components/overlays/overlay/overlay.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay.d.ts +10 -0
- package/src/tedi/components/overlays/overlay/overlay.es.js +74 -71
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +6 -6
- package/src/tedi/providers/label-provider/labels-map.es.js +9 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.cjs2.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.cjs2.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.cjs4.js"),r=require("./cjs/react-is.production.min.cjs.js"),o=require("./cjs/react-is.development.cjs.js");process.env.NODE_ENV==="production"?e.__module.exports=r.__require():e.__module.exports=o.__require();var t=e.__module.exports;exports.reactIsExports=t;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as r } from "../../../../_virtual/index.
|
|
1
|
+
import { __module as r } from "../../../../_virtual/index.es4.js";
|
|
2
2
|
import { __require as e } from "./cjs/react-is.production.min.es.js";
|
|
3
3
|
import { __require as o } from "./cjs/react-is.development.es.js";
|
|
4
4
|
process.env.NODE_ENV === "production" ? r.exports = e() : r.exports = o();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.development.cjs.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../_virtual/react-is.production.min.cjs.js");/** @license React v16.13.1
|
|
2
2
|
* react-is.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../_virtual/index.cjs3.js"),t=require("./cjs/react-is.production.min.cjs.js"),o=require("./cjs/react-is.development.cjs.js");var r;function u(){return r||(r=1,process.env.NODE_ENV==="production"?e.__module.exports=t.__require():e.__module.exports=o.__require()),e.__module.exports}exports.__require=u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as e } from "../../../../_virtual/index.
|
|
1
|
+
import { __module as e } from "../../../../_virtual/index.es3.js";
|
|
2
2
|
import { __require as o } from "./cjs/react-is.production.min.es.js";
|
|
3
3
|
import { __require as t } from "./cjs/react-is.development.es.js";
|
|
4
4
|
var r;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),l=require("../../../../../external/classnames/index.cjs.js"),D=require("react"),F=require("../../base/icon/icon.cjs.js"),q=require("../../loaders/spinner/spinner.cjs.js"),G=require("../../misc/print/print.cjs.js"),t=require("./button-content.module.scss.cjs.js"),b=require("../../overlays/tooltip/tooltip.cjs.js"),T=D.forwardRef(({children:d,as:g,_text:J,className:p,visualType:h="primary",color:E="default",size:o,icon:r,iconLeft:u,iconRight:i,underline:M=!1,isHovered:P,isActive:w,isLoading:s=!1,noStyle:m,_renderWrapperElement:K,fullWidth:_,onClick:x,showTooltip:S=!1,...j},A)=>{const y=g||"button",v=r||u||i,H=m?l.default(t.default["tedi-btn--no-style"],{[t.default["tedi-btn--full-width"]]:_},p):l.default(t.default["tedi-btn"],t.default[`tedi-btn--${h}`],t.default[`tedi-btn--${E}`],{[t.default[`tedi-btn--${o}`]]:o},{[t.default["tedi-btn--underline"]]:M},{[t.default["tedi-btn--is-hovered"]]:P},{[t.default["tedi-btn--is-active"]]:w},{[t.default["tedi-btn--is-loading"]]:s},{[t.default["tedi-btn--icon-only"]]:r},{[t.default["tedi-btn--icon"]]:v},{[t.default["tedi-btn--full-width"]]:_},p),f=(e,a)=>{const z=l.default(t.default["tedi-btn__icon"],t.default[`tedi-btn__icon--${e}`],{[t.default["tedi-btn__spinner"]]:s,[t.default["tedi-btn__icon-responsive"]]:y==="a"&&o==="small"}),c={size:o==="large"?24:18,className:z},B=typeof a=="string"?{...c,name:a}:{...c,...a,className:l.default(c.className,a==null?void 0:a.className)};return s?n.jsx(q.Spinner,{className:B.className,size:18,decorative:!0}):n.jsx(F.Icon,{...B})},O=()=>{const e=s?n.jsx(q.Spinner,{position:v?void 0:"absolute",className:l.default(t.default["tedi-btn__spinner"],t.default["tedi-btn__spinner--left"]),size:18,decorative:!0}):u?f("left",u):r?f("center",r):null;return n.jsxs("span",{className:t.default["tedi-btn__inner"],children:[e,n.jsx("span",{className:t.default["tedi-btn__text"],children:d}),!s&&i&&f("right",i)]})},k=e=>{x&&!s&&x(e)},R=!!r,C=(e=>{if(typeof e=="string")return e;if(Array.isArray(e))return e.map(a=>typeof a=="string"?a:"").join("").trim()})(d),N=n.jsx(y,{"data-name":"button-content",...j,"aria-disabled":s||j["aria-disabled"],"aria-busy":s||void 0,onClick:k,ref:A,className:H,children:m?d:O()});return n.jsx(G.Print,{visibility:"hide",children:S&&R&&C?n.jsxs(b.Tooltip,{ariaHidden:!0,children:[n.jsx(b.Tooltip.Trigger,{children:N}),n.jsx(b.Tooltip.Content,{children:C})]}):N})});T.displayName="ButtonContent";const I=T;exports.ButtonContent=I;exports.default=I;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o, jsxs as T } from "react/jsx-runtime";
|
|
2
2
|
import a from "../../../../../external/classnames/index.es.js";
|
|
3
3
|
import { forwardRef as F } from "react";
|
|
4
4
|
import { Icon as G } from "../../base/icon/icon.es.js";
|
|
5
5
|
import { Spinner as h } from "../../loaders/spinner/spinner.es.js";
|
|
6
6
|
import { Print as J } from "../../misc/print/print.es.js";
|
|
7
7
|
import t from "./button-content.module.scss.es.js";
|
|
8
|
-
import { Tooltip as
|
|
8
|
+
import { Tooltip as p } from "../../overlays/tooltip/tooltip.es.js";
|
|
9
9
|
const E = F(
|
|
10
10
|
({
|
|
11
11
|
children: l,
|
|
12
12
|
as: $,
|
|
13
13
|
_text: K,
|
|
14
|
-
className:
|
|
14
|
+
className: u,
|
|
15
15
|
visualType: j = "primary",
|
|
16
16
|
color: w = "default",
|
|
17
17
|
size: i,
|
|
18
|
-
icon:
|
|
18
|
+
icon: s,
|
|
19
19
|
iconLeft: d,
|
|
20
20
|
iconRight: m,
|
|
21
21
|
underline: P = !1,
|
|
22
22
|
isHovered: g,
|
|
23
23
|
isActive: A,
|
|
24
24
|
isLoading: r = !1,
|
|
25
|
-
noStyle:
|
|
25
|
+
noStyle: f,
|
|
26
26
|
_renderWrapperElement: Q,
|
|
27
27
|
fullWidth: _,
|
|
28
28
|
onClick: y,
|
|
29
|
-
showTooltip:
|
|
29
|
+
showTooltip: H = !1,
|
|
30
30
|
...N
|
|
31
|
-
},
|
|
32
|
-
const
|
|
31
|
+
}, M) => {
|
|
32
|
+
const v = $ || "button", x = s || d || m, k = f ? a(t["tedi-btn--no-style"], { [t["tedi-btn--full-width"]]: _ }, u) : a(
|
|
33
33
|
t["tedi-btn"],
|
|
34
34
|
t[`tedi-btn--${j}`],
|
|
35
35
|
t[`tedi-btn--${w}`],
|
|
@@ -38,56 +38,57 @@ const E = F(
|
|
|
38
38
|
{ [t["tedi-btn--is-hovered"]]: g },
|
|
39
39
|
{ [t["tedi-btn--is-active"]]: A },
|
|
40
40
|
{ [t["tedi-btn--is-loading"]]: r },
|
|
41
|
-
{ [t["tedi-btn--icon-only"]]:
|
|
42
|
-
{ [t["tedi-btn--icon"]]:
|
|
41
|
+
{ [t["tedi-btn--icon-only"]]: s },
|
|
42
|
+
{ [t["tedi-btn--icon"]]: x },
|
|
43
43
|
{ [t["tedi-btn--full-width"]]: _ },
|
|
44
|
-
|
|
44
|
+
u
|
|
45
45
|
), b = (e, n) => {
|
|
46
46
|
const D = a(t["tedi-btn__icon"], t[`tedi-btn__icon--${e}`], {
|
|
47
47
|
[t["tedi-btn__spinner"]]: r,
|
|
48
|
-
[t["tedi-btn__icon-responsive"]]:
|
|
49
|
-
}),
|
|
48
|
+
[t["tedi-btn__icon-responsive"]]: v === "a" && i === "small"
|
|
49
|
+
}), c = {
|
|
50
50
|
size: i === "large" ? 24 : 18,
|
|
51
51
|
className: D
|
|
52
|
-
}, I = typeof n == "string" ? { ...
|
|
53
|
-
return r ? /* @__PURE__ */
|
|
52
|
+
}, I = typeof n == "string" ? { ...c, name: n } : { ...c, ...n, className: a(c.className, n == null ? void 0 : n.className) };
|
|
53
|
+
return r ? /* @__PURE__ */ o(h, { className: I.className, size: 18, decorative: !0 }) : /* @__PURE__ */ o(G, { ...I });
|
|
54
54
|
}, O = () => {
|
|
55
|
-
const e = r ? /* @__PURE__ */
|
|
55
|
+
const e = r ? /* @__PURE__ */ o(
|
|
56
56
|
h,
|
|
57
57
|
{
|
|
58
|
-
position:
|
|
58
|
+
position: x ? void 0 : "absolute",
|
|
59
59
|
className: a(t["tedi-btn__spinner"], t["tedi-btn__spinner--left"]),
|
|
60
|
-
size: 18
|
|
60
|
+
size: 18,
|
|
61
|
+
decorative: !0
|
|
61
62
|
}
|
|
62
|
-
) : d ? b("left", d) :
|
|
63
|
+
) : d ? b("left", d) : s ? b("center", s) : null;
|
|
63
64
|
return /* @__PURE__ */ T("span", { className: t["tedi-btn__inner"], children: [
|
|
64
65
|
e,
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ o("span", { className: t["tedi-btn__text"], children: l }),
|
|
66
67
|
!r && m && b("right", m)
|
|
67
68
|
] });
|
|
68
69
|
}, q = (e) => {
|
|
69
70
|
y && !r && y(e);
|
|
70
|
-
}, z = !!
|
|
71
|
+
}, z = !!s, B = ((e) => {
|
|
71
72
|
if (typeof e == "string") return e;
|
|
72
73
|
if (Array.isArray(e))
|
|
73
74
|
return e.map((n) => typeof n == "string" ? n : "").join("").trim();
|
|
74
|
-
})(l),
|
|
75
|
-
|
|
75
|
+
})(l), C = /* @__PURE__ */ o(
|
|
76
|
+
v,
|
|
76
77
|
{
|
|
77
78
|
"data-name": "button-content",
|
|
78
79
|
...N,
|
|
79
80
|
"aria-disabled": r || N["aria-disabled"],
|
|
80
81
|
"aria-busy": r || void 0,
|
|
81
82
|
onClick: q,
|
|
82
|
-
ref:
|
|
83
|
-
className:
|
|
84
|
-
children:
|
|
83
|
+
ref: M,
|
|
84
|
+
className: k,
|
|
85
|
+
children: f ? l : O()
|
|
85
86
|
}
|
|
86
87
|
);
|
|
87
|
-
return /* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
] }) :
|
|
88
|
+
return /* @__PURE__ */ o(J, { visibility: "hide", children: H && z && B ? /* @__PURE__ */ T(p, { ariaHidden: !0, children: [
|
|
89
|
+
/* @__PURE__ */ o(p.Trigger, { children: C }),
|
|
90
|
+
/* @__PURE__ */ o(p.Content, { children: B })
|
|
91
|
+
] }) : C });
|
|
91
92
|
}
|
|
92
93
|
);
|
|
93
94
|
E.displayName = "ButtonContent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),T=require("../../../../../external/classnames/index.cjs.js"),r=require("react"),ce=require("../../base/typography/text/text.cjs.js"),fe=require("../../buttons/button/button.cjs.js"),me=require("../feedback-text/feedback-text.cjs.js"),be=require("../form-label/form-label.cjs.js"),i=require("./number-field.module.scss.cjs.js"),pe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),ve=require("../../../providers/label-provider/use-labels.cjs.js"),U=g=>{const{getCurrentBreakpointProps:G}=pe.useBreakpointProps(g.defaultServerBreakpoint),{getLabel:h,locale:J}=ve.useLabels(),K=J==="en"?".":",",{id:Q,label:k,hideLabel:X,required:w,className:C,size:q,inputMode:Y,decimalPlaces:x,decimalSeparator:j=K,min:d,max:o,step:M=1,defaultValue:O,value:c,onChange:a,suffix:S,fullWidth:Z=!1,disabled:N=!1,invalid:R=!1,helper:u,input:_}=G(g),ee=r.useId(),E=Q??ee,te=Y??(x&&x>0||j===","?"decimal":"numeric"),m=r.useCallback(e=>e===void 0?"":j===","?String(e).replace(".",","):String(e),[j]),y=r.useRef(null),B=r.useRef(!1),[ne,L]=r.useState(""),[re,V]=r.useState(O),[ie,I]=r.useState(()=>m(c??O)),F=c!==void 0,n=F?c:re,b=r.useRef(),p=r.useRef(),P=r.useRef(n);r.useEffect(()=>{!B.current&&typeof c<"u"&&I(m(c))},[c,m]);const $=u?`${E}-helper`:void 0,z=r.useCallback(e=>{if(e===void 0)return R||(u==null?void 0:u.type)==="error";const t=d!==void 0&&e<d,l=o!==void 0&&e>o;return R||t||l||(u==null?void 0:u.type)==="error"},[R,u,o,d]),A=e=>Math.min(o??1/0,Math.max(d??-1/0,e)),D=r.useCallback(e=>{e&&(L(""),b.current&&clearTimeout(b.current),p.current&&clearTimeout(p.current),b.current=setTimeout(()=>{L(e),p.current=setTimeout(()=>L(""),5e3)},100))},[]);r.useEffect(()=>()=>{b.current&&clearTimeout(b.current),p.current&&clearTimeout(p.current)},[]),r.useEffect(()=>{P.current!==n&&(!B.current&&n!==void 0&&D(h("numberField.quantityUpdated",n)),P.current=n)},[n,D,h]);const W=e=>x!==void 0?parseFloat(e.toFixed(x)):e,ue=e=>{let t=n??0;e==="increment"&&(t=t+M),e==="decrement"&&(t=t-M),t=A(t),t=W(t),a==null||a(t),F||V(t),I(m(t))},ae=({currentTarget:{value:e}})=>{if(I(e),e===""){n!==void 0&&(a==null||a(void 0),F||V(void 0));return}const t=e.replace(",",".");if(!/^-?(\d+(\.\d*)?|\.\d+)$/.test(t))return;const l=parseFloat(t);if(Number.isNaN(l))return;const f=A(l),v=W(f);v!==n&&(a==null||a(v),F||V(v))},se=()=>{B.current=!0},le=()=>{B.current=!1,I(m(n))},H=e=>{const t=n!==void 0&&(e==="increment"?o!==void 0&&n>=o:d!==void 0&&n<=d),l=T.default(i.default["tedi-number-field__button"],i.default[`tedi-number-field__button--${e}`],{[i.default["tedi-number-field__button--disabled"]]:t||N}),f=typeof k=="string"?k:void 0,v=h(`numberField.${e}`,M,f);return s.jsx(fe.Button,{"aria-label":v,onClick:()=>ue(e),disabled:t||N,visualType:"secondary",className:l,icon:{name:e==="increment"?"add":"remove"},size:q==="small"?"small":void 0,children:e==="increment"?"+":"-"})},de=()=>{const e=T.default(i.default["tedi-number-field__input-wrapper"],{[i.default["tedi-number-field__input-wrapper--with-suffix"]]:S,[i.default["tedi-number-field__input-wrapper--full-width"]]:Z}),t=T.default(i.default["tedi-number-field__input"],_==null?void 0:_.className),l=()=>{var f;return(f=y==null?void 0:y.current)==null?void 0:f.focus()};return s.jsxs("div",{className:e,onClick:l,children:[s.jsx("input",{ref:y,id:E,role:"spinbutton","aria-valuemin":d,"aria-valuemax":o,"aria-valuenow":n,"aria-describedby":$,"aria-invalid":z(n)?"true":"false",type:"text",inputMode:te,value:ie,required:w,disabled:N,onChange:ae,onFocus:se,onBlur:le,className:t,..._}),S&&s.jsx(ce.Text,{element:"span",modifiers:"small",color:"tertiary",className:i.default["tedi-number-field__suffix"],children:S})]})},oe=T.default(i.default["tedi-number-field"],{[i.default["tedi-number-field--invalid"]]:z(n)},{[i.default["tedi-number-field--disabled"]]:N},{[i.default["tedi-number-field--small"]]:q==="small"},C);return s.jsxs("div",{"data-name":"number-field",className:C,children:[s.jsx(be.FormLabel,{id:E,label:k,required:w,hideLabel:X,size:q}),s.jsxs("div",{className:oe,children:[H("decrement"),de(),H("increment")]}),u&&s.jsx(me.FeedbackText,{className:i.default["tedi-number-field__feedback"],...u,id:$}),s.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:ne})]})};U.displayName="NumberField";exports.NumberField=U;
|
|
@@ -1,145 +1,150 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { Text as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { FeedbackText as
|
|
7
|
-
import { FormLabel as
|
|
1
|
+
import { jsxs as $, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import F from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useId as pe, useCallback as z, useRef as v, useState as C, useEffect as P } from "react";
|
|
4
|
+
import { Text as be } from "../../base/typography/text/text.es.js";
|
|
5
|
+
import { Button as ve } from "../../buttons/button/button.es.js";
|
|
6
|
+
import { FeedbackText as Ne } from "../feedback-text/feedback-text.es.js";
|
|
7
|
+
import { FormLabel as _e } from "../form-label/form-label.es.js";
|
|
8
8
|
import n from "./number-field.module.scss.es.js";
|
|
9
|
-
import { useBreakpointProps as
|
|
10
|
-
import { useLabels as
|
|
11
|
-
const
|
|
12
|
-
const { getCurrentBreakpointProps:
|
|
13
|
-
id:
|
|
14
|
-
label:
|
|
15
|
-
hideLabel:
|
|
16
|
-
required:
|
|
17
|
-
className:
|
|
18
|
-
size:
|
|
19
|
-
inputMode:
|
|
20
|
-
decimalPlaces:
|
|
21
|
-
decimalSeparator:
|
|
22
|
-
min:
|
|
23
|
-
max:
|
|
24
|
-
step:
|
|
25
|
-
defaultValue:
|
|
26
|
-
value:
|
|
27
|
-
onChange:
|
|
28
|
-
suffix:
|
|
29
|
-
fullWidth:
|
|
30
|
-
disabled:
|
|
31
|
-
invalid:
|
|
32
|
-
helper:
|
|
33
|
-
input:
|
|
34
|
-
} =
|
|
35
|
-
(e) => e === void 0 ? "" :
|
|
36
|
-
[
|
|
37
|
-
),
|
|
38
|
-
|
|
39
|
-
!
|
|
40
|
-
}, [
|
|
41
|
-
const
|
|
9
|
+
import { useBreakpointProps as ye } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
10
|
+
import { useLabels as Be } from "../../../providers/label-provider/use-labels.es.js";
|
|
11
|
+
const Ie = (j) => {
|
|
12
|
+
const { getCurrentBreakpointProps: Q } = ye(j.defaultServerBreakpoint), { getLabel: T, locale: X } = Be(), Y = X === "en" ? "." : ",", {
|
|
13
|
+
id: Z,
|
|
14
|
+
label: M,
|
|
15
|
+
hideLabel: ee,
|
|
16
|
+
required: q,
|
|
17
|
+
className: A,
|
|
18
|
+
size: k,
|
|
19
|
+
inputMode: te,
|
|
20
|
+
decimalPlaces: N,
|
|
21
|
+
decimalSeparator: S = Y,
|
|
22
|
+
min: a,
|
|
23
|
+
max: l,
|
|
24
|
+
step: V = 1,
|
|
25
|
+
defaultValue: D,
|
|
26
|
+
value: u,
|
|
27
|
+
onChange: o,
|
|
28
|
+
suffix: w,
|
|
29
|
+
fullWidth: re = !1,
|
|
30
|
+
disabled: _ = !1,
|
|
31
|
+
invalid: E = !1,
|
|
32
|
+
helper: i,
|
|
33
|
+
input: y
|
|
34
|
+
} = Q(j), ne = pe(), L = Z ?? ne, ie = te ?? (N && N > 0 || S === "," ? "decimal" : "numeric"), m = z(
|
|
35
|
+
(e) => e === void 0 ? "" : S === "," ? String(e).replace(".", ",") : String(e),
|
|
36
|
+
[S]
|
|
37
|
+
), B = v(null), I = v(!1), [oe, g] = C(""), [ae, O] = C(D), [le, h] = C(() => m(u ?? D)), x = u !== void 0, r = x ? u : ae, f = v(), p = v(), R = v(r);
|
|
38
|
+
P(() => {
|
|
39
|
+
!I.current && typeof u < "u" && h(m(u));
|
|
40
|
+
}, [u, m]);
|
|
41
|
+
const W = i ? `${L}-helper` : void 0, H = z(
|
|
42
42
|
(e) => {
|
|
43
43
|
if (e === void 0)
|
|
44
|
-
return
|
|
45
|
-
const t =
|
|
46
|
-
return
|
|
44
|
+
return E || (i == null ? void 0 : i.type) === "error";
|
|
45
|
+
const t = a !== void 0 && e < a, s = l !== void 0 && e > l;
|
|
46
|
+
return E || t || s || (i == null ? void 0 : i.type) === "error";
|
|
47
47
|
},
|
|
48
|
-
[
|
|
49
|
-
),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
[E, i, l, a]
|
|
49
|
+
), U = (e) => Math.min(l ?? 1 / 0, Math.max(a ?? -1 / 0, e)), G = z((e) => {
|
|
50
|
+
e && (g(""), f.current && clearTimeout(f.current), p.current && clearTimeout(p.current), f.current = setTimeout(() => {
|
|
51
|
+
g(e), p.current = setTimeout(() => g(""), 5e3);
|
|
52
|
+
}, 100));
|
|
53
|
+
}, []);
|
|
54
|
+
P(() => () => {
|
|
55
|
+
f.current && clearTimeout(f.current), p.current && clearTimeout(p.current);
|
|
56
|
+
}, []), P(() => {
|
|
57
|
+
R.current !== r && (!I.current && r !== void 0 && G(T("numberField.quantityUpdated", r)), R.current = r);
|
|
58
|
+
}, [r, G, T]);
|
|
59
|
+
const J = (e) => N !== void 0 ? parseFloat(e.toFixed(N)) : e, se = (e) => {
|
|
60
|
+
let t = r ?? 0;
|
|
61
|
+
e === "increment" && (t = t + V), e === "decrement" && (t = t - V), t = U(t), t = J(t), o == null || o(t), x || O(t), h(m(t));
|
|
62
|
+
}, ue = ({ currentTarget: { value: e } }) => {
|
|
63
|
+
if (h(e), e === "") {
|
|
64
|
+
r !== void 0 && (o == null || o(void 0), x || O(void 0));
|
|
60
65
|
return;
|
|
61
66
|
}
|
|
62
67
|
const t = e.replace(",", ".");
|
|
63
68
|
if (!/^-?(\d+(\.\d*)?|\.\d+)$/.test(t))
|
|
64
69
|
return;
|
|
65
|
-
const
|
|
66
|
-
if (Number.isNaN(
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
const t =
|
|
75
|
-
[n["tedi-number-field__button--disabled"]]: t ||
|
|
76
|
-
}),
|
|
70
|
+
const s = parseFloat(t);
|
|
71
|
+
if (Number.isNaN(s)) return;
|
|
72
|
+
const d = U(s), b = J(d);
|
|
73
|
+
b !== r && (o == null || o(b), x || O(b));
|
|
74
|
+
}, de = () => {
|
|
75
|
+
I.current = !0;
|
|
76
|
+
}, ce = () => {
|
|
77
|
+
I.current = !1, h(m(r));
|
|
78
|
+
}, K = (e) => {
|
|
79
|
+
const t = r !== void 0 && (e === "increment" ? l !== void 0 && r >= l : a !== void 0 && r <= a), s = F(n["tedi-number-field__button"], n[`tedi-number-field__button--${e}`], {
|
|
80
|
+
[n["tedi-number-field__button--disabled"]]: t || _
|
|
81
|
+
}), d = typeof M == "string" ? M : void 0, b = T(`numberField.${e}`, V, d);
|
|
77
82
|
return /* @__PURE__ */ c(
|
|
78
|
-
|
|
83
|
+
ve,
|
|
79
84
|
{
|
|
80
|
-
"aria-label":
|
|
81
|
-
onClick: () =>
|
|
82
|
-
disabled: t ||
|
|
85
|
+
"aria-label": b,
|
|
86
|
+
onClick: () => se(e),
|
|
87
|
+
disabled: t || _,
|
|
83
88
|
visualType: "secondary",
|
|
84
|
-
className:
|
|
89
|
+
className: s,
|
|
85
90
|
icon: { name: e === "increment" ? "add" : "remove" },
|
|
86
|
-
size:
|
|
91
|
+
size: k === "small" ? "small" : void 0,
|
|
87
92
|
children: e === "increment" ? "+" : "-"
|
|
88
93
|
}
|
|
89
94
|
);
|
|
90
|
-
},
|
|
91
|
-
const e =
|
|
92
|
-
[n["tedi-number-field__input-wrapper--with-suffix"]]:
|
|
93
|
-
[n["tedi-number-field__input-wrapper--full-width"]]:
|
|
94
|
-
}), t =
|
|
95
|
-
return /* @__PURE__ */
|
|
96
|
-
var
|
|
97
|
-
return (
|
|
95
|
+
}, me = () => {
|
|
96
|
+
const e = F(n["tedi-number-field__input-wrapper"], {
|
|
97
|
+
[n["tedi-number-field__input-wrapper--with-suffix"]]: w,
|
|
98
|
+
[n["tedi-number-field__input-wrapper--full-width"]]: re
|
|
99
|
+
}), t = F(n["tedi-number-field__input"], y == null ? void 0 : y.className);
|
|
100
|
+
return /* @__PURE__ */ $("div", { className: e, onClick: () => {
|
|
101
|
+
var d;
|
|
102
|
+
return (d = B == null ? void 0 : B.current) == null ? void 0 : d.focus();
|
|
98
103
|
}, children: [
|
|
99
104
|
/* @__PURE__ */ c(
|
|
100
105
|
"input",
|
|
101
106
|
{
|
|
102
|
-
ref:
|
|
103
|
-
id:
|
|
107
|
+
ref: B,
|
|
108
|
+
id: L,
|
|
104
109
|
role: "spinbutton",
|
|
105
|
-
"aria-valuemin":
|
|
106
|
-
"aria-valuemax":
|
|
107
|
-
"aria-valuenow":
|
|
108
|
-
"aria-describedby":
|
|
109
|
-
"aria-invalid":
|
|
110
|
+
"aria-valuemin": a,
|
|
111
|
+
"aria-valuemax": l,
|
|
112
|
+
"aria-valuenow": r,
|
|
113
|
+
"aria-describedby": W,
|
|
114
|
+
"aria-invalid": H(r) ? "true" : "false",
|
|
110
115
|
type: "text",
|
|
111
|
-
inputMode:
|
|
112
|
-
value:
|
|
113
|
-
required:
|
|
114
|
-
disabled:
|
|
115
|
-
onChange:
|
|
116
|
-
onFocus:
|
|
117
|
-
onBlur:
|
|
116
|
+
inputMode: ie,
|
|
117
|
+
value: le,
|
|
118
|
+
required: q,
|
|
119
|
+
disabled: _,
|
|
120
|
+
onChange: ue,
|
|
121
|
+
onFocus: de,
|
|
122
|
+
onBlur: ce,
|
|
118
123
|
className: t,
|
|
119
|
-
...
|
|
124
|
+
...y
|
|
120
125
|
}
|
|
121
126
|
),
|
|
122
|
-
|
|
127
|
+
w && /* @__PURE__ */ c(be, { element: "span", modifiers: "small", color: "tertiary", className: n["tedi-number-field__suffix"], children: w })
|
|
123
128
|
] });
|
|
124
|
-
},
|
|
129
|
+
}, fe = F(
|
|
125
130
|
n["tedi-number-field"],
|
|
126
|
-
{ [n["tedi-number-field--invalid"]]:
|
|
127
|
-
{ [n["tedi-number-field--disabled"]]:
|
|
128
|
-
{ [n["tedi-number-field--small"]]:
|
|
129
|
-
|
|
131
|
+
{ [n["tedi-number-field--invalid"]]: H(r) },
|
|
132
|
+
{ [n["tedi-number-field--disabled"]]: _ },
|
|
133
|
+
{ [n["tedi-number-field--small"]]: k === "small" },
|
|
134
|
+
A
|
|
130
135
|
);
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */ c(
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
return /* @__PURE__ */ $("div", { "data-name": "number-field", className: A, children: [
|
|
137
|
+
/* @__PURE__ */ c(_e, { id: L, label: M, required: q, hideLabel: ee, size: k }),
|
|
138
|
+
/* @__PURE__ */ $("div", { className: fe, children: [
|
|
139
|
+
K("decrement"),
|
|
140
|
+
me(),
|
|
141
|
+
K("increment")
|
|
137
142
|
] }),
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
i && /* @__PURE__ */ c(Ne, { className: n["tedi-number-field__feedback"], ...i, id: W }),
|
|
144
|
+
/* @__PURE__ */ c("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: oe })
|
|
140
145
|
] });
|
|
141
146
|
};
|
|
142
|
-
|
|
147
|
+
Ie.displayName = "NumberField";
|
|
143
148
|
export {
|
|
144
|
-
|
|
149
|
+
Ie as NumberField
|
|
145
150
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),p=require("../../../../../external/classnames/index.cjs.js"),e=require("./spinner.module.scss.cjs.js"),f=require("../../../providers/label-provider/use-labels.cjs.js"),v=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),m=r=>{const{getLabel:o}=f.useLabels(),{getCurrentBreakpointProps:l}=v.useBreakpointProps(r.defaultServerBreakpoint),{className:d,size:s=16,color:t="primary",label:c=o("spinner.loading"),position:a,decorative:i=!1}=l(r),u=p.default(e.default["tedi-spinner"],d,a&&e.default[`tedi-spinner--${a}`],s&&e.default[`tedi-spinner--size-${s}`],t&&e.default[`tedi-spinner--color-${t}`]);return n.jsxs("span",{className:u,role:i?void 0:"status","aria-live":i?void 0:"polite","aria-hidden":i||void 0,"data-testid":"tedi-spinner",children:[n.jsx("svg",{viewBox:"22 22 44 44","aria-hidden":"true",children:n.jsx("circle",{className:e.default["tedi-spinner__inner"],cx:"44",cy:"44",r:"20",fill:"none"})}),!i&&n.jsx("span",{className:"sr-only",children:c})]})};exports.Spinner=m;
|
|
@@ -33,6 +33,13 @@ export interface SpinnerProps extends BreakpointSupport<SpinnerBreakpointProps>
|
|
|
33
33
|
* Provides a text label for screen readers to announce the spinner's purpose or status.
|
|
34
34
|
*/
|
|
35
35
|
label?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Renders the spinner as purely decorative — no `role="status"` live region and
|
|
38
|
+
* no screen-reader label. Use when the loading state is already announced by an
|
|
39
|
+
* ancestor (e.g. a button's `aria-busy`), so it isn't announced twice.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
decorative?: boolean;
|
|
36
43
|
}
|
|
37
44
|
export declare const Spinner: (props: SpinnerProps) => JSX.Element;
|
|
38
45
|
export {};
|