@tedi-design-system/react 18.0.0-rc.15 → 18.0.0-rc.17

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 (63) hide show
  1. package/_virtual/index.es13.js +2 -2
  2. package/_virtual/index.es14.js +2 -2
  3. package/bundle-stats.html +1 -1
  4. package/external/react-is/index.cjs.js +1 -1
  5. package/external/react-is/index.es.js +1 -1
  6. package/external/toposort/index.cjs.js +1 -1
  7. package/external/toposort/index.es.js +1 -1
  8. package/index.css +1 -1
  9. package/package.json +1 -1
  10. package/src/community/components/accordion/accordion-item/accordion-item.d.ts +3 -0
  11. package/src/community/components/accordion/accordion-item-content/accordion-item-content.d.ts +3 -0
  12. package/src/community/components/accordion/accordion-item-header/accordion-item-header.d.ts +3 -0
  13. package/src/community/components/accordion/accordion.d.ts +3 -0
  14. package/src/tedi/components/buttons/collapse-button/collapse-button.cjs.js +1 -0
  15. package/src/tedi/components/buttons/collapse-button/collapse-button.d.ts +61 -0
  16. package/src/tedi/components/buttons/collapse-button/collapse-button.es.js +68 -0
  17. package/src/tedi/components/buttons/collapse-button/collapse-button.module.scss.cjs.js +1 -0
  18. package/src/tedi/components/buttons/collapse-button/collapse-button.module.scss.es.js +17 -0
  19. package/src/tedi/components/content/accordion/accordion-context.cjs.js +1 -0
  20. package/src/tedi/components/content/accordion/accordion-context.d.ts +27 -0
  21. package/src/tedi/components/content/accordion/accordion-context.es.js +6 -0
  22. package/src/tedi/components/content/accordion/accordion-item/accordion-item-context.cjs.js +1 -0
  23. package/src/tedi/components/content/accordion/accordion-item/accordion-item-context.d.ts +24 -0
  24. package/src/tedi/components/content/accordion/accordion-item/accordion-item-context.es.js +11 -0
  25. package/src/tedi/components/content/accordion/accordion-item/accordion-item.cjs.js +1 -0
  26. package/src/tedi/components/content/accordion/accordion-item/accordion-item.d.ts +76 -0
  27. package/src/tedi/components/content/accordion/accordion-item/accordion-item.es.js +70 -0
  28. package/src/tedi/components/content/accordion/accordion-item-content/accordion-item-content.cjs.js +1 -0
  29. package/src/tedi/components/content/accordion/accordion-item-content/accordion-item-content.d.ts +16 -0
  30. package/src/tedi/components/content/accordion/accordion-item-content/accordion-item-content.es.js +31 -0
  31. package/src/tedi/components/content/accordion/accordion-item-header/accordion-item-header.cjs.js +1 -0
  32. package/src/tedi/components/content/accordion/accordion-item-header/accordion-item-header.d.ts +134 -0
  33. package/src/tedi/components/content/accordion/accordion-item-header/accordion-item-header.es.js +127 -0
  34. package/src/tedi/components/content/accordion/accordion.cjs.js +1 -0
  35. package/src/tedi/components/content/accordion/accordion.d.ts +61 -0
  36. package/src/tedi/components/content/accordion/accordion.es.js +52 -0
  37. package/src/tedi/components/content/accordion/accordion.module.scss.cjs.js +1 -0
  38. package/src/tedi/components/content/accordion/accordion.module.scss.es.js +32 -0
  39. package/src/tedi/components/content/accordion/index.d.ts +6 -0
  40. package/src/tedi/components/form/time-field/time-field-helpers.cjs.js +1 -1
  41. package/src/tedi/components/form/time-field/time-field-helpers.d.ts +1 -1
  42. package/src/tedi/components/form/time-field/time-field-helpers.es.js +1 -1
  43. package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
  44. package/src/tedi/components/form/time-field/time-field.d.ts +23 -1
  45. package/src/tedi/components/form/time-field/time-field.es.js +126 -94
  46. package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.cjs.js +1 -0
  47. package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.d.ts +30 -0
  48. package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.es.js +59 -0
  49. package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.module.scss.cjs.js +1 -0
  50. package/src/tedi/components/form/time-field/time-picker-modal/time-picker-modal.module.scss.es.js +10 -0
  51. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.cjs.js +1 -1
  52. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.d.ts +5 -1
  53. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.es.js +47 -64
  54. package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.cjs.js +1 -1
  55. package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.es.js +1 -1
  56. package/src/tedi/components/form/time-picker/time-picker.module.scss.cjs.js +1 -1
  57. package/src/tedi/components/form/time-picker/time-picker.module.scss.es.js +1 -2
  58. package/src/tedi/index.d.ts +2 -0
  59. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  60. package/src/tedi/providers/label-provider/labels-map.d.ts +21 -0
  61. package/src/tedi/providers/label-provider/labels-map.es.js +23 -2
  62. package/tedi.cjs.js +1 -1
  63. package/tedi.es.js +299 -283
