@tedi-design-system/react 19.2.0-rc.5 → 19.2.0-rc.7

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 (56) hide show
  1. package/bundle-stats.html +1 -1
  2. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  3. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  4. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  5. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  6. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  7. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  8. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  9. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  10. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  11. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  12. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  13. package/external/prop-types/external/react-is/index.es.js +1 -1
  14. package/package.json +1 -1
  15. package/src/tedi/components/content/carousel/components/carousel-indicators/carousel-indicators.cjs.js +1 -1
  16. package/src/tedi/components/content/carousel/components/carousel-indicators/carousel-indicators.es.js +18 -18
  17. package/src/tedi/components/content/carousel/use-carousel.cjs.js +1 -1
  18. package/src/tedi/components/content/carousel/use-carousel.d.ts +2 -1
  19. package/src/tedi/components/content/carousel/use-carousel.es.js +177 -163
  20. package/src/tedi/components/content/label/label.cjs.js +1 -1
  21. package/src/tedi/components/content/label/label.d.ts +22 -0
  22. package/src/tedi/components/content/label/label.es.js +30 -28
  23. package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
  24. package/src/tedi/components/form/checkbox/checkbox.es.js +32 -30
  25. package/src/tedi/components/form/choice-group/choice-group.cjs.js +1 -1
  26. package/src/tedi/components/form/choice-group/choice-group.es.js +80 -69
  27. package/src/tedi/components/form/choice-input.types.d.ts +7 -0
  28. package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
  29. package/src/tedi/components/form/date-field/date-field.d.ts +5 -0
  30. package/src/tedi/components/form/date-field/date-field.es.js +187 -184
  31. package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -1
  32. package/src/tedi/components/form/date-time-field/date-time-field.d.ts +5 -0
  33. package/src/tedi/components/form/date-time-field/date-time-field.es.js +103 -101
  34. package/src/tedi/components/form/form-label/form-label.cjs.js +1 -1
  35. package/src/tedi/components/form/form-label/form-label.d.ts +9 -0
  36. package/src/tedi/components/form/form-label/form-label.es.js +15 -14
  37. package/src/tedi/components/form/multi-value-field/multi-value-field.cjs.js +1 -1
  38. package/src/tedi/components/form/multi-value-field/multi-value-field.d.ts +7 -0
  39. package/src/tedi/components/form/multi-value-field/multi-value-field.es.js +41 -40
  40. package/src/tedi/components/form/number-field/number-field.cjs.js +1 -1
  41. package/src/tedi/components/form/number-field/number-field.es.js +54 -43
  42. package/src/tedi/components/form/radio/radio.cjs.js +1 -1
  43. package/src/tedi/components/form/radio/radio.es.js +30 -28
  44. package/src/tedi/components/form/select/select.cjs.js +1 -1
  45. package/src/tedi/components/form/select/select.es.js +79 -77
  46. package/src/tedi/components/form/slider/slider.cjs.js +1 -1
  47. package/src/tedi/components/form/slider/slider.d.ts +7 -0
  48. package/src/tedi/components/form/slider/slider.es.js +48 -47
  49. package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
  50. package/src/tedi/components/form/textfield/textfield.es.js +72 -61
  51. package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
  52. package/src/tedi/components/form/time-field/time-field.d.ts +5 -0
  53. package/src/tedi/components/form/time-field/time-field.es.js +87 -85
  54. package/src/tedi/components/form/toggle/toggle.cjs.js +1 -1
  55. package/src/tedi/components/form/toggle/toggle.d.ts +7 -0
  56. package/src/tedi/components/form/toggle/toggle.es.js +26 -24
@@ -1,73 +1,74 @@
1
1
  import { jsx as n, jsxs as S } from "react/jsx-runtime";
2
2
  import _ from "../../../../../external/classnames/index.es.js";
3
- import y, { forwardRef as be, useMemo as b, useCallback as w } from "react";
3
+ import y, { forwardRef as Ie, useMemo as b, useCallback as w } from "react";
4
4
  import { Icon as D } from "../../base/icon/icon.es.js";
5
- import { ClosingButton as Ie } from "../../buttons/closing-button/closing-button.es.js";
6
- import { Separator as ge } from "../../misc/separator/separator.es.js";
5
+ import { ClosingButton as ge } from "../../buttons/closing-button/closing-button.es.js";
6
+ import { Separator as Ne } from "../../misc/separator/separator.es.js";
7
7
  import { FeedbackText as U } from "../feedback-text/feedback-text.es.js";
8
- import { Field as Ne } from "../field/field.es.js";
9
- import { FormLabel as Ae } from "../form-label/form-label.es.js";
10
- import { useOptionalInputGroup as Ce } from "../input-group/input-group.es.js";
8
+ import { Field as Ae } from "../field/field.es.js";
9
+ import { FormLabel as Ce } from "../form-label/form-label.es.js";
10
+ import { useOptionalInputGroup as ke } from "../input-group/input-group.es.js";
11
11
  import r from "./textfield.module.scss.es.js";
