@carbon/react 1.104.1 → 1.105.0-rc.0
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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +988 -988
- package/es/components/AISkeleton/AISkeletonPlaceholder.d.ts +1 -1
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.js +2 -2
- package/es/components/ComposedModal/ComposedModal.js +1 -1
- package/es/components/DataTable/TableDecoratorRow.js +1 -1
- package/es/components/DataTable/TableExpandRow.js +1 -1
- package/es/components/DataTable/TableHeader.js +1 -1
- package/es/components/DataTable/TableRow.js +1 -1
- package/es/components/DataTable/tools/normalize.js +1 -1
- package/es/components/DatePicker/DatePicker.d.ts +0 -8
- package/es/components/DatePicker/DatePicker.js +5 -28
- package/es/components/DatePicker/plugins/fixEventsPlugin.d.ts +18 -2
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +9 -16
- package/es/components/DatePickerInput/DatePickerInput.js +1 -2
- package/es/components/Dropdown/Dropdown.js +2 -2
- package/es/components/FluidDatePicker/FluidDatePicker.js +1 -3
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +2 -2
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +2 -2
- package/es/components/MultiSelect/MultiSelect.js +2 -2
- package/es/components/NumberInput/NumberInput.js +2 -2
- package/es/components/Pagination/Pagination.js +60 -29
- package/es/components/Popover/index.js +7 -4
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +1 -1
- package/es/components/Slider/Slider.js +60 -45
- package/es/components/Tabs/Tabs.js +1 -1
- package/es/components/Tag/DismissibleTag.js +1 -1
- package/es/components/Tag/Tag.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/TextInput.js +1 -1
- package/es/components/Tile/Tile.js +1 -1
- package/es/components/UIShell/HeaderPanel.js +1 -1
- package/es/components/UIShell/Switcher.js +1 -1
- package/es/internal/useNoInteractiveChildren.d.ts +2 -10
- package/es/internal/useNoInteractiveChildren.js +16 -27
- package/lib/components/AISkeleton/AISkeletonPlaceholder.d.ts +1 -1
- package/lib/components/AISkeleton/AISkeletonPlaceholder.js +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +2 -2
- package/lib/components/ComposedModal/ComposedModal.js +1 -1
- package/lib/components/DataTable/TableDecoratorRow.js +1 -1
- package/lib/components/DataTable/TableExpandRow.js +1 -1
- package/lib/components/DataTable/TableHeader.js +1 -1
- package/lib/components/DataTable/TableRow.js +1 -1
- package/lib/components/DataTable/tools/normalize.js +1 -1
- package/lib/components/DatePicker/DatePicker.d.ts +0 -8
- package/lib/components/DatePicker/DatePicker.js +1 -24
- package/lib/components/DatePicker/plugins/fixEventsPlugin.d.ts +18 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +9 -16
- package/lib/components/DatePickerInput/DatePickerInput.js +1 -2
- package/lib/components/Dropdown/Dropdown.js +2 -2
- package/lib/components/FluidDatePicker/FluidDatePicker.js +1 -3
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +2 -2
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +2 -2
- package/lib/components/NumberInput/NumberInput.js +2 -2
- package/lib/components/Pagination/Pagination.js +59 -28
- package/lib/components/Popover/index.js +7 -4
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +1 -1
- package/lib/components/Slider/Slider.js +60 -45
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/Tag/DismissibleTag.js +1 -1
- package/lib/components/Tag/Tag.js +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/components/Tile/Tile.js +1 -1
- package/lib/components/UIShell/HeaderPanel.js +1 -1
- package/lib/components/UIShell/Switcher.js +1 -1
- package/lib/internal/useNoInteractiveChildren.d.ts +2 -10
- package/lib/internal/useNoInteractiveChildren.js +16 -27
- package/package.json +7 -7
|
@@ -9,8 +9,8 @@ import { usePrefix } from "../../internal/usePrefix.js";
|
|
|
9
9
|
import { Text } from "../Text/Text.js";
|
|
10
10
|
import { useId } from "../../internal/useId.js";
|
|
11
11
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
12
|
-
import { AILabel } from "../AILabel/index.js";
|
|
13
12
|
import { isComponentElement } from "../../internal/utils.js";
|
|
13
|
+
import { AILabel } from "../AILabel/index.js";
|
|
14
14
|
import { mergeRefs } from "../../tools/mergeRefs.js";
|
|
15
15
|
import { useNormalizedInputProps } from "../../internal/useNormalizedInputProps.js";
|
|
16
16
|
import classNames from "classnames";
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { usePrefix } from "../../internal/usePrefix.js";
|
|
9
9
|
import { useId } from "../../internal/useId.js";
|
|
10
10
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
11
|
-
import { AILabel } from "../AILabel/index.js";
|
|
12
11
|
import { isComponentElement } from "../../internal/utils.js";
|
|
12
|
+
import { AILabel } from "../AILabel/index.js";
|
|
13
13
|
import { mergeRefs } from "../../tools/mergeRefs.js";
|
|
14
14
|
import { Legend } from "../Text/createTextComponent.js";
|
|
15
15
|
import classNames from "classnames";
|
|
@@ -12,9 +12,9 @@ import { matches } from "../../internal/keyboard/match.js";
|
|
|
12
12
|
import { useFallbackId } from "../../internal/useId.js";
|
|
13
13
|
import { noopFn } from "../../internal/noopFn.js";
|
|
14
14
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
15
|
+
import { isComponentElement } from "../../internal/utils.js";
|
|
15
16
|
import { useFeatureFlag } from "../FeatureFlags/index.js";
|
|
16
17
|
import { AILabel } from "../AILabel/index.js";
|
|
17
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
18
18
|
import classNames from "classnames";
|
|
19
19
|
import React, { cloneElement } from "react";
|
|
20
20
|
import PropTypes from "prop-types";
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { usePrefix } from "../../internal/usePrefix.js";
|
|
9
9
|
import { Text } from "../Text/Text.js";
|
|
10
10
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
11
|
-
import { AILabel } from "../AILabel/index.js";
|
|
12
11
|
import { isComponentElement } from "../../internal/utils.js";
|
|
12
|
+
import { AILabel } from "../AILabel/index.js";
|
|
13
13
|
import { composeEventHandlers } from "../../tools/events.js";
|
|
14
14
|
import { FormContext } from "../FluidForm/FormContext.js";
|
|
15
15
|
import { useNormalizedInputProps } from "../../internal/useNormalizedInputProps.js";
|
|
@@ -46,13 +46,18 @@ const translationIds = { "carbon.slider.auto-correct-announcement": "carbon.slid
|
|
|
46
46
|
const defaultTranslations = { [translationIds["carbon.slider.auto-correct-announcement"]]: "The inputted value \"{correctedValue}\" was corrected to the nearest allowed digit." };
|
|
47
47
|
const defaultTranslateWithId = (messageId, args) => {
|
|
48
48
|
const template = defaultTranslations[messageId];
|
|
49
|
-
|
|
50
|
-
return template;
|
|
49
|
+
const correctedValue = args?.correctedValue ?? "";
|
|
50
|
+
return template.replace("{correctedValue}", correctedValue);
|
|
51
51
|
};
|
|
52
52
|
const defaultFormatLabel = (value, label) => {
|
|
53
53
|
return `${value}${label ?? ""}`;
|
|
54
54
|
};
|
|
55
55
|
const hasUpperValue = (valueUpper) => typeof valueUpper !== "undefined";
|
|
56
|
+
const calcRawLeftPercent = ({ max, min, value }) => {
|
|
57
|
+
const range = max - min;
|
|
58
|
+
if (range === 0) return 0;
|
|
59
|
+
return clamp((value - min) / range, 0, 1);
|
|
60
|
+
};
|
|
56
61
|
/**
|
|
57
62
|
* Minimum time between processed "drag" events in milliseconds.
|
|
58
63
|
*/
|
|
@@ -69,6 +74,12 @@ var HandlePosition = /* @__PURE__ */ function(HandlePosition) {
|
|
|
69
74
|
return HandlePosition;
|
|
70
75
|
}(HandlePosition || {});
|
|
71
76
|
const Slider = (props) => {
|
|
77
|
+
const controlledValue = props.value;
|
|
78
|
+
const controlledValueUpper = props.unstable_valueUpper;
|
|
79
|
+
const controlledMax = props.max;
|
|
80
|
+
const controlledMin = props.min;
|
|
81
|
+
const onChange = props.onChange;
|
|
82
|
+
const onRelease = props.onRelease;
|
|
72
83
|
const [state, setState] = useReducer((prev, args) => ({
|
|
73
84
|
...prev,
|
|
74
85
|
...args
|
|
@@ -141,18 +152,20 @@ const Slider = (props) => {
|
|
|
141
152
|
};
|
|
142
153
|
}, []);
|
|
143
154
|
useEffect(() => {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
const el = filledTrackRef.current;
|
|
156
|
+
if (!el) return;
|
|
157
|
+
if (twoHandles) el.style.transform = state.isRtl ? `translate(${100 - state.leftUpper}%, -50%) scaleX(${(state.leftUpper - state.left) / 100})` : `translate(${state.left}%, -50%) scaleX(${(state.leftUpper - state.left) / 100})`;
|
|
158
|
+
else el.style.transform = state.isRtl ? `translate(100%, -50%) scaleX(-${state.left / 100})` : `translate(0%, -50%) scaleX(${state.left / 100})`;
|
|
147
159
|
}, [
|
|
160
|
+
state.isRtl,
|
|
148
161
|
state.left,
|
|
149
162
|
state.leftUpper,
|
|
150
|
-
|
|
163
|
+
twoHandles
|
|
151
164
|
]);
|
|
152
165
|
const prevValsRef = useRef(null);
|
|
153
166
|
useEffect(() => {
|
|
154
167
|
const prev = prevValsRef.current;
|
|
155
|
-
if (prev && (prev.value !== state.value || prev.valueUpper !== state.valueUpper) && typeof
|
|
168
|
+
if (prev && (prev.value !== state.value || prev.valueUpper !== state.valueUpper) && typeof onChange === "function") onChange({
|
|
156
169
|
value: state.value,
|
|
157
170
|
valueUpper: state.valueUpper
|
|
158
171
|
});
|
|
@@ -163,56 +176,59 @@ const Slider = (props) => {
|
|
|
163
176
|
}, [
|
|
164
177
|
state.value,
|
|
165
178
|
state.valueUpper,
|
|
166
|
-
|
|
179
|
+
onChange
|
|
167
180
|
]);
|
|
168
181
|
useEffect(() => {
|
|
169
|
-
if (state.needsOnRelease && typeof
|
|
170
|
-
|
|
182
|
+
if (state.needsOnRelease && typeof onRelease === "function") {
|
|
183
|
+
onRelease({
|
|
171
184
|
value: state.value,
|
|
172
185
|
valueUpper: state.valueUpper
|
|
173
186
|
});
|
|
174
187
|
setState({ needsOnRelease: false });
|
|
175
188
|
}
|
|
176
189
|
}, [
|
|
190
|
+
onRelease,
|
|
177
191
|
state.needsOnRelease,
|
|
178
192
|
state.value,
|
|
179
|
-
state.valueUpper
|
|
180
|
-
props.onRelease
|
|
193
|
+
state.valueUpper
|
|
181
194
|
]);
|
|
182
195
|
const prevSyncKeysRef = useRef(null);
|
|
183
196
|
useEffect(() => {
|
|
184
197
|
const prev = prevSyncKeysRef.current;
|
|
185
198
|
const next = [
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
199
|
+
controlledValue,
|
|
200
|
+
controlledValueUpper,
|
|
201
|
+
controlledMax,
|
|
202
|
+
controlledMin
|
|
190
203
|
];
|
|
191
204
|
if (!prev || prev[0] !== next[0] || prev[1] !== next[1] || prev[2] !== next[2] || prev[3] !== next[3]) {
|
|
192
|
-
setState(
|
|
193
|
-
value:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
setState({
|
|
206
|
+
value: controlledValue,
|
|
207
|
+
left: calcRawLeftPercent({
|
|
208
|
+
max: controlledMax,
|
|
209
|
+
min: controlledMin,
|
|
210
|
+
value: controlledValue
|
|
211
|
+
}) * 100
|
|
212
|
+
});
|
|
213
|
+
if (typeof controlledValueUpper !== "undefined") setState({
|
|
214
|
+
valueUpper: controlledValueUpper,
|
|
215
|
+
leftUpper: calcRawLeftPercent({
|
|
216
|
+
max: controlledMax,
|
|
217
|
+
min: controlledMin,
|
|
218
|
+
value: controlledValueUpper
|
|
219
|
+
}) * 100
|
|
220
|
+
});
|
|
221
|
+
else setState({
|
|
206
222
|
valueUpper: void 0,
|
|
207
223
|
leftUpper: void 0
|
|
208
224
|
});
|
|
209
225
|
prevSyncKeysRef.current = next;
|
|
210
226
|
}
|
|
211
227
|
}, [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
228
|
+
controlledMax,
|
|
229
|
+
controlledMin,
|
|
230
|
+
controlledValue,
|
|
231
|
+
controlledValueUpper
|
|
216
232
|
]);
|
|
217
233
|
/**
|
|
218
234
|
* Rounds a given value to the nearest step defined by the slider's `step`
|
|
@@ -287,7 +303,7 @@ const Slider = (props) => {
|
|
|
287
303
|
const _onDragRef = useRef(null);
|
|
288
304
|
_onDragRef.current = (evt, activeHandle) => {
|
|
289
305
|
activeHandle = activeHandle ?? stateRef.current.activeHandle;
|
|
290
|
-
if (propsRef.current.disabled || propsRef.current.readOnly
|
|
306
|
+
if (propsRef.current.disabled || propsRef.current.readOnly) return;
|
|
291
307
|
const { value, left } = calcValue({
|
|
292
308
|
clientX: getClientXFromEvent(evt),
|
|
293
309
|
value: stateRef.current.value
|
|
@@ -354,7 +370,6 @@ const Slider = (props) => {
|
|
|
354
370
|
*/
|
|
355
371
|
const onChangeInput = (evt) => {
|
|
356
372
|
if (props.disabled || props.readOnly) return;
|
|
357
|
-
if (!evt || !("target" in evt) || typeof evt.target.value !== "string") return;
|
|
358
373
|
const activeHandle = evt.target.dataset.handlePosition ?? HandlePosition.LOWER;
|
|
359
374
|
const targetValue = Number.parseFloat(evt.target.value);
|
|
360
375
|
if (twoHandles) if (isNaN(targetValue)) setValueForHandle(activeHandle, evt.target.value);
|
|
@@ -378,7 +393,6 @@ const Slider = (props) => {
|
|
|
378
393
|
* Handles state change to isValid state.
|
|
379
394
|
*/
|
|
380
395
|
const onBlurInput = (evt) => {
|
|
381
|
-
if (!evt || !("target" in evt) || typeof evt.target.value !== "string") return;
|
|
382
396
|
const { value: targetValue } = evt.target;
|
|
383
397
|
processNewInputValue(evt.target);
|
|
384
398
|
props.onBlur?.({
|
|
@@ -388,7 +402,6 @@ const Slider = (props) => {
|
|
|
388
402
|
};
|
|
389
403
|
const onInputKeyDown = (evt) => {
|
|
390
404
|
if (props.disabled || props.readOnly || !(evt.target instanceof HTMLInputElement)) return;
|
|
391
|
-
if (!evt || !("target" in evt) || typeof evt.target.value !== "string") return;
|
|
392
405
|
if (matches(evt, [Enter])) processNewInputValue(evt.target);
|
|
393
406
|
};
|
|
394
407
|
const processNewInputValue = (input) => {
|
|
@@ -435,13 +448,17 @@ const Slider = (props) => {
|
|
|
435
448
|
});
|
|
436
449
|
}
|
|
437
450
|
};
|
|
438
|
-
const calcLeftPercent = ({ clientX, value
|
|
451
|
+
const calcLeftPercent = ({ clientX, value }) => {
|
|
439
452
|
const boundingRect = elementRef.current?.getBoundingClientRect?.();
|
|
440
453
|
let width = boundingRect ? boundingRect.right - boundingRect.left : 0;
|
|
454
|
+
const nextValue = value ?? props.min;
|
|
441
455
|
if (width <= 0) width = 1;
|
|
442
456
|
if (clientX) return (state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0)) / width;
|
|
443
|
-
|
|
444
|
-
|
|
457
|
+
return calcRawLeftPercent({
|
|
458
|
+
max: props.max,
|
|
459
|
+
min: props.min,
|
|
460
|
+
value: nextValue
|
|
461
|
+
});
|
|
445
462
|
};
|
|
446
463
|
/**
|
|
447
464
|
* Calculates the discrete value (snapped to the nearest step) along
|
|
@@ -465,8 +482,7 @@ const Slider = (props) => {
|
|
|
465
482
|
/** `leftPercentRaw` clamped between 0 and 1. */
|
|
466
483
|
const leftPercent = clamp(calcLeftPercent({
|
|
467
484
|
clientX,
|
|
468
|
-
value
|
|
469
|
-
range: props.max - props.min
|
|
485
|
+
value
|
|
470
486
|
}), 0, 1);
|
|
471
487
|
if (useRawValue) return {
|
|
472
488
|
value,
|
|
@@ -535,8 +551,7 @@ const Slider = (props) => {
|
|
|
535
551
|
max
|
|
536
552
|
})) return false;
|
|
537
553
|
if (handle === HandlePosition.LOWER) return !valueUpper || newValue <= valueUpper;
|
|
538
|
-
|
|
539
|
-
return false;
|
|
554
|
+
return !value || newValue >= value;
|
|
540
555
|
};
|
|
541
556
|
const isValidValue = ({ value, min, max }) => {
|
|
542
557
|
return !(value < min || value > max);
|
|
@@ -12,11 +12,11 @@ import { match, matches } from "../../internal/keyboard/match.js";
|
|
|
12
12
|
import useIsomorphicEffect from "../../internal/useIsomorphicEffect.js";
|
|
13
13
|
import { useId } from "../../internal/useId.js";
|
|
14
14
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
15
|
+
import { isComponentElement } from "../../internal/utils.js";
|
|
15
16
|
import { useMergedRefs } from "../../internal/useMergedRefs.js";
|
|
16
17
|
import { useEvent } from "../../internal/useEvent.js";
|
|
17
18
|
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
18
19
|
import BadgeIndicator from "../BadgeIndicator/index.js";
|
|
19
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
20
20
|
import { useControllableState } from "../../internal/useControllableState.js";
|
|
21
21
|
import { GridAsGridComponent } from "../Grid/Grid.js";
|
|
22
22
|
import { useMatchMedia } from "../../internal/useMatchMedia.js";
|
|
@@ -10,9 +10,9 @@ import { Text } from "../Text/Text.js";
|
|
|
10
10
|
import useIsomorphicEffect from "../../internal/useIsomorphicEffect.js";
|
|
11
11
|
import { useId } from "../../internal/useId.js";
|
|
12
12
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
13
|
+
import { isComponentElement } from "../../internal/utils.js";
|
|
13
14
|
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
14
15
|
import { AILabel } from "../AILabel/index.js";
|
|
15
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
16
16
|
import { mergeRefs } from "../../tools/mergeRefs.js";
|
|
17
17
|
import { isEllipsisActive } from "./isEllipsisActive.js";
|
|
18
18
|
import Tag, { SIZES, TYPES } from "./Tag.js";
|
package/es/components/Tag/Tag.js
CHANGED
|
@@ -10,10 +10,10 @@ import { Text } from "../Text/Text.js";
|
|
|
10
10
|
import useIsomorphicEffect from "../../internal/useIsomorphicEffect.js";
|
|
11
11
|
import { useId } from "../../internal/useId.js";
|
|
12
12
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
13
|
+
import { isComponentElement } from "../../internal/utils.js";
|
|
13
14
|
import { useMergedRefs } from "../../internal/useMergedRefs.js";
|
|
14
15
|
import { DefinitionTooltip } from "../Tooltip/DefinitionTooltip.js";
|
|
15
16
|
import { AILabel } from "../AILabel/index.js";
|
|
16
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
17
17
|
import { isEllipsisActive } from "./isEllipsisActive.js";
|
|
18
18
|
import classNames from "classnames";
|
|
19
19
|
import React, { cloneElement, useRef, useState } from "react";
|
|
@@ -11,9 +11,9 @@ import useIsomorphicEffect from "../../internal/useIsomorphicEffect.js";
|
|
|
11
11
|
import { useId } from "../../internal/useId.js";
|
|
12
12
|
import { noopFn } from "../../internal/noopFn.js";
|
|
13
13
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
14
|
+
import { isComponentElement } from "../../internal/utils.js";
|
|
14
15
|
import { useMergedRefs } from "../../internal/useMergedRefs.js";
|
|
15
16
|
import { AILabel } from "../AILabel/index.js";
|
|
16
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
17
17
|
import { FormContext } from "../FluidForm/FormContext.js";
|
|
18
18
|
import { getAnnouncement } from "../../internal/getAnnouncement.js";
|
|
19
19
|
import classNames from "classnames";
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
import { usePrefix } from "../../internal/usePrefix.js";
|
|
9
9
|
import { Text } from "../Text/Text.js";
|
|
10
10
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
11
|
+
import { isComponentElement } from "../../internal/utils.js";
|
|
11
12
|
import { useMergedRefs } from "../../internal/useMergedRefs.js";
|
|
12
13
|
import { AILabel } from "../AILabel/index.js";
|
|
13
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
14
14
|
import { FormContext } from "../FluidForm/FormContext.js";
|
|
15
15
|
import { useNormalizedInputProps } from "../../internal/useNormalizedInputProps.js";
|
|
16
16
|
import { getTextInputProps } from "./util.js";
|
|
@@ -13,11 +13,11 @@ import useIsomorphicEffect from "../../internal/useIsomorphicEffect.js";
|
|
|
13
13
|
import { useId } from "../../internal/useId.js";
|
|
14
14
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
15
15
|
import Link_default from "../Link/index.js";
|
|
16
|
+
import { isComponentElement } from "../../internal/utils.js";
|
|
16
17
|
import { useMergedRefs } from "../../internal/useMergedRefs.js";
|
|
17
18
|
import { useFeatureFlag } from "../FeatureFlags/index.js";
|
|
18
19
|
import { getInteractiveContent, getRoleContent } from "../../internal/useNoInteractiveChildren.js";
|
|
19
20
|
import { AILabel } from "../AILabel/index.js";
|
|
20
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
21
21
|
import { composeEventHandlers } from "../../tools/events.js";
|
|
22
22
|
import classNames from "classnames";
|
|
23
23
|
import React, { Children, cloneElement, forwardRef, useCallback, useEffect, useRef, useState } from "react";
|
|
@@ -9,9 +9,9 @@ import { usePrefix } from "../../internal/usePrefix.js";
|
|
|
9
9
|
import { Escape } from "../../internal/keyboard/keys.js";
|
|
10
10
|
import { match } from "../../internal/keyboard/match.js";
|
|
11
11
|
import { noopFn } from "../../internal/noopFn.js";
|
|
12
|
+
import { isComponentElement } from "../../internal/utils.js";
|
|
12
13
|
import { useMergedRefs } from "../../internal/useMergedRefs.js";
|
|
13
14
|
import { useWindowEvent } from "../../internal/useEvent.js";
|
|
14
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
15
15
|
import Switcher from "./Switcher.js";
|
|
16
16
|
import classNames from "classnames";
|
|
17
17
|
import React, { useRef, useState } from "react";
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { usePrefix } from "../../internal/usePrefix.js";
|
|
9
|
-
import { useMergedRefs } from "../../internal/useMergedRefs.js";
|
|
10
9
|
import { isComponentElement } from "../../internal/utils.js";
|
|
10
|
+
import { useMergedRefs } from "../../internal/useMergedRefs.js";
|
|
11
11
|
import { AriaLabelPropType } from "../../prop-types/AriaPropTypes.js";
|
|
12
12
|
import SwitcherItem from "./SwitcherItem.js";
|
|
13
13
|
import SwitcherDivider from "./SwitcherDivider.js";
|
|
@@ -8,18 +8,10 @@ import { type RefObject } from 'react';
|
|
|
8
8
|
export declare const useNoInteractiveChildren: (ref: RefObject<HTMLElement | null>, message?: string) => void;
|
|
9
9
|
export declare const useInteractiveChildrenNeedDescription: (ref: RefObject<HTMLElement | null>, message?: string) => void;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* interactive. It returns the interactive node if one is found.
|
|
13
|
-
*
|
|
14
|
-
* @param node - The node to check.
|
|
15
|
-
* @returns The interactive node, or `null` if none is found.
|
|
11
|
+
* Finds an interactive node in a given DOM node, including the node itself.
|
|
16
12
|
*/
|
|
17
13
|
export declare const getInteractiveContent: (node: HTMLElement) => HTMLElement | null;
|
|
18
14
|
/**
|
|
19
|
-
*
|
|
20
|
-
* It returns the node with a `role` if one is found.
|
|
21
|
-
*
|
|
22
|
-
* @param node - The node to check.
|
|
23
|
-
* @returns The node with a `role`, or `null` if none is found.
|
|
15
|
+
* Finds a node with a `role` in a given DOM node, including the node itself.
|
|
24
16
|
*/
|
|
25
17
|
export declare const getRoleContent: (node: HTMLElement) => HTMLElement | null;
|
|
@@ -32,39 +32,28 @@ const useInteractiveChildrenNeedDescription = (ref, message = `interactive child
|
|
|
32
32
|
if (node && !node.hasAttribute("aria-describedby")) throw new Error(`Error: ${message}.\n\nInstead found: ${node.outerHTML}`);
|
|
33
33
|
}, [message, ref]);
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
const getInteractiveContent = (node) => {
|
|
43
|
-
if (!node || !node.childNodes) return null;
|
|
44
|
-
if (isFocusable(node)) return node;
|
|
45
|
-
for (const childNode of node.childNodes) if (childNode instanceof HTMLElement) {
|
|
46
|
-
const interactiveNode = getInteractiveContent(childNode);
|
|
47
|
-
if (interactiveNode) return interactiveNode;
|
|
35
|
+
const findMatchingContent = (node, matcher) => {
|
|
36
|
+
if (matcher(node)) return node;
|
|
37
|
+
for (const child of node.children) {
|
|
38
|
+
if (!(child instanceof HTMLElement)) continue;
|
|
39
|
+
const matchingChild = findMatchingContent(child, matcher);
|
|
40
|
+
if (matchingChild) return matchingChild;
|
|
48
41
|
}
|
|
49
42
|
return null;
|
|
50
43
|
};
|
|
51
44
|
/**
|
|
52
|
-
*
|
|
53
|
-
* It returns the node with a `role` if one is found.
|
|
54
|
-
*
|
|
55
|
-
* @param node - The node to check.
|
|
56
|
-
* @returns The node with a `role`, or `null` if none is found.
|
|
45
|
+
* Finds an interactive node in a given DOM node, including the node itself.
|
|
57
46
|
*/
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const roleNode = getRoleContent(childNode);
|
|
63
|
-
if (roleNode) return roleNode;
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
47
|
+
const getInteractiveContent = (node) => findMatchingContent(node, isFocusable);
|
|
48
|
+
const hasRole = (element) => {
|
|
49
|
+
const role = element.getAttribute("role");
|
|
50
|
+
return role !== null && role !== "";
|
|
66
51
|
};
|
|
67
52
|
/**
|
|
53
|
+
* Finds a node with a `role` in a given DOM node, including the node itself.
|
|
54
|
+
*/
|
|
55
|
+
const getRoleContent = (node) => findMatchingContent(node, hasRole);
|
|
56
|
+
/**
|
|
68
57
|
* Determines if the given element is focusable.
|
|
69
58
|
*
|
|
70
59
|
* @param element - The element to check.
|
|
@@ -72,7 +61,7 @@ const getRoleContent = (node) => {
|
|
|
72
61
|
* @see https://github.com/w3c/aria-practices/blob/0553bb51588ffa517506e2a1b2ca1422ed438c5f/examples/js/utils.js#L68
|
|
73
62
|
*/
|
|
74
63
|
const isFocusable = (element) => {
|
|
75
|
-
if (element.tabIndex
|
|
64
|
+
if (element.tabIndex < 0) return false;
|
|
76
65
|
if (element instanceof HTMLButtonElement || element instanceof HTMLInputElement || element instanceof HTMLSelectElement || element instanceof HTMLTextAreaElement) {
|
|
77
66
|
if (element.disabled) return false;
|
|
78
67
|
}
|
|
@@ -18,7 +18,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
18
18
|
|
|
19
19
|
//#region src/components/AISkeleton/AISkeletonPlaceholder.tsx
|
|
20
20
|
/**
|
|
21
|
-
* Copyright IBM Corp. 2016,
|
|
21
|
+
* Copyright IBM Corp. 2016, 2026
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -11,8 +11,8 @@ const require_Text = require('../Text/Text.js');
|
|
|
11
11
|
const require_useId = require('../../internal/useId.js');
|
|
12
12
|
const require_noopFn = require('../../internal/noopFn.js');
|
|
13
13
|
const require_deprecate = require('../../prop-types/deprecate.js');
|
|
14
|
-
const require_index = require('../AILabel/index.js');
|
|
15
14
|
const require_utils = require('../../internal/utils.js');
|
|
15
|
+
const require_index = require('../AILabel/index.js');
|
|
16
16
|
let classnames = require("classnames");
|
|
17
17
|
classnames = require_runtime.__toESM(classnames);
|
|
18
18
|
let react = require("react");
|
|
@@ -9,8 +9,8 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
|
9
9
|
const require_usePrefix = require('../../internal/usePrefix.js');
|
|
10
10
|
const require_useId = require('../../internal/useId.js');
|
|
11
11
|
const require_deprecate = require('../../prop-types/deprecate.js');
|
|
12
|
-
const require_index = require('../AILabel/index.js');
|
|
13
12
|
const require_utils = require('../../internal/utils.js');
|
|
13
|
+
const require_index = require('../AILabel/index.js');
|
|
14
14
|
const require_Checkbox = require('../Checkbox/Checkbox.js');
|
|
15
15
|
let classnames = require("classnames");
|
|
16
16
|
classnames = require_runtime.__toESM(classnames);
|
|
@@ -12,10 +12,10 @@ const require_keys = require('../../internal/keyboard/keys.js');
|
|
|
12
12
|
const require_match = require('../../internal/keyboard/match.js');
|
|
13
13
|
const require_useId = require('../../internal/useId.js');
|
|
14
14
|
const require_deprecate = require('../../prop-types/deprecate.js');
|
|
15
|
-
const require_index = require('../FeatureFlags/index.js');
|
|
16
|
-
const require_index$1 = require('../AILabel/index.js');
|
|
17
15
|
const require_defaultItemToString = require('../../internal/defaultItemToString.js');
|
|
18
16
|
const require_utils = require('../../internal/utils.js');
|
|
17
|
+
const require_index = require('../FeatureFlags/index.js');
|
|
18
|
+
const require_index$1 = require('../AILabel/index.js');
|
|
19
19
|
const require_ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
|
|
20
20
|
const require_FormContext = require('../FluidForm/FormContext.js');
|
|
21
21
|
const require_index$2 = require('../ListBox/index.js');
|
|
@@ -12,9 +12,9 @@ const require_match = require('../../internal/keyboard/match.js');
|
|
|
12
12
|
const require_useId = require('../../internal/useId.js');
|
|
13
13
|
const require_warning = require('../../internal/warning.js');
|
|
14
14
|
const require_deprecate = require('../../prop-types/deprecate.js');
|
|
15
|
+
const require_utils = require('../../internal/utils.js');
|
|
15
16
|
const require_index = require('../FeatureFlags/index.js');
|
|
16
17
|
const require_index$1 = require('../AILabel/index.js');
|
|
17
|
-
const require_utils = require('../../internal/utils.js');
|
|
18
18
|
const require_useResizeObserver = require('../../internal/useResizeObserver.js');
|
|
19
19
|
const require_events = require('../../tools/events.js');
|
|
20
20
|
const require_mergeRefs = require('../../tools/mergeRefs.js');
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
9
9
|
const require_usePrefix = require('../../internal/usePrefix.js');
|
|
10
|
-
const require_index = require('../AILabel/index.js');
|
|
11
10
|
const require_utils = require('../../internal/utils.js');
|
|
11
|
+
const require_index = require('../AILabel/index.js');
|
|
12
12
|
let classnames = require("classnames");
|
|
13
13
|
classnames = require_runtime.__toESM(classnames);
|
|
14
14
|
let react = require("react");
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
9
9
|
const require_usePrefix = require('../../internal/usePrefix.js');
|
|
10
|
-
const require_index = require('../AILabel/index.js');
|
|
11
10
|
const require_utils = require('../../internal/utils.js');
|
|
11
|
+
const require_index = require('../AILabel/index.js');
|
|
12
12
|
const require_TableCell = require('./TableCell.js');
|
|
13
13
|
const require_TableDecoratorRow = require('./TableDecoratorRow.js');
|
|
14
14
|
const require_TableSlugRow = require('./TableSlugRow.js');
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
9
9
|
const require_usePrefix = require('../../internal/usePrefix.js');
|
|
10
10
|
const require_useId = require('../../internal/useId.js');
|
|
11
|
-
const require_index = require('../AILabel/index.js');
|
|
12
11
|
const require_utils = require('../../internal/utils.js');
|
|
12
|
+
const require_index = require('../AILabel/index.js');
|
|
13
13
|
const require_sortStates = require('./state/sortStates.js');
|
|
14
14
|
let classnames = require("classnames");
|
|
15
15
|
classnames = require_runtime.__toESM(classnames);
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
9
9
|
const require_usePrefix = require('../../internal/usePrefix.js');
|
|
10
|
-
const require_index = require('../AILabel/index.js');
|
|
11
10
|
const require_utils = require('../../internal/utils.js');
|
|
11
|
+
const require_index = require('../AILabel/index.js');
|
|
12
12
|
const require_TableDecoratorRow = require('./TableDecoratorRow.js');
|
|
13
13
|
const require_TableSlugRow = require('./TableSlugRow.js');
|
|
14
14
|
let classnames = require("classnames");
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
const require_index = require('../../AILabel/index.js');
|
|
9
8
|
const require_utils = require('../../../internal/utils.js');
|
|
9
|
+
const require_index = require('../../AILabel/index.js');
|
|
10
10
|
const require_cells = require('./cells.js');
|
|
11
11
|
|
|
12
12
|
//#region src/components/DataTable/tools/normalize.js
|
|
@@ -61,10 +61,6 @@ export interface DatePickerProps {
|
|
|
61
61
|
* Specify whether or not the control is invalid (Fluid only)
|
|
62
62
|
*/
|
|
63
63
|
invalid?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Provide the text that is displayed when the control is in error state (Fluid Only)
|
|
66
|
-
*/
|
|
67
|
-
invalidText?: ReactNode;
|
|
68
64
|
/**
|
|
69
65
|
* `true` to use the light version.
|
|
70
66
|
*/
|
|
@@ -116,10 +112,6 @@ export interface DatePickerProps {
|
|
|
116
112
|
* Specify whether the control is currently in warning state (Fluid only)
|
|
117
113
|
*/
|
|
118
114
|
warn?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Provide the text that is displayed when the control is in warning state (Fluid only)
|
|
121
|
-
*/
|
|
122
|
-
warnText?: ReactNode;
|
|
123
115
|
/**
|
|
124
116
|
* Accessible aria-label for the "next month" arrow icon.
|
|
125
117
|
*/
|