@carbon/react 1.24.0 → 1.26.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/es/components/Button/Button.js +2 -2
- package/es/components/CodeSnippet/CodeSnippet.js +13 -115
- package/es/components/ComboBox/ComboBox.d.ts +6 -0
- package/es/components/ComboBox/ComboBox.js +19 -172
- package/es/components/ComboButton/index.js +164 -0
- package/es/components/ComposedModal/ComposedModal.js +1 -2
- package/es/components/DataTable/Table.d.ts +74 -0
- package/es/components/DataTable/Table.js +4 -2
- package/es/components/DataTable/TableCell.d.ts +10 -0
- package/es/components/DataTable/TableContext.d.ts +13 -0
- package/es/components/DataTable/TableContext.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +67 -0
- package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/es/components/DataTable/TableHead.d.ts +10 -0
- package/es/components/DataTable/TableHeader.d.ts +64 -0
- package/es/components/DataTable/TableHeader.js +23 -28
- package/es/components/DataTable/TableRow.d.ts +32 -0
- package/es/components/DataTable/TableSelectAll.js +1 -1
- package/es/components/DataTable/TableSelectRow.js +1 -3
- package/es/components/DataTable/TableToolbar.d.ts +19 -0
- package/es/components/DataTable/TableToolbar.js +1 -1
- package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/es/components/DataTable/TableToolbarContent.d.ts +19 -0
- package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -3
- package/es/components/DataTable/TableToolbarSearch.js +1 -0
- package/es/components/DataTable/tools/sorting.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/es/components/Dropdown/Dropdown.d.ts +6 -0
- package/es/components/Dropdown/Dropdown.js +8 -145
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +2 -0
- package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/es/components/FileUploader/FileUploaderItem.js +2 -1
- package/es/components/FileUploader/Filename.js +8 -2
- package/es/components/FluidTextArea/FluidTextArea.js +12 -1
- package/es/components/IconButton/index.js +1 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/es/components/ListBox/ListBoxSelection.js +4 -23
- package/es/components/ListBox/next/ListBoxSelection.js +2 -23
- package/es/components/Menu/Menu.js +50 -29
- package/es/components/Menu/MenuItem.js +1 -0
- package/es/components/MenuButton/index.js +127 -0
- package/es/components/Modal/Modal.js +4 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +46 -144
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +48 -28
- package/es/components/Notification/Notification.js +27 -264
- package/es/components/NumberInput/NumberInput.js +9 -1
- package/es/components/OverflowMenu/OverflowMenu.js +13 -139
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/es/components/OverflowMenuV2/index.js +15 -51
- package/es/components/Popover/index.d.ts +5 -1
- package/es/components/Popover/index.js +37 -9
- package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/es/components/RadioButton/RadioButton.d.ts +64 -0
- package/es/components/RadioButton/RadioButton.js +19 -17
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +88 -26
- package/es/components/RadioTile/RadioTile.js +6 -6
- package/es/components/Search/Search.Skeleton.d.ts +36 -0
- package/es/components/Search/Search.js +3 -2
- package/es/components/Search/index.js +1 -0
- package/es/components/Select/Select.d.ts +89 -0
- package/es/components/SelectItem/SelectItem.d.ts +62 -0
- package/es/components/SelectItem/SelectItem.js +2 -4
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/StructuredList/StructuredList.js +11 -39
- package/es/components/Tabs/Tabs.js +29 -6
- package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/es/components/TextArea/TextArea.Skeleton.js +5 -5
- package/es/components/TextArea/TextArea.d.ts +9 -2
- package/es/components/TextArea/TextArea.js +31 -8
- package/es/components/TextArea/index.js +1 -0
- package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/es/components/TextInput/index.js +1 -0
- package/es/components/Tile/Tile.js +15 -8
- package/es/components/Toggle/Toggle.js +8 -19
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +117 -0
- package/es/components/Tooltip/Tooltip.js +6 -4
- package/es/components/Tooltip/index.d.ts +9 -0
- package/es/components/UIShell/HeaderMenu.js +13 -4
- package/es/components/UIShell/HeaderMenuItem.js +17 -4
- package/es/index.d.ts +2 -0
- package/es/index.js +5 -3
- package/es/internal/ClickListener.js +1 -2
- package/es/internal/keyboard/match.js +1 -1
- package/es/internal/useAttachedMenu.js +85 -0
- package/es/internal/useDelayedState.d.ts +19 -0
- package/es/internal/useDelayedState.js +7 -3
- package/es/internal/useId.js +1 -1
- package/es/tools/wrapComponent.js +9 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
- package/lib/components/ComboBox/ComboBox.d.ts +6 -0
- package/lib/components/ComboBox/ComboBox.js +18 -171
- package/lib/components/ComboButton/index.js +174 -0
- package/lib/components/ComposedModal/ComposedModal.js +1 -2
- package/lib/components/DataTable/Table.d.ts +74 -0
- package/lib/components/DataTable/Table.js +4 -2
- package/lib/components/DataTable/TableCell.d.ts +10 -0
- package/lib/components/DataTable/TableContext.d.ts +13 -0
- package/lib/components/DataTable/TableContext.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
- package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/lib/components/DataTable/TableHead.d.ts +10 -0
- package/lib/components/DataTable/TableHeader.d.ts +64 -0
- package/lib/components/DataTable/TableHeader.js +23 -28
- package/lib/components/DataTable/TableRow.d.ts +32 -0
- package/lib/components/DataTable/TableSelectAll.js +1 -1
- package/lib/components/DataTable/TableSelectRow.js +1 -3
- package/lib/components/DataTable/TableToolbar.d.ts +19 -0
- package/lib/components/DataTable/TableToolbar.js +1 -1
- package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/lib/components/DataTable/TableToolbarContent.d.ts +19 -0
- package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -3
- package/lib/components/DataTable/TableToolbarSearch.js +1 -0
- package/lib/components/DataTable/tools/sorting.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/lib/components/Dropdown/Dropdown.d.ts +6 -0
- package/lib/components/Dropdown/Dropdown.js +7 -144
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +2 -0
- package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/lib/components/FileUploader/FileUploaderItem.js +2 -1
- package/lib/components/FileUploader/Filename.js +8 -2
- package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
- package/lib/components/IconButton/index.js +1 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/lib/components/ListBox/ListBoxSelection.js +4 -23
- package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
- package/lib/components/Menu/Menu.js +50 -29
- package/lib/components/Menu/MenuItem.js +1 -0
- package/lib/components/MenuButton/index.js +137 -0
- package/lib/components/Modal/Modal.js +4 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +43 -141
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +47 -27
- package/lib/components/Notification/Notification.js +27 -264
- package/lib/components/NumberInput/NumberInput.js +9 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/lib/components/OverflowMenuV2/index.js +13 -49
- package/lib/components/Popover/index.d.ts +5 -1
- package/lib/components/Popover/index.js +37 -9
- package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/lib/components/RadioButton/RadioButton.d.ts +64 -0
- package/lib/components/RadioButton/RadioButton.js +18 -16
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +86 -24
- package/lib/components/RadioTile/RadioTile.js +6 -6
- package/lib/components/Search/Search.Skeleton.d.ts +36 -0
- package/lib/components/Search/Search.js +3 -2
- package/lib/components/Search/index.js +2 -0
- package/lib/components/Select/Select.d.ts +89 -0
- package/lib/components/SelectItem/SelectItem.d.ts +62 -0
- package/lib/components/SelectItem/SelectItem.js +1 -3
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +11 -39
- package/lib/components/Tabs/Tabs.js +29 -6
- package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
- package/lib/components/TextArea/TextArea.d.ts +9 -2
- package/lib/components/TextArea/TextArea.js +30 -7
- package/lib/components/TextArea/index.js +2 -0
- package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/lib/components/TextInput/index.js +2 -0
- package/lib/components/Tile/Tile.js +15 -8
- package/lib/components/Toggle/Toggle.js +8 -19
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +117 -0
- package/lib/components/Tooltip/Tooltip.js +6 -4
- package/lib/components/Tooltip/index.d.ts +9 -0
- package/lib/components/UIShell/HeaderMenu.js +13 -4
- package/lib/components/UIShell/HeaderMenuItem.js +17 -4
- package/lib/index.d.ts +2 -0
- package/lib/index.js +50 -46
- package/lib/internal/ClickListener.js +1 -2
- package/lib/internal/keyboard/match.js +1 -1
- package/lib/internal/useAttachedMenu.js +89 -0
- package/lib/internal/useDelayedState.d.ts +19 -0
- package/lib/internal/useDelayedState.js +7 -3
- package/lib/internal/useId.js +1 -1
- package/lib/tools/wrapComponent.js +9 -0
- package/package.json +3 -3
|
@@ -7,29 +7,30 @@
|
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default from 'react';
|
|
10
|
+
import React__default, { useRef } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import '../Text/index.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
15
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
15
16
|
import { Text } from '../Text/Text.js';
|
|
16
17
|
|
|
17
18
|
var _excluded = ["className", "disabled", "hideLabel", "id", "labelPosition", "labelText", "name", "onChange", "value"];
|
|
18
|
-
var RadioButton = /*#__PURE__*/React__default.forwardRef(function
|
|
19
|
-
var className =
|
|
20
|
-
disabled =
|
|
21
|
-
hideLabel =
|
|
22
|
-
id =
|
|
23
|
-
|
|
24
|
-
labelPosition =
|
|
25
|
-
|
|
26
|
-
labelText =
|
|
27
|
-
name =
|
|
28
|
-
|
|
29
|
-
onChange =
|
|
30
|
-
|
|
31
|
-
value =
|
|
32
|
-
rest = _objectWithoutProperties(
|
|
19
|
+
var RadioButton = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
20
|
+
var className = props.className,
|
|
21
|
+
disabled = props.disabled,
|
|
22
|
+
hideLabel = props.hideLabel,
|
|
23
|
+
id = props.id,
|
|
24
|
+
_props$labelPosition = props.labelPosition,
|
|
25
|
+
labelPosition = _props$labelPosition === void 0 ? 'right' : _props$labelPosition,
|
|
26
|
+
_props$labelText = props.labelText,
|
|
27
|
+
labelText = _props$labelText === void 0 ? '' : _props$labelText,
|
|
28
|
+
name = props.name,
|
|
29
|
+
_props$onChange = props.onChange,
|
|
30
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
31
|
+
_props$value = props.value,
|
|
32
|
+
value = _props$value === void 0 ? '' : _props$value,
|
|
33
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
33
34
|
|
|
34
35
|
var prefix = usePrefix();
|
|
35
36
|
var uid = useId('radio-button');
|
|
@@ -41,6 +42,7 @@ var RadioButton = /*#__PURE__*/React__default.forwardRef(function RadioButton(_r
|
|
|
41
42
|
|
|
42
43
|
var innerLabelClasses = cx("".concat(prefix, "--radio-button__label-text"), _defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
43
44
|
var wrapperClasses = cx(className, "".concat(prefix, "--radio-button-wrapper"), _defineProperty({}, "".concat(prefix, "--radio-button-wrapper--label-").concat(labelPosition), labelPosition !== 'right'));
|
|
45
|
+
var inputRef = useRef(null);
|
|
44
46
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
45
47
|
className: wrapperClasses
|
|
46
48
|
}, /*#__PURE__*/React__default.createElement("input", _extends({}, rest, {
|
|
@@ -48,7 +50,7 @@ var RadioButton = /*#__PURE__*/React__default.forwardRef(function RadioButton(_r
|
|
|
48
50
|
className: "".concat(prefix, "--radio-button"),
|
|
49
51
|
onChange: handleOnChange,
|
|
50
52
|
id: uniqueId,
|
|
51
|
-
ref: ref,
|
|
53
|
+
ref: mergeRefs(inputRef, ref),
|
|
52
54
|
disabled: disabled,
|
|
53
55
|
value: value,
|
|
54
56
|
name: name
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { ReactNodeLike } from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
export declare const RadioButtonGroupContext: React.Context<null>;
|
|
10
|
+
type ExcludedAttributes = 'onChange';
|
|
11
|
+
export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
|
|
12
|
+
/**
|
|
13
|
+
* Provide a collection of `<RadioButton>` components to render in the group
|
|
14
|
+
*/
|
|
15
|
+
children?: ReactNodeLike;
|
|
16
|
+
/**
|
|
17
|
+
* Provide an optional className to be applied to the container node
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Specify the `<RadioButton>` to be selected by default
|
|
22
|
+
*/
|
|
23
|
+
defaultSelected?: string | number;
|
|
24
|
+
/**
|
|
25
|
+
* Specify whether the group is disabled
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Provide text that is used alongside the control label for additional help
|
|
30
|
+
*/
|
|
31
|
+
helperText?: ReactNodeLike;
|
|
32
|
+
/**
|
|
33
|
+
* Specify whether the control is currently invalid
|
|
34
|
+
*/
|
|
35
|
+
invalid?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
38
|
+
*/
|
|
39
|
+
invalidText?: ReactNodeLike;
|
|
40
|
+
/**
|
|
41
|
+
* Provide where label text should be placed
|
|
42
|
+
*/
|
|
43
|
+
labelPosition?: 'left' | 'right';
|
|
44
|
+
/**
|
|
45
|
+
* Provide a legend to the RadioButtonGroup input that you are
|
|
46
|
+
* exposing to the user
|
|
47
|
+
*/
|
|
48
|
+
legendText?: ReactNodeLike;
|
|
49
|
+
/**
|
|
50
|
+
* Specify the name of the underlying `<input>` nodes
|
|
51
|
+
*/
|
|
52
|
+
name: string;
|
|
53
|
+
/**
|
|
54
|
+
* Provide an optional `onChange` hook that is called whenever the value of
|
|
55
|
+
* the group changes
|
|
56
|
+
*/
|
|
57
|
+
onChange?: (selection: unknown, name: string, evt: unknown) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Provide where radio buttons should be placed
|
|
60
|
+
*/
|
|
61
|
+
orientation?: 'horizontal' | 'vertical';
|
|
62
|
+
/**
|
|
63
|
+
* Whether the RadioButtonGroup should be read-only
|
|
64
|
+
*/
|
|
65
|
+
readOnly?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Specify whether the control is currently in warning state
|
|
68
|
+
*/
|
|
69
|
+
warn?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Provide the text that is displayed when the control is in warning state
|
|
72
|
+
*/
|
|
73
|
+
warnText?: ReactNodeLike;
|
|
74
|
+
/**
|
|
75
|
+
* Specify the value that is currently selected in the group
|
|
76
|
+
*/
|
|
77
|
+
valueSelected?: string | number;
|
|
78
|
+
}
|
|
79
|
+
declare const RadioButtonGroup: React.ForwardRefExoticComponent<RadioButtonGroupProps & React.RefAttributes<unknown>>;
|
|
80
|
+
export default RadioButtonGroup;
|
|
@@ -5,30 +5,42 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default, { useState } from 'react';
|
|
10
|
+
import React__default, { useState, useRef } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { Legend } from '../Text/index.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
15
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
14
16
|
|
|
15
|
-
var
|
|
17
|
+
var _excluded = ["children", "className", "defaultSelected", "disabled", "helperText", "invalid", "invalidText", "labelPosition", "legendText", "name", "onChange", "orientation", "readOnly", "valueSelected", "warn", "warnText"];
|
|
18
|
+
var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
16
19
|
var _classNames;
|
|
17
20
|
|
|
18
|
-
var children =
|
|
19
|
-
className =
|
|
20
|
-
defaultSelected =
|
|
21
|
-
disabled =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
var children = props.children,
|
|
22
|
+
className = props.className,
|
|
23
|
+
defaultSelected = props.defaultSelected,
|
|
24
|
+
disabled = props.disabled,
|
|
25
|
+
helperText = props.helperText,
|
|
26
|
+
_props$invalid = props.invalid,
|
|
27
|
+
invalid = _props$invalid === void 0 ? false : _props$invalid,
|
|
28
|
+
invalidText = props.invalidText,
|
|
29
|
+
_props$labelPosition = props.labelPosition,
|
|
30
|
+
labelPosition = _props$labelPosition === void 0 ? 'right' : _props$labelPosition,
|
|
31
|
+
legendText = props.legendText,
|
|
32
|
+
name = props.name,
|
|
33
|
+
_props$onChange = props.onChange,
|
|
34
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
35
|
+
_props$orientation = props.orientation,
|
|
36
|
+
orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
|
37
|
+
readOnly = props.readOnly,
|
|
38
|
+
valueSelected = props.valueSelected,
|
|
39
|
+
_props$warn = props.warn,
|
|
40
|
+
warn = _props$warn === void 0 ? false : _props$warn,
|
|
41
|
+
warnText = props.warnText,
|
|
42
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
43
|
+
|
|
32
44
|
var prefix = usePrefix();
|
|
33
45
|
|
|
34
46
|
var _useState = useState(valueSelected !== null && valueSelected !== void 0 ? valueSelected : defaultSelected),
|
|
@@ -53,7 +65,11 @@ var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function RadioButt
|
|
|
53
65
|
|
|
54
66
|
function getRadioButtons() {
|
|
55
67
|
var mappedChildren = React__default.Children.map(children, function (radioButton) {
|
|
56
|
-
var
|
|
68
|
+
var _props;
|
|
69
|
+
|
|
70
|
+
var _ref = (_props = radioButton === null || radioButton === void 0 ? void 0 : radioButton.props) !== null && _props !== void 0 ? _props : undefined,
|
|
71
|
+
value = _ref.value;
|
|
72
|
+
|
|
57
73
|
var newProps = {
|
|
58
74
|
name: name,
|
|
59
75
|
key: value,
|
|
@@ -62,11 +78,13 @@ var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function RadioButt
|
|
|
62
78
|
checked: value === selected
|
|
63
79
|
};
|
|
64
80
|
|
|
65
|
-
if (!selected && radioButton.props.checked) {
|
|
81
|
+
if (!selected && radioButton !== null && radioButton !== void 0 && radioButton.props.checked) {
|
|
66
82
|
newProps.checked = true;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
if (radioButton) {
|
|
86
|
+
return /*#__PURE__*/React__default.cloneElement(radioButton, newProps);
|
|
87
|
+
}
|
|
70
88
|
});
|
|
71
89
|
return mappedChildren;
|
|
72
90
|
}
|
|
@@ -80,18 +98,36 @@ var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function RadioButt
|
|
|
80
98
|
}
|
|
81
99
|
}
|
|
82
100
|
|
|
83
|
-
var
|
|
101
|
+
var showWarning = !readOnly && !invalid && warn;
|
|
102
|
+
var showHelper = !invalid && !disabled && !warn;
|
|
84
103
|
var wrapperClasses = cx("".concat(prefix, "--form-item"), className);
|
|
104
|
+
var fieldsetClasses = cx("".concat(prefix, "--radio-button-group"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--").concat(orientation), orientation === 'vertical'), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--label-").concat(labelPosition), labelPosition), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--readonly"), readOnly), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--invalid"), !readOnly && invalid), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--warning"), showWarning), _classNames));
|
|
105
|
+
var helperClasses = cx("".concat(prefix, "--form__helper-text"), _defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
106
|
+
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
107
|
+
className: helperClasses
|
|
108
|
+
}, helperText) : null;
|
|
109
|
+
var divRef = useRef(null);
|
|
85
110
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
86
111
|
className: wrapperClasses,
|
|
87
|
-
ref: ref
|
|
88
|
-
}, /*#__PURE__*/React__default.createElement("fieldset", {
|
|
112
|
+
ref: mergeRefs(divRef, ref)
|
|
113
|
+
}, /*#__PURE__*/React__default.createElement("fieldset", _extends({
|
|
89
114
|
className: fieldsetClasses,
|
|
90
115
|
disabled: disabled,
|
|
116
|
+
"data-invalid": invalid ? true : undefined,
|
|
91
117
|
"aria-readonly": readOnly
|
|
92
|
-
}, legendText && /*#__PURE__*/React__default.createElement(Legend, {
|
|
118
|
+
}, rest), legendText && /*#__PURE__*/React__default.createElement(Legend, {
|
|
93
119
|
className: "".concat(prefix, "--label")
|
|
94
|
-
}, legendText), getRadioButtons())
|
|
120
|
+
}, legendText), getRadioButtons()), /*#__PURE__*/React__default.createElement("div", {
|
|
121
|
+
className: "".concat(prefix, "--radio-button__validation-msg")
|
|
122
|
+
}, !readOnly && invalid && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
123
|
+
className: "".concat(prefix, "--radio-button__invalid-icon")
|
|
124
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
125
|
+
className: "".concat(prefix, "--form-requirement")
|
|
126
|
+
}, invalidText)), showWarning && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningAltFilled, {
|
|
127
|
+
className: "".concat(prefix, "--radio-button__invalid-icon ").concat(prefix, "--radio-button__invalid-icon--warning")
|
|
128
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
129
|
+
className: "".concat(prefix, "--form-requirement")
|
|
130
|
+
}, warnText)), showHelper && helper));
|
|
95
131
|
});
|
|
96
132
|
RadioButtonGroup.propTypes = {
|
|
97
133
|
/**
|
|
@@ -114,6 +150,21 @@ RadioButtonGroup.propTypes = {
|
|
|
114
150
|
*/
|
|
115
151
|
disabled: PropTypes.bool,
|
|
116
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Provide text that is used alongside the control label for additional help
|
|
155
|
+
*/
|
|
156
|
+
helperText: PropTypes.node,
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Specify whether the control is currently invalid
|
|
160
|
+
*/
|
|
161
|
+
invalid: PropTypes.bool,
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
165
|
+
*/
|
|
166
|
+
invalidText: PropTypes.node,
|
|
167
|
+
|
|
117
168
|
/**
|
|
118
169
|
* Provide where label text should be placed
|
|
119
170
|
*/
|
|
@@ -149,8 +200,19 @@ RadioButtonGroup.propTypes = {
|
|
|
149
200
|
/**
|
|
150
201
|
* Specify the value that is currently selected in the group
|
|
151
202
|
*/
|
|
152
|
-
valueSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
203
|
+
valueSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Specify whether the control is currently in warning state
|
|
207
|
+
*/
|
|
208
|
+
warn: PropTypes.bool,
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Provide the text that is displayed when the control is in warning state
|
|
212
|
+
*/
|
|
213
|
+
warnText: PropTypes.node
|
|
153
214
|
};
|
|
215
|
+
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
|
154
216
|
var RadioButtonGroup$1 = RadioButtonGroup;
|
|
155
217
|
|
|
156
218
|
export { RadioButtonGroup$1 as default };
|
|
@@ -19,8 +19,7 @@ import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
|
19
19
|
var _CheckmarkFilled;
|
|
20
20
|
|
|
21
21
|
var _excluded = ["children", "className", "disabled", "light", "checked", "name", "value", "id", "onChange", "tabIndex"];
|
|
22
|
-
|
|
23
|
-
function RadioTile(_ref) {
|
|
22
|
+
var RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref, ref) {
|
|
24
23
|
var _cx;
|
|
25
24
|
|
|
26
25
|
var children = _ref.children,
|
|
@@ -60,7 +59,8 @@ function RadioTile(_ref) {
|
|
|
60
59
|
onKeyDown: !disabled ? handleOnKeyDown : null,
|
|
61
60
|
tabIndex: !disabled ? tabIndex : null,
|
|
62
61
|
type: "radio",
|
|
63
|
-
value: value
|
|
62
|
+
value: value,
|
|
63
|
+
ref: ref
|
|
64
64
|
}), /*#__PURE__*/React__default.createElement("label", _extends({}, rest, {
|
|
65
65
|
htmlFor: inputId,
|
|
66
66
|
className: className
|
|
@@ -69,8 +69,7 @@ function RadioTile(_ref) {
|
|
|
69
69
|
}, _CheckmarkFilled || (_CheckmarkFilled = /*#__PURE__*/React__default.createElement(CheckmarkFilled, null))), /*#__PURE__*/React__default.createElement("span", {
|
|
70
70
|
className: "".concat(prefix, "--tile-content")
|
|
71
71
|
}, children)));
|
|
72
|
-
}
|
|
73
|
-
|
|
72
|
+
});
|
|
74
73
|
RadioTile.propTypes = {
|
|
75
74
|
/**
|
|
76
75
|
* `true` if this tile should be selected.
|
|
@@ -127,5 +126,6 @@ RadioTile.defaultProps = {
|
|
|
127
126
|
onChange: function onChange() {},
|
|
128
127
|
tabIndex: 0
|
|
129
128
|
};
|
|
129
|
+
var RadioTile$1 = RadioTile;
|
|
130
130
|
|
|
131
|
-
export { RadioTile as default };
|
|
131
|
+
export { RadioTile$1 as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
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 from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
export interface SearchSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify whether the Search should be a small variant.
|
|
16
|
+
*/
|
|
17
|
+
small?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const SearchSkeleton: {
|
|
20
|
+
({ small, className, ...rest }: SearchSkeletonProps): JSX.Element;
|
|
21
|
+
propTypes: {
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to add.
|
|
24
|
+
*/
|
|
25
|
+
className: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Specify whether the Search should be a small variant
|
|
28
|
+
*/
|
|
29
|
+
small: PropTypes.Requireable<boolean>;
|
|
30
|
+
};
|
|
31
|
+
defaultProps: {
|
|
32
|
+
small: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export default SearchSkeleton;
|
|
36
|
+
export { SearchSkeleton };
|
|
@@ -44,7 +44,7 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
|
|
|
44
44
|
onKeyDown = _ref.onKeyDown,
|
|
45
45
|
onExpand = _ref.onExpand,
|
|
46
46
|
_ref$placeholder = _ref.placeholder,
|
|
47
|
-
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
47
|
+
placeholder = _ref$placeholder === void 0 ? 'Search' : _ref$placeholder,
|
|
48
48
|
renderIcon = _ref.renderIcon,
|
|
49
49
|
_ref$role = _ref.role,
|
|
50
50
|
role = _ref$role === void 0 ? 'searchbox' : _ref$role,
|
|
@@ -115,9 +115,10 @@ var Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forwar
|
|
|
115
115
|
|
|
116
116
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
117
117
|
role: "search",
|
|
118
|
-
"aria-
|
|
118
|
+
"aria-label": placeholder,
|
|
119
119
|
className: searchClasses
|
|
120
120
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
121
|
+
"aria-labelledby": uniqueId,
|
|
121
122
|
role: onExpand ? 'button' : null,
|
|
122
123
|
className: "".concat(prefix, "--search-magnifier"),
|
|
123
124
|
onClick: onExpand
|
|
@@ -0,0 +1,89 @@
|
|
|
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, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
|
|
8
|
+
type ExcludedAttributes = 'size';
|
|
9
|
+
interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
|
|
10
|
+
/**
|
|
11
|
+
* Provide the contents of your Select
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the node containing the label and the select box
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optionally provide the default value of the `<select>`
|
|
20
|
+
*/
|
|
21
|
+
defaultValue?: any;
|
|
22
|
+
/**
|
|
23
|
+
* Specify whether the control is disabled
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Provide text that is used alongside the control label for additional help
|
|
28
|
+
*/
|
|
29
|
+
helperText?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Specify whether the label should be hidden, or not
|
|
32
|
+
*/
|
|
33
|
+
hideLabel?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Specify a custom `id` for the `<select>`
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Specify whether you want the inline version of this control
|
|
40
|
+
*/
|
|
41
|
+
inline?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Specify if the currently value is invalid.
|
|
44
|
+
*/
|
|
45
|
+
invalid?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Message which is displayed if the value is invalid.
|
|
48
|
+
*/
|
|
49
|
+
invalidText?: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Provide label text to be read by screen readers when interacting with the control.
|
|
52
|
+
*/
|
|
53
|
+
labelText?: ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
56
|
+
* Don't use this to make tile background color same as container background color.
|
|
57
|
+
*
|
|
58
|
+
* @deprecated The `light` prop for `Select` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component.
|
|
59
|
+
* It will be moved in the next major release.
|
|
60
|
+
*/
|
|
61
|
+
light?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Reserved for use with <Pagination> component. Will not render a label for the
|
|
64
|
+
* select since Pagination renders one for us.
|
|
65
|
+
*/
|
|
66
|
+
noLabel?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Provide an optional `onChange` hook that is called each time the value of the underlying `<input>` changes.
|
|
69
|
+
*/
|
|
70
|
+
onChange?: ChangeEventHandler<HTMLSelectElement>;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the select should be read-only
|
|
73
|
+
*/
|
|
74
|
+
readOnly?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Specify the size of the Select Input.
|
|
77
|
+
*/
|
|
78
|
+
size?: 'sm' | 'md' | 'lg';
|
|
79
|
+
/**
|
|
80
|
+
* Specify whether the control is currently in warning state
|
|
81
|
+
*/
|
|
82
|
+
warn?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Provide the text that is displayed when the control is in warning state
|
|
85
|
+
*/
|
|
86
|
+
warnText?: ReactNode;
|
|
87
|
+
}
|
|
88
|
+
declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "className" | "disabled" | "size" | "form" | "slot" | "style" | "title" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "onAnimationEnd" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "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" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inline" | "name" | "readOnly" | "required" | "labelText" | "hideLabel" | "light" | "invalid" | "invalidText" | "warn" | "warnText" | "helperText" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
|
|
89
|
+
export default Select;
|
|
@@ -0,0 +1,62 @@
|
|
|
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 from 'prop-types';
|
|
8
|
+
import { HTMLAttributes } from 'react';
|
|
9
|
+
export interface SelectItemProps extends HTMLAttributes<HTMLOptionElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to be applied to the node
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify whether the <SelectItem> should be disabled
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Specify whether the <SelectItem> is hidden
|
|
20
|
+
*/
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Provide the contents of your <SelectItem>
|
|
24
|
+
*/
|
|
25
|
+
text: string;
|
|
26
|
+
/**
|
|
27
|
+
* Specify the value of the <SelectItem>
|
|
28
|
+
*/
|
|
29
|
+
value: any;
|
|
30
|
+
}
|
|
31
|
+
declare const SelectItem: {
|
|
32
|
+
({ className, value, disabled, hidden, text, ...other }: SelectItemProps): JSX.Element;
|
|
33
|
+
propTypes: {
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to be applied to the node
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.Requireable<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Specify whether the <SelectItem> should be disabled
|
|
40
|
+
*/
|
|
41
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Specify whether the <SelectItem> is hidden
|
|
44
|
+
*/
|
|
45
|
+
hidden: PropTypes.Requireable<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Provide the contents of your <SelectItem>
|
|
48
|
+
*/
|
|
49
|
+
text: PropTypes.Validator<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Specify the value of the <SelectItem>
|
|
52
|
+
*/
|
|
53
|
+
value: PropTypes.Validator<any>;
|
|
54
|
+
};
|
|
55
|
+
defaultProps: {
|
|
56
|
+
disabled: boolean;
|
|
57
|
+
hidden: boolean;
|
|
58
|
+
value: string;
|
|
59
|
+
text: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export default SelectItem;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
@@ -14,8 +14,6 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
14
14
|
var _excluded = ["className", "value", "disabled", "hidden", "text"];
|
|
15
15
|
|
|
16
16
|
var SelectItem = function SelectItem(_ref) {
|
|
17
|
-
var _classNames;
|
|
18
|
-
|
|
19
17
|
var className = _ref.className,
|
|
20
18
|
value = _ref.value,
|
|
21
19
|
disabled = _ref.disabled,
|
|
@@ -24,7 +22,7 @@ var SelectItem = function SelectItem(_ref) {
|
|
|
24
22
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
25
23
|
|
|
26
24
|
var prefix = usePrefix();
|
|
27
|
-
var selectItemClasses = cx((
|
|
25
|
+
var selectItemClasses = cx(_objectSpread2(_defineProperty({}, "".concat(prefix, "--select-option"), true), className && _defineProperty({}, className, className)));
|
|
28
26
|
return /*#__PURE__*/React__default.createElement("option", _extends({}, other, {
|
|
29
27
|
className: selectItemClasses,
|
|
30
28
|
value: value,
|
|
@@ -0,0 +1,52 @@
|
|
|
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 from 'prop-types';
|
|
8
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
9
|
+
export interface SelectItemGroupProps extends HTMLAttributes<HTMLOptGroupElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Provide the contents of your <SelectItemGroup>
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specify whether the <SelectItemGroup> should be disabled
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Specify the label to be displayed
|
|
24
|
+
*/
|
|
25
|
+
label: string;
|
|
26
|
+
}
|
|
27
|
+
declare const SelectItemGroup: {
|
|
28
|
+
({ children, className, disabled, label, ...other }: SelectItemGroupProps): JSX.Element;
|
|
29
|
+
propTypes: {
|
|
30
|
+
/**
|
|
31
|
+
* Provide the contents of your <SelectItemGroup>
|
|
32
|
+
*/
|
|
33
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to be applied to the node
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.Requireable<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Specify whether the <SelectItemGroup> should be disabled
|
|
40
|
+
*/
|
|
41
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Specify the label to be displayed
|
|
44
|
+
*/
|
|
45
|
+
label: PropTypes.Validator<string>;
|
|
46
|
+
};
|
|
47
|
+
defaultProps: {
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
label: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export default SelectItemGroup;
|