@tedi-design-system/react 17.1.0-rc.6 → 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.
Files changed (82) hide show
  1. package/_virtual/index.cjs10.js +1 -1
  2. package/_virtual/index.cjs11.js +1 -1
  3. package/_virtual/index.cjs12.js +1 -1
  4. package/_virtual/index.cjs13.js +1 -1
  5. package/_virtual/index.cjs5.js +1 -1
  6. package/_virtual/index.cjs6.js +1 -1
  7. package/_virtual/index.cjs7.js +1 -1
  8. package/_virtual/index.cjs8.js +1 -1
  9. package/_virtual/index.cjs9.js +1 -1
  10. package/_virtual/index.es10.js +1 -1
  11. package/_virtual/index.es11.js +1 -1
  12. package/_virtual/index.es12.js +1 -1
  13. package/_virtual/index.es13.js +2 -4
  14. package/_virtual/index.es5.js +4 -2
  15. package/_virtual/index.es6.js +1 -1
  16. package/_virtual/index.es7.js +1 -1
  17. package/_virtual/index.es8.js +1 -1
  18. package/_virtual/index.es9.js +1 -1
  19. package/bundle-stats.html +1 -1
  20. package/external/@mui/system/colorManipulator.cjs.js +1 -1
  21. package/external/@mui/system/colorManipulator.es.js +2 -2
  22. package/external/@mui/system/createStyled.cjs.js +1 -1
  23. package/external/@mui/system/createStyled.es.js +6 -6
  24. package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
  25. package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
  26. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  27. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  28. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  29. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  30. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  31. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  32. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  33. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  34. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  35. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  36. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  37. package/external/prop-types/external/react-is/index.es.js +1 -1
  38. package/external/toposort/index.cjs.js +1 -1
  39. package/external/toposort/index.es.js +1 -1
  40. package/index.css +1 -1
  41. package/package.json +1 -1
  42. package/src/tedi/components/content/text-group/index.d.ts +2 -0
  43. package/src/tedi/components/content/text-group/text-group-list/text-group-list.cjs.js +1 -0
  44. package/src/tedi/components/content/text-group/text-group-list/text-group-list.d.ts +82 -0
  45. package/src/tedi/components/content/text-group/text-group-list/text-group-list.es.js +30 -0
  46. package/src/tedi/components/content/text-group/text-group.cjs.js +1 -1
  47. package/src/tedi/components/content/text-group/text-group.d.ts +9 -1
  48. package/src/tedi/components/content/text-group/text-group.es.js +20 -15
  49. package/src/tedi/components/content/text-group/text-group.module.scss.cjs.js +1 -1
  50. package/src/tedi/components/content/text-group/text-group.module.scss.es.js +3 -1
  51. package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
  52. package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +70 -70
  53. package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
  54. package/src/tedi/components/form/textfield/textfield.es.js +110 -110
  55. package/src/tedi/components/form/time-field/time-field-helpers.cjs.js +1 -0
  56. package/src/tedi/components/form/time-field/time-field-helpers.d.ts +51 -0
  57. package/src/tedi/components/form/time-field/time-field-helpers.es.js +65 -0
  58. package/src/tedi/components/form/time-field/time-field.cjs.js +1 -0
  59. package/src/tedi/components/form/time-field/time-field.d.ts +87 -0
  60. package/src/tedi/components/form/time-field/time-field.es.js +149 -0
  61. package/src/tedi/components/form/time-field/time-field.module.scss.cjs.js +1 -0
  62. package/src/tedi/components/form/time-field/time-field.module.scss.es.js +10 -0
  63. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.cjs.js +1 -0
  64. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.d.ts +38 -0
  65. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.es.js +101 -0
  66. package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.cjs.js +1 -0
  67. package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.d.ts +40 -0
  68. package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.es.js +184 -0
  69. package/src/tedi/components/form/time-picker/time-picker.cjs.js +1 -0
  70. package/src/tedi/components/form/time-picker/time-picker.d.ts +60 -0
  71. package/src/tedi/components/form/time-picker/time-picker.es.js +45 -0
  72. package/src/tedi/components/form/time-picker/time-picker.module.scss.cjs.js +1 -0
  73. package/src/tedi/components/form/time-picker/time-picker.module.scss.es.js +14 -0
  74. package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
  75. package/src/tedi/components/overlays/dropdown/dropdown.d.ts +9 -0
  76. package/src/tedi/components/overlays/dropdown/dropdown.es.js +98 -88
  77. package/src/tedi/index.d.ts +3 -1
  78. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  79. package/src/tedi/providers/label-provider/labels-map.d.ts +7 -0
  80. package/src/tedi/providers/label-provider/labels-map.es.js +9 -2
  81. package/tedi.cjs.js +1 -1
  82. package/tedi.es.js +214 -208
