@carbon/react 1.44.0-rc.0 → 1.45.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 +1009 -1050
- package/es/components/Accordion/AccordionItem.d.ts +1 -1
- package/es/components/Accordion/AccordionItem.js +19 -15
- package/es/components/Checkbox/Checkbox.d.ts +4 -0
- package/es/components/Checkbox/Checkbox.js +15 -2
- package/es/components/CheckboxGroup/CheckboxGroup.js +17 -2
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComboBox/ComboBox.js +1 -1
- package/es/components/ComboButton/index.js +1 -1
- package/es/components/ComposedModal/ModalFooter.d.ts +2 -1
- package/es/components/DataTable/DataTable.d.ts +2 -0
- package/es/components/DataTable/DataTable.js +3 -0
- package/es/components/DataTable/TableExpandRow.js +20 -3
- package/es/components/DataTable/TableHeader.d.ts +5 -0
- package/es/components/DataTable/TableHeader.js +30 -6
- package/es/components/DataTable/TableSlugRow.d.ts +31 -0
- package/es/components/DataTable/TableSlugRow.js +49 -0
- package/es/components/DataTable/index.d.ts +2 -1
- package/es/components/DataTable/index.js +3 -0
- package/es/components/DataTable/tools/sorting.js +1 -1
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +1 -1
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +1 -1
- package/es/components/FileUploader/FileUploader.js +5 -3
- package/es/components/Grid/Column.js +11 -1
- package/es/components/InlineLoading/InlineLoading.d.ts +68 -0
- package/es/components/InlineLoading/InlineLoading.js +4 -4
- package/es/components/InlineLoading/index.d.ts +9 -0
- package/es/components/Layer/LayerContext.d.ts +8 -0
- package/es/components/Layer/LayerLevel.d.ts +5 -0
- package/es/components/Layer/LayerLevel.js +12 -0
- package/es/components/Layer/index.d.ts +38 -0
- package/es/components/Layer/index.js +9 -8
- package/es/components/Menu/MenuItem.js +2 -1
- package/es/components/MenuButton/index.js +8 -2
- package/es/components/Modal/Modal.d.ts +3 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +1 -1
- package/es/components/Notification/Notification.js +1 -0
- package/es/components/NumberInput/NumberInput.d.ts +1 -1
- package/es/components/NumberInput/NumberInput.js +1 -1
- package/es/components/RadioButton/RadioButton.d.ts +4 -0
- package/es/components/RadioButton/RadioButton.js +15 -2
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
- package/es/components/Select/Select.d.ts +2 -2
- package/es/components/Select/Select.js +1 -1
- package/es/components/Slider/Slider.Skeleton.js +17 -3
- package/es/components/Slider/Slider.js +132 -93
- package/es/components/Slider/SliderHandles.d.ts +4 -0
- package/es/components/Slider/SliderHandles.js +65 -0
- package/es/components/Slug/index.js +1 -1
- package/es/components/Tabs/Tabs.js +1 -1
- package/es/components/TextArea/TextArea.d.ts +7 -3
- package/es/components/TextArea/TextArea.js +84 -17
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +1 -1
- package/es/components/Tile/Tile.d.ts +37 -0
- package/es/components/Tile/Tile.js +114 -13
- package/es/components/Tooltip/Tooltip.js +48 -2
- package/es/components/UIShell/Content.d.ts +296 -0
- package/es/components/UIShell/Content.js +1 -2
- package/es/components/UIShell/HeaderPanel.d.ts +36 -0
- package/es/components/UIShell/HeaderPanel.js +6 -6
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/index.js +2 -1
- package/es/internal/useAnnouncer.js +2 -1
- package/es/internal/useNoInteractiveChildren.js +2 -6
- package/lib/components/Accordion/AccordionItem.d.ts +1 -1
- package/lib/components/Accordion/AccordionItem.js +18 -14
- package/lib/components/Checkbox/Checkbox.d.ts +4 -0
- package/lib/components/Checkbox/Checkbox.js +15 -2
- package/lib/components/CheckboxGroup/CheckboxGroup.js +17 -2
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.js +1 -1
- package/lib/components/ComboButton/index.js +1 -1
- package/lib/components/ComposedModal/ModalFooter.d.ts +2 -1
- package/lib/components/DataTable/DataTable.d.ts +2 -0
- package/lib/components/DataTable/DataTable.js +3 -0
- package/lib/components/DataTable/TableExpandRow.js +20 -3
- package/lib/components/DataTable/TableHeader.d.ts +5 -0
- package/lib/components/DataTable/TableHeader.js +29 -5
- package/lib/components/DataTable/TableSlugRow.d.ts +31 -0
- package/lib/components/DataTable/TableSlugRow.js +59 -0
- package/lib/components/DataTable/index.d.ts +2 -1
- package/lib/components/DataTable/index.js +3 -0
- package/lib/components/DataTable/tools/sorting.js +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +1 -1
- package/lib/components/FileUploader/FileUploader.js +5 -3
- package/lib/components/Grid/Column.js +11 -1
- package/lib/components/InlineLoading/InlineLoading.d.ts +68 -0
- package/lib/components/InlineLoading/InlineLoading.js +4 -4
- package/lib/components/InlineLoading/index.d.ts +9 -0
- package/lib/components/Layer/LayerContext.d.ts +8 -0
- package/lib/components/Layer/LayerLevel.d.ts +5 -0
- package/lib/components/Layer/LayerLevel.js +18 -0
- package/lib/components/Layer/index.d.ts +38 -0
- package/lib/components/Layer/index.js +10 -9
- package/lib/components/Menu/MenuItem.js +2 -1
- package/lib/components/MenuButton/index.js +8 -2
- package/lib/components/Modal/Modal.d.ts +3 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +1 -1
- package/lib/components/Notification/Notification.js +1 -0
- package/lib/components/NumberInput/NumberInput.d.ts +1 -1
- package/lib/components/NumberInput/NumberInput.js +1 -1
- package/lib/components/RadioButton/RadioButton.d.ts +4 -0
- package/lib/components/RadioButton/RadioButton.js +15 -2
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
- package/lib/components/Select/Select.d.ts +2 -2
- package/lib/components/Select/Select.js +1 -1
- package/lib/components/Slider/Slider.Skeleton.js +17 -3
- package/lib/components/Slider/Slider.js +132 -93
- package/lib/components/Slider/SliderHandles.d.ts +4 -0
- package/lib/components/Slider/SliderHandles.js +76 -0
- package/lib/components/Slug/index.js +1 -1
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/TextArea/TextArea.d.ts +7 -3
- package/lib/components/TextArea/TextArea.js +83 -16
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/components/Tile/Tile.d.ts +37 -0
- package/lib/components/Tile/Tile.js +114 -13
- package/lib/components/Tooltip/Tooltip.js +47 -1
- package/lib/components/UIShell/Content.d.ts +296 -0
- package/lib/components/UIShell/Content.js +1 -2
- package/lib/components/UIShell/HeaderPanel.d.ts +36 -0
- package/lib/components/UIShell/HeaderPanel.js +7 -7
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/index.js +4 -2
- package/lib/internal/useAnnouncer.js +2 -1
- package/lib/internal/useNoInteractiveChildren.js +2 -6
- package/package.json +5 -8
|
@@ -47,7 +47,7 @@ interface AccordionItemProps {
|
|
|
47
47
|
* The callback function to run on the `onAnimationEnd`
|
|
48
48
|
* event for the list item.
|
|
49
49
|
*/
|
|
50
|
-
handleAnimationEnd?: AnimationEventHandler<
|
|
50
|
+
handleAnimationEnd?: AnimationEventHandler<HTMLElement>;
|
|
51
51
|
}
|
|
52
52
|
interface AccordionToggleProps {
|
|
53
53
|
'aria-controls'?: AriaAttributes['aria-controls'];
|
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import { ChevronRight } from '@carbon/icons-react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React__default, { useState, useContext } from 'react';
|
|
12
|
+
import React__default, { useState, useContext, useRef } from 'react';
|
|
13
13
|
import '../Text/index.js';
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
15
15
|
import deprecate from '../../prop-types/deprecate.js';
|
|
@@ -37,8 +37,6 @@ function AccordionItem(_ref) {
|
|
|
37
37
|
...rest
|
|
38
38
|
} = _ref;
|
|
39
39
|
const [isOpen, setIsOpen] = useState(open);
|
|
40
|
-
const [prevIsOpen, setPrevIsOpen] = useState(open);
|
|
41
|
-
const [animation, setAnimation] = useState('');
|
|
42
40
|
const accordionState = useContext(AccordionContext);
|
|
43
41
|
const disabledIsControlled = typeof controlledDisabled === 'boolean';
|
|
44
42
|
const disabled = disabledIsControlled ? controlledDisabled : accordionState.disabled;
|
|
@@ -47,23 +45,28 @@ function AccordionItem(_ref) {
|
|
|
47
45
|
const className = cx({
|
|
48
46
|
[`${prefix}--accordion__item`]: true,
|
|
49
47
|
[`${prefix}--accordion__item--active`]: isOpen,
|
|
50
|
-
[`${prefix}--accordion__item--${animation}`]: animation,
|
|
51
48
|
[`${prefix}--accordion__item--disabled`]: disabled,
|
|
52
49
|
[customClassName]: !!customClassName
|
|
53
50
|
});
|
|
54
51
|
const Toggle = renderToggle || renderExpando; // remove renderExpando in next major release
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
setAnimation(isOpen ? 'collapsing' : 'expanding');
|
|
58
|
-
setIsOpen(open);
|
|
59
|
-
setPrevIsOpen(open);
|
|
60
|
-
}
|
|
53
|
+
const content = useRef(null);
|
|
61
54
|
|
|
62
55
|
// When the AccordionItem heading is clicked, toggle the open state of the
|
|
63
56
|
// panel
|
|
64
57
|
function onClick(event) {
|
|
58
|
+
// type guard for ref
|
|
59
|
+
if (!content.current) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (isOpen) {
|
|
63
|
+
// accordion closes
|
|
64
|
+
content.current.style.maxBlockSize = '';
|
|
65
|
+
} else {
|
|
66
|
+
// accordion opens
|
|
67
|
+
content.current.style.maxBlockSize = content.current.scrollHeight + 15 + 'px';
|
|
68
|
+
}
|
|
65
69
|
const nextValue = !isOpen;
|
|
66
|
-
setAnimation(isOpen ? 'collapsing' : 'expanding');
|
|
67
70
|
setIsOpen(nextValue);
|
|
68
71
|
if (onHeadingClick) {
|
|
69
72
|
// TODO: normalize signature, potentially:
|
|
@@ -85,13 +88,10 @@ function AccordionItem(_ref) {
|
|
|
85
88
|
if (handleAnimationEnd) {
|
|
86
89
|
handleAnimationEnd(event);
|
|
87
90
|
}
|
|
88
|
-
setAnimation('');
|
|
89
91
|
}
|
|
90
92
|
return /*#__PURE__*/React__default.createElement("li", _extends({
|
|
91
93
|
className: className
|
|
92
|
-
}, rest, {
|
|
93
|
-
onAnimationEnd: onAnimationEnd
|
|
94
|
-
}), /*#__PURE__*/React__default.createElement(Toggle, {
|
|
94
|
+
}, rest), /*#__PURE__*/React__default.createElement(Toggle, {
|
|
95
95
|
disabled: disabled,
|
|
96
96
|
"aria-controls": id,
|
|
97
97
|
"aria-expanded": isOpen,
|
|
@@ -105,9 +105,13 @@ function AccordionItem(_ref) {
|
|
|
105
105
|
as: "div",
|
|
106
106
|
className: `${prefix}--accordion__title`
|
|
107
107
|
}, title)), /*#__PURE__*/React__default.createElement("div", {
|
|
108
|
+
ref: content,
|
|
109
|
+
className: `${prefix}--accordion__wrapper`,
|
|
110
|
+
onTransitionEnd: onAnimationEnd
|
|
111
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
108
112
|
id: id,
|
|
109
113
|
className: `${prefix}--accordion__content`
|
|
110
|
-
}, children));
|
|
114
|
+
}, children)));
|
|
111
115
|
}
|
|
112
116
|
AccordionItem.propTypes = {
|
|
113
117
|
/**
|
|
@@ -45,6 +45,10 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
45
45
|
* Provide the text that is displayed when the Checkbox is in an invalid state
|
|
46
46
|
*/
|
|
47
47
|
invalidText?: React.ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
50
|
+
*/
|
|
51
|
+
slug?: ReactNodeLike;
|
|
48
52
|
/**
|
|
49
53
|
* Specify whether the Checkbox is currently invalid
|
|
50
54
|
*/
|
|
@@ -33,6 +33,7 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
33
33
|
title = '',
|
|
34
34
|
warn,
|
|
35
35
|
warnText,
|
|
36
|
+
slug,
|
|
36
37
|
...other
|
|
37
38
|
} = _ref;
|
|
38
39
|
const prefix = usePrefix();
|
|
@@ -47,11 +48,19 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
47
48
|
const wrapperClasses = cx(`${prefix}--form-item`, `${prefix}--checkbox-wrapper`, className, {
|
|
48
49
|
[`${prefix}--checkbox-wrapper--readonly`]: readOnly,
|
|
49
50
|
[`${prefix}--checkbox-wrapper--invalid`]: !readOnly && invalid,
|
|
50
|
-
[`${prefix}--checkbox-wrapper--warning`]: showWarning
|
|
51
|
+
[`${prefix}--checkbox-wrapper--warning`]: showWarning,
|
|
52
|
+
[`${prefix}--checkbox-wrapper--slug`]: slug
|
|
51
53
|
});
|
|
52
54
|
const innerLabelClasses = cx(`${prefix}--checkbox-label-text`, {
|
|
53
55
|
[`${prefix}--visually-hidden`]: hideLabel
|
|
54
56
|
});
|
|
57
|
+
let normalizedSlug;
|
|
58
|
+
if (slug && /*#__PURE__*/React__default.isValidElement(slug)) {
|
|
59
|
+
const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
|
|
60
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
61
|
+
size
|
|
62
|
+
});
|
|
63
|
+
}
|
|
55
64
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
56
65
|
className: wrapperClasses
|
|
57
66
|
}, /*#__PURE__*/React__default.createElement("input", _extends({}, other, {
|
|
@@ -97,7 +106,7 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
97
106
|
title: title
|
|
98
107
|
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
99
108
|
className: innerLabelClasses
|
|
100
|
-
}, labelText)), /*#__PURE__*/React__default.createElement("div", {
|
|
109
|
+
}, labelText, normalizedSlug)), /*#__PURE__*/React__default.createElement("div", {
|
|
101
110
|
className: `${prefix}--checkbox__validation-msg`
|
|
102
111
|
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
103
112
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -165,6 +174,10 @@ Checkbox.propTypes = {
|
|
|
165
174
|
* Specify whether the Checkbox is read-only
|
|
166
175
|
*/
|
|
167
176
|
readOnly: PropTypes.bool,
|
|
177
|
+
/**
|
|
178
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
179
|
+
*/
|
|
180
|
+
slug: PropTypes.node,
|
|
168
181
|
/**
|
|
169
182
|
* Specify a title for the <label> node for the Checkbox
|
|
170
183
|
*/
|
|
@@ -26,6 +26,7 @@ function CheckboxGroup(_ref) {
|
|
|
26
26
|
readOnly,
|
|
27
27
|
warn,
|
|
28
28
|
warnText,
|
|
29
|
+
slug,
|
|
29
30
|
...rest
|
|
30
31
|
} = _ref;
|
|
31
32
|
const prefix = usePrefix();
|
|
@@ -40,8 +41,18 @@ function CheckboxGroup(_ref) {
|
|
|
40
41
|
const fieldsetClasses = cx(`${prefix}--checkbox-group`, className, {
|
|
41
42
|
[`${prefix}--checkbox-group--readonly`]: readOnly,
|
|
42
43
|
[`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
|
|
43
|
-
[`${prefix}--checkbox-group--warning`]: showWarning
|
|
44
|
+
[`${prefix}--checkbox-group--warning`]: showWarning,
|
|
45
|
+
[`${prefix}--checkbox-group--slug`]: slug
|
|
44
46
|
});
|
|
47
|
+
|
|
48
|
+
// Slug is always size `mini`
|
|
49
|
+
let normalizedSlug;
|
|
50
|
+
if (slug) {
|
|
51
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
52
|
+
size: 'mini',
|
|
53
|
+
kind: 'default'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
45
56
|
return /*#__PURE__*/React__default.createElement("fieldset", _extends({
|
|
46
57
|
className: fieldsetClasses,
|
|
47
58
|
"data-invalid": invalid ? true : undefined,
|
|
@@ -51,7 +62,7 @@ function CheckboxGroup(_ref) {
|
|
|
51
62
|
}, rest), /*#__PURE__*/React__default.createElement("legend", {
|
|
52
63
|
className: `${prefix}--label`,
|
|
53
64
|
id: legendId || rest['aria-labelledby']
|
|
54
|
-
}, legendText), children, /*#__PURE__*/React__default.createElement("div", {
|
|
65
|
+
}, legendText, normalizedSlug), children, /*#__PURE__*/React__default.createElement("div", {
|
|
55
66
|
className: `${prefix}--checkbox-group__validation-msg`
|
|
56
67
|
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
57
68
|
className: `${prefix}--checkbox__invalid-icon`
|
|
@@ -97,6 +108,10 @@ CheckboxGroup.propTypes = {
|
|
|
97
108
|
* Whether the CheckboxGroup should be read-only
|
|
98
109
|
*/
|
|
99
110
|
readOnly: PropTypes.bool,
|
|
111
|
+
/**
|
|
112
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
|
|
113
|
+
*/
|
|
114
|
+
slug: PropTypes.node,
|
|
100
115
|
/**
|
|
101
116
|
* Specify whether the form group is currently in warning state
|
|
102
117
|
*/
|
|
@@ -137,7 +137,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
|
|
|
137
137
|
*/
|
|
138
138
|
size?: ListBoxSize;
|
|
139
139
|
/**
|
|
140
|
-
* Provide a `Slug` component to be rendered inside the `ComboBox` component
|
|
140
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
|
|
141
141
|
*/
|
|
142
142
|
slug?: ReactNodeLike;
|
|
143
143
|
/**
|
|
@@ -575,7 +575,7 @@ ComboBox.propTypes = {
|
|
|
575
575
|
*/
|
|
576
576
|
size: ListBoxSize,
|
|
577
577
|
/**
|
|
578
|
-
* Provide a `Slug` component to be rendered inside the `ComboBox` component
|
|
578
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
|
|
579
579
|
*/
|
|
580
580
|
slug: PropTypes.node,
|
|
581
581
|
/**
|
|
@@ -20,7 +20,7 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
|
20
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
21
21
|
|
|
22
22
|
var _ChevronDown;
|
|
23
|
-
const spacing =
|
|
23
|
+
const spacing = 0; // top and bottom spacing between the button and the menu. in px
|
|
24
24
|
const defaultTranslations = {
|
|
25
25
|
'carbon.combo-button.additional-actions': 'Additional actions'
|
|
26
26
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode, type MouseEvent, type Ref } from 'react';
|
|
2
|
+
import { InlineLoadingStatus } from '../InlineLoading/InlineLoading';
|
|
2
3
|
interface SecondaryButtonProps {
|
|
3
4
|
buttonText: ReactNode;
|
|
4
5
|
onClick(evt: MouseEvent): void;
|
|
@@ -70,7 +71,7 @@ export interface ModalFooterProps {
|
|
|
70
71
|
/**
|
|
71
72
|
* loading status
|
|
72
73
|
*/
|
|
73
|
-
loadingStatus?:
|
|
74
|
+
loadingStatus?: InlineLoadingStatus;
|
|
74
75
|
/**
|
|
75
76
|
* Specify the description for the loading text
|
|
76
77
|
*/
|
|
@@ -22,6 +22,7 @@ import TableHeader from './TableHeader';
|
|
|
22
22
|
import TableRow from './TableRow';
|
|
23
23
|
import TableSelectAll from './TableSelectAll';
|
|
24
24
|
import TableSelectRow from './TableSelectRow';
|
|
25
|
+
import TableSlugRow from './TableSlugRow';
|
|
25
26
|
import TableToolbar from './TableToolbar';
|
|
26
27
|
import TableToolbarAction from './TableToolbarAction';
|
|
27
28
|
import TableToolbarContent from './TableToolbarContent';
|
|
@@ -302,6 +303,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
|
|
|
302
303
|
static TableRow: typeof TableRow;
|
|
303
304
|
static TableSelectAll: typeof TableSelectAll;
|
|
304
305
|
static TableSelectRow: typeof TableSelectRow;
|
|
306
|
+
static TableSlugRow: typeof TableSlugRow;
|
|
305
307
|
static TableToolbar: typeof TableToolbar;
|
|
306
308
|
static TableToolbarAction: typeof TableToolbarAction;
|
|
307
309
|
static TableToolbarContent: typeof TableToolbarContent;
|
|
@@ -31,6 +31,7 @@ import TableHeader from './TableHeader.js';
|
|
|
31
31
|
import TableRow from './TableRow.js';
|
|
32
32
|
import TableSelectAll from './TableSelectAll.js';
|
|
33
33
|
import TableSelectRow from './TableSelectRow.js';
|
|
34
|
+
import TableSlugRow from './TableSlugRow.js';
|
|
34
35
|
import TableToolbar from './TableToolbar.js';
|
|
35
36
|
import TableToolbarAction from './TableToolbarAction.js';
|
|
36
37
|
import TableToolbarContent from './TableToolbarContent.js';
|
|
@@ -723,6 +724,7 @@ _defineProperty(DataTable, "TableHeader", void 0);
|
|
|
723
724
|
_defineProperty(DataTable, "TableRow", void 0);
|
|
724
725
|
_defineProperty(DataTable, "TableSelectAll", void 0);
|
|
725
726
|
_defineProperty(DataTable, "TableSelectRow", void 0);
|
|
727
|
+
_defineProperty(DataTable, "TableSlugRow", void 0);
|
|
726
728
|
_defineProperty(DataTable, "TableToolbar", void 0);
|
|
727
729
|
_defineProperty(DataTable, "TableToolbarAction", void 0);
|
|
728
730
|
_defineProperty(DataTable, "TableToolbarContent", void 0);
|
|
@@ -743,6 +745,7 @@ DataTable.TableHeader = TableHeader;
|
|
|
743
745
|
DataTable.TableRow = TableRow;
|
|
744
746
|
DataTable.TableSelectAll = TableSelectAll;
|
|
745
747
|
DataTable.TableSelectRow = TableSelectRow;
|
|
748
|
+
DataTable.TableSlugRow = TableSlugRow;
|
|
746
749
|
DataTable.TableToolbar = TableToolbar;
|
|
747
750
|
DataTable.TableToolbarAction = TableToolbarAction;
|
|
748
751
|
DataTable.TableToolbarContent = TableToolbarContent;
|
|
@@ -28,17 +28,34 @@ const TableExpandRow = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
28
28
|
...rest
|
|
29
29
|
} = _ref;
|
|
30
30
|
const prefix = usePrefix();
|
|
31
|
+
|
|
32
|
+
// We need to put the slug before the expansion arrow and all other table cells after the arrow.
|
|
33
|
+
let rowHasSlug;
|
|
34
|
+
const slug = React__default.Children.toArray(children).map(child => {
|
|
35
|
+
if (child.type?.displayName === 'TableSlugRow') {
|
|
36
|
+
if (child.props.slug) {
|
|
37
|
+
rowHasSlug = true;
|
|
38
|
+
}
|
|
39
|
+
return child;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const normalizedChildren = React__default.Children.toArray(children).map(child => {
|
|
43
|
+
if (child.type?.displayName !== 'TableSlugRow') {
|
|
44
|
+
return child;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
31
47
|
const className = cx({
|
|
32
48
|
[`${prefix}--parent-row`]: true,
|
|
33
49
|
[`${prefix}--expandable-row`]: isExpanded,
|
|
34
|
-
[`${prefix}--data-table--selected`]: isSelected
|
|
50
|
+
[`${prefix}--data-table--selected`]: isSelected,
|
|
51
|
+
[`${prefix}--parent-row--slug`]: rowHasSlug
|
|
35
52
|
}, rowClassName);
|
|
36
53
|
const previousValue = isExpanded ? 'collapsed' : undefined;
|
|
37
54
|
return /*#__PURE__*/React__default.createElement("tr", _extends({}, rest, {
|
|
38
55
|
ref: ref,
|
|
39
56
|
className: className,
|
|
40
57
|
"data-parent-row": true
|
|
41
|
-
}), /*#__PURE__*/React__default.createElement(TableCell, {
|
|
58
|
+
}), slug, /*#__PURE__*/React__default.createElement(TableCell, {
|
|
42
59
|
className: `${prefix}--table-expand`,
|
|
43
60
|
"data-previous-value": previousValue,
|
|
44
61
|
headers: expandHeader
|
|
@@ -53,7 +70,7 @@ const TableExpandRow = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
53
70
|
}, /*#__PURE__*/React__default.createElement(ChevronRight, {
|
|
54
71
|
className: `${prefix}--table-expand__svg`,
|
|
55
72
|
"aria-label": expandIconDescription
|
|
56
|
-
}))),
|
|
73
|
+
}))), normalizedChildren);
|
|
57
74
|
});
|
|
58
75
|
TableExpandRow.propTypes = {
|
|
59
76
|
/**
|
|
@@ -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, { MouseEventHandler } from 'react';
|
|
8
9
|
import { ReactAttr } from '../../types/common';
|
|
9
10
|
interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonElement> {
|
|
@@ -43,6 +44,10 @@ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonEl
|
|
|
43
44
|
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
|
|
44
45
|
*/
|
|
45
46
|
scope?: string;
|
|
47
|
+
/**
|
|
48
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `TableSlugRow` component
|
|
49
|
+
*/
|
|
50
|
+
slug?: ReactNodeLike;
|
|
46
51
|
/**
|
|
47
52
|
* Specify which direction we are currently sorting by, should be one of DESC,
|
|
48
53
|
* NONE, or ASC.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import React__default from 'react';
|
|
11
|
+
import React__default, { useRef } from 'react';
|
|
12
12
|
import { ArrowUp, ArrowsVertical } from '@carbon/icons-react';
|
|
13
13
|
import './state/sorting.js';
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
@@ -52,11 +52,26 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
|
52
52
|
scope = defaultScope,
|
|
53
53
|
sortDirection,
|
|
54
54
|
translateWithId: t = translateWithId,
|
|
55
|
+
slug,
|
|
55
56
|
id,
|
|
56
57
|
...rest
|
|
57
58
|
} = _ref;
|
|
58
59
|
const prefix = usePrefix();
|
|
59
60
|
const uniqueId = useId('table-sort');
|
|
61
|
+
|
|
62
|
+
// Slug is always size `mini`
|
|
63
|
+
const slugRef = useRef(null);
|
|
64
|
+
let normalizedSlug;
|
|
65
|
+
if (slug) {
|
|
66
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
67
|
+
size: 'mini',
|
|
68
|
+
ref: slugRef
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const headerLabelClassNames = cx({
|
|
72
|
+
[`${prefix}--table-header-label`]: true,
|
|
73
|
+
[`${prefix}--table-header-label--slug`]: slug
|
|
74
|
+
});
|
|
60
75
|
if (!isSortable) {
|
|
61
76
|
return /*#__PURE__*/React__default.createElement("th", _extends({}, rest, {
|
|
62
77
|
id: id,
|
|
@@ -65,8 +80,8 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
|
65
80
|
colSpan: colSpan,
|
|
66
81
|
ref: ref
|
|
67
82
|
}), children ? /*#__PURE__*/React__default.createElement("div", {
|
|
68
|
-
className:
|
|
69
|
-
}, children) : null);
|
|
83
|
+
className: headerLabelClassNames
|
|
84
|
+
}, children, normalizedSlug) : null);
|
|
70
85
|
}
|
|
71
86
|
const className = cx(headerClassName, {
|
|
72
87
|
[`${prefix}--table-sort`]: true,
|
|
@@ -80,7 +95,16 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
|
80
95
|
isSortHeader,
|
|
81
96
|
sortStates
|
|
82
97
|
});
|
|
83
|
-
const headerClasses = cx(headerClassName, `${prefix}--table-sort__header
|
|
98
|
+
const headerClasses = cx(headerClassName, `${prefix}--table-sort__header`, {
|
|
99
|
+
[`${prefix}--table-sort__header--slug`]: slug
|
|
100
|
+
});
|
|
101
|
+
const handleClick = evt => {
|
|
102
|
+
if (slug && slugRef.current && slugRef.current.contains(evt.target)) {
|
|
103
|
+
return;
|
|
104
|
+
} else if (onClick) {
|
|
105
|
+
return onClick(evt);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
84
108
|
return /*#__PURE__*/React__default.createElement("th", {
|
|
85
109
|
id: id,
|
|
86
110
|
"aria-sort": ariaSort,
|
|
@@ -95,12 +119,12 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
|
95
119
|
type: "button",
|
|
96
120
|
"aria-describedby": uniqueId,
|
|
97
121
|
className: className,
|
|
98
|
-
onClick:
|
|
122
|
+
onClick: handleClick
|
|
99
123
|
}, rest), /*#__PURE__*/React__default.createElement("span", {
|
|
100
124
|
className: `${prefix}--table-sort__flex`
|
|
101
125
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
102
126
|
className: `${prefix}--table-header-label`
|
|
103
|
-
}, children), /*#__PURE__*/React__default.createElement(ArrowUp, {
|
|
127
|
+
}, children), normalizedSlug, /*#__PURE__*/React__default.createElement(ArrowUp, {
|
|
104
128
|
size: 20,
|
|
105
129
|
className: `${prefix}--table-sort__icon`
|
|
106
130
|
}), /*#__PURE__*/React__default.createElement(ArrowsVertical, {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes, { ReactNodeLike } from 'prop-types';
|
|
8
|
+
export interface TableSlugRowProps {
|
|
9
|
+
/**
|
|
10
|
+
* The CSS class names of the cell that wraps the underlying input control
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Provide a `Slug` component to be rendered inside the `TableSlugRow` component
|
|
15
|
+
*/
|
|
16
|
+
slug?: ReactNodeLike;
|
|
17
|
+
}
|
|
18
|
+
declare const TableSlugRow: {
|
|
19
|
+
({ className, slug }: TableSlugRowProps): JSX.Element;
|
|
20
|
+
propTypes: {
|
|
21
|
+
/**
|
|
22
|
+
* The CSS class names of the cell that wraps the underlying input control
|
|
23
|
+
*/
|
|
24
|
+
className: PropTypes.Requireable<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Provide a `Slug` component to be rendered inside the `TableSlugRow` component
|
|
27
|
+
*/
|
|
28
|
+
slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export default TableSlugRow;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import React__default from 'react';
|
|
10
|
+
import cx from 'classnames';
|
|
11
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
|
+
|
|
13
|
+
const TableSlugRow = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
className,
|
|
16
|
+
slug
|
|
17
|
+
} = _ref;
|
|
18
|
+
const prefix = usePrefix();
|
|
19
|
+
const TableSlugRowClasses = cx({
|
|
20
|
+
...(className && {
|
|
21
|
+
[className]: true
|
|
22
|
+
}),
|
|
23
|
+
[`${prefix}--table-column-slug`]: true,
|
|
24
|
+
[`${prefix}--table-column-slug--active`]: slug
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Slug is always size `mini`
|
|
28
|
+
let normalizedSlug;
|
|
29
|
+
if (slug) {
|
|
30
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
31
|
+
size: 'mini'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/React__default.createElement("td", {
|
|
35
|
+
className: TableSlugRowClasses
|
|
36
|
+
}, normalizedSlug);
|
|
37
|
+
};
|
|
38
|
+
TableSlugRow.propTypes = {
|
|
39
|
+
/**
|
|
40
|
+
* The CSS class names of the cell that wraps the underlying input control
|
|
41
|
+
*/
|
|
42
|
+
className: PropTypes.string,
|
|
43
|
+
/**
|
|
44
|
+
* Provide a `Slug` component to be rendered inside the `TableSlugRow` component
|
|
45
|
+
*/
|
|
46
|
+
slug: PropTypes.node
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { TableSlugRow as default };
|
|
@@ -20,10 +20,11 @@ import TableHeader from './TableHeader';
|
|
|
20
20
|
import TableRow from './TableRow';
|
|
21
21
|
import TableSelectAll from './TableSelectAll';
|
|
22
22
|
import TableSelectRow from './TableSelectRow';
|
|
23
|
+
import TableSlugRow from './TableSlugRow';
|
|
23
24
|
import TableToolbar from './TableToolbar';
|
|
24
25
|
import TableToolbarAction from './TableToolbarAction';
|
|
25
26
|
import TableToolbarContent from './TableToolbarContent';
|
|
26
27
|
import TableToolbarSearch from './TableToolbarSearch';
|
|
27
28
|
import TableToolbarMenu from './TableToolbarMenu';
|
|
28
|
-
export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
|
|
29
|
+
export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableSlugRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
|
|
29
30
|
export default DataTable;
|
|
@@ -37,6 +37,8 @@ import TableSelectAll from './TableSelectAll.js';
|
|
|
37
37
|
export { default as TableSelectAll } from './TableSelectAll.js';
|
|
38
38
|
import TableSelectRow from './TableSelectRow.js';
|
|
39
39
|
export { default as TableSelectRow } from './TableSelectRow.js';
|
|
40
|
+
import TableSlugRow from './TableSlugRow.js';
|
|
41
|
+
export { default as TableSlugRow } from './TableSlugRow.js';
|
|
40
42
|
import TableToolbar from './TableToolbar.js';
|
|
41
43
|
export { default as TableToolbar } from './TableToolbar.js';
|
|
42
44
|
import TableToolbarAction from './TableToolbarAction.js';
|
|
@@ -63,6 +65,7 @@ DataTable.TableHeader = TableHeader;
|
|
|
63
65
|
DataTable.TableRow = TableRow;
|
|
64
66
|
DataTable.TableSelectAll = TableSelectAll;
|
|
65
67
|
DataTable.TableSelectRow = TableSelectRow;
|
|
68
|
+
DataTable.TableSlugRow = TableSlugRow;
|
|
66
69
|
DataTable.TableToolbar = TableToolbar;
|
|
67
70
|
DataTable.TableToolbarAction = TableToolbarAction;
|
|
68
71
|
DataTable.TableToolbarContent = TableToolbarContent;
|
|
@@ -33,7 +33,7 @@ const compare = function (a, b) {
|
|
|
33
33
|
|
|
34
34
|
// if column has React elements, this should sort by the child string if there is one
|
|
35
35
|
if (typeof a === 'object' && typeof b === 'object') {
|
|
36
|
-
if (typeof a.props
|
|
36
|
+
if (typeof a.props?.children === 'string' && typeof b.props?.children === 'string') {
|
|
37
37
|
return compareStrings(a.props.children, b.props.children, locale);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -77,7 +77,7 @@ interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>, Exclude
|
|
|
77
77
|
*/
|
|
78
78
|
size?: 'sm' | 'md' | 'lg';
|
|
79
79
|
/**
|
|
80
|
-
* Provide a `Slug` component to be rendered inside the `DatePickerInput` component
|
|
80
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
|
|
81
81
|
*/
|
|
82
82
|
slug?: ReactNodeLike;
|
|
83
83
|
/**
|
|
@@ -206,7 +206,7 @@ DatePickerInput.propTypes = {
|
|
|
206
206
|
*/
|
|
207
207
|
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
208
208
|
/**
|
|
209
|
-
* Provide a `Slug` component to be rendered inside the `DatePickerInput` component
|
|
209
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
|
|
210
210
|
*/
|
|
211
211
|
slug: PropTypes.node,
|
|
212
212
|
/**
|
|
@@ -112,7 +112,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
112
112
|
*/
|
|
113
113
|
size?: ListBoxSize;
|
|
114
114
|
/**
|
|
115
|
-
* Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
115
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
116
116
|
*/
|
|
117
117
|
slug?: ReactNodeLike;
|
|
118
118
|
/**
|
|
@@ -396,7 +396,7 @@ Dropdown.propTypes = {
|
|
|
396
396
|
*/
|
|
397
397
|
size: ListBoxSize,
|
|
398
398
|
/**
|
|
399
|
-
* Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
399
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
400
400
|
*/
|
|
401
401
|
slug: PropTypes.node,
|
|
402
402
|
/**
|
|
@@ -106,11 +106,12 @@ class FileUploader extends React__default.Component {
|
|
|
106
106
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
107
107
|
className: classes
|
|
108
108
|
}, other), !labelTitle ? null : /*#__PURE__*/React__default.createElement(Text, {
|
|
109
|
-
as: "
|
|
109
|
+
as: "h3",
|
|
110
110
|
className: getHelperLabelClasses(`${prefix}--file--label`)
|
|
111
111
|
}, labelTitle), /*#__PURE__*/React__default.createElement(Text, {
|
|
112
112
|
as: "p",
|
|
113
|
-
className: getHelperLabelClasses(`${prefix}--label-description`)
|
|
113
|
+
className: getHelperLabelClasses(`${prefix}--label-description`),
|
|
114
|
+
id: "description"
|
|
114
115
|
}, labelDescription), /*#__PURE__*/React__default.createElement(FileUploaderButton, {
|
|
115
116
|
innerRef: this.uploaderButton,
|
|
116
117
|
disabled: disabled,
|
|
@@ -121,7 +122,8 @@ class FileUploader extends React__default.Component {
|
|
|
121
122
|
disableLabelChanges: true,
|
|
122
123
|
accept: accept,
|
|
123
124
|
name: name,
|
|
124
|
-
size: size
|
|
125
|
+
size: size,
|
|
126
|
+
"aria-describedby": "description"
|
|
125
127
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
126
128
|
className: `${prefix}--file-container`
|
|
127
129
|
}, this.state.filenames.length === 0 ? null : this.state.filenames.map((name, index) => /*#__PURE__*/React__default.createElement("span", _extends({
|
|
@@ -102,6 +102,11 @@ Column.propTypes = {
|
|
|
102
102
|
* @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
|
|
103
103
|
*/
|
|
104
104
|
sm: spanPropType,
|
|
105
|
+
/**
|
|
106
|
+
* Specify constant column span, start, or end values that will not change
|
|
107
|
+
* based on breakpoint
|
|
108
|
+
*/
|
|
109
|
+
span: PropTypes.oneOfType([PropTypes.number, percentSpanType]),
|
|
105
110
|
/**
|
|
106
111
|
* Specify column span for the `xlg` breakpoint (Default breakpoint up to
|
|
107
112
|
* 1584px) This breakpoint supports 16 columns by default.
|
|
@@ -311,8 +316,13 @@ function getClassNameForFlexGridBreakpoints(breakpoints, prefix) {
|
|
|
311
316
|
*/
|
|
312
317
|
function getClassNameForSpan(value, prefix) {
|
|
313
318
|
const classNames = [];
|
|
314
|
-
if (typeof value === 'number'
|
|
319
|
+
if (typeof value === 'number') {
|
|
315
320
|
classNames.push(`${prefix}--col-span-${value}`);
|
|
321
|
+
}
|
|
322
|
+
// If value is a string, the user has specified a percent
|
|
323
|
+
// they'd like this column to span.
|
|
324
|
+
else if (typeof value === 'string') {
|
|
325
|
+
classNames.push(`${prefix}--col-span-${value.slice(0, -1)}`);
|
|
316
326
|
} else if (typeof value === 'object') {
|
|
317
327
|
const {
|
|
318
328
|
span,
|