12
- import { useBreakpointProps as ke } from "../../../helpers/hooks/use-breakpoint-props.es.js";
13
- import { useLabels as Se } from "../../../providers/label-provider/use-labels.es.js";
14
- const we = {
12
+ import { useBreakpointProps as Se } from "../../../helpers/hooks/use-breakpoint-props.es.js";
13
+ import { useLabels as we } from "../../../providers/label-provider/use-labels.es.js";
14
+ const Be = {
15
15
  large: 24,
16
16
  default: 18
17
- }, Be = be((I, J) => {
17
+ }, ze = Ie((I, J) => {
18
18
  var M;
19
- const { getCurrentBreakpointProps: Q } = ke(I.defaultServerBreakpoint), {
20
- id: ze,
19
+ const { getCurrentBreakpointProps: Q } = Se(I.defaultServerBreakpoint), {
20
+ id: Fe,
21
21
  label: g,
22
22
  className: W,
23
23
  inputClassName: X,
24
24
  disabled: d,
25
25
  required: B,
26
26
  hideLabel: z,
27
+ labelProps: Y,
27
28
  invalid: f,
28
29
  readOnly: F,
29
30
  icon: i,
30
31
  onIconClick: x,
31
32
  iconButtonProps: p,
32
33
  size: s = "default",
33
- placeholder: Y,
34
- isArrowsHidden: Z = !0,
34
+ placeholder: Z,
35
+ isArrowsHidden: G = !0,
35
36
  isClearable: R,
36
- showClearOnInteraction: G,
37
+ showClearOnInteraction: ee,
37
38
  onClear: v,
38
39
  onChange: o,
39
- onChangeEvent: ee,
40
- onKeyUp: re,
41
- onKeyDown: te,
42
- onKeyPress: ae,
40
+ onChangeEvent: re,
41
+ onKeyUp: te,
42
+ onKeyDown: ae,
43
+ onKeyPress: ie,
43
44
  defaultValue: $,
44
45
  value: N,
45
46
  onFocus: A,
46
47
  onBlur: C,
47
- onClick: ie,
48
+ onClick: le,
48
49
  helper: e,
49
50
  input: a,
50
- name: le,
51
- isTextArea: ne,
52
- startSlot: se,
53
- endSlot: oe,
54
- ...de
55
- } = Q(I) || {}, { getLabel: L } = Se(), O = y.useRef(null), T = y.useRef(null), [ce, E] = y.useState(N ?? $ ?? ""), P = N ?? ce, c = !!(R && P && !F), m = (M = Ce) == null ? void 0 : M(), fe = y.useId(), me = m == null ? void 0 : m.hasExternalLabel, u = I.id ?? (m == null ? void 0 : m.inputId) ?? fe;
51
+ name: ne,
52
+ isTextArea: se,
53
+ startSlot: oe,
54
+ endSlot: de,
55
+ ...ce
56
+ } = Q(I) || {}, { getLabel: L } = we(), O = y.useRef(null), P = y.useRef(null), [fe, T] = y.useState(N ?? $ ?? ""), E = N ?? fe, c = !!(R && E && !F), m = (M = ke) == null ? void 0 : M(), me = y.useId(), ue = m == null ? void 0 : m.hasExternalLabel, u = I.id ?? (m == null ? void 0 : m.inputId) ?? me;
56
57
  y.useImperativeHandle(J, () => ({
57
58
  get input() {
58
- return T.current;
59
+ return P.current;
59
60
  },
60
61
  get inner() {
61
62
  return O.current;
62
63
  }
63
64
  }));
64
- const V = b(() => Array.isArray(e) ? f || e.some((t) => t.type === "error") : f || (e == null ? void 0 : e.type) === "error", [f, e]), ue = b(() => !e || Array.isArray(e) && e.length === 0 ? !1 : Array.isArray(e) ? !f && e.every((t) => t.type === "valid") : !f && e.type === "valid", [f, e]), pe = s === "large" ? "default" : s, h = N !== void 0, ye = w(
65
+ const V = b(() => Array.isArray(e) ? f || e.some((t) => t.type === "error") : f || (e == null ? void 0 : e.type) === "error", [f, e]), pe = b(() => !e || Array.isArray(e) && e.length === 0 ? !1 : Array.isArray(e) ? !f && e.every((t) => t.type === "valid") : !f && e.type === "valid", [f, e]), ye = s === "large" ? "default" : s, h = N !== void 0, xe = w(
65
66
  (t) => {
66
- h || E(t), o == null || o(t);
67
+ h || T(t), o == null || o(t);
67
68
  },
68
69
  [h, o]
69
70
  ), j = w(() => {
70
- h || E(""), o == null || o(""), v == null || v();
71
+ h || T(""), o == null || o(""), v == null || v();
71
72
  }, [h, o, v]), H = w(() => {
72
73
  if (!i) return null;
73
74
  const k = {
@@ -86,35 +87,35 @@ const we = {
86
87
  }
87
88
  ) : /* @__PURE__ */ n("div", { className: r["tedi-textfield__icon-wrapper"], "aria-hidden": "true", children: /* @__PURE__ */ n(D, { ...q }) });
88
89
  }, [i, s, x, p, d]), K = b(() => c ? /* @__PURE__ */ n(
89
- Ie,
90
+ ge,
90
91
  {
91
- iconSize: we[s === "large" ? "large" : "default"],
92
+ iconSize: Be[s === "large" ? "large" : "default"],
92
93
  onClick: d ? void 0 : j,
93
94
  disabled: d,
94
95
  title: L("clear"),
95
96
  className: r["tedi-textfield__clear-button"]
96
97
  }
97
- ) : null, [c, s, d, j, L]), xe = b(() => !c && !i ? null : /* @__PURE__ */ S("div", { className: r["tedi-textfield__right-area"], children: [
98
+ ) : null, [c, s, d, j, L]), ve = b(() => !c && !i ? null : /* @__PURE__ */ S("div", { className: r["tedi-textfield__right-area"], children: [
98
99
  K,
99
- c && i && /* @__PURE__ */ n(ge, { color: "primary", axis: "vertical", className: r["tedi-textfield__separator"] }),
100
+ c && i && /* @__PURE__ */ n(Ne, { color: "primary", axis: "vertical", className: r["tedi-textfield__separator"] }),
100
101
  i && H()
101
- ] }), [c, i, K, H]), ve = /* @__PURE__ */ n(
102
- Ne,
102
+ ] }), [c, i, K, H]), he = /* @__PURE__ */ n(
103
+ Ae,
103
104
  {
104
105
  ...a,
105
106
  id: u,
106
- name: le,
107
- value: P,
107
+ name: ne,
108
+ value: E,
108
109
  defaultValue: $,
109
- onChange: ye,
110
- onChangeEvent: ee,
110
+ onChange: xe,
111
+ onChangeEvent: re,
111
112
  disabled: d,
112
113
  readOnly: F || (a == null ? void 0 : a.readOnly),
113
114
  required: B,
114
115
  invalid: V,
115
- placeholder: Y,
116
+ placeholder: Z,
116
117
  className: _(r["tedi-textfield__input"], X, {
117
- [r["tedi-textfield__input--hidden-arrows"]]: Z
118
+ [r["tedi-textfield__input--hidden-arrows"]]: G
118
119
  }),
119
120
  onFocus: (t) => {
120
121
  var l;
@@ -124,45 +125,55 @@ const we = {
124
125
  var l;
125
126
  (l = a == null ? void 0 : a.onBlur) == null || l.call(a, t), C == null || C(t);
126
127
  },
127
- isTextArea: ne,
128
+ isTextArea: se,
128
129
  "aria-describedby": !e || Array.isArray(e) && e.length === 0 ? void 0 : Array.isArray(e) ? e.map((t, l) => `${u}-helper-${l}`).join(" ") : `${u}-helper`,
129
130
  "aria-label": z && typeof g == "string" ? g : void 0,
130
- ref: T
131
+ ref: P
131
132
  }
132
- ), he = _(
133
+ ), _e = _(
133
134
  r["tedi-textfield"],
134
135
  { [r[`tedi-textfield--${s}`]]: s },
135
136
  { [r["tedi-textfield--with-icon"]]: i },
136
137
  { [r["tedi-textfield--invalid"]]: V },
137
- { [r["tedi-textfield--valid"]]: ue },
138
+ { [r["tedi-textfield--valid"]]: pe },
138
139
  { [r["tedi-textfield--clearable"]]: c },
139
- { [r["tedi-textfield--clear-on-interaction"]]: c && G },
140
+ { [r["tedi-textfield--clear-on-interaction"]]: c && ee },
140
141
  W
141
- ), _e = () => !e || Array.isArray(e) && e.length === 0 ? null : /* @__PURE__ */ n("div", { className: r["tedi-textfield__feedback-wrapper"], children: Array.isArray(e) ? e.map((t, l) => /* @__PURE__ */ n(U, { ...t, id: `${u}-helper-${l}` }, l)) : /* @__PURE__ */ n(U, { ...e, id: `${u}-helper` }) });
142
- return /* @__PURE__ */ S("div", { "data-name": "textfield", ...de, className: he, children: [
143
- !me && /* @__PURE__ */ n(Ae, { id: u, label: g, required: B, hideLabel: z, size: pe }),
142
+ ), be = () => !e || Array.isArray(e) && e.length === 0 ? null : /* @__PURE__ */ n("div", { className: r["tedi-textfield__feedback-wrapper"], children: Array.isArray(e) ? e.map((t, l) => /* @__PURE__ */ n(U, { ...t, id: `${u}-helper-${l}` }, l)) : /* @__PURE__ */ n(U, { ...e, id: `${u}-helper` }) });
143
+ return /* @__PURE__ */ S("div", { "data-name": "textfield", ...ce, className: _e, children: [
144
+ !ue && /* @__PURE__ */ n(
145
+ Ce,
146
+ {
147
+ id: u,
148
+ label: g,
149
+ required: B,
150
+ hideLabel: z,
151
+ size: ye,
152
+ labelProps: Y
153
+ }
154
+ ),
144
155
  /* @__PURE__ */ S(
145
156
  "div",
146
157
  {
147
158
  className: r["tedi-textfield__inner"],
148
- onKeyDown: te,
149
- onKeyUp: re,
150
- onKeyPress: ae,
151
- onClick: ie,
159
+ onKeyDown: ae,
160
+ onKeyUp: te,
161
+ onKeyPress: ie,
162
+ onClick: le,
152
163
  ref: O,
153
164
  children: [
154
- se,
155
- ve,
156
165
  oe,
157
- (R || i) && xe
166
+ he,
167
+ de,
168
+ (R || i) && ve
158
169
  ]
159
170
  }
160
171
  ),
161
- _e()
172
+ be()
162
173
  ] });
163
174
  });
164
- Be.displayName = "TextField";
175
+ ze.displayName = "TextField";
165
176
  export {
166
- Be as TextField,
167
- Be as default
177
+ ze as TextField,
178
+ ze as default
168
179
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),M=require("../../../../../external/classnames/index.cjs.js"),m=require("react"),J=require("../textfield/textfield.cjs.js"),Pe=require("../time-picker/time-picker.cjs.js"),c=require("./time-field.module.scss.cjs.js"),Q=require("./time-field-helpers.cjs.js"),Ce=require("./time-picker-modal/time-picker-modal.cjs.js"),_e=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),Te=require("../../../providers/label-provider/use-labels.cjs.js"),W=require("../../../helpers/hooks/use-breakpoint.cjs.js"),P=require("../../overlays/dropdown/dropdown.cjs.js"),je=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),N=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),X=C=>{const{getCurrentBreakpointProps:Y}=_e.useBreakpointProps(C.defaultServerBreakpoint),{getLabel:Z}=Te.useLabels(),{id:$,label:ee,value:f,defaultValue:te,onChange:_,readOnly:h=!1,disabled:a=!1,required:ie,placeholder:ne,inputProps:t,stepMinutes:R=1,className:D,availableTimes:l,modal:T=!1,modalProps:oe}=C,{useNativePicker:re=!1,timePickerTrigger:j="button",showPicker:o=!0,availableTimesVariant:q="grid-buttons",clearable:se=!0}=Y(C),E=f!==void 0,[ae,S]=m.useState(f??te??""),g=E?f:ae,[w,I]=m.useState(!1),[U,V]=m.useState(!1),p=j==="input",n=re,le=W.default(),d=!n&&o&&!h&&!a&&(T===!0||typeof T=="string"&&W.isBreakpointBelow(le,T)),de=u.useFloating({open:w,onOpenChange:I,placement:p?"bottom-start":"bottom-end",middleware:[N.offset(Q.TIMEPICKER_OFFSET),N.flip(),N.shift()],whileElementsMounted:je.autoUpdate}),{refs:B,context:v,x:ce,y:ue,strategy:fe}=de,pe=u.useClick(v),me=u.useDismiss(v),ge=u.useRole(v,{role:"listbox"}),L=o&&p&&!h&&!a&&!n&&!d,z=u.useInteractions([...L?[pe]:[],me,ge]),x=e=>{const r=e.trim();E||S(r),_==null||_(r)},xe=e=>{var F;const r=e.target.value??"";(F=t==null?void 0:t.onBlur)==null||F.call(t,e);const s=Q.normalizeTime(r);s!==null&&s!==r&&x(s)};m.useEffect(()=>{f!==void 0&&S(f)},[f]);const k=m.useRef(null);m.useEffect(()=>{var e;(e=k.current)!=null&&e.inner&&B.setReference(k.current.inner)},[B]);const ke=()=>{var r;const e=(r=k.current)==null?void 0:r.input;if(e){if(typeof e.showPicker=="function"){e.showPicker();return}e.focus()}},be=()=>I(e=>!e),A=()=>V(!0),he=()=>{!o||a||(n?ke():d?A():j==="button"&&be())},H=d&&p&&!h?()=>{A()}:void 0,y=!n&&o&&!a&&q==="dropdown"&&!!(l!=null&&l.length),K=d?"dialog":"listbox",G=d?U:w,ve=o&&!n&&!y&&(j==="button"||d),Fe=o&&p&&!n&&!y,O={...t,id:$,label:ee,value:g,placeholder:ne,readOnly:h||!n&&p,disabled:a||(t==null?void 0:t.disabled),icon:o?"schedule":{name:"schedule",color:"inherit"},isClearable:se,required:ie,onIconClick:o?he:void 0,iconButtonProps:{"aria-label":Z("time-field.open-picker"),...ve&&{"aria-haspopup":K,"aria-expanded":G},...t==null?void 0:t.iconButtonProps},onChange:x,onBlur:xe,className:M.default(c.default["tedi-time-field__textfield"],{[c.default["tedi-time-field__icon--disabled"]]:!o||a},{[c.default["tedi-time-field__textfield--disabled"]]:a||(t==null?void 0:t.disabled)},{[c.default["tedi-time-field--native"]]:n}),input:{...t==null?void 0:t.input,...n&&{type:"time"},...H&&{onClick:H},...Fe&&{role:"combobox","aria-haspopup":K,"aria-expanded":G}}};if(y){const e=l.indexOf(g),r=e>=0?e:0;return i.jsxs(P.Dropdown,{width:"trigger",defaultActiveIndex:r,children:[i.jsx(P.Dropdown.Trigger,{children:i.jsx("div",{role:"combobox",className:M.default(c.default["tedi-time-field__container"],D,{[c.default["tedi-time-field__container--native"]]:n}),children:i.jsx(J.TextField,{ref:k,...O,input:{...O.input,...!p&&{onClick:s=>s.stopPropagation()}}})})}),i.jsx(P.Dropdown.Content,{children:l.map((s,F)=>i.jsx(P.Dropdown.Item,{index:F,active:s===g,onClick:()=>x(s),children:s},s))})]})}const b={...L?z.getReferenceProps():{}};return delete b.role,delete b["aria-haspopup"],delete b["aria-expanded"],delete b["aria-controls"],i.jsxs(i.Fragment,{children:[i.jsx("div",{className:M.default(c.default["tedi-time-field__container"],D),...b,tabIndex:-1,children:i.jsx(J.TextField,{ref:k,...O})}),d&&i.jsx(Ce.TimePickerModal,{open:U,onOpenChange:V,value:g,onConfirm:x,stepMinutes:R,availableTimes:l,gridVariant:q==="grid-radio"?"radio":"button",modalProps:oe}),!n&&o&&!a&&!d&&i.jsx(u.FloatingPortal,{children:w&&i.jsx(u.FloatingFocusManager,{context:v,modal:!1,initialFocus:-1,children:i.jsx("div",{ref:B.setFloating,...z.getFloatingProps({style:{position:fe,top:ue??0,left:ce??0}}),children:i.jsx(Pe.TimePicker,{value:g,stepMinutes:R,availableTimes:l,onChange:e=>{x(e),l&&I(!1)},gridVariant:q==="grid-radio"?"radio":"button",className:c.default["tedi-time-field__picker-wrapper"]})})})})]})};X.displayName="TimeField";exports.TimeField=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),M=require("../../../../../external/classnames/index.cjs.js"),m=require("react"),J=require("../textfield/textfield.cjs.js"),Ce=require("../time-picker/time-picker.cjs.js"),c=require("./time-field.module.scss.cjs.js"),Q=require("./time-field-helpers.cjs.js"),_e=require("./time-picker-modal/time-picker-modal.cjs.js"),Te=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),je=require("../../../providers/label-provider/use-labels.cjs.js"),W=require("../../../helpers/hooks/use-breakpoint.cjs.js"),F=require("../../overlays/dropdown/dropdown.cjs.js"),qe=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),N=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),X=C=>{const{getCurrentBreakpointProps:Y}=Te.useBreakpointProps(C.defaultServerBreakpoint),{getLabel:Z}=je.useLabels(),{id:$,label:ee,labelProps:te,value:f,defaultValue:ie,onChange:_,readOnly:h=!1,disabled:s=!1,required:oe,placeholder:ne,inputProps:e,stepMinutes:R=1,className:D,availableTimes:a,modal:T=!1,modalProps:re}=C,{useNativePicker:le=!1,timePickerTrigger:j="button",showPicker:n=!0,availableTimesVariant:q="grid-buttons",clearable:se=!0}=Y(C),E=f!==void 0,[ae,S]=m.useState(f??ie??""),g=E?f:ae,[w,I]=m.useState(!1),[U,V]=m.useState(!1),p=j==="input",o=le,de=W.default(),d=!o&&n&&!h&&!s&&(T===!0||typeof T=="string"&&W.isBreakpointBelow(de,T)),ce=u.useFloating({open:w,onOpenChange:I,placement:p?"bottom-start":"bottom-end",middleware:[N.offset(Q.TIMEPICKER_OFFSET),N.flip(),N.shift()],whileElementsMounted:qe.autoUpdate}),{refs:B,context:P,x:ue,y:fe,strategy:pe}=ce,me=u.useClick(P),ge=u.useDismiss(P),xe=u.useRole(P,{role:"listbox"}),L=n&&p&&!h&&!s&&!o&&!d,z=u.useInteractions([...L?[me]:[],ge,xe]),x=t=>{const r=t.trim();E||S(r),_==null||_(r)},be=t=>{var v;const r=t.target.value??"";(v=e==null?void 0:e.onBlur)==null||v.call(e,t);const l=Q.normalizeTime(r);l!==null&&l!==r&&x(l)};m.useEffect(()=>{f!==void 0&&S(f)},[f]);const b=m.useRef(null);m.useEffect(()=>{var t;(t=b.current)!=null&&t.inner&&B.setReference(b.current.inner)},[B]);const ke=()=>{var r;const t=(r=b.current)==null?void 0:r.input;if(t){if(typeof t.showPicker=="function"){t.showPicker();return}t.focus()}},he=()=>I(t=>!t),A=()=>V(!0),Pe=()=>{!n||s||(o?ke():d?A():j==="button"&&he())},H=d&&p&&!h?()=>{A()}:void 0,y=!o&&n&&!s&&q==="dropdown"&&!!(a!=null&&a.length),K=d?"dialog":"listbox",G=d?U:w,ve=n&&!o&&!y&&(j==="button"||d),Fe=n&&p&&!o&&!y,O={...e,id:$,label:ee,labelProps:te??(e==null?void 0:e.labelProps),value:g,placeholder:ne,readOnly:h||!o&&p,disabled:s||(e==null?void 0:e.disabled),icon:n?"schedule":{name:"schedule",color:"inherit"},isClearable:se,required:oe,onIconClick:n?Pe:void 0,iconButtonProps:{"aria-label":Z("time-field.open-picker"),...ve&&{"aria-haspopup":K,"aria-expanded":G},...e==null?void 0:e.iconButtonProps},onChange:x,onBlur:be,className:M.default(c.default["tedi-time-field__textfield"],{[c.default["tedi-time-field__icon--disabled"]]:!n||s},{[c.default["tedi-time-field__textfield--disabled"]]:s||(e==null?void 0:e.disabled)},{[c.default["tedi-time-field--native"]]:o}),input:{...e==null?void 0:e.input,...o&&{type:"time"},...H&&{onClick:H},...Fe&&{role:"combobox","aria-haspopup":K,"aria-expanded":G}}};if(y){const t=a.indexOf(g),r=t>=0?t:0;return i.jsxs(F.Dropdown,{width:"trigger",defaultActiveIndex:r,children:[i.jsx(F.Dropdown.Trigger,{children:i.jsx("div",{role:"combobox",className:M.default(c.default["tedi-time-field__container"],D,{[c.default["tedi-time-field__container--native"]]:o}),children:i.jsx(J.TextField,{ref:b,...O,input:{...O.input,...!p&&{onClick:l=>l.stopPropagation()}}})})}),i.jsx(F.Dropdown.Content,{children:a.map((l,v)=>i.jsx(F.Dropdown.Item,{index:v,active:l===g,onClick:()=>x(l),children:l},l))})]})}const k={...L?z.getReferenceProps():{}};return delete k.role,delete k["aria-haspopup"],delete k["aria-expanded"],delete k["aria-controls"],i.jsxs(i.Fragment,{children:[i.jsx("div",{className:M.default(c.default["tedi-time-field__container"],D),...k,tabIndex:-1,children:i.jsx(J.TextField,{ref:b,...O})}),d&&i.jsx(_e.TimePickerModal,{open:U,onOpenChange:V,value:g,onConfirm:x,stepMinutes:R,availableTimes:a,gridVariant:q==="grid-radio"?"radio":"button",modalProps:re}),!o&&n&&!s&&!d&&i.jsx(u.FloatingPortal,{children:w&&i.jsx(u.FloatingFocusManager,{context:P,modal:!1,initialFocus:-1,children:i.jsx("div",{ref:B.setFloating,...z.getFloatingProps({style:{position:pe,top:fe??0,left:ue??0}}),children:i.jsx(Ce.TimePicker,{value:g,stepMinutes:R,availableTimes:a,onChange:t=>{x(t),a&&I(!1)},gridVariant:q==="grid-radio"?"radio":"button",className:c.default["tedi-time-field__picker-wrapper"]})})})})]})};X.displayName="TimeField";exports.TimeField=X;
@@ -47,6 +47,11 @@ export interface TimeFieldProps extends BreakpointSupport<TimeFieldBreakpointPro
47
47
  * Label for the input field. Used for accessibility.
