@carbon/react 1.45.0-rc.0 → 1.46.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 +975 -893
- package/README.md +9 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.js +1 -1
- package/es/components/ComposedModal/ComposedModal.d.ts +5 -0
- package/es/components/ComposedModal/ComposedModal.js +20 -3
- package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +1 -1
- package/es/components/Dropdown/Dropdown.js +1 -1
- package/es/components/Grid/Column.js +2 -2
- package/es/components/Modal/Modal.d.ts +5 -0
- package/es/components/Modal/Modal.js +17 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/es/components/MultiSelect/MultiSelect.js +4 -1
- package/es/components/NumberInput/NumberInput.js +2 -2
- package/es/components/PaginationNav/PaginationNav.js +35 -2
- package/es/components/ProgressIndicator/ProgressIndicator.js +4 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/Select/Select.js +1 -1
- package/es/components/Slug/index.js +1 -0
- package/es/components/Tag/Tag.d.ts +18 -10
- package/es/components/Tag/Tag.js +23 -7
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/TextInput.js +1 -1
- package/es/components/Tile/Tile.js +2 -2
- package/es/components/UIShell/Switcher.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.d.ts +5 -0
- package/lib/components/ComposedModal/ComposedModal.js +20 -3
- package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +1 -1
- package/lib/components/Grid/Column.js +2 -2
- package/lib/components/Modal/Modal.d.ts +5 -0
- package/lib/components/Modal/Modal.js +17 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +4 -1
- package/lib/components/NumberInput/NumberInput.js +2 -2
- package/lib/components/PaginationNav/PaginationNav.js +35 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.js +4 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/Select/Select.js +1 -1
- package/lib/components/Slug/index.js +1 -0
- package/lib/components/Tag/Tag.d.ts +18 -10
- package/lib/components/Tag/Tag.js +23 -7
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/components/Tile/Tile.js +2 -2
- package/lib/components/UIShell/Switcher.js +1 -1
- package/package.json +7 -7
- package/telemetry.yml +816 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ReactNode, type RefObject } from 'react';
|
|
2
|
+
import { ReactNodeLike } from 'prop-types';
|
|
2
3
|
export interface ModalBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
/** Specify the content to be placed in the ModalBody. */
|
|
4
5
|
children?: ReactNode;
|
|
@@ -69,6 +70,10 @@ export interface ComposedModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
69
70
|
/** Specify the CSS selectors that match the floating menus. */
|
|
70
71
|
selectorsFloatingMenus?: Array<string | null | undefined>;
|
|
71
72
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
73
|
+
/**
|
|
74
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComposedModal` component
|
|
75
|
+
*/
|
|
76
|
+
slug?: ReactNodeLike;
|
|
72
77
|
}
|
|
73
78
|
declare const ComposedModal: React.ForwardRefExoticComponent<ComposedModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
74
79
|
export default ComposedModal;
|
|
@@ -91,6 +91,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
91
91
|
selectorsFloatingMenus,
|
|
92
92
|
size,
|
|
93
93
|
launcherButtonRef,
|
|
94
|
+
slug,
|
|
94
95
|
...rest
|
|
95
96
|
} = _ref2;
|
|
96
97
|
const prefix = usePrefix.usePrefix();
|
|
@@ -159,7 +160,11 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
159
160
|
setIsOpen(false);
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
|
-
const modalClass = cx__default["default"](`${prefix}--modal`,
|
|
163
|
+
const modalClass = cx__default["default"](`${prefix}--modal`, {
|
|
164
|
+
'is-visible': isOpen,
|
|
165
|
+
[`${prefix}--modal--danger`]: danger,
|
|
166
|
+
[`${prefix}--modal--slug`]: slug
|
|
167
|
+
}, customClassName);
|
|
163
168
|
const containerClass = cx__default["default"](`${prefix}--modal-container`, size && `${prefix}--modal-container--${size}`, isFullWidth && `${prefix}--modal-container--full-width`, containerClassName);
|
|
164
169
|
|
|
165
170
|
// Generate aria-label based on Modal Header label if one is not provided (L253)
|
|
@@ -212,6 +217,14 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
212
217
|
focusButton(innerModal.current);
|
|
213
218
|
}
|
|
214
219
|
}, [open, selectorPrimaryFocus, isOpen]);
|
|
220
|
+
|
|
221
|
+
// Slug is always size `lg`
|
|
222
|
+
let normalizedSlug;
|
|
223
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
224
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
225
|
+
size: 'lg'
|
|
226
|
+
});
|
|
227
|
+
}
|
|
215
228
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
216
229
|
role: "presentation",
|
|
217
230
|
ref: ref,
|
|
@@ -233,7 +246,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
233
246
|
}, "Focus sentinel"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
234
247
|
ref: innerModal,
|
|
235
248
|
className: `${prefix}--modal-container-body`
|
|
236
|
-
}, childrenWithProps), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
249
|
+
}, normalizedSlug, childrenWithProps), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
237
250
|
type: "button",
|
|
238
251
|
ref: endSentinel,
|
|
239
252
|
className: `${prefix}--visually-hidden`
|
|
@@ -303,7 +316,11 @@ ComposedModal.propTypes = {
|
|
|
303
316
|
/**
|
|
304
317
|
* Specify the size variant.
|
|
305
318
|
*/
|
|
306
|
-
size: PropTypes__default["default"].oneOf(['xs', 'sm', 'md', 'lg'])
|
|
319
|
+
size: PropTypes__default["default"].oneOf(['xs', 'sm', 'md', 'lg']),
|
|
320
|
+
/**
|
|
321
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComposedModal` component
|
|
322
|
+
*/
|
|
323
|
+
slug: PropTypes__default["default"].node
|
|
307
324
|
};
|
|
308
325
|
|
|
309
326
|
exports.ModalBody = ModalBody;
|
|
@@ -140,7 +140,7 @@ class ContentSwitcher extends React__default["default"].Component {
|
|
|
140
140
|
className: classes,
|
|
141
141
|
role: "tablist",
|
|
142
142
|
onChange: undefined
|
|
143
|
-
}), children && React__default["default"].Children.
|
|
143
|
+
}), children && React__default["default"].Children.toArray(children).map((child, index) => /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
144
144
|
index,
|
|
145
145
|
onClick: events.composeEventHandlers([this.handleChildChange, child.props.onClick]),
|
|
146
146
|
onKeyDown: this.handleChildChange,
|
|
@@ -108,7 +108,7 @@ const DatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(functi
|
|
|
108
108
|
|
|
109
109
|
// Slug is always size `mini`
|
|
110
110
|
let normalizedSlug;
|
|
111
|
-
if (slug) {
|
|
111
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
112
112
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
113
113
|
size: 'mini'
|
|
114
114
|
});
|
|
@@ -238,7 +238,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
238
238
|
|
|
239
239
|
// Slug is always size `mini`
|
|
240
240
|
let normalizedSlug;
|
|
241
|
-
if (slug) {
|
|
241
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
242
242
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
243
243
|
size: 'mini'
|
|
244
244
|
});
|
|
@@ -254,10 +254,10 @@ function getClassNameForBreakpoints(breakpoints, prefix) {
|
|
|
254
254
|
continue;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
// If our breakpoint is a string, the user
|
|
257
|
+
// If our breakpoint is a string, the user might have specified a percent
|
|
258
258
|
// they'd like this column to span.
|
|
259
259
|
if (typeof breakpoint === 'string') {
|
|
260
|
-
classNames.push(`${prefix}--${name}:col-span-${breakpoint.
|
|
260
|
+
classNames.push(`${prefix}--${name}:col-span-${breakpoint.replace('%', '')}`);
|
|
261
261
|
continue;
|
|
262
262
|
}
|
|
263
263
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import { ReactNodeLike } from 'prop-types';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import { ReactAttr } from '../../types/common';
|
|
9
10
|
import { InlineLoadingStatus } from '../InlineLoading/InlineLoading';
|
|
@@ -150,6 +151,10 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
150
151
|
* Specify the size variant.
|
|
151
152
|
*/
|
|
152
153
|
size?: ModalSize;
|
|
154
|
+
/**
|
|
155
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
|
|
156
|
+
*/
|
|
157
|
+
slug?: ReactNodeLike;
|
|
153
158
|
}
|
|
154
159
|
declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
155
160
|
export default Modal;
|
|
@@ -69,6 +69,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
69
69
|
loadingDescription,
|
|
70
70
|
loadingIconDescription,
|
|
71
71
|
onLoadingSuccess = noopFn.noopFn,
|
|
72
|
+
slug,
|
|
72
73
|
...rest
|
|
73
74
|
} = _ref;
|
|
74
75
|
const prefix = usePrefix.usePrefix();
|
|
@@ -134,7 +135,8 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
134
135
|
const modalClasses = cx__default["default"](`${prefix}--modal`, {
|
|
135
136
|
[`${prefix}--modal-tall`]: !passiveModal,
|
|
136
137
|
'is-visible': open,
|
|
137
|
-
[`${prefix}--modal--danger`]: danger
|
|
138
|
+
[`${prefix}--modal--danger`]: danger,
|
|
139
|
+
[`${prefix}--modal--slug`]: slug
|
|
138
140
|
}, className);
|
|
139
141
|
const containerClasses = cx__default["default"](`${prefix}--modal-container`, {
|
|
140
142
|
[`${prefix}--modal-container--${size}`]: size,
|
|
@@ -201,6 +203,14 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
201
203
|
focusButton(innerModal.current);
|
|
202
204
|
}
|
|
203
205
|
}, [open, selectorPrimaryFocus, danger, prefix]);
|
|
206
|
+
|
|
207
|
+
// Slug is always size `lg`
|
|
208
|
+
let normalizedSlug;
|
|
209
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
210
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
211
|
+
size: 'lg'
|
|
212
|
+
});
|
|
213
|
+
}
|
|
204
214
|
const modalButton = /*#__PURE__*/React__default["default"].createElement("button", {
|
|
205
215
|
className: modalCloseButtonClass,
|
|
206
216
|
type: "button",
|
|
@@ -232,7 +242,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
232
242
|
as: "h3",
|
|
233
243
|
id: modalHeadingId,
|
|
234
244
|
className: `${prefix}--modal-header__heading`
|
|
235
|
-
}, modalHeading), !passiveModal && modalButton), /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
245
|
+
}, modalHeading), normalizedSlug, !passiveModal && modalButton), /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
236
246
|
id: modalBodyId,
|
|
237
247
|
className: contentClasses
|
|
238
248
|
}, hasScrollingContentProps), children), hasScrollingContent && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -442,7 +452,11 @@ Modal.propTypes = {
|
|
|
442
452
|
/**
|
|
443
453
|
* Specify the size variant.
|
|
444
454
|
*/
|
|
445
|
-
size: PropTypes__default["default"].oneOf(ModalSizes)
|
|
455
|
+
size: PropTypes__default["default"].oneOf(ModalSizes),
|
|
456
|
+
/**
|
|
457
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Modal` component
|
|
458
|
+
*/
|
|
459
|
+
slug: PropTypes__default["default"].node
|
|
446
460
|
};
|
|
447
461
|
|
|
448
462
|
exports.ModalSizes = ModalSizes;
|
|
@@ -205,7 +205,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
205
205
|
|
|
206
206
|
// Slug is always size `mini`
|
|
207
207
|
let normalizedSlug;
|
|
208
|
-
if (slug) {
|
|
208
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
209
209
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
210
210
|
size: 'mini'
|
|
211
211
|
});
|
|
@@ -248,6 +248,9 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
248
248
|
if (changes.selectedItem === undefined) {
|
|
249
249
|
break;
|
|
250
250
|
}
|
|
251
|
+
if (Array.isArray(changes.selectedItem)) {
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
251
254
|
onItemChange(changes.selectedItem);
|
|
252
255
|
return {
|
|
253
256
|
...changes,
|
|
@@ -309,7 +312,7 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
309
312
|
|
|
310
313
|
// Slug is always size `mini`
|
|
311
314
|
let normalizedSlug;
|
|
312
|
-
if (slug) {
|
|
315
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
313
316
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
314
317
|
size: 'mini'
|
|
315
318
|
});
|
|
@@ -182,7 +182,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
182
182
|
|
|
183
183
|
// Slug is always size `mini`
|
|
184
184
|
let normalizedSlug;
|
|
185
|
-
if (slug) {
|
|
185
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
186
186
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
187
187
|
size: 'mini'
|
|
188
188
|
});
|
|
@@ -190,7 +190,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
190
190
|
|
|
191
191
|
// Need to update the internal value when the revert button is clicked
|
|
192
192
|
let isRevertActive;
|
|
193
|
-
if (slug) {
|
|
193
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
194
194
|
isRevertActive = normalizedSlug.props.revertActive;
|
|
195
195
|
}
|
|
196
196
|
React.useEffect(() => {
|
|
@@ -113,9 +113,28 @@ function PaginationOverflow(_ref3) {
|
|
|
113
113
|
fromIndex,
|
|
114
114
|
count,
|
|
115
115
|
onSelect,
|
|
116
|
+
// eslint-disable-next-line react/prop-types
|
|
117
|
+
disableOverflow,
|
|
116
118
|
translateWithId: t = translateWithId
|
|
117
119
|
} = _ref3;
|
|
118
120
|
const prefix = usePrefix.usePrefix();
|
|
121
|
+
|
|
122
|
+
//If overflow is disabled, return a select tag with no select options
|
|
123
|
+
if (disableOverflow === true && count > 1) {
|
|
124
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
125
|
+
className: `${prefix}--pagination-nav__list-item`
|
|
126
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
127
|
+
className: `${prefix}--pagination-nav__select`
|
|
128
|
+
}, /*#__PURE__*/React__default["default"].createElement("select", {
|
|
129
|
+
className: `${prefix}--pagination-nav__page ${prefix}--pagination-nav__page--select`,
|
|
130
|
+
"aria-label": `Select ${t('carbon.pagination-nav.item')} number`,
|
|
131
|
+
disabled: true
|
|
132
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
133
|
+
className: `${prefix}--pagination-nav__select-icon-wrapper`
|
|
134
|
+
}, /*#__PURE__*/React__default["default"].createElement(iconsReact.OverflowMenuHorizontal, {
|
|
135
|
+
className: `${prefix}--pagination-nav__select-icon`
|
|
136
|
+
}))));
|
|
137
|
+
}
|
|
119
138
|
if (count > 1) {
|
|
120
139
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
121
140
|
className: `${prefix}--pagination-nav__list-item`
|
|
@@ -157,6 +176,7 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
157
176
|
className,
|
|
158
177
|
onChange = () => {},
|
|
159
178
|
totalItems,
|
|
179
|
+
disableOverflow,
|
|
160
180
|
itemsShown = 10,
|
|
161
181
|
page = 0,
|
|
162
182
|
loop = false,
|
|
@@ -168,6 +188,7 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
168
188
|
const [cuts, setCuts] = React.useState(getCuts(currentPage, totalItems, itemsThatFit));
|
|
169
189
|
const prevPage = usePrevious(currentPage);
|
|
170
190
|
const prefix = usePrefix.usePrefix();
|
|
191
|
+
const [isOverflowDisabled, setIsOverFlowDisabled] = React.useState(disableOverflow);
|
|
171
192
|
function jumpToItem(index) {
|
|
172
193
|
if (index >= 0 && index < totalItems) {
|
|
173
194
|
setCurrentPage(index);
|
|
@@ -226,6 +247,9 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
226
247
|
}
|
|
227
248
|
}, [currentPage]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
228
249
|
|
|
250
|
+
React.useEffect(() => {
|
|
251
|
+
setIsOverFlowDisabled(disableOverflow);
|
|
252
|
+
}, [disableOverflow]);
|
|
229
253
|
const classNames = cx__default["default"](`${prefix}--pagination-nav`, className);
|
|
230
254
|
const backwardButtonDisabled = !loop && currentPage === 0;
|
|
231
255
|
const forwardButtonDisabled = !loop && currentPage === totalItems - 1;
|
|
@@ -255,7 +279,8 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
255
279
|
}), /*#__PURE__*/React__default["default"].createElement(PaginationOverflow, {
|
|
256
280
|
fromIndex: startOffset,
|
|
257
281
|
count: cuts.front,
|
|
258
|
-
onSelect: jumpToItem
|
|
282
|
+
onSelect: jumpToItem,
|
|
283
|
+
disableOverflow: isOverflowDisabled
|
|
259
284
|
}),
|
|
260
285
|
// render items between overflows
|
|
261
286
|
[...Array(totalItems)].map((e, i) => i).slice(startOffset + cuts.front, (1 + cuts.back) * -1).map(item => /*#__PURE__*/React__default["default"].createElement(PaginationItem, {
|
|
@@ -269,7 +294,8 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
269
294
|
})), /*#__PURE__*/React__default["default"].createElement(PaginationOverflow, {
|
|
270
295
|
fromIndex: totalItems - cuts.back - 1,
|
|
271
296
|
count: cuts.back,
|
|
272
|
-
onSelect: jumpToItem
|
|
297
|
+
onSelect: jumpToItem,
|
|
298
|
+
disableOverflow: isOverflowDisabled
|
|
273
299
|
}),
|
|
274
300
|
// render last item unless there is only one in total
|
|
275
301
|
totalItems > 1 && /*#__PURE__*/React__default["default"].createElement(PaginationItem, {
|
|
@@ -352,6 +378,13 @@ PaginationNav.propTypes = {
|
|
|
352
378
|
* Additional CSS class names.
|
|
353
379
|
*/
|
|
354
380
|
className: PropTypes__default["default"].string,
|
|
381
|
+
/**
|
|
382
|
+
* If true, the '...' pagination overflow will not render page links between the first and last rendered buttons.
|
|
383
|
+
* Set this to true if you are having performance problems with large data sets.
|
|
384
|
+
*/
|
|
385
|
+
disableOverflow: PropTypes__default["default"].bool,
|
|
386
|
+
// eslint-disable-line react/prop-types
|
|
387
|
+
|
|
355
388
|
/**
|
|
356
389
|
* The number of items to be shown.
|
|
357
390
|
*/
|
|
@@ -61,6 +61,10 @@ function ProgressIndicator(_ref) {
|
|
|
61
61
|
return /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({
|
|
62
62
|
className: className
|
|
63
63
|
}, rest), React__default["default"].Children.map(children, (child, index) => {
|
|
64
|
+
if (! /*#__PURE__*/React__default["default"].isValidElement(child)) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
// only setup click handlers if onChange event is passed
|
|
65
69
|
const onClick = onChange ? () => onChange(index) : undefined;
|
|
66
70
|
if (index === currentIndex) {
|
|
@@ -114,7 +114,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
114
114
|
|
|
115
115
|
// Slug is always size `mini`
|
|
116
116
|
let normalizedSlug;
|
|
117
|
-
if (slug) {
|
|
117
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
118
118
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
119
119
|
size: 'mini',
|
|
120
120
|
kind: 'default'
|
|
@@ -138,7 +138,7 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
138
138
|
|
|
139
139
|
// Slug is always size `mini`
|
|
140
140
|
let normalizedSlug;
|
|
141
|
-
if (slug) {
|
|
141
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
142
142
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
143
143
|
size: 'mini'
|
|
144
144
|
});
|
|
@@ -135,6 +135,7 @@ const Slug = /*#__PURE__*/React__default["default"].forwardRef(function Slug(_re
|
|
|
135
135
|
className: `${prefix}--slug__additional-text`
|
|
136
136
|
}, aiTextLabel)), children));
|
|
137
137
|
});
|
|
138
|
+
Slug.displayName = 'Slug';
|
|
138
139
|
Slug.propTypes = {
|
|
139
140
|
/**
|
|
140
141
|
* Specify the correct translation of the AI text
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
7
|
+
import PropTypes, { ReactNodeLike } from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
declare const TYPES: {
|
|
@@ -23,7 +23,7 @@ declare const TYPES: {
|
|
|
23
23
|
};
|
|
24
24
|
export interface TagBaseProps {
|
|
25
25
|
/**
|
|
26
|
-
* Provide content to be rendered inside of a
|
|
26
|
+
* Provide content to be rendered inside of a `Tag`
|
|
27
27
|
*/
|
|
28
28
|
children?: React.ReactNode;
|
|
29
29
|
/**
|
|
@@ -31,11 +31,11 @@ export interface TagBaseProps {
|
|
|
31
31
|
*/
|
|
32
32
|
className?: string;
|
|
33
33
|
/**
|
|
34
|
-
* Specify if the
|
|
34
|
+
* Specify if the `Tag` is disabled
|
|
35
35
|
*/
|
|
36
36
|
disabled?: boolean;
|
|
37
37
|
/**
|
|
38
|
-
* Determine if
|
|
38
|
+
* Determine if `Tag` is a filter/chip
|
|
39
39
|
*/
|
|
40
40
|
filter?: boolean;
|
|
41
41
|
/**
|
|
@@ -56,18 +56,22 @@ export interface TagBaseProps {
|
|
|
56
56
|
* 'md' (default) sizes.
|
|
57
57
|
*/
|
|
58
58
|
size?: 'sm' | 'md';
|
|
59
|
+
/**
|
|
60
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
|
|
61
|
+
*/
|
|
62
|
+
slug?: ReactNodeLike;
|
|
59
63
|
/**
|
|
60
64
|
* Text to show on clear filters
|
|
61
65
|
*/
|
|
62
66
|
title?: string;
|
|
63
67
|
/**
|
|
64
|
-
* Specify the type of the
|
|
68
|
+
* Specify the type of the `Tag`
|
|
65
69
|
*/
|
|
66
70
|
type?: keyof typeof TYPES;
|
|
67
71
|
}
|
|
68
72
|
export type TagProps<T extends React.ElementType> = PolymorphicProps<T, TagBaseProps>;
|
|
69
73
|
declare const Tag: {
|
|
70
|
-
<T extends React.ElementType<any>>({ children, className, id, type, filter, renderIcon: CustomIconElement, title, disabled, onClose, size, as: BaseComponent, ...other }: TagProps<T>): JSX.Element;
|
|
74
|
+
<T extends React.ElementType<any>>({ children, className, id, type, filter, renderIcon: CustomIconElement, title, disabled, onClose, size, as: BaseComponent, slug, ...other }: TagProps<T>): JSX.Element;
|
|
71
75
|
propTypes: {
|
|
72
76
|
/**
|
|
73
77
|
* Provide an alternative tag or component to use instead of the default
|
|
@@ -75,7 +79,7 @@ declare const Tag: {
|
|
|
75
79
|
*/
|
|
76
80
|
as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
|
|
77
81
|
/**
|
|
78
|
-
* Provide content to be rendered inside of a
|
|
82
|
+
* Provide content to be rendered inside of a `Tag`
|
|
79
83
|
*/
|
|
80
84
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
81
85
|
/**
|
|
@@ -83,11 +87,11 @@ declare const Tag: {
|
|
|
83
87
|
*/
|
|
84
88
|
className: PropTypes.Requireable<string>;
|
|
85
89
|
/**
|
|
86
|
-
* Specify if the
|
|
90
|
+
* Specify if the `Tag` is disabled
|
|
87
91
|
*/
|
|
88
92
|
disabled: PropTypes.Requireable<boolean>;
|
|
89
93
|
/**
|
|
90
|
-
* Determine if
|
|
94
|
+
* Determine if `Tag` is a filter/chip
|
|
91
95
|
*/
|
|
92
96
|
filter: PropTypes.Requireable<boolean>;
|
|
93
97
|
/**
|
|
@@ -108,12 +112,16 @@ declare const Tag: {
|
|
|
108
112
|
* 'md' (default) sizes.
|
|
109
113
|
*/
|
|
110
114
|
size: PropTypes.Requireable<string>;
|
|
115
|
+
/**
|
|
116
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
|
|
117
|
+
*/
|
|
118
|
+
slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
111
119
|
/**
|
|
112
120
|
* Text to show on clear filters
|
|
113
121
|
*/
|
|
114
122
|
title: PropTypes.Requireable<string>;
|
|
115
123
|
/**
|
|
116
|
-
* Specify the type of the
|
|
124
|
+
* Specify the type of the `Tag`
|
|
117
125
|
*/
|
|
118
126
|
type: PropTypes.Requireable<string>;
|
|
119
127
|
};
|
|
@@ -54,6 +54,7 @@ const Tag = _ref => {
|
|
|
54
54
|
onClose,
|
|
55
55
|
size,
|
|
56
56
|
as: BaseComponent,
|
|
57
|
+
slug,
|
|
57
58
|
...other
|
|
58
59
|
} = _ref;
|
|
59
60
|
const prefix = usePrefix.usePrefix();
|
|
@@ -74,15 +75,26 @@ const Tag = _ref => {
|
|
|
74
75
|
onClose(event);
|
|
75
76
|
}
|
|
76
77
|
};
|
|
78
|
+
|
|
79
|
+
// Slug is always size `md` and `inline`
|
|
80
|
+
let normalizedSlug;
|
|
81
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
82
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
83
|
+
size: 'sm',
|
|
84
|
+
kind: 'inline'
|
|
85
|
+
});
|
|
86
|
+
}
|
|
77
87
|
if (filter) {
|
|
78
88
|
const ComponentTag = BaseComponent ?? 'div';
|
|
79
89
|
return /*#__PURE__*/React__default["default"].createElement(ComponentTag, _rollupPluginBabelHelpers["extends"]({
|
|
80
90
|
className: tagClasses,
|
|
81
91
|
id: tagId
|
|
82
|
-
}, other), /*#__PURE__*/React__default["default"].createElement(
|
|
92
|
+
}, other), CustomIconElement ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
93
|
+
className: `${prefix}--tag__custom-icon`
|
|
94
|
+
}, /*#__PURE__*/React__default["default"].createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
83
95
|
className: `${prefix}--tag__label`,
|
|
84
96
|
title: typeof children === 'string' ? children : undefined
|
|
85
|
-
}, children !== null && children !== undefined ? children : typeText), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
97
|
+
}, children !== null && children !== undefined ? children : typeText), normalizedSlug, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
86
98
|
type: "button",
|
|
87
99
|
className: `${prefix}--tag__close-icon`,
|
|
88
100
|
onClick: handleClose,
|
|
@@ -100,7 +112,7 @@ const Tag = _ref => {
|
|
|
100
112
|
className: `${prefix}--tag__custom-icon`
|
|
101
113
|
}, /*#__PURE__*/React__default["default"].createElement(CustomIconElement, null)) : '', /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
102
114
|
title: typeof children === 'string' ? children : undefined
|
|
103
|
-
}, children !== null && children !== undefined ? children : typeText));
|
|
115
|
+
}, children !== null && children !== undefined ? children : typeText), normalizedSlug);
|
|
104
116
|
};
|
|
105
117
|
Tag.propTypes = {
|
|
106
118
|
/**
|
|
@@ -109,7 +121,7 @@ Tag.propTypes = {
|
|
|
109
121
|
*/
|
|
110
122
|
as: PropTypes__default["default"].elementType,
|
|
111
123
|
/**
|
|
112
|
-
* Provide content to be rendered inside of a
|
|
124
|
+
* Provide content to be rendered inside of a `Tag`
|
|
113
125
|
*/
|
|
114
126
|
children: PropTypes__default["default"].node,
|
|
115
127
|
/**
|
|
@@ -117,11 +129,11 @@ Tag.propTypes = {
|
|
|
117
129
|
*/
|
|
118
130
|
className: PropTypes__default["default"].string,
|
|
119
131
|
/**
|
|
120
|
-
* Specify if the
|
|
132
|
+
* Specify if the `Tag` is disabled
|
|
121
133
|
*/
|
|
122
134
|
disabled: PropTypes__default["default"].bool,
|
|
123
135
|
/**
|
|
124
|
-
* Determine if
|
|
136
|
+
* Determine if `Tag` is a filter/chip
|
|
125
137
|
*/
|
|
126
138
|
filter: PropTypes__default["default"].bool,
|
|
127
139
|
/**
|
|
@@ -142,12 +154,16 @@ Tag.propTypes = {
|
|
|
142
154
|
* 'md' (default) sizes.
|
|
143
155
|
*/
|
|
144
156
|
size: PropTypes__default["default"].oneOf(['sm', 'md']),
|
|
157
|
+
/**
|
|
158
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
|
|
159
|
+
*/
|
|
160
|
+
slug: PropTypes__default["default"].node,
|
|
145
161
|
/**
|
|
146
162
|
* Text to show on clear filters
|
|
147
163
|
*/
|
|
148
164
|
title: PropTypes__default["default"].string,
|
|
149
165
|
/**
|
|
150
|
-
* Specify the type of the
|
|
166
|
+
* Specify the type of the `Tag`
|
|
151
167
|
*/
|
|
152
168
|
type: PropTypes__default["default"].oneOf(Object.keys(TYPES))
|
|
153
169
|
};
|
|
@@ -236,7 +236,7 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
236
236
|
|
|
237
237
|
// Slug is always size `mini`
|
|
238
238
|
let normalizedSlug;
|
|
239
|
-
if (slug) {
|
|
239
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
240
240
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
241
241
|
size: 'mini'
|
|
242
242
|
});
|
|
@@ -167,7 +167,7 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef(function Tex
|
|
|
167
167
|
|
|
168
168
|
// Slug is always size `mini`
|
|
169
169
|
let normalizedSlug;
|
|
170
|
-
if (slug) {
|
|
170
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
171
171
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
172
172
|
size: 'mini'
|
|
173
173
|
});
|
|
@@ -279,7 +279,7 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
279
279
|
// Slug is always size `xs`
|
|
280
280
|
const slugRef = React.useRef(null);
|
|
281
281
|
let normalizedSlug;
|
|
282
|
-
if (slug) {
|
|
282
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
283
283
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
284
284
|
size: 'xs',
|
|
285
285
|
ref: slugRef
|
|
@@ -504,7 +504,7 @@ const ExpandableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
504
504
|
|
|
505
505
|
// Slug is always size `xs`
|
|
506
506
|
let normalizedSlug;
|
|
507
|
-
if (slug) {
|
|
507
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
508
508
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
509
509
|
size: 'xs'
|
|
510
510
|
});
|
|
@@ -70,7 +70,7 @@ const Switcher = /*#__PURE__*/React.forwardRef(function Switcher(props, forwardR
|
|
|
70
70
|
switcherItem.focus();
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
const childrenWithProps = React__default["default"].Children.
|
|
73
|
+
const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) => {
|
|
74
74
|
// only setup click handlers if onChange event is passed
|
|
75
75
|
if ( /*#__PURE__*/React__default["default"].isValidElement(child) && child.type && getDisplayName["default"](child.type) === 'Switcher') {
|
|
76
76
|
return /*#__PURE__*/React__default["default"].cloneElement(child, {
|
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.46.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"icons/index.esm.js",
|
|
21
21
|
"icons/index.d.ts",
|
|
22
22
|
"icons/package.json",
|
|
23
|
-
".playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json"
|
|
23
|
+
".playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json",
|
|
24
|
+
"telemetry.yml"
|
|
24
25
|
],
|
|
25
26
|
"keywords": [
|
|
26
27
|
"ibm",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
"scripts": {
|
|
37
38
|
"build": "yarn clean && node tasks/build-styles.js && node tasks/build.js",
|
|
38
39
|
"clean": "rimraf es lib icons/index.js icons/index.d.ts icons/index.esm.js storybook-static",
|
|
39
|
-
"postinstall": "
|
|
40
|
+
"postinstall": "npx -y @ibm/telemetry-js --config=telemetry.yml",
|
|
40
41
|
"storybook": "storybook dev -p 3000",
|
|
41
42
|
"storybook:build": "storybook build"
|
|
42
43
|
},
|
|
@@ -48,10 +49,9 @@
|
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"@babel/runtime": "^7.18.3",
|
|
50
51
|
"@carbon/feature-flags": "^0.16.0",
|
|
51
|
-
"@carbon/icons-react": "^11.
|
|
52
|
+
"@carbon/icons-react": "^11.33.0-rc.0",
|
|
52
53
|
"@carbon/layout": "^11.20.0",
|
|
53
|
-
"@carbon/styles": "^1.
|
|
54
|
-
"@carbon/telemetry": "0.1.0",
|
|
54
|
+
"@carbon/styles": "^1.46.0-rc.0",
|
|
55
55
|
"classnames": "2.3.2",
|
|
56
56
|
"copy-to-clipboard": "^3.3.1",
|
|
57
57
|
"downshift": "8.2.3",
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"**/*.scss",
|
|
138
138
|
"**/*.css"
|
|
139
139
|
],
|
|
140
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "89fe49b63bf2b4b5902d30f3bfeff2face55897e"
|
|
141
141
|
}
|