@tedi-design-system/react 19.2.0-rc.6 → 19.2.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle-stats.html +1 -1
- package/component.manifest.json +8 -8
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/community/components/map-components/map-layer/map-layer.cjs.js +1 -1
- package/src/community/components/map-components/map-layer/map-layer.es.js +1 -1
- package/src/tedi/components/content/label/label.cjs.js +1 -1
- package/src/tedi/components/content/label/label.d.ts +22 -0
- package/src/tedi/components/content/label/label.es.js +30 -28
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.cjs.js +1 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.d.ts +20 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group-context.es.js +5 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.cjs.js +1 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.d.ts +72 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.es.js +124 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/checkbox/checkbox-group/checkbox-group.module.scss.es.js +13 -0
- package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.d.ts +8 -2
- package/src/tedi/components/form/checkbox/checkbox.es.js +146 -108
- package/src/tedi/components/form/checkbox/checkbox.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.module.scss.es.js +11 -3
- package/src/tedi/components/form/checkbox/index.cjs.js +1 -0
- package/src/tedi/components/form/checkbox/index.d.ts +11 -0
- package/src/tedi/components/form/checkbox/index.es.js +7 -0
- package/src/tedi/components/form/choice-group/choice-group.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/choice-group.d.ts +11 -0
- package/src/tedi/components/form/choice-group/choice-group.es.js +80 -69
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +15 -15
- package/src/tedi/components/form/choice-input.types.d.ts +46 -8
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +5 -0
- package/src/tedi/components/form/date-field/date-field.es.js +187 -184
- package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -1
- package/src/tedi/components/form/date-time-field/date-time-field.d.ts +5 -0
- package/src/tedi/components/form/date-time-field/date-time-field.es.js +103 -101
- package/src/tedi/components/form/form-label/form-label.cjs.js +1 -1
- package/src/tedi/components/form/form-label/form-label.d.ts +9 -0
- package/src/tedi/components/form/form-label/form-label.es.js +15 -14
- package/src/tedi/components/form/multi-value-field/multi-value-field.cjs.js +1 -1
- package/src/tedi/components/form/multi-value-field/multi-value-field.d.ts +7 -0
- package/src/tedi/components/form/multi-value-field/multi-value-field.es.js +41 -40
- package/src/tedi/components/form/number-field/number-field.cjs.js +1 -1
- package/src/tedi/components/form/number-field/number-field.es.js +54 -43
- package/src/tedi/components/form/radio/index.cjs.js +1 -0
- package/src/tedi/components/form/radio/index.d.ts +11 -0
- package/src/tedi/components/form/radio/index.es.js +7 -0
- package/src/tedi/components/form/radio/radio-group/radio-group-context.cjs.js +1 -0
- package/src/tedi/components/form/radio/radio-group/radio-group-context.d.ts +21 -0
- package/src/tedi/components/form/radio/radio-group/radio-group-context.es.js +5 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.cjs.js +1 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.d.ts +56 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.es.js +78 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.module.scss.cjs.js +1 -0
- package/src/tedi/components/form/radio/radio-group/radio-group.module.scss.es.js +13 -0
- package/src/tedi/components/form/radio/radio.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.d.ts +7 -2
- package/src/tedi/components/form/radio/radio.es.js +117 -77
- package/src/tedi/components/form/radio/radio.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.module.scss.es.js +11 -3
- package/src/tedi/components/form/select/select.cjs.js +1 -1
- package/src/tedi/components/form/select/select.es.js +79 -77
- package/src/tedi/components/form/slider/slider.cjs.js +1 -1
- package/src/tedi/components/form/slider/slider.d.ts +7 -0
- package/src/tedi/components/form/slider/slider.es.js +48 -47
- package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
- package/src/tedi/components/form/textfield/textfield.es.js +72 -61
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.d.ts +5 -0
- package/src/tedi/components/form/time-field/time-field.es.js +87 -85
- package/src/tedi/components/form/toggle/toggle.cjs.js +1 -1
- package/src/tedi/components/form/toggle/toggle.d.ts +7 -0
- package/src/tedi/components/form/toggle/toggle.es.js +26 -24
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.d.ts +12 -0
- package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.es.js +57 -27
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.cjs.js +1 -1
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.d.ts +17 -0
- package/src/tedi/components/navigation/table-of-contents/table-of-contents.es.js +65 -51
- package/src/tedi/index.d.ts +2 -2
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +14 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +25 -11
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +298 -294
|
@@ -1,129 +1,131 @@
|
|
|
1
|
-
import { jsxs as G, jsx as
|
|
2
|
-
import { useFloating as
|
|
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
|
|
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
|
|
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
|
|
9
|
-
import { TimePickerModal as
|
|
10
|
-
import { useBreakpointProps as
|
|
11
|
-
import { useLabels as
|
|
12
|
-
import
|
|
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
|
|
15
|
-
import { offset as
|
|
16
|
-
const
|
|
17
|
-
const { getCurrentBreakpointProps: Q } =
|
|
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:
|
|
22
|
-
onChange:
|
|
23
|
-
readOnly:
|
|
22
|
+
defaultValue: $,
|
|
23
|
+
onChange: P,
|
|
24
|
+
readOnly: h = !1,
|
|
24
25
|
disabled: l = !1,
|
|
25
|
-
required:
|
|
26
|
-
placeholder:
|
|
27
|
-
inputProps:
|
|
26
|
+
required: ee,
|
|
27
|
+
placeholder: te,
|
|
28
|
+
inputProps: e,
|
|
28
29
|
stepMinutes: R = 1,
|
|
29
30
|
className: V,
|
|
30
31
|
availableTimes: s,
|
|
31
|
-
modal:
|
|
32
|
-
modalProps:
|
|
32
|
+
modal: _ = !1,
|
|
33
|
+
modalProps: oe
|
|
33
34
|
} = C, {
|
|
34
35
|
useNativePicker: ie = !1,
|
|
35
|
-
timePickerTrigger:
|
|
36
|
+
timePickerTrigger: F = "button",
|
|
36
37
|
showPicker: n = !0,
|
|
37
38
|
availableTimesVariant: I = "grid-buttons",
|
|
38
|
-
clearable:
|
|
39
|
-
} = Q(C), E = m !== void 0, [
|
|
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:
|
|
43
|
-
middleware: [
|
|
44
|
-
whileElementsMounted:
|
|
45
|
-
}), { refs: B, context:
|
|
46
|
-
const r =
|
|
47
|
-
E || U(r),
|
|
48
|
-
},
|
|
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 =
|
|
51
|
-
(x =
|
|
52
|
-
const a =
|
|
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 =
|
|
59
|
+
const g = Be.useRef(null);
|
|
59
60
|
H(() => {
|
|
60
|
-
var
|
|
61
|
-
(
|
|
61
|
+
var t;
|
|
62
|
+
(t = g.current) != null && t.inner && B.setReference(g.current.inner);
|
|
62
63
|
}, [B]);
|
|
63
|
-
const
|
|
64
|
+
const ge = () => {
|
|
64
65
|
var r;
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
if (typeof
|
|
68
|
-
|
|
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
|
-
|
|
72
|
+
t.focus();
|
|
72
73
|
}
|
|
73
|
-
},
|
|
74
|
-
!n || l || (
|
|
75
|
-
}, z = c &&
|
|
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 = !
|
|
78
|
-
...
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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:
|
|
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
|
-
...
|
|
94
|
+
...e == null ? void 0 : e.iconButtonProps
|
|
93
95
|
},
|
|
94
96
|
onChange: p,
|
|
95
|
-
onBlur:
|
|
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 || (
|
|
100
|
-
{ [d["tedi-time-field--native"]]:
|
|
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
|
-
...
|
|
104
|
-
...
|
|
105
|
+
...e == null ? void 0 : e.input,
|
|
106
|
+
...i && { type: "time" },
|
|
105
107
|
...z && { onClick: z },
|
|
106
|
-
...
|
|
108
|
+
...xe && { role: "combobox", "aria-haspopup": A, "aria-expanded": K }
|
|
107
109
|
}
|
|
108
110
|
};
|
|
109
111
|
if (y) {
|
|
110
|
-
const
|
|
112
|
+
const t = s.indexOf(u), r = t >= 0 ? t : 0;
|
|
111
113
|
return /* @__PURE__ */ G(v, { width: "trigger", defaultActiveIndex: r, children: [
|
|
112
|
-
/* @__PURE__ */
|
|
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"]]:
|
|
119
|
+
[d["tedi-time-field__container--native"]]: i
|
|
118
120
|
}),
|
|
119
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ o(
|
|
120
122
|
J,
|
|
121
123
|
{
|
|
122
124
|
ref: g,
|
|
123
125
|
...N,
|
|
124
126
|
input: {
|
|
125
127
|
...N.input,
|
|
126
|
-
...!
|
|
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__ */
|
|
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
|
|
139
|
+
const b = {
|
|
138
140
|
...j ? L.getReferenceProps() : {}
|
|
139
141
|
};
|
|
140
|
-
return delete
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
c && /* @__PURE__ */
|
|
143
|
-
|
|
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:
|
|
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:
|
|
154
|
+
modalProps: oe
|
|
153
155
|
}
|
|
154
156
|
),
|
|
155
|
-
!
|
|
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:
|
|
162
|
-
top:
|
|
163
|
-
left:
|
|
163
|
+
position: de,
|
|
164
|
+
top: ce ?? 0,
|
|
165
|
+
left: se ?? 0
|
|
164
166
|
}
|
|
165
167
|
}),
|
|
166
|
-
children: /* @__PURE__ */
|
|
167
|
-
|
|
168
|
+
children: /* @__PURE__ */ o(
|
|
169
|
+
ye,
|
|
168
170
|
{
|
|
169
|
-
value:
|
|
171
|
+
value: u,
|
|
170
172
|
stepMinutes: R,
|
|
171
173
|
availableTimes: s,
|
|
172
|
-
onChange: (
|
|
173
|
-
p(
|
|
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
|
-
|
|
185
|
+
qe.displayName = "TimeField";
|
|
184
186
|
export {
|
|
185
|
-
|
|
187
|
+
qe as TimeField
|
|
186
188
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as c, Fragment as
|
|
1
|
+
import { jsxs as c, Fragment as P, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import n from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Spinner as
|
|
6
|
-
import { FeedbackText as
|
|
7
|
-
import { FormLabel as
|
|
3
|
+
import { forwardRef as R, useState as q } from "react";
|
|
4
|
+
import { Icon as A } from "../../base/icon/icon.es.js";
|
|
5
|
+
import { Spinner as B } from "../../loaders/spinner/spinner.es.js";
|
|
6
|
+
import { FeedbackText as D } from "../feedback-text/feedback-text.es.js";
|
|
7
|
+
import { FormLabel as E } from "../form-label/form-label.es.js";
|
|
8
8
|
import e from "./toggle.module.scss.es.js";
|
|
9
|
-
const
|
|
9
|
+
const G = R((k, N) => {
|
|
10
10
|
const {
|
|
11
11
|
id: a,
|
|
12
12
|
label: t,
|
|
@@ -24,36 +24,38 @@ const E = P((k, N) => {
|
|
|
24
24
|
disabled: f = !1,
|
|
25
25
|
isLoading: i = !1,
|
|
26
26
|
tooltip: $,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
labelProps: F,
|
|
28
|
+
...I
|
|
29
|
+
} = k, h = o ? `${a}-helper` : void 0, [L, S] = q(m ?? !1), s = typeof g < "u", d = s ? g : L, b = v || (p ? "large" : "default"), T = (_) => {
|
|
30
|
+
i || (s || S(_.target.checked), r == null || r(_.target.checked));
|
|
31
|
+
}, j = n(
|
|
31
32
|
e["tedi-toggle"],
|
|
32
|
-
e[`tedi-toggle--${
|
|
33
|
+
e[`tedi-toggle--${b}`],
|
|
33
34
|
e[`tedi-toggle--${x}-${z}`],
|
|
34
35
|
{
|
|
35
36
|
[e["tedi-toggle--active"]]: d,
|
|
36
37
|
[e["tedi-toggle--disabled"]]: f || i
|
|
37
38
|
},
|
|
38
39
|
y
|
|
39
|
-
),
|
|
40
|
-
return /* @__PURE__ */ c(
|
|
41
|
-
/* @__PURE__ */ c("div", { className:
|
|
40
|
+
), w = n(e["tedi-toggle__control"], e[`tedi-toggle__control--label-${C}`]);
|
|
41
|
+
return /* @__PURE__ */ c(P, { children: [
|
|
42
|
+
/* @__PURE__ */ c("div", { className: w, children: [
|
|
42
43
|
t && /* @__PURE__ */ l(
|
|
43
|
-
|
|
44
|
+
E,
|
|
44
45
|
{
|
|
45
46
|
id: a,
|
|
46
47
|
className: e["tedi-toggle__label"],
|
|
47
48
|
hideLabel: u,
|
|
48
49
|
label: t,
|
|
49
|
-
tooltip:
|
|
50
|
+
tooltip: $,
|
|
51
|
+
labelProps: F
|
|
50
52
|
}
|
|
51
53
|
),
|
|
52
|
-
/* @__PURE__ */ c("div", { className:
|
|
54
|
+
/* @__PURE__ */ c("div", { className: j, children: [
|
|
53
55
|
/* @__PURE__ */ l(
|
|
54
56
|
"input",
|
|
55
57
|
{
|
|
56
|
-
...
|
|
58
|
+
...I,
|
|
57
59
|
ref: N,
|
|
58
60
|
id: a,
|
|
59
61
|
type: "checkbox",
|
|
@@ -64,16 +66,16 @@ const E = P((k, N) => {
|
|
|
64
66
|
checked: s ? d : void 0,
|
|
65
67
|
defaultChecked: s ? void 0 : m,
|
|
66
68
|
disabled: f || i,
|
|
67
|
-
onChange:
|
|
69
|
+
onChange: T
|
|
68
70
|
}
|
|
69
71
|
),
|
|
70
|
-
/* @__PURE__ */ l("span", { className: e["tedi-toggle__slider"], children: i ? /* @__PURE__ */ l(
|
|
72
|
+
/* @__PURE__ */ l("span", { className: e["tedi-toggle__slider"], children: i ? /* @__PURE__ */ l(B, { size: b === "large" ? 16 : 10, className: e["tedi-toggle__icon"] }) : p ? /* @__PURE__ */ l(A, { name: d ? "lock_open" : "lock", size: 16, color: "inherit" }) : null })
|
|
71
73
|
] })
|
|
72
74
|
] }),
|
|
73
|
-
o && /* @__PURE__ */ l(
|
|
75
|
+
o && /* @__PURE__ */ l(D, { id: h, ...o, className: n(e["tedi-toggle__helper"], o.className) })
|
|
74
76
|
] });
|
|
75
77
|
});
|
|
76
|
-
|
|
78
|
+
G.displayName = "Toggle";
|
|
77
79
|
export {
|
|
78
|
-
|
|
80
|
+
G as Toggle
|
|
79
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),x=require("../../../../../../../external/classnames/index.cjs.js"),p=require("react"),D=require("../../../../misc/separator/separator.cjs.js"),G=require("../../table-of-contents.cjs.js"),o=require("../../table-of-contents.module.scss.cjs.js"),H=8,j=n=>{let e=(n==null?void 0:n.parentElement)??null;for(;e&&e!==document.body&&e!==document.documentElement;){const{overflowY:t}=window.getComputedStyle(e);if((t==="auto"||t==="scroll"||t==="overlay")&&e.scrollHeight>e.clientHeight)return e;e=e.parentElement}return null},y=(n,e,t,l,c=H)=>n<t+c?n-t-c:e>l-c?e-l+c:0,m=({node:n,depth:e,index:t,numberPrefix:l})=>{const{activeId:c,numbered:f,activeTrail:O,defaultOpen:N,scrollActiveIntoView:_,activeIdChanged:h}=p.useContext(G.TableOfContentsContext),{id:i,content:q,children:d,separator:M,slot:w}=n,$=!!(d!=null&&d.length),u=!!i&&i===c,A=$&&(N||!!i&&O.has(i)),E=Math.min(e,2),R=p.useRef(null);p.useEffect(()=>{var S;if(!_||!u||!h)return;const a=R.current;if(!a)return;const r=j(a);if(!r||typeof r.scrollBy!="function")return;const v=a.getBoundingClientRect(),C=r.getBoundingClientRect(),g=y(v.top,v.bottom,C.top,C.bottom);if(g===0)return;const I=typeof window<"u"&&((S=window.matchMedia)==null?void 0:S.call(window,"(prefers-reduced-motion: reduce)").matches);r.scrollBy({top:g,behavior:I?"auto":"smooth"})},[_,u,h]);const b=l?`${l}.${t+1}`:`${t+1}`,T=l?b:`${b}.`,B=f?"ol":"ul";return s.jsxs("li",{"aria-current":u?"location":void 0,className:x.default(o.default["tedi-table-of-contents__item"],{[o.default["tedi-table-of-contents__item--selected"]]:u}),children:[s.jsxs("div",{ref:R,className:x.default(o.default["tedi-table-of-contents__row"],o.default[`tedi-table-of-contents__row--level-${E}`]),children:[f&&s.jsx("span",{className:o.default["tedi-table-of-contents__number"],"aria-hidden":"true",children:T}),s.jsx("span",{className:o.default["tedi-table-of-contents__content"],children:q}),w!==void 0&&s.jsx("div",{className:o.default["tedi-table-of-contents__slot"],children:w})]}),A&&s.jsx(B,{className:o.default["tedi-table-of-contents__group"],children:d.map((a,r)=>s.jsx(m,{node:a,depth:e+1,index:r,numberPrefix:f?b:void 0},a.id??r))}),M&&s.jsx(D.Separator,{className:o.default["tedi-table-of-contents__separator"]})]})};m.displayName="TableOfContentsRow";exports.TableOfContentsRow=m;exports.getRowScrollDelta=y;exports.getScrollableAncestor=j;
|
|
@@ -6,6 +6,18 @@ interface TableOfContentsRowProps {
|
|
|
6
6
|
/** Parent's number (e.g. `'2'`) for building hierarchical ordinals like `2.1`. */
|
|
7
7
|
numberPrefix?: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Nearest scrollable ancestor that is a real in-page container (never `body` / `documentElement`),
|
|
11
|
+
* so bringing the active row into view scrolls only the table-of-contents' own scroll area and can
|
|
12
|
+
* never scroll the whole document. Returns `null` when no such container exists.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getScrollableAncestor: (element: HTMLElement | null) => HTMLElement | null;
|
|
15
|
+
/**
|
|
16
|
+
* Minimal vertical scroll (with an {@link SCROLL_MARGIN}px margin) to bring the row's
|
|
17
|
+
* `[top, bottom]` band inside the container's `[top, bottom]` band. Returns `0` when the row is
|
|
18
|
+
* already visible — "nearest" semantics: scroll up if it's above, down if it's below, else nothing.
|
|
19
|
+
*/
|
|
20
|
+
export declare const getRowScrollDelta: (rowTop: number, rowBottom: number, containerTop: number, containerBottom: number, margin?: number) => number;
|
|
9
21
|
export declare const TableOfContentsRow: {
|
|
10
22
|
({ node, depth, index, numberPrefix }: TableOfContentsRowProps): JSX.Element;
|
|
11
23
|
displayName: string;
|
|
@@ -1,40 +1,70 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { Separator as
|
|
5
|
-
import { TableOfContentsContext as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as N, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import g from "../../../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { useContext as G, useRef as H, useEffect as L } from "react";
|
|
4
|
+
import { Separator as T } from "../../../../misc/separator/separator.es.js";
|
|
5
|
+
import { TableOfContentsContext as D } from "../../table-of-contents.es.js";
|
|
6
|
+
import o from "../../table-of-contents.module.scss.es.js";
|
|
7
|
+
const V = 8, Y = (n) => {
|
|
8
|
+
let t = (n == null ? void 0 : n.parentElement) ?? null;
|
|
9
|
+
for (; t && t !== document.body && t !== document.documentElement; ) {
|
|
10
|
+
const { overflowY: e } = window.getComputedStyle(t);
|
|
11
|
+
if ((e === "auto" || e === "scroll" || e === "overlay") && t.scrollHeight > t.clientHeight) return t;
|
|
12
|
+
t = t.parentElement;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}, k = (n, t, e, s, c = V) => n < e + c ? n - e - c : t > s - c ? t - s + c : 0, y = ({ node: n, depth: t, index: e, numberPrefix: s }) => {
|
|
16
|
+
const { activeId: c, numbered: f, activeTrail: S, defaultOpen: O, scrollActiveIntoView: p, activeIdChanged: b } = G(D), { id: i, content: $, children: d, separator: E, slot: _ } = n, M = !!(d != null && d.length), u = !!i && i === c, x = M && (O || !!i && S.has(i)), A = Math.min(t, 2), h = H(null);
|
|
17
|
+
L(() => {
|
|
18
|
+
var C;
|
|
19
|
+
if (!p || !u || !b) return;
|
|
20
|
+
const l = h.current;
|
|
21
|
+
if (!l) return;
|
|
22
|
+
const r = Y(l);
|
|
23
|
+
if (!r || typeof r.scrollBy != "function") return;
|
|
24
|
+
const w = l.getBoundingClientRect(), v = r.getBoundingClientRect(), R = k(w.top, w.bottom, v.top, v.bottom);
|
|
25
|
+
if (R === 0) return;
|
|
26
|
+
const j = typeof window < "u" && ((C = window.matchMedia) == null ? void 0 : C.call(window, "(prefers-reduced-motion: reduce)").matches);
|
|
27
|
+
r.scrollBy({ top: R, behavior: j ? "auto" : "smooth" });
|
|
28
|
+
}, [p, u, b]);
|
|
29
|
+
const m = s ? `${s}.${e + 1}` : `${e + 1}`, B = s ? m : `${m}.`, I = f ? "ol" : "ul";
|
|
30
|
+
return /* @__PURE__ */ N(
|
|
10
31
|
"li",
|
|
11
32
|
{
|
|
12
|
-
"aria-current":
|
|
13
|
-
className:
|
|
14
|
-
[
|
|
33
|
+
"aria-current": u ? "location" : void 0,
|
|
34
|
+
className: g(o["tedi-table-of-contents__item"], {
|
|
35
|
+
[o["tedi-table-of-contents__item--selected"]]: u
|
|
15
36
|
}),
|
|
16
37
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
/* @__PURE__ */ e("span", { className: t["tedi-table-of-contents__content"], children: C }),
|
|
20
|
-
c !== void 0 && /* @__PURE__ */ e("div", { className: t["tedi-table-of-contents__slot"], children: c })
|
|
21
|
-
] }),
|
|
22
|
-
w && /* @__PURE__ */ e(g, { className: t["tedi-table-of-contents__group"], children: n.map((m, f) => /* @__PURE__ */ e(
|
|
23
|
-
b,
|
|
38
|
+
/* @__PURE__ */ N(
|
|
39
|
+
"div",
|
|
24
40
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
ref: h,
|
|
42
|
+
className: g(o["tedi-table-of-contents__row"], o[`tedi-table-of-contents__row--level-${A}`]),
|
|
43
|
+
children: [
|
|
44
|
+
f && /* @__PURE__ */ a("span", { className: o["tedi-table-of-contents__number"], "aria-hidden": "true", children: B }),
|
|
45
|
+
/* @__PURE__ */ a("span", { className: o["tedi-table-of-contents__content"], children: $ }),
|
|
46
|
+
_ !== void 0 && /* @__PURE__ */ a("div", { className: o["tedi-table-of-contents__slot"], children: _ })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
x && /* @__PURE__ */ a(I, { className: o["tedi-table-of-contents__group"], children: d.map((l, r) => /* @__PURE__ */ a(
|
|
51
|
+
y,
|
|
52
|
+
{
|
|
53
|
+
node: l,
|
|
54
|
+
depth: t + 1,
|
|
55
|
+
index: r,
|
|
56
|
+
numberPrefix: f ? m : void 0
|
|
29
57
|
},
|
|
30
|
-
|
|
58
|
+
l.id ?? r
|
|
31
59
|
)) }),
|
|
32
|
-
|
|
60
|
+
E && /* @__PURE__ */ a(T, { className: o["tedi-table-of-contents__separator"] })
|
|
33
61
|
]
|
|
34
62
|
}
|
|
35
63
|
);
|
|
36
64
|
};
|
|
37
|
-
|
|
65
|
+
y.displayName = "TableOfContentsRow";
|
|
38
66
|
export {
|
|
39
|
-
|
|
67
|
+
y as TableOfContentsRow,
|
|
68
|
+
k as getRowScrollDelta,
|
|
69
|
+
Y as getScrollableAncestor
|
|
40
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),I=require("../../../../../external/classnames/index.cjs.js"),s=require("react"),B=require("../../misc/affix/affix.cjs.js"),E=require("./components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js"),k=require("./components/table-of-contents-item/table-of-contents-item.cjs.js"),M=require("./components/table-of-contents-list/table-of-contents-list.cjs.js"),f=require("./table-of-contents.module.scss.cjs.js"),R=require("../../../providers/label-provider/use-labels.cjs.js"),V=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=require("../../content/card/card.cjs.js"),H=require("../../content/card/card-content/card-content.cjs.js"),A=s.createContext({activeTrail:new Set}),h=n=>s.isValidElement(n)&&n.type===k.TableOfContentsItem,m=n=>s.Children.toArray(n).filter(h).map(l=>{const{id:a,separator:i,slot:c,children:o}=l.props,t=s.Children.toArray(o),e=t.filter(h),d=t.filter(u=>!h(u));return{id:a,separator:i,slot:c,content:r.jsx(r.Fragment,{children:d}),children:e.length?m(o):void 0}}),N=(n,l)=>{const a=new Set;if(!l)return a;const i=(c,o)=>{for(const t of c){const e=t.id?[...o,t.id]:o;if(t.id===l||t.children&&i(t.children,e))return e.forEach(d=>a.add(d)),!0}return!1};return i(n,[]),a};function b(n){const{getLabel:l}=R.useLabels(),{getCurrentBreakpointProps:a}=V.useBreakpointProps(n.defaultServerBreakpoint),{children:i,heading:c,headingLevel:o="h3",ariaLabel:t,activeId:e,defaultOpen:d=!0,numbered:u=!1,sticky:p=!0,variant:v="default",bordered:L=!1,scrollActiveIntoView:x=!1,className:P}=a(n),S=c===void 0?l("table-of-contents.title"):c,C=s.useMemo(()=>m(i),[i]),T=s.useMemo(()=>N(C,e),[C,e]),O=s.useRef(e),g=O.current!==e;s.useEffect(()=>{O.current=e},[e]);const w=s.useMemo(()=>({activeId:e,numbered:u,headingLevel:o,ariaLabel:t,activeTrail:T,defaultOpen:d,scrollActiveIntoView:x,activeIdChanged:g}),[e,u,o,t,T,d,x,g]),q=r.jsx("div",{className:I.default(f.default["tedi-table-of-contents"],{[f.default["tedi-table-of-contents--transparent"]]:v==="transparent",[f.default["tedi-table-of-contents--bordered"]]:L}),children:r.jsx(M.TableOfContentsList,{nodes:C,heading:S})}),j=I.default({[f.default["tedi-table-of-contents--sticky"]]:p},P),y=v==="transparent"?r.jsx("div",{className:j,children:q}):r.jsx(F.Card,{className:j,children:r.jsx(H.CardContent,{padding:0,children:q})});return r.jsx(A.Provider,{value:w,children:p?r.jsx(B.Affix,{position:"sticky",top:1.5,bottom:1.5,children:y}):y})}b.displayName="TableOfContents";b.Item=k.TableOfContentsItem;b.Collapsible=E.TableOfContentsCollapsible;exports.TableOfContents=b;exports.TableOfContentsContext=A;exports.buildActiveTrail=N;exports.childrenToNodes=m;
|
|
@@ -17,6 +17,16 @@ type TableOfContentsBreakpointProps = {
|
|
|
17
17
|
* @default true
|
|
18
18
|
*/
|
|
19
19
|
sticky?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Keep the active item visible inside a scrollable table of contents. When the `activeId`
|
|
22
|
+
* changes, the active item's row is scrolled into view within the nearest scroll container
|
|
23
|
+
* (the sticky card, or a scrollable wrapper you provide) using "nearest" semantics — it only
|
|
24
|
+
* scrolls when the row is out of view, leaving ~8px of margin. Positions on the row itself,
|
|
25
|
+
* not its expanded children. Has no effect in non-scrollable layouts and respects
|
|
26
|
+
* `prefers-reduced-motion`.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
scrollActiveIntoView?: boolean;
|
|
20
30
|
};
|
|
21
31
|
export interface TableOfContentsProps extends BreakpointSupport<TableOfContentsBreakpointProps> {
|
|
22
32
|
/**
|
|
@@ -87,6 +97,13 @@ interface TableOfContentsContextValue {
|
|
|
87
97
|
ariaLabel?: string;
|
|
88
98
|
activeTrail: Set<string>;
|
|
89
99
|
defaultOpen?: boolean;
|
|
100
|
+
scrollActiveIntoView?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* True only on renders where `activeId` genuinely changed from its previously committed value
|
|
103
|
+
* (never on the initial render, including Strict Mode's mount-effect replay). Rows use it to
|
|
104
|
+
* scroll into view only on a real transition — not when a selected child first mounts on load.
|
|
105
|
+
*/
|
|
106
|
+
activeIdChanged?: boolean;
|
|
90
107
|
}
|
|
91
108
|
export declare const TableOfContentsContext: import('react').Context<TableOfContentsContextValue>;
|
|
92
109
|
export declare const childrenToNodes: (children: ReactNode) => TableOfContentsNode[];
|