@carbon/react 1.40.0 → 1.41.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 +1564 -872
- package/es/components/Accordion/Accordion.Skeleton.d.ts +0 -5
- package/es/components/Accordion/Accordion.Skeleton.js +0 -5
- package/es/components/Breadcrumb/BreadcrumbItem.js +3 -1
- package/es/components/Checkbox/Checkbox.js +3 -6
- package/es/components/CodeSnippet/CodeSnippet.js +5 -12
- package/es/components/ComboBox/ComboBox.d.ts +1 -5
- package/es/components/ComboBox/ComboBox.js +6 -20
- package/es/components/ComposedModal/ComposedModal.js +1 -5
- package/es/components/ComposedModal/ModalFooter.js +4 -9
- package/es/components/ComposedModal/ModalHeader.js +1 -4
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +3 -8
- package/es/components/ContentSwitcher/ContentSwitcher.js +7 -11
- package/es/components/Copy/Copy.js +4 -8
- package/es/components/CopyButton/CopyButton.js +8 -7
- package/es/components/DataTable/DataTable.d.ts +3 -39
- package/es/components/DataTable/DataTable.js +10 -18
- package/es/components/DataTable/Table.d.ts +0 -4
- package/es/components/DataTable/Table.js +4 -7
- package/es/components/DataTable/TableBatchAction.js +12 -5
- package/es/components/DataTable/TableBatchActions.js +1 -6
- package/es/components/DataTable/TableBody.d.ts +0 -3
- package/es/components/DataTable/TableBody.js +1 -3
- package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/es/components/DataTable/TableHeader.js +3 -8
- package/es/components/DataTable/TableSelectAll.d.ts +0 -3
- package/es/components/DataTable/TableSelectAll.js +1 -4
- package/es/components/DataTable/TableToolbar.d.ts +10 -0
- package/es/components/DataTable/TableToolbar.js +15 -7
- package/es/components/DataTable/TableToolbarMenu.js +2 -6
- package/es/components/DataTable/TableToolbarSearch.d.ts +2 -8
- package/es/components/DataTable/TableToolbarSearch.js +6 -11
- package/es/components/DataTable/tools/sorting.js +2 -2
- package/es/components/DatePicker/DatePicker.d.ts +4 -4
- package/es/components/DatePicker/DatePicker.js +9 -4
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +6 -0
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +12 -6
- package/es/components/Dropdown/Dropdown.js +6 -15
- package/es/components/FileUploader/FileUploader.d.ts +2 -11
- package/es/components/FileUploader/FileUploader.js +15 -19
- package/es/components/FileUploader/FileUploaderButton.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +0 -7
- package/es/components/FileUploader/FileUploaderDropContainer.js +2 -8
- package/es/components/FileUploader/FileUploaderItem.d.ts +0 -4
- package/es/components/FileUploader/FileUploaderItem.js +12 -9
- package/es/components/FileUploader/Filename.d.ts +6 -10
- package/es/components/FileUploader/Filename.js +7 -11
- package/es/components/FormGroup/FormGroup.d.ts +0 -5
- package/es/components/FormGroup/FormGroup.js +3 -8
- package/es/components/FormItem/FormItem.d.ts +32 -0
- package/es/components/FormItem/index.d.ts +9 -0
- package/es/components/FormLabel/FormLabel.js +4 -1
- package/es/components/ListBox/ListBox.js +4 -8
- package/es/components/ListBox/ListBoxMenuIcon.js +1 -4
- package/es/components/ListBox/ListBoxMenuItem.js +4 -8
- package/es/components/ListBox/ListBoxSelection.d.ts +5 -5
- package/es/components/ListBox/ListBoxSelection.js +12 -13
- package/es/components/ListBox/next/ListBoxSelection.js +12 -13
- package/es/components/ListBox/next/ListBoxTrigger.js +3 -5
- package/es/components/ListItem/ListItem.d.ts +1 -1
- package/es/components/ListItem/ListItem.js +6 -2
- package/es/components/Menu/MenuItem.js +4 -1
- package/es/components/Modal/Modal.d.ts +137 -0
- package/es/components/Modal/Modal.js +39 -45
- package/es/components/Modal/index.d.ts +9 -0
- package/es/components/ModalWrapper/ModalWrapper.js +13 -19
- package/es/components/MultiSelect/FilterableMultiSelect.js +14 -28
- package/es/components/MultiSelect/MultiSelect.js +17 -33
- package/es/components/MultiSelect/MultiSelectPropTypes.js +2 -2
- package/es/components/MultiSelect/tools/sorting.js +2 -2
- package/es/components/Notification/Notification.d.ts +11 -29
- package/es/components/Notification/Notification.js +38 -57
- package/es/components/NumberInput/NumberInput.js +6 -2
- package/es/components/OverflowMenu/OverflowMenu.js +27 -33
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +4 -1
- package/es/components/Pagination/experimental/PageSelector.js +3 -8
- package/es/components/Pagination/experimental/Pagination.js +16 -34
- package/es/components/ProgressIndicator/ProgressIndicator.js +7 -6
- package/es/components/RadioTile/RadioTile.js +6 -7
- package/es/components/Search/Search.Skeleton.d.ts +0 -3
- package/es/components/Search/Search.Skeleton.js +1 -4
- package/es/components/Select/Select.d.ts +2 -2
- package/es/components/Select/Select.js +13 -16
- package/es/components/SelectItem/SelectItem.d.ts +0 -6
- package/es/components/SelectItem/SelectItem.js +4 -10
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +0 -3
- package/es/components/SelectItemGroup/SelectItemGroup.js +1 -4
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +13 -0
- package/es/components/SkeletonIcon/SkeletonIcon.js +2 -3
- package/es/components/SkeletonText/SkeletonText.d.ts +0 -6
- package/es/components/SkeletonText/SkeletonText.js +0 -6
- package/es/components/Slider/Slider.Skeleton.d.ts +9 -1
- package/es/components/Slider/Slider.Skeleton.js +20 -4
- package/es/components/Slider/Slider.d.ts +137 -25
- package/es/components/Slider/Slider.js +779 -186
- package/es/components/StructuredList/StructuredList.js +5 -2
- package/es/components/Switch/Switch.js +3 -7
- package/es/components/Tabs/Tabs.js +5 -2
- package/es/components/Tag/Tag.js +4 -2
- package/es/components/Text/Text.js +1 -1
- package/es/components/Text/TextDirection.d.ts +1 -1
- package/es/components/TextArea/TextArea.js +30 -34
- package/es/components/TextInput/ControlledPasswordInput.js +12 -19
- package/es/components/TextInput/TextInput.js +8 -3
- package/es/components/Tile/Tile.js +5 -3
- package/es/components/TileGroup/TileGroup.js +5 -4
- package/es/components/Toggle/Toggle.js +4 -2
- package/es/components/Toggletip/index.d.ts +6 -1
- package/es/components/Toggletip/index.js +7 -1
- package/es/components/UIShell/Content.js +1 -4
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/components/UIShell/SideNavDetails.d.ts +32 -0
- package/es/components/UIShell/SideNavDetails.js +1 -2
- package/es/components/UIShell/SideNavDivider.d.ts +15 -0
- package/es/components/UIShell/SideNavDivider.js +2 -2
- package/es/components/UIShell/SideNavFooter.js +2 -5
- package/es/components/UIShell/SideNavIcon.d.ts +25 -0
- package/es/components/UIShell/SideNavIcon.js +4 -7
- package/es/components/UIShell/SideNavSwitcher.d.ts +31 -0
- package/es/components/UIShell/SideNavSwitcher.js +6 -5
- package/es/index.js +2 -2
- package/es/internal/FloatingMenu.js +2 -7
- package/es/internal/Selection.js +0 -3
- package/es/internal/noopFn.d.ts +7 -0
- package/es/internal/noopFn.js +10 -0
- package/es/internal/useNormalizedInputProps.js +6 -2
- package/es/internal/wrapFocus.js +5 -5
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
- package/lib/components/Accordion/Accordion.Skeleton.d.ts +0 -5
- package/lib/components/Accordion/Accordion.Skeleton.js +0 -5
- package/lib/components/Breadcrumb/BreadcrumbItem.js +3 -1
- package/lib/components/Checkbox/Checkbox.js +3 -6
- package/lib/components/CodeSnippet/CodeSnippet.js +5 -12
- package/lib/components/ComboBox/ComboBox.d.ts +1 -5
- package/lib/components/ComboBox/ComboBox.js +5 -19
- package/lib/components/ComposedModal/ComposedModal.js +1 -5
- package/lib/components/ComposedModal/ModalFooter.js +4 -9
- package/lib/components/ComposedModal/ModalHeader.js +1 -4
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +3 -8
- package/lib/components/ContentSwitcher/ContentSwitcher.js +7 -11
- package/lib/components/Copy/Copy.js +4 -8
- package/lib/components/CopyButton/CopyButton.js +8 -7
- package/lib/components/DataTable/DataTable.d.ts +3 -39
- package/lib/components/DataTable/DataTable.js +13 -21
- package/lib/components/DataTable/Table.d.ts +0 -4
- package/lib/components/DataTable/Table.js +3 -6
- package/lib/components/DataTable/TableBatchAction.js +12 -5
- package/lib/components/DataTable/TableBatchActions.js +1 -6
- package/lib/components/DataTable/TableBody.d.ts +0 -3
- package/lib/components/DataTable/TableBody.js +1 -3
- package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.js +3 -8
- package/lib/components/DataTable/TableSelectAll.d.ts +0 -3
- package/lib/components/DataTable/TableSelectAll.js +1 -4
- package/lib/components/DataTable/TableToolbar.d.ts +10 -0
- package/lib/components/DataTable/TableToolbar.js +15 -7
- package/lib/components/DataTable/TableToolbarMenu.js +2 -6
- package/lib/components/DataTable/TableToolbarSearch.d.ts +2 -8
- package/lib/components/DataTable/TableToolbarSearch.js +6 -11
- package/lib/components/DataTable/tools/sorting.js +2 -2
- package/lib/components/DatePicker/DatePicker.d.ts +4 -4
- package/lib/components/DatePicker/DatePicker.js +9 -4
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +6 -0
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +12 -6
- package/lib/components/Dropdown/Dropdown.js +6 -15
- package/lib/components/FileUploader/FileUploader.d.ts +2 -11
- package/lib/components/FileUploader/FileUploader.js +15 -19
- package/lib/components/FileUploader/FileUploaderButton.js +2 -2
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +0 -7
- package/lib/components/FileUploader/FileUploaderDropContainer.js +2 -8
- package/lib/components/FileUploader/FileUploaderItem.d.ts +0 -4
- package/lib/components/FileUploader/FileUploaderItem.js +12 -9
- package/lib/components/FileUploader/Filename.d.ts +6 -10
- package/lib/components/FileUploader/Filename.js +7 -11
- package/lib/components/FormGroup/FormGroup.d.ts +0 -5
- package/lib/components/FormGroup/FormGroup.js +3 -8
- package/lib/components/FormItem/FormItem.d.ts +32 -0
- package/lib/components/FormItem/index.d.ts +9 -0
- package/lib/components/FormLabel/FormLabel.js +4 -1
- package/lib/components/ListBox/ListBox.js +4 -8
- package/lib/components/ListBox/ListBoxMenuIcon.js +1 -4
- package/lib/components/ListBox/ListBoxMenuItem.js +4 -8
- package/lib/components/ListBox/ListBoxSelection.d.ts +5 -5
- package/lib/components/ListBox/ListBoxSelection.js +12 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +12 -13
- package/lib/components/ListBox/next/ListBoxTrigger.js +3 -5
- package/lib/components/ListItem/ListItem.d.ts +1 -1
- package/lib/components/ListItem/ListItem.js +6 -2
- package/lib/components/Menu/MenuItem.js +4 -1
- package/lib/components/Modal/Modal.d.ts +137 -0
- package/lib/components/Modal/Modal.js +40 -45
- package/lib/components/Modal/index.d.ts +9 -0
- package/lib/components/ModalWrapper/ModalWrapper.js +13 -19
- package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -32
- package/lib/components/MultiSelect/MultiSelect.js +16 -32
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +2 -2
- package/lib/components/MultiSelect/tools/sorting.js +2 -2
- package/lib/components/Notification/Notification.d.ts +11 -29
- package/lib/components/Notification/Notification.js +38 -57
- package/lib/components/NumberInput/NumberInput.js +6 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +27 -33
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -1
- package/lib/components/Pagination/experimental/PageSelector.js +3 -8
- package/lib/components/Pagination/experimental/Pagination.js +16 -34
- package/lib/components/ProgressIndicator/ProgressIndicator.js +7 -6
- package/lib/components/RadioTile/RadioTile.js +6 -7
- package/lib/components/Search/Search.Skeleton.d.ts +0 -3
- package/lib/components/Search/Search.Skeleton.js +1 -4
- package/lib/components/Select/Select.d.ts +2 -2
- package/lib/components/Select/Select.js +13 -16
- package/lib/components/SelectItem/SelectItem.d.ts +0 -6
- package/lib/components/SelectItem/SelectItem.js +4 -10
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +0 -3
- package/lib/components/SelectItemGroup/SelectItemGroup.js +1 -4
- package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +13 -0
- package/lib/components/SkeletonIcon/SkeletonIcon.js +2 -3
- package/lib/components/SkeletonText/SkeletonText.d.ts +0 -6
- package/lib/components/SkeletonText/SkeletonText.js +0 -6
- package/lib/components/Slider/Slider.Skeleton.d.ts +9 -1
- package/lib/components/Slider/Slider.Skeleton.js +20 -4
- package/lib/components/Slider/Slider.d.ts +137 -25
- package/lib/components/Slider/Slider.js +778 -185
- package/lib/components/StructuredList/StructuredList.js +5 -2
- package/lib/components/Switch/Switch.js +3 -7
- package/lib/components/Tabs/Tabs.js +5 -2
- package/lib/components/Tag/Tag.js +4 -2
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/Text/TextDirection.d.ts +1 -1
- package/lib/components/TextArea/TextArea.js +30 -34
- package/lib/components/TextInput/ControlledPasswordInput.js +12 -19
- package/lib/components/TextInput/TextInput.js +8 -3
- package/lib/components/Tile/Tile.js +5 -3
- package/lib/components/TileGroup/TileGroup.js +5 -4
- package/lib/components/Toggle/Toggle.js +4 -2
- package/lib/components/Toggletip/index.d.ts +6 -1
- package/lib/components/Toggletip/index.js +7 -1
- package/lib/components/UIShell/Content.js +1 -4
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/UIShell/SideNavDetails.d.ts +32 -0
- package/lib/components/UIShell/SideNavDetails.js +1 -2
- package/lib/components/UIShell/SideNavDivider.d.ts +15 -0
- package/lib/components/UIShell/SideNavDivider.js +2 -2
- package/lib/components/UIShell/SideNavFooter.js +2 -5
- package/lib/components/UIShell/SideNavIcon.d.ts +25 -0
- package/lib/components/UIShell/SideNavIcon.js +4 -7
- package/lib/components/UIShell/SideNavSwitcher.d.ts +31 -0
- package/lib/components/UIShell/SideNavSwitcher.js +5 -4
- package/lib/index.js +4 -4
- package/lib/internal/FloatingMenu.js +2 -7
- package/lib/internal/Selection.js +0 -3
- package/lib/internal/noopFn.d.ts +7 -0
- package/lib/internal/noopFn.js +14 -0
- package/lib/internal/useNormalizedInputProps.js +6 -2
- package/lib/internal/wrapFocus.js +5 -5
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
- package/package.json +9 -9
- package/scss/components/slug/_index.scss +9 -0
- package/scss/components/slug/_slug.scss +9 -0
|
@@ -0,0 +1,137 @@
|
|
|
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 { ReactAttr } from '../../types/common';
|
|
9
|
+
export declare const ModalSizes: readonly ["xs", "sm", "md", "lg"];
|
|
10
|
+
export type ModalSize = (typeof ModalSizes)[number];
|
|
11
|
+
export interface ModalSecondaryButton {
|
|
12
|
+
buttonText?: string;
|
|
13
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
14
|
+
}
|
|
15
|
+
export interface ModalProps extends ReactAttr<HTMLDivElement> {
|
|
16
|
+
/**
|
|
17
|
+
* Specify whether the Modal is displaying an alert, error or warning
|
|
18
|
+
* Should go hand in hand with the danger prop.
|
|
19
|
+
*/
|
|
20
|
+
alert?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Required props for the accessibility label of the header
|
|
23
|
+
*/
|
|
24
|
+
'aria-label'?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Provide the contents of your Modal
|
|
27
|
+
*/
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Specify an optional className to be applied to the modal root node
|
|
31
|
+
*/
|
|
32
|
+
className?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Specify an label for the close button of the modal; defaults to close
|
|
35
|
+
*/
|
|
36
|
+
closeButtonLabel?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Specify whether the Modal is for dangerous actions
|
|
39
|
+
*/
|
|
40
|
+
danger?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Specify whether the modal contains scrolling content
|
|
43
|
+
*/
|
|
44
|
+
hasScrollingContent?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Specify the DOM element ID of the top-level node.
|
|
47
|
+
*/
|
|
48
|
+
id?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Specify whether or not the Modal content should have any inner padding.
|
|
51
|
+
*/
|
|
52
|
+
isFullWidth?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Provide a ref to return focus to once the modal is closed.
|
|
55
|
+
*/
|
|
56
|
+
launcherButtonRef?: any;
|
|
57
|
+
/**
|
|
58
|
+
* Specify a label to be read by screen readers on the modal root node
|
|
59
|
+
*/
|
|
60
|
+
modalAriaLabel?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Specify the content of the modal header title.
|
|
63
|
+
*/
|
|
64
|
+
modalHeading?: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Specify the content of the modal header label.
|
|
67
|
+
*/
|
|
68
|
+
modalLabel?: React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* Specify a handler for keypresses.
|
|
71
|
+
* @deprecated this property is unused
|
|
72
|
+
*/
|
|
73
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
|
74
|
+
/**
|
|
75
|
+
* Specify a handler for closing modal.
|
|
76
|
+
* The handler should care of closing modal, e.g. changing `open` prop.
|
|
77
|
+
*/
|
|
78
|
+
onRequestClose?: React.ReactEventHandler<HTMLElement>;
|
|
79
|
+
/**
|
|
80
|
+
* Specify a handler for "submitting" modal.
|
|
81
|
+
* The handler should care of closing modal, e.g. changing `open` prop, if necessary.
|
|
82
|
+
*/
|
|
83
|
+
onRequestSubmit?: React.ReactEventHandler<HTMLElement>;
|
|
84
|
+
/**
|
|
85
|
+
* Specify a handler for the secondary button.
|
|
86
|
+
* Useful if separate handler from `onRequestClose` is desirable
|
|
87
|
+
*/
|
|
88
|
+
onSecondarySubmit?: React.ReactEventHandler<HTMLElement>;
|
|
89
|
+
/**
|
|
90
|
+
* Specify whether the Modal is currently open
|
|
91
|
+
*/
|
|
92
|
+
open?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Specify whether the modal should be button-less
|
|
95
|
+
*/
|
|
96
|
+
passiveModal?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Prevent closing on click outside of modal
|
|
99
|
+
*/
|
|
100
|
+
preventCloseOnClickOutside?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Specify whether the Button should be disabled, or not
|
|
103
|
+
*/
|
|
104
|
+
primaryButtonDisabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Specify the text for the primary button
|
|
107
|
+
*/
|
|
108
|
+
primaryButtonText?: React.ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Specify the text for the secondary button
|
|
111
|
+
*/
|
|
112
|
+
secondaryButtonText?: React.ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Specify an array of config objects for secondary buttons
|
|
115
|
+
*/
|
|
116
|
+
secondaryButtons?: ModalSecondaryButton[];
|
|
117
|
+
/**
|
|
118
|
+
* Specify a CSS selector that matches the DOM element that should
|
|
119
|
+
* be focused when the Modal opens
|
|
120
|
+
*/
|
|
121
|
+
selectorPrimaryFocus?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Specify CSS selectors that match DOM elements working as floating menus.
|
|
124
|
+
* Focusing on those elements won't trigger "focus-wrap" behavior
|
|
125
|
+
*/
|
|
126
|
+
selectorsFloatingMenus?: string[];
|
|
127
|
+
/**
|
|
128
|
+
* Specify if Enter key should be used as "submit" action
|
|
129
|
+
*/
|
|
130
|
+
shouldSubmitOnEnter?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Specify the size variant.
|
|
133
|
+
*/
|
|
134
|
+
size?: ModalSize;
|
|
135
|
+
}
|
|
136
|
+
declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
137
|
+
export default Modal;
|
|
@@ -18,50 +18,50 @@ import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsT
|
|
|
18
18
|
import wrapFocus, { elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
|
|
19
19
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
20
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
21
|
+
import { noopFn } from '../../internal/noopFn.js';
|
|
22
|
+
import '../Text/index.js';
|
|
23
|
+
import { Text } from '../Text/Text.js';
|
|
21
24
|
import { match } from '../../internal/keyboard/match.js';
|
|
22
25
|
import { Escape, Enter } from '../../internal/keyboard/keys.js';
|
|
23
26
|
|
|
24
27
|
const getInstanceId = setupGetInstanceId();
|
|
28
|
+
const ModalSizes = ['xs', 'sm', 'md', 'lg'];
|
|
25
29
|
const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
26
30
|
let {
|
|
27
31
|
'aria-label': ariaLabelProp,
|
|
28
32
|
children,
|
|
29
33
|
className,
|
|
30
|
-
modalHeading,
|
|
31
|
-
modalLabel,
|
|
34
|
+
modalHeading = '',
|
|
35
|
+
modalLabel = '',
|
|
32
36
|
modalAriaLabel,
|
|
33
|
-
passiveModal,
|
|
37
|
+
passiveModal = false,
|
|
34
38
|
secondaryButtonText,
|
|
35
39
|
primaryButtonText,
|
|
36
40
|
open,
|
|
37
|
-
onRequestClose,
|
|
38
|
-
onRequestSubmit,
|
|
41
|
+
onRequestClose = noopFn,
|
|
42
|
+
onRequestSubmit = noopFn,
|
|
39
43
|
onSecondarySubmit,
|
|
40
|
-
primaryButtonDisabled,
|
|
44
|
+
primaryButtonDisabled = false,
|
|
41
45
|
danger,
|
|
42
46
|
alert,
|
|
43
47
|
secondaryButtons,
|
|
44
|
-
selectorPrimaryFocus,
|
|
45
|
-
// eslint-disable-line
|
|
48
|
+
selectorPrimaryFocus = '[data-modal-primary-focus]',
|
|
46
49
|
selectorsFloatingMenus,
|
|
47
|
-
// eslint-disable-line
|
|
48
50
|
shouldSubmitOnEnter,
|
|
49
|
-
// eslint-disable-line
|
|
50
51
|
size,
|
|
51
|
-
hasScrollingContent,
|
|
52
|
+
hasScrollingContent = false,
|
|
52
53
|
closeButtonLabel,
|
|
53
|
-
preventCloseOnClickOutside,
|
|
54
|
-
// eslint-disable-line
|
|
54
|
+
preventCloseOnClickOutside = false,
|
|
55
55
|
isFullWidth,
|
|
56
56
|
launcherButtonRef,
|
|
57
57
|
...rest
|
|
58
58
|
} = _ref;
|
|
59
59
|
const prefix = usePrefix();
|
|
60
|
-
const button = useRef();
|
|
60
|
+
const button = useRef(null);
|
|
61
61
|
const secondaryButton = useRef();
|
|
62
|
-
const innerModal = useRef();
|
|
63
|
-
const startTrap = useRef();
|
|
64
|
-
const endTrap = useRef();
|
|
62
|
+
const innerModal = useRef(null);
|
|
63
|
+
const startTrap = useRef(null);
|
|
64
|
+
const endTrap = useRef(null);
|
|
65
65
|
const modalInstanceId = `modal-${getInstanceId()}`;
|
|
66
66
|
const modalLabelId = `${prefix}--modal-header__label--${modalInstanceId}`;
|
|
67
67
|
const modalHeadingId = `${prefix}--modal-header__heading--${modalInstanceId}`;
|
|
@@ -81,7 +81,8 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
function handleMousedown(evt) {
|
|
84
|
-
|
|
84
|
+
const target = evt.target;
|
|
85
|
+
if (innerModal.current && !innerModal.current.contains(target) && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && !preventCloseOnClickOutside) {
|
|
85
86
|
onRequestClose(evt);
|
|
86
87
|
}
|
|
87
88
|
}
|
|
@@ -114,9 +115,8 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
114
115
|
const modalClasses = cx(`${prefix}--modal`, {
|
|
115
116
|
[`${prefix}--modal-tall`]: !passiveModal,
|
|
116
117
|
'is-visible': open,
|
|
117
|
-
[`${prefix}--modal--danger`]: danger
|
|
118
|
-
|
|
119
|
-
});
|
|
118
|
+
[`${prefix}--modal--danger`]: danger
|
|
119
|
+
}, className);
|
|
120
120
|
const containerClasses = cx(`${prefix}--modal-container`, {
|
|
121
121
|
[`${prefix}--modal-container--${size}`]: size,
|
|
122
122
|
[`${prefix}--modal-container--full-width`]: isFullWidth
|
|
@@ -127,7 +127,12 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
127
127
|
const footerClasses = cx(`${prefix}--modal-footer`, {
|
|
128
128
|
[`${prefix}--modal-footer--three-button`]: Array.isArray(secondaryButtons) && secondaryButtons.length === 2
|
|
129
129
|
});
|
|
130
|
-
const
|
|
130
|
+
const asStringOrUndefined = node => {
|
|
131
|
+
return typeof node === 'string' ? node : undefined;
|
|
132
|
+
};
|
|
133
|
+
const modalLabelStr = asStringOrUndefined(modalLabel);
|
|
134
|
+
const modalHeadingStr = asStringOrUndefined(modalHeading);
|
|
135
|
+
const ariaLabel = modalLabelStr || ariaLabelProp || modalAriaLabel || modalHeadingStr;
|
|
131
136
|
const getAriaLabelledBy = modalLabel ? modalLabelId : modalHeadingId;
|
|
132
137
|
const hasScrollingContentProps = hasScrollingContent ? {
|
|
133
138
|
tabIndex: 0,
|
|
@@ -149,7 +154,7 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
149
154
|
};
|
|
150
155
|
}, [prefix]);
|
|
151
156
|
useEffect(() => {
|
|
152
|
-
toggleClass(document.body, `${prefix}--body--with-modal-open`, open);
|
|
157
|
+
toggleClass(document.body, `${prefix}--body--with-modal-open`, open ?? false);
|
|
153
158
|
}, [open, prefix]);
|
|
154
159
|
useEffect(() => {
|
|
155
160
|
if (!open && launcherButtonRef) {
|
|
@@ -169,7 +174,7 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
169
174
|
};
|
|
170
175
|
const focusButton = focusContainerElement => {
|
|
171
176
|
const target = initialFocus(focusContainerElement);
|
|
172
|
-
if (target) {
|
|
177
|
+
if (target !== null) {
|
|
173
178
|
target.focus();
|
|
174
179
|
}
|
|
175
180
|
};
|
|
@@ -197,13 +202,15 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
197
202
|
className: containerClasses,
|
|
198
203
|
"aria-label": ariaLabel,
|
|
199
204
|
"aria-modal": "true",
|
|
200
|
-
tabIndex:
|
|
205
|
+
tabIndex: -1
|
|
201
206
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
202
207
|
className: `${prefix}--modal-header`
|
|
203
|
-
}, passiveModal && modalButton, modalLabel && /*#__PURE__*/React__default.createElement(
|
|
208
|
+
}, passiveModal && modalButton, modalLabel && /*#__PURE__*/React__default.createElement(Text, {
|
|
209
|
+
as: "h2",
|
|
204
210
|
id: modalLabelId,
|
|
205
211
|
className: `${prefix}--modal-header__label`
|
|
206
|
-
}, modalLabel), /*#__PURE__*/React__default.createElement(
|
|
212
|
+
}, modalLabel), /*#__PURE__*/React__default.createElement(Text, {
|
|
213
|
+
as: "h3",
|
|
207
214
|
id: modalHeadingId,
|
|
208
215
|
className: `${prefix}--modal-header__heading`
|
|
209
216
|
}, modalHeading), !passiveModal && modalButton), /*#__PURE__*/React__default.createElement("div", _extends({
|
|
@@ -242,12 +249,12 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
|
|
|
242
249
|
ref: ref
|
|
243
250
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
244
251
|
ref: startTrap,
|
|
245
|
-
tabIndex:
|
|
252
|
+
tabIndex: 0,
|
|
246
253
|
role: "link",
|
|
247
254
|
className: `${prefix}--visually-hidden`
|
|
248
255
|
}, "Focus sentinel"), modalBody, /*#__PURE__*/React__default.createElement("span", {
|
|
249
256
|
ref: endTrap,
|
|
250
|
-
tabIndex:
|
|
257
|
+
tabIndex: 0,
|
|
251
258
|
role: "link",
|
|
252
259
|
className: `${prefix}--visually-hidden`
|
|
253
260
|
}, "Focus sentinel"));
|
|
@@ -382,7 +389,7 @@ Modal.propTypes = {
|
|
|
382
389
|
* Specify CSS selectors that match DOM elements working as floating menus.
|
|
383
390
|
* Focusing on those elements won't trigger "focus-wrap" behavior
|
|
384
391
|
*/
|
|
385
|
-
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string),
|
|
392
|
+
selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
386
393
|
/**
|
|
387
394
|
* Specify if Enter key should be used as "submit" action
|
|
388
395
|
*/
|
|
@@ -390,20 +397,7 @@ Modal.propTypes = {
|
|
|
390
397
|
/**
|
|
391
398
|
* Specify the size variant.
|
|
392
399
|
*/
|
|
393
|
-
size: PropTypes.oneOf(
|
|
394
|
-
};
|
|
395
|
-
Modal.defaultProps = {
|
|
396
|
-
onRequestClose: () => {},
|
|
397
|
-
onRequestSubmit: () => {},
|
|
398
|
-
primaryButtonDisabled: false,
|
|
399
|
-
onKeyDown: () => {},
|
|
400
|
-
passiveModal: false,
|
|
401
|
-
modalHeading: '',
|
|
402
|
-
modalLabel: '',
|
|
403
|
-
preventCloseOnClickOutside: false,
|
|
404
|
-
selectorPrimaryFocus: '[data-modal-primary-focus]',
|
|
405
|
-
hasScrollingContent: false
|
|
400
|
+
size: PropTypes.oneOf(ModalSizes)
|
|
406
401
|
};
|
|
407
|
-
var Modal$1 = Modal;
|
|
408
402
|
|
|
409
|
-
export { Modal
|
|
403
|
+
export { ModalSizes, Modal as default };
|
|
@@ -13,6 +13,7 @@ import Button from '../Button/Button.js';
|
|
|
13
13
|
import '../Button/Button.Skeleton.js';
|
|
14
14
|
import { ButtonKinds } from '../../prop-types/types.js';
|
|
15
15
|
import { warning } from '../../internal/warning.js';
|
|
16
|
+
import { noopFn } from '../../internal/noopFn.js';
|
|
16
17
|
|
|
17
18
|
let didWarnAboutDeprecation = false;
|
|
18
19
|
class ModalWrapper extends React__default.Component {
|
|
@@ -57,19 +58,21 @@ class ModalWrapper extends React__default.Component {
|
|
|
57
58
|
render() {
|
|
58
59
|
const {
|
|
59
60
|
children,
|
|
60
|
-
onKeyDown,
|
|
61
|
+
onKeyDown = noopFn,
|
|
61
62
|
buttonTriggerText,
|
|
62
63
|
buttonTriggerClassName,
|
|
63
64
|
renderTriggerButtonIcon,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
primaryButtonText = 'Save',
|
|
66
|
+
secondaryButtonText = 'Cancel',
|
|
67
|
+
triggerButtonIconDescription = 'Provide icon description if icon is used',
|
|
68
|
+
triggerButtonKind = 'primary',
|
|
69
|
+
disabled = false,
|
|
67
70
|
handleSubmit,
|
|
68
71
|
// eslint-disable-line no-unused-vars
|
|
69
|
-
shouldCloseAfterSubmit,
|
|
72
|
+
shouldCloseAfterSubmit = true,
|
|
70
73
|
// eslint-disable-line no-unused-vars
|
|
71
|
-
selectorPrimaryFocus,
|
|
72
|
-
preventCloseOnClickOutside,
|
|
74
|
+
selectorPrimaryFocus = '[data-modal-primary-focus]',
|
|
75
|
+
preventCloseOnClickOutside = false,
|
|
73
76
|
// eslint-disable-line no-unused-vars
|
|
74
77
|
...other
|
|
75
78
|
} = this.props;
|
|
@@ -97,7 +100,9 @@ class ModalWrapper extends React__default.Component {
|
|
|
97
100
|
onClick: this.handleOpen,
|
|
98
101
|
ref: this.triggerButton
|
|
99
102
|
}, buttonTriggerText), /*#__PURE__*/React__default.createElement(Modal, _extends({
|
|
100
|
-
ref: this.modal
|
|
103
|
+
ref: this.modal,
|
|
104
|
+
primaryButtonText: primaryButtonText,
|
|
105
|
+
secondaryButtonText: secondaryButtonText
|
|
101
106
|
}, props), children));
|
|
102
107
|
}
|
|
103
108
|
}
|
|
@@ -126,16 +131,5 @@ _defineProperty(ModalWrapper, "propTypes", {
|
|
|
126
131
|
triggerButtonKind: PropTypes.oneOf(ButtonKinds),
|
|
127
132
|
withHeader: PropTypes.bool
|
|
128
133
|
});
|
|
129
|
-
_defineProperty(ModalWrapper, "defaultProps", {
|
|
130
|
-
shouldCloseAfterSubmit: true,
|
|
131
|
-
primaryButtonText: 'Save',
|
|
132
|
-
secondaryButtonText: 'Cancel',
|
|
133
|
-
triggerButtonIconDescription: 'Provide icon description if icon is used',
|
|
134
|
-
triggerButtonKind: 'primary',
|
|
135
|
-
disabled: false,
|
|
136
|
-
preventCloseOnClickOutside: false,
|
|
137
|
-
selectorPrimaryFocus: '[data-modal-primary-focus]',
|
|
138
|
-
onKeyDown: () => {}
|
|
139
|
-
});
|
|
140
134
|
|
|
141
135
|
export { ModalWrapper as default };
|
|
@@ -33,35 +33,35 @@ import { Escape, Space, Enter, Delete, Tab, Home, End } from '../../internal/key
|
|
|
33
33
|
const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function FilterableMultiSelect(_ref, ref) {
|
|
34
34
|
let {
|
|
35
35
|
className: containerClassName,
|
|
36
|
-
clearSelectionDescription,
|
|
37
|
-
clearSelectionText,
|
|
38
|
-
compareItems,
|
|
39
|
-
direction,
|
|
40
|
-
disabled,
|
|
36
|
+
clearSelectionDescription = 'Total items selected: ',
|
|
37
|
+
clearSelectionText = 'To clear selection, press Delete or Backspace',
|
|
38
|
+
compareItems = defaultCompareItems,
|
|
39
|
+
direction = 'bottom',
|
|
40
|
+
disabled = false,
|
|
41
41
|
downshiftProps,
|
|
42
|
-
filterItems,
|
|
42
|
+
filterItems = defaultFilterItems,
|
|
43
43
|
helperText,
|
|
44
44
|
hideLabel,
|
|
45
45
|
id,
|
|
46
|
-
initialSelectedItems,
|
|
46
|
+
initialSelectedItems = [],
|
|
47
47
|
invalid,
|
|
48
48
|
invalidText,
|
|
49
49
|
items,
|
|
50
50
|
itemToElement: ItemToElement,
|
|
51
51
|
// needs to be capitalized for react to render it correctly
|
|
52
|
-
itemToString,
|
|
52
|
+
itemToString = defaultItemToString,
|
|
53
53
|
light,
|
|
54
|
-
locale,
|
|
54
|
+
locale = 'en',
|
|
55
55
|
onInputValueChange,
|
|
56
|
-
open,
|
|
56
|
+
open = false,
|
|
57
57
|
onChange,
|
|
58
58
|
onMenuChange,
|
|
59
59
|
placeholder,
|
|
60
60
|
titleText,
|
|
61
61
|
type,
|
|
62
|
-
selectionFeedback,
|
|
62
|
+
selectionFeedback = 'top-after-reopen',
|
|
63
63
|
size,
|
|
64
|
-
sortItems,
|
|
64
|
+
sortItems = defaultSortItems,
|
|
65
65
|
translateWithId,
|
|
66
66
|
useTitleInItem,
|
|
67
67
|
warn,
|
|
@@ -297,10 +297,10 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
|
|
|
297
297
|
if (match(event, Tab)) {
|
|
298
298
|
handleOnMenuChange(false);
|
|
299
299
|
}
|
|
300
|
-
if (match(event, Home)) {
|
|
300
|
+
if (match(event, Home) && event.code !== 'Numpad7') {
|
|
301
301
|
event.target.setSelectionRange(0, 0);
|
|
302
302
|
}
|
|
303
|
-
if (match(event, End)) {
|
|
303
|
+
if (match(event, End) && event.code !== 'Numpad1') {
|
|
304
304
|
event.target.setSelectionRange(event.target.value.length, event.target.value.length);
|
|
305
305
|
}
|
|
306
306
|
},
|
|
@@ -552,20 +552,6 @@ FilterableMultiSelect.propTypes = {
|
|
|
552
552
|
*/
|
|
553
553
|
warnText: PropTypes.node
|
|
554
554
|
};
|
|
555
|
-
FilterableMultiSelect.defaultProps = {
|
|
556
|
-
compareItems: defaultCompareItems,
|
|
557
|
-
direction: 'bottom',
|
|
558
|
-
disabled: false,
|
|
559
|
-
filterItems: defaultFilterItems,
|
|
560
|
-
initialSelectedItems: [],
|
|
561
|
-
itemToString: defaultItemToString,
|
|
562
|
-
locale: 'en',
|
|
563
|
-
sortItems: defaultSortItems,
|
|
564
|
-
open: false,
|
|
565
|
-
selectionFeedback: 'top-after-reopen',
|
|
566
|
-
clearSelectionText: 'To clear selection, press Delete or Backspace,',
|
|
567
|
-
clearSelectionDescription: 'Total items selected: '
|
|
568
|
-
};
|
|
569
555
|
var FilterableMultiSelect$1 = FilterableMultiSelect;
|
|
570
556
|
|
|
571
557
|
export { FilterableMultiSelect$1 as default };
|
|
@@ -14,7 +14,7 @@ import PropTypes from 'prop-types';
|
|
|
14
14
|
import React__default, { useContext, useRef, useState } from 'react';
|
|
15
15
|
import ListBox from '../ListBox/index.js';
|
|
16
16
|
import { sortingPropTypes } from './MultiSelectPropTypes.js';
|
|
17
|
-
import {
|
|
17
|
+
import { defaultSortItems, defaultCompareItems } from './tools/sorting.js';
|
|
18
18
|
import { useSelection } from '../../internal/Selection.js';
|
|
19
19
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
20
20
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
@@ -22,11 +22,11 @@ import deprecate from '../../prop-types/deprecate.js';
|
|
|
22
22
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
23
23
|
import '../FluidForm/FluidForm.js';
|
|
24
24
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
25
|
+
import { noopFn } from '../../internal/noopFn.js';
|
|
25
26
|
import { match } from '../../internal/keyboard/match.js';
|
|
26
27
|
import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
|
|
27
28
|
import { Delete, Escape, Space, ArrowDown, Enter } from '../../internal/keyboard/keys.js';
|
|
28
29
|
|
|
29
|
-
const noop = () => {};
|
|
30
30
|
const getInstanceId = setupGetInstanceId();
|
|
31
31
|
const {
|
|
32
32
|
ItemClick,
|
|
@@ -60,18 +60,18 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
60
60
|
items,
|
|
61
61
|
itemToElement,
|
|
62
62
|
itemToString = defaultItemToString,
|
|
63
|
-
titleText,
|
|
63
|
+
titleText = false,
|
|
64
64
|
hideLabel,
|
|
65
65
|
helperText,
|
|
66
66
|
label,
|
|
67
|
-
type,
|
|
67
|
+
type = 'default',
|
|
68
68
|
size,
|
|
69
|
-
disabled,
|
|
70
|
-
initialSelectedItems,
|
|
71
|
-
sortItems,
|
|
72
|
-
compareItems,
|
|
73
|
-
clearSelectionText,
|
|
74
|
-
clearSelectionDescription,
|
|
69
|
+
disabled = false,
|
|
70
|
+
initialSelectedItems = [],
|
|
71
|
+
sortItems = defaultSortItems,
|
|
72
|
+
compareItems = defaultCompareItems,
|
|
73
|
+
clearSelectionText = 'To clear selection, press Delete or Backspace',
|
|
74
|
+
clearSelectionDescription = 'Total items selected: ',
|
|
75
75
|
light,
|
|
76
76
|
invalid,
|
|
77
77
|
invalidText,
|
|
@@ -80,14 +80,14 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
80
80
|
useTitleInItem,
|
|
81
81
|
translateWithId,
|
|
82
82
|
downshiftProps,
|
|
83
|
-
open,
|
|
84
|
-
selectionFeedback,
|
|
83
|
+
open = false,
|
|
84
|
+
selectionFeedback = 'top-after-reopen',
|
|
85
85
|
onChange,
|
|
86
86
|
onMenuChange,
|
|
87
|
-
direction,
|
|
87
|
+
direction = 'bottom',
|
|
88
88
|
selectedItems: selected,
|
|
89
89
|
readOnly,
|
|
90
|
-
locale
|
|
90
|
+
locale = 'en'
|
|
91
91
|
} = _ref;
|
|
92
92
|
const prefix = usePrefix();
|
|
93
93
|
const {
|
|
@@ -321,7 +321,7 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
321
321
|
className: multiSelectFieldWrapperClasses
|
|
322
322
|
}, selectedItems.length > 0 && /*#__PURE__*/React__default.createElement(ListBox.Selection, {
|
|
323
323
|
readOnly: readOnly,
|
|
324
|
-
clearSelection: !disabled && !readOnly ? clearSelection :
|
|
324
|
+
clearSelection: !disabled && !readOnly ? clearSelection : noopFn,
|
|
325
325
|
selectionCount: selectedItems.length
|
|
326
326
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
327
327
|
,
|
|
@@ -394,7 +394,7 @@ MultiSelect.propTypes = {
|
|
|
394
394
|
* Provide a compare function that is used to determine the ordering of
|
|
395
395
|
* options. See 'sortItems' for more control.
|
|
396
396
|
*/
|
|
397
|
-
compareItems: PropTypes.func
|
|
397
|
+
compareItems: PropTypes.func,
|
|
398
398
|
/**
|
|
399
399
|
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
400
400
|
*/
|
|
@@ -516,7 +516,7 @@ MultiSelect.propTypes = {
|
|
|
516
516
|
* locale: string,
|
|
517
517
|
* }) => Array<Item>
|
|
518
518
|
*/
|
|
519
|
-
sortItems: PropTypes.func
|
|
519
|
+
sortItems: PropTypes.func,
|
|
520
520
|
/**
|
|
521
521
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
522
522
|
* multiselect via ARIA attributes.
|
|
@@ -543,22 +543,6 @@ MultiSelect.propTypes = {
|
|
|
543
543
|
*/
|
|
544
544
|
warnText: PropTypes.node
|
|
545
545
|
};
|
|
546
|
-
MultiSelect.defaultProps = {
|
|
547
|
-
compareItems: defaultCompareItems,
|
|
548
|
-
disabled: false,
|
|
549
|
-
locale: 'en',
|
|
550
|
-
itemToString: defaultItemToString,
|
|
551
|
-
initialSelectedItems: [],
|
|
552
|
-
sortItems: defaultSortItems,
|
|
553
|
-
type: 'default',
|
|
554
|
-
titleText: false,
|
|
555
|
-
open: false,
|
|
556
|
-
selectionFeedback: 'top-after-reopen',
|
|
557
|
-
direction: 'bottom',
|
|
558
|
-
clearSelectionText: 'To clear selection, press Delete or Backspace,',
|
|
559
|
-
clearSelectionDescription: 'Total items selected: ',
|
|
560
|
-
selectedItems: undefined
|
|
561
|
-
};
|
|
562
546
|
var MultiSelect$1 = MultiSelect;
|
|
563
547
|
|
|
564
548
|
export { MultiSelect$1 as default };
|
|
@@ -15,7 +15,7 @@ const sortingPropTypes = {
|
|
|
15
15
|
* compareFunction :
|
|
16
16
|
* (itemA: string, itemB: string, { locale: string }) => number
|
|
17
17
|
*/
|
|
18
|
-
compareItems: PropTypes.func
|
|
18
|
+
compareItems: PropTypes.func,
|
|
19
19
|
/**
|
|
20
20
|
* Provide a method that sorts all options in the control. Overriding this
|
|
21
21
|
* prop means that you also have to handle the sort logic for selected versus
|
|
@@ -34,7 +34,7 @@ const sortingPropTypes = {
|
|
|
34
34
|
* locale: string,
|
|
35
35
|
* }) => Array<Item>
|
|
36
36
|
*/
|
|
37
|
-
sortItems: PropTypes.func
|
|
37
|
+
sortItems: PropTypes.func
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export { sortingPropTypes };
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* Use the local `localCompare` with the `numeric` option to sort two,
|
|
10
10
|
* potentially alpha-numeric, strings in a list of items.
|
|
11
11
|
*
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
12
|
+
* @param {ItemType} itemA
|
|
13
|
+
* @param {ItemType} itemB
|
|
14
14
|
* @param {object} options
|
|
15
15
|
* @param {string} options.locale
|
|
16
16
|
* @returns {number}
|