@@ -1,166 +1,166 @@
1
- import { jsx as n, jsxs as C } from "react/jsx-runtime";
2
- import h from "../../../../../external/classnames/index.es.js";
3
- import y, { forwardRef as ve, useMemo as _, useCallback as w } from "react";
4
- import { Icon as O } from "../../base/icon/icon.es.js";
5
- import { ClosingButton as he } from "../../buttons/closing-button/closing-button.es.js";
6
- import { Separator as _e } from "../../misc/separator/separator.es.js";
7
- import { FeedbackText as q } from "../feedback-text/feedback-text.es.js";
8
- import { Field as be } from "../field/field.es.js";
9
- import { FormLabel as ge } from "../form-label/form-label.es.js";
10
- import { useOptionalInputGroup as Ne } from "../input-group/input-group.es.js";
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 Ae } from "../../../helpers/hooks/use-breakpoint-props.es.js";
13
- import { useLabels as Ie } from "../../../providers/label-provider/use-labels.es.js";
14
- const ke = {
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
- }, Ce = ve((b, D) => {
18
- var M;
19
- const { getCurrentBreakpointProps: U } = Ae(b.defaultServerBreakpoint), {
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: J,
23
- inputClassName: Q,
22
+ className: W,
23
+ inputClassName: X,
24
24
  disabled: d,
25
- required: B,
26
- hideLabel: F,
25
+ required: w,
26
+ hideLabel: z,
27
27
  invalid: c,
28
- readOnly: S,
29
- icon: a,
30
- onIconClick: N,
28
+ readOnly: F,
29
+ icon: i,
30
+ onIconClick: v,
31
31
  iconButtonProps: p,
32
32
  size: s = "default",
33
- placeholder: W,
34
- isArrowsHidden: X = !0,
33
+ placeholder: Y,
34
+ isArrowsHidden: Z = !0,
35
35
  isClearable: R,
36
36
  onClear: x,
37
37
  onChange: o,
38
- onChangeEvent: Y,
39
- onKeyUp: Z,
40
- onKeyDown: G,
41
- onKeyPress: ee,
38
+ onChangeEvent: G,
39
+ onKeyUp: ee,
40
+ onKeyDown: re,
41
+ onKeyPress: te,
42
42
  defaultValue: $,
43
- value: A,
44
- onFocus: I,
43
+ value: N,
44
+ onFocus: A,
45
45
  onBlur: k,
46
- onClick: re,
46
+ onClick: ie,
47
47
  helper: e,
48
- input: l,
49
- name: te,
50
- isTextArea: ie,
51
- startSlot: ae,
52
- endSlot: le,
53
- ...ne
54
- } = U(b) || {}, { getLabel: z } = Ie(), L = y.useRef(null), T = y.useRef(null), [se, E] = y.useState(A ?? $ ?? ""), P = A ?? se, f = !!(R && P && !S), u = (M = Ne) == null ? void 0 : M(), oe = y.useId(), de = u == null ? void 0 : u.hasExternalLabel, m = b.id ?? (u == null ? void 0 : u.inputId) ?? oe;
55
- y.useImperativeHandle(D, () => ({
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 T.current;
57
+ return E.current;
58
58
  },
59
59
  get inner() {
60
- return L.current;
60
+ return T.current;
61
61
  }
62
62
  }));
63
- const V = _(() => Array.isArray(e) ? c || e.some((r) => r.type === "error") : c || (e == null ? void 0 : e.type) === "error", [c, e]), ce = _(() => !e || Array.isArray(e) && e.length === 0 ? !1 : Array.isArray(e) ? !c && e.every((r) => r.type === "valid") : !c && e.type === "valid", [c, e]), fe = s === "large" ? "default" : s, v = A !== void 0, ue = w(
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
- v || E(r), o == null || o(r);
65
+ h || P(r), o == null || o(r);
66
66
  },
67
- [v, o]
68
- ), j = w(() => {
69
- v || E(""), o == null || o(""), x == null || x();
70
- }, [v, o, x]), H = w(() => {
71
- if (!a) return null;
72
- const r = {
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
- }, i = typeof a == "string" ? { ...r, name: a } : { ...r, ...a, className: h(r.className, a.className) };
76
- return N ? /* @__PURE__ */ n(
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: h(t["tedi-textfield__icon-wrapper"], p == null ? void 0 : p.className),
82
- onClick: d ? void 0 : N,
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(O, { ...i })
84
+ children: /* @__PURE__ */ n(D, { ...q })
85
85
  }
86
- ) : /* @__PURE__ */ n("div", { className: t["tedi-textfield__icon-wrapper"], "aria-hidden": "true", children: /* @__PURE__ */ n(O, { ...i }) });
87
- }, [a, s, N, p, d]), K = _(() => f ? /* @__PURE__ */ n(
88
- he,
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: ke[s === "large" ? "large" : "default"],
91
- onClick: d ? void 0 : j,
90
+ iconSize: Se[s === "large" ? "large" : "default"],
91
+ onClick: d ? void 0 : H,
92
92
  disabled: d,
93
- title: z("clear"),
93
+ title: L("clear"),
94
94
  className: t["tedi-textfield__clear-button"]
95
95
  }
96
- ) : null, [f, s, d, j, z]), me = _(() => !f && !a ? null : /* @__PURE__ */ C("div", { className: t["tedi-textfield__right-area"], children: [
97
- K,
98
- f && a && /* @__PURE__ */ n(_e, { color: "primary", axis: "vertical", className: t["tedi-textfield__separator"] }),
99
- a && H()
100
- ] }), [f, a, K, H]), pe = /* @__PURE__ */ n(
101
- be,
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
- ...l,
104
- id: m,
105
- name: te,
106
- value: P,
103
+ ...a,
104
+ id: u,
105
+ name: ae,
106
+ value: V,
107
107
  defaultValue: $,
108
- onChange: ue,
109
- onChangeEvent: Y,
108
+ onChange: pe,
109
+ onChangeEvent: G,
110
110
  disabled: d,
111
- readOnly: S,
112
- required: B,
113
- invalid: V,
114
- placeholder: W,
115
- className: h(t["tedi-textfield__input"], Q, {
116
- [t["tedi-textfield__input--hidden-arrows"]]: X
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 i;
120
- (i = l == null ? void 0 : l.onFocus) == null || i.call(l, r), I == null || I(r);
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 i;
124
- (i = l == null ? void 0 : l.onBlur) == null || i.call(l, r), k == null || k(r);
123
+ var l;
124
+ (l = a == null ? void 0 : a.onBlur) == null || l.call(a, r), k == null || k(r);
125
125
  },
126
- isTextArea: ie,
127
- "aria-describedby": !e || Array.isArray(e) && e.length === 0 ? void 0 : Array.isArray(e) ? e.map((r, i) => `${m}-helper-${i}`).join(" ") : `${m}-helper`,
128
- "aria-label": F && typeof g == "string" ? g : void 0,
129
- ref: T
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
- ), ye = h(
131
+ ), xe = _(
132
132
  t["tedi-textfield"],
133
133
  { [t[`tedi-textfield--${s}`]]: s },
134
- { [t["tedi-textfield--with-icon"]]: a },
135
- { [t["tedi-textfield--invalid"]]: V },
136
- { [t["tedi-textfield--valid"]]: ce },
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
- J
139
- ), xe = () => !e || Array.isArray(e) && e.length === 0 ? null : /* @__PURE__ */ n("div", { className: t["tedi-textfield__feedback-wrapper"], children: Array.isArray(e) ? e.map((r, i) => /* @__PURE__ */ n(q, { ...r, id: `${m}-helper-${i}` }, i)) : /* @__PURE__ */ n(q, { ...e, id: `${m}-helper` }) });
140
- return /* @__PURE__ */ C("div", { "data-name": "textfield", ...ne, className: ye, children: [
141
- !de && /* @__PURE__ */ n(ge, { id: m, label: g, required: B, hideLabel: F, size: fe }),
142
- /* @__PURE__ */ C(
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: G,
147
- onKeyUp: Z,
148
- onKeyPress: ee,
149
- onClick: re,
150
- ref: L,
146
+ onKeyDown: re,
147
+ onKeyUp: ee,
148
+ onKeyPress: te,
149
+ onClick: ie,
150
+ ref: T,
151
151
  children: [
152
- ae,
153
- pe,
154
- le,
155
- (R || a) && me
152
+ ne,
153
+ ve,
154
+ se,
155
+ (R || i) && ye
156
156
  ]
157
157
  }
158
158
  ),
159
- xe()
159
+ he()
160
160
  ] });
