@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.
- package/bundle-stats.html +1 -1
- 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/package.json +1 -1
- package/src/tedi/components/content/carousel/components/carousel-indicators/carousel-indicators.cjs.js +1 -1
- package/src/tedi/components/content/carousel/components/carousel-indicators/carousel-indicators.es.js +18 -18
- package/src/tedi/components/content/carousel/use-carousel.cjs.js +1 -1
- package/src/tedi/components/content/carousel/use-carousel.d.ts +2 -1
- package/src/tedi/components/content/carousel/use-carousel.es.js +177 -163
- 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.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.es.js +32 -30
- package/src/tedi/components/form/choice-group/choice-group.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/choice-group.es.js +80 -69
- package/src/tedi/components/form/choice-input.types.d.ts +7 -0
- 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/radio.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.es.js +30 -28
- 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
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as L, jsxs as Q } from "react/jsx-runtime";
|
|
2
2
|
import Y from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import r, { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { FeedbackText as
|
|
7
|
-
import { FormLabel as
|
|
8
|
-
import { useOptionalInputGroup as
|
|
9
|
-
import
|
|
10
|
-
import { SELECT_ALL_VALUE as M, GROUP_OPTION_PREFIX as
|
|
11
|
-
import { SelectClearIndicator as
|
|
12
|
-
import { SelectControl as
|
|
13
|
-
import { SelectDropDownIndicator as
|
|
14
|
-
import { SelectGroup as
|
|
15
|
-
import { SelectGroupHeading as
|
|
16
|
-
import { SelectIndicatorsContainer as
|
|
17
|
-
import { SelectInput as
|
|
18
|
-
import { SelectLoadingIndicator as
|
|
19
|
-
import { SelectMenu as
|
|
20
|
-
import { SelectMenuList as
|
|
21
|
-
import { SelectMenuPortal as
|
|
22
|
-
import { SelectMultiValue as
|
|
23
|
-
import { SelectMultiValueRemove as
|
|
24
|
-
import { SelectOption as
|
|
25
|
-
import { SelectSingleValue as
|
|
26
|
-
import { SelectValueContainer as
|
|
3
|
+
import r, { forwardRef as st } from "react";
|
|
4
|
+
import rt from "../../../../../external/react-select/dist/react-select.esm.es.js";
|
|
5
|
+
import at from "../../../../../external/react-select/async/dist/react-select-async.esm.es.js";
|
|
6
|
+
import { FeedbackText as it } from "../feedback-text/feedback-text.es.js";
|
|
7
|
+
import { FormLabel as ct } from "../form-label/form-label.es.js";
|
|
8
|
+
import { useOptionalInputGroup as ut } from "../input-group/input-group.es.js";
|
|
9
|
+
import dt from "../input-group/input-group.module.scss.es.js";
|
|
10
|
+
import { SELECT_ALL_VALUE as M, GROUP_OPTION_PREFIX as pt, areAllSelected as Z, getEnabledOptions as ee, isGroupSentinel as te } from "./components/select-bulk-helpers.es.js";
|
|
11
|
+
import { SelectClearIndicator as ft } from "./components/select-clear-indicator.es.js";
|
|
12
|
+
import { SelectControl as mt } from "./components/select-control.es.js";
|
|
13
|
+
import { SelectDropDownIndicator as gt } from "./components/select-dropdown-indicator.es.js";
|
|
14
|
+
import { SelectGroup as St } from "./components/select-group.es.js";
|
|
15
|
+
import { SelectGroupHeading as bt } from "./components/select-group-heading.es.js";
|
|
16
|
+
import { SelectIndicatorsContainer as yt } from "./components/select-indicators-container.es.js";
|
|
17
|
+
import { SelectInput as Mt } from "./components/select-input.es.js";
|
|
18
|
+
import { SelectLoadingIndicator as vt } from "./components/select-loading-indicator.es.js";
|
|
19
|
+
import { SelectMenu as ht } from "./components/select-menu.es.js";
|
|
20
|
+
import { SelectMenuList as It } from "./components/select-menu-list.es.js";
|
|
21
|
+
import { SelectMenuPortal as Ot } from "./components/select-menu-portal.es.js";
|
|
22
|
+
import { SelectMultiValue as Ct } from "./components/select-multi-value.es.js";
|
|
23
|
+
import { SelectMultiValueRemove as wt } from "./components/select-multi-value-remove.es.js";
|
|
24
|
+
import { SelectOption as Lt } from "./components/select-option.es.js";
|
|
25
|
+
import { SelectSingleValue as Vt } from "./components/select-single-value.es.js";
|
|
26
|
+
import { SelectValueContainer as At } from "./components/select-value-container.es.js";
|
|
27
27
|
import d from "./select.module.scss.es.js";
|
|
28
|
-
import { useLabels as
|
|
29
|
-
const
|
|
28
|
+
import { useLabels as _t } from "../../../providers/label-provider/use-labels.es.js";
|
|
29
|
+
const kt = st(
|
|
30
30
|
(D, oe) => {
|
|
31
31
|
var J;
|
|
32
32
|
const {
|
|
@@ -86,22 +86,23 @@ const _t = lt(
|
|
|
86
86
|
showRadioButtons: xe = !1,
|
|
87
87
|
renderWithoutLabel: Ee,
|
|
88
88
|
tooltip: Ge,
|
|
89
|
+
labelProps: He,
|
|
89
90
|
classNames: j
|
|
90
|
-
} = D, u = (J =
|
|
91
|
+
} = D, u = (J = ut) == null ? void 0 : J(), Ke = r.useId(), R = u == null ? void 0 : u.hasExternalLabel, m = D.id ?? (u == null ? void 0 : u.inputId) ?? Ke, je = R ? (u == null ? void 0 : u.inputId) ?? m : `${m}-input`, Ue = R ? `${m}-container` : m, U = a ? (a == null ? void 0 : a.id) ?? `${m}-helper` : void 0, h = r.useRef(null), { getLabel: C } = _t();
|
|
91
92
|
r.useImperativeHandle(
|
|
92
93
|
oe,
|
|
93
94
|
() => h.current
|
|
94
95
|
);
|
|
95
|
-
const [
|
|
96
|
+
const [Be, B] = r.useState(!1), ze = (t) => {
|
|
96
97
|
var e, o;
|
|
97
98
|
if (K || !O || t.pointerType !== "touch" && t.pointerType !== "pen") return;
|
|
98
99
|
const l = t.target;
|
|
99
100
|
if (!((e = l.closest) != null && e.call(l, `.${d["tedi-select__control"]}`))) return;
|
|
100
101
|
const n = (o = h.current) == null ? void 0 : o.inputRef, i = !!n && (t.target === n || n.contains(l));
|
|
101
102
|
B(!i);
|
|
102
|
-
},
|
|
103
|
+
}, qe = () => {
|
|
103
104
|
B(!1), k == null || k();
|
|
104
|
-
}, S = !!x && v, [
|
|
105
|
+
}, S = !!x && v, [We, Xe] = r.useState(T ?? null), z = P !== void 0, g = z ? P : We, p = r.useMemo(() => Array.isArray(g) ? g : g ? [g] : [], [g]), w = r.useMemo(
|
|
105
106
|
() => ({ value: M, label: C("select.select-all") }),
|
|
106
107
|
[C]
|
|
107
108
|
), b = !!E && !!v, { groupFlattenedOptions: q, groupSentinelMap: I } = r.useMemo(() => {
|
|
@@ -112,7 +113,7 @@ const _t = lt(
|
|
|
112
113
|
const n = [], i = /* @__PURE__ */ new Map();
|
|
113
114
|
for (const e of c)
|
|
114
115
|
if (e && Array.isArray(e.options)) {
|
|
115
|
-
const o = e, s = `${
|
|
116
|
+
const o = e, s = `${pt}${o.label ?? ""}`, f = o.options.filter((y) => !y.isDisabled);
|
|
116
117
|
i.set(s, { enabled: f }), n.push({ value: s, label: o.label ?? "" });
|
|
117
118
|
for (const y of o.options)
|
|
118
119
|
n.push({
|
|
@@ -122,10 +123,10 @@ const _t = lt(
|
|
|
122
123
|
} else
|
|
123
124
|
n.push(e);
|
|
124
125
|
return { groupFlattenedOptions: n, groupSentinelMap: i };
|
|
125
|
-
}, [c, b]),
|
|
126
|
+
}, [c, b]), Je = r.useMemo(() => {
|
|
126
127
|
let t = q ?? c;
|
|
127
128
|
return S && t && t.length > 0 && (t = [w, ...t]), t;
|
|
128
|
-
}, [c, q, S, w]),
|
|
129
|
+
}, [c, q, S, w]), Qe = r.useMemo(() => {
|
|
129
130
|
const t = [];
|
|
130
131
|
if (b && I.size > 0)
|
|
131
132
|
for (const [l, n] of I)
|
|
@@ -143,7 +144,7 @@ const _t = lt(
|
|
|
143
144
|
I,
|
|
144
145
|
S,
|
|
145
146
|
w
|
|
146
|
-
]),
|
|
147
|
+
]), Ye = (t, l) => {
|
|
147
148
|
let n = t;
|
|
148
149
|
const i = l.option;
|
|
149
150
|
if (b && i && I.has(i.value)) {
|
|
@@ -162,22 +163,22 @@ const _t = lt(
|
|
|
162
163
|
(s) => s.value !== M && !e.some((f) => f.value === s.value)
|
|
163
164
|
));
|
|
164
165
|
}
|
|
165
|
-
Array.isArray(n) && (n = n.filter((e) => e.value !== M && !te(e))), z ||
|
|
166
|
+
Array.isArray(n) && (n = n.filter((e) => e.value !== M && !te(e))), z || Xe(n), A == null || A(n), !G && h.current && setTimeout(() => {
|
|
166
167
|
var e, o;
|
|
167
168
|
return (o = (e = h.current) == null ? void 0 : e.inputRef) == null ? void 0 : o.focus();
|
|
168
169
|
}, 0);
|
|
169
|
-
},
|
|
170
|
+
}, Ze = r.useCallback(
|
|
170
171
|
(t, l) => t.data.value === M || te(t.data) || !l ? !0 : String(t.label).toLowerCase().includes(l.toLowerCase()),
|
|
171
172
|
[]
|
|
172
|
-
), [W, X] = r.useState(!1),
|
|
173
|
+
), [W, X] = r.useState(!1), et = (t) => {
|
|
173
174
|
(t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "Home" || t.key === "End" || t.key === "PageUp" || t.key === "PageDown" || t.key === "Tab") && (W || X(!0));
|
|
174
|
-
},
|
|
175
|
+
}, tt = r.useCallback(() => {
|
|
175
176
|
X((t) => t && !1);
|
|
176
|
-
}, []),
|
|
177
|
-
(t) => /* @__PURE__ */ L(
|
|
177
|
+
}, []), ot = r.useCallback(
|
|
178
|
+
(t) => /* @__PURE__ */ L(It, { ...t, renderMessageListFooter: $ }),
|
|
178
179
|
[$]
|
|
179
|
-
),
|
|
180
|
-
Me ?
|
|
180
|
+
), nt = () => /* @__PURE__ */ L(
|
|
181
|
+
Me ? at : rt,
|
|
181
182
|
{
|
|
182
183
|
tagsDirection: V,
|
|
183
184
|
showSelectAll: x,
|
|
@@ -185,50 +186,50 @@ const _t = lt(
|
|
|
185
186
|
dropdownType: Oe,
|
|
186
187
|
renderValue: Ce,
|
|
187
188
|
keyboardMode: W,
|
|
188
|
-
exitKeyboardMode:
|
|
189
|
-
onKeyDown:
|
|
190
|
-
id:
|
|
189
|
+
exitKeyboardMode: tt,
|
|
190
|
+
onKeyDown: et,
|
|
191
|
+
id: Ue,
|
|
191
192
|
"aria-describedby": U,
|
|
192
193
|
autoFocus: Le,
|
|
193
194
|
ref: h,
|
|
194
195
|
instanceId: m,
|
|
195
196
|
className: "tedi-select__wrapper",
|
|
196
197
|
name: le,
|
|
197
|
-
options:
|
|
198
|
+
options: Je,
|
|
198
199
|
defaultOptions: ne,
|
|
199
|
-
value:
|
|
200
|
+
value: Qe,
|
|
200
201
|
defaultValue: T,
|
|
201
202
|
cacheOptions: $e,
|
|
202
|
-
onChange:
|
|
203
|
-
filterOption: S || b ?
|
|
203
|
+
onChange: Ye,
|
|
204
|
+
filterOption: S || b ? Ze : void 0,
|
|
204
205
|
onInputChange: ae,
|
|
205
|
-
onBlur:
|
|
206
|
-
softKeyboardSuppressed: !K && O &&
|
|
206
|
+
onBlur: qe,
|
|
207
|
+
softKeyboardSuppressed: !K && O && Be,
|
|
207
208
|
inputValue: ie,
|
|
208
|
-
inputId:
|
|
209
|
+
inputId: je,
|
|
209
210
|
loadOptions: ce,
|
|
210
211
|
isLoading: ue,
|
|
211
212
|
noOptionsMessage: he || (() => C("select.no-options")),
|
|
212
213
|
loadingMessage: Ie || (() => C("select.loading")),
|
|
213
214
|
classNamePrefix: "select",
|
|
214
215
|
components: {
|
|
215
|
-
ClearIndicator: (e) =>
|
|
216
|
-
DropdownIndicator: () =>
|
|
216
|
+
ClearIndicator: (e) => ft({ isClearIndicatorVisible: H, ...e }),
|
|
217
|
+
DropdownIndicator: () => gt({ iconName: se }),
|
|
217
218
|
IndicatorSeparator: () => null,
|
|
218
|
-
MenuPortal:
|
|
219
|
-
Menu:
|
|
220
|
-
MenuList:
|
|
221
|
-
Option: (e) =>
|
|
222
|
-
Control:
|
|
223
|
-
Input:
|
|
224
|
-
MultiValue: (e) =>
|
|
225
|
-
MultiValueRemove:
|
|
226
|
-
SingleValue:
|
|
227
|
-
Group:
|
|
228
|
-
GroupHeading: (e) =>
|
|
229
|
-
IndicatorsContainer:
|
|
230
|
-
ValueContainer:
|
|
231
|
-
LoadingIndicator:
|
|
219
|
+
MenuPortal: Ot,
|
|
220
|
+
Menu: ht,
|
|
221
|
+
MenuList: ot,
|
|
222
|
+
Option: (e) => Lt({ renderOption: ve, multiple: v, showRadioButtons: xe, ...e }),
|
|
223
|
+
Control: mt,
|
|
224
|
+
Input: Mt,
|
|
225
|
+
MultiValue: (e) => Ct({ isTagRemovable: Ne, tagsEllipsis: Pe, ...e }),
|
|
226
|
+
MultiValueRemove: wt,
|
|
227
|
+
SingleValue: Vt,
|
|
228
|
+
Group: St,
|
|
229
|
+
GroupHeading: (e) => bt({ optionGroupHeadingText: Fe, ...e }),
|
|
230
|
+
IndicatorsContainer: yt,
|
|
231
|
+
ValueContainer: At,
|
|
232
|
+
LoadingIndicator: vt
|
|
232
233
|
},
|
|
233
234
|
isDisabled: F,
|
|
234
235
|
isSearchable: O,
|
|
@@ -258,7 +259,7 @@ const _t = lt(
|
|
|
258
259
|
e[o] = typeof s == "string" ? () => s : s;
|
|
259
260
|
if (u) {
|
|
260
261
|
const o = e.control;
|
|
261
|
-
e.control = (s) => Y(o == null ? void 0 : o(s),
|
|
262
|
+
e.control = (s) => Y(o == null ? void 0 : o(s), dt["tedi-input-group__input"]);
|
|
262
263
|
}
|
|
263
264
|
return Object.keys(e).length > 0 ? e : void 0;
|
|
264
265
|
})(),
|
|
@@ -278,7 +279,7 @@ const _t = lt(
|
|
|
278
279
|
})
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
|
-
),
|
|
282
|
+
), lt = Y(
|
|
282
283
|
d["tedi-select"],
|
|
283
284
|
me,
|
|
284
285
|
{ [d["tedi-select--invalid"]]: be || (a == null ? void 0 : a.type) === "error" },
|
|
@@ -289,10 +290,10 @@ const _t = lt(
|
|
|
289
290
|
{ [d["tedi-select--clear-on-interaction"]]: H && Ae },
|
|
290
291
|
{ [d["tedi-select--disabled"]]: F }
|
|
291
292
|
);
|
|
292
|
-
return /* @__PURE__ */ Q("div", { "data-name": "select", className:
|
|
293
|
+
return /* @__PURE__ */ Q("div", { "data-name": "select", className: lt, onPointerDownCapture: ze, children: [
|
|
293
294
|
/* @__PURE__ */ Q("div", { className: d["tedi-select__inner"], children: [
|
|
294
295
|
!R && /* @__PURE__ */ L(
|
|
295
|
-
|
|
296
|
+
ct,
|
|
296
297
|
{
|
|
297
298
|
id: `${m}-input`,
|
|
298
299
|
label: re,
|
|
@@ -300,16 +301,17 @@ const _t = lt(
|
|
|
300
301
|
hideLabel: ge,
|
|
301
302
|
size: _,
|
|
302
303
|
renderWithoutLabel: Ee,
|
|
303
|
-
tooltip: Ge
|
|
304
|
+
tooltip: Ge,
|
|
305
|
+
labelProps: He
|
|
304
306
|
}
|
|
305
307
|
),
|
|
306
|
-
|
|
308
|
+
nt()
|
|
307
309
|
] }),
|
|
308
|
-
a && /* @__PURE__ */ L(
|
|
310
|
+
a && /* @__PURE__ */ L(it, { ...a, id: U })
|
|
309
311
|
] });
|
|
310
312
|
}
|
|
311
313
|
);
|
|
312
|
-
|
|
314
|
+
kt.displayName = "Select";
|
|
313
315
|
export {
|
|
314
|
-
|
|
316
|
+
kt as Select
|
|
315
317
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),B=require("../../../../../external/classnames/index.cjs.js"),e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),B=require("../../../../../external/classnames/index.cjs.js"),e=require("react"),de=require("../../overlays/tooltip/tooltip.cjs.js"),oe=require("../../overlays/tooltip/tooltip-content.cjs.js"),ue=require("../../overlays/tooltip/tooltip-trigger.cjs.js"),ce=require("../feedback-text/feedback-text.cjs.js"),pe=require("../form-label/form-label.cjs.js"),t=require("./slider.module.scss.cjs.js"),fe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=e.forwardRef((m,M)=>{const{getCurrentBreakpointProps:P}=fe.useBreakpointProps(m.defaultServerBreakpoint),{id:V,name:E,label:h,hideLabel:R,labelProps:D,required:x,min:l=0,max:d=100,step:$=1,value:c,defaultValue:H,onChange:o,disabled:i=!1,invalid:O=!1,minLabel:p,maxLabel:U,showCurrentValue:f=!1,valueFormatter:_,tooltip:z=!0,addonRight:j,helper:r,className:A,"aria-label":G,"aria-labelledby":J,"aria-valuetext":K}=P(m),Q=e.useId(),b=V??`tedi-slider-${Q}`,k=r?r.id??`${b}-helper`:void 0,[W,X]=e.useState(H??l),u=Math.min(d,Math.max(l,c??W)),[Y,w]=e.useState(!1),[Z,L]=e.useState(!1),[s,C]=e.useState(!1),N=!!z&&!i,ee=N&&(Y||Z||s),ae=e.useCallback(()=>w(!0),[]),te=e.useCallback(()=>w(!1),[]),re=e.useCallback(()=>L(!0),[]),le=e.useCallback(()=>L(!1),[]),S=e.useRef(null),n=e.useCallback(()=>{S.current=null,C(!1)},[]);e.useEffect(()=>{if(s)return window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[s,n]);const ie=e.useCallback(g=>{i||(S.current=g.pointerId,C(!0))},[i]),se=e.useCallback(g=>{const y=Number(g.target.value);c===void 0&&X(y),o==null||o(y)},[o,c]),T=O||(r==null?void 0:r.type)==="error",q=d===l?0:(u-l)/(d-l)*100,I=_?_(u):u,v=f?I:U,ne=B.default(t.default["tedi-slider"],{[t.default["tedi-slider--disabled"]]:i,[t.default["tedi-slider--invalid"]]:T,[t.default["tedi-slider--dragging"]]:s&&!i},A);return a.jsxs("div",{"data-name":"slider",className:ne,children:[h&&a.jsx(pe.FormLabel,{id:b,label:h,required:x,hideLabel:R,labelProps:D}),a.jsxs("div",{className:t.default["tedi-slider__container"],children:[a.jsxs("div",{className:t.default["tedi-slider__track-row"],children:[p!=null&&a.jsx("span",{className:t.default["tedi-slider__range-label"],"aria-hidden":"true",children:p}),a.jsxs("div",{className:t.default["tedi-slider__track"],style:{"--tedi-slider-progress":`${q}%`,"--tedi-slider-progress-ratio":`${q/100}`},children:[a.jsx("input",{ref:M,id:b,name:E,type:"range",min:l,max:d,step:$,value:u,disabled:i,required:x,"aria-invalid":T?"true":void 0,"aria-describedby":k,"aria-label":G,"aria-labelledby":J,"aria-valuetext":K,onChange:se,onMouseEnter:ae,onMouseLeave:te,onPointerDown:ie,onFocus:re,onBlur:le,className:B.default(t.default["tedi-slider__input"],{[t.default["tedi-slider__input--dragging"]]:s})}),N&&a.jsxs(de.Tooltip,{open:ee,onToggle:()=>{},focusManager:{returnFocus:!1,initialFocus:-1},placement:"top",trackReferencePosition:!0,children:[a.jsx(ue.TooltipTrigger,{children:a.jsx("span",{className:t.default["tedi-slider__thumb-anchor"],"aria-hidden":"true",tabIndex:-1})}),a.jsx(oe.TooltipContent,{children:I})]})]}),v!=null&&a.jsx("span",{className:t.default["tedi-slider__range-label"],"aria-hidden":f?void 0:"true","aria-live":f?"polite":void 0,children:v})]}),j&&a.jsx("div",{className:t.default["tedi-slider__addon"],children:j})]}),r&&a.jsx(ce.FeedbackText,{...r,id:k})]})});F.displayName="Slider";exports.Slider=F;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { BreakpointSupport } from '../../../helpers';
|
|
3
3
|
import { FeedbackTextProps } from '../feedback-text/feedback-text';
|
|
4
|
+
import { FormLabelProps } from '../form-label/form-label';
|
|
4
5
|
type SliderBreakpointProps = {
|
|
5
6
|
/**
|
|
6
7
|
* Text/element rendered to the left of the track (e.g. the minimum value).
|
|
@@ -59,6 +60,12 @@ export interface SliderProps extends BreakpointSupport<SliderBreakpointProps> {
|
|
|
59
60
|
* available to assistive technology, or `'keep-space'` to reserve the vertical space.
|
|
60
61
|
*/
|
|
61
62
|
hideLabel?: boolean | 'keep-space';
|
|
63
|
+
/**
|
|
64
|
+
* Additional props forwarded to the underlying `Label` component.
|
|
65
|
+
* Use `modifiers` to control how the label text wraps or breaks
|
|
66
|
+
* (e.g. `{ modifiers: 'nowrap' }`).
|
|
67
|
+
*/
|
|
68
|
+
labelProps?: FormLabelProps['labelProps'];
|
|
62
69
|
/**
|
|
63
70
|
* Marks the field as required.
|
|
64
71
|
*/
|
|
@@ -1,70 +1,71 @@
|
|
|
1
1
|
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Tooltip as
|
|
5
|
-
import { TooltipContent as
|
|
6
|
-
import { TooltipTrigger as
|
|
7
|
-
import { FeedbackText as
|
|
8
|
-
import { FormLabel as
|
|
2
|
+
import C from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { forwardRef as de, useId as ce, useState as m, useCallback as i, useRef as ue, useEffect as me } from "react";
|
|
4
|
+
import { Tooltip as pe } from "../../overlays/tooltip/tooltip.es.js";
|
|
5
|
+
import { TooltipContent as ve } from "../../overlays/tooltip/tooltip-content.es.js";
|
|
6
|
+
import { TooltipTrigger as fe } from "../../overlays/tooltip/tooltip-trigger.es.js";
|
|
7
|
+
import { FeedbackText as ge } from "../feedback-text/feedback-text.es.js";
|
|
8
|
+
import { FormLabel as he } from "../form-label/form-label.es.js";
|
|
9
9
|
import e from "./slider.module.scss.es.js";
|
|
10
|
-
import { useBreakpointProps as
|
|
11
|
-
const
|
|
12
|
-
const { getCurrentBreakpointProps: D } =
|
|
10
|
+
import { useBreakpointProps as be } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
11
|
+
const _e = de((_, S) => {
|
|
12
|
+
const { getCurrentBreakpointProps: D } = be(_.defaultServerBreakpoint), {
|
|
13
13
|
id: R,
|
|
14
14
|
name: $,
|
|
15
15
|
label: w,
|
|
16
16
|
hideLabel: j,
|
|
17
|
+
labelProps: H,
|
|
17
18
|
required: L,
|
|
18
19
|
min: t = 0,
|
|
19
20
|
max: d = 100,
|
|
20
|
-
step:
|
|
21
|
+
step: q = 1,
|
|
21
22
|
value: p,
|
|
22
|
-
defaultValue:
|
|
23
|
+
defaultValue: O,
|
|
23
24
|
onChange: c,
|
|
24
25
|
disabled: n = !1,
|
|
25
|
-
invalid:
|
|
26
|
+
invalid: U = !1,
|
|
26
27
|
minLabel: v,
|
|
27
|
-
maxLabel:
|
|
28
|
+
maxLabel: z,
|
|
28
29
|
showCurrentValue: f = !1,
|
|
29
30
|
valueFormatter: N,
|
|
30
|
-
tooltip:
|
|
31
|
+
tooltip: A = !0,
|
|
31
32
|
addonRight: x,
|
|
32
33
|
helper: a,
|
|
33
|
-
className:
|
|
34
|
-
"aria-label":
|
|
35
|
-
"aria-labelledby":
|
|
36
|
-
"aria-valuetext":
|
|
37
|
-
} = D(_),
|
|
34
|
+
className: G,
|
|
35
|
+
"aria-label": J,
|
|
36
|
+
"aria-labelledby": K,
|
|
37
|
+
"aria-valuetext": Q
|
|
38
|
+
} = D(_), W = ce(), g = R ?? `tedi-slider-${W}`, I = a ? a.id ?? `${g}-helper` : void 0, [X, Y] = m(O ?? t), u = Math.min(d, Math.max(t, p ?? X)), [Z, y] = m(!1), [ee, F] = m(!1), [l, T] = m(!1), V = !!A && !n, re = V && (Z || ee || l), ae = i(() => y(!0), []), ie = i(() => y(!1), []), te = i(() => F(!0), []), ne = i(() => F(!1), []), k = ue(null), o = i(() => {
|
|
38
39
|
k.current = null, T(!1);
|
|
39
40
|
}, []);
|
|
40
|
-
|
|
41
|
+
me(() => {
|
|
41
42
|
if (l)
|
|
42
43
|
return window.addEventListener("pointerup", o), window.addEventListener("pointercancel", o), () => {
|
|
43
44
|
window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", o);
|
|
44
45
|
};
|
|
45
46
|
}, [l, o]);
|
|
46
|
-
const
|
|
47
|
+
const le = i(
|
|
47
48
|
(b) => {
|
|
48
49
|
n || (k.current = b.pointerId, T(!0));
|
|
49
50
|
},
|
|
50
51
|
[n]
|
|
51
|
-
),
|
|
52
|
+
), oe = i(
|
|
52
53
|
(b) => {
|
|
53
|
-
const
|
|
54
|
-
p === void 0 &&
|
|
54
|
+
const P = Number(b.target.value);
|
|
55
|
+
p === void 0 && Y(P), c == null || c(P);
|
|
55
56
|
},
|
|
56
57
|
[c, p]
|
|
57
|
-
), B =
|
|
58
|
+
), B = U || (a == null ? void 0 : a.type) === "error", E = d === t ? 0 : (u - t) / (d - t) * 100, M = N ? N(u) : u, h = f ? M : z, se = C(
|
|
58
59
|
e["tedi-slider"],
|
|
59
60
|
{
|
|
60
61
|
[e["tedi-slider--disabled"]]: n,
|
|
61
62
|
[e["tedi-slider--invalid"]]: B,
|
|
62
63
|
[e["tedi-slider--dragging"]]: l && !n
|
|
63
64
|
},
|
|
64
|
-
|
|
65
|
+
G
|
|
65
66
|
);
|
|
66
|
-
return /* @__PURE__ */ s("div", { "data-name": "slider", className:
|
|
67
|
-
w && /* @__PURE__ */ r(
|
|
67
|
+
return /* @__PURE__ */ s("div", { "data-name": "slider", className: se, children: [
|
|
68
|
+
w && /* @__PURE__ */ r(he, { id: g, label: w, required: L, hideLabel: j, labelProps: H }),
|
|
68
69
|
/* @__PURE__ */ s("div", { className: e["tedi-slider__container"], children: [
|
|
69
70
|
/* @__PURE__ */ s("div", { className: e["tedi-slider__track-row"], children: [
|
|
70
71
|
v != null && /* @__PURE__ */ r("span", { className: e["tedi-slider__range-label"], "aria-hidden": "true", children: v }),
|
|
@@ -86,38 +87,38 @@ const be = se((_, S) => {
|
|
|
86
87
|
type: "range",
|
|
87
88
|
min: t,
|
|
88
89
|
max: d,
|
|
89
|
-
step:
|
|
90
|
+
step: q,
|
|
90
91
|
value: u,
|
|
91
92
|
disabled: n,
|
|
92
93
|
required: L,
|
|
93
94
|
"aria-invalid": B ? "true" : void 0,
|
|
94
95
|
"aria-describedby": I,
|
|
95
|
-
"aria-label":
|
|
96
|
-
"aria-labelledby":
|
|
97
|
-
"aria-valuetext":
|
|
98
|
-
onChange:
|
|
99
|
-
onMouseEnter:
|
|
100
|
-
onMouseLeave:
|
|
101
|
-
onPointerDown:
|
|
102
|
-
onFocus:
|
|
103
|
-
onBlur:
|
|
104
|
-
className:
|
|
96
|
+
"aria-label": J,
|
|
97
|
+
"aria-labelledby": K,
|
|
98
|
+
"aria-valuetext": Q,
|
|
99
|
+
onChange: oe,
|
|
100
|
+
onMouseEnter: ae,
|
|
101
|
+
onMouseLeave: ie,
|
|
102
|
+
onPointerDown: le,
|
|
103
|
+
onFocus: te,
|
|
104
|
+
onBlur: ne,
|
|
105
|
+
className: C(e["tedi-slider__input"], {
|
|
105
106
|
[e["tedi-slider__input--dragging"]]: l
|
|
106
107
|
})
|
|
107
108
|
}
|
|
108
109
|
),
|
|
109
110
|
V && /* @__PURE__ */ s(
|
|
110
|
-
|
|
111
|
+
pe,
|
|
111
112
|
{
|
|
112
|
-
open:
|
|
113
|
+
open: re,
|
|
113
114
|
onToggle: () => {
|
|
114
115
|
},
|
|
115
116
|
focusManager: { returnFocus: !1, initialFocus: -1 },
|
|
116
117
|
placement: "top",
|
|
117
118
|
trackReferencePosition: !0,
|
|
118
119
|
children: [
|
|
119
|
-
/* @__PURE__ */ r(
|
|
120
|
-
/* @__PURE__ */ r(
|
|
120
|
+
/* @__PURE__ */ r(fe, { children: /* @__PURE__ */ r("span", { className: e["tedi-slider__thumb-anchor"], "aria-hidden": "true", tabIndex: -1 }) }),
|
|
121
|
+
/* @__PURE__ */ r(ve, { children: M })
|
|
121
122
|
]
|
|
122
123
|
}
|
|
123
124
|
)
|
|
@@ -136,10 +137,10 @@ const be = se((_, S) => {
|
|
|
136
137
|
] }),
|
|
137
138
|
x && /* @__PURE__ */ r("div", { className: e["tedi-slider__addon"], children: x })
|
|
138
139
|
] }),
|
|
139
|
-
a && /* @__PURE__ */ r(
|
|
140
|
+
a && /* @__PURE__ */ r(ge, { ...a, id: I })
|
|
140
141
|
] });
|
|
141
142
|
});
|
|
142
|
-
|
|
143
|
+
_e.displayName = "Slider";
|
|
143
144
|
export {
|
|
144
|
-
|
|
145
|
+
_e as Slider
|
|
145
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),h=require("../../../../../external/classnames/index.cjs.js"),i=require("react"),K=require("../../base/icon/icon.cjs.js"),_e=require("../../buttons/closing-button/closing-button.cjs.js"),Ie=require("../../misc/separator/separator.cjs.js"),D=require("../feedback-text/feedback-text.cjs.js"),ge=require("../field/field.cjs.js"),je=require("../form-label/form-label.cjs.js"),k=require("../input-group/input-group.cjs.js"),t=require("./textfield.module.scss.cjs.js"),Ae=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),Ne=require("../../../providers/label-provider/use-labels.cjs.js"),ke={large:24,default:18},q=i.forwardRef((_,U)=>{var V;const{getCurrentBreakpointProps:J}=Ae.useBreakpointProps(_.defaultServerBreakpoint),{id:qe,label:I,className:Q,inputClassName:W,disabled:c,required:C,hideLabel:S,labelProps:X,invalid:f,readOnly:B,icon:s,onIconClick:b,iconButtonProps:y,size:d="default",placeholder:Y,isArrowsHidden:Z=!0,isClearable:F,showClearOnInteraction:G,onClear:v,onChange:o,onChangeEvent:ee,onKeyUp:te,onKeyDown:re,onKeyPress:ae,defaultValue:w,value:g,onFocus:j,onBlur:A,onClick:le,helper:e,input:a,name:ie,isTextArea:se,startSlot:ne,endSlot:de,...oe}=J(_)||{},{getLabel:T}=Ne.useLabels(),z=i.useRef(null),L=i.useRef(null),[ce,R]=i.useState(g??w??""),M=g??ce,u=!!(F&&M&&!B),x=(V=k.useOptionalInputGroup)==null?void 0:V.call(k),ue=i.useId(),fe=x==null?void 0:x.hasExternalLabel,m=_.id??(x==null?void 0:x.inputId)??ue;i.useImperativeHandle(U,()=>({get input(){return L.current},get inner(){return z.current}}));const P=i.useMemo(()=>Array.isArray(e)?f||e.some(r=>r.type==="error"):f||(e==null?void 0:e.type)==="error",[f,e]),xe=i.useMemo(()=>!e||Array.isArray(e)&&e.length===0?!1:Array.isArray(e)?!f&&e.every(r=>r.type==="valid"):!f&&e.type==="valid",[f,e]),me=d==="large"?"default":d,p=g!==void 0,ye=i.useCallback(r=>{p||R(r),o==null||o(r)},[p,o]),O=i.useCallback(()=>{p||R(""),o==null||o(""),v==null||v()},[p,o,v]),$=i.useCallback(()=>{if(!s)return null;const N={size:d==="large"?24:d==="small"?!!b?18:16:18,className:t.default["tedi-textfield__icon"]},H=typeof s=="string"?{...N,name:s}:{...N,...s,className:h.default(N.className,s.className)};return b?l.jsx("button",{type:"button",...y,className:h.default(t.default["tedi-textfield__icon-wrapper"],y==null?void 0:y.className),onClick:c?void 0:b,disabled:c,children:l.jsx(K.Icon,{...H})}):l.jsx("div",{className:t.default["tedi-textfield__icon-wrapper"],"aria-hidden":"true",children:l.jsx(K.Icon,{...H})})},[s,d,b,y,c]),E=i.useMemo(()=>u?l.jsx(_e.ClosingButton,{iconSize:ke[d==="large"?"large":"default"],onClick:c?void 0:O,disabled:c,title:T("clear"),className:t.default["tedi-textfield__clear-button"]}):null,[u,d,c,O,T]),be=i.useMemo(()=>!u&&!s?null:l.jsxs("div",{className:t.default["tedi-textfield__right-area"],children:[E,u&&s&&l.jsx(Ie.Separator,{color:"primary",axis:"vertical",className:t.default["tedi-textfield__separator"]}),s&&$()]}),[u,s,E,$]),ve=l.jsx(ge.Field,{...a,id:m,name:ie,value:M,defaultValue:w,onChange:ye,onChangeEvent:ee,disabled:c,readOnly:B||(a==null?void 0:a.readOnly),required:C,invalid:P,placeholder:Y,className:h.default(t.default["tedi-textfield__input"],W,{[t.default["tedi-textfield__input--hidden-arrows"]]:Z}),onFocus:r=>{var n;(n=a==null?void 0:a.onFocus)==null||n.call(a,r),j==null||j(r)},onBlur:r=>{var n;(n=a==null?void 0:a.onBlur)==null||n.call(a,r),A==null||A(r)},isTextArea:se,"aria-describedby":!e||Array.isArray(e)&&e.length===0?void 0:Array.isArray(e)?e.map((r,n)=>`${m}-helper-${n}`).join(" "):`${m}-helper`,"aria-label":S&&typeof I=="string"?I:void 0,ref:L}),pe=h.default(t.default["tedi-textfield"],{[t.default[`tedi-textfield--${d}`]]:d},{[t.default["tedi-textfield--with-icon"]]:s},{[t.default["tedi-textfield--invalid"]]:P},{[t.default["tedi-textfield--valid"]]:xe},{[t.default["tedi-textfield--clearable"]]:u},{[t.default["tedi-textfield--clear-on-interaction"]]:u&&G},Q),he=()=>!e||Array.isArray(e)&&e.length===0?null:l.jsx("div",{className:t.default["tedi-textfield__feedback-wrapper"],children:Array.isArray(e)?e.map((r,n)=>l.jsx(D.FeedbackText,{...r,id:`${m}-helper-${n}`},n)):l.jsx(D.FeedbackText,{...e,id:`${m}-helper`})});return l.jsxs("div",{"data-name":"textfield",...oe,className:pe,children:[!fe&&l.jsx(je.FormLabel,{id:m,label:I,required:C,hideLabel:S,size:me,labelProps:X}),l.jsxs("div",{className:t.default["tedi-textfield__inner"],onKeyDown:re,onKeyUp:te,onKeyPress:ae,onClick:le,ref:z,children:[ne,ve,de,(F||s)&&be]}),he()]})});q.displayName="TextField";exports.TextField=q;exports.default=q;
|