48
48
  */
49
49
  label: string;
50
+ /**
51
+ * Props forwarded to the field's label (e.g. `{ modifiers: 'nowrap' }` to control
52
+ * how a long label wraps). Breakpoint keys are supported for responsive wrapping.
53
+ */
54
+ labelProps?: TextFieldProps['labelProps'];
50
55
  /**
51
56
  * Current value of the time field (controlled).
52
57
  */
@@ -1,129 +1,131 @@
1
- import { jsxs as G, jsx as i, Fragment as xe } from "react/jsx-runtime";
2
- import { useFloating as ve, useClick as Ce, useDismiss as _e, useRole as Fe, useInteractions as Pe, FloatingPortal as Ie, FloatingFocusManager as Te } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
1
+ import { jsxs as G, jsx as o, Fragment as ve } from "react/jsx-runtime";
2
+ import { useFloating as Ce, useClick as Pe, useDismiss as _e, useRole as Fe, useInteractions as Ie, FloatingPortal as Te, FloatingFocusManager as we } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
3
  import O from "../../../../../external/classnames/index.es.js";
4
- import we, { useState as M, useEffect as H } from "react";
4
+ import Be, { useState as M, useEffect as H } from "react";
5
5
  import { TextField as J } from "../textfield/textfield.es.js";
