@tedi-design-system/react 17.1.0-rc.7 → 17.1.0-rc.8
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/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +70 -70
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +110 -110
- package/src/tedi/components/form/time-field/time-field-helpers.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field-helpers.d.ts +51 -0
- package/src/tedi/components/form/time-field/time-field-helpers.es.js +65 -0
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field.d.ts +87 -0
- package/src/tedi/components/form/time-field/time-field.es.js +149 -0
- package/src/tedi/components/form/time-field/time-field.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/time-field/time-field.module.scss.es.js +10 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.d.ts +38 -0
- package/src/tedi/components/form/time-picker/components/time-grid/time-grid.es.js +101 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.d.ts +40 -0
- package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.es.js +184 -0
- package/src/tedi/components/form/time-picker/time-picker.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/time-picker.d.ts +60 -0
- package/src/tedi/components/form/time-picker/time-picker.es.js +45 -0
- package/src/tedi/components/form/time-picker/time-picker.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/time-picker/time-picker.module.scss.es.js +14 -0
- package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.d.ts +9 -0
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +98 -88
- package/src/tedi/index.d.ts +2 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +7 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +9 -2
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +170 -166
package/package.json
CHANGED
package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),h=require("../../../../../../../external/classnames/index.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),h=require("../../../../../../../external/classnames/index.cjs.js"),S=require("react"),A=require("../../../checkbox/checkbox.cjs.js"),H=require("../../../feedback-text/feedback-text.cjs.js"),L=require("../../../radio/radio.cjs.js"),O=require("../../choice-group-context.cjs.js"),e=require("./choice-group-item.module.scss.cjs.js"),V=require("../../../../../helpers/hooks/use-breakpoint-props.cjs.js"),z=require("../../../../layout/grid/col.cjs.js"),_=n=>{const{getCurrentBreakpointProps:q}=V.useBreakpointProps(n.defaultServerBreakpoint),{id:a,label:C,value:d,className:N,direction:m,disabled:r,colProps:I=m==="column"?{width:12}:{width:"auto"},onChange:p,hideLabel:B,helper:u,tooltip:$,type:o="radio",variant:s="default",color:G="primary",layout:P,showIndicator:x,justifyContent:b="start"}=q(n),{currentValue:l,name:v,onChange:f,inputType:M}=S.useContext(O.ChoiceGroupContext),i=Array.isArray(l)?l.includes(d):d===l,R=l===void 0?n.defaultChecked:i,y=(c,k)=>{f==null||f(c,k),p==null||p(c,k)},T=h.default(e.default[`tedi-choice-group-item--${P==="separated"?"separated":"segmented"}`],m&&e.default[`tedi-choice-group-item--${m}`]),w=h.default(e.default["tedi-choice-group-item"],e.default[`tedi-choice-group-item--${s}`],e.default[`tedi-choice-group-item--${s}-${G}`],x&&e.default["tedi-choice-group-item--indicator"],o&&e.default[`tedi-choice-group-item--${o}`],{[e.default["tedi-choice-group-item--disabled"]]:r},{[e.default["tedi-choice-group-item--checked"]]:i},{[`justify-content-${b}`]:b}),E=o==="radio"?L.Radio:A.Checkbox,F=c=>{var j;r||s!=="card"||c.target.closest("input, label")||(j=document.getElementById(a))==null||j.click()},g=o==="radio";return t.jsx(z.Col,{...I,className:T,children:t.jsx("div",{className:w,tabIndex:g||r?-1:0,onClick:F,role:g?void 0:o,"aria-checked":g?void 0:i,children:s==="default"||x?t.jsx(E,{id:a,label:C,value:d,name:v,className:h.default(e.default["tedi-choice-group-item__indicator"],N),disabled:r,checked:i,defaultChecked:R,onChange:y,hideLabel:B,helper:u?{...u,className:h.default(e.default["tedi-choice-group-item__feedback-text"],u.className)}:void 0,tooltip:$,"data-testid":"choice-group-item-indicator","aria-checked":i}):t.jsxs(t.Fragment,{children:[t.jsx("input",{id:a,value:d,name:v,type:M,disabled:r,checked:i,defaultChecked:l===void 0?n.defaultChecked:void 0,onChange:c=>{y(d,c.target.checked)},className:"visually-hidden",role:o==="radio"?"radio":void 0,"aria-checked":i,tabIndex:-1}),t.jsxs("label",{htmlFor:a,className:e.default["tedi-choice-group-item__label"],children:[C,u&&t.jsx(H.FeedbackText,{...u,id:a,className:e.default["tedi-choice-group-item__feedback-text"]})]})]})})})};exports.ChoiceGroupItem=_;exports.default=_;
|
package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s, jsxs as _, Fragment as H } from "react/jsx-runtime";
|
|
2
2
|
import u from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
-
import
|
|
4
|
-
import { Checkbox as
|
|
5
|
-
import { FeedbackText as
|
|
6
|
-
import { Radio as
|
|
7
|
-
import { ChoiceGroupContext as
|
|
3
|
+
import L from "react";
|
|
4
|
+
import { Checkbox as S } from "../../../checkbox/checkbox.es.js";
|
|
5
|
+
import { FeedbackText as V } from "../../../feedback-text/feedback-text.es.js";
|
|
6
|
+
import { Radio as q } from "../../../radio/radio.es.js";
|
|
7
|
+
import { ChoiceGroupContext as z } from "../../choice-group-context.es.js";
|
|
8
8
|
import e from "./choice-group-item.module.scss.es.js";
|
|
9
|
-
import { useBreakpointProps as
|
|
10
|
-
import { Col as
|
|
11
|
-
const
|
|
12
|
-
const { getCurrentBreakpointProps:
|
|
13
|
-
id:
|
|
14
|
-
label:
|
|
15
|
-
value:
|
|
16
|
-
className:
|
|
9
|
+
import { useBreakpointProps as D } from "../../../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
10
|
+
import { Col as J } from "../../../../layout/grid/col.es.js";
|
|
11
|
+
const oe = (l) => {
|
|
12
|
+
const { getCurrentBreakpointProps: $ } = D(l.defaultServerBreakpoint), {
|
|
13
|
+
id: c,
|
|
14
|
+
label: C,
|
|
15
|
+
value: r,
|
|
16
|
+
className: B,
|
|
17
17
|
direction: h,
|
|
18
|
-
disabled:
|
|
19
|
-
colProps:
|
|
18
|
+
disabled: a,
|
|
19
|
+
colProps: I = h === "column" ? { width: 12 } : { width: "auto" },
|
|
20
20
|
onChange: p,
|
|
21
|
-
hideLabel:
|
|
22
|
-
helper:
|
|
23
|
-
tooltip:
|
|
24
|
-
type:
|
|
21
|
+
hideLabel: j,
|
|
22
|
+
helper: d,
|
|
23
|
+
tooltip: w,
|
|
24
|
+
type: o = "radio",
|
|
25
25
|
variant: m = "default",
|
|
26
|
-
color:
|
|
27
|
-
layout:
|
|
28
|
-
showIndicator:
|
|
29
|
-
justifyContent:
|
|
30
|
-
} =
|
|
31
|
-
f == null || f(
|
|
32
|
-
},
|
|
33
|
-
e[`tedi-choice-group-item--${
|
|
26
|
+
color: E = "primary",
|
|
27
|
+
layout: F,
|
|
28
|
+
showIndicator: b,
|
|
29
|
+
justifyContent: y = "start"
|
|
30
|
+
} = $(l), { currentValue: n, name: v, onChange: f, inputType: G } = L.useContext(z), t = Array.isArray(n) ? n.includes(r) : r === n, P = n === void 0 ? l.defaultChecked : t, x = (i, k) => {
|
|
31
|
+
f == null || f(i, k), p == null || p(i, k);
|
|
32
|
+
}, R = u(
|
|
33
|
+
e[`tedi-choice-group-item--${F === "separated" ? "separated" : "segmented"}`],
|
|
34
34
|
h && e[`tedi-choice-group-item--${h}`]
|
|
35
35
|
), A = u(
|
|
36
36
|
e["tedi-choice-group-item"],
|
|
37
37
|
e[`tedi-choice-group-item--${m}`],
|
|
38
|
-
e[`tedi-choice-group-item--${m}-${
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{ [e["tedi-choice-group-item--disabled"]]:
|
|
38
|
+
e[`tedi-choice-group-item--${m}-${E}`],
|
|
39
|
+
b && e["tedi-choice-group-item--indicator"],
|
|
40
|
+
o && e[`tedi-choice-group-item--${o}`],
|
|
41
|
+
{ [e["tedi-choice-group-item--disabled"]]: a },
|
|
42
42
|
{ [e["tedi-choice-group-item--checked"]]: t },
|
|
43
|
-
{ [`justify-content-${
|
|
44
|
-
)
|
|
45
|
-
|
|
43
|
+
{ [`justify-content-${y}`]: y }
|
|
44
|
+
), M = o === "radio" ? q : S, T = (i) => {
|
|
45
|
+
var N;
|
|
46
|
+
a || m !== "card" || i.target.closest("input, label") || (N = document.getElementById(c)) == null || N.click();
|
|
47
|
+
}, g = o === "radio";
|
|
48
|
+
return /* @__PURE__ */ s(J, { ...I, className: R, children: /* @__PURE__ */ s(
|
|
46
49
|
"div",
|
|
47
50
|
{
|
|
48
51
|
className: A,
|
|
49
|
-
tabIndex:
|
|
50
|
-
onClick:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"aria-checked": t,
|
|
56
|
-
children: m === "default" || C ? /* @__PURE__ */ l(
|
|
57
|
-
d === "radio" ? L : T,
|
|
52
|
+
tabIndex: g || a ? -1 : 0,
|
|
53
|
+
onClick: T,
|
|
54
|
+
role: g ? void 0 : o,
|
|
55
|
+
"aria-checked": g ? void 0 : t,
|
|
56
|
+
children: m === "default" || b ? /* @__PURE__ */ s(
|
|
57
|
+
M,
|
|
58
58
|
{
|
|
59
|
-
id:
|
|
60
|
-
label:
|
|
61
|
-
value:
|
|
62
|
-
name:
|
|
63
|
-
className: u(e["tedi-choice-group-item__indicator"],
|
|
64
|
-
disabled:
|
|
59
|
+
id: c,
|
|
60
|
+
label: C,
|
|
61
|
+
value: r,
|
|
62
|
+
name: v,
|
|
63
|
+
className: u(e["tedi-choice-group-item__indicator"], B),
|
|
64
|
+
disabled: a,
|
|
65
65
|
checked: t,
|
|
66
|
-
defaultChecked:
|
|
66
|
+
defaultChecked: P,
|
|
67
67
|
onChange: x,
|
|
68
|
-
hideLabel:
|
|
69
|
-
helper:
|
|
70
|
-
tooltip:
|
|
68
|
+
hideLabel: j,
|
|
69
|
+
helper: d ? { ...d, className: u(e["tedi-choice-group-item__feedback-text"], d.className) } : void 0,
|
|
70
|
+
tooltip: w,
|
|
71
71
|
"data-testid": "choice-group-item-indicator",
|
|
72
72
|
"aria-checked": t
|
|
73
73
|
}
|
|
74
|
-
) : /* @__PURE__ */ _(
|
|
75
|
-
/* @__PURE__ */
|
|
74
|
+
) : /* @__PURE__ */ _(H, { children: [
|
|
75
|
+
/* @__PURE__ */ s(
|
|
76
76
|
"input",
|
|
77
77
|
{
|
|
78
|
-
id:
|
|
79
|
-
value:
|
|
80
|
-
name:
|
|
81
|
-
type:
|
|
82
|
-
disabled:
|
|
78
|
+
id: c,
|
|
79
|
+
value: r,
|
|
80
|
+
name: v,
|
|
81
|
+
type: G,
|
|
82
|
+
disabled: a,
|
|
83
83
|
checked: t,
|
|
84
|
-
defaultChecked: n === void 0 ?
|
|
85
|
-
onChange: (
|
|
86
|
-
x(
|
|
84
|
+
defaultChecked: n === void 0 ? l.defaultChecked : void 0,
|
|
85
|
+
onChange: (i) => {
|
|
86
|
+
x(r, i.target.checked);
|
|
87
87
|
},
|
|
88
88
|
className: "visually-hidden",
|
|
89
|
-
role:
|
|
89
|
+
role: o === "radio" ? "radio" : void 0,
|
|
90
90
|
"aria-checked": t,
|
|
91
91
|
tabIndex: -1
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
/* @__PURE__ */ _("label", { htmlFor:
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
/* @__PURE__ */ _("label", { htmlFor: c, className: e["tedi-choice-group-item__label"], children: [
|
|
95
|
+
C,
|
|
96
|
+
d && /* @__PURE__ */ s(V, { ...d, id: c, className: e["tedi-choice-group-item__feedback-text"] })
|
|
97
97
|
] })
|
|
98
98
|
] })
|
|
99
99
|
}
|
|
100
100
|
) });
|
|
101
101
|
};
|
|
102
102
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
oe as ChoiceGroupItem,
|
|
104
|
+
oe as default
|
|
105
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),_=require("../../../../../external/classnames/index.cjs.js"),l=require("react"),O=require("../../base/icon/icon.cjs.js"),pe=require("../../buttons/closing-button/closing-button.cjs.js"),_e=require("../../misc/separator/separator.cjs.js"),D=require("../feedback-text/feedback-text.cjs.js"),he=require("../field/field.cjs.js"),ge=require("../form-label/form-label.cjs.js"),k=require("../input-group/input-group.cjs.js"),r=require("./textfield.module.scss.cjs.js"),Ie=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),je=require("../../../providers/label-provider/use-labels.cjs.js"),Ae={large:24,default:18},q=l.forwardRef((h,U)=>{var H;const{getCurrentBreakpointProps:J}=Ie.useBreakpointProps(h.defaultServerBreakpoint),{id:Ne,label:g,className:Q,inputClassName:W,disabled:c,required:C,hideLabel:S,invalid:u,readOnly:B,icon:i,onIconClick:b,iconButtonProps:y,size:d="default",placeholder:X,isArrowsHidden:Y=!0,isClearable:F,onClear:v,onChange:o,onChangeEvent:Z,onKeyUp:G,onKeyDown:ee,onKeyPress:te,defaultValue:T,value:I,onFocus:j,onBlur:A,onClick:re,helper:e,input:s,name:ae,isTextArea:le,startSlot:ie,endSlot:se,...ne}=J(h)||{},{getLabel:w}=je.useLabels(),z=l.useRef(null),L=l.useRef(null),[de,R]=l.useState(I??T??""),M=I??de,f=!!(F&&M&&!B),x=(H=k.useOptionalInputGroup)==null?void 0:H.call(k),oe=l.useId(),ce=x==null?void 0:x.hasExternalLabel,m=h.id??(x==null?void 0:x.inputId)??oe;l.useImperativeHandle(U,()=>({get input(){return L.current},get inner(){return z.current}}));const P=l.useMemo(()=>Array.isArray(e)?u||e.some(t=>t.type==="error"):u||(e==null?void 0:e.type)==="error",[u,e]),ue=l.useMemo(()=>!e||Array.isArray(e)&&e.length===0?!1:Array.isArray(e)?!u&&e.every(t=>t.type==="valid"):!u&&e.type==="valid",[u,e]),fe=d==="large"?"default":d,p=I!==void 0,xe=l.useCallback(t=>{p||R(t),o==null||o(t)},[p,o]),$=l.useCallback(()=>{p||R(""),o==null||o(""),v==null||v()},[p,o,v]),E=l.useCallback(()=>{if(!i)return null;const N={size:d==="large"?24:d==="small"?!!b?18:16:18,className:r.default["tedi-textfield__icon"]},K=typeof i=="string"?{...N,name:i}:{...N,...i,className:_.default(N.className,i.className)};return b?a.jsx("button",{type:"button",...y,className:_.default(r.default["tedi-textfield__icon-wrapper"],y==null?void 0:y.className),onClick:c?void 0:b,disabled:c,children:a.jsx(O.Icon,{...K})}):a.jsx("div",{className:r.default["tedi-textfield__icon-wrapper"],"aria-hidden":"true",children:a.jsx(O.Icon,{...K})})},[i,d,b,y,c]),V=l.useMemo(()=>f?a.jsx(pe.ClosingButton,{iconSize:Ae[d==="large"?"large":"default"],onClick:c?void 0:$,disabled:c,title:w("clear"),className:r.default["tedi-textfield__clear-button"]}):null,[f,d,c,$,w]),me=l.useMemo(()=>!f&&!i?null:a.jsxs("div",{className:r.default["tedi-textfield__right-area"],children:[V,f&&i&&a.jsx(_e.Separator,{color:"primary",axis:"vertical",className:r.default["tedi-textfield__separator"]}),i&&E()]}),[f,i,V,E]),ye=a.jsx(he.Field,{...s,id:m,name:ae,value:M,defaultValue:T,onChange:xe,onChangeEvent:Z,disabled:c,readOnly:B,required:C,invalid:P,placeholder:X,className:_.default(r.default["tedi-textfield__input"],W,{[r.default["tedi-textfield__input--hidden-arrows"]]:Y}),onFocus:t=>{var n;(n=s==null?void 0:s.onFocus)==null||n.call(s,t),j==null||j(t)},onBlur:t=>{var n;(n=s==null?void 0:s.onBlur)==null||n.call(s,t),A==null||A(t)},isTextArea:le,"aria-describedby":!e||Array.isArray(e)&&e.length===0?void 0:Array.isArray(e)?e.map((t,n)=>`${m}-helper-${n}`).join(" "):`${m}-helper`,"aria-label":S&&typeof g=="string"?g:void 0,ref:L}),be=_.default(r.default["tedi-textfield"],{[r.default[`tedi-textfield--${d}`]]:d},{[r.default["tedi-textfield--with-icon"]]:i},{[r.default["tedi-textfield--invalid"]]:P},{[r.default["tedi-textfield--valid"]]:ue},{[r.default["tedi-textfield--clearable"]]:f},Q),ve=()=>!e||Array.isArray(e)&&e.length===0?null:a.jsx("div",{className:r.default["tedi-textfield__feedback-wrapper"],children:Array.isArray(e)?e.map((t,n)=>a.jsx(D.FeedbackText,{...t,id:`${m}-helper-${n}`},n)):a.jsx(D.FeedbackText,{...e,id:`${m}-helper`})});return a.jsxs("div",{"data-name":"textfield",...ne,className:be,children:[!ce&&a.jsx(ge.FormLabel,{id:m,label:g,required:C,hideLabel:S,size:fe}),a.jsxs("div",{className:r.default["tedi-textfield__inner"],onKeyDown:ee,onKeyUp:G,onKeyPress:te,onClick:re,ref:z,children:[ie,ye,se,(F||i)&&me]}),ve()]})});q.displayName="TextField";exports.TextField=q;exports.default=q;
|
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import y, { forwardRef as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { ClosingButton as
|
|
6
|
-
import { Separator as
|
|
7
|
-
import { FeedbackText as
|
|
8
|
-
import { Field as
|
|
9
|
-
import { FormLabel as
|
|
10
|
-
import { useOptionalInputGroup as
|
|
1
|
+
import { jsx as n, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import _ from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import y, { forwardRef as _e, useMemo as b, useCallback as B } from "react";
|
|
4
|
+
import { Icon as D } from "../../base/icon/icon.es.js";
|
|
5
|
+
import { ClosingButton as be } from "../../buttons/closing-button/closing-button.es.js";
|
|
6
|
+
import { Separator as Ie } from "../../misc/separator/separator.es.js";
|
|
7
|
+
import { FeedbackText as U } from "../feedback-text/feedback-text.es.js";
|
|
8
|
+
import { Field as ge } from "../field/field.es.js";
|
|
9
|
+
import { FormLabel as Ne } from "../form-label/form-label.es.js";
|
|
10
|
+
import { useOptionalInputGroup as Ae } from "../input-group/input-group.es.js";
|
|
11
11
|
import t from "./textfield.module.scss.es.js";
|
|
12
|
-
import { useBreakpointProps as
|
|
13
|
-
import { useLabels as
|
|
14
|
-
const
|
|
12
|
+
import { useBreakpointProps as ke } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
13
|
+
import { useLabels as Ce } from "../../../providers/label-provider/use-labels.es.js";
|
|
14
|
+
const Se = {
|
|
15
15
|
large: 24,
|
|
16
16
|
default: 18
|
|
17
|
-
},
|
|
18
|
-
var
|
|
19
|
-
const { getCurrentBreakpointProps:
|
|
17
|
+
}, Be = _e((I, J) => {
|
|
18
|
+
var O;
|
|
19
|
+
const { getCurrentBreakpointProps: Q } = ke(I.defaultServerBreakpoint), {
|
|
20
20
|
id: we,
|
|
21
21
|
label: g,
|
|
22
|
-
className:
|
|
23
|
-
inputClassName:
|
|
22
|
+
className: W,
|
|
23
|
+
inputClassName: X,
|
|
24
24
|
disabled: d,
|
|
25
|
-
required:
|
|
26
|
-
hideLabel:
|
|
25
|
+
required: w,
|
|
26
|
+
hideLabel: z,
|
|
27
27
|
invalid: c,
|
|
28
|
-
readOnly:
|
|
29
|
-
icon:
|
|
30
|
-
onIconClick:
|
|
28
|
+
readOnly: F,
|
|
29
|
+
icon: i,
|
|
30
|
+
onIconClick: v,
|
|
31
31
|
iconButtonProps: p,
|
|
32
32
|
size: s = "default",
|
|
33
|
-
placeholder:
|
|
34
|
-
isArrowsHidden:
|
|
33
|
+
placeholder: Y,
|
|
34
|
+
isArrowsHidden: Z = !0,
|
|
35
35
|
isClearable: R,
|
|
36
36
|
onClear: x,
|
|
37
37
|
onChange: o,
|
|
38
|
-
onChangeEvent:
|
|
39
|
-
onKeyUp:
|
|
40
|
-
onKeyDown:
|
|
41
|
-
onKeyPress:
|
|
38
|
+
onChangeEvent: G,
|
|
39
|
+
onKeyUp: ee,
|
|
40
|
+
onKeyDown: re,
|
|
41
|
+
onKeyPress: te,
|
|
42
42
|
defaultValue: $,
|
|
43
|
-
value:
|
|
44
|
-
onFocus:
|
|
43
|
+
value: N,
|
|
44
|
+
onFocus: A,
|
|
45
45
|
onBlur: k,
|
|
46
|
-
onClick:
|
|
46
|
+
onClick: ie,
|
|
47
47
|
helper: e,
|
|
48
|
-
input:
|
|
49
|
-
name:
|
|
50
|
-
isTextArea:
|
|
51
|
-
startSlot:
|
|
52
|
-
endSlot:
|
|
53
|
-
...
|
|
54
|
-
} =
|
|
55
|
-
y.useImperativeHandle(
|
|
48
|
+
input: a,
|
|
49
|
+
name: ae,
|
|
50
|
+
isTextArea: le,
|
|
51
|
+
startSlot: ne,
|
|
52
|
+
endSlot: se,
|
|
53
|
+
...oe
|
|
54
|
+
} = Q(I) || {}, { getLabel: L } = Ce(), T = y.useRef(null), E = y.useRef(null), [de, P] = y.useState(N ?? $ ?? ""), V = N ?? de, f = !!(R && V && !F), m = (O = Ae) == null ? void 0 : O(), ce = y.useId(), fe = m == null ? void 0 : m.hasExternalLabel, u = I.id ?? (m == null ? void 0 : m.inputId) ?? ce;
|
|
55
|
+
y.useImperativeHandle(J, () => ({
|
|
56
56
|
get input() {
|
|
57
|
-
return
|
|
57
|
+
return E.current;
|
|
58
58
|
},
|
|
59
59
|
get inner() {
|
|
60
|
-
return
|
|
60
|
+
return T.current;
|
|
61
61
|
}
|
|
62
62
|
}));
|
|
63
|
-
const
|
|
63
|
+
const j = b(() => Array.isArray(e) ? c || e.some((r) => r.type === "error") : c || (e == null ? void 0 : e.type) === "error", [c, e]), me = b(() => !e || Array.isArray(e) && e.length === 0 ? !1 : Array.isArray(e) ? !c && e.every((r) => r.type === "valid") : !c && e.type === "valid", [c, e]), ue = s === "large" ? "default" : s, h = N !== void 0, pe = B(
|
|
64
64
|
(r) => {
|
|
65
|
-
|
|
65
|
+
h || P(r), o == null || o(r);
|
|
66
66
|
},
|
|
67
|
-
[
|
|
68
|
-
),
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
if (!
|
|
72
|
-
const
|
|
73
|
-
size: s === "large" ? 24 : s === "small" ? 16 : 18,
|
|
67
|
+
[h, o]
|
|
68
|
+
), H = B(() => {
|
|
69
|
+
h || P(""), o == null || o(""), x == null || x();
|
|
70
|
+
}, [h, o, x]), K = B(() => {
|
|
71
|
+
if (!i) return null;
|
|
72
|
+
const C = {
|
|
73
|
+
size: s === "large" ? 24 : s === "small" ? !!v ? 18 : 16 : 18,
|
|
74
74
|
className: t["tedi-textfield__icon"]
|
|
75
|
-
},
|
|
76
|
-
return
|
|
75
|
+
}, q = typeof i == "string" ? { ...C, name: i } : { ...C, ...i, className: _(C.className, i.className) };
|
|
76
|
+
return v ? /* @__PURE__ */ n(
|
|
77
77
|
"button",
|
|
78
78
|
{
|
|
79
79
|
type: "button",
|
|
80
80
|
...p,
|
|
81
|
-
className:
|
|
82
|
-
onClick: d ? void 0 :
|
|
81
|
+
className: _(t["tedi-textfield__icon-wrapper"], p == null ? void 0 : p.className),
|
|
82
|
+
onClick: d ? void 0 : v,
|
|
83
83
|
disabled: d,
|
|
84
|
-
children: /* @__PURE__ */ n(
|
|
84
|
+
children: /* @__PURE__ */ n(D, { ...q })
|
|
85
85
|
}
|
|
86
|
-
) : /* @__PURE__ */ n("div", { className: t["tedi-textfield__icon-wrapper"], "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
87
|
-
}, [
|
|
88
|
-
|
|
86
|
+
) : /* @__PURE__ */ n("div", { className: t["tedi-textfield__icon-wrapper"], "aria-hidden": "true", children: /* @__PURE__ */ n(D, { ...q }) });
|
|
87
|
+
}, [i, s, v, p, d]), M = b(() => f ? /* @__PURE__ */ n(
|
|
88
|
+
be,
|
|
89
89
|
{
|
|
90
|
-
iconSize:
|
|
91
|
-
onClick: d ? void 0 :
|
|
90
|
+
iconSize: Se[s === "large" ? "large" : "default"],
|
|
91
|
+
onClick: d ? void 0 : H,
|
|
92
92
|
disabled: d,
|
|
93
|
-
title:
|
|
93
|
+
title: L("clear"),
|
|
94
94
|
className: t["tedi-textfield__clear-button"]
|
|
95
95
|
}
|
|
96
|
-
) : null, [f, s, d,
|
|
97
|
-
|
|
98
|
-
f &&
|
|
99
|
-
|
|
100
|
-
] }), [f,
|
|
101
|
-
|
|
96
|
+
) : null, [f, s, d, H, L]), ye = b(() => !f && !i ? null : /* @__PURE__ */ S("div", { className: t["tedi-textfield__right-area"], children: [
|
|
97
|
+
M,
|
|
98
|
+
f && i && /* @__PURE__ */ n(Ie, { color: "primary", axis: "vertical", className: t["tedi-textfield__separator"] }),
|
|
99
|
+
i && K()
|
|
100
|
+
] }), [f, i, M, K]), ve = /* @__PURE__ */ n(
|
|
101
|
+
ge,
|
|
102
102
|
{
|
|
103
|
-
...
|
|
104
|
-
id:
|
|
105
|
-
name:
|
|
106
|
-
value:
|
|
103
|
+
...a,
|
|
104
|
+
id: u,
|
|
105
|
+
name: ae,
|
|
106
|
+
value: V,
|
|
107
107
|
defaultValue: $,
|
|
108
|
-
onChange:
|
|
109
|
-
onChangeEvent:
|
|
108
|
+
onChange: pe,
|
|
109
|
+
onChangeEvent: G,
|
|
110
110
|
disabled: d,
|
|
111
|
-
readOnly:
|
|
112
|
-
required:
|
|
113
|
-
invalid:
|
|
114
|
-
placeholder:
|
|
115
|
-
className:
|
|
116
|
-
[t["tedi-textfield__input--hidden-arrows"]]:
|
|
111
|
+
readOnly: F,
|
|
112
|
+
required: w,
|
|
113
|
+
invalid: j,
|
|
114
|
+
placeholder: Y,
|
|
115
|
+
className: _(t["tedi-textfield__input"], X, {
|
|
116
|
+
[t["tedi-textfield__input--hidden-arrows"]]: Z
|
|
117
117
|
}),
|
|
118
118
|
onFocus: (r) => {
|
|
119
|
-
var
|
|
120
|
-
(
|
|
119
|
+
var l;
|
|
120
|
+
(l = a == null ? void 0 : a.onFocus) == null || l.call(a, r), A == null || A(r);
|
|
121
121
|
},
|
|
122
122
|
onBlur: (r) => {
|
|
123
|
-
var
|
|
124
|
-
(
|
|
123
|
+
var l;
|
|
124
|
+
(l = a == null ? void 0 : a.onBlur) == null || l.call(a, r), k == null || k(r);
|
|
125
125
|
},
|
|
126
|
-
isTextArea:
|
|
127
|
-
"aria-describedby": !e || Array.isArray(e) && e.length === 0 ? void 0 : Array.isArray(e) ? e.map((r,
|
|
128
|
-
"aria-label":
|
|
129
|
-
ref:
|
|
126
|
+
isTextArea: le,
|
|
127
|
+
"aria-describedby": !e || Array.isArray(e) && e.length === 0 ? void 0 : Array.isArray(e) ? e.map((r, l) => `${u}-helper-${l}`).join(" ") : `${u}-helper`,
|
|
128
|
+
"aria-label": z && typeof g == "string" ? g : void 0,
|
|
129
|
+
ref: E
|
|
130
130
|
}
|
|
131
|
-
),
|
|
131
|
+
), xe = _(
|
|
132
132
|
t["tedi-textfield"],
|
|
133
133
|
{ [t[`tedi-textfield--${s}`]]: s },
|
|
134
|
-
{ [t["tedi-textfield--with-icon"]]:
|
|
135
|
-
{ [t["tedi-textfield--invalid"]]:
|
|
136
|
-
{ [t["tedi-textfield--valid"]]:
|
|
134
|
+
{ [t["tedi-textfield--with-icon"]]: i },
|
|
135
|
+
{ [t["tedi-textfield--invalid"]]: j },
|
|
136
|
+
{ [t["tedi-textfield--valid"]]: me },
|
|
137
137
|
{ [t["tedi-textfield--clearable"]]: f },
|
|
138
|
-
|
|
139
|
-
),
|
|
140
|
-
return /* @__PURE__ */
|
|
141
|
-
!
|
|
142
|
-
/* @__PURE__ */
|
|
138
|
+
W
|
|
139
|
+
), he = () => !e || Array.isArray(e) && e.length === 0 ? null : /* @__PURE__ */ n("div", { className: t["tedi-textfield__feedback-wrapper"], children: Array.isArray(e) ? e.map((r, l) => /* @__PURE__ */ n(U, { ...r, id: `${u}-helper-${l}` }, l)) : /* @__PURE__ */ n(U, { ...e, id: `${u}-helper` }) });
|
|
140
|
+
return /* @__PURE__ */ S("div", { "data-name": "textfield", ...oe, className: xe, children: [
|
|
141
|
+
!fe && /* @__PURE__ */ n(Ne, { id: u, label: g, required: w, hideLabel: z, size: ue }),
|
|
142
|
+
/* @__PURE__ */ S(
|
|
143
143
|
"div",
|
|
144
144
|
{
|
|
145
145
|
className: t["tedi-textfield__inner"],
|
|
146
|
-
onKeyDown:
|
|
147
|
-
onKeyUp:
|
|
148
|
-
onKeyPress:
|
|
149
|
-
onClick:
|
|
150
|
-
ref:
|
|
146
|
+
onKeyDown: re,
|
|
147
|
+
onKeyUp: ee,
|
|
148
|
+
onKeyPress: te,
|
|
149
|
+
onClick: ie,
|
|
150
|
+
ref: T,
|
|
151
151
|
children: [
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
(R ||
|
|
152
|
+
ne,
|
|
153
|
+
ve,
|
|
154
|
+
se,
|
|
155
|
+
(R || i) && ye
|
|
156
156
|
]
|
|
157
157
|
}
|
|
158
158
|
),
|
|
159
|
-
|
|
159
|
+
he()
|
|
160
160
|
] });
|
|
161
161
|
});
|
|
162
|
-
|
|
162
|
+
Be.displayName = "TextField";
|
|
163
163
|
export {
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
Be as TextField,
|
|
165
|
+
Be as default
|
|
166
166
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=40,u=6,d=()=>Array.from({length:24},(e,t)=>t.toString().padStart(2,"0")),m=e=>{const t=Math.max(1,e??1),r=[];for(let n=0;n<60;n+=t)r.push(n.toString().padStart(2,"0"));return r},T=(e,t)=>{if(!t.length)return"00";const r=Number(e);return isNaN(r)?t[0]:t.reduce((n,s)=>{const o=Math.abs(Number(s)-r),i=Math.abs(Number(n)-r);return o<i||o===i&&Number(s)>Number(n)?s:n},t[0])},p=e=>{if(!e.includes(":"))return{hour:"00",minute:"00"};const[t,r]=e.split(":");return{hour:t.padStart(2,"0"),minute:r.padStart(2,"0")}},f=(e,t)=>{const r=Math.round(e/c);return Math.max(0,Math.min(r,t-1))},l=e=>e*c,S=(e,t,r=1)=>Math.abs(e-t)>r,g=(e,t,r="auto")=>{e.scrollTo({top:l(t),behavior:r})},h=e=>{e&&clearTimeout(e)},a=e=>e?/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e.trim()):!1,I=e=>{const t=e.trim();if(!t)return"";if(a(t))return t;const r=t.replace(/[^0-9]/g,"");if(r.length===3){const n=r.slice(0,1).padStart(2,"0"),s=r.slice(1),o=`${n}:${s}`;return a(o)?o:null}if(r.length===4){const n=r.slice(0,2),s=r.slice(2),o=`${n}:${s}`;return a(o)?o:null}if(t.includes(":")){const[n,s]=t.split(":"),o=parseInt(n,10),i=parseInt(s,10);if(!isNaN(o)&&!isNaN(i)&&o>=0&&o<=23&&i>=0&&i<=59)return`${o.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`}return null};exports.ITEM_HEIGHT=c;exports.TIMEPICKER_OFFSET=u;exports.clearScrollTimeout=h;exports.findClosestMinute=T;exports.generateHours=d;exports.generateMinutes=m;exports.getScrollTopForIndex=l;exports.isValidTime=a;exports.needsScrollCorrection=S;exports.normalizeTime=I;exports.parseTime=p;exports.scrollToIndex=g;exports.snapToNearestItem=f;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const ITEM_HEIGHT = 40;
|
|
2
|
+
export declare const TIMEPICKER_OFFSET = 6;
|
|
3
|
+
/**
|
|
4
|
+
* Generates an array of hours (00–23)
|
|
5
|
+
*/
|
|
6
|
+
export declare const generateHours: () => string[];
|
|
7
|
+
/**
|
|
8
|
+
* Generates minute values based on a step (e.g. 5, 10, 15)
|
|
9
|
+
*/
|
|
10
|
+
export declare const generateMinutes: (stepMinutes: number) => string[];
|
|
11
|
+
/**
|
|
12
|
+
* Finds the closest available minute to a target value
|
|
13
|
+
*/
|
|
14
|
+
export declare const findClosestMinute: (target: string, mins: string[]) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Parses HH:mm time string
|
|
17
|
+
*/
|
|
18
|
+
export declare const parseTime: (time: string) => {
|
|
19
|
+
hour: string;
|
|
20
|
+
minute: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Returns nearest wheel index from scroll position
|
|
24
|
+
*/
|
|
25
|
+
export declare const snapToNearestItem: (scrollTop: number, length: number) => number;
|
|
26
|
+
/**
|
|
27
|
+
* Returns scrollTop position for index
|
|
28
|
+
*/
|
|
29
|
+
export declare const getScrollTopForIndex: (index: number) => number;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if scroll correction is needed
|
|
32
|
+
*/
|
|
33
|
+
export declare const needsScrollCorrection: (current: number, target: number, tolerance?: number) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Scrolls element to index
|
|
36
|
+
*/
|
|
37
|
+
export declare const scrollToIndex: (element: HTMLDivElement, index: number, behavior?: ScrollBehavior) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Clears scroll timeout safely
|
|
40
|
+
*/
|
|
41
|
+
export declare const clearScrollTimeout: (timeout?: NodeJS.Timeout) => void;
|
|
42
|
+
export declare const isValidTime: (time: string) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Normalizes common typing patterns into HH:mm or returns null if impossible
|
|
45
|
+
* Examples:
|
|
46
|
+
* "9:5" → "09:05"
|
|
47
|
+
* "14:5" → "14:05"
|
|
48
|
+
* "2359" → "23:59"
|
|
49
|
+
* "4:89" → null
|
|
50
|
+
*/
|
|
51
|
+
export declare const normalizeTime: (input: string) => string | null;
|