@carbon/react 1.69.0 → 1.70.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 +812 -812
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.js +16 -8
- package/es/components/ComposedModal/ComposedModal.js +6 -2
- package/es/components/ContextMenu/index.d.ts +8 -0
- package/es/components/ContextMenu/useContextMenu.d.ts +21 -0
- package/es/components/ContextMenu/useContextMenu.js +9 -8
- package/es/components/DataTable/DataTable.d.ts +3 -2
- package/es/components/DataTable/Table.d.ts +9 -1
- package/es/components/DataTable/Table.js +7 -2
- package/es/components/DatePicker/DatePicker.js +0 -8
- package/es/components/DatePicker/plugins/appendToPlugin.js +2 -2
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/es/components/DatePicker/plugins/rangePlugin.js +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +2 -2
- package/es/components/FeatureFlags/index.d.ts +3 -1
- package/es/components/FeatureFlags/index.js +5 -2
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +5 -5
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +15 -0
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +6 -8
- package/es/components/FluidDropdown/FluidDropdown.d.ts +101 -0
- package/es/components/FluidDropdown/FluidDropdown.js +1 -2
- package/es/components/FluidDropdown/index.d.ts +13 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +5 -5
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +5 -5
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +2 -13
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +22 -5
- package/es/components/Notification/Notification.js +2 -6
- package/es/components/NumberInput/NumberInput.Skeleton.d.ts +9 -1
- package/es/components/NumberInput/NumberInput.Skeleton.js +7 -2
- package/es/components/OverflowMenu/OverflowMenu.js +1 -1
- package/es/components/Pagination/Pagination.js +1 -1
- package/es/components/Pagination/experimental/PageSelector.js +1 -1
- package/es/components/Popover/index.js +4 -2
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/Tabs/Tabs.js +1 -1
- package/es/components/TreeView/TreeNode.js +1 -1
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/HeaderPanel.js +1 -1
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/SideNavMenu.js +1 -1
- package/es/components/UIShell/Switcher.js +1 -1
- package/es/feature-flags.js +2 -1
- package/es/index.js +3 -3
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +17 -8
- package/lib/components/ComposedModal/ComposedModal.js +6 -2
- package/lib/components/ContextMenu/index.d.ts +8 -0
- package/lib/components/ContextMenu/useContextMenu.d.ts +21 -0
- package/lib/components/ContextMenu/useContextMenu.js +9 -8
- package/lib/components/DataTable/DataTable.d.ts +3 -2
- package/lib/components/DataTable/Table.d.ts +9 -1
- package/lib/components/DataTable/Table.js +7 -2
- package/lib/components/DatePicker/DatePicker.js +0 -8
- package/lib/components/DatePicker/plugins/appendToPlugin.js +2 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/lib/components/DatePicker/plugins/rangePlugin.js +2 -2
- package/lib/components/Dropdown/Dropdown.d.ts +2 -2
- package/lib/components/FeatureFlags/index.d.ts +3 -1
- package/lib/components/FeatureFlags/index.js +5 -2
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +5 -5
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +15 -0
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +6 -8
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +101 -0
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -2
- package/lib/components/FluidDropdown/index.d.ts +13 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +5 -5
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +5 -5
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +2 -13
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +24 -5
- package/lib/components/Notification/Notification.js +2 -6
- package/lib/components/NumberInput/NumberInput.Skeleton.d.ts +9 -1
- package/lib/components/NumberInput/NumberInput.Skeleton.js +7 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
- package/lib/components/Pagination/Pagination.js +1 -1
- package/lib/components/Pagination/experimental/PageSelector.js +1 -1
- package/lib/components/Popover/index.js +4 -2
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/TreeView/TreeNode.js +1 -1
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/HeaderPanel.js +1 -1
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/SideNavMenu.js +1 -1
- package/lib/components/UIShell/Switcher.js +1 -1
- package/lib/feature-flags.js +2 -1
- package/lib/index.js +6 -6
- package/package.json +6 -5
- package/telemetry.yml +765 -710
|
@@ -48,7 +48,7 @@ const CheckboxGroup = _ref => {
|
|
|
48
48
|
|
|
49
49
|
// Slug is always size `mini`
|
|
50
50
|
let normalizedSlug;
|
|
51
|
-
if (
|
|
51
|
+
if (/*#__PURE__*/React__default.isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
|
|
52
52
|
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
53
53
|
size: 'mini',
|
|
54
54
|
kind: 'default'
|
|
@@ -12,6 +12,7 @@ import PropTypes from 'prop-types';
|
|
|
12
12
|
import React__default, { forwardRef, useRef, useEffect, useState, useContext, useCallback, useMemo } from 'react';
|
|
13
13
|
import '../Text/index.js';
|
|
14
14
|
import { WarningFilled, WarningAltFilled, Checkmark } from '@carbon/icons-react';
|
|
15
|
+
import isEqual from 'react-fast-compare';
|
|
15
16
|
import ListBox from '../ListBox/index.js';
|
|
16
17
|
import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
|
|
17
18
|
import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
|
|
@@ -225,11 +226,15 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
225
226
|
selectedItem: selectedItemProp,
|
|
226
227
|
prevSelectedItem: prevSelectedItemProp.current
|
|
227
228
|
});
|
|
228
|
-
|
|
229
|
-
onChange
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
|
|
230
|
+
// selectedItem has been updated externally, need to update state and call onChange
|
|
231
|
+
if (inputValue !== currentInputValue) {
|
|
232
|
+
setInputValue(currentInputValue);
|
|
233
|
+
onChange({
|
|
234
|
+
selectedItem: selectedItemProp,
|
|
235
|
+
inputValue: currentInputValue
|
|
236
|
+
});
|
|
237
|
+
}
|
|
233
238
|
prevSelectedItemProp.current = selectedItemProp;
|
|
234
239
|
}
|
|
235
240
|
}, [selectedItemProp]);
|
|
@@ -443,9 +448,12 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
443
448
|
let {
|
|
444
449
|
selectedItem
|
|
445
450
|
} = _ref5;
|
|
446
|
-
onChange
|
|
447
|
-
|
|
448
|
-
|
|
451
|
+
// only call onChange if new selection is updated from previous
|
|
452
|
+
if (!isEqual(selectedItem, selectedItemProp)) {
|
|
453
|
+
onChange({
|
|
454
|
+
selectedItem
|
|
455
|
+
});
|
|
456
|
+
}
|
|
449
457
|
},
|
|
450
458
|
onHighlightedIndexChange: _ref6 => {
|
|
451
459
|
let {
|
|
@@ -210,7 +210,8 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
210
210
|
const el = child;
|
|
211
211
|
return /*#__PURE__*/React__default.cloneElement(el, {
|
|
212
212
|
closeModal,
|
|
213
|
-
inputref: button
|
|
213
|
+
inputref: button,
|
|
214
|
+
danger
|
|
214
215
|
});
|
|
215
216
|
}
|
|
216
217
|
default:
|
|
@@ -227,7 +228,7 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
227
228
|
useEffect(() => {
|
|
228
229
|
const initialFocus = focusContainerElement => {
|
|
229
230
|
const containerElement = focusContainerElement || innerModal.current;
|
|
230
|
-
const primaryFocusElement = containerElement ? containerElement.querySelector(selectorPrimaryFocus) : null;
|
|
231
|
+
const primaryFocusElement = containerElement ? containerElement.querySelector(danger ? `.${prefix}--btn--secondary` : selectorPrimaryFocus) : null;
|
|
231
232
|
if (primaryFocusElement) {
|
|
232
233
|
return primaryFocusElement;
|
|
233
234
|
}
|
|
@@ -235,8 +236,11 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
|
|
|
235
236
|
};
|
|
236
237
|
const focusButton = focusContainerElement => {
|
|
237
238
|
const target = initialFocus(focusContainerElement);
|
|
239
|
+
const closeButton = focusContainerElement.querySelector(`.${prefix}--modal-close`);
|
|
238
240
|
if (target) {
|
|
239
241
|
target.focus();
|
|
242
|
+
} else if (!target && closeButton) {
|
|
243
|
+
closeButton?.focus();
|
|
240
244
|
}
|
|
241
245
|
};
|
|
242
246
|
if (open && isOpen) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 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
|
+
/// <reference types="react" />
|
|
8
|
+
type TriggerType = Element | Document | Window | React.RefObject<Element>;
|
|
9
|
+
interface ContextMenuProps {
|
|
10
|
+
open: boolean;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
mode: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @param {TriggerType} [trigger=document] The element or ref which should trigger the Menu on right-click
|
|
18
|
+
* @returns {ContextMenuProps} Props object to pass onto Menu component
|
|
19
|
+
*/
|
|
20
|
+
declare function useContextMenu(trigger?: TriggerType): ContextMenuProps;
|
|
21
|
+
export default useContextMenu;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { useState, useEffect } from 'react';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @param {
|
|
12
|
-
* @returns {
|
|
11
|
+
* @param {TriggerType} [trigger=document] The element or ref which should trigger the Menu on right-click
|
|
12
|
+
* @returns {ContextMenuProps} Props object to pass onto Menu component
|
|
13
13
|
*/
|
|
14
14
|
function useContextMenu() {
|
|
15
15
|
let trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
@@ -18,8 +18,8 @@ function useContextMenu() {
|
|
|
18
18
|
function openContextMenu(e) {
|
|
19
19
|
e.preventDefault();
|
|
20
20
|
const {
|
|
21
|
-
x,
|
|
22
|
-
y
|
|
21
|
+
clientX: x,
|
|
22
|
+
clientY: y
|
|
23
23
|
} = e;
|
|
24
24
|
setPosition([x, y]);
|
|
25
25
|
setOpen(true);
|
|
@@ -28,11 +28,12 @@ function useContextMenu() {
|
|
|
28
28
|
setOpen(false);
|
|
29
29
|
}
|
|
30
30
|
useEffect(() => {
|
|
31
|
-
const el = trigger
|
|
32
|
-
if (el
|
|
33
|
-
|
|
31
|
+
const el = trigger instanceof Element || trigger instanceof Document || trigger instanceof Window ? trigger : trigger.current;
|
|
32
|
+
if (el) {
|
|
33
|
+
const eventListener = e => openContextMenu(e);
|
|
34
|
+
el.addEventListener('contextmenu', eventListener);
|
|
34
35
|
return () => {
|
|
35
|
-
el.removeEventListener('contextmenu',
|
|
36
|
+
el.removeEventListener('contextmenu', eventListener);
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
}, [trigger]);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import type { MouseEvent } from 'react';
|
|
9
10
|
import type { DataTableSortState } from './state/sortStates';
|
|
10
11
|
import Table from './Table';
|
|
11
12
|
import TableActionList from './TableActionList';
|
|
@@ -131,13 +132,13 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
131
132
|
}) => {
|
|
132
133
|
ariaLabel: string;
|
|
133
134
|
'aria-label': string;
|
|
134
|
-
checked?: boolean;
|
|
135
|
+
checked?: boolean | undefined;
|
|
135
136
|
disabled?: boolean | undefined;
|
|
136
137
|
id: string;
|
|
137
138
|
indeterminate?: boolean;
|
|
138
139
|
name: string;
|
|
139
140
|
onSelect: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
140
|
-
radio?: boolean;
|
|
141
|
+
radio?: boolean | undefined;
|
|
141
142
|
[key: string]: unknown;
|
|
142
143
|
};
|
|
143
144
|
getToolbarProps: (getToolbarPropsArgs?: {
|
|
@@ -33,9 +33,13 @@ interface TableProps {
|
|
|
33
33
|
* `true` to add useZebraStyles striping.
|
|
34
34
|
*/
|
|
35
35
|
useZebraStyles?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Specify the table tabIndex
|
|
38
|
+
*/
|
|
39
|
+
tabIndex?: number;
|
|
36
40
|
}
|
|
37
41
|
export declare const Table: {
|
|
38
|
-
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, tabIndex, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
39
43
|
propTypes: {
|
|
40
44
|
/**
|
|
41
45
|
* Pass in the children that will be rendered within the Table
|
|
@@ -70,6 +74,10 @@ export declare const Table: {
|
|
|
70
74
|
* `true` to add useZebraStyles striping.
|
|
71
75
|
*/
|
|
72
76
|
useZebraStyles: PropTypes.Requireable<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Specify the table tabIndex
|
|
79
|
+
*/
|
|
80
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
73
81
|
};
|
|
74
82
|
};
|
|
75
83
|
export default Table;
|
|
@@ -54,6 +54,7 @@ const Table = _ref => {
|
|
|
54
54
|
stickyHeader,
|
|
55
55
|
overflowMenuOnHover = true,
|
|
56
56
|
experimentalAutoAlign = false,
|
|
57
|
+
tabIndex,
|
|
57
58
|
...other
|
|
58
59
|
} = _ref;
|
|
59
60
|
const {
|
|
@@ -129,7 +130,7 @@ const Table = _ref => {
|
|
|
129
130
|
className: `${prefix}--data-table-content`
|
|
130
131
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
131
132
|
,
|
|
132
|
-
tabIndex: isScrollable ? 0 : undefined
|
|
133
|
+
tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
|
|
133
134
|
}, /*#__PURE__*/React__default.createElement("table", _extends({
|
|
134
135
|
"aria-labelledby": titleId,
|
|
135
136
|
"aria-describedby": descriptionId
|
|
@@ -174,7 +175,11 @@ Table.propTypes = {
|
|
|
174
175
|
/**
|
|
175
176
|
* `true` to add useZebraStyles striping.
|
|
176
177
|
*/
|
|
177
|
-
useZebraStyles: PropTypes.bool
|
|
178
|
+
useZebraStyles: PropTypes.bool,
|
|
179
|
+
/**
|
|
180
|
+
* Specify the table tabIndex
|
|
181
|
+
*/
|
|
182
|
+
tabIndex: PropTypes.number
|
|
178
183
|
};
|
|
179
184
|
|
|
180
185
|
export { Table, Table as default };
|
|
@@ -530,9 +530,6 @@ const DatePicker = /*#__PURE__*/React__default.forwardRef(function DatePicker(_r
|
|
|
530
530
|
const closeCalendar = event => {
|
|
531
531
|
calendarRef.current.close();
|
|
532
532
|
// Remove focus from endDate calendar input
|
|
533
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
534
|
-
document.activeElement.blur();
|
|
535
|
-
}
|
|
536
533
|
onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, {
|
|
537
534
|
type: 'clickOutside'
|
|
538
535
|
});
|
|
@@ -558,12 +555,7 @@ const DatePicker = /*#__PURE__*/React__default.forwardRef(function DatePicker(_r
|
|
|
558
555
|
if (!calendarRef.current || !startInputField.current) return;
|
|
559
556
|
const handleKeyDown = event => {
|
|
560
557
|
if (match(event, Tab) && !event.shiftKey && document.activeElement === endInputField.current && calendarRef.current.isOpen) {
|
|
561
|
-
event.preventDefault();
|
|
562
558
|
calendarRef.current.close();
|
|
563
|
-
// Remove focus from endDate calendar input
|
|
564
|
-
document.activeElement instanceof HTMLElement &&
|
|
565
|
-
// this is to fix the TS warning
|
|
566
|
-
document?.activeElement?.blur();
|
|
567
559
|
onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, event);
|
|
568
560
|
}
|
|
569
561
|
};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @param {object} config Plugin configuration.
|
|
10
10
|
* @returns {Plugin} A Flatpickr plugin to put adjust the position of calendar dropdown.
|
|
11
11
|
*/
|
|
12
|
-
var carbonFlatpickrAppendToPlugin =
|
|
12
|
+
var carbonFlatpickrAppendToPlugin = config => fp => {
|
|
13
13
|
/**
|
|
14
14
|
* Adjusts the floating menu position after Flatpicker sets it.
|
|
15
15
|
*/
|
|
@@ -51,6 +51,6 @@ var carbonFlatpickrAppendToPlugin = (config => fp => {
|
|
|
51
51
|
onReady: register,
|
|
52
52
|
onPreCalendarPosition: handlePreCalendarPosition
|
|
53
53
|
};
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
55
|
|
|
56
56
|
export { carbonFlatpickrAppendToPlugin as default };
|
|
@@ -12,7 +12,7 @@ import { Enter, ArrowLeft, ArrowRight, ArrowDown } from '../../../internal/keybo
|
|
|
12
12
|
* @param {object} config Plugin configuration.
|
|
13
13
|
* @returns {Plugin} A Flatpickr plugin to fix Flatpickr's behavior of certain events.
|
|
14
14
|
*/
|
|
15
|
-
var carbonFlatpickrFixEventsPlugin =
|
|
15
|
+
var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
16
16
|
const {
|
|
17
17
|
inputFrom,
|
|
18
18
|
inputTo,
|
|
@@ -150,6 +150,6 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
|
150
150
|
onReady: [register, init],
|
|
151
151
|
onDestroy: [release]
|
|
152
152
|
};
|
|
153
|
-
}
|
|
153
|
+
};
|
|
154
154
|
|
|
155
155
|
export { carbonFlatpickrFixEventsPlugin as default };
|
|
@@ -14,7 +14,7 @@ import rangePlugin from 'flatpickr/dist/plugins/rangePlugin';
|
|
|
14
14
|
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
|
|
15
15
|
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
16
16
|
*/
|
|
17
|
-
var carbonFlatpickrRangePlugin =
|
|
17
|
+
var carbonFlatpickrRangePlugin = config => {
|
|
18
18
|
const factory = rangePlugin(Object.assign({
|
|
19
19
|
position: 'left'
|
|
20
20
|
}, config));
|
|
@@ -49,6 +49,6 @@ var carbonFlatpickrRangePlugin = (config => {
|
|
|
49
49
|
onPreCalendarPosition() {}
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
|
|
54
54
|
export { carbonFlatpickrRangePlugin as default };
|
|
@@ -12,7 +12,7 @@ type ExcludedAttributes = 'id' | 'onChange';
|
|
|
12
12
|
export interface OnChangeData<ItemType> {
|
|
13
13
|
selectedItem: ItemType | null;
|
|
14
14
|
}
|
|
15
|
-
export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes>, TranslateWithId<ListBoxMenuIconTranslationKey> {
|
|
15
|
+
export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes>, TranslateWithId<ListBoxMenuIconTranslationKey>, React.RefAttributes<HTMLDivElement> {
|
|
16
16
|
/**
|
|
17
17
|
* Specify a label to be read by screen readers on the container node
|
|
18
18
|
* 'aria-label' of the ListBox component.
|
|
@@ -127,7 +127,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
127
127
|
* Provide the title text that will be read by a screen reader when
|
|
128
128
|
* visiting this control
|
|
129
129
|
*/
|
|
130
|
-
titleText
|
|
130
|
+
titleText: ReactNode;
|
|
131
131
|
/**
|
|
132
132
|
* The dropdown type, `default` or `inline`
|
|
133
133
|
*/
|
|
@@ -14,6 +14,7 @@ interface FeatureFlagsProps {
|
|
|
14
14
|
enableV12Overflowmenu?: boolean;
|
|
15
15
|
enableTreeviewControllable?: boolean;
|
|
16
16
|
enableExperimentalFocusWrapWithoutSentinels?: boolean;
|
|
17
|
+
enableV12DynamicFloatingStyles?: boolean;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
@@ -25,7 +26,7 @@ declare const FeatureFlagContext: React.Context<any>;
|
|
|
25
26
|
* along with the current `FeatureFlagContext` to provide consumers to check if
|
|
26
27
|
* a feature flag is enabled or disabled in a given React tree
|
|
27
28
|
*/
|
|
28
|
-
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, }: FeatureFlagsProps): JSX.Element;
|
|
29
|
+
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableV12DynamicFloatingStyles, }: FeatureFlagsProps): JSX.Element;
|
|
29
30
|
declare namespace FeatureFlags {
|
|
30
31
|
var propTypes: {
|
|
31
32
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -38,6 +39,7 @@ declare namespace FeatureFlags {
|
|
|
38
39
|
enableV12Overflowmenu: PropTypes.Requireable<boolean>;
|
|
39
40
|
enableTreeviewControllable: PropTypes.Requireable<boolean>;
|
|
40
41
|
enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
|
|
42
|
+
enableV12DynamicFloatingStyles: PropTypes.Requireable<boolean>;
|
|
41
43
|
};
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
@@ -29,7 +29,8 @@ function FeatureFlags(_ref) {
|
|
|
29
29
|
enableV12TileRadioIcons = false,
|
|
30
30
|
enableV12Overflowmenu = false,
|
|
31
31
|
enableTreeviewControllable = false,
|
|
32
|
-
enableExperimentalFocusWrapWithoutSentinels = false
|
|
32
|
+
enableExperimentalFocusWrapWithoutSentinels = false,
|
|
33
|
+
enableV12DynamicFloatingStyles = false
|
|
33
34
|
} = _ref;
|
|
34
35
|
const parentScope = useContext(FeatureFlagContext);
|
|
35
36
|
const [prevParentScope, setPrevParentScope] = useState(parentScope);
|
|
@@ -39,6 +40,7 @@ function FeatureFlags(_ref) {
|
|
|
39
40
|
'enable-v12-overflowmenu': enableV12Overflowmenu,
|
|
40
41
|
'enable-treeview-controllable': enableTreeviewControllable,
|
|
41
42
|
'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
|
|
43
|
+
'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
|
|
42
44
|
...flags
|
|
43
45
|
};
|
|
44
46
|
const [scope, updateScope] = useState(() => {
|
|
@@ -75,7 +77,8 @@ FeatureFlags.propTypes = {
|
|
|
75
77
|
enableV12TileRadioIcons: PropTypes.bool,
|
|
76
78
|
enableV12Overflowmenu: PropTypes.bool,
|
|
77
79
|
enableTreeviewControllable: PropTypes.bool,
|
|
78
|
-
enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool
|
|
80
|
+
enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool,
|
|
81
|
+
enableV12DynamicFloatingStyles: PropTypes.bool
|
|
79
82
|
};
|
|
80
83
|
|
|
81
84
|
/**
|
|
@@ -17,12 +17,12 @@ const FluidComboBoxSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const wrapperClasses = cx(className, `${prefix}--
|
|
21
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
22
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
23
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
20
|
+
const wrapperClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
24
22
|
className: wrapperClasses
|
|
25
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
23
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
26
26
|
className: `${prefix}--list-box__label`
|
|
27
27
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
28
28
|
className: `${prefix}--list-box__field`
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export interface FluidDropdownSkeletonProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to add.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const FluidDropdownSkeleton: React.FC<FluidDropdownSkeletonProps>;
|
|
15
|
+
export default FluidDropdownSkeleton;
|
|
@@ -17,13 +17,12 @@ const FluidDropdownSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
23
|
-
className: wrapperContainerClasses
|
|
24
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
20
|
+
const wrapperClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
25
22
|
className: wrapperClasses
|
|
26
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
23
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
27
26
|
className: `${prefix}--list-box__label`
|
|
28
27
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
29
28
|
className: `${prefix}--list-box__field`
|
|
@@ -35,6 +34,5 @@ FluidDropdownSkeleton.propTypes = {
|
|
|
35
34
|
*/
|
|
36
35
|
className: PropTypes.string
|
|
37
36
|
};
|
|
38
|
-
var FluidDropdownSkeleton$1 = FluidDropdownSkeleton;
|
|
39
37
|
|
|
40
|
-
export { FluidDropdownSkeleton
|
|
38
|
+
export { FluidDropdownSkeleton as default };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
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 { DropdownProps } from '../Dropdown';
|
|
9
|
+
export interface OnChangeData<ItemType> {
|
|
10
|
+
selectedItem: ItemType | null;
|
|
11
|
+
}
|
|
12
|
+
export interface FluidDropdownProps<ItemType> extends DropdownProps<ItemType> {
|
|
13
|
+
/**
|
|
14
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
19
|
+
*/
|
|
20
|
+
direction?: 'top' | 'bottom';
|
|
21
|
+
/**
|
|
22
|
+
* Specify whether the `<input>` should be disabled
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Specify a custom `id` for the `<input>`
|
|
27
|
+
*/
|
|
28
|
+
id: string;
|
|
29
|
+
/**
|
|
30
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
31
|
+
* from their collection that are pre-selected
|
|
32
|
+
*/
|
|
33
|
+
initialSelectedItem?: ItemType;
|
|
34
|
+
/**
|
|
35
|
+
* Specify if the currently selected value is invalid.
|
|
36
|
+
*/
|
|
37
|
+
invalid?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
40
|
+
*/
|
|
41
|
+
invalidText?: React.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Specify if the `FluidDropdown` should render its menu items in condensed mode
|
|
44
|
+
*/
|
|
45
|
+
isCondensed?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Function to render items as custom components instead of strings.
|
|
48
|
+
* Defaults to null and is overridden by a getter
|
|
49
|
+
*/
|
|
50
|
+
itemToElement?: React.JSXElementConstructor<ItemType> | null;
|
|
51
|
+
/**
|
|
52
|
+
* Helper function passed to downshift that allows the library to render a
|
|
53
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
54
|
+
* from a given item to serve as the item label in the list.
|
|
55
|
+
*/
|
|
56
|
+
itemToString?(item: ItemType | null): string;
|
|
57
|
+
/**
|
|
58
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
59
|
+
* in a collection of whatever kind of data structure they prefer
|
|
60
|
+
*/
|
|
61
|
+
items: ItemType[];
|
|
62
|
+
/**
|
|
63
|
+
* Generic `label` that will be used as the textual representation of what
|
|
64
|
+
* this field is for
|
|
65
|
+
*/
|
|
66
|
+
label: NonNullable<React.ReactNode>;
|
|
67
|
+
/**
|
|
68
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
69
|
+
* consuming component what kind of internal state changes are occurring.
|
|
70
|
+
*/
|
|
71
|
+
onChange?(data: OnChangeData<ItemType>): void;
|
|
72
|
+
/**
|
|
73
|
+
* An optional callback to render the currently selected item as a react element instead of only
|
|
74
|
+
* as a string.
|
|
75
|
+
*/
|
|
76
|
+
renderSelectedItem?(item: ItemType): React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* In the case you want to control the dropdown selection entirely.
|
|
79
|
+
* This value is the selected item from the list of items
|
|
80
|
+
*/
|
|
81
|
+
selectedItem?: ItemType;
|
|
82
|
+
/**
|
|
83
|
+
* Provide the title text that will be read by a screen reader when
|
|
84
|
+
* visiting this control
|
|
85
|
+
*/
|
|
86
|
+
titleText: React.ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
89
|
+
*/
|
|
90
|
+
translateWithId?: (id: string) => string;
|
|
91
|
+
/**
|
|
92
|
+
* Specify whether the control is currently in warning state
|
|
93
|
+
*/
|
|
94
|
+
warn?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Provide the text that is displayed when the control is in warning state
|
|
97
|
+
*/
|
|
98
|
+
warnText?: React.ReactNode;
|
|
99
|
+
}
|
|
100
|
+
declare const FluidDropdown: React.ForwardRefExoticComponent<Omit<FluidDropdownProps<unknown>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
101
|
+
export default FluidDropdown;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
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 FluidDropdown from './FluidDropdown';
|
|
8
|
+
import { type FluidDropdownProps } from './FluidDropdown';
|
|
9
|
+
import { type FluidDropdownSkeletonProps } from './FluidDropdown.Skeleton';
|
|
10
|
+
export type { FluidDropdownProps, FluidDropdownSkeletonProps };
|
|
11
|
+
export default FluidDropdown;
|
|
12
|
+
export { FluidDropdown };
|
|
13
|
+
export { default as FluidDropdownSkeleton } from './FluidDropdown.Skeleton';
|
|
@@ -17,12 +17,12 @@ const FluidMultiSelectSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const wrapperClasses = cx(className, `${prefix}--
|
|
21
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
22
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
23
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
20
|
+
const wrapperClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
24
22
|
className: wrapperClasses
|
|
25
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
23
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
26
26
|
className: `${prefix}--list-box__label`
|
|
27
27
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
28
28
|
className: `${prefix}--list-box__field`
|
|
@@ -17,12 +17,12 @@ const FluidSelectSkeleton = _ref => {
|
|
|
17
17
|
...rest
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const wrapperClasses = cx(className, `${prefix}--
|
|
21
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
22
|
-
className: `${prefix}--list-box__wrapper--fluid`
|
|
23
|
-
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
20
|
+
const wrapperClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
24
22
|
className: wrapperClasses
|
|
25
|
-
}, rest), /*#__PURE__*/React__default.createElement("
|
|
23
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--skeleton ${prefix}--list-box`
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
26
26
|
className: `${prefix}--list-box__label`
|
|
27
27
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
28
28
|
className: `${prefix}--list-box__field`
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface FluidTextAreaSkeletonProps {
|
|
3
3
|
/**
|
|
4
4
|
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
5
5
|
*/
|
|
6
6
|
className?: string;
|
|
7
7
|
}
|
|
8
|
-
declare
|
|
9
|
-
[x: string]: any;
|
|
10
|
-
className: any;
|
|
11
|
-
}): void;
|
|
12
|
-
declare namespace FluidTextAreaSkeleton {
|
|
13
|
-
var propTypes: {
|
|
14
|
-
/**
|
|
15
|
-
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
16
|
-
*/
|
|
17
|
-
className: PropTypes.Requireable<string>;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
8
|
+
declare const FluidTextAreaSkeleton: React.FC<FluidTextAreaSkeletonProps>;
|
|
20
9
|
export default FluidTextAreaSkeleton;
|