@carbon/react 1.94.2 → 1.95.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 +894 -894
- package/es/components/ComboBox/ComboBox.js +1 -1
- package/es/components/DataTable/TableSlugRow.d.ts +1 -1
- package/es/components/DataTable/TableSlugRow.js +1 -1
- package/es/components/Menu/Menu.d.ts +8 -0
- package/es/components/Menu/Menu.js +13 -1
- package/es/components/MenuButton/index.d.ts +8 -0
- package/es/components/MenuButton/index.js +13 -2
- package/es/components/PaginationNav/PaginationNav.js +1 -3
- package/es/components/Slider/Slider.js +75 -59
- package/es/components/Text/Text.js +1 -1
- package/es/components/Tile/Tile.js +1 -1
- package/es/internal/useNormalizedInputProps.js +2 -2
- package/es/prop-types/deprecateComponent.d.ts +7 -1
- package/es/prop-types/deprecateComponent.js +3 -3
- package/lib/components/ComboBox/ComboBox.js +1 -1
- package/lib/components/DataTable/TableSlugRow.d.ts +1 -1
- package/lib/components/DataTable/TableSlugRow.js +1 -1
- package/lib/components/Menu/Menu.d.ts +8 -0
- package/lib/components/Menu/Menu.js +13 -1
- package/lib/components/MenuButton/index.d.ts +8 -0
- package/lib/components/MenuButton/index.js +13 -2
- package/lib/components/PaginationNav/PaginationNav.js +1 -3
- package/lib/components/Slider/Slider.js +75 -59
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/Tile/Tile.js +1 -1
- package/lib/internal/useNormalizedInputProps.js +2 -2
- package/lib/prop-types/deprecateComponent.d.ts +7 -1
- package/lib/prop-types/deprecateComponent.js +3 -5
- package/package.json +4 -4
- package/telemetry.yml +10 -4
|
@@ -22,6 +22,7 @@ require('../Tooltip/DefinitionTooltip.js');
|
|
|
22
22
|
var Tooltip = require('../Tooltip/Tooltip.js');
|
|
23
23
|
var SliderHandles = require('./SliderHandles.js');
|
|
24
24
|
var clamp = require('../../internal/clamp.js');
|
|
25
|
+
var useNormalizedInputProps = require('../../internal/useNormalizedInputProps.js');
|
|
25
26
|
var throttle = require('../../node_modules/es-toolkit/dist/compat/function/throttle.js');
|
|
26
27
|
|
|
27
28
|
const ThumbWrapper = ({
|
|
@@ -75,6 +76,7 @@ var HandlePosition = /*#__PURE__*/function (HandlePosition) {
|
|
|
75
76
|
return HandlePosition;
|
|
76
77
|
}(HandlePosition || {}); // TODO: Delete this type and directory type the properties in the function.
|
|
77
78
|
const Slider = props => {
|
|
79
|
+
var _Fragment, _Fragment2, _Fragment3, _Fragment4;
|
|
78
80
|
// TODO: Move destructured `props` from the IIFE to here.
|
|
79
81
|
|
|
80
82
|
const initialState = {
|
|
@@ -928,63 +930,77 @@ const Slider = props => {
|
|
|
928
930
|
setState(derivedState);
|
|
929
931
|
}
|
|
930
932
|
}, [props.invalid]);
|
|
933
|
+
const {
|
|
934
|
+
ariaLabelInput,
|
|
935
|
+
unstable_ariaLabelInputUpper: ariaLabelInputUpper,
|
|
936
|
+
className,
|
|
937
|
+
hideTextInput = false,
|
|
938
|
+
id = inputIdRef.current = inputIdRef.current ||
|
|
939
|
+
// TODO:
|
|
940
|
+
// 1. Why isn't `inputId` just set to this value instead of an empty
|
|
941
|
+
// string?
|
|
942
|
+
// 2. Why this value instead of something else, like
|
|
943
|
+
// `crypto.randomUUID()` or `useId()`?
|
|
944
|
+
`__carbon-slider_${Math.random().toString(36).substr(2)}`,
|
|
945
|
+
min,
|
|
946
|
+
minLabel,
|
|
947
|
+
max,
|
|
948
|
+
maxLabel,
|
|
949
|
+
formatLabel = defaultFormatLabel,
|
|
950
|
+
labelText,
|
|
951
|
+
hideLabel,
|
|
952
|
+
step = 1,
|
|
953
|
+
// TODO: Other properties are deleted below. Why isn't this one?
|
|
954
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
955
|
+
stepMultiplier: _stepMultiplier,
|
|
956
|
+
inputType = 'number',
|
|
957
|
+
invalidText,
|
|
958
|
+
required,
|
|
959
|
+
disabled = false,
|
|
960
|
+
name,
|
|
961
|
+
unstable_nameUpper: nameUpper,
|
|
962
|
+
light,
|
|
963
|
+
readOnly = false,
|
|
964
|
+
warn = false,
|
|
965
|
+
warnText,
|
|
966
|
+
translateWithId: t = defaultTranslateWithId,
|
|
967
|
+
...other
|
|
968
|
+
} = props;
|
|
969
|
+
const {
|
|
970
|
+
value,
|
|
971
|
+
valueUpper,
|
|
972
|
+
isValid,
|
|
973
|
+
isValidUpper,
|
|
974
|
+
correctedValue,
|
|
975
|
+
correctedPosition,
|
|
976
|
+
isRtl
|
|
977
|
+
} = state;
|
|
978
|
+
const normalizedProps = useNormalizedInputProps.useNormalizedInputProps({
|
|
979
|
+
id,
|
|
980
|
+
disabled,
|
|
981
|
+
readOnly,
|
|
982
|
+
invalid: !isValid,
|
|
983
|
+
warn
|
|
984
|
+
});
|
|
985
|
+
const normalizedUpperProps = useNormalizedInputProps.useNormalizedInputProps({
|
|
986
|
+
id,
|
|
987
|
+
disabled,
|
|
988
|
+
readOnly,
|
|
989
|
+
invalid: !isValidUpper,
|
|
990
|
+
warn
|
|
991
|
+
});
|
|
931
992
|
|
|
932
993
|
// TODO: Delete this IIFE. It was added to maintain whitespace and to make it clear
|
|
933
994
|
// what exactly has changed.
|
|
934
|
-
return ((
|
|
935
|
-
const {
|
|
936
|
-
ariaLabelInput,
|
|
937
|
-
unstable_ariaLabelInputUpper: ariaLabelInputUpper,
|
|
938
|
-
className,
|
|
939
|
-
hideTextInput = false,
|
|
940
|
-
id = inputIdRef.current = inputIdRef.current ||
|
|
941
|
-
// TODO:
|
|
942
|
-
// 1. Why isn't `inputId` just set to this value instead of an empty
|
|
943
|
-
// string?
|
|
944
|
-
// 2. Why this value instead of something else, like
|
|
945
|
-
// `crypto.randomUUID()` or `useId()`?
|
|
946
|
-
`__carbon-slider_${Math.random().toString(36).substr(2)}`,
|
|
947
|
-
min,
|
|
948
|
-
minLabel,
|
|
949
|
-
max,
|
|
950
|
-
maxLabel,
|
|
951
|
-
formatLabel = defaultFormatLabel,
|
|
952
|
-
labelText,
|
|
953
|
-
hideLabel,
|
|
954
|
-
step = 1,
|
|
955
|
-
// TODO: Other properties are deleted below. Why isn't this one?
|
|
956
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
957
|
-
stepMultiplier: _stepMultiplier,
|
|
958
|
-
inputType = 'number',
|
|
959
|
-
invalidText,
|
|
960
|
-
required,
|
|
961
|
-
disabled = false,
|
|
962
|
-
name,
|
|
963
|
-
unstable_nameUpper: nameUpper,
|
|
964
|
-
light,
|
|
965
|
-
readOnly = false,
|
|
966
|
-
warn,
|
|
967
|
-
warnText,
|
|
968
|
-
translateWithId: t = defaultTranslateWithId,
|
|
969
|
-
...other
|
|
970
|
-
} = props;
|
|
995
|
+
return (() => {
|
|
971
996
|
delete other.onRelease;
|
|
972
997
|
delete other.invalid;
|
|
973
998
|
delete other.unstable_valueUpper;
|
|
974
|
-
const
|
|
975
|
-
value,
|
|
976
|
-
valueUpper,
|
|
977
|
-
isValid,
|
|
978
|
-
isValidUpper,
|
|
979
|
-
correctedValue,
|
|
980
|
-
correctedPosition,
|
|
981
|
-
isRtl
|
|
982
|
-
} = state;
|
|
983
|
-
const showWarning = !readOnly && warn ||
|
|
999
|
+
const showWarning = normalizedProps.warn ||
|
|
984
1000
|
// TODO: https://github.com/carbon-design-system/carbon/issues/18991#issuecomment-2795709637
|
|
985
1001
|
// eslint-disable-next-line valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
986
1002
|
typeof correctedValue !== null && correctedPosition === HandlePosition.LOWER && isValid;
|
|
987
|
-
const showWarningUpper =
|
|
1003
|
+
const showWarningUpper = normalizedUpperProps.warn ||
|
|
988
1004
|
// TODO: https://github.com/carbon-design-system/carbon/issues/18991#issuecomment-2795709637
|
|
989
1005
|
// eslint-disable-next-line valid-typeof, no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
990
1006
|
typeof correctedValue !== null && correctedPosition === (twoHandles ? HandlePosition.UPPER : HandlePosition.LOWER) && (twoHandles ? isValidUpper : isValid);
|
|
@@ -1009,11 +1025,11 @@ const Slider = props => {
|
|
|
1009
1025
|
[`${prefix}--text-input--light`]: light
|
|
1010
1026
|
};
|
|
1011
1027
|
const lowerInputClasses = cx([...fixedInputClasses, `${prefix}--slider-text-input--lower`, conditionalInputClasses, {
|
|
1012
|
-
[`${prefix}--text-input--invalid`]:
|
|
1028
|
+
[`${prefix}--text-input--invalid`]: normalizedProps.invalid,
|
|
1013
1029
|
[`${prefix}--slider-text-input--warn`]: showWarning
|
|
1014
1030
|
}]);
|
|
1015
1031
|
const upperInputClasses = cx([...fixedInputClasses, `${prefix}--slider-text-input--upper`, conditionalInputClasses, {
|
|
1016
|
-
[`${prefix}--text-input--invalid`]:
|
|
1032
|
+
[`${prefix}--text-input--invalid`]: twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid,
|
|
1017
1033
|
[`${prefix}--slider-text-input--warn`]: showWarningUpper
|
|
1018
1034
|
}]);
|
|
1019
1035
|
const lowerInputWrapperClasses = cx([`${prefix}--text-input-wrapper`, `${prefix}--slider-text-input-wrapper`, `${prefix}--slider-text-input-wrapper--lower`, {
|
|
@@ -1073,11 +1089,11 @@ const Slider = props => {
|
|
|
1073
1089
|
onBlur: onBlurInput,
|
|
1074
1090
|
onKeyUp: props.onInputKeyUp,
|
|
1075
1091
|
onKeyDown: onInputKeyDown,
|
|
1076
|
-
"data-invalid":
|
|
1092
|
+
"data-invalid": normalizedProps.invalid ? true : null,
|
|
1077
1093
|
"data-handle-position": HandlePosition.LOWER,
|
|
1078
|
-
"aria-invalid":
|
|
1094
|
+
"aria-invalid": normalizedProps.invalid ? true : undefined,
|
|
1079
1095
|
readOnly: readOnly
|
|
1080
|
-
}),
|
|
1096
|
+
}), normalizedProps.invalid && /*#__PURE__*/React.createElement(iconsReact.WarningFilled, {
|
|
1081
1097
|
className: `${prefix}--slider__invalid-icon`
|
|
1082
1098
|
}), showWarning && /*#__PURE__*/React.createElement(iconsReact.WarningAltFilled, {
|
|
1083
1099
|
className: `${prefix}--slider__invalid-icon ${prefix}--slider__invalid-icon--warning`
|
|
@@ -1093,7 +1109,7 @@ const Slider = props => {
|
|
|
1093
1109
|
onKeyDown: onKeyDown,
|
|
1094
1110
|
role: "presentation",
|
|
1095
1111
|
tabIndex: -1,
|
|
1096
|
-
"data-invalid": (twoHandles ?
|
|
1112
|
+
"data-invalid": (twoHandles ? normalizedProps.invalid || normalizedUpperProps.invalid : normalizedProps.invalid) ? true : null
|
|
1097
1113
|
}, other), /*#__PURE__*/React.createElement(ThumbWrapper, _rollupPluginBabelHelpers.extends({
|
|
1098
1114
|
hasTooltip: hideTextInput,
|
|
1099
1115
|
className: lowerThumbWrapperClasses,
|
|
@@ -1176,18 +1192,18 @@ const Slider = props => {
|
|
|
1176
1192
|
onBlur: onBlurInput,
|
|
1177
1193
|
onKeyDown: onInputKeyDown,
|
|
1178
1194
|
onKeyUp: props.onInputKeyUp,
|
|
1179
|
-
"data-invalid": (twoHandles ?
|
|
1195
|
+
"data-invalid": (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) ? true : null,
|
|
1180
1196
|
"data-handle-position": twoHandles ? HandlePosition.UPPER : null,
|
|
1181
|
-
"aria-invalid": (twoHandles ?
|
|
1197
|
+
"aria-invalid": (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) ? true : undefined,
|
|
1182
1198
|
readOnly: readOnly
|
|
1183
|
-
}),
|
|
1199
|
+
}), (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) && /*#__PURE__*/React.createElement(iconsReact.WarningFilled, {
|
|
1184
1200
|
className: `${prefix}--slider__invalid-icon`
|
|
1185
1201
|
}), showWarningUpper && /*#__PURE__*/React.createElement(iconsReact.WarningAltFilled, {
|
|
1186
1202
|
className: `${prefix}--slider__invalid-icon ${prefix}--slider__invalid-icon--warning`
|
|
1187
|
-
}))),
|
|
1203
|
+
}))), (normalizedProps.invalid || normalizedUpperProps.invalid) && /*#__PURE__*/React.createElement(Text.Text, {
|
|
1188
1204
|
as: "div",
|
|
1189
1205
|
className: cx(`${prefix}--slider__validation-msg`, `${prefix}--slider__validation-msg--invalid`, `${prefix}--form-requirement`)
|
|
1190
|
-
}, invalidText),
|
|
1206
|
+
}, invalidText), (normalizedProps.warn || normalizedUpperProps.warn) && /*#__PURE__*/React.createElement(Text.Text, {
|
|
1191
1207
|
as: "div",
|
|
1192
1208
|
className: cx(`${prefix}--slider__validation-msg`, `${prefix}--form-requirement`)
|
|
1193
1209
|
}, warnText), correctedValue && /*#__PURE__*/React.createElement(Text.Text, {
|
|
@@ -64,7 +64,7 @@ Text.propTypes = {
|
|
|
64
64
|
/**
|
|
65
65
|
* Provide child elements or text to be rendered inside of this component
|
|
66
66
|
*/
|
|
67
|
-
children: PropTypes.node
|
|
67
|
+
children: PropTypes.node,
|
|
68
68
|
/**
|
|
69
69
|
* Specify the text direction to be used for this component and any of its
|
|
70
70
|
* children
|
|
@@ -495,7 +495,7 @@ const ExpandableTile = /*#__PURE__*/React.forwardRef(({
|
|
|
495
495
|
});
|
|
496
496
|
resizeObserver.observe(aboveTheFold.current);
|
|
497
497
|
return () => resizeObserver.disconnect();
|
|
498
|
-
}, []);
|
|
498
|
+
}, [isTileMaxHeight, isTilePadding]);
|
|
499
499
|
const belowTheFoldId = useId.useId('expandable-tile-interactive');
|
|
500
500
|
|
|
501
501
|
// AILabel is always size `xs`
|
|
@@ -34,9 +34,9 @@ const useNormalizedInputProps = ({
|
|
|
34
34
|
const prefix = usePrefix.usePrefix();
|
|
35
35
|
const normalizedProps = {
|
|
36
36
|
disabled: !readOnly && disabled,
|
|
37
|
-
invalid: !readOnly && invalid,
|
|
37
|
+
invalid: !readOnly && !disabled && invalid,
|
|
38
38
|
invalidId: `${id}-error-msg`,
|
|
39
|
-
warn: !readOnly && !invalid && warn,
|
|
39
|
+
warn: !readOnly && !invalid && !disabled && warn,
|
|
40
40
|
warnId: `${id}-warn-msg`,
|
|
41
41
|
validation: null,
|
|
42
42
|
icon: null,
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare const deprecateComponent: (componentName: string, message?: string) => string | undefined;
|
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var warning = require('../internal/warning.js');
|
|
13
11
|
|
|
14
12
|
const didWarnAboutDeprecation = {};
|
|
15
|
-
|
|
13
|
+
const deprecateComponent = (componentName, message) => {
|
|
16
14
|
if (!didWarnAboutDeprecation[componentName]) {
|
|
17
15
|
didWarnAboutDeprecation[componentName] = true;
|
|
18
16
|
process.env.NODE_ENV !== "production" ? warning.warning(false, message) : void 0;
|
|
19
17
|
}
|
|
20
18
|
return componentName;
|
|
21
|
-
}
|
|
19
|
+
};
|
|
22
20
|
|
|
23
|
-
exports.
|
|
21
|
+
exports.deprecateComponent = deprecateComponent;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.95.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@carbon/feature-flags": "0.32.0",
|
|
56
56
|
"@carbon/icons-react": "^11.70.0",
|
|
57
57
|
"@carbon/layout": "^11.43.0",
|
|
58
|
-
"@carbon/styles": "^1.
|
|
58
|
+
"@carbon/styles": "^1.94.0-rc.0",
|
|
59
59
|
"@carbon/utilities": "^0.12.0",
|
|
60
60
|
"@floating-ui/react": "^0.27.4",
|
|
61
61
|
"@ibm/telemetry-js": "^1.5.0",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"rollup": "^4.41.1",
|
|
119
119
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
120
120
|
"rollup-plugin-strip-banner": "^3.0.0",
|
|
121
|
-
"sass": "^1.
|
|
121
|
+
"sass": "^1.93.2",
|
|
122
122
|
"sass-loader": "^16.0.0",
|
|
123
123
|
"storybook": "^9.0.5",
|
|
124
124
|
"stream-browserify": "^3.0.0",
|
|
@@ -139,5 +139,5 @@
|
|
|
139
139
|
"**/*.scss",
|
|
140
140
|
"**/*.css"
|
|
141
141
|
],
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "ba9072cd72b1d664f26a3c984e2f7d694280175b"
|
|
143
143
|
}
|
package/telemetry.yml
CHANGED
|
@@ -27,6 +27,7 @@ collect:
|
|
|
27
27
|
- as
|
|
28
28
|
- autoAlign
|
|
29
29
|
- autoComplete
|
|
30
|
+
- backgroundToken
|
|
30
31
|
- border
|
|
31
32
|
- buttonKind
|
|
32
33
|
- caption
|
|
@@ -422,6 +423,9 @@ collect:
|
|
|
422
423
|
- legacyAutoalign
|
|
423
424
|
- x
|
|
424
425
|
- y
|
|
426
|
+
# MenuButton
|
|
427
|
+
- menuBackgroundToken
|
|
428
|
+
- menuBorder
|
|
425
429
|
# MenuItem
|
|
426
430
|
- shortcut
|
|
427
431
|
# MenuItemRadioGroup
|
|
@@ -506,7 +510,6 @@ collect:
|
|
|
506
510
|
# Popover
|
|
507
511
|
- alignmentAxisOffset
|
|
508
512
|
- autoAlignBoundary
|
|
509
|
-
- backgroundToken
|
|
510
513
|
- caret
|
|
511
514
|
- isTabTip
|
|
512
515
|
# ProgressIndicator
|
|
@@ -668,6 +671,9 @@ collect:
|
|
|
668
671
|
- step
|
|
669
672
|
- time
|
|
670
673
|
- "true"
|
|
674
|
+
# General - backgroundToken
|
|
675
|
+
- background
|
|
676
|
+
- layer
|
|
671
677
|
# General - buttonKind
|
|
672
678
|
- danger
|
|
673
679
|
- danger--ghost
|
|
@@ -924,6 +930,9 @@ collect:
|
|
|
924
930
|
- complete
|
|
925
931
|
- edit
|
|
926
932
|
- uploading
|
|
933
|
+
# MenuButton - menuBackgroundToken
|
|
934
|
+
- background
|
|
935
|
+
- layer
|
|
927
936
|
# ModalWrapper - triggerButtonKind
|
|
928
937
|
- danger
|
|
929
938
|
- danger--ghost
|
|
@@ -939,9 +948,6 @@ collect:
|
|
|
939
948
|
- toast
|
|
940
949
|
# Popover - autoAlignBoundary
|
|
941
950
|
- clippingAncestors
|
|
942
|
-
# Popover - backgroundToken
|
|
943
|
-
- background
|
|
944
|
-
- layer
|
|
945
951
|
# ShapeIndicator - textSize
|
|
946
952
|
- "12"
|
|
947
953
|
- "14"
|