6
- import { TimePicker as Be } from "../time-picker/time-picker.es.js";
6
+ import { TimePicker as ye } from "../time-picker/time-picker.es.js";
7
7
  import d from "./time-field.module.scss.es.js";
8
- import { normalizeTime as ye, TIMEPICKER_OFFSET as Ne } from "./time-field-helpers.es.js";
9
- import { TimePickerModal as Oe } from "./time-picker-modal/time-picker-modal.es.js";
10
- import { useBreakpointProps as Me } from "../../../helpers/hooks/use-breakpoint-props.es.js";
11
- import { useLabels as Re } from "../../../providers/label-provider/use-labels.es.js";
12
- import Ve, { isBreakpointBelow as Ee } from "../../../helpers/hooks/use-breakpoint.es.js";
8
+ import { normalizeTime as Ne, TIMEPICKER_OFFSET as Oe } from "./time-field-helpers.es.js";
9
+ import { TimePickerModal as Me } from "./time-picker-modal/time-picker-modal.es.js";
10
+ import { useBreakpointProps as Re } from "../../../helpers/hooks/use-breakpoint-props.es.js";
11
+ import { useLabels as Ve } from "../../../providers/label-provider/use-labels.es.js";
12
+ import Ee, { isBreakpointBelow as Ue } from "../../../helpers/hooks/use-breakpoint.es.js";
13
13
  import { Dropdown as v } from "../../overlays/dropdown/dropdown.es.js";