@@ -1,62 +1,66 @@
1
- import { jsxs as V, jsx as i, Fragment as ne } from "react/jsx-runtime";
2
- import { useFloating as oe, useClick as re, useDismiss as le, useRole as se, useInteractions as ae, FloatingPortal as de, FloatingFocusManager as ce } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
- import C from "../../../../../external/classnames/index.es.js";
4
- import fe, { useState as E, useEffect as U } from "react";
5
- import { TextField as D } from "../textfield/textfield.es.js";
6
- import { TimePicker as me } from "../time-picker/time-picker.es.js";
7
- import l from "./time-field.module.scss.es.js";
8
- import { normalizeTime as ue, TIMEPICKER_OFFSET as pe } from "./time-field-helpers.es.js";
9
- import { autoUpdate as ge } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
10
- import { offset as he, flip as ke, shift as ve } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
11
- import { useBreakpointProps as be } from "../../../helpers/hooks/use-breakpoint-props.es.js";
12
- import { Dropdown as h } from "../../overlays/dropdown/dropdown.es.js";
13
- const xe = (k) => {
14
- const { getCurrentBreakpointProps: M } = be(k.defaultServerBreakpoint), {
15
- id: S,
16
- label: j,
1
+ import { jsxs as q, jsx as i, Fragment as fe } from "react/jsx-runtime";
2
+ import { useFloating as me, useClick as ue, useDismiss as pe, useRole as ge, useInteractions as he, FloatingPortal as ke, FloatingFocusManager as ve } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import y from "../../../../../external/classnames/index.es.js";
4
+ import be, { useState as N, useEffect as z } from "react";
5
+ import { TextField as A } from "../textfield/textfield.es.js";
6
+ import { TimePicker as Ce } from "../time-picker/time-picker.es.js";
7
+ import d from "./time-field.module.scss.es.js";
8
+ import { normalizeTime as xe, TIMEPICKER_OFFSET as _e } from "./time-field-helpers.es.js";
9
+ import { TimePickerModal as Fe } from "./time-picker-modal/time-picker-modal.es.js";
10
+ import { autoUpdate as Pe } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
11
+ import { offset as Te, flip as we, shift as Ie } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
12
+ import { useBreakpointProps as ye } from "../../../helpers/hooks/use-breakpoint-props.es.js";
13
+ import { useBreakpoint as Ne, isBreakpointBelow as Be } from "../../../helpers/hooks/use-breakpoint.es.js";
14
+ import { Dropdown as b } from "../../overlays/dropdown/dropdown.es.js";
15
+ const Oe = (C) => {
16
+ const { getCurrentBreakpointProps: K } = ye(C.defaultServerBreakpoint), {
17
+ id: G,
18
+ label: H,
17
19
  value: c,
18
- defaultValue: q,
19
- onChange: v,
20
- readOnly: I = !1,
20
+ defaultValue: J,
21
+ onChange: x,
22
+ readOnly: h = !1,
21
23
  disabled: s = !1,
22
- required: z,
23
- placeholder: A,
24
+ required: L,
25
+ placeholder: Q,
24
26
  inputProps: t,
25
- stepMinutes: K = 1,
26
- className: w,
27
- availableTimes: a
28
- } = k, {
29
- useNativePicker: G = !1,
30
- timePickerTrigger: T = "button",
31
- showPicker: d = !0,
32
- availableTimesVariant: N = "grid-buttons"
33
- } = M(k), y = c !== void 0, [H, P] = E(c ?? q ?? ""), m = y ? c : H, [b, x] = E(!1), _ = T === "input", o = G, J = oe({
34
- open: b,
35
- onOpenChange: x,
36
- placement: _ ? "bottom-start" : "bottom-end",
37
- middleware: [he(pe), ke(), ve()],
38
- whileElementsMounted: ge
39
- }), { refs: F, context: u, x: L, y: Q, strategy: W } = J, X = re(u), Y = le(u), Z = se(u, { role: "listbox" }), R = d && _ && !I && !s && !o, B = ae([...R ? [X] : [], Y, Z]), p = (e) => {
27
+ stepMinutes: B = 1,
28
+ className: O,
29
+ availableTimes: a,
30
+ modal: _ = !1,
31
+ modalProps: W
32
+ } = C, {
33
+ useNativePicker: X = !1,
34
+ timePickerTrigger: M = "button",
35
+ showPicker: o = !0,
36
+ availableTimesVariant: F = "grid-buttons"
37
+ } = K(C), R = c !== void 0, [Y, V] = N(c ?? J ?? ""), f = R ? c : Y, [P, T] = N(!1), [Z, E] = N(!1), m = M === "input", l = X, $ = Ne(), u = !l && o && !h && !s && (_ === !0 || typeof _ == "string" && Be($, _)), ee = me({
38
+ open: P,
39
+ onOpenChange: T,
40
+ placement: m ? "bottom-start" : "bottom-end",
41
+ middleware: [Te(_e), we(), Ie()],
42
+ whileElementsMounted: Pe
43
+ }), { refs: w, context: k, x: te, y: ie, strategy: oe } = ee, ne = ue(k), re = pe(k), le = ge(k, { role: "listbox" }), U = o && m && !h && !s && !l && !u, D = he([...U ? [ne] : [], re, le]), p = (e) => {
40
44
  const n = e.trim();
41
- y || P(n), v == null || v(n);
42
- }, $ = (e) => {
43
- var g;
45
+ R || V(n), x == null || x(n);
46
+ }, se = (e) => {
47
+ var v;
44
48
  const n = e.target.value ?? "";
45
- (g = t == null ? void 0 : t.onBlur) == null || g.call(t, e);
46
- const r = ue(n);
49
+ (v = t == null ? void 0 : t.onBlur) == null || v.call(t, e);
50
+ const r = xe(n);
47
51
  r !== null && r !== n && p(r);
48
52
  };
49
- U(() => {
50
- c !== void 0 && P(c);
53
+ z(() => {
54
+ c !== void 0 && V(c);
51
55
  }, [c]);
52
- const f = fe.useRef(null);
53
- U(() => {
56
+ const g = be.useRef(null);
57
+ z(() => {
54
58
  var e;
55
- (e = f.current) != null && e.inner && F.setReference(f.current.inner);
56
- }, [F]);
57
- const ee = () => {
59
+ (e = g.current) != null && e.inner && w.setReference(g.current.inner);
60
+ }, [w]);
61
+ const ae = () => {
58
62
  var n;
59
- const e = (n = f.current) == null ? void 0 : n.input;
63
+ const e = (n = g.current) == null ? void 0 : n.input;
60
64
  if (e) {
61
65
  if (typeof e.showPicker == "function") {
62
66
  e.showPicker();
@@ -64,88 +68,116 @@ const xe = (k) => {
64
68
  }
65
69
  e.focus();
66
70
  }
67
- }, te = () => x((e) => !e), ie = () => {
68
- !d || s || (o ? ee() : T === "button" && te());
69
- }, O = {
71
+ }, de = () => T((e) => !e), S = () => E(!0), ce = () => {
72
+ !o || s || (l ? ae() : u ? S() : M === "button" && de());
73
+ }, j = u && m && !h ? () => {
74
+ S();
75
+ } : void 0, I = {
70
76
  ...t,
71
- id: S,
72
- label: j,
73
- value: m,
74
- placeholder: A,
75
- readOnly: I || !o && _,
77
+ id: G,
78
+ label: H,
79
+ value: f,
80
+ placeholder: Q,
81
+ readOnly: h || !l && m,
76
82
  disabled: s || (t == null ? void 0 : t.disabled),
77
- icon: "schedule",
83
+ icon: o ? "schedule" : { name: "schedule", color: "inherit" },
78
84
  isClearable: !0,
79
- required: z,
80
- onIconClick: ie,
85
+ required: L,
86
+ onIconClick: o ? ce : void 0,
81
87
  onChange: p,
82
- onBlur: $,
83
- className: C(
84
- l["tedi-time-field__textfield"],
85
- { [l["tedi-time-field__icon--disabled"]]: !d || s },
86
- { [l["tedi-time-field__textfield--disabled"]]: s || (t == null ? void 0 : t.disabled) },
87
- { [l["tedi-time-field--native"]]: o }
88
+ onBlur: se,
89
+ className: y(
90
+ d["tedi-time-field__textfield"],
91
+ { [d["tedi-time-field__icon--disabled"]]: !o || s },
92
+ { [d["tedi-time-field__textfield--disabled"]]: s || (t == null ? void 0 : t.disabled) },
93
+ { [d["tedi-time-field--native"]]: l }
88
94
  ),
89
95
  input: {
90
96
  ...t == null ? void 0 : t.input,
91
- ...o && { type: "time" }
97
+ ...l && { type: "time" },
98
+ ...j && { onClick: j }
92
99
  }
93
100
  };
94
- if (!o && d && !s && N === "dropdown" && !!(a != null && a.length)) {
95
- const e = a.indexOf(m), n = e >= 0 ? e : 0;
96
- return /* @__PURE__ */ V(h, { width: "trigger", defaultActiveIndex: n, children: [
97
- /* @__PURE__ */ i(h.Trigger, { children: /* @__PURE__ */ i(
101
+ if (!l && o && !s && F === "dropdown" && !!(a != null && a.length)) {
102
+ const e = a.indexOf(f), n = e >= 0 ? e : 0;
103
+ return /* @__PURE__ */ q(b, { width: "trigger", defaultActiveIndex: n, children: [
104
+ /* @__PURE__ */ i(b.Trigger, { children: /* @__PURE__ */ i(
98
105
  "div",
99
106
  {
100
- className: C(l["tedi-time-field__container"], w, {
101
- [l["tedi-time-field__container--native"]]: o
107
+ className: y(d["tedi-time-field__container"], O, {
108
+ [d["tedi-time-field__container--native"]]: l
102
109
  }),
103
- children: /* @__PURE__ */ i(D, { ref: f, ...O })
110
+ children: /* @__PURE__ */ i(
111
+ A,
112
+ {
113
+ ref: g,
114
+ ...I,
115
+ input: {
116
+ ...I.input,
117
+ ...!m && {
118
+ onClick: (r) => r.stopPropagation()
119
+ }
120
+ }
121
+ }
122
+ )
104
123
  }
105
124
  ) }),
106
- /* @__PURE__ */ i(h.Content, { children: a.map((r, g) => /* @__PURE__ */ i(h.Item, { index: g, active: r === m, onClick: () => p(r), children: r }, r)) })
125
+ /* @__PURE__ */ i(b.Content, { children: a.map((r, v) => /* @__PURE__ */ i(b.Item, { index: v, active: r === f, onClick: () => p(r), children: r }, r)) })
107
126
  ] });
108
127
  }
109
- return /* @__PURE__ */ V(ne, { children: [
128
+ return /* @__PURE__ */ q(fe, { children: [
110
129
  /* @__PURE__ */ i(
111
130
  "div",
112
131
  {
113
- className: C(l["tedi-time-field__container"], w),
114
- ...R ? B.getReferenceProps() : {},
115
- "aria-haspopup": d ? "listbox" : void 0,
132
+ className: y(d["tedi-time-field__container"], O),
133
+ ...U ? D.getReferenceProps() : {},
134
+ "aria-haspopup": o ? "listbox" : void 0,
116
135
  tabIndex: -1,
117
- children: /* @__PURE__ */ i(D, { ref: f, "aria-expanded": d ? b : void 0, ...O })
136
+ children: /* @__PURE__ */ i(A, { ref: g, "aria-expanded": o ? P : void 0, ...I })
118
137
  }
119
138
  ),
120
- !o && d && !s && /* @__PURE__ */ i(de, { children: b && /* @__PURE__ */ i(ce, { context: u, modal: !1, initialFocus: -1, children: /* @__PURE__ */ i(
139
+ u && /* @__PURE__ */ i(
140
+ Fe,
141
+ {
142
+ open: Z,
143
+ onOpenChange: E,
144
+ value: f,
145
+ onConfirm: p,
146
+ stepMinutes: B,
147
+ availableTimes: a,
148
+ gridVariant: F === "grid-radio" ? "radio" : "button",
149
+ modalProps: W
150
+ }
151
+ ),
152
+ !l && o && !s && !u && /* @__PURE__ */ i(ke, { children: P && /* @__PURE__ */ i(ve, { context: k, modal: !1, initialFocus: -1, children: /* @__PURE__ */ i(
121
153
  "div",
122
154
  {
123
- ref: F.setFloating,
124
- ...B.getFloatingProps({
155
+ ref: w.setFloating,
156
+ ...D.getFloatingProps({
125
157
  style: {
126
- position: W,
127
- top: Q ?? 0,
128
- left: L ?? 0
158
+ position: oe,
159
+ top: ie ?? 0,
160
+ left: te ?? 0
129
161
  }
130
162
  }),
131
163
  children: /* @__PURE__ */ i(
132
- me,
164
+ Ce,
133
165
  {
134
- value: m,
135
- stepMinutes: K,
166
+ value: f,
167
+ stepMinutes: B,
136
168
  availableTimes: a,
137
169
  onChange: (e) => {
138
- p(e), a && x(!1);
170
+ p(e), a && T(!1);
139
171
  },
140
- gridVariant: N === "grid-radio" ? "radio" : "button",
141
- className: l["tedi-time-field__picker-wrapper"]
172
+ gridVariant: F === "grid-radio" ? "radio" : "button",
173
+ className: d["tedi-time-field__picker-wrapper"]
142
174
  }
143
175
  )
144
176
  }
145
177
  ) }) })
146
178
  ] });
147
179
  };
148
- xe.displayName = "TimeField";
180
+ Oe.displayName = "TimeField";
149
181
  export {
150
- xe as TimeField
182
+ Oe as TimeField
151
183
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),q=require("../../../../../../external/classnames/index.cjs.js"),m=require("react"),C=require("../../../base/typography/heading/heading.cjs.js"),f=require("../../../buttons/button/button.cjs.js"),_=require("../../../buttons/closing-button/closing-button.cjs.js"),b=require("../../time-picker/time-picker.cjs.js"),s=require("./time-picker-modal.module.scss.cjs.js"),l=require("../../../overlays/modal/modal.cjs.js"),T=require("../../../overlays/modal/modal-context.cjs.js"),v=require("../../../../providers/label-provider/use-labels.cjs.js"),N=({title:o})=>{const{labelId:i,onOpenChange:t}=T.useModal();return e.jsxs("div",{className:s.default["tedi-time-picker-modal__header"],children:[e.jsx(C.Heading,{element:"h2",modifiers:"h4",id:i,className:s.default["tedi-time-picker-modal__title"],children:o}),e.jsx(_.ClosingButton,{size:"small",onClick:()=>t(!1)})]})},c=o=>{const{open:i,onOpenChange:t,value:n,onConfirm:h,stepMinutes:k,availableTimes:x,gridVariant:j,modalProps:a,title:M}=o,{getLabel:r}=v.useLabels(),g=M??r("time-field.modal-title"),[d,u]=m.useState(n??"");m.useEffect(()=>{i&&u(n??"")},[i,n]);const p=()=>{d&&h(d),t(!1)};return e.jsx(l.Modal,{open:i,onToggle:t,children:e.jsxs(l.Modal.Content,{size:"small",width:"xs",...a,className:q.default(s.default["tedi-time-picker-modal"],a==null?void 0:a.className),children:[e.jsx(l.Modal.Header,{children:e.jsx(N,{title:g})}),e.jsx(l.Modal.Body,{className:s.default["tedi-time-picker-modal__body"],children:e.jsx(b.TimePicker,{value:d,stepMinutes:k,availableTimes:x,gridVariant:j,onChange:u,bordered:!1,className:s.default["tedi-time-picker-modal__picker"]})}),e.jsxs(l.Modal.Footer,{children:[e.jsx(f.Button,{visualType:"secondary",onClick:()=>t(!1),children:r("time-field.cancel")}),e.jsx(f.Button,{onClick:p,children:r("time-field.confirm")})]})]})})};c.displayName="TimePickerModal";exports.TimePickerModal=c;exports.default=c;
@@ -0,0 +1,30 @@
1
+ import { ModalContentProps } from '../../../overlays/modal';
2
+ import { TimePickerProps } from '../../time-picker/time-picker';
3
+ export interface TimePickerModalProps {
4
+ /** Whether the modal is open. Pair with `onOpenChange`. */
5
+ open: boolean;
6
+ /** Fires when the modal opens or closes (e.g. dismiss via backdrop or Escape). */
7
+ onOpenChange: (open: boolean) => void;
8
+ /** Current committed value (HH:mm). Used to seed the draft when the modal opens. */
9
+ value?: string;
10
+ /** Fires with the chosen value when the user clicks "Confirm". Cancel/dismiss do nothing. */
11
+ onConfirm: (value: string) => void;
12
+ /** Forwarded to the inner `TimePicker`. */
13
+ stepMinutes?: TimePickerProps['stepMinutes'];
14
+ /** Forwarded to the inner `TimePicker`. */
15
+ availableTimes?: TimePickerProps['availableTimes'];
16
+ /** Forwarded to the inner `TimePicker`. */
17
+ gridVariant?: TimePickerProps['gridVariant'];
18
+ /**
19
+ * Extra props spread onto `Modal.Content`, overriding the `size="small"` / `width="xs"` (capped to 312px)
20
+ * defaults (including `fullscreen`). `className` is merged, not replaced, so the internal padding reset survives.
21
+ */
22
+ modalProps?: Omit<ModalContentProps, 'children'>;
23
+ /** Modal title text. Falls back to the `time-field.modal-title` i18n key. */
24
+ title?: string;
25
+ }
26
+ export declare const TimePickerModal: {
27
+ (props: TimePickerModalProps): JSX.Element;
28
+ displayName: string;
29
+ };
30
+ export default TimePickerModal;
@@ -0,0 +1,59 @@
1
+ import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
+ import T from "../../../../../../external/classnames/index.es.js";
3
+ import { useState as _, useEffect as b } from "react";
4
+ import { Heading as v } from "../../../base/typography/heading/heading.es.js";
5
+ import { Button as f } from "../../../buttons/button/button.es.js";
6
+ import { ClosingButton as y } from "../../../buttons/closing-button/closing-button.es.js";
7
+ import { TimePicker as M } from "../../time-picker/time-picker.es.js";
8
+ import l from "./time-picker-modal.module.scss.es.js";
9
+ import { Modal as t } from "../../../overlays/modal/modal.es.js";
10
+ import { useModal as x } from "../../../overlays/modal/modal-context.es.js";
11
+ import { useLabels as B } from "../../../../providers/label-provider/use-labels.es.js";
12
+ const H = ({ title: a }) => {
13
+ const { labelId: i, onOpenChange: o } = x();
14
+ return /* @__PURE__ */ d("div", { className: l["tedi-time-picker-modal__header"], children: [
15
+ /* @__PURE__ */ e(v, { element: "h2", modifiers: "h4", id: i, className: l["tedi-time-picker-modal__title"], children: a }),
16
+ /* @__PURE__ */ e(y, { size: "small", onClick: () => o(!1) })
17
+ ] });
18
+ }, P = (a) => {
19
+ const { open: i, onOpenChange: o, value: m, onConfirm: p, stepMinutes: h, availableTimes: k, gridVariant: u, modalProps: r, title: C } = a, { getLabel: s } = B(), g = C ?? s("time-field.modal-title"), [n, c] = _(m ?? "");
20
+ b(() => {
21
+ i && c(m ?? "");
22
+ }, [i, m]);
23
+ const N = () => {
24
+ n && p(n), o(!1);
25
+ };
26
+ return /* @__PURE__ */ e(t, { open: i, onToggle: o, children: /* @__PURE__ */ d(
27
+ t.Content,
28
+ {
29
+ size: "small",
30
+ width: "xs",
31
+ ...r,
32
+ className: T(l["tedi-time-picker-modal"], r == null ? void 0 : r.className),
33
+ children: [
34
+ /* @__PURE__ */ e(t.Header, { children: /* @__PURE__ */ e(H, { title: g }) }),
35
+ /* @__PURE__ */ e(t.Body, { className: l["tedi-time-picker-modal__body"], children: /* @__PURE__ */ e(
36
+ M,
37
+ {
38
+ value: n,
39
+ stepMinutes: h,
40
+ availableTimes: k,
41
+ gridVariant: u,
42
+ onChange: c,
43
+ bordered: !1,
44
+ className: l["tedi-time-picker-modal__picker"]
45
+ }
46
+ ) }),
47
+ /* @__PURE__ */ d(t.Footer, { children: [
48
+ /* @__PURE__ */ e(f, { visualType: "secondary", onClick: () => o(!1), children: s("time-field.cancel") }),
49
+ /* @__PURE__ */ e(f, { onClick: N, children: s("time-field.confirm") })
50
+ ] })
51
+ ]
52
+ }
53
+ ) });
54
+ };
55
+ P.displayName = "TimePickerModal";
56
+ export {
57
+ P as TimePickerModal,
58
+ P as default
59
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-time-picker-modal":"tedi-time-picker-modal-10d7ab34","tedi-time-picker-modal__header":"tedi-time-picker-modal__header-8331c682","tedi-time-picker-modal__title":"tedi-time-picker-modal__title-2c759f1e","tedi-time-picker-modal__body":"tedi-time-picker-modal__body-6b342637","tedi-time-picker-modal__picker":"tedi-time-picker-modal__picker-c4de3136"};exports.default=e;
@@ -0,0 +1,10 @@
1
+ const e = {
2
+ "tedi-time-picker-modal": "tedi-time-picker-modal-10d7ab34",
3
+ "tedi-time-picker-modal__header": "tedi-time-picker-modal__header-8331c682",
4
+ "tedi-time-picker-modal__title": "tedi-time-picker-modal__title-2c759f1e",
5
+ "tedi-time-picker-modal__body": "tedi-time-picker-modal__body-6b342637",
6
+ "tedi-time-picker-modal__picker": "tedi-time-picker-modal__picker-c4de3136"
7
+ };
8
+ export {
9
+ e as default
10
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),d=require("react"),h=require("../../../../../../../external/classnames/index.cjs.js"),R=require("../../../../buttons/button/button.cjs.js"),A=require("../../../choice-group/choice-group.cjs.js"),u=require("../../time-picker.module.scss.cjs.js"),C=require("../../../../../providers/label-provider/use-labels.cjs.js"),G=require("../../../../layout/grid/row.cjs.js"),I=require("../../../../layout/grid/col.cjs.js"),k=({times:m,value:o,onSelect:f,className:w,colWidth:a={xs:6,md:4},variant:p="button",bordered:x=!0})=>{const l=d.useId(),{getLabel:q}=C.useLabels(),s=d.useRef(null);d.useEffect(()=>{if(!o)return;const e=s.current;if(!e)return;const r=e.querySelector(`input[type="radio"][value="${o}"], button[data-time="${o}"]`);r==null||r.focus({preventScroll:!0})},[]);const _=e=>{var g;if(p!=="radio")return;const r=s.current;if(!r)return;const t=Array.from(r.querySelectorAll('input[type="radio"]:not([disabled])'));if(t.length===0)return;const i=t.findIndex(j=>j===document.activeElement);let n;switch(e.key){case"ArrowDown":case"ArrowRight":n=i<0||i===t.length-1?0:i+1;break;case"ArrowUp":case"ArrowLeft":n=i<=0?t.length-1:i-1;break;case"Home":n=0;break;case"End":n=t.length-1;break;default:return}e.preventDefault(),(g=t[n])==null||g.focus()},b=h.default(u.default["tedi-time-picker__grid"],{[u.default["tedi-time-picker__grid--borderless"]]:!x},w),y=typeof a=="object"?a:{width:a};return p==="radio"?c.jsx("div",{ref:s,className:b,onKeyDown:_,children:c.jsx(A.ChoiceGroup,{id:`time-picker-group-${l}`,label:q("timePicker.pickTime"),inputType:"radio",name:`time-grid-${l}`,value:o,onChange:e=>f(e),items:m.map(e=>({id:`time-${l}-${e}`,label:e,value:e,colProps:y})),direction:"row",variant:"card",showIndicator:!0,color:"secondary",hideLabel:!0})}):c.jsx("div",{ref:s,className:b,children:c.jsx(G.Row,{gutter:2,children:m.map(e=>d.createElement(I.Col,{...y,key:e},c.jsx(R.Button,{noStyle:!0,"data-time":e,className:h.default(u.default["tedi-time-picker__grid-item"],{[u.default["tedi-time-picker__grid-item--selected"]]:e===o}),onClick:()=>f(e),children:e})))})})};k.displayName="TimeGrid";exports.TimeGrid=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),j=require("../../../../../../../external/classnames/index.cjs.js"),d=require("react"),A=require("../../../choice-group/choice-group.cjs.js"),l=require("../../time-picker.module.scss.cjs.js"),G=require("../../../../../providers/label-provider/use-labels.cjs.js"),f=({times:b,value:n,onSelect:y,className:h,colWidth:s={xs:6,md:4},variant:m="button",bordered:g=!0})=>{const c=d.useId(),{getLabel:k}=G.useLabels(),a=d.useRef(null);d.useEffect(()=>{if(!n)return;const e=a.current;if(!e)return;const r=e.querySelector(`input[type="radio"][value="${n}"]`);r==null||r.focus({preventScroll:!0})},[]);const w=e=>{var p;const r=a.current;if(!r)return;const t=Array.from(r.querySelectorAll('input[type="radio"]:not([disabled])'));if(t.length===0)return;const o=t.findIndex(_=>_===document.activeElement);let i;switch(e.key){case"ArrowDown":case"ArrowRight":i=o<0||o===t.length-1?0:o+1;break;case"ArrowUp":case"ArrowLeft":i=o<=0?t.length-1:o-1;break;case"Home":i=0;break;case"End":i=t.length-1;break;default:return}e.preventDefault(),(p=t[i])==null||p.focus()},x=j.default(l.default["tedi-time-picker__grid"],{[l.default["tedi-time-picker__grid--borderless"]]:!g},h),q=typeof s=="object"?s:{width:s};return u.jsx("div",{ref:a,className:x,onKeyDown:w,children:u.jsx(A.ChoiceGroup,{id:`time-picker-group-${c}`,label:k("timePicker.pickTime"),inputType:"radio",name:`time-grid-${c}`,value:n,onChange:e=>y(e),items:b.map(e=>({id:`time-${c}-${e}`,label:m==="button"?u.jsx("span",{className:l.default["tedi-time-picker__slot-label"],children:e}):e,value:e,colProps:q})),direction:"row",variant:"card",showIndicator:m==="radio",color:"secondary",hideLabel:!0})})};f.displayName="TimeGrid";exports.TimeGrid=f;
@@ -25,7 +25,11 @@ export interface TimeGridProps {
25
25
  */
26
26
  colWidth?: ColSize | Pick<ColProps, 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'>;
27
27
  /**
28
- * Display mode
28
+ * Display mode. Both variants render the same `ChoiceGroup` card radio
29
+ * underneath — the only difference is the leading radio indicator:
30
+ *
31
+ * - `'button'` (default) — card with the label only, no dot.
32
+ * - `'radio'` — card with the radio dot before the label.
29
33
  */
30
34
  variant?: 'button' | 'radio';
31
35
  className?: string;
@@ -1,101 +1,84 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { useId as A, useRef as C, useEffect as I, createElement as N } from "react";
3
- import h from "../../../../../../../external/classnames/index.es.js";
4
- import { Button as $ } from "../../../../buttons/button/button.es.js";
5
- import { ChoiceGroup as R } from "../../../choice-group/choice-group.es.js";
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import A from "../../../../../../../external/classnames/index.es.js";
3
+ import { useId as I, useRef as _, useEffect as N } from "react";
4
+ import { ChoiceGroup as $ } from "../../../choice-group/choice-group.es.js";
6
5
  import d from "../../time-picker.module.scss.es.js";
7
- import { useLabels as D } from "../../../../../providers/label-provider/use-labels.es.js";
8
- import { Row as E } from "../../../../layout/grid/row.es.js";
9
- import { Col as G } from "../../../../layout/grid/col.es.js";
10
- const L = ({
11
- times: l,
12
- value: o,
13
- onSelect: u,
14
- className: k,
15
- colWidth: a = { xs: 6, md: 4 },
16
- variant: p = "button",
17
- bordered: g = !0
6
+ import { useLabels as v } from "../../../../../providers/label-provider/use-labels.es.js";
7
+ const C = ({
8
+ times: p,
9
+ value: n,
10
+ onSelect: f,
11
+ className: b,
12
+ colWidth: s = { xs: 6, md: 4 },
13
+ variant: m = "button",
14
+ bordered: y = !0
18
15
  }) => {
19
- const m = A(), { getLabel: w } = D(), s = C(null);
20
- I(() => {
21
- if (!o) return;
22
- const e = s.current;
16
+ const c = I(), { getLabel: h } = v(), a = _(null);
17
+ N(() => {
18
+ if (!n) return;
19
+ const e = a.current;
23
20
  if (!e) return;
24
- const r = e.querySelector(
25
- `input[type="radio"][value="${o}"], button[data-time="${o}"]`
26
- );
21
+ const r = e.querySelector(`input[type="radio"][value="${n}"]`);
27
22
  r == null || r.focus({ preventScroll: !0 });
28
23
  }, []);
29
- const _ = (e) => {
30
- var b;
31
- if (p !== "radio") return;
32
- const r = s.current;
24
+ const k = (e) => {
25
+ var u;
26
+ const r = a.current;
33
27
  if (!r) return;
34
28
  const t = Array.from(r.querySelectorAll('input[type="radio"]:not([disabled])'));
35
29
  if (t.length === 0) return;
36
- const i = t.findIndex((x) => x === document.activeElement);
37
- let n;
30
+ const o = t.findIndex((x) => x === document.activeElement);
31
+ let i;
38
32
  switch (e.key) {
39
33
  case "ArrowDown":
40
34
  case "ArrowRight":
41
- n = i < 0 || i === t.length - 1 ? 0 : i + 1;
35
+ i = o < 0 || o === t.length - 1 ? 0 : o + 1;
42
36
  break;
43
37
  case "ArrowUp":
44
38
  case "ArrowLeft":
45
- n = i <= 0 ? t.length - 1 : i - 1;
39
+ i = o <= 0 ? t.length - 1 : o - 1;
46
40
  break;
47
41
  case "Home":
48
- n = 0;
42
+ i = 0;
49
43
  break;
50
44
  case "End":
51
- n = t.length - 1;
45
+ i = t.length - 1;
52
46
  break;
53
47
  default:
54
48
  return;
55
49
  }
56
- e.preventDefault(), (b = t[n]) == null || b.focus();
57
- }, f = h(
50
+ e.preventDefault(), (u = t[i]) == null || u.focus();
51
+ }, w = A(
58
52
  d["tedi-time-picker__grid"],
59
53
  {
60
- [d["tedi-time-picker__grid--borderless"]]: !g
54
+ [d["tedi-time-picker__grid--borderless"]]: !y
61
55
  },
62
- k
63
- ), y = typeof a == "object" ? a : { width: a };
64
- return p === "radio" ? /* @__PURE__ */ c("div", { ref: s, className: f, onKeyDown: _, children: /* @__PURE__ */ c(
65
- R,
56
+ b
57
+ ), g = typeof s == "object" ? s : { width: s };
58
+ return /* @__PURE__ */ l("div", { ref: a, className: w, onKeyDown: k, children: /* @__PURE__ */ l(
59
+ $,
66
60
  {
67
- id: `time-picker-group-${m}`,
68
- label: w("timePicker.pickTime"),
61
+ id: `time-picker-group-${c}`,
62
+ label: h("timePicker.pickTime"),
69
63
  inputType: "radio",
70
- name: `time-grid-${m}`,
71
- value: o,
72
- onChange: (e) => u(e),
73
- items: l.map((e) => ({
74
- id: `time-${m}-${e}`,
75
- label: e,
64
+ name: `time-grid-${c}`,
65
+ value: n,
66
+ onChange: (e) => f(e),
67
+ items: p.map((e) => ({
68
+ id: `time-${c}-${e}`,
69
+ label: m === "button" ? /* @__PURE__ */ l("span", { className: d["tedi-time-picker__slot-label"], children: e }) : e,
76
70
  value: e,
77
- colProps: y
71
+ colProps: g
78
72
  })),
79
73
  direction: "row",
80
74
  variant: "card",
81
- showIndicator: !0,
75
+ showIndicator: m === "radio",
82
76
  color: "secondary",
83
77
  hideLabel: !0
84
78
  }
85
- ) }) : /* @__PURE__ */ c("div", { ref: s, className: f, children: /* @__PURE__ */ c(E, { gutter: 2, children: l.map((e) => /* @__PURE__ */ N(G, { ...y, key: e }, /* @__PURE__ */ c(
86
- $,
87
- {
88
- noStyle: !0,
89
- "data-time": e,
90
- className: h(d["tedi-time-picker__grid-item"], {
91
- [d["tedi-time-picker__grid-item--selected"]]: e === o
92
- }),
93
- onClick: () => u(e),
94
- children: e
95
- }
96
- ))) }) });
79
+ ) });
97
80
  };
98
- L.displayName = "TimeGrid";
81
+ C.displayName = "TimeGrid";
99
82
  export {
100
- L as TimeGrid
83
+ C as TimeGrid
101
84
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),j=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),t=require("../../../time-field/time-field-helpers.cjs.js"),p=require("../../time-picker.module.scss.cjs.js"),F=({hours:c,minutes:l,selectedHour:a,selectedMinute:s,onChange:x,className:P,bordered:L=!0})=>{const I=n.useId(),i=n.useRef(null),d=n.useRef(null),f=n.useRef(!1),m=n.useRef(!1),g=n.useRef(),k=n.useRef(),v=n.useRef(-1),b=n.useRef(-1),[M,R]=n.useState(null),[C,$]=n.useState(null),N=(r,e)=>Math.max(0,Math.min(e-1,r)),A=(r,e,o)=>{const T=r.current;if(!T||e<0)return;const w=t.getScrollTopForIndex(e);o?f.current=!0:m.current=!0,T.scrollTo({top:w,behavior:"instant"}),requestAnimationFrame(()=>{o?f.current=!1:m.current=!1})};n.useLayoutEffect(()=>{const r=c.indexOf(a),e=l.indexOf(s);r!==v.current&&(v.current=r,A(i,r,!0)),e!==b.current&&(b.current=e,A(d,e,!1)),R(r),$(e)},[c,l,a,s]);const q=n.useRef(()=>{});q.current=()=>{const r=i.current;if(!r||f.current)return;t.clearScrollTimeout(g.current);const e=N(t.snapToNearestItem(r.scrollTop,c.length),c.length);R(e);const o=t.getScrollTopForIndex(e);t.needsScrollCorrection(r.scrollTop,o,8)&&(f.current=!0,t.scrollToIndex(r,e,"instant"),requestAnimationFrame(()=>{f.current=!1})),e!==v.current&&(v.current=e,x(c[e],s))};const y=n.useRef(()=>{});y.current=()=>{const r=d.current;if(!r||m.current)return;t.clearScrollTimeout(k.current);const e=N(t.snapToNearestItem(r.scrollTop,l.length),l.length);$(e);const o=t.getScrollTopForIndex(e);t.needsScrollCorrection(r.scrollTop,o,8)&&(m.current=!0,t.scrollToIndex(r,e,"instant"),requestAnimationFrame(()=>{m.current=!1})),e!==b.current&&(b.current=e,x(a,l[e]))},n.useEffect(()=>{const r=i.current,e=d.current;if(!r||!e)return;const o=()=>q.current(),T=()=>y.current();return r.addEventListener("scrollend",o),e.addEventListener("scrollend",T),()=>{r.removeEventListener("scrollend",o),e.removeEventListener("scrollend",T)}},[]);const H=()=>{if(!i.current||f.current)return;const r=N(t.snapToNearestItem(i.current.scrollTop,c.length),c.length);R(r),t.clearScrollTimeout(g.current),g.current=setTimeout(()=>q.current(),150)},K=()=>{if(!d.current||m.current)return;const r=N(t.snapToNearestItem(d.current.scrollTop,l.length),l.length);$(r),t.clearScrollTimeout(k.current),k.current=setTimeout(()=>y.current(),150)},W=r=>{const e=c[r];!e||!i.current||(t.clearScrollTimeout(g.current),v.current=r,R(r),x(e,s),f.current=!0,t.scrollToIndex(i.current,r,"smooth"),setTimeout(()=>{f.current=!1},300))},U=r=>{const e=l[r];!e||!d.current||(t.clearScrollTimeout(k.current),b.current=r,$(r),x(a,e),m.current=!0,t.scrollToIndex(d.current,r,"smooth"),setTimeout(()=>{m.current=!1},300))},D=(r,e,o,T)=>w=>{const u=e.indexOf(o);if(u===-1)return;let h=-1,_=!1;switch(w.key){case"ArrowDown":h=(u+1)%e.length,_=u===e.length-1;break;case"ArrowUp":h=(u-1+e.length)%e.length,_=u===0;break;case"Home":h=0;break;case"End":h=e.length-1;break;case"PageDown":h=(u+5)%e.length,_=u+5>=e.length;break;case"PageUp":h=(u-5+e.length)%e.length,_=u-5<0;break;case"Enter":case" ":w.preventDefault(),T(e[u]);return;default:return}w.preventDefault();const O=r==="hour"?i.current:d.current,S=O==null?void 0:O.querySelector(`#${CSS.escape(`${I}-${r}-${h}`)}`);S==null||S.focus(),S==null||S.scrollIntoView({block:"center",behavior:_?"auto":"smooth"})};return n.useEffect(()=>()=>{t.clearScrollTimeout(g.current),t.clearScrollTimeout(k.current)},[]),E.jsxs("div",{className:j.default(p.default["tedi-time-picker__wheel"],{[p.default["tedi-time-picker__wheel--borderless"]]:!L},P),children:[E.jsx("div",{ref:i,role:"listbox","aria-label":"Hours",tabIndex:0,"aria-activedescendant":`${I}-hour-${c.indexOf(a)}`,className:p.default["tedi-time-picker__wheel-column"],onScroll:H,onKeyDown:D("hour",c,a,r=>x(r,s)),children:c.map((r,e)=>E.jsx("div",{className:j.default(p.default["tedi-time-picker__wheel-item"],{[p.default["tedi-time-picker__wheel-item--selected"]]:e===(M??c.indexOf(a))}),onClick:()=>W(e),id:`${I}-hour-${e}`,role:"option","aria-selected":r===a,children:r},r))}),E.jsx("div",{ref:d,role:"listbox",className:p.default["tedi-time-picker__wheel-column"],onScroll:K,"aria-label":"Minutes",tabIndex:0,"aria-activedescendant":`${I}-minute-${l.indexOf(s)}`,onKeyDown:D("minute",l,s,r=>x(a,r)),children:l.map((r,e)=>E.jsx("div",{className:j.default(p.default["tedi-time-picker__wheel-item"],{[p.default["tedi-time-picker__wheel-item--selected"]]:e===(C??l.indexOf(s))}),onClick:()=>U(e),id:`${I}-minute-${e}`,role:"option","aria-selected":r===s,children:r},r))})]})};F.displayName="TimeWheel";exports.TimeWheel=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),j=require("../../../../../../../external/classnames/index.cjs.js"),n=require("react"),t=require("../../../time-field/time-field-helpers.cjs.js"),p=require("../../time-picker.module.scss.cjs.js"),F=({hours:c,minutes:l,selectedHour:s,selectedMinute:a,onChange:x,className:P,bordered:L=!0})=>{const I=n.useId(),i=n.useRef(null),d=n.useRef(null),f=n.useRef(!1),m=n.useRef(!1),g=n.useRef(),k=n.useRef(),v=n.useRef(-1),b=n.useRef(-1),[M,R]=n.useState(null),[C,$]=n.useState(null),N=(r,e)=>Math.max(0,Math.min(e-1,r)),A=(r,e,o)=>{const T=r.current;if(!T||e<0)return;const w=t.getScrollTopForIndex(e);o?f.current=!0:m.current=!0,T.scrollTo({top:w,behavior:"instant"}),requestAnimationFrame(()=>{o?f.current=!1:m.current=!1})};n.useLayoutEffect(()=>{const r=c.indexOf(s),e=l.indexOf(a);r!==v.current&&(v.current=r,A(i,r,!0)),e!==b.current&&(b.current=e,A(d,e,!1)),R(r),$(e)},[c,l,s,a]);const q=n.useRef(()=>{});q.current=()=>{const r=i.current;if(!r||f.current)return;t.clearScrollTimeout(g.current);const e=N(t.snapToNearestItem(r.scrollTop,c.length),c.length);R(e);const o=t.getScrollTopForIndex(e);t.needsScrollCorrection(r.scrollTop,o,8)&&(f.current=!0,t.scrollToIndex(r,e,"instant"),requestAnimationFrame(()=>{f.current=!1})),e!==v.current&&(v.current=e,x(c[e],a))};const y=n.useRef(()=>{});y.current=()=>{const r=d.current;if(!r||m.current)return;t.clearScrollTimeout(k.current);const e=N(t.snapToNearestItem(r.scrollTop,l.length),l.length);$(e);const o=t.getScrollTopForIndex(e);t.needsScrollCorrection(r.scrollTop,o,8)&&(m.current=!0,t.scrollToIndex(r,e,"instant"),requestAnimationFrame(()=>{m.current=!1})),e!==b.current&&(b.current=e,x(s,l[e]))},n.useEffect(()=>{const r=i.current,e=d.current;if(!r||!e)return;const o=()=>q.current(),T=()=>y.current();return r.addEventListener("scrollend",o),e.addEventListener("scrollend",T),()=>{r.removeEventListener("scrollend",o),e.removeEventListener("scrollend",T)}},[]);const H=()=>{if(!i.current||f.current)return;const r=N(t.snapToNearestItem(i.current.scrollTop,c.length),c.length);R(r),t.clearScrollTimeout(g.current),g.current=setTimeout(()=>q.current(),150)},K=()=>{if(!d.current||m.current)return;const r=N(t.snapToNearestItem(d.current.scrollTop,l.length),l.length);$(r),t.clearScrollTimeout(k.current),k.current=setTimeout(()=>y.current(),150)},W=r=>{const e=c[r];!e||!i.current||(t.clearScrollTimeout(g.current),v.current=r,R(r),x(e,a),f.current=!0,t.scrollToIndex(i.current,r,"smooth"),setTimeout(()=>{f.current=!1},300))},U=r=>{const e=l[r];!e||!d.current||(t.clearScrollTimeout(k.current),b.current=r,$(r),x(s,e),m.current=!0,t.scrollToIndex(d.current,r,"smooth"),setTimeout(()=>{m.current=!1},300))},D=(r,e,o,T)=>w=>{const u=e.indexOf(o);if(u===-1)return;let h=-1,_=!1;switch(w.key){case"ArrowDown":h=(u+1)%e.length,_=u===e.length-1;break;case"ArrowUp":h=(u-1+e.length)%e.length,_=u===0;break;case"Home":h=0;break;case"End":h=e.length-1;break;case"PageDown":h=(u+5)%e.length,_=u+5>=e.length;break;case"PageUp":h=(u-5+e.length)%e.length,_=u-5<0;break;case"Enter":case" ":w.preventDefault(),T(e[u]);return;default:return}w.preventDefault();const O=r==="hour"?i.current:d.current,S=O==null?void 0:O.querySelector(`#${CSS.escape(`${I}-${r}-${h}`)}`);S==null||S.focus(),S==null||S.scrollIntoView({block:"center",behavior:_?"instant":"smooth"})};return n.useEffect(()=>()=>{t.clearScrollTimeout(g.current),t.clearScrollTimeout(k.current)},[]),E.jsxs("div",{className:j.default(p.default["tedi-time-picker__wheel"],{[p.default["tedi-time-picker__wheel--borderless"]]:!L},P),children:[E.jsx("div",{ref:i,role:"listbox","aria-label":"Hours",tabIndex:0,"aria-activedescendant":`${I}-hour-${c.indexOf(s)}`,className:p.default["tedi-time-picker__wheel-column"],onScroll:H,onKeyDown:D("hour",c,s,r=>x(r,a)),children:c.map((r,e)=>E.jsx("div",{className:j.default(p.default["tedi-time-picker__wheel-item"],{[p.default["tedi-time-picker__wheel-item--selected"]]:e===(M??c.indexOf(s))}),onClick:()=>W(e),id:`${I}-hour-${e}`,role:"option","aria-selected":r===s,children:r},r))}),E.jsx("div",{ref:d,role:"listbox",className:p.default["tedi-time-picker__wheel-column"],onScroll:K,"aria-label":"Minutes",tabIndex:0,"aria-activedescendant":`${I}-minute-${l.indexOf(a)}`,onKeyDown:D("minute",l,a,r=>x(s,r)),children:l.map((r,e)=>E.jsx("div",{className:j.default(p.default["tedi-time-picker__wheel-item"],{[p.default["tedi-time-picker__wheel-item--selected"]]:e===(C??l.indexOf(a))}),onClick:()=>U(e),id:`${I}-minute-${e}`,role:"option","aria-selected":r===a,children:r},r))})]})};F.displayName="TimeWheel";exports.TimeWheel=F;
@@ -107,7 +107,7 @@ const Y = ({
107
107
  }
108
108
  I.preventDefault();
109
109
  const q = r === "hour" ? a.current : s.current, T = q == null ? void 0 : q.querySelector(`#${CSS.escape(`${g}-${r}-${x}`)}`);
110
- T == null || T.focus(), T == null || T.scrollIntoView({ block: "center", behavior: b ? "auto" : "smooth" });
110
+ T == null || T.focus(), T == null || T.scrollIntoView({ block: "center", behavior: b ? "instant" : "smooth" });
111
111
  };
112
112
  return j(() => () => {
113
113
  d(v.current), d(S.current);
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-time-picker__wheel":"tedi-time-picker__wheel-3c73e157","tedi-time-picker__wheel--borderless":"tedi-time-picker__wheel--borderless-42e8669c","tedi-time-picker__wheel-column":"tedi-time-picker__wheel-column-02048315","tedi-time-picker__wheel-item":"tedi-time-picker__wheel-item-78600fe1","tedi-time-picker__wheel-item--selected":"tedi-time-picker__wheel-item--selected-cc3c7194","tedi-time-picker__grid":"tedi-time-picker__grid-5cf42402","tedi-time-picker__grid--borderless":"tedi-time-picker__grid--borderless-805d6413","tedi-time-picker__grid-item":"tedi-time-picker__grid-item-53c9d41d","tedi-time-picker__grid-item--selected":"tedi-time-picker__grid-item--selected-32fb5e5d"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-time-picker__wheel":"tedi-time-picker__wheel-3c73e157","tedi-time-picker__wheel--borderless":"tedi-time-picker__wheel--borderless-42e8669c","tedi-time-picker__wheel-column":"tedi-time-picker__wheel-column-02048315","tedi-time-picker__wheel-item":"tedi-time-picker__wheel-item-78600fe1","tedi-time-picker__wheel-item--selected":"tedi-time-picker__wheel-item--selected-cc3c7194","tedi-time-picker__grid":"tedi-time-picker__grid-5cf42402","tedi-time-picker__grid--borderless":"tedi-time-picker__grid--borderless-805d6413","tedi-time-picker__slot-label":"tedi-time-picker__slot-label-87a1b0e8"};exports.default=e;
@@ -6,8 +6,7 @@ const e = {
6
6
  "tedi-time-picker__wheel-item--selected": "tedi-time-picker__wheel-item--selected-cc3c7194",
7
7
  "tedi-time-picker__grid": "tedi-time-picker__grid-5cf42402",
8
8
  "tedi-time-picker__grid--borderless": "tedi-time-picker__grid--borderless-805d6413",
9
- "tedi-time-picker__grid-item": "tedi-time-picker__grid-item-53c9d41d",
10
- "tedi-time-picker__grid-item--selected": "tedi-time-picker__grid-item--selected-32fb5e5d"
9
+ "tedi-time-picker__slot-label": "tedi-time-picker__slot-label-87a1b0e8"
11
10
  };
12
11
  export {
13
12
  e as default