@carbon/react 1.71.0-rc.0 → 1.71.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 +910 -885
- package/es/components/Checkbox/Checkbox.d.ts +5 -0
- package/es/components/Checkbox/Checkbox.js +16 -7
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +16 -7
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComposedModal/ComposedModal.d.ts +5 -0
- package/es/components/ComposedModal/ComposedModal.js +16 -10
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
- package/es/components/FluidSelect/FluidSelect.d.ts +4 -0
- package/es/components/FluidSelect/FluidSelect.js +5 -1
- package/es/components/FluidTextArea/FluidTextArea.d.ts +4 -0
- package/es/components/FluidTextArea/FluidTextArea.js +5 -1
- package/es/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
- package/es/components/FluidTextInput/FluidPasswordInput.js +5 -1
- package/es/components/FluidTextInput/FluidTextInput.d.ts +4 -0
- package/es/components/FluidTextInput/FluidTextInput.js +5 -1
- package/es/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
- package/es/components/FluidTimePicker/FluidTimePicker.js +23 -7
- package/es/components/Modal/Modal.d.ts +5 -0
- package/es/components/Modal/Modal.js +16 -10
- package/es/components/PaginationNav/PaginationNav.js +15 -3
- package/es/components/RadioButton/RadioButton.d.ts +5 -0
- package/es/components/RadioButton/RadioButton.js +16 -7
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
- package/es/components/RadioTile/RadioTile.d.ts +5 -0
- package/es/components/RadioTile/RadioTile.js +17 -8
- package/es/components/Tag/DismissibleTag.d.ts +11 -2
- package/es/components/Tag/DismissibleTag.js +13 -5
- package/es/components/Tag/Tag.d.ts +5 -0
- package/es/components/Tag/Tag.js +14 -7
- package/es/components/Tile/Tile.d.ts +21 -1
- package/es/components/Tile/Tile.js +68 -48
- package/lib/components/Checkbox/Checkbox.d.ts +5 -0
- package/lib/components/Checkbox/Checkbox.js +16 -7
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +5 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -7
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComposedModal/ComposedModal.d.ts +5 -0
- package/lib/components/ComposedModal/ComposedModal.js +16 -10
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -0
- package/lib/components/FluidSelect/FluidSelect.d.ts +4 -0
- package/lib/components/FluidSelect/FluidSelect.js +5 -1
- package/lib/components/FluidTextArea/FluidTextArea.d.ts +4 -0
- package/lib/components/FluidTextArea/FluidTextArea.js +5 -1
- package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +4 -0
- package/lib/components/FluidTextInput/FluidPasswordInput.js +5 -1
- package/lib/components/FluidTextInput/FluidTextInput.d.ts +4 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +5 -1
- package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +4 -0
- package/lib/components/FluidTimePicker/FluidTimePicker.js +23 -7
- package/lib/components/Modal/Modal.d.ts +5 -0
- package/lib/components/Modal/Modal.js +16 -10
- package/lib/components/PaginationNav/PaginationNav.js +15 -3
- package/lib/components/RadioButton/RadioButton.d.ts +5 -0
- package/lib/components/RadioButton/RadioButton.js +16 -7
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +5 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +16 -7
- package/lib/components/RadioTile/RadioTile.d.ts +5 -0
- package/lib/components/RadioTile/RadioTile.js +17 -8
- package/lib/components/Tag/DismissibleTag.d.ts +11 -2
- package/lib/components/Tag/DismissibleTag.js +13 -5
- package/lib/components/Tag/Tag.d.ts +5 -0
- package/lib/components/Tag/Tag.js +14 -7
- package/lib/components/Tile/Tile.d.ts +21 -1
- package/lib/components/Tile/Tile.js +67 -47
- package/package.json +4 -4
|
@@ -16,6 +16,10 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
16
16
|
* exposing to the user
|
|
17
17
|
*/
|
|
18
18
|
labelText: NonNullable<ReactNode>;
|
|
19
|
+
/**
|
|
20
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `Checkbox` component
|
|
21
|
+
*/
|
|
22
|
+
decorator?: ReactNode;
|
|
19
23
|
/**
|
|
20
24
|
* Specify whether the underlying input should be checked by default
|
|
21
25
|
*/
|
|
@@ -45,6 +49,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
45
49
|
*/
|
|
46
50
|
invalidText?: ReactNode;
|
|
47
51
|
/**
|
|
52
|
+
* @deprecated please use decorator instead.
|
|
48
53
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
49
54
|
*/
|
|
50
55
|
slug?: ReactNode;
|
|
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import '../Text/index.js';
|
|
13
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
13
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
15
|
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
15
16
|
import { useId } from '../../internal/useId.js';
|
|
@@ -19,6 +20,7 @@ import { Text } from '../Text/Text.js';
|
|
|
19
20
|
const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
20
21
|
let {
|
|
21
22
|
className,
|
|
23
|
+
decorator,
|
|
22
24
|
helperText,
|
|
23
25
|
id,
|
|
24
26
|
labelText,
|
|
@@ -48,15 +50,16 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
48
50
|
[`${prefix}--checkbox-wrapper--readonly`]: readOnly,
|
|
49
51
|
[`${prefix}--checkbox-wrapper--invalid`]: !readOnly && invalid,
|
|
50
52
|
[`${prefix}--checkbox-wrapper--warning`]: showWarning,
|
|
51
|
-
[`${prefix}--checkbox-wrapper--slug`]: slug
|
|
53
|
+
[`${prefix}--checkbox-wrapper--slug`]: slug,
|
|
54
|
+
[`${prefix}--checkbox-wrapper--decorator`]: decorator
|
|
52
55
|
});
|
|
53
56
|
const innerLabelClasses = cx(`${prefix}--checkbox-label-text`, {
|
|
54
57
|
[`${prefix}--visually-hidden`]: hideLabel
|
|
55
58
|
});
|
|
56
|
-
let
|
|
57
|
-
if (
|
|
58
|
-
const size =
|
|
59
|
-
|
|
59
|
+
let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
60
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
61
|
+
const size = normalizedDecorator.props?.['kind'] === 'inline' ? 'md' : 'mini';
|
|
62
|
+
normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
|
|
60
63
|
size
|
|
61
64
|
});
|
|
62
65
|
}
|
|
@@ -105,7 +108,9 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
105
108
|
title: title
|
|
106
109
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
107
110
|
className: innerLabelClasses
|
|
108
|
-
}, labelText,
|
|
111
|
+
}, labelText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
|
|
112
|
+
className: `${prefix}--checkbox-wrapper-inner--decorator`
|
|
113
|
+
}, normalizedDecorator) : '')), /*#__PURE__*/React__default.createElement("div", {
|
|
109
114
|
className: `${prefix}--checkbox__validation-msg`
|
|
110
115
|
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
111
116
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -126,6 +131,10 @@ Checkbox.propTypes = {
|
|
|
126
131
|
* Specify an optional className to be applied to the <label> node
|
|
127
132
|
*/
|
|
128
133
|
className: PropTypes.string,
|
|
134
|
+
/**
|
|
135
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `Checkbox` component
|
|
136
|
+
*/
|
|
137
|
+
decorator: PropTypes.node,
|
|
129
138
|
/**
|
|
130
139
|
* Specify whether the underlying input should be checked by default
|
|
131
140
|
*/
|
|
@@ -176,7 +185,7 @@ Checkbox.propTypes = {
|
|
|
176
185
|
/**
|
|
177
186
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
178
187
|
*/
|
|
179
|
-
slug: PropTypes.node,
|
|
188
|
+
slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
|
|
180
189
|
/**
|
|
181
190
|
* Specify a title for the <label> node for the Checkbox
|
|
182
191
|
*/
|
|
@@ -8,6 +8,7 @@ import React, { ReactNode } from 'react';
|
|
|
8
8
|
export interface CheckboxGroupProps {
|
|
9
9
|
children?: ReactNode;
|
|
10
10
|
className?: string;
|
|
11
|
+
decorator?: ReactNode;
|
|
11
12
|
helperText?: ReactNode;
|
|
12
13
|
invalid?: boolean;
|
|
13
14
|
invalidText?: ReactNode;
|
|
@@ -15,6 +16,10 @@ export interface CheckboxGroupProps {
|
|
|
15
16
|
orientation?: 'horizontal' | 'vertical';
|
|
16
17
|
legendText: ReactNode;
|
|
17
18
|
readOnly?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* * @deprecated please use decorator instead.
|
|
21
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
22
|
+
*/
|
|
18
23
|
slug?: ReactNode;
|
|
19
24
|
warn?: boolean;
|
|
20
25
|
warnText?: ReactNode;
|
|
@@ -9,6 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
12
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
14
|
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
14
15
|
import { useId } from '../../internal/useId.js';
|
|
@@ -17,6 +18,7 @@ const CheckboxGroup = _ref => {
|
|
|
17
18
|
let {
|
|
18
19
|
children,
|
|
19
20
|
className,
|
|
21
|
+
decorator,
|
|
20
22
|
helperText,
|
|
21
23
|
invalid,
|
|
22
24
|
invalidText,
|
|
@@ -43,13 +45,14 @@ const CheckboxGroup = _ref => {
|
|
|
43
45
|
[`${prefix}--checkbox-group--readonly`]: readOnly,
|
|
44
46
|
[`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
|
|
45
47
|
[`${prefix}--checkbox-group--warning`]: showWarning,
|
|
46
|
-
[`${prefix}--checkbox-group--slug`]: slug
|
|
48
|
+
[`${prefix}--checkbox-group--slug`]: slug,
|
|
49
|
+
[`${prefix}--checkbox-group--decorator`]: decorator
|
|
47
50
|
});
|
|
48
51
|
|
|
49
|
-
//
|
|
50
|
-
let
|
|
51
|
-
if (
|
|
52
|
-
|
|
52
|
+
// AILabel always size `mini`
|
|
53
|
+
let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
54
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
55
|
+
normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
|
|
53
56
|
size: 'mini',
|
|
54
57
|
kind: 'default'
|
|
55
58
|
});
|
|
@@ -63,7 +66,9 @@ const CheckboxGroup = _ref => {
|
|
|
63
66
|
}, rest), /*#__PURE__*/React__default.createElement("legend", {
|
|
64
67
|
className: `${prefix}--label`,
|
|
65
68
|
id: legendId || rest['aria-labelledby']
|
|
66
|
-
}, legendText,
|
|
69
|
+
}, legendText, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
|
|
70
|
+
className: `${prefix}--checkbox-group-inner--decorator`
|
|
71
|
+
}, normalizedDecorator) : ''), children, /*#__PURE__*/React__default.createElement("div", {
|
|
67
72
|
className: `${prefix}--checkbox-group__validation-msg`
|
|
68
73
|
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
69
74
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -84,6 +89,10 @@ CheckboxGroup.propTypes = {
|
|
|
84
89
|
* Provide a custom className to be applied to the containing <fieldset> node
|
|
85
90
|
*/
|
|
86
91
|
className: PropTypes.string,
|
|
92
|
+
/**
|
|
93
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `CheckboxGroup` component
|
|
94
|
+
*/
|
|
95
|
+
decorator: PropTypes.node,
|
|
87
96
|
/**
|
|
88
97
|
* Provide text for the form group for additional help
|
|
89
98
|
*/
|
|
@@ -116,7 +125,7 @@ CheckboxGroup.propTypes = {
|
|
|
116
125
|
/**
|
|
117
126
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
|
|
118
127
|
*/
|
|
119
|
-
slug: PropTypes.node,
|
|
128
|
+
slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
|
|
120
129
|
/**
|
|
121
130
|
* Specify whether the form group is currently in warning state
|
|
122
131
|
*/
|
|
@@ -39,6 +39,10 @@ export interface ComposedModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
39
39
|
* Note that this prop is not applied if you render primary/danger button by yourself
|
|
40
40
|
*/
|
|
41
41
|
danger?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `ComposedModal` component
|
|
44
|
+
*/
|
|
45
|
+
decorator?: ReactNode;
|
|
42
46
|
/**
|
|
43
47
|
* Specify whether the Modal content should have any inner padding.
|
|
44
48
|
*/
|
|
@@ -70,6 +74,7 @@ export interface ComposedModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
70
74
|
selectorsFloatingMenus?: string[];
|
|
71
75
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
72
76
|
/**
|
|
77
|
+
* @deprecated please use `decorator` instead.
|
|
73
78
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComposedModal` component
|
|
74
79
|
*/
|
|
75
80
|
slug?: ReactNode;
|
|
@@ -22,6 +22,7 @@ import wrapFocus, { wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } f
|
|
|
22
22
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
23
23
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
24
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
25
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
25
26
|
import { match } from '../../internal/keyboard/match.js';
|
|
26
27
|
import { Escape, Tab } from '../../internal/keyboard/keys.js';
|
|
27
28
|
|
|
@@ -98,6 +99,7 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
98
99
|
className: customClassName,
|
|
99
100
|
containerClassName,
|
|
100
101
|
danger,
|
|
102
|
+
decorator,
|
|
101
103
|
isFullWidth,
|
|
102
104
|
onClose,
|
|
103
105
|
onKeyDown,
|
|
@@ -189,7 +191,8 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
189
191
|
const modalClass = cx(`${prefix}--modal`, {
|
|
190
192
|
'is-visible': isOpen,
|
|
191
193
|
[`${prefix}--modal--danger`]: danger,
|
|
192
|
-
[`${prefix}--modal--slug`]: slug
|
|
194
|
+
[`${prefix}--modal--slug`]: slug,
|
|
195
|
+
[`${prefix}--modal--decorator`]: decorator
|
|
193
196
|
}, customClassName);
|
|
194
197
|
const containerClass = cx(`${prefix}--modal-container`, size && `${prefix}--modal-container--${size}`, isFullWidth && `${prefix}--modal-container--full-width`, containerClassName);
|
|
195
198
|
|
|
@@ -248,10 +251,10 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
248
251
|
}
|
|
249
252
|
}, [open, selectorPrimaryFocus, isOpen]);
|
|
250
253
|
|
|
251
|
-
//
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
254
|
-
|
|
254
|
+
// AILabel is always size `sm`
|
|
255
|
+
let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
256
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
257
|
+
normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
|
|
255
258
|
size: 'sm'
|
|
256
259
|
});
|
|
257
260
|
}
|
|
@@ -277,7 +280,9 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
277
280
|
}, "Focus sentinel"), /*#__PURE__*/React__default.createElement("div", {
|
|
278
281
|
ref: innerModal,
|
|
279
282
|
className: `${prefix}--modal-container-body`
|
|
280
|
-
},
|
|
283
|
+
}, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
|
|
284
|
+
className: `${prefix}--modal--inner__decorator`
|
|
285
|
+
}, normalizedDecorator) : '', childrenWithProps), !focusTrapWithoutSentinels && /*#__PURE__*/React__default.createElement("button", {
|
|
281
286
|
type: "button",
|
|
282
287
|
ref: endSentinel,
|
|
283
288
|
className: `${prefix}--visually-hidden`
|
|
@@ -309,6 +314,10 @@ ComposedModal.propTypes = {
|
|
|
309
314
|
* Note that this prop is not applied if you render primary/danger button by yourself
|
|
310
315
|
*/
|
|
311
316
|
danger: PropTypes.bool,
|
|
317
|
+
/**
|
|
318
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `ComposedModal` component
|
|
319
|
+
*/
|
|
320
|
+
decorator: PropTypes.node,
|
|
312
321
|
/**
|
|
313
322
|
* Specify whether the Modal content should have any inner padding.
|
|
314
323
|
*/
|
|
@@ -348,10 +357,7 @@ ComposedModal.propTypes = {
|
|
|
348
357
|
* Specify the size variant.
|
|
349
358
|
*/
|
|
350
359
|
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
351
|
-
|
|
352
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComposedModal` component
|
|
353
|
-
*/
|
|
354
|
-
slug: PropTypes.node
|
|
360
|
+
slug: deprecate(PropTypes.node, 'The `slug` prop for `ComposedModal` has ' + 'been deprecated in favor of the new `decorator` prop. It will be removed in the next major release.')
|
|
355
361
|
};
|
|
356
362
|
|
|
357
363
|
export { ModalBody, ComposedModal as default };
|
|
@@ -90,6 +90,10 @@ export interface FluidNumberInputProps {
|
|
|
90
90
|
* Provide the text that is displayed when the control is in warning state
|
|
91
91
|
*/
|
|
92
92
|
warnText?: React.ReactNode;
|
|
93
|
+
/**
|
|
94
|
+
* Whether or not the component is readonly
|
|
95
|
+
*/
|
|
96
|
+
readOnly?: boolean;
|
|
93
97
|
}
|
|
94
98
|
declare const FluidNumberInput: React.FC<FluidNumberInputProps>;
|
|
95
99
|
export default FluidNumberInput;
|
|
@@ -52,6 +52,10 @@ export interface FluidSelectProps {
|
|
|
52
52
|
* Provide the text that is displayed when the control is in warning state
|
|
53
53
|
*/
|
|
54
54
|
warnText?: React.ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* Whether or not the component is readonly
|
|
57
|
+
*/
|
|
58
|
+
readOnly?: boolean;
|
|
55
59
|
}
|
|
56
60
|
declare const FluidSelect: React.ForwardRefExoticComponent<FluidSelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
57
61
|
export default FluidSelect;
|
|
@@ -77,7 +77,11 @@ FluidSelect.propTypes = {
|
|
|
77
77
|
/**
|
|
78
78
|
* Provide the text that is displayed when the control is in warning state
|
|
79
79
|
*/
|
|
80
|
-
warnText: PropTypes.node
|
|
80
|
+
warnText: PropTypes.node,
|
|
81
|
+
/**
|
|
82
|
+
* Whether or not the component is readonly
|
|
83
|
+
*/
|
|
84
|
+
readOnly: PropTypes.bool
|
|
81
85
|
};
|
|
82
86
|
|
|
83
87
|
export { FluidSelect as default };
|
|
@@ -91,6 +91,10 @@ export interface FluidTextAreaProps {
|
|
|
91
91
|
* Provide the text that is displayed when the control is in warning state
|
|
92
92
|
*/
|
|
93
93
|
warnText?: React.ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Whether or not the component is readonly
|
|
96
|
+
*/
|
|
97
|
+
readOnly?: boolean;
|
|
94
98
|
}
|
|
95
99
|
declare const FluidTextArea: React.FC<FluidTextAreaProps>;
|
|
96
100
|
export default FluidTextArea;
|
|
@@ -115,7 +115,11 @@ FluidTextArea.propTypes = {
|
|
|
115
115
|
/**
|
|
116
116
|
* Provide the text that is displayed when the control is in warning state
|
|
117
117
|
*/
|
|
118
|
-
warnText: PropTypes.node
|
|
118
|
+
warnText: PropTypes.node,
|
|
119
|
+
/**
|
|
120
|
+
* Whether or not the component is readonly
|
|
121
|
+
*/
|
|
122
|
+
readOnly: PropTypes.bool
|
|
119
123
|
};
|
|
120
124
|
|
|
121
125
|
export { FluidTextArea as default };
|
|
@@ -78,6 +78,10 @@ export interface FluidPasswordInputProps {
|
|
|
78
78
|
* Provide the text that is displayed when the control is in warning state
|
|
79
79
|
*/
|
|
80
80
|
warnText?: React.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Whether or not the component is readonly
|
|
83
|
+
*/
|
|
84
|
+
readOnly?: boolean;
|
|
81
85
|
}
|
|
82
86
|
declare const FluidPasswordInput: React.FC<FluidPasswordInputProps>;
|
|
83
87
|
export default FluidPasswordInput;
|
|
@@ -83,5 +83,9 @@ import '../TextInput/PasswordInput.js';
|
|
|
83
83
|
/**
|
|
84
84
|
* Provide the text that is displayed when the control is in warning state
|
|
85
85
|
*/
|
|
86
|
-
warnText: PropTypes.node
|
|
86
|
+
warnText: PropTypes.node,
|
|
87
|
+
/**
|
|
88
|
+
* Whether or not the component is readonly
|
|
89
|
+
*/
|
|
90
|
+
readOnly: PropTypes.bool
|
|
87
91
|
});
|
|
@@ -65,6 +65,10 @@ export interface FluidTextInputProps {
|
|
|
65
65
|
* Provide the text that is displayed when the control is in warning state
|
|
66
66
|
*/
|
|
67
67
|
warnText?: React.ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Whether or not the component is readonly
|
|
70
|
+
*/
|
|
71
|
+
readOnly?: boolean;
|
|
68
72
|
}
|
|
69
73
|
declare const FluidTextInput: React.ForwardRefExoticComponent<FluidTextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
70
74
|
export default FluidTextInput;
|
|
@@ -97,7 +97,11 @@ FluidTextInput.propTypes = {
|
|
|
97
97
|
/**
|
|
98
98
|
* Provide the text that is displayed when the control is in warning state
|
|
99
99
|
*/
|
|
100
|
-
warnText: PropTypes.node
|
|
100
|
+
warnText: PropTypes.node,
|
|
101
|
+
/**
|
|
102
|
+
* Whether or not the component is readonly
|
|
103
|
+
*/
|
|
104
|
+
readOnly: PropTypes.bool
|
|
101
105
|
};
|
|
102
106
|
|
|
103
107
|
export { FluidTextInput as default };
|
|
@@ -40,6 +40,10 @@ export interface FluidTimePickerProps extends FluidTextInputProps {
|
|
|
40
40
|
* Provide the text that is displayed when the control is in warning state
|
|
41
41
|
*/
|
|
42
42
|
warnText?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Specify if the component is readonly
|
|
45
|
+
*/
|
|
46
|
+
readOnly?: boolean;
|
|
43
47
|
}
|
|
44
48
|
declare const FluidTimePicker: React.ForwardRefExoticComponent<FluidTimePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
45
49
|
export default FluidTimePicker;
|
|
@@ -24,6 +24,7 @@ const FluidTimePicker = /*#__PURE__*/React__default.forwardRef(function FluidTim
|
|
|
24
24
|
invalidText,
|
|
25
25
|
warn,
|
|
26
26
|
warnText,
|
|
27
|
+
readOnly,
|
|
27
28
|
...other
|
|
28
29
|
} = _ref;
|
|
29
30
|
const prefix = usePrefix();
|
|
@@ -43,6 +44,19 @@ const FluidTimePicker = /*#__PURE__*/React__default.forwardRef(function FluidTim
|
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
const error = invalid || warn;
|
|
47
|
+
const childrenWithProps = () => {
|
|
48
|
+
if (disabled) {
|
|
49
|
+
return React__default.Children.toArray(children).map(child => /*#__PURE__*/React__default.cloneElement(child, {
|
|
50
|
+
disabled: true
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
if (readOnly) {
|
|
54
|
+
return React__default.Children.toArray(children).map(child => /*#__PURE__*/React__default.cloneElement(child, {
|
|
55
|
+
readOnly: true
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
return children;
|
|
59
|
+
};
|
|
46
60
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
47
61
|
className: classNames
|
|
48
62
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -50,12 +64,10 @@ const FluidTimePicker = /*#__PURE__*/React__default.forwardRef(function FluidTim
|
|
|
50
64
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
51
65
|
className: `${prefix}--time-picker__input`
|
|
52
66
|
}, /*#__PURE__*/React__default.createElement(FluidTextInput, _extends({
|
|
53
|
-
ref: ref
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
}) : children), error && /*#__PURE__*/React__default.createElement("hr", {
|
|
67
|
+
ref: ref,
|
|
68
|
+
readOnly: readOnly,
|
|
69
|
+
disabled: disabled
|
|
70
|
+
}, other))), childrenWithProps()), error && /*#__PURE__*/React__default.createElement("hr", {
|
|
59
71
|
className: `${prefix}--time-picker__divider`
|
|
60
72
|
}), error && /*#__PURE__*/React__default.createElement("div", {
|
|
61
73
|
className: `${prefix}--form-requirement`
|
|
@@ -98,7 +110,11 @@ FluidTimePicker.propTypes = {
|
|
|
98
110
|
/**
|
|
99
111
|
* Provide the text that is displayed when the control is in warning state
|
|
100
112
|
*/
|
|
101
|
-
warnText: PropTypes.node
|
|
113
|
+
warnText: PropTypes.node,
|
|
114
|
+
/**
|
|
115
|
+
* Whether or not the component is readonly
|
|
116
|
+
*/
|
|
117
|
+
readOnly: PropTypes.bool
|
|
102
118
|
};
|
|
103
119
|
|
|
104
120
|
export { FluidTimePicker as default };
|
|
@@ -39,6 +39,10 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
39
39
|
* Specify whether the Modal is for dangerous actions
|
|
40
40
|
*/
|
|
41
41
|
danger?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
44
|
+
*/
|
|
45
|
+
decorator?: ReactNode;
|
|
42
46
|
/**
|
|
43
47
|
* Specify whether the modal contains scrolling content
|
|
44
48
|
*/
|
|
@@ -151,6 +155,7 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
151
155
|
*/
|
|
152
156
|
size?: ModalSize;
|
|
153
157
|
/**
|
|
158
|
+
* @deprecated please use decorator instead.
|
|
154
159
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
|
|
155
160
|
*/
|
|
156
161
|
slug?: ReactNode;
|
|
@@ -27,6 +27,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
27
27
|
import '../Text/index.js';
|
|
28
28
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
29
29
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
30
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
30
31
|
import { Text } from '../Text/Text.js';
|
|
31
32
|
import { match } from '../../internal/keyboard/match.js';
|
|
32
33
|
import { Escape, Enter, Tab } from '../../internal/keyboard/keys.js';
|
|
@@ -37,6 +38,7 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
37
38
|
'aria-label': ariaLabelProp,
|
|
38
39
|
children,
|
|
39
40
|
className,
|
|
41
|
+
decorator,
|
|
40
42
|
modalHeading = '',
|
|
41
43
|
modalLabel = '',
|
|
42
44
|
modalAriaLabel,
|
|
@@ -143,7 +145,8 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
143
145
|
[`${prefix}--modal-tall`]: !passiveModal,
|
|
144
146
|
'is-visible': open,
|
|
145
147
|
[`${prefix}--modal--danger`]: danger,
|
|
146
|
-
[`${prefix}--modal--slug`]: slug
|
|
148
|
+
[`${prefix}--modal--slug`]: slug,
|
|
149
|
+
[`${prefix}--modal--decorator`]: decorator
|
|
147
150
|
}, className);
|
|
148
151
|
const containerClasses = cx(`${prefix}--modal-container`, {
|
|
149
152
|
[`${prefix}--modal-container--${size}`]: size,
|
|
@@ -227,10 +230,10 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
227
230
|
};
|
|
228
231
|
}, []);
|
|
229
232
|
|
|
230
|
-
//
|
|
231
|
-
let
|
|
232
|
-
if (
|
|
233
|
-
|
|
233
|
+
// AILabel always size `sm`
|
|
234
|
+
let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
235
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
236
|
+
normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
|
|
234
237
|
size: 'sm'
|
|
235
238
|
});
|
|
236
239
|
}
|
|
@@ -267,7 +270,9 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
267
270
|
as: "h2",
|
|
268
271
|
id: modalHeadingId,
|
|
269
272
|
className: `${prefix}--modal-header__heading`
|
|
270
|
-
}, modalHeading),
|
|
273
|
+
}, modalHeading), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default.createElement("div", {
|
|
274
|
+
className: `${prefix}--modal--inner__decorator`
|
|
275
|
+
}, normalizedDecorator) : '', !passiveModal && modalButton), /*#__PURE__*/React__default.createElement(Layer, _extends({
|
|
271
276
|
ref: contentRef,
|
|
272
277
|
id: modalBodyId,
|
|
273
278
|
className: contentClasses
|
|
@@ -348,6 +353,10 @@ Modal.propTypes = {
|
|
|
348
353
|
* Specify whether the Modal is for dangerous actions
|
|
349
354
|
*/
|
|
350
355
|
danger: PropTypes.bool,
|
|
356
|
+
/**
|
|
357
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
358
|
+
*/
|
|
359
|
+
decorator: PropTypes.node,
|
|
351
360
|
/**
|
|
352
361
|
* Specify whether the modal contains scrolling content
|
|
353
362
|
*/
|
|
@@ -478,10 +487,7 @@ Modal.propTypes = {
|
|
|
478
487
|
* Specify the size variant.
|
|
479
488
|
*/
|
|
480
489
|
size: PropTypes.oneOf(ModalSizes),
|
|
481
|
-
|
|
482
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
|
|
483
|
-
*/
|
|
484
|
-
slug: PropTypes.node
|
|
490
|
+
slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.')
|
|
485
491
|
};
|
|
486
492
|
|
|
487
493
|
export { ModalSizes, Modal as default };
|
|
@@ -183,8 +183,20 @@ const PaginationNav = /*#__PURE__*/React__default.forwardRef(function Pagination
|
|
|
183
183
|
} = _ref4;
|
|
184
184
|
const smMediaQuery = `(max-width: ${breakpoints.sm.width})`;
|
|
185
185
|
const isSm = useMatchMedia(smMediaQuery);
|
|
186
|
+
let numberOfPages;
|
|
187
|
+
switch (size) {
|
|
188
|
+
case 'md':
|
|
189
|
+
numberOfPages = itemsShown === 4 ? itemsShown : 5;
|
|
190
|
+
break;
|
|
191
|
+
case 'sm':
|
|
192
|
+
numberOfPages = Math.max(4, Math.min(itemsShown, 7));
|
|
193
|
+
break;
|
|
194
|
+
default:
|
|
195
|
+
numberOfPages = 4;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
186
198
|
const [currentPage, setCurrentPage] = useState(page);
|
|
187
|
-
const [itemsDisplayedOnPage, setItemsDisplayedOnPage] = useState(itemsShown >= 4 && !isSm ? itemsShown :
|
|
199
|
+
const [itemsDisplayedOnPage, setItemsDisplayedOnPage] = useState(itemsShown >= 4 && !isSm ? itemsShown : numberOfPages);
|
|
188
200
|
const [cuts, setCuts] = useState(calculateCuts(currentPage, totalItems, itemsDisplayedOnPage));
|
|
189
201
|
const prevPage = usePrevious(currentPage);
|
|
190
202
|
const prefix = usePrefix();
|
|
@@ -229,10 +241,10 @@ const PaginationNav = /*#__PURE__*/React__default.forwardRef(function Pagination
|
|
|
229
241
|
|
|
230
242
|
// re-calculate cuts if props.totalItems or props.itemsShown change
|
|
231
243
|
useEffect(() => {
|
|
232
|
-
const itemsToBeShown = itemsShown >= 4 && !isSm ? itemsShown :
|
|
244
|
+
const itemsToBeShown = itemsShown >= 4 && !isSm ? itemsShown : numberOfPages;
|
|
233
245
|
setItemsDisplayedOnPage(Math.max(itemsToBeShown, 4));
|
|
234
246
|
setCuts(calculateCuts(currentPage, totalItems, Math.max(itemsToBeShown, 4)));
|
|
235
|
-
}, [totalItems, itemsShown, isSm]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
247
|
+
}, [totalItems, itemsShown, isSm, size]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
236
248
|
|
|
237
249
|
// update cuts if necessary whenever currentPage changes
|
|
238
250
|
useEffect(() => {
|
|
@@ -15,6 +15,10 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
15
15
|
* Provide an optional className to be applied to the containing node
|
|
16
16
|
*/
|
|
17
17
|
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `RadioButton` component
|
|
20
|
+
*/
|
|
21
|
+
decorator?: ReactNode;
|
|
18
22
|
/**
|
|
19
23
|
* Specify whether the `<RadioButton>` should be checked by default
|
|
20
24
|
*/
|
|
@@ -55,6 +59,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
55
59
|
*/
|
|
56
60
|
onClick?: (evt: React.MouseEvent<HTMLInputElement>) => void;
|
|
57
61
|
/**
|
|
62
|
+
* @deprecated please use decorator instead.
|
|
58
63
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
59
64
|
*/
|
|
60
65
|
slug?: ReactNode;
|