@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
|
@@ -16,6 +16,7 @@ var cx = require('classnames');
|
|
|
16
16
|
require('../Text/index.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
18
|
var useId = require('../../internal/useId.js');
|
|
19
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
19
20
|
var Text = require('../Text/Text.js');
|
|
20
21
|
|
|
21
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -25,21 +26,21 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
25
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
26
27
|
|
|
27
28
|
var _excluded = ["className", "disabled", "hideLabel", "id", "labelPosition", "labelText", "name", "onChange", "value"];
|
|
28
|
-
var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
29
|
-
var className =
|
|
30
|
-
disabled =
|
|
31
|
-
hideLabel =
|
|
32
|
-
id =
|
|
33
|
-
|
|
34
|
-
labelPosition =
|
|
35
|
-
|
|
36
|
-
labelText =
|
|
37
|
-
name =
|
|
38
|
-
|
|
39
|
-
onChange =
|
|
40
|
-
|
|
41
|
-
value =
|
|
42
|
-
rest = _rollupPluginBabelHelpers.objectWithoutProperties(
|
|
29
|
+
var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
30
|
+
var className = props.className,
|
|
31
|
+
disabled = props.disabled,
|
|
32
|
+
hideLabel = props.hideLabel,
|
|
33
|
+
id = props.id,
|
|
34
|
+
_props$labelPosition = props.labelPosition,
|
|
35
|
+
labelPosition = _props$labelPosition === void 0 ? 'right' : _props$labelPosition,
|
|
36
|
+
_props$labelText = props.labelText,
|
|
37
|
+
labelText = _props$labelText === void 0 ? '' : _props$labelText,
|
|
38
|
+
name = props.name,
|
|
39
|
+
_props$onChange = props.onChange,
|
|
40
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
41
|
+
_props$value = props.value,
|
|
42
|
+
value = _props$value === void 0 ? '' : _props$value,
|
|
43
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
43
44
|
|
|
44
45
|
var prefix = usePrefix.usePrefix();
|
|
45
46
|
var uid = useId.useId('radio-button');
|
|
@@ -51,6 +52,7 @@ var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
51
52
|
|
|
52
53
|
var innerLabelClasses = cx__default["default"]("".concat(prefix, "--radio-button__label-text"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
53
54
|
var wrapperClasses = cx__default["default"](className, "".concat(prefix, "--radio-button-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--radio-button-wrapper--label-").concat(labelPosition), labelPosition !== 'right'));
|
|
55
|
+
var inputRef = React.useRef(null);
|
|
54
56
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
55
57
|
className: wrapperClasses
|
|
56
58
|
}, /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
@@ -58,7 +60,7 @@ var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function Rad
|
|
|
58
60
|
className: "".concat(prefix, "--radio-button"),
|
|
59
61
|
onChange: handleOnChange,
|
|
60
62
|
id: uniqueId,
|
|
61
|
-
ref: ref,
|
|
63
|
+
ref: mergeRefs["default"](inputRef, ref),
|
|
62
64
|
disabled: disabled,
|
|
63
65
|
value: value,
|
|
64
66
|
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;
|
|
@@ -15,6 +15,8 @@ var React = require('react');
|
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var index = require('../Text/index.js');
|
|
17
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var iconsReact = require('@carbon/icons-react');
|
|
19
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
18
20
|
|
|
19
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
22
|
|
|
@@ -22,23 +24,33 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
22
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
25
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
26
|
|
|
25
|
-
var
|
|
27
|
+
var _excluded = ["children", "className", "defaultSelected", "disabled", "helperText", "invalid", "invalidText", "labelPosition", "legendText", "name", "onChange", "orientation", "readOnly", "valueSelected", "warn", "warnText"];
|
|
28
|
+
var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
26
29
|
var _classNames;
|
|
27
30
|
|
|
28
|
-
var children =
|
|
29
|
-
className =
|
|
30
|
-
defaultSelected =
|
|
31
|
-
disabled =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
var children = props.children,
|
|
32
|
+
className = props.className,
|
|
33
|
+
defaultSelected = props.defaultSelected,
|
|
34
|
+
disabled = props.disabled,
|
|
35
|
+
helperText = props.helperText,
|
|
36
|
+
_props$invalid = props.invalid,
|
|
37
|
+
invalid = _props$invalid === void 0 ? false : _props$invalid,
|
|
38
|
+
invalidText = props.invalidText,
|
|
39
|
+
_props$labelPosition = props.labelPosition,
|
|
40
|
+
labelPosition = _props$labelPosition === void 0 ? 'right' : _props$labelPosition,
|
|
41
|
+
legendText = props.legendText,
|
|
42
|
+
name = props.name,
|
|
43
|
+
_props$onChange = props.onChange,
|
|
44
|
+
onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
|
|
45
|
+
_props$orientation = props.orientation,
|
|
46
|
+
orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
|
47
|
+
readOnly = props.readOnly,
|
|
48
|
+
valueSelected = props.valueSelected,
|
|
49
|
+
_props$warn = props.warn,
|
|
50
|
+
warn = _props$warn === void 0 ? false : _props$warn,
|
|
51
|
+
warnText = props.warnText,
|
|
52
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
53
|
+
|
|
42
54
|
var prefix = usePrefix.usePrefix();
|
|
43
55
|
|
|
44
56
|
var _useState = React.useState(valueSelected !== null && valueSelected !== void 0 ? valueSelected : defaultSelected),
|
|
@@ -63,7 +75,11 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
63
75
|
|
|
64
76
|
function getRadioButtons() {
|
|
65
77
|
var mappedChildren = React__default["default"].Children.map(children, function (radioButton) {
|
|
66
|
-
var
|
|
78
|
+
var _props;
|
|
79
|
+
|
|
80
|
+
var _ref = (_props = radioButton === null || radioButton === void 0 ? void 0 : radioButton.props) !== null && _props !== void 0 ? _props : undefined,
|
|
81
|
+
value = _ref.value;
|
|
82
|
+
|
|
67
83
|
var newProps = {
|
|
68
84
|
name: name,
|
|
69
85
|
key: value,
|
|
@@ -72,11 +88,13 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
72
88
|
checked: value === selected
|
|
73
89
|
};
|
|
74
90
|
|
|
75
|
-
if (!selected && radioButton.props.checked) {
|
|
91
|
+
if (!selected && radioButton !== null && radioButton !== void 0 && radioButton.props.checked) {
|
|
76
92
|
newProps.checked = true;
|
|
77
93
|
}
|
|
78
94
|
|
|
79
|
-
|
|
95
|
+
if (radioButton) {
|
|
96
|
+
return /*#__PURE__*/React__default["default"].cloneElement(radioButton, newProps);
|
|
97
|
+
}
|
|
80
98
|
});
|
|
81
99
|
return mappedChildren;
|
|
82
100
|
}
|
|
@@ -90,18 +108,36 @@ var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
90
108
|
}
|
|
91
109
|
}
|
|
92
110
|
|
|
93
|
-
var
|
|
111
|
+
var showWarning = !readOnly && !invalid && warn;
|
|
112
|
+
var showHelper = !invalid && !disabled && !warn;
|
|
94
113
|
var wrapperClasses = cx__default["default"]("".concat(prefix, "--form-item"), className);
|
|
114
|
+
var fieldsetClasses = cx__default["default"]("".concat(prefix, "--radio-button-group"), (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--").concat(orientation), orientation === 'vertical'), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--label-").concat(labelPosition), labelPosition), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--readonly"), readOnly), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--invalid"), !readOnly && invalid), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--warning"), showWarning), _classNames));
|
|
115
|
+
var helperClasses = cx__default["default"]("".concat(prefix, "--form__helper-text"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
116
|
+
var helper = helperText ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
117
|
+
className: helperClasses
|
|
118
|
+
}, helperText) : null;
|
|
119
|
+
var divRef = React.useRef(null);
|
|
95
120
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
96
121
|
className: wrapperClasses,
|
|
97
|
-
ref: ref
|
|
98
|
-
}, /*#__PURE__*/React__default["default"].createElement("fieldset", {
|
|
122
|
+
ref: mergeRefs["default"](divRef, ref)
|
|
123
|
+
}, /*#__PURE__*/React__default["default"].createElement("fieldset", _rollupPluginBabelHelpers["extends"]({
|
|
99
124
|
className: fieldsetClasses,
|
|
100
125
|
disabled: disabled,
|
|
126
|
+
"data-invalid": invalid ? true : undefined,
|
|
101
127
|
"aria-readonly": readOnly
|
|
102
|
-
}, legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
|
|
128
|
+
}, rest), legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
|
|
103
129
|
className: "".concat(prefix, "--label")
|
|
104
|
-
}, legendText), getRadioButtons())
|
|
130
|
+
}, legendText), getRadioButtons()), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
131
|
+
className: "".concat(prefix, "--radio-button__validation-msg")
|
|
132
|
+
}, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
133
|
+
className: "".concat(prefix, "--radio-button__invalid-icon")
|
|
134
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
135
|
+
className: "".concat(prefix, "--form-requirement")
|
|
136
|
+
}, invalidText)), showWarning && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningAltFilled, {
|
|
137
|
+
className: "".concat(prefix, "--radio-button__invalid-icon ").concat(prefix, "--radio-button__invalid-icon--warning")
|
|
138
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
139
|
+
className: "".concat(prefix, "--form-requirement")
|
|
140
|
+
}, warnText)), showHelper && helper));
|
|
105
141
|
});
|
|
106
142
|
RadioButtonGroup.propTypes = {
|
|
107
143
|
/**
|
|
@@ -124,6 +160,21 @@ RadioButtonGroup.propTypes = {
|
|
|
124
160
|
*/
|
|
125
161
|
disabled: PropTypes__default["default"].bool,
|
|
126
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Provide text that is used alongside the control label for additional help
|
|
165
|
+
*/
|
|
166
|
+
helperText: PropTypes__default["default"].node,
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Specify whether the control is currently invalid
|
|
170
|
+
*/
|
|
171
|
+
invalid: PropTypes__default["default"].bool,
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
175
|
+
*/
|
|
176
|
+
invalidText: PropTypes__default["default"].node,
|
|
177
|
+
|
|
127
178
|
/**
|
|
128
179
|
* Provide where label text should be placed
|
|
129
180
|
*/
|
|
@@ -159,8 +210,19 @@ RadioButtonGroup.propTypes = {
|
|
|
159
210
|
/**
|
|
160
211
|
* Specify the value that is currently selected in the group
|
|
161
212
|
*/
|
|
162
|
-
valueSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
|
|
213
|
+
valueSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Specify whether the control is currently in warning state
|
|
217
|
+
*/
|
|
218
|
+
warn: PropTypes__default["default"].bool,
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Provide the text that is displayed when the control is in warning state
|
|
222
|
+
*/
|
|
223
|
+
warnText: PropTypes__default["default"].node
|
|
163
224
|
};
|
|
225
|
+
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
|
164
226
|
var RadioButtonGroup$1 = RadioButtonGroup;
|
|
165
227
|
|
|
166
228
|
exports["default"] = RadioButtonGroup$1;
|
|
@@ -29,8 +29,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
29
29
|
var _CheckmarkFilled;
|
|
30
30
|
|
|
31
31
|
var _excluded = ["children", "className", "disabled", "light", "checked", "name", "value", "id", "onChange", "tabIndex"];
|
|
32
|
-
|
|
33
|
-
function RadioTile(_ref) {
|
|
32
|
+
var RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function RadioTile(_ref, ref) {
|
|
34
33
|
var _cx;
|
|
35
34
|
|
|
36
35
|
var children = _ref.children,
|
|
@@ -70,7 +69,8 @@ function RadioTile(_ref) {
|
|
|
70
69
|
onKeyDown: !disabled ? handleOnKeyDown : null,
|
|
71
70
|
tabIndex: !disabled ? tabIndex : null,
|
|
72
71
|
type: "radio",
|
|
73
|
-
value: value
|
|
72
|
+
value: value,
|
|
73
|
+
ref: ref
|
|
74
74
|
}), /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
75
75
|
htmlFor: inputId,
|
|
76
76
|
className: className
|
|
@@ -79,8 +79,7 @@ function RadioTile(_ref) {
|
|
|
79
79
|
}, _CheckmarkFilled || (_CheckmarkFilled = /*#__PURE__*/React__default["default"].createElement(iconsReact.CheckmarkFilled, null))), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
80
80
|
className: "".concat(prefix, "--tile-content")
|
|
81
81
|
}, children)));
|
|
82
|
-
}
|
|
83
|
-
|
|
82
|
+
});
|
|
84
83
|
RadioTile.propTypes = {
|
|
85
84
|
/**
|
|
86
85
|
* `true` if this tile should be selected.
|
|
@@ -137,5 +136,6 @@ RadioTile.defaultProps = {
|
|
|
137
136
|
onChange: function onChange() {},
|
|
138
137
|
tabIndex: 0
|
|
139
138
|
};
|
|
139
|
+
var RadioTile$1 = RadioTile;
|
|
140
140
|
|
|
141
|
-
exports["default"] = RadioTile;
|
|
141
|
+
exports["default"] = RadioTile$1;
|
|
@@ -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 };
|
|
@@ -54,7 +54,7 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
54
54
|
onKeyDown = _ref.onKeyDown,
|
|
55
55
|
onExpand = _ref.onExpand,
|
|
56
56
|
_ref$placeholder = _ref.placeholder,
|
|
57
|
-
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
57
|
+
placeholder = _ref$placeholder === void 0 ? 'Search' : _ref$placeholder,
|
|
58
58
|
renderIcon = _ref.renderIcon,
|
|
59
59
|
_ref$role = _ref.role,
|
|
60
60
|
role = _ref$role === void 0 ? 'searchbox' : _ref$role,
|
|
@@ -125,9 +125,10 @@ var Search = /*#__PURE__*/React__default["default"].forwardRef(function Search(_
|
|
|
125
125
|
|
|
126
126
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
127
127
|
role: "search",
|
|
128
|
-
"aria-
|
|
128
|
+
"aria-label": placeholder,
|
|
129
129
|
className: searchClasses
|
|
130
130
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
131
|
+
"aria-labelledby": uniqueId,
|
|
131
132
|
role: onExpand ? 'button' : null,
|
|
132
133
|
className: "".concat(prefix, "--search-magnifier"),
|
|
133
134
|
onClick: onExpand
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var Search = require('./Search.js');
|
|
13
|
+
var Search_Skeleton = require('./Search.Skeleton.js');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
exports.Search = Search["default"];
|
|
17
18
|
exports["default"] = Search["default"];
|
|
19
|
+
exports.SearchSkeleton = Search_Skeleton["default"];
|
|
@@ -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;
|
|
@@ -24,8 +24,6 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
24
24
|
var _excluded = ["className", "value", "disabled", "hidden", "text"];
|
|
25
25
|
|
|
26
26
|
var SelectItem = function SelectItem(_ref) {
|
|
27
|
-
var _classNames;
|
|
28
|
-
|
|
29
27
|
var className = _ref.className,
|
|
30
28
|
value = _ref.value,
|
|
31
29
|
disabled = _ref.disabled,
|
|
@@ -34,7 +32,7 @@ var SelectItem = function SelectItem(_ref) {
|
|
|
34
32
|
other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
35
33
|
|
|
36
34
|
var prefix = usePrefix.usePrefix();
|
|
37
|
-
var selectItemClasses = cx__default["default"]((
|
|
35
|
+
var selectItemClasses = cx__default["default"](_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--select-option"), true), className && _rollupPluginBabelHelpers.defineProperty({}, className, className)));
|
|
38
36
|
return /*#__PURE__*/React__default["default"].createElement("option", _rollupPluginBabelHelpers["extends"]({}, other, {
|
|
39
37
|
className: selectItemClasses,
|
|
40
38
|
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;
|