161
161
  });
162
- Ce.displayName = "TextField";
162
+ Be.displayName = "TextField";
163
163
  export {
164
- Ce as TextField,
165
- Ce as default
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;
@@ -0,0 +1,65 @@
1
+ const u = 40, l = 6, d = () => Array.from({ length: 24 }, (n, t) => t.toString().padStart(2, "0")), m = (n) => {
2
+ const t = Math.max(1, n ?? 1), r = [];
3
+ for (let e = 0; e < 60; e += t)
4
+ r.push(e.toString().padStart(2, "0"));
5
+ return r;
6
+ }, f = (n, t) => {
7
+ if (!t.length) return "00";
8
+ const r = Number(n);
9
+ return isNaN(r) ? t[0] : t.reduce((e, s) => {
10
+ const o = Math.abs(Number(s) - r), a = Math.abs(Number(e) - r);
11
+ return o < a || o === a && Number(s) > Number(e) ? s : e;
12
+ }, t[0]);
13
+ }, h = (n) => {
14
+ if (!n.includes(":"))
15
+ return { hour: "00", minute: "00" };
16
+ const [t, r] = n.split(":");
17
+ return {
18
+ hour: t.padStart(2, "0"),
19
+ minute: r.padStart(2, "0")
20
+ };
21
+ }, p = (n, t) => {
22
+ const r = Math.round(n / 40);
23
+ return Math.max(0, Math.min(r, t - 1));
24
+ }, i = (n) => n * 40, T = (n, t, r = 1) => Math.abs(n - t) > r, g = (n, t, r = "auto") => {
25
+ n.scrollTo({
26
+ top: i(t),
27
+ behavior: r
28
+ });
29
+ }, S = (n) => {
30
+ n && clearTimeout(n);
31
+ }, c = (n) => n ? /^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(n.trim()) : !1, I = (n) => {
32
+ const t = n.trim();
33
+ if (!t) return "";
34
+ if (c(t)) return t;
35
+ const r = t.replace(/[^0-9]/g, "");
36
+ if (r.length === 3) {
37
+ const e = r.slice(0, 1).padStart(2, "0"), s = r.slice(1), o = `${e}:${s}`;
38
+ return c(o) ? o : null;
39
+ }
40
+ if (r.length === 4) {
41
+ const e = r.slice(0, 2), s = r.slice(2), o = `${e}:${s}`;
42
+ return c(o) ? o : null;
43
+ }
44
+ if (t.includes(":")) {
45
+ const [e, s] = t.split(":"), o = parseInt(e, 10), a = parseInt(s, 10);
46
+ if (!isNaN(o) && !isNaN(a) && o >= 0 && o <= 23 && a >= 0 && a <= 59)
47
+ return `${o.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}`;
48
+ }
49
+ return null;
50
+ };
51
+ export {
52
+ u as ITEM_HEIGHT,
53
+ l as TIMEPICKER_OFFSET,
54
+ S as clearScrollTimeout,
55
+ f as findClosestMinute,
56
+ d as generateHours,
57
+ m as generateMinutes,
58
+ i as getScrollTopForIndex,
59
+ c as isValidTime,
60
+ T as needsScrollCorrection,
61
+ I as normalizeTime,
62
+ h as parseTime,
63
+ g as scrollToIndex,
64
+ p as snapToNearestItem
65
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),T=require("../../../../../external/classnames/index.cjs.js"),m=require("react"),B=require("../textfield/textfield.cjs.js"),ne=require("../time-picker/time-picker.cjs.js"),s=require("./time-field.module.scss.cjs.js"),O=require("./time-field-helpers.cjs.js"),re=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),C=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),oe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),k=require("../../overlays/dropdown/dropdown.cjs.js"),E=v=>{const{getCurrentBreakpointProps:S}=oe.useBreakpointProps(v.defaultServerBreakpoint),{id:V,label:M,value:c,defaultValue:z,onChange:F,readOnly:u=!1,required:A,placeholder:H,inputProps:i,stepMinutes:K=1,className:I,availableTimes:l}=v,{useNativePicker:G=!1,timePickerTrigger:P="button",showPicker:a=!0,availableTimesVariant:q="grid-buttons"}=S(v),y=c!==void 0,[J,N]=m.useState(c??z??""),g=y?c:J,[_,b]=m.useState(!1),w=P==="input",r=G,L=d.useFloating({open:_,onOpenChange:b,placement:w?"bottom-start":"bottom-end",middleware:[C.offset(O.TIMEPICKER_OFFSET),C.flip(),C.shift()],whileElementsMounted:re.autoUpdate}),{refs:j,context:p,x:Q,y:W,strategy:X}=L,Y=d.useClick(p),Z=d.useDismiss(p),$=d.useRole(p,{role:"listbox"}),D=a&&w&&!u&&!r,R=d.useInteractions([...D?[Y]:[],Z,$]),x=e=>{const n=e.trim();y||N(n),F==null||F(n)},ee=e=>{var h;const n=e.target.value??"";(h=i==null?void 0:i.onBlur)==null||h.call(i,e);const o=O.normalizeTime(n);o!==null&&o!==n&&x(o)};m.useEffect(()=>{c!==void 0&&N(c)},[c]);const f=m.useRef(null);m.useEffect(()=>{var e;(e=f.current)!=null&&e.inner&&j.setReference(f.current.inner)},[j]);const te=()=>{var n;const e=(n=f.current)==null?void 0:n.input;if(e){if(typeof e.showPicker=="function"){e.showPicker();return}e.focus()}},ie=()=>b(e=>!e),U={...i,id:V,label:M,value:g,placeholder:H,readOnly:u||!r&&w,icon:"schedule",isClearable:!0,required:A,onIconClick:()=>{u||!a||(r?te():P==="button"&&ie())},onChange:x,onBlur:ee,className:T.default(s.default["tedi-time-field__textfield"],{[s.default["tedi-time-field__icon--disabled"]]:!a||u},{[s.default["tedi-time-field__textfield--disabled"]]:i==null?void 0:i.disabled},{[s.default["tedi-time-field--native"]]:r}),input:{...i==null?void 0:i.input,...r&&{type:"time"}}};if(!r&&a&&!u&&q==="dropdown"&&!!(l!=null&&l.length)){const e=l.indexOf(g),n=e>=0?e:0;return t.jsxs(k.Dropdown,{width:"trigger",defaultActiveIndex:n,children:[t.jsx(k.Dropdown.Trigger,{children:t.jsx("div",{className:T.default(s.default["tedi-time-field__container"],I,{[s.default["tedi-time-field__container--native"]]:r}),children:t.jsx(B.TextField,{ref:f,...U})})}),t.jsx(k.Dropdown.Content,{children:l.map((o,h)=>t.jsx(k.Dropdown.Item,{index:h,active:o===g,onClick:()=>x(o),children:o},o))})]})}return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:T.default(s.default["tedi-time-field__container"],I),...D?R.getReferenceProps():{},"aria-haspopup":a?"listbox":void 0,tabIndex:-1,children:t.jsx(B.TextField,{ref:f,"aria-expanded":a?_:void 0,...U})}),!r&&a&&t.jsx(d.FloatingPortal,{children:_&&!u&&t.jsx(d.FloatingFocusManager,{context:p,modal:!1,initialFocus:-1,children:t.jsx("div",{ref:j.setFloating,...R.getFloatingProps({style:{position:X,top:W??0,left:Q??0}}),children:t.jsx(ne.TimePicker,{value:g,stepMinutes:K,availableTimes:l,onChange:e=>{x(e),l&&b(!1)},gridVariant:q==="grid-radio"?"radio":"button",className:s.default["tedi-time-field__picker-wrapper"]})})})})]})};E.displayName="TimeField";exports.TimeField=E;
@@ -0,0 +1,87 @@
1
+ import { default as React } from 'react';
2
+ import { BreakpointSupport } from '../../../helpers';
3
+ import { TextFieldProps } from '../textfield/textfield';
4
+ type TimeFieldBreakpointProps = {
5
+ /**
6
+ * If `true`, the field swaps the custom time-picker popover for the
7
+ * browser's native time picker (`<input type="time">`). Works on both
8
+ * mobile and desktop — useful when the consumer wants to skip the custom
9
+ * UI entirely.
10
+ * Note: When using the native picker, the `availableTimes` prop is ignored.
11
+ * @default false
12
+ */
13
+ useNativePicker?: boolean;
14
+ /**
15
+ * Determines how the time picker is triggered:
16
+ * - 'button' (default) – only clicking the icon opens the picker
17
+ * - 'input' – clicking anywhere in the input opens the picker
18
+ */
19
+ timePickerTrigger?: 'input' | 'button';
20
+ /**
21
+ * Enables or disables the time picker popover.
22
+ * @default true
23
+ */
24
+ showPicker?: boolean;
25
+ /**
26
+ * Variant of the available times:
27
+ * - 'grid-buttons' – buttons grid
28
+ * - 'grid-radio' – radio buttons grid
29
+ * - 'dropdown' – dropdown list
30
+ */
31
+ availableTimesVariant?: 'grid-buttons' | 'grid-radio' | 'dropdown';
32
+ };
33
+ export interface TimeFieldProps extends BreakpointSupport<TimeFieldBreakpointProps> {
34
+ /**
35
+ * Unique identifier for the input field.
36
+ */
37
+ id: string;
38
+ /**
39
+ * Label for the input field. Used for accessibility.
40
+ */
41
+ label: string;
42
+ /**
43
+ * Current value of the time field (controlled).
44
+ */
45
+ value?: string;
46
+ /**
47
+ * Initial value of the time field (uncontrolled).
48
+ */
49
+ defaultValue?: string;
50
+ /**
51
+ * Callback fired when the time value changes.
52
+ */
53
+ onChange?: (time: string) => void;
54
+ /**
55
+ * Makes the input read-only. Picker can still be opened if showPicker is true.
56
+ * @default false
57
+ */
58
+ readOnly?: boolean;
59
+ /**
60
+ * Marks the input as required.
61
+ */
62
+ required?: boolean;
63
+ /**
64
+ * Placeholder text for the input field.
65
+ */
66
+ placeholder?: string;
67
+ /**
68
+ * Additional props to pass to the underlying TextField component,
69
+ * excluding `id`, `label`, `value`, and `onChange`.
70
+ */
71
+ inputProps?: Omit<TextFieldProps, 'id' | 'label' | 'value' | 'onChange'>;
72
+ /**
73
+ * Step interval in minutes for the time picker.
74
+ * @default 1
75
+ */
76
+ stepMinutes?: number;
77
+ /**
78
+ * Additional CSS class for the container.
79
+ */
80
+ className?: string;
81
+ /**
82
+ * Array of available times to show in the picker or dropdown.
83
+ */
84
+ availableTimes?: string[];
85
+ }
86
+ export declare const TimeField: React.FC<TimeFieldProps>;
87
+ export {};
@@ -0,0 +1,149 @@
1
+ import { jsxs as O, jsx as i, Fragment as te } from "react/jsx-runtime";
2
+ import { useFloating as ie, useClick as ne, useDismiss as oe, useRole as re, useInteractions as le, FloatingPortal as se, FloatingFocusManager as ae } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import C from "../../../../../external/classnames/index.es.js";
4
+ import ce, { useState as V, useEffect as E } from "react";
5
+ import { TextField as U } from "../textfield/textfield.es.js";
6
+ import { TimePicker as de } from "../time-picker/time-picker.es.js";
7
+ import l from "./time-field.module.scss.es.js";
8
+ import { TIMEPICKER_OFFSET as fe, normalizeTime as ue } from "./time-field-helpers.es.js";
9
+ import { autoUpdate as me } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
10
+ import { offset as pe, flip as ge, shift as he } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
11
+ import { useBreakpointProps as ke } from "../../../helpers/hooks/use-breakpoint-props.es.js";
12
+ import { Dropdown as h } from "../../overlays/dropdown/dropdown.es.js";
13
+ const ve = (k) => {
14
+ const { getCurrentBreakpointProps: D } = ke(k.defaultServerBreakpoint), {
15
+ id: M,
16
+ label: S,
17
+ value: c,
18
+ defaultValue: j,
19
+ onChange: v,
20
+ readOnly: d = !1,
21
+ required: q,
22
+ placeholder: z,
23
+ inputProps: t,
24
+ stepMinutes: A = 1,
25
+ className: I,
26
+ availableTimes: s
27
+ } = k, {
28
+ useNativePicker: K = !1,
29
+ timePickerTrigger: w = "button",
30
+ showPicker: a = !0,
31
+ availableTimesVariant: T = "grid-buttons"
32
+ } = D(k), P = c !== void 0, [G, N] = V(c ?? j ?? ""), u = P ? c : G, [x, _] = V(!1), F = w === "input", o = K, H = ie({
33
+ open: x,
34
+ onOpenChange: _,
35
+ placement: F ? "bottom-start" : "bottom-end",
36
+ middleware: [pe(fe), ge(), he()],
37
+ whileElementsMounted: me
38
+ }), { refs: b, context: m, x: J, y: L, strategy: Q } = H, W = ne(m), X = oe(m), Y = re(m, { role: "listbox" }), y = a && F && !d && !o, R = le([...y ? [W] : [], X, Y]), p = (e) => {
39
+ const n = e.trim();
40
+ P || N(n), v == null || v(n);
41
+ }, Z = (e) => {
42
+ var g;
43
+ const n = e.target.value ?? "";
44
+ (g = t == null ? void 0 : t.onBlur) == null || g.call(t, e);
45
+ const r = ue(n);
46
+ r !== null && r !== n && p(r);
47
+ };
48
+ E(() => {
49
+ c !== void 0 && N(c);
50
+ }, [c]);
51
+ const f = ce.useRef(null);
52
+ E(() => {
53
+ var e;
54
+ (e = f.current) != null && e.inner && b.setReference(f.current.inner);
55
+ }, [b]);
56
+ const $ = () => {
57
+ var n;
58
+ const e = (n = f.current) == null ? void 0 : n.input;
59
+ if (e) {
60
+ if (typeof e.showPicker == "function") {
61
+ e.showPicker();
62
+ return;
63
+ }
64
+ e.focus();
65
+ }
66
+ }, ee = () => _((e) => !e), B = {
67
+ ...t,
68
+ id: M,
69
+ label: S,
70
+ value: u,
71
+ placeholder: z,
72
+ readOnly: d || !o && F,
73
+ icon: "schedule",
74
+ isClearable: !0,
75
+ required: q,
76
+ onIconClick: () => {
77
+ d || !a || (o ? $() : w === "button" && ee());
78
+ },
79
+ onChange: p,
80
+ onBlur: Z,
81
+ className: C(
82
+ l["tedi-time-field__textfield"],
83
+ { [l["tedi-time-field__icon--disabled"]]: !a || d },
84
+ { [l["tedi-time-field__textfield--disabled"]]: t == null ? void 0 : t.disabled },
85
+ { [l["tedi-time-field--native"]]: o }
86
+ ),
87
+ input: {
88
+ ...t == null ? void 0 : t.input,
89
+ ...o && { type: "time" }
90
+ }
91
+ };
92
+ if (!o && a && !d && T === "dropdown" && !!(s != null && s.length)) {
93
+ const e = s.indexOf(u), n = e >= 0 ? e : 0;
94
+ return /* @__PURE__ */ O(h, { width: "trigger", defaultActiveIndex: n, children: [
95
+ /* @__PURE__ */ i(h.Trigger, { children: /* @__PURE__ */ i(
96
+ "div",
97
+ {
98
+ className: C(l["tedi-time-field__container"], I, {
99
+ [l["tedi-time-field__container--native"]]: o
100
+ }),
101
+ children: /* @__PURE__ */ i(U, { ref: f, ...B })
102
+ }
103
+ ) }),
104
+ /* @__PURE__ */ i(h.Content, { children: s.map((r, g) => /* @__PURE__ */ i(h.Item, { index: g, active: r === u, onClick: () => p(r), children: r }, r)) })
105
+ ] });
106
+ }
107
+ return /* @__PURE__ */ O(te, { children: [
108
+ /* @__PURE__ */ i(
109
+ "div",
110
+ {
111
+ className: C(l["tedi-time-field__container"], I),
112
+ ...y ? R.getReferenceProps() : {},
113
+ "aria-haspopup": a ? "listbox" : void 0,
114
+ tabIndex: -1,
115
+ children: /* @__PURE__ */ i(U, { ref: f, "aria-expanded": a ? x : void 0, ...B })
116
+ }
117
+ ),
118
+ !o && a && /* @__PURE__ */ i(se, { children: x && !d && /* @__PURE__ */ i(ae, { context: m, modal: !1, initialFocus: -1, children: /* @__PURE__ */ i(
119
+ "div",
120
+ {
121
+ ref: b.setFloating,
122
+ ...R.getFloatingProps({
123
+ style: {
124
+ position: Q,
125
+ top: L ?? 0,
126
+ left: J ?? 0
127
+ }
128
+ }),
129
+ children: /* @__PURE__ */ i(
130
+ de,
131
+ {
132
+ value: u,
133
+ stepMinutes: A,
134
+ availableTimes: s,
135
+ onChange: (e) => {
136
+ p(e), s && _(!1);
137
+ },
138
+ gridVariant: T === "grid-radio" ? "radio" : "button",
139
+ className: l["tedi-time-field__picker-wrapper"]
140
+ }
141
+ )
142
+ }
143
+ ) }) })
144
+ ] });
145
+ };
146
+ ve.displayName = "TimeField";
147
+ export {
148
+ ve as TimeField
149
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-time-field__textfield":"tedi-time-field__textfield-73806efe","tedi-time-field__textfield--disabled":"tedi-time-field__textfield--disabled-86b8b11c","tedi-time-field__container":"tedi-time-field__container-45902dd9","tedi-time-field__icon--disabled":"tedi-time-field__icon--disabled-1c2b77ca","tedi-time-field__picker-wrapper":"tedi-time-field__picker-wrapper-6dd90739"};exports.default=e;