@carbon/react 1.69.0 → 1.70.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.
Files changed (53) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +781 -781
  2. package/es/components/ContextMenu/index.d.ts +8 -0
  3. package/es/components/ContextMenu/useContextMenu.d.ts +21 -0
  4. package/es/components/ContextMenu/useContextMenu.js +9 -8
  5. package/es/components/DataTable/DataTable.d.ts +3 -2
  6. package/es/components/Dropdown/Dropdown.d.ts +2 -2
  7. package/es/components/FeatureFlags/index.d.ts +3 -1
  8. package/es/components/FeatureFlags/index.js +5 -2
  9. package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +5 -5
  10. package/es/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +15 -0
  11. package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +6 -8
  12. package/es/components/FluidDropdown/FluidDropdown.d.ts +101 -0
  13. package/es/components/FluidDropdown/FluidDropdown.js +1 -2
  14. package/es/components/FluidDropdown/index.d.ts +13 -0
  15. package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +5 -5
  16. package/es/components/FluidSelect/FluidSelect.Skeleton.js +5 -5
  17. package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +2 -13
  18. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +22 -5
  19. package/es/components/Notification/Notification.js +2 -6
  20. package/es/components/NumberInput/NumberInput.Skeleton.d.ts +9 -1
  21. package/es/components/NumberInput/NumberInput.Skeleton.js +7 -2
  22. package/es/components/Popover/index.js +2 -0
  23. package/es/components/Tabs/Tabs.js +1 -1
  24. package/es/components/UIShell/HeaderPanel.js +1 -1
  25. package/es/feature-flags.js +2 -1
  26. package/es/index.js +3 -3
  27. package/lib/components/ContextMenu/index.d.ts +8 -0
  28. package/lib/components/ContextMenu/useContextMenu.d.ts +21 -0
  29. package/lib/components/ContextMenu/useContextMenu.js +9 -8
  30. package/lib/components/DataTable/DataTable.d.ts +3 -2
  31. package/lib/components/Dropdown/Dropdown.d.ts +2 -2
  32. package/lib/components/FeatureFlags/index.d.ts +3 -1
  33. package/lib/components/FeatureFlags/index.js +5 -2
  34. package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +5 -5
  35. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +15 -0
  36. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +6 -8
  37. package/lib/components/FluidDropdown/FluidDropdown.d.ts +101 -0
  38. package/lib/components/FluidDropdown/FluidDropdown.js +1 -2
  39. package/lib/components/FluidDropdown/index.d.ts +13 -0
  40. package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +5 -5
  41. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +5 -5
  42. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +2 -13
  43. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +24 -5
  44. package/lib/components/Notification/Notification.js +2 -6
  45. package/lib/components/NumberInput/NumberInput.Skeleton.d.ts +9 -1
  46. package/lib/components/NumberInput/NumberInput.Skeleton.js +7 -2
  47. package/lib/components/Popover/index.js +2 -0
  48. package/lib/components/Tabs/Tabs.js +1 -1
  49. package/lib/components/UIShell/HeaderPanel.js +1 -1
  50. package/lib/feature-flags.js +2 -1
  51. package/lib/index.js +6 -6
  52. package/package.json +5 -4
  53. package/telemetry.yml +765 -710