14
- import { autoUpdate as Ue } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
15
- import { offset as De, flip as Se, shift as je } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
16
- const Le = (C) => {
17
- const { getCurrentBreakpointProps: Q } = Me(C.defaultServerBreakpoint), { getLabel: W } = Re(), {
14
+ import { autoUpdate as De } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
15
+ import { offset as Se, flip as je, shift as Le } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
16
+ const qe = (C) => {
17
+ const { getCurrentBreakpointProps: Q } = Re(C.defaultServerBreakpoint), { getLabel: W } = Ve(), {
18
18
  id: X,
19
19
  label: Y,
20
+ labelProps: Z,
20
21
  value: m,
21
- defaultValue: Z,
22
- onChange: _,
23
- readOnly: k = !1,
22
+ defaultValue: $,
23
+ onChange: P,
24
+ readOnly: h = !1,
24
25
  disabled: l = !1,
25
- required: $,
26
- placeholder: ee,
27
- inputProps: t,
26
+ required: ee,
27
+ placeholder: te,
28
+ inputProps: e,
28
29
  stepMinutes: R = 1,
29
30
  className: V,
30
31
  availableTimes: s,
31
- modal: F = !1,
32
- modalProps: te
32
+ modal: _ = !1,
33
+ modalProps: oe
33
34
  } = C, {
34
35
  useNativePicker: ie = !1,
35
- timePickerTrigger: P = "button",
36
+ timePickerTrigger: F = "button",
36
37
  showPicker: n = !0,
37
38
  availableTimesVariant: I = "grid-buttons",
38
- clearable: oe = !0
39
- } = Q(C), E = m !== void 0, [ne, U] = M(m ?? Z ?? ""), f = E ? m : ne, [T, w] = M(!1), [D, S] = M(!1), u = P === "input", o = ie, re = Ve(), c = !o && n && !k && !l && (F === !0 || typeof F == "string" && Ee(re, F)), ae = ve({
39
+ clearable: ne = !0
40
+ } = Q(C), E = m !== void 0, [re, U] = M(m ?? $ ?? ""), u = E ? m : re, [T, w] = M(!1), [D, S] = M(!1), f = F === "input", i = ie, ae = Ee(), c = !i && n && !h && !l && (_ === !0 || typeof _ == "string" && Ue(ae, _)), le = Ce({
40
41
  open: T,
41
42
  onOpenChange: w,
42
- placement: u ? "bottom-start" : "bottom-end",
43
- middleware: [De(Ne), Se(), je()],
44
- whileElementsMounted: Ue
45
- }), { refs: B, context: b, x: le, y: se, strategy: ce } = ae, de = Ce(b), me = _e(b), ue = Fe(b, { role: "listbox" }), j = n && u && !k && !l && !o && !c, L = Pe([...j ? [de] : [], me, ue]), p = (e) => {
46
- const r = e.trim();
47
- E || U(r), _ == null || _(r);
48
- }, fe = (e) => {
43
+ placement: f ? "bottom-start" : "bottom-end",
44
+ middleware: [Se(Oe), je(), Le()],
45
+ whileElementsMounted: De
46
+ }), { refs: B, context: k, x: se, y: ce, strategy: de } = le, me = Pe(k), fe = _e(k), ue = Fe(k, { role: "listbox" }), j = n && f && !h && !l && !i && !c, L = Ie([...j ? [me] : [], fe, ue]), p = (t) => {
47
+ const r = t.trim();
48
+ E || U(r), P == null || P(r);
49
+ }, pe = (t) => {
49
50
  var x;
50
- const r = e.target.value ?? "";
51
- (x = t == null ? void 0 : t.onBlur) == null || x.call(t, e);
52
- const a = ye(r);
51
+ const r = t.target.value ?? "";
52
+ (x = e == null ? void 0 : e.onBlur) == null || x.call(e, t);
53
+ const a = Ne(r);
53
54
  a !== null && a !== r && p(a);
54
55
  };
55
56
  H(() => {
56
57
  m !== void 0 && U(m);
57
58
  }, [m]);
58
- const g = we.useRef(null);
59
+ const g = Be.useRef(null);
59
60
  H(() => {
60
- var e;
61
- (e = g.current) != null && e.inner && B.setReference(g.current.inner);
61
+ var t;
62
+ (t = g.current) != null && t.inner && B.setReference(g.current.inner);
62
63
  }, [B]);
63
- const pe = () => {
64
+ const ge = () => {
64
65
  var r;
65
- const e = (r = g.current) == null ? void 0 : r.input;
66
- if (e) {
67
- if (typeof e.showPicker == "function") {
68
- e.showPicker();
66
+ const t = (r = g.current) == null ? void 0 : r.input;
67
+ if (t) {
68
+ if (typeof t.showPicker == "function") {
69
+ t.showPicker();
69
70
  return;
70
71
  }
71
- e.focus();
72
+ t.focus();
72
73
  }
73
- }, ge = () => w((e) => !e), q = () => S(!0), he = () => {
74
- !n || l || (o ? pe() : c ? q() : P === "button" && ge());
75
- }, z = c && u && !k ? () => {
74
+ }, be = () => w((t) => !t), q = () => S(!0), he = () => {
75
+ !n || l || (i ? ge() : c ? q() : F === "button" && be());
76
+ }, z = c && f && !h ? () => {
76
77
  q();
77
- } : void 0, y = !o && n && !l && I === "dropdown" && !!(s != null && s.length), A = c ? "dialog" : "listbox", K = c ? D : T, ke = n && !o && !y && (P === "button" || c), be = n && u && !o && !y, N = {
78
- ...t,
78
+ } : void 0, y = !i && n && !l && I === "dropdown" && !!(s != null && s.length), A = c ? "dialog" : "listbox", K = c ? D : T, ke = n && !i && !y && (F === "button" || c), xe = n && f && !i && !y, N = {
79
+ ...e,
79
80
  id: X,
80
81
  label: Y,
81
- value: f,
82
- placeholder: ee,
83
- readOnly: k || !o && u,
84
- disabled: l || (t == null ? void 0 : t.disabled),
82
+ labelProps: Z ?? (e == null ? void 0 : e.labelProps),
83
+ value: u,
84
+ placeholder: te,
85
+ readOnly: h || !i && f,
86
+ disabled: l || (e == null ? void 0 : e.disabled),
85
87
  icon: n ? "schedule" : { name: "schedule", color: "inherit" },
86
- isClearable: oe,
87
- required: $,
88
+ isClearable: ne,
89
+ required: ee,
88
90
  onIconClick: n ? he : void 0,
89
91
  iconButtonProps: {
90
92
  "aria-label": W("time-field.open-picker"),
91
93
  ...ke && { "aria-haspopup": A, "aria-expanded": K },
92
- ...t == null ? void 0 : t.iconButtonProps
94
+ ...e == null ? void 0 : e.iconButtonProps
93
95
  },
94
96
  onChange: p,
95
- onBlur: fe,
97
+ onBlur: pe,
96
98
  className: O(
97
99
  d["tedi-time-field__textfield"],
98
100
  { [d["tedi-time-field__icon--disabled"]]: !n || l },
99
- { [d["tedi-time-field__textfield--disabled"]]: l || (t == null ? void 0 : t.disabled) },
100
- { [d["tedi-time-field--native"]]: o }
101
+ { [d["tedi-time-field__textfield--disabled"]]: l || (e == null ? void 0 : e.disabled) },
102
+ { [d["tedi-time-field--native"]]: i }
101
103
  ),
102
104
  input: {
103
- ...t == null ? void 0 : t.input,
104
- ...o && { type: "time" },
105
+ ...e == null ? void 0 : e.input,
106
+ ...i && { type: "time" },
105
107
  ...z && { onClick: z },
106
- ...be && { role: "combobox", "aria-haspopup": A, "aria-expanded": K }
108
+ ...xe && { role: "combobox", "aria-haspopup": A, "aria-expanded": K }
107
109
  }
108
110
  };
109
111
  if (y) {
110
- const e = s.indexOf(f), r = e >= 0 ? e : 0;
112
+ const t = s.indexOf(u), r = t >= 0 ? t : 0;
111
113
  return /* @__PURE__ */ G(v, { width: "trigger", defaultActiveIndex: r, children: [
112
- /* @__PURE__ */ i(v.Trigger, { children: /* @__PURE__ */ i(
114
+ /* @__PURE__ */ o(v.Trigger, { children: /* @__PURE__ */ o(
113
115
  "div",
114
116
  {
115
117
  role: "combobox",
116
118
  className: O(d["tedi-time-field__container"], V, {
117
- [d["tedi-time-field__container--native"]]: o
119
+ [d["tedi-time-field__container--native"]]: i
118
120
  }),
119
- children: /* @__PURE__ */ i(
121
+ children: /* @__PURE__ */ o(
120
122
  J,
121
123
  {
122
124
  ref: g,
123
125
  ...N,
124
126
  input: {
125
127
  ...N.input,
126
- ...!u && {
128
+ ...!f && {
127
129
  onClick: (a) => a.stopPropagation()
128
130
  }
129
131
  }
@@ -131,46 +133,46 @@ const Le = (C) => {
131
133
  )
132
134
  }
133
135
  ) }),
134
- /* @__PURE__ */ i(v.Content, { children: s.map((a, x) => /* @__PURE__ */ i(v.Item, { index: x, active: a === f, onClick: () => p(a), children: a }, a)) })
136
+ /* @__PURE__ */ o(v.Content, { children: s.map((a, x) => /* @__PURE__ */ o(v.Item, { index: x, active: a === u, onClick: () => p(a), children: a }, a)) })
135
137
  ] });
136
138
  }
137
- const h = {
139
+ const b = {
138
140
  ...j ? L.getReferenceProps() : {}
139
141
  };
140
- return delete h.role, delete h["aria-haspopup"], delete h["aria-expanded"], delete h["aria-controls"], /* @__PURE__ */ G(xe, { children: [
141
- /* @__PURE__ */ i("div", { className: O(d["tedi-time-field__container"], V), ...h, tabIndex: -1, children: /* @__PURE__ */ i(J, { ref: g, ...N }) }),
142
- c && /* @__PURE__ */ i(
143
- Oe,
142
+ return delete b.role, delete b["aria-haspopup"], delete b["aria-expanded"], delete b["aria-controls"], /* @__PURE__ */ G(ve, { children: [
143
+ /* @__PURE__ */ o("div", { className: O(d["tedi-time-field__container"], V), ...b, tabIndex: -1, children: /* @__PURE__ */ o(J, { ref: g, ...N }) }),
144
+ c && /* @__PURE__ */ o(
145
+ Me,
144
146
  {
145
147
  open: D,
146
148
  onOpenChange: S,
147
- value: f,
149
+ value: u,
148
150
  onConfirm: p,
149
151
  stepMinutes: R,
150
152
  availableTimes: s,
151
153
  gridVariant: I === "grid-radio" ? "radio" : "button",
152
- modalProps: te
154
+ modalProps: oe
153
155
  }
154
156
  ),
155
- !o && n && !l && !c && /* @__PURE__ */ i(Ie, { children: T && /* @__PURE__ */ i(Te, { context: b, modal: !1, initialFocus: -1, children: /* @__PURE__ */ i(
157
+ !i && n && !l && !c && /* @__PURE__ */ o(Te, { children: T && /* @__PURE__ */ o(we, { context: k, modal: !1, initialFocus: -1, children: /* @__PURE__ */ o(
156
158
  "div",
157
159
  {
158
160
  ref: B.setFloating,
159
161
  ...L.getFloatingProps({
160
162
  style: {
161
- position: ce,
162
- top: se ?? 0,
163
- left: le ?? 0
163
+ position: de,
164
+ top: ce ?? 0,
165
+ left: se ?? 0
164
166
  }
165
167
  }),
166
- children: /* @__PURE__ */ i(
167
- Be,
168
+ children: /* @__PURE__ */ o(
169
+ ye,
168
170
  {
169
- value: f,
171
+ value: u,
170
172
  stepMinutes: R,
171
173
  availableTimes: s,
172
- onChange: (e) => {
173
- p(e), s && w(!1);
174
+ onChange: (t) => {
175
+ p(t), s && w(!1);
174
176
  },
175
177
  gridVariant: I === "grid-radio" ? "radio" : "button",
176
178
  className: d["tedi-time-field__picker-wrapper"]
@@ -180,7 +182,7 @@ const Le = (C) => {
180
182
  ) }) })
181
183
  ] });
182
184
  };
183
- Le.displayName = "TimeField";
185
+ qe.displayName = "TimeField";
184
186
  export {
185
- Le as TimeField
187
+ qe as TimeField
186
188
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("../../../../../external/classnames/index.cjs.js"),m=require("react"),R=require("../../base/icon/icon.cjs.js"),w=require("../../loaders/spinner/spinner.cjs.js"),P=require("../feedback-text/feedback-text.cjs.js"),M=require("../form-label/form-label.cjs.js"),e=require("./toggle.module.scss.cjs.js"),_=m.forwardRef((k,x)=>{const{id:o,label:l,hideLabel:j=!1,labelPosition:N="left",helper:a,className:y,checked:n,defaultChecked:g,onChange:d,size:C,color:q="primary",type:v="filled",icon:u,disabled:f=!1,isLoading:s=!1,tooltip:T,...$}=k,h=a?`${o}-helper`:void 0,[z,S]=m.useState(g??!1),i=typeof n<"u",c=i?n:z,p=C||(u?"large":"default"),L=b=>{s||(i||S(b.target.checked),d==null||d(b.target.checked))},F=r.default(e.default["tedi-toggle"],e.default[`tedi-toggle--${p}`],e.default[`tedi-toggle--${q}-${v}`],{[e.default["tedi-toggle--active"]]:c,[e.default["tedi-toggle--disabled"]]:f||s},y),I=r.default(e.default["tedi-toggle__control"],e.default[`tedi-toggle__control--label-${N}`]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:I,children:[l&&t.jsx(M.FormLabel,{id:o,className:e.default["tedi-toggle__label"],hideLabel:j,label:l,tooltip:T}),t.jsxs("div",{className:F,children:[t.jsx("input",{...$,ref:x,id:o,type:"checkbox",role:"switch","aria-label":typeof l=="string"?l:void 0,"aria-describedby":h,className:e.default["tedi-toggle__input"],checked:i?c:void 0,defaultChecked:i?void 0:g,disabled:f||s,onChange:L}),t.jsx("span",{className:e.default["tedi-toggle__slider"],children:s?t.jsx(w.Spinner,{size:p==="large"?16:10,className:e.default["tedi-toggle__icon"]}):u?t.jsx(R.Icon,{name:c?"lock_open":"lock",size:16,color:"inherit"}):null})]})]}),a&&t.jsx(P.FeedbackText,{id:h,...a,className:r.default(e.default["tedi-toggle__helper"],a.className)})]})});_.displayName="Toggle";exports.Toggle=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),r=require("../../../../../external/classnames/index.cjs.js"),m=require("react"),R=require("../../base/icon/icon.cjs.js"),w=require("../../loaders/spinner/spinner.cjs.js"),M=require("../feedback-text/feedback-text.cjs.js"),O=require("../form-label/form-label.cjs.js"),e=require("./toggle.module.scss.cjs.js"),_=m.forwardRef((k,x)=>{const{id:i,label:t,hideLabel:j=!1,labelPosition:N="left",helper:a,className:y,checked:n,defaultChecked:g,onChange:d,size:C,color:q="primary",type:v="filled",icon:u,disabled:f=!1,isLoading:s=!1,tooltip:T,labelProps:$,...z}=k,h=a?`${i}-helper`:void 0,[S,L]=m.useState(g??!1),o=typeof n<"u",c=o?n:S,p=C||(u?"large":"default"),F=b=>{s||(o||L(b.target.checked),d==null||d(b.target.checked))},I=r.default(e.default["tedi-toggle"],e.default[`tedi-toggle--${p}`],e.default[`tedi-toggle--${q}-${v}`],{[e.default["tedi-toggle--active"]]:c,[e.default["tedi-toggle--disabled"]]:f||s},y),P=r.default(e.default["tedi-toggle__control"],e.default[`tedi-toggle__control--label-${N}`]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:P,children:[t&&l.jsx(O.FormLabel,{id:i,className:e.default["tedi-toggle__label"],hideLabel:j,label:t,tooltip:T,labelProps:$}),l.jsxs("div",{className:I,children:[l.jsx("input",{...z,ref:x,id:i,type:"checkbox",role:"switch","aria-label":typeof t=="string"?t:void 0,"aria-describedby":h,className:e.default["tedi-toggle__input"],checked:o?c:void 0,defaultChecked:o?void 0:g,disabled:f||s,onChange:F}),l.jsx("span",{className:e.default["tedi-toggle__slider"],children:s?l.jsx(w.Spinner,{size:p==="large"?16:10,className:e.default["tedi-toggle__icon"]}):u?l.jsx(R.Icon,{name:c?"lock_open":"lock",size:16,color:"inherit"}):null})]})]}),a&&l.jsx(M.FeedbackText,{id:h,...a,className:r.default(e.default["tedi-toggle__helper"],a.className)})]})});_.displayName="Toggle";exports.Toggle=_;
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { FeedbackTextProps } from '../feedback-text/feedback-text';
3
+ import { FormLabelProps } from '../form-label/form-label';
3
4
  export interface ToggleProps {
4
5
  /**
5
6
  * Unique identifier for the toggle input.
@@ -87,6 +88,12 @@ export interface ToggleProps {
87
88
  * Useful for providing extra explanation without cluttering the UI.
88
89
  */
89
90
  tooltip?: string;
91
+ /**
92
+ * Additional props forwarded to the underlying `Label` component.
93
+ * Use `modifiers` to control how the label text wraps or breaks
94
+ * (e.g. `{ modifiers: 'nowrap' }`).
95
+ */
96
+ labelProps?: FormLabelProps['labelProps'];
90
97
  }
91
98
  export declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLInputElement>>;
92
99
  export default Toggle;