@carbon/react 1.62.1 → 1.63.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 +836 -836
- package/es/components/Checkbox/Checkbox.js +2 -3
- package/es/components/CheckboxGroup/CheckboxGroup.js +2 -3
- package/es/components/ComboBox/ComboBox.d.ts +10 -6
- package/es/components/ComboBox/ComboBox.js +14 -4
- package/es/components/ComboButton/index.d.ts +9 -6
- package/es/components/ComboButton/index.js +5 -0
- package/es/components/DataTable/DataTable.d.ts +25 -11
- package/es/components/DataTable/DataTable.js +6 -1
- package/es/components/DataTable/TableBatchActions.d.ts +2 -2
- package/es/components/DataTable/TableHeader.d.ts +7 -13
- package/es/components/DataTable/TableSelectRow.js +3 -2
- package/es/components/DataTable/TableToolbarSearch.d.ts +5 -2
- package/es/components/DataTable/TableToolbarSearch.js +7 -4
- package/es/components/DatePickerInput/DatePickerInput.js +2 -3
- package/es/components/Dropdown/Dropdown.d.ts +2 -6
- package/es/components/Dropdown/Dropdown.js +3 -6
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +40 -0
- package/es/components/FluidSearch/FluidSearch.js +96 -0
- package/es/components/FormGroup/FormGroup.d.ts +9 -1
- package/es/components/FormGroup/FormGroup.js +8 -1
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +2 -7
- package/es/components/ListBox/ListBoxSelection.d.ts +8 -9
- package/es/components/ListBox/ListBoxSelection.js +5 -0
- package/es/components/Modal/Modal.js +2 -3
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +10 -5
- package/es/components/MultiSelect/FilterableMultiSelect.js +20 -8
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/MultiSelect.js +11 -11
- package/es/components/NumberInput/NumberInput.d.ts +8 -7
- package/es/components/NumberInput/NumberInput.js +5 -0
- package/es/components/Pagination/experimental/PageSelector.js +2 -3
- package/es/components/PaginationNav/PaginationNav.d.ts +13 -6
- package/es/components/PaginationNav/PaginationNav.js +5 -0
- package/es/components/ProgressIndicator/ProgressIndicator.d.ts +12 -6
- package/es/components/ProgressIndicator/ProgressIndicator.js +5 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +2 -5
- package/es/components/Select/Select.js +3 -6
- package/es/components/Slider/Slider.d.ts +11 -9
- package/es/components/Slider/Slider.js +6 -1
- package/es/components/Tag/DismissibleTag.js +2 -3
- package/es/components/Tag/OperationalTag.js +2 -3
- package/es/components/Tag/SelectableTag.js +2 -3
- package/es/components/Tag/Tag.js +3 -5
- package/es/components/TextArea/TextArea.js +32 -6
- package/es/components/TextInput/ControlledPasswordInput.js +3 -6
- package/es/components/TextInput/TextInput.js +29 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/internal/Selection.js +1 -1
- package/es/internal/useAnnouncer.js +8 -3
- package/es/types/common.d.ts +6 -1
- package/lib/components/Checkbox/Checkbox.js +2 -3
- package/lib/components/CheckboxGroup/CheckboxGroup.js +2 -3
- package/lib/components/ComboBox/ComboBox.d.ts +10 -6
- package/lib/components/ComboBox/ComboBox.js +14 -4
- package/lib/components/ComboButton/index.d.ts +9 -6
- package/lib/components/ComboButton/index.js +5 -0
- package/lib/components/DataTable/DataTable.d.ts +25 -11
- package/lib/components/DataTable/DataTable.js +6 -1
- package/lib/components/DataTable/TableBatchActions.d.ts +2 -2
- package/lib/components/DataTable/TableHeader.d.ts +7 -13
- package/lib/components/DataTable/TableSelectRow.js +2 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +5 -2
- package/lib/components/DataTable/TableToolbarSearch.js +6 -3
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -3
- package/lib/components/Dropdown/Dropdown.d.ts +2 -6
- package/lib/components/Dropdown/Dropdown.js +2 -5
- package/lib/components/FluidSearch/FluidSearch.Skeleton.js +50 -0
- package/lib/components/FluidSearch/FluidSearch.js +106 -0
- package/lib/components/FormGroup/FormGroup.d.ts +9 -1
- package/lib/components/FormGroup/FormGroup.js +8 -1
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +2 -7
- package/lib/components/ListBox/ListBoxSelection.d.ts +8 -9
- package/lib/components/ListBox/ListBoxSelection.js +5 -0
- package/lib/components/Modal/Modal.js +2 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +10 -5
- package/lib/components/MultiSelect/FilterableMultiSelect.js +19 -7
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +10 -10
- package/lib/components/NumberInput/NumberInput.d.ts +8 -7
- package/lib/components/NumberInput/NumberInput.js +5 -0
- package/lib/components/Pagination/experimental/PageSelector.js +2 -3
- package/lib/components/PaginationNav/PaginationNav.d.ts +13 -6
- package/lib/components/PaginationNav/PaginationNav.js +5 -0
- package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +12 -6
- package/lib/components/ProgressIndicator/ProgressIndicator.js +5 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +2 -5
- package/lib/components/Select/Select.js +2 -5
- package/lib/components/Slider/Slider.d.ts +11 -9
- package/lib/components/Slider/Slider.js +6 -1
- package/lib/components/Tag/DismissibleTag.js +2 -3
- package/lib/components/Tag/OperationalTag.js +2 -3
- package/lib/components/Tag/SelectableTag.js +2 -3
- package/lib/components/Tag/Tag.js +3 -5
- package/lib/components/TextArea/TextArea.js +32 -6
- package/lib/components/TextInput/ControlledPasswordInput.js +2 -5
- package/lib/components/TextInput/TextInput.js +28 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/internal/Selection.js +1 -1
- package/lib/internal/useAnnouncer.js +8 -3
- package/lib/types/common.d.ts +6 -1
- package/package.json +18 -18
|
@@ -5,12 +5,17 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ReactNode } from 'react';
|
|
8
|
+
import { TranslateWithId } from '../../types/common';
|
|
8
9
|
export declare const translationIds: {
|
|
9
|
-
'increment.number':
|
|
10
|
-
'decrement.number':
|
|
10
|
+
readonly 'increment.number': "increment.number";
|
|
11
|
+
readonly 'decrement.number': "decrement.number";
|
|
11
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Message ids that will be passed to translateWithId().
|
|
15
|
+
*/
|
|
16
|
+
type TranslationKey = keyof typeof translationIds;
|
|
12
17
|
type ExcludedAttributes = 'defaultValue' | 'id' | 'min' | 'max' | 'onChange' | 'onClick' | 'size' | 'step' | 'value';
|
|
13
|
-
export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
18
|
+
export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<TranslationKey> {
|
|
14
19
|
/**
|
|
15
20
|
* `true` to allow empty string.
|
|
16
21
|
*/
|
|
@@ -115,10 +120,6 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
115
120
|
* Specify how much the values should increase/decrease upon clicking on up/down button
|
|
116
121
|
*/
|
|
117
122
|
step?: number;
|
|
118
|
-
/**
|
|
119
|
-
* Provide custom text for the component for each translation id
|
|
120
|
-
*/
|
|
121
|
-
translateWithId?: (id: string) => string;
|
|
122
123
|
/**
|
|
123
124
|
* Specify the value of the input
|
|
124
125
|
*/
|
|
@@ -34,6 +34,11 @@ const translationIds = {
|
|
|
34
34
|
'increment.number': 'increment.number',
|
|
35
35
|
'decrement.number': 'decrement.number'
|
|
36
36
|
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Message ids that will be passed to translateWithId().
|
|
40
|
+
*/
|
|
41
|
+
|
|
37
42
|
const defaultTranslations = {
|
|
38
43
|
[translationIds['increment.number']]: 'Increment number',
|
|
39
44
|
[translationIds['decrement.number']]: 'Decrement number'
|
|
@@ -13,7 +13,7 @@ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHel
|
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var cx = require('classnames');
|
|
16
|
-
var
|
|
16
|
+
var useId = require('../../../internal/useId.js');
|
|
17
17
|
var Select = require('../../Select/Select.js');
|
|
18
18
|
require('../../Select/Select.Skeleton.js');
|
|
19
19
|
var SelectItem = require('../../SelectItem/SelectItem.js');
|
|
@@ -25,7 +25,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
25
25
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
26
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
27
27
|
|
|
28
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
29
28
|
function PageSelector(_ref) {
|
|
30
29
|
let {
|
|
31
30
|
className = null,
|
|
@@ -37,7 +36,7 @@ function PageSelector(_ref) {
|
|
|
37
36
|
} = _ref;
|
|
38
37
|
const prefix = usePrefix.usePrefix();
|
|
39
38
|
const namespace = `${prefix}--unstable-pagination__page-selector`;
|
|
40
|
-
const instanceId = `${namespace}__select-${
|
|
39
|
+
const instanceId = `${namespace}__select-${useId.useId()}`;
|
|
41
40
|
const renderPages = total => {
|
|
42
41
|
const pages = [];
|
|
43
42
|
for (let counter = 1; counter <= total; counter += 1) {
|
|
@@ -5,7 +5,19 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
|
|
8
|
+
import { TranslateWithId } from '../../types/common';
|
|
9
|
+
declare const translationIds: {
|
|
10
|
+
readonly 'carbon.pagination-nav.next': "Next";
|
|
11
|
+
readonly 'carbon.pagination-nav.previous': "Previous";
|
|
12
|
+
readonly 'carbon.pagination-nav.item': "Page";
|
|
13
|
+
readonly 'carbon.pagination-nav.active': "Active";
|
|
14
|
+
readonly 'carbon.pagination-nav.of': "of";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Message ids that will be passed to translateWithId().
|
|
18
|
+
*/
|
|
19
|
+
type TranslationKey = keyof typeof translationIds;
|
|
20
|
+
interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'>, TranslateWithId<TranslationKey> {
|
|
9
21
|
/**
|
|
10
22
|
* Additional CSS class names.
|
|
11
23
|
*/
|
|
@@ -35,11 +47,6 @@ interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'on
|
|
|
35
47
|
* The total number of items.
|
|
36
48
|
*/
|
|
37
49
|
totalItems?: number;
|
|
38
|
-
/**
|
|
39
|
-
* Specify a custom translation function that takes in a message identifier
|
|
40
|
-
* and returns the localized string for the message
|
|
41
|
-
*/
|
|
42
|
-
translateWithId?: (id: string) => string;
|
|
43
50
|
}
|
|
44
51
|
declare const PaginationNav: React.ForwardRefExoticComponent<PaginationNavProps & React.RefAttributes<HTMLElement>>;
|
|
45
52
|
export default PaginationNav;
|
|
@@ -31,6 +31,11 @@ const translationIds = {
|
|
|
31
31
|
'carbon.pagination-nav.active': 'Active',
|
|
32
32
|
'carbon.pagination-nav.of': 'of'
|
|
33
33
|
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Message ids that will be passed to translateWithId().
|
|
37
|
+
*/
|
|
38
|
+
|
|
34
39
|
function translateWithId(messageId) {
|
|
35
40
|
return translationIds[messageId];
|
|
36
41
|
}
|
|
@@ -6,6 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import { TranslateWithId } from '../../types/common';
|
|
10
|
+
declare const defaultTranslations: {
|
|
11
|
+
readonly 'carbon.progress-step.complete': "Complete";
|
|
12
|
+
readonly 'carbon.progress-step.incomplete': "Incomplete";
|
|
13
|
+
readonly 'carbon.progress-step.current': "Current";
|
|
14
|
+
readonly 'carbon.progress-step.invalid': "Invalid";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Message ids that will be passed to translateWithId().
|
|
18
|
+
*/
|
|
19
|
+
type TranslationKey = keyof typeof defaultTranslations;
|
|
9
20
|
export interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onChange'> {
|
|
10
21
|
/**
|
|
11
22
|
* Provide `<ProgressStep>` components to be rendered in the
|
|
@@ -63,7 +74,7 @@ declare namespace ProgressIndicator {
|
|
|
63
74
|
vertical: PropTypes.Requireable<boolean>;
|
|
64
75
|
};
|
|
65
76
|
}
|
|
66
|
-
export interface ProgressStepProps {
|
|
77
|
+
export interface ProgressStepProps extends TranslateWithId<TranslationKey> {
|
|
67
78
|
/**
|
|
68
79
|
* Provide an optional className to be applied to the containing `<li>` node
|
|
69
80
|
*/
|
|
@@ -112,11 +123,6 @@ export interface ProgressStepProps {
|
|
|
112
123
|
* The ID of the tooltip content.
|
|
113
124
|
*/
|
|
114
125
|
tooltipId?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Optional method that takes in a message id and returns an
|
|
117
|
-
* internationalized string.
|
|
118
|
-
*/
|
|
119
|
-
translateWithId?: (id: string) => string;
|
|
120
126
|
}
|
|
121
127
|
declare function ProgressStep({ label, description, className, current, complete, invalid, secondaryLabel, disabled, onClick, translateWithId: t, ...rest }: ProgressStepProps): import("react/jsx-runtime").JSX.Element;
|
|
122
128
|
declare namespace ProgressStep {
|
|
@@ -32,6 +32,11 @@ const defaultTranslations = {
|
|
|
32
32
|
'carbon.progress-step.current': 'Current',
|
|
33
33
|
'carbon.progress-step.invalid': 'Invalid'
|
|
34
34
|
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Message ids that will be passed to translateWithId().
|
|
38
|
+
*/
|
|
39
|
+
|
|
35
40
|
function translateWithId(messageId) {
|
|
36
41
|
return defaultTranslations[messageId];
|
|
37
42
|
}
|
|
@@ -17,7 +17,7 @@ var index = require('../Text/index.js');
|
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var iconsReact = require('@carbon/icons-react');
|
|
19
19
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
20
|
-
var
|
|
20
|
+
var useId = require('../../internal/useId.js');
|
|
21
21
|
|
|
22
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
23
|
|
|
@@ -25,7 +25,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
25
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
27
27
|
|
|
28
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
29
28
|
const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((props, ref) => {
|
|
30
29
|
const {
|
|
31
30
|
children,
|
|
@@ -51,9 +50,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
51
50
|
const prefix = usePrefix.usePrefix();
|
|
52
51
|
const [selected, setSelected] = React.useState(valueSelected ?? defaultSelected);
|
|
53
52
|
const [prevValueSelected, setPrevValueSelected] = React.useState(valueSelected);
|
|
54
|
-
const
|
|
55
|
-
current: radioButtonGroupInstanceId
|
|
56
|
-
} = React.useRef(getInstanceId());
|
|
53
|
+
const radioButtonGroupInstanceId = useId.useId();
|
|
57
54
|
|
|
58
55
|
/**
|
|
59
56
|
* prop + state alignment - getDerivedStateFromProps
|
|
@@ -18,7 +18,7 @@ var deprecate = require('../../prop-types/deprecate.js');
|
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
19
|
require('../FluidForm/FluidForm.js');
|
|
20
20
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
21
|
-
var
|
|
21
|
+
var useId = require('../../internal/useId.js');
|
|
22
22
|
var events = require('../../tools/events.js');
|
|
23
23
|
require('../Text/index.js');
|
|
24
24
|
var Text = require('../Text/Text.js');
|
|
@@ -29,7 +29,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
29
29
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
30
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
31
31
|
|
|
32
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
33
32
|
const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select(_ref, ref) {
|
|
34
33
|
let {
|
|
35
34
|
className,
|
|
@@ -60,9 +59,7 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
60
59
|
} = React.useContext(FormContext.FormContext);
|
|
61
60
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
62
61
|
const [title, setTitle] = React.useState('');
|
|
63
|
-
const
|
|
64
|
-
current: selectInstanceId
|
|
65
|
-
} = React.useRef(getInstanceId());
|
|
62
|
+
const selectInstanceId = useId.useId();
|
|
66
63
|
const selectClasses = cx__default["default"]({
|
|
67
64
|
[`${prefix}--select`]: true,
|
|
68
65
|
[`${prefix}--select--inline`]: inline,
|
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { type KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import { TranslateWithId } from '../../types/common';
|
|
10
|
+
declare const translationIds: {
|
|
11
|
+
readonly autoCorrectAnnouncement: "carbon.slider.auto-correct-announcement";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Message ids that will be passed to translateWithId().
|
|
15
|
+
*/
|
|
16
|
+
type TranslationKey = (typeof translationIds)[keyof typeof translationIds];
|
|
9
17
|
/**
|
|
10
18
|
* Distinguish two handles by lower and upper positions.
|
|
11
19
|
*/
|
|
@@ -14,7 +22,9 @@ declare enum HandlePosition {
|
|
|
14
22
|
UPPER = "upper"
|
|
15
23
|
}
|
|
16
24
|
type ExcludedAttributes = 'onChange' | 'onBlur';
|
|
17
|
-
export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes
|
|
25
|
+
export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<TranslationKey, {
|
|
26
|
+
correctedValue?: string;
|
|
27
|
+
}> {
|
|
18
28
|
/**
|
|
19
29
|
* The `ariaLabel` for the `<input>`.
|
|
20
30
|
*/
|
|
@@ -136,14 +146,6 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
136
146
|
* which will be `(max - min) / stepMultiplier`.
|
|
137
147
|
*/
|
|
138
148
|
stepMultiplier?: number;
|
|
139
|
-
/**
|
|
140
|
-
* Supply a method to translate internal strings with your i18n tool of
|
|
141
|
-
* choice. Translation keys are available on the `translationIds` field for
|
|
142
|
-
* this component.
|
|
143
|
-
*/
|
|
144
|
-
translateWithId?: (translationId: string, translationState: {
|
|
145
|
-
correctedValue?: string;
|
|
146
|
-
}) => string;
|
|
147
149
|
/**
|
|
148
150
|
* The value of the slider. When there are two handles, value is the lower
|
|
149
151
|
* bound.
|
|
@@ -83,8 +83,13 @@ ThumbWrapper.propTypes = {
|
|
|
83
83
|
const translationIds = {
|
|
84
84
|
autoCorrectAnnouncement: 'carbon.slider.auto-correct-announcement'
|
|
85
85
|
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Message ids that will be passed to translateWithId().
|
|
89
|
+
*/
|
|
90
|
+
|
|
86
91
|
function translateWithId(translationId, translationState) {
|
|
87
|
-
if (
|
|
92
|
+
if (translationState?.correctedValue) {
|
|
88
93
|
const {
|
|
89
94
|
correctedValue
|
|
90
95
|
} = translationState;
|
|
@@ -13,7 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
|
-
var
|
|
16
|
+
var useId = require('../../internal/useId.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var Tag = require('./Tag.js');
|
|
19
19
|
var iconsReact = require('@carbon/icons-react');
|
|
@@ -30,7 +30,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
30
30
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
31
31
|
|
|
32
32
|
var _Close;
|
|
33
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
34
33
|
const DismissibleTag = _ref => {
|
|
35
34
|
let {
|
|
36
35
|
className,
|
|
@@ -47,7 +46,7 @@ const DismissibleTag = _ref => {
|
|
|
47
46
|
} = _ref;
|
|
48
47
|
const prefix = usePrefix.usePrefix();
|
|
49
48
|
const tagLabelRef = React.useRef();
|
|
50
|
-
const tagId = id || `tag-${
|
|
49
|
+
const tagId = id || `tag-${useId.useId()}`;
|
|
51
50
|
const tagClasses = cx__default["default"](`${prefix}--tag--filter`, className);
|
|
52
51
|
const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
|
|
53
52
|
React.useLayoutEffect(() => {
|
|
@@ -13,7 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
|
-
var
|
|
16
|
+
var useId = require('../../internal/useId.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var Tag = require('./Tag.js');
|
|
19
19
|
require('../Tooltip/DefinitionTooltip.js');
|
|
@@ -28,7 +28,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
28
28
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
29
29
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
30
30
|
|
|
31
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
32
31
|
const TYPES = {
|
|
33
32
|
red: 'Red',
|
|
34
33
|
magenta: 'Magenta',
|
|
@@ -55,7 +54,7 @@ const OperationalTag = _ref => {
|
|
|
55
54
|
} = _ref;
|
|
56
55
|
const prefix = usePrefix.usePrefix();
|
|
57
56
|
const tagRef = React.useRef();
|
|
58
|
-
const tagId = id || `tag-${
|
|
57
|
+
const tagId = id || `tag-${useId.useId()}`;
|
|
59
58
|
const tagClasses = cx__default["default"](`${prefix}--tag--operational`, className);
|
|
60
59
|
const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
|
|
61
60
|
React.useLayoutEffect(() => {
|
|
@@ -13,7 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
|
-
var
|
|
16
|
+
var useId = require('../../internal/useId.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var Tag = require('./Tag.js');
|
|
19
19
|
require('../Tooltip/DefinitionTooltip.js');
|
|
@@ -28,7 +28,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
28
28
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
29
29
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
30
30
|
|
|
31
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
32
31
|
const SelectableTag = _ref => {
|
|
33
32
|
let {
|
|
34
33
|
className,
|
|
@@ -43,7 +42,7 @@ const SelectableTag = _ref => {
|
|
|
43
42
|
} = _ref;
|
|
44
43
|
const prefix = usePrefix.usePrefix();
|
|
45
44
|
const tagRef = React.useRef();
|
|
46
|
-
const tagId = id || `tag-${
|
|
45
|
+
const tagId = id || `tag-${useId.useId()}`;
|
|
47
46
|
const [selectedTag, setSelectedTag] = React.useState(selected);
|
|
48
47
|
const tagClasses = cx__default["default"](`${prefix}--tag--selectable`, className, {
|
|
49
48
|
[`${prefix}--tag--selectable-selected`]: selectedTag
|
|
@@ -14,7 +14,7 @@ var PropTypes = require('prop-types');
|
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
|
-
var
|
|
17
|
+
var useId = require('../../internal/useId.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
19
|
require('../Text/index.js');
|
|
20
20
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
@@ -31,7 +31,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
31
31
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
32
32
|
|
|
33
33
|
var _Close;
|
|
34
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
35
34
|
const TYPES = {
|
|
36
35
|
red: 'Red',
|
|
37
36
|
magenta: 'Magenta',
|
|
@@ -73,7 +72,7 @@ const Tag = /*#__PURE__*/React__default["default"].forwardRef(function Tag(_ref,
|
|
|
73
72
|
const prefix = usePrefix.usePrefix();
|
|
74
73
|
const tagRef = React.useRef();
|
|
75
74
|
const ref = react.useMergeRefs([forwardRef, tagRef]);
|
|
76
|
-
const tagId = id || `tag-${
|
|
75
|
+
const tagId = id || `tag-${useId.useId()}`;
|
|
77
76
|
const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
|
|
78
77
|
React.useLayoutEffect(() => {
|
|
79
78
|
const newElement = tagRef.current?.getElementsByClassName(`${prefix}--tag__label`)[0];
|
|
@@ -127,8 +126,7 @@ const Tag = /*#__PURE__*/React__default["default"].forwardRef(function Tag(_ref,
|
|
|
127
126
|
}
|
|
128
127
|
const ComponentTag = BaseComponent ?? (other.onClick || className?.includes(`${prefix}--tag--operational`) ? 'button' : 'div');
|
|
129
128
|
const labelClasses = cx__default["default"]({
|
|
130
|
-
[`${prefix}--tag__label`]: !isInteractiveTag
|
|
131
|
-
[`${prefix}--tag--${type}`]: type && !isInteractiveTag
|
|
129
|
+
[`${prefix}--tag__label`]: !isInteractiveTag
|
|
132
130
|
});
|
|
133
131
|
return /*#__PURE__*/React__default["default"].createElement(ComponentTag, _rollupPluginBabelHelpers["extends"]({
|
|
134
132
|
ref: ref,
|
|
@@ -21,7 +21,7 @@ var FormContext = require('../FluidForm/FormContext.js');
|
|
|
21
21
|
var useAnnouncer = require('../../internal/useAnnouncer.js');
|
|
22
22
|
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
23
23
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
24
|
-
var
|
|
24
|
+
var useId = require('../../internal/useId.js');
|
|
25
25
|
var noopFn = require('../../internal/noopFn.js');
|
|
26
26
|
require('../Text/index.js');
|
|
27
27
|
var Text = require('../Text/Text.js');
|
|
@@ -32,7 +32,6 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
32
32
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
33
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
34
34
|
|
|
35
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
36
35
|
const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwardRef) => {
|
|
37
36
|
const {
|
|
38
37
|
className,
|
|
@@ -65,9 +64,7 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
65
64
|
defaultValue,
|
|
66
65
|
value
|
|
67
66
|
} = other;
|
|
68
|
-
const
|
|
69
|
-
current: textAreaInstanceId
|
|
70
|
-
} = React.useRef(getInstanceId());
|
|
67
|
+
const textAreaInstanceId = useId.useId();
|
|
71
68
|
const textareaRef = React.useRef(null);
|
|
72
69
|
const ref = useMergedRefs.useMergedRefs([forwardRef, textareaRef]);
|
|
73
70
|
function getInitialTextCount() {
|
|
@@ -227,7 +224,33 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
227
224
|
textareaProps.maxLength = maxCount;
|
|
228
225
|
}
|
|
229
226
|
}
|
|
227
|
+
const announcerRef = React.useRef(null);
|
|
228
|
+
const [prevAnnouncement, setPrevAnnouncement] = React.useState('');
|
|
230
229
|
const ariaAnnouncement = useAnnouncer.useAnnouncer(textCount, maxCount, counterMode === 'word' ? 'words' : undefined);
|
|
230
|
+
React.useEffect(() => {
|
|
231
|
+
if (ariaAnnouncement && ariaAnnouncement !== prevAnnouncement) {
|
|
232
|
+
const announcer = announcerRef.current;
|
|
233
|
+
if (announcer) {
|
|
234
|
+
// Clear the content first
|
|
235
|
+
announcer.textContent = '';
|
|
236
|
+
|
|
237
|
+
// Set the new content after a small delay
|
|
238
|
+
const timeoutId = setTimeout(() => {
|
|
239
|
+
if (announcer) {
|
|
240
|
+
announcer.textContent = ariaAnnouncement;
|
|
241
|
+
setPrevAnnouncement(ariaAnnouncement);
|
|
242
|
+
}
|
|
243
|
+
}, counterMode === 'word' ? 2000 : 1000);
|
|
244
|
+
|
|
245
|
+
//clear the timeout
|
|
246
|
+
return () => {
|
|
247
|
+
if (timeoutId) {
|
|
248
|
+
clearTimeout(timeoutId);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}, [ariaAnnouncement, prevAnnouncement, counterMode]);
|
|
231
254
|
const input = /*#__PURE__*/React__default["default"].createElement("textarea", _rollupPluginBabelHelpers["extends"]({}, other, textareaProps, {
|
|
232
255
|
placeholder: placeholder,
|
|
233
256
|
"aria-readonly": other.readOnly ? true : false,
|
|
@@ -260,7 +283,10 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
260
283
|
className: `${prefix}--text-area__invalid-icon ${prefix}--text-area__invalid-icon--warning`
|
|
261
284
|
}), input, normalizedSlug, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
262
285
|
className: `${prefix}--text-area__counter-alert`,
|
|
263
|
-
role: "alert"
|
|
286
|
+
role: "alert",
|
|
287
|
+
"aria-live": "assertive",
|
|
288
|
+
"aria-atomic": "true",
|
|
289
|
+
ref: announcerRef
|
|
264
290
|
}, ariaAnnouncement), isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
265
291
|
className: `${prefix}--text-area__divider`
|
|
266
292
|
}), isFluid && invalid ? error : null, isFluid && warn && !invalid ? warning : null), !invalid && !warn && !isFluid ? helper : null, invalid && !isFluid ? error : null, warn && !invalid && !isFluid ? warning : null);
|
|
@@ -18,7 +18,7 @@ var util = require('./util.js');
|
|
|
18
18
|
var warning = require('../../internal/warning.js');
|
|
19
19
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
20
20
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
21
|
-
var
|
|
21
|
+
var useId = require('../../internal/useId.js');
|
|
22
22
|
var noopFn = require('../../internal/noopFn.js');
|
|
23
23
|
|
|
24
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -27,7 +27,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
27
27
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
28
28
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
29
29
|
|
|
30
|
-
const getInstanceId = setupGetInstanceId["default"]();
|
|
31
30
|
let didWarnAboutDeprecation = false;
|
|
32
31
|
const ControlledPasswordInput = /*#__PURE__*/React__default["default"].forwardRef(function ControlledPasswordInput(_ref, ref) {
|
|
33
32
|
let {
|
|
@@ -55,9 +54,7 @@ const ControlledPasswordInput = /*#__PURE__*/React__default["default"].forwardRe
|
|
|
55
54
|
...other
|
|
56
55
|
} = _ref;
|
|
57
56
|
const prefix = usePrefix.usePrefix();
|
|
58
|
-
const
|
|
59
|
-
current: controlledPasswordInstanceId
|
|
60
|
-
} = React.useRef(getInstanceId());
|
|
57
|
+
const controlledPasswordInstanceId = useId.useId();
|
|
61
58
|
if (process.env.NODE_ENV !== "production") {
|
|
62
59
|
process.env.NODE_ENV !== "production" ? warning.warning(didWarnAboutDeprecation, '`<TextInput.ControlledPasswordInput>` has been deprecated in favor of `<TextInput.PasswordInput />` and will be removed in the next major release of `carbon-components-react`') : void 0;
|
|
63
60
|
didWarnAboutDeprecation = true;
|
|
@@ -162,7 +162,31 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
|
|
|
162
162
|
const {
|
|
163
163
|
isFluid
|
|
164
164
|
} = React.useContext(FormContext.FormContext);
|
|
165
|
+
const announcerRef = React.useRef(null);
|
|
166
|
+
const [prevAnnouncement, setPrevAnnouncement] = React.useState('');
|
|
165
167
|
const ariaAnnouncement = useAnnouncer.useAnnouncer(textCount, maxCount);
|
|
168
|
+
React.useEffect(() => {
|
|
169
|
+
if (ariaAnnouncement && ariaAnnouncement !== prevAnnouncement) {
|
|
170
|
+
const announcer = announcerRef.current;
|
|
171
|
+
if (announcer) {
|
|
172
|
+
// Clear the content first
|
|
173
|
+
announcer.textContent = '';
|
|
174
|
+
// Set the new content after a small delay
|
|
175
|
+
const timeoutId = setTimeout(() => {
|
|
176
|
+
if (announcer) {
|
|
177
|
+
announcer.textContent = ariaAnnouncement;
|
|
178
|
+
setPrevAnnouncement(ariaAnnouncement);
|
|
179
|
+
}
|
|
180
|
+
}, 1000);
|
|
181
|
+
// clear the timeout
|
|
182
|
+
return () => {
|
|
183
|
+
if (timeoutId) {
|
|
184
|
+
clearTimeout(timeoutId);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}, [ariaAnnouncement, prevAnnouncement]);
|
|
166
190
|
const Icon = normalizedProps.icon;
|
|
167
191
|
|
|
168
192
|
// Slug is always size `mini`
|
|
@@ -185,7 +209,10 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
|
|
|
185
209
|
className: iconClasses
|
|
186
210
|
}), input, normalizedSlug, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
187
211
|
className: `${prefix}--text-input__counter-alert`,
|
|
188
|
-
role: "alert"
|
|
212
|
+
role: "alert",
|
|
213
|
+
"aria-live": "assertive",
|
|
214
|
+
"aria-atomic": "true",
|
|
215
|
+
ref: announcerRef
|
|
189
216
|
}, ariaAnnouncement), isFluid && /*#__PURE__*/React__default["default"].createElement("hr", {
|
|
190
217
|
className: `${prefix}--text-input__divider`
|
|
191
218
|
}), isFluid && !inline && normalizedProps.validation), !isFluid && !inline && (normalizedProps.validation || helper)));
|
package/lib/index.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export { FluidDatePickerInput as unstable__FluidDatePickerInput } from './compon
|
|
|
102
102
|
export { FluidDropdown as unstable__FluidDropdown, FluidDropdownSkeleton as unstable__FluidDropdownSkeleton, } from './components/FluidDropdown';
|
|
103
103
|
export { FluidMultiSelect as unstable__FluidMultiSelect, FluidMultiSelectSkeleton as unstable__FluidMultiSelectSkeleton, } from './components/FluidMultiSelect';
|
|
104
104
|
export { FluidSelect as unstable__FluidSelect, FluidSelectSkeleton as unstable__FluidSelectSkeleton, } from './components/FluidSelect';
|
|
105
|
+
export { FluidSearch as unstable__FluidSearch, FluidSearchSkeleton as unstable__FluidSearchSkeleton, } from './components/FluidSearch';
|
|
105
106
|
export { FluidTextArea as unstable__FluidTextArea, FluidTextAreaSkeleton as unstable__FluidTextAreaSkeleton, } from './components/FluidTextArea';
|
|
106
107
|
export { FluidTextInput as unstable__FluidTextInput, FluidTextInputSkeleton as unstable__FluidTextInputSkeleton, } from './components/FluidTextInput';
|
|
107
108
|
export { FluidTimePicker as unstable__FluidTimePicker, FluidTimePickerSkeleton as unstable__FluidTimePickerSkeleton, } from './components/FluidTimePicker';
|
package/lib/index.js
CHANGED
|
@@ -179,6 +179,7 @@ var index$g = require('./components/Theme/index.js');
|
|
|
179
179
|
var usePrefix = require('./internal/usePrefix.js');
|
|
180
180
|
var useIdPrefix = require('./internal/useIdPrefix.js');
|
|
181
181
|
var FluidDatePicker_Skeleton = require('./components/FluidDatePicker/FluidDatePicker.Skeleton.js');
|
|
182
|
+
var FluidSearch_Skeleton = require('./components/FluidSearch/FluidSearch.Skeleton.js');
|
|
182
183
|
var FluidTextArea = require('./components/FluidTextArea/FluidTextArea.js');
|
|
183
184
|
var FluidTextArea_Skeleton = require('./components/FluidTextArea/FluidTextArea.Skeleton.js');
|
|
184
185
|
var FluidTextInput = require('./components/FluidTextInput/FluidTextInput.js');
|
|
@@ -202,6 +203,7 @@ var FluidMultiSelect = require('./components/FluidMultiSelect/FluidMultiSelect.j
|
|
|
202
203
|
var FluidMultiSelect_Skeleton = require('./components/FluidMultiSelect/FluidMultiSelect.Skeleton.js');
|
|
203
204
|
var FluidSelect = require('./components/FluidSelect/FluidSelect.js');
|
|
204
205
|
var FluidSelect_Skeleton = require('./components/FluidSelect/FluidSelect.Skeleton.js');
|
|
206
|
+
var FluidSearch = require('./components/FluidSearch/FluidSearch.js');
|
|
205
207
|
var FluidTimePicker = require('./components/FluidTimePicker/FluidTimePicker.js');
|
|
206
208
|
var FluidTimePicker_Skeleton = require('./components/FluidTimePicker/FluidTimePicker.Skeleton.js');
|
|
207
209
|
var FluidTimePickerSelect = require('./components/FluidTimePickerSelect/FluidTimePickerSelect.js');
|
|
@@ -453,6 +455,7 @@ exports.PrefixContext = usePrefix.PrefixContext;
|
|
|
453
455
|
exports.usePrefix = usePrefix.usePrefix;
|
|
454
456
|
exports.useIdPrefix = useIdPrefix.useIdPrefix;
|
|
455
457
|
exports.unstable__FluidDatePickerSkeleton = FluidDatePicker_Skeleton["default"];
|
|
458
|
+
exports.unstable__FluidSearchSkeleton = FluidSearch_Skeleton["default"];
|
|
456
459
|
exports.unstable__FluidTextArea = FluidTextArea["default"];
|
|
457
460
|
exports.unstable__FluidTextAreaSkeleton = FluidTextArea_Skeleton["default"];
|
|
458
461
|
exports.unstable__FluidTextInput = FluidTextInput["default"];
|
|
@@ -476,6 +479,7 @@ exports.unstable__FluidMultiSelect = FluidMultiSelect["default"];
|
|
|
476
479
|
exports.unstable__FluidMultiSelectSkeleton = FluidMultiSelect_Skeleton["default"];
|
|
477
480
|
exports.unstable__FluidSelect = FluidSelect["default"];
|
|
478
481
|
exports.unstable__FluidSelectSkeleton = FluidSelect_Skeleton["default"];
|
|
482
|
+
exports.unstable__FluidSearch = FluidSearch["default"];
|
|
479
483
|
exports.unstable__FluidTimePicker = FluidTimePicker["default"];
|
|
480
484
|
exports.unstable__FluidTimePickerSkeleton = FluidTimePicker_Skeleton["default"];
|
|
481
485
|
exports.unstable__FluidTimePickerSelect = FluidTimePickerSelect["default"];
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
|
-
var isEqual = require('
|
|
15
|
+
var isEqual = require('react-fast-compare');
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
18
|
|
|
@@ -11,10 +11,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
function useAnnouncer(textCount, maxCount) {
|
|
13
13
|
let entityName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'characters';
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
|
|
14
|
+
const remaining = maxCount - textCount;
|
|
15
|
+
if (remaining <= 10 && remaining > 0) {
|
|
16
|
+
const entity = remaining === 1 ? entityName.slice(0, -1) : entityName;
|
|
17
|
+
return `${remaining} ${entity} left.`;
|
|
17
18
|
}
|
|
19
|
+
if (remaining <= 0) {
|
|
20
|
+
return `Maximum ${entityName} reached.`;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
exports.useAnnouncer = useAnnouncer;
|
package/lib/types/common.d.ts
CHANGED
|
@@ -9,10 +9,15 @@ export type ForwardRefReturn<T, P = unknown> = React.ForwardRefExoticComponent<F
|
|
|
9
9
|
export type PolymorphicProps<Element extends React.ElementType, Props> = Props & Omit<React.ComponentProps<Element>, 'as'> & {
|
|
10
10
|
as?: Element;
|
|
11
11
|
};
|
|
12
|
-
export interface
|
|
12
|
+
export interface TranslateWithId<MID = string, ARGS = Record<string, unknown>> {
|
|
13
13
|
/**
|
|
14
14
|
* Supply a method to translate internal strings with your i18n tool of
|
|
15
15
|
* choice.
|
|
16
16
|
*/
|
|
17
17
|
translateWithId?(messageId: MID, args?: ARGS): string;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Alias of TranslateWithId. Will be removed in v12
|
|
21
|
+
* @deprecated Use TranslateWithId instead
|
|
22
|
+
*/
|
|
23
|
+
export type InternationalProps<MID = string, ARGS = Record<string, unknown>> = TranslateWithId<MID, ARGS>;
|