@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
|
@@ -0,0 +1,38 @@
|
|
|
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 React from 'react';
|
|
8
|
+
import { LayerLevel } from './LayerLevel';
|
|
9
|
+
import { PolymorphicProps } from '../../types/common';
|
|
10
|
+
/**
|
|
11
|
+
* A custom hook that will return information about the current layer. A common
|
|
12
|
+
* field to pull from this is the `level` for the layer that the component that
|
|
13
|
+
* calls this hook is currently in
|
|
14
|
+
*/
|
|
15
|
+
export declare function useLayer(): {
|
|
16
|
+
level: 0 | 1 | 2;
|
|
17
|
+
};
|
|
18
|
+
interface LayerBaseProps {
|
|
19
|
+
/**
|
|
20
|
+
* Provide child elements to be rendered inside of `Theme`
|
|
21
|
+
*/
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Provide a custom class name to be used on the outermost element rendered by
|
|
25
|
+
* the component
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Specify the layer level and override any existing levels based on hierarchy
|
|
30
|
+
*/
|
|
31
|
+
level?: LayerLevel;
|
|
32
|
+
}
|
|
33
|
+
export type LayerProps<T extends React.ElementType> = PolymorphicProps<T, LayerBaseProps>;
|
|
34
|
+
export interface LayerComponent {
|
|
35
|
+
<T extends React.ElementType>(props: LayerProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
36
|
+
}
|
|
37
|
+
export declare const Layer: LayerComponent;
|
|
38
|
+
export {};
|
|
@@ -15,6 +15,7 @@ var PropTypes = require('prop-types');
|
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
17
|
var LayerContext = require('./LayerContext.js');
|
|
18
|
+
var LayerLevel = require('./LayerLevel.js');
|
|
18
19
|
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
21
|
|
|
@@ -22,9 +23,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
23
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
24
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
25
|
|
|
25
|
-
const levels = ['one', 'two', 'three'];
|
|
26
|
-
const MAX_LEVEL = levels.length - 1;
|
|
27
|
-
|
|
28
26
|
/**
|
|
29
27
|
* A custom hook that will return information about the current layer. A common
|
|
30
28
|
* field to pull from this is the `level` for the layer that the component that
|
|
@@ -36,9 +34,9 @@ function useLayer() {
|
|
|
36
34
|
level
|
|
37
35
|
};
|
|
38
36
|
}
|
|
39
|
-
const
|
|
37
|
+
const LayerRenderFunction = /*#__PURE__*/React__default["default"].forwardRef(function Layer(_ref, ref) {
|
|
40
38
|
let {
|
|
41
|
-
as
|
|
39
|
+
as = 'div',
|
|
42
40
|
className: customClassName,
|
|
43
41
|
children,
|
|
44
42
|
level: overrideLevel,
|
|
@@ -47,9 +45,10 @@ const Layer = /*#__PURE__*/React__default["default"].forwardRef(function Layer(_
|
|
|
47
45
|
const contextLevel = React__default["default"].useContext(LayerContext.LayerContext);
|
|
48
46
|
const level = overrideLevel ?? contextLevel;
|
|
49
47
|
const prefix = usePrefix.usePrefix();
|
|
50
|
-
const className = cx__default["default"](`${prefix}--layer-${levels[level]}`, customClassName);
|
|
51
|
-
// The level should be between
|
|
52
|
-
const value = Math.max(
|
|
48
|
+
const className = cx__default["default"](`${prefix}--layer-${LayerLevel.levels[level]}`, customClassName);
|
|
49
|
+
// The level should be between MIN_LEVEL and MAX_LEVEL
|
|
50
|
+
const value = Math.max(LayerLevel.MIN_LEVEL, Math.min(level + 1, LayerLevel.MAX_LEVEL));
|
|
51
|
+
const BaseComponent = as;
|
|
53
52
|
return /*#__PURE__*/React__default["default"].createElement(LayerContext.LayerContext.Provider, {
|
|
54
53
|
value: value
|
|
55
54
|
}, /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({
|
|
@@ -58,7 +57,8 @@ const Layer = /*#__PURE__*/React__default["default"].forwardRef(function Layer(_
|
|
|
58
57
|
className: className
|
|
59
58
|
}), children));
|
|
60
59
|
});
|
|
61
|
-
|
|
60
|
+
LayerRenderFunction.displayName = 'Layer';
|
|
61
|
+
LayerRenderFunction.propTypes = {
|
|
62
62
|
/**
|
|
63
63
|
* Specify a custom component or element to be rendered as the top-level
|
|
64
64
|
* element in the component
|
|
@@ -78,6 +78,7 @@ Layer.propTypes = {
|
|
|
78
78
|
*/
|
|
79
79
|
level: PropTypes__default["default"].oneOf([0, 1, 2])
|
|
80
80
|
};
|
|
81
|
+
const Layer = LayerRenderFunction;
|
|
81
82
|
|
|
82
83
|
exports.Layer = Layer;
|
|
83
84
|
exports.useLayer = useLayer;
|
|
@@ -179,7 +179,8 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef(function Menu
|
|
|
179
179
|
className: `${prefix}--menu-item__icon`
|
|
180
180
|
}, iconsAllowed && IconElement && /*#__PURE__*/React__default["default"].createElement(IconElement, null)), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
181
181
|
as: "div",
|
|
182
|
-
className: `${prefix}--menu-item__label
|
|
182
|
+
className: `${prefix}--menu-item__label`,
|
|
183
|
+
title: label
|
|
183
184
|
}, label), shortcut && !hasChildren && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
184
185
|
className: `${prefix}--menu-item__shortcut`
|
|
185
186
|
}, shortcut), hasChildren && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -28,7 +28,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
28
28
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
29
29
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
30
30
|
|
|
31
|
-
const spacing =
|
|
31
|
+
const spacing = 0; // top and bottom spacing between the button and the menu. in px
|
|
32
32
|
const validButtonKinds = ['primary', 'tertiary', 'ghost'];
|
|
33
33
|
const defaultButtonKind = 'primary';
|
|
34
34
|
const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function MenuButton(_ref, forwardRef) {
|
|
@@ -39,6 +39,7 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
|
|
|
39
39
|
kind = defaultButtonKind,
|
|
40
40
|
label,
|
|
41
41
|
size = 'lg',
|
|
42
|
+
tabIndex = 0,
|
|
42
43
|
...rest
|
|
43
44
|
} = _ref;
|
|
44
45
|
const id = useId.useId('MenuButton');
|
|
@@ -79,6 +80,7 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef(function Me
|
|
|
79
80
|
}), /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
80
81
|
className: triggerClasses,
|
|
81
82
|
size: size,
|
|
83
|
+
tabIndex: tabIndex,
|
|
82
84
|
kind: buttonKind,
|
|
83
85
|
renderIcon: iconsReact.ChevronDown,
|
|
84
86
|
disabled: disabled,
|
|
@@ -124,7 +126,11 @@ MenuButton.propTypes = {
|
|
|
124
126
|
/**
|
|
125
127
|
* Specify the size of the button and menu.
|
|
126
128
|
*/
|
|
127
|
-
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg'])
|
|
129
|
+
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
130
|
+
/**
|
|
131
|
+
* Specify the tabIndex of the button.
|
|
132
|
+
*/
|
|
133
|
+
tabIndex: PropTypes__default["default"].number
|
|
128
134
|
};
|
|
129
135
|
|
|
130
136
|
exports.MenuButton = MenuButton;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ReactAttr } from '../../types/common';
|
|
9
|
+
import { InlineLoadingStatus } from '../InlineLoading/InlineLoading';
|
|
9
10
|
export declare const ModalSizes: readonly ["xs", "sm", "md", "lg"];
|
|
10
11
|
export type ModalSize = (typeof ModalSizes)[number];
|
|
11
12
|
export interface ModalSecondaryButton {
|
|
@@ -65,7 +66,7 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
65
66
|
/**
|
|
66
67
|
* Specify loading status
|
|
67
68
|
*/
|
|
68
|
-
loadingStatus?:
|
|
69
|
+
loadingStatus?: InlineLoadingStatus;
|
|
69
70
|
/**
|
|
70
71
|
* Specify a label to be read by screen readers on the modal root node
|
|
71
72
|
*/
|
|
@@ -87,7 +88,7 @@ export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
|
87
88
|
* Specify an optional handler to be invoked when loading is
|
|
88
89
|
* successful
|
|
89
90
|
*/
|
|
90
|
-
onLoadingSuccess?:
|
|
91
|
+
onLoadingSuccess?: () => void;
|
|
91
92
|
/**
|
|
92
93
|
* Specify a handler for closing modal.
|
|
93
94
|
* The handler should care of closing modal, e.g. changing `open` prop.
|
|
@@ -557,7 +557,7 @@ FilterableMultiSelect.propTypes = {
|
|
|
557
557
|
*/
|
|
558
558
|
size: ListBoxPropTypes.ListBoxSize,
|
|
559
559
|
/**
|
|
560
|
-
* Provide a `Slug` component to be rendered inside the `FilterableMultiSelect` component
|
|
560
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `FilterableMultiSelect` component
|
|
561
561
|
*/
|
|
562
562
|
slug: PropTypes__default["default"].node,
|
|
563
563
|
...MultiSelectPropTypes.sortingPropTypes,
|
|
@@ -164,7 +164,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
164
164
|
*/
|
|
165
165
|
size?: ListBoxSize;
|
|
166
166
|
/**
|
|
167
|
-
* Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
167
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
168
168
|
*/
|
|
169
169
|
slug?: ReactNodeLike;
|
|
170
170
|
/**
|
|
@@ -518,7 +518,7 @@ MultiSelect.propTypes = {
|
|
|
518
518
|
*/
|
|
519
519
|
size: ListBoxPropTypes.ListBoxSize,
|
|
520
520
|
/**
|
|
521
|
-
* Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
521
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
522
522
|
*/
|
|
523
523
|
slug: PropTypes__default["default"].node,
|
|
524
524
|
/**
|
|
@@ -594,6 +594,7 @@ function ActionableNotification(_ref6) {
|
|
|
594
594
|
className: `${prefix}--actionable-notification__subtitle`,
|
|
595
595
|
id: subtitleId
|
|
596
596
|
}, subtitle), children))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
597
|
+
className: `${prefix}--actionable-notification__button-wrapper`,
|
|
597
598
|
ref: innerModal
|
|
598
599
|
}, actionButtonLabel && /*#__PURE__*/React__default["default"].createElement(NotificationActionButton, {
|
|
599
600
|
onClick: onActionButtonClick,
|
|
@@ -109,7 +109,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
109
109
|
*/
|
|
110
110
|
size?: 'sm' | 'md' | 'lg';
|
|
111
111
|
/**
|
|
112
|
-
* Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
112
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
113
113
|
*/
|
|
114
114
|
slug?: ReactNodeLike;
|
|
115
115
|
/**
|
|
@@ -370,7 +370,7 @@ NumberInput.propTypes = {
|
|
|
370
370
|
*/
|
|
371
371
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
372
372
|
/**
|
|
373
|
-
* Provide a `Slug` component to be rendered inside the `NumberInput` component
|
|
373
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `NumberInput` component
|
|
374
374
|
*/
|
|
375
375
|
slug: PropTypes__default["default"].node,
|
|
376
376
|
/**
|
|
@@ -55,6 +55,10 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
55
55
|
* Provide a handler that is invoked when a user clicks on the control
|
|
56
56
|
*/
|
|
57
57
|
onClick?: (evt: React.MouseEvent<HTMLInputElement>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
60
|
+
*/
|
|
61
|
+
slug?: ReactNodeLike;
|
|
58
62
|
/**
|
|
59
63
|
* Specify the value of the `<RadioButton>`
|
|
60
64
|
*/
|
|
@@ -36,6 +36,7 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
|
|
|
36
36
|
name,
|
|
37
37
|
onChange = () => {},
|
|
38
38
|
value = '',
|
|
39
|
+
slug,
|
|
39
40
|
...rest
|
|
40
41
|
} = props;
|
|
41
42
|
const prefix = usePrefix.usePrefix();
|
|
@@ -48,9 +49,17 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
|
|
|
48
49
|
[`${prefix}--visually-hidden`]: hideLabel
|
|
49
50
|
});
|
|
50
51
|
const wrapperClasses = cx__default["default"](className, `${prefix}--radio-button-wrapper`, {
|
|
51
|
-
[`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right'
|
|
52
|
+
[`${prefix}--radio-button-wrapper--label-${labelPosition}`]: labelPosition !== 'right',
|
|
53
|
+
[`${prefix}--radio-button-wrapper--slug`]: slug
|
|
52
54
|
});
|
|
53
55
|
const inputRef = React.useRef(null);
|
|
56
|
+
let normalizedSlug;
|
|
57
|
+
if (slug && /*#__PURE__*/React__default["default"].isValidElement(slug)) {
|
|
58
|
+
const size = slug.props?.['kind'] === 'inline' ? 'md' : 'mini';
|
|
59
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
60
|
+
size
|
|
61
|
+
});
|
|
62
|
+
}
|
|
54
63
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
55
64
|
className: wrapperClasses
|
|
56
65
|
}, /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
@@ -69,7 +78,7 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
|
|
|
69
78
|
className: `${prefix}--radio-button__appearance`
|
|
70
79
|
}), labelText && /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
71
80
|
className: innerLabelClasses
|
|
72
|
-
}, labelText)));
|
|
81
|
+
}, labelText, normalizedSlug)));
|
|
73
82
|
});
|
|
74
83
|
RadioButton.displayName = 'RadioButton';
|
|
75
84
|
RadioButton.propTypes = {
|
|
@@ -120,6 +129,10 @@ RadioButton.propTypes = {
|
|
|
120
129
|
* Provide a handler that is invoked when a user clicks on the control
|
|
121
130
|
*/
|
|
122
131
|
onClick: PropTypes__default["default"].func,
|
|
132
|
+
/**
|
|
133
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
134
|
+
*/
|
|
135
|
+
slug: PropTypes__default["default"].node,
|
|
123
136
|
/**
|
|
124
137
|
* Specify the value of the `<RadioButton>`
|
|
125
138
|
*/
|
|
@@ -63,6 +63,10 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
63
63
|
* Whether the RadioButtonGroup should be read-only
|
|
64
64
|
*/
|
|
65
65
|
readOnly?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
68
|
+
*/
|
|
69
|
+
slug?: ReactNodeLike;
|
|
66
70
|
/**
|
|
67
71
|
* Specify whether the control is currently in warning state
|
|
68
72
|
*/
|
|
@@ -44,6 +44,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
44
44
|
valueSelected,
|
|
45
45
|
warn = false,
|
|
46
46
|
warnText,
|
|
47
|
+
slug,
|
|
47
48
|
...rest
|
|
48
49
|
} = props;
|
|
49
50
|
const prefix = usePrefix.usePrefix();
|
|
@@ -98,7 +99,8 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
98
99
|
[`${prefix}--radio-button-group--label-${labelPosition}`]: labelPosition,
|
|
99
100
|
[`${prefix}--radio-button-group--readonly`]: readOnly,
|
|
100
101
|
[`${prefix}--radio-button-group--invalid`]: !readOnly && invalid,
|
|
101
|
-
[`${prefix}--radio-button-group--warning`]: showWarning
|
|
102
|
+
[`${prefix}--radio-button-group--warning`]: showWarning,
|
|
103
|
+
[`${prefix}--radio-button-group--slug`]: slug
|
|
102
104
|
});
|
|
103
105
|
const helperClasses = cx__default["default"](`${prefix}--form__helper-text`, {
|
|
104
106
|
[`${prefix}--form__helper-text--disabled`]: disabled
|
|
@@ -109,6 +111,15 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
109
111
|
className: helperClasses
|
|
110
112
|
}, helperText) : null;
|
|
111
113
|
const divRef = React.useRef(null);
|
|
114
|
+
|
|
115
|
+
// Slug is always size `mini`
|
|
116
|
+
let normalizedSlug;
|
|
117
|
+
if (slug) {
|
|
118
|
+
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
119
|
+
size: 'mini',
|
|
120
|
+
kind: 'default'
|
|
121
|
+
});
|
|
122
|
+
}
|
|
112
123
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
113
124
|
className: wrapperClasses,
|
|
114
125
|
ref: mergeRefs["default"](divRef, ref)
|
|
@@ -119,7 +130,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
119
130
|
"aria-describedby": showHelper && helperText ? helperId : undefined
|
|
120
131
|
}, rest), legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
|
|
121
132
|
className: `${prefix}--label`
|
|
122
|
-
}, legendText), getRadioButtons()), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
133
|
+
}, legendText, normalizedSlug), getRadioButtons()), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
123
134
|
className: `${prefix}--radio-button__validation-msg`
|
|
124
135
|
}, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
125
136
|
className: `${prefix}--radio-button__invalid-icon`
|
|
@@ -186,6 +197,10 @@ RadioButtonGroup.propTypes = {
|
|
|
186
197
|
* Whether the RadioButtonGroup should be read-only
|
|
187
198
|
*/
|
|
188
199
|
readOnly: PropTypes__default["default"].bool,
|
|
200
|
+
/**
|
|
201
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
202
|
+
*/
|
|
203
|
+
slug: PropTypes__default["default"].node,
|
|
189
204
|
/**
|
|
190
205
|
* Specify the value that is currently selected in the group
|
|
191
206
|
*/
|
|
@@ -78,7 +78,7 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
78
78
|
*/
|
|
79
79
|
size?: 'sm' | 'md' | 'lg';
|
|
80
80
|
/**
|
|
81
|
-
* Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
81
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
82
82
|
*/
|
|
83
83
|
slug?: ReactNodeLike;
|
|
84
84
|
/**
|
|
@@ -90,5 +90,5 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
90
90
|
*/
|
|
91
91
|
warnText?: ReactNode;
|
|
92
92
|
}
|
|
93
|
-
declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "disabled" | "form" | "slot" | "style" | "title" | "className" | "size" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "
|
|
93
|
+
declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "disabled" | "form" | "slot" | "style" | "title" | "className" | "size" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "onTransitionEnd" | "tabIndex" | "color" | "lang" | "name" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "inline" | "readOnly" | "required" | "light" | "invalid" | "labelText" | "helperText" | "invalidText" | "hideLabel" | "warn" | "warnText" | "slug" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
|
|
94
94
|
export default Select;
|
|
@@ -255,7 +255,7 @@ Select.propTypes = {
|
|
|
255
255
|
*/
|
|
256
256
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
257
257
|
/**
|
|
258
|
-
* Provide a `Slug` component to be rendered inside the `Select` component
|
|
258
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Select` component
|
|
259
259
|
*/
|
|
260
260
|
slug: PropTypes__default["default"].node,
|
|
261
261
|
/**
|
|
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
|
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
|
+
var SliderHandles = require('./SliderHandles.js');
|
|
17
18
|
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
20
|
|
|
@@ -21,6 +22,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
21
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
22
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
23
24
|
|
|
25
|
+
var _LowerHandle, _UpperHandle, _UpperHandle2, _LowerHandle2;
|
|
24
26
|
const SliderSkeleton = _ref => {
|
|
25
27
|
let {
|
|
26
28
|
hideLabel,
|
|
@@ -29,8 +31,10 @@ const SliderSkeleton = _ref => {
|
|
|
29
31
|
...rest
|
|
30
32
|
} = _ref;
|
|
31
33
|
const prefix = usePrefix.usePrefix();
|
|
34
|
+
const isRtl = document?.dir === 'rtl';
|
|
32
35
|
const containerClasses = cx__default["default"](`${prefix}--slider-container`, `${prefix}--skeleton`, {
|
|
33
|
-
[`${prefix}--slider-container--two-handles`]: twoHandles
|
|
36
|
+
[`${prefix}--slider-container--two-handles`]: twoHandles,
|
|
37
|
+
[`${prefix}--slider-container--rtl`]: isRtl
|
|
34
38
|
});
|
|
35
39
|
const lowerThumbClasses = cx__default["default"](`${prefix}--slider__thumb`, {
|
|
36
40
|
[`${prefix}--slider__thumb--lower`]: twoHandles
|
|
@@ -38,6 +42,12 @@ const SliderSkeleton = _ref => {
|
|
|
38
42
|
const upperThumbClasses = cx__default["default"](`${prefix}--slider__thumb`, {
|
|
39
43
|
[`${prefix}--slider__thumb--upper`]: twoHandles
|
|
40
44
|
});
|
|
45
|
+
const lowerThumbWrapperClasses = cx__default["default"](`${prefix}--slider__thumb-wrapper`, {
|
|
46
|
+
[`${prefix}--slider__thumb-wrapper--lower`]: twoHandles
|
|
47
|
+
});
|
|
48
|
+
const upperThumbWrapperClasses = cx__default["default"](`${prefix}--slider__thumb-wrapper`, {
|
|
49
|
+
[`${prefix}--slider__thumb-wrapper--upper`]: twoHandles
|
|
50
|
+
});
|
|
41
51
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
42
52
|
className: cx__default["default"](`${prefix}--form-item`, className)
|
|
43
53
|
}, rest), !hideLabel && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -53,10 +63,14 @@ const SliderSkeleton = _ref => {
|
|
|
53
63
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
54
64
|
className: `${prefix}--slider__filled-track`
|
|
55
65
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
66
|
+
className: lowerThumbWrapperClasses
|
|
67
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
56
68
|
className: lowerThumbClasses
|
|
57
|
-
}), twoHandles ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
69
|
+
}, twoHandles && !isRtl ? _LowerHandle || (_LowerHandle = /*#__PURE__*/React__default["default"].createElement(SliderHandles.LowerHandle, null)) : twoHandles && isRtl ? _UpperHandle || (_UpperHandle = /*#__PURE__*/React__default["default"].createElement(SliderHandles.UpperHandle, null)) : undefined)), twoHandles ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
70
|
+
className: upperThumbWrapperClasses
|
|
71
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
58
72
|
className: upperThumbClasses
|
|
59
|
-
}) : undefined), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
73
|
+
}, twoHandles && !isRtl ? _UpperHandle2 || (_UpperHandle2 = /*#__PURE__*/React__default["default"].createElement(SliderHandles.UpperHandle, null)) : twoHandles && isRtl ? _LowerHandle2 || (_LowerHandle2 = /*#__PURE__*/React__default["default"].createElement(SliderHandles.LowerHandle, null)) : undefined)) : undefined), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
60
74
|
className: `${prefix}--slider__range-label`
|
|
61
75
|
})));
|
|
62
76
|
};
|