@@ -0,0 +1,8 @@
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
+ import useContextMenu from './useContextMenu';
8
+ export { useContextMenu };
@@ -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 {Element|Document|Window|object} [trigger=document] The element or ref which should trigger the Menu on right-click
12
- * @returns {object} Props object to pass onto Menu component
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?.current ?? trigger;
32
- if (el && el instanceof Element || el instanceof Document || el instanceof Window) {
33
- el.addEventListener('contextmenu', openContextMenu);
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', openContextMenu);
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?: {
@@ -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?: ReactNode;
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}--skeleton`, `${prefix}--list-box`);
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("span", {
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 wrapperContainerClasses = cx(className, `${prefix}--list-box__wrapper--fluid`);
21
- const wrapperClasses = cx(`${prefix}--skeleton`, `${prefix}--list-box`);
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("span", {
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$1 as default };
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;
@@ -120,6 +120,5 @@ FluidDropdown.propTypes = {
120
120
  */
121
121
  warnText: PropTypes.node
122
122
  };
123
- var FluidDropdown$1 = FluidDropdown;
124
123
 
125
- export { FluidDropdown$1 as default };
124
+ export { FluidDropdown as default };
@@ -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}--skeleton`, `${prefix}--list-box`);
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("span", {
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}--skeleton`, `${prefix}--list-box`);
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("span", {
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 PropTypes from 'prop-types';
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 function FluidTextAreaSkeleton({ className, ...other }: {
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;
@@ -5,14 +5,31 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
9
  import PropTypes from 'prop-types';
9
- import 'react';
10
- import 'classnames';
10
+ import React__default from 'react';
11
+ import cx from 'classnames';
11
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
+ import { FormContext } from '../FluidForm/FormContext.js';
12
14
 
13
- function FluidTextAreaSkeleton(_ref) {
14
- usePrefix();
15
- }
15
+ const FluidTextAreaSkeleton = _ref => {
16
+ let {
17
+ className,
18
+ ...other
19
+ } = _ref;
20
+ const prefix = usePrefix();
21
+ return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
22
+ value: {
23
+ isFluid: true
24
+ }
25
+ }, /*#__PURE__*/React__default.createElement("div", _extends({
26
+ className: cx(`${prefix}--form-item ${prefix}--text-area--fluid__skeleton`, className)
27
+ }, other), /*#__PURE__*/React__default.createElement("span", {
28
+ className: `${prefix}--label ${prefix}--skeleton`
29
+ }), /*#__PURE__*/React__default.createElement("div", {
30
+ className: `${prefix}--skeleton ${prefix}--text-area`
31
+ })));
32
+ };
16
33
  FluidTextAreaSkeleton.propTypes = {
17
34
  /**
18
35
  * Specify an optional className to be applied to the outer FluidForm wrapper
@@ -278,9 +278,7 @@ function ToastNotification(_ref4) {
278
278
  }, caption), children), !hideCloseButton && /*#__PURE__*/React__default.createElement(NotificationButton, {
279
279
  notificationType: "toast",
280
280
  onClick: handleCloseButtonClick,
281
- "aria-hidden": "true",
282
- "aria-label": deprecatedAriaLabel || ariaLabel,
283
- tabIndex: -1
281
+ "aria-label": deprecatedAriaLabel || ariaLabel
284
282
  }));
285
283
  }
286
284
  ToastNotification.propTypes = {
@@ -415,9 +413,7 @@ function InlineNotification(_ref5) {
415
413
  }, subtitle), children)), !hideCloseButton && /*#__PURE__*/React__default.createElement(NotificationButton, {
416
414
  notificationType: "inline",
417
415
  onClick: handleCloseButtonClick,
418
- "aria-hidden": "true",
419
- "aria-label": ariaLabel,
420
- tabIndex: -1
416
+ "aria-label": ariaLabel
421
417
  }));
422
418
  }
423
419
  InlineNotification.propTypes = {
@@ -15,8 +15,12 @@ export interface NumberInputSkeletonProps extends HTMLAttributes<HTMLDivElement>
15
15
  * Specify whether the label should be hidden, or not
16
16
  */
17
17
  hideLabel?: boolean;
18
+ /**
19
+ * Specify the size of the Number Input.
20
+ */
21
+ size?: 'sm' | 'md' | 'lg';
18
22
  }
19
- declare function NumberInputSkeleton({ hideLabel, className, ...rest }: NumberInputSkeletonProps): import("react/jsx-runtime").JSX.Element;
23
+ declare function NumberInputSkeleton({ hideLabel, className, size, ...rest }: NumberInputSkeletonProps): import("react/jsx-runtime").JSX.Element;
20
24
  declare namespace NumberInputSkeleton {
21
25
  var propTypes: {
22
26
  /**
@@ -27,6 +31,10 @@ declare namespace NumberInputSkeleton {
27
31
  * Specify whether the label should be hidden, or not
28
32
  */
29
33
  hideLabel: PropTypes.Requireable<boolean>;
34
+ /**
35
+ * Specify the size of the Number Input.
36
+ */
37
+ size: PropTypes.Requireable<string>;
30
38
  };
31
39
  }
32
40
  export default NumberInputSkeleton;
@@ -15,6 +15,7 @@ function NumberInputSkeleton(_ref) {
15
15
  let {
16
16
  hideLabel,
17
17
  className,
18
+ size = 'md',
18
19
  ...rest
19
20
  } = _ref;
20
21
  const prefix = usePrefix();
@@ -23,7 +24,7 @@ function NumberInputSkeleton(_ref) {
23
24
  }, rest), !hideLabel && /*#__PURE__*/React__default.createElement("span", {
24
25
  className: `${prefix}--label ${prefix}--skeleton`
25
26
  }), /*#__PURE__*/React__default.createElement("div", {
26
- className: `${prefix}--number ${prefix}--skeleton`
27
+ className: `${prefix}--number ${prefix}--skeleton ${prefix}--number--${size}`
27
28
  }));
28
29
  }
29
30
  NumberInputSkeleton.propTypes = {
@@ -34,7 +35,11 @@ NumberInputSkeleton.propTypes = {
34
35
  /**
35
36
  * Specify whether the label should be hidden, or not
36
37
  */
37
- hideLabel: PropTypes.bool
38
+ hideLabel: PropTypes.bool,
39
+ /**
40
+ * Specify the size of the Number Input.
41
+ */
42
+ size: PropTypes.oneOf(['sm', 'md', 'lg'])
38
43
  };
39
44
 
40
45
  export { NumberInputSkeleton as default };
@@ -128,6 +128,8 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
128
128
  strategy: 'fixed',
129
129
  // Middleware order matters, arrow should be last
130
130
  middleware: [offset(!isTabTip ? popoverDimensions?.current?.offset : 0), autoAlign && flip({
131
+ fallbackPlacements: align.includes('bottom') ? ['bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end'] : ['top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end'],
132
+ fallbackStrategy: 'initialPlacement',
131
133
  fallbackAxisSideDirection: 'start'
132
134
  }), arrow({
133
135
  element: caretRef
@@ -1184,7 +1184,7 @@ function TabPanels(_ref13) {
1184
1184
  }
1185
1185
  });
1186
1186
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, React__default.Children.map(children, (child, index) => {
1187
- return /*#__PURE__*/React__default.createElement(TabPanelContext.Provider, {
1187
+ return !isElement(child) ? null : /*#__PURE__*/React__default.createElement(TabPanelContext.Provider, {
1188
1188
  value: index
1189
1189
  }, /*#__PURE__*/React__default.cloneElement(child, {
1190
1190
  ref: element => {
@@ -62,7 +62,7 @@ const HeaderPanel = /*#__PURE__*/React__default.forwardRef(function HeaderPanel(
62
62
  const focusedElement = document.activeElement;
63
63
  setLastClickedElement(focusedElement);
64
64
  const childJsxElement = children;
65
- if (childJsxElement.type?.displayName === 'Switcher' && !focusedElement?.closest(`.${prefix}--header-panel--expanded`) && !focusedElement?.closest(`.${prefix}--header__action`) && !headerPanelReference?.current?.classList.contains(`${prefix}--switcher`) && expanded) {
65
+ if (childJsxElement?.type?.displayName === 'Switcher' && !focusedElement?.closest(`.${prefix}--header-panel--expanded`) && !focusedElement?.closest(`.${prefix}--header__action`) && !headerPanelReference?.current?.classList.contains(`${prefix}--switcher`) && expanded) {
66
66
  setExpandedState(false);
67
67
  onHeaderPanelFocus();
68
68
  }
@@ -13,5 +13,6 @@ FeatureFlags.merge({
13
13
  'enable-v11-release': true,
14
14
  'enable-experimental-tile-contrast': false,
15
15
  'enable-v12-tile-radio-icons': false,
16
- 'enable-v12-structured-list-visible-icons': false
16
+ 'enable-v12-structured-list-visible-icons': false,
17
+ 'enable-v12-dynamic-floating-styles': false
17
18
  });
package/es/index.js CHANGED
@@ -29,6 +29,7 @@ export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
29
29
  export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
30
30
  import './components/ContainedList/index.js';
31
31
  export { default as ContentSwitcher } from './components/ContentSwitcher/index.js';
32
+ export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
32
33
  export { default as Copy } from './components/Copy/Copy.js';
33
34
  export { default as CopyButton } from './components/CopyButton/CopyButton.js';
34
35
  export { default as DangerButton } from './components/DangerButton/DangerButton.js';
@@ -165,6 +166,8 @@ export { default as unstable__FluidComboBoxSkeleton } from './components/FluidCo
165
166
  export { default as unstable__FluidDatePicker } from './components/FluidDatePicker/FluidDatePicker.js';
166
167
  export { default as unstable__FluidDatePickerSkeleton } from './components/FluidDatePicker/FluidDatePicker.Skeleton.js';
167
168
  export { default as unstable__FluidDatePickerInput } from './components/FluidDatePickerInput/FluidDatePickerInput.js';
169
+ export { default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
170
+ export { default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
168
171
  export { default as unstable__FluidMultiSelect } from './components/FluidMultiSelect/FluidMultiSelect.js';
169
172
  export { default as unstable__FluidMultiSelectSkeleton } from './components/FluidMultiSelect/FluidMultiSelect.Skeleton.js';
170
173
  export { default as unstable__FluidSelect } from './components/FluidSelect/FluidSelect.js';
@@ -202,12 +205,9 @@ export { default as unstable_PageSelector } from './components/Pagination/experi
202
205
  export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
203
206
  export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
204
207
  export { default as ContainedList } from './components/ContainedList/ContainedList.js';
205
- export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
206
208
  export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
207
209
  export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
208
210
  export { default as TextInput } from './components/TextInput/TextInput.js';
209
- export { default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
210
- export { default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
211
211
  export { LayoutDirection as unstable_LayoutDirection } from './components/LayoutDirection/LayoutDirection.js';
212
212
  export { useLayoutDirection as unstable_useLayoutDirection } from './components/LayoutDirection/useLayoutDirection.js';
213
213
  export { Text as unstable_Text } from './components/Text/Text.js';
@@ -0,0 +1,8 @@
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
+ import useContextMenu from './useContextMenu';
8
+ export { useContextMenu };
@@ -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;