@carbon/react 1.66.0-rc.0 → 1.67.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 (150) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1031 -1047
  2. package/es/components/AILabel/index.d.ts +37 -0
  3. package/es/components/AILabel/index.js +38 -14
  4. package/es/components/Accordion/Accordion.d.ts +5 -1
  5. package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
  6. package/es/components/Button/Button.d.ts +2 -1
  7. package/es/components/Button/Button.js +14 -3
  8. package/es/components/CodeSnippet/CodeSnippet.d.ts +9 -1
  9. package/es/components/CodeSnippet/CodeSnippet.js +7 -0
  10. package/es/components/ComboBox/ComboBox.js +37 -14
  11. package/es/components/ComboButton/index.js +1 -1
  12. package/es/components/Copy/Copy.d.ts +9 -1
  13. package/es/components/Copy/Copy.js +6 -0
  14. package/es/components/CopyButton/CopyButton.d.ts +9 -1
  15. package/es/components/CopyButton/CopyButton.js +6 -0
  16. package/es/components/DataTable/TableExpandHeader.d.ts +2 -2
  17. package/es/components/DataTable/TableExpandHeader.js +1 -1
  18. package/es/components/DatePicker/DatePicker.js +1 -0
  19. package/es/components/Dropdown/Dropdown.js +2 -2
  20. package/es/components/FeatureFlags/index.js +27 -7
  21. package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +15 -0
  22. package/es/components/FluidNumberInput/FluidNumberInput.d.ts +95 -0
  23. package/es/components/FluidNumberInput/index.d.ts +11 -0
  24. package/es/components/FluidSearch/FluidSearch.Skeleton.d.ts +15 -0
  25. package/es/components/FluidSearch/FluidSearch.Skeleton.js +2 -2
  26. package/es/components/FluidSearch/FluidSearch.d.ts +73 -0
  27. package/es/components/FluidSearch/FluidSearch.js +1 -2
  28. package/es/components/FluidSearch/index.d.ts +11 -0
  29. package/es/components/FluidSelect/FluidSelect.Skeleton.d.ts +15 -0
  30. package/es/components/FluidSelect/FluidSelect.Skeleton.js +1 -2
  31. package/es/components/FluidSelect/FluidSelect.d.ts +57 -0
  32. package/es/components/FluidSelect/FluidSelect.js +1 -2
  33. package/es/components/FluidSelect/index.d.ts +13 -0
  34. package/es/components/FluidSelect/index.js +1 -0
  35. package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
  36. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -20
  37. package/es/components/FluidTextArea/FluidTextArea.d.ts +96 -0
  38. package/es/components/FluidTextArea/FluidTextArea.js +2 -2
  39. package/es/components/FluidTextArea/index.d.ts +12 -0
  40. package/es/components/FluidTextInput/FluidPasswordInput.d.ts +83 -0
  41. package/es/components/FluidTextInput/FluidPasswordInput.js +87 -0
  42. package/es/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +15 -0
  43. package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +2 -2
  44. package/es/components/FluidTextInput/FluidTextInput.d.ts +70 -0
  45. package/es/components/FluidTextInput/FluidTextInput.js +6 -4
  46. package/es/components/FluidTextInput/index.d.ts +15 -0
  47. package/es/components/FluidTextInput/index.js +2 -0
  48. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.d.ts +35 -0
  49. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +4 -2
  50. package/es/components/FluidTimePicker/FluidTimePicker.d.ts +45 -0
  51. package/es/components/FluidTimePicker/FluidTimePicker.js +5 -5
  52. package/es/components/FluidTimePicker/index.d.ts +13 -0
  53. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +41 -0
  54. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -2
  55. package/es/components/FluidTimePickerSelect/index.d.ts +11 -0
  56. package/es/components/IconButton/index.d.ts +4 -0
  57. package/es/components/IconButton/index.js +6 -0
  58. package/es/components/Menu/Menu.js +2 -1
  59. package/es/components/MultiSelect/FilterableMultiSelect.js +6 -5
  60. package/es/components/MultiSelect/MultiSelect.js +2 -1
  61. package/es/components/Notification/Notification.js +4 -2
  62. package/es/components/OverflowMenu/next/index.js +3 -1
  63. package/es/components/OverflowMenuV2/index.js +1 -3
  64. package/es/components/Pagination/Pagination.js +1 -1
  65. package/es/components/Popover/index.js +2 -2
  66. package/es/components/Tabs/Tabs.js +1 -1
  67. package/es/components/Tag/DismissibleTag.d.ts +9 -1
  68. package/es/components/Tag/DismissibleTag.js +7 -3
  69. package/es/components/Tag/Tag.js +2 -2
  70. package/es/components/Toggletip/index.js +2 -1
  71. package/es/components/UIShell/HeaderPanel.js +1 -1
  72. package/es/index.js +12 -11
  73. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +757 -4
  74. package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +76 -0
  75. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +106 -6
  76. package/lib/components/AILabel/index.d.ts +37 -0
  77. package/lib/components/AILabel/index.js +38 -14
  78. package/lib/components/Accordion/Accordion.d.ts +5 -1
  79. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  80. package/lib/components/Button/Button.d.ts +2 -1
  81. package/lib/components/Button/Button.js +13 -2
  82. package/lib/components/CodeSnippet/CodeSnippet.d.ts +9 -1
  83. package/lib/components/CodeSnippet/CodeSnippet.js +7 -0
  84. package/lib/components/ComboBox/ComboBox.js +38 -15
  85. package/lib/components/ComboButton/index.js +2 -2
  86. package/lib/components/Copy/Copy.d.ts +9 -1
  87. package/lib/components/Copy/Copy.js +6 -0
  88. package/lib/components/CopyButton/CopyButton.d.ts +9 -1
  89. package/lib/components/CopyButton/CopyButton.js +6 -0
  90. package/lib/components/DataTable/TableExpandHeader.d.ts +2 -2
  91. package/lib/components/DataTable/TableExpandHeader.js +1 -1
  92. package/lib/components/DatePicker/DatePicker.js +1 -0
  93. package/lib/components/Dropdown/Dropdown.js +3 -3
  94. package/lib/components/FeatureFlags/index.js +27 -7
  95. package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +15 -0
  96. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +95 -0
  97. package/lib/components/FluidNumberInput/index.d.ts +11 -0
  98. package/lib/components/FluidSearch/FluidSearch.Skeleton.d.ts +15 -0
  99. package/lib/components/FluidSearch/FluidSearch.Skeleton.js +2 -2
  100. package/lib/components/FluidSearch/FluidSearch.d.ts +73 -0
  101. package/lib/components/FluidSearch/FluidSearch.js +1 -2
  102. package/lib/components/FluidSearch/index.d.ts +11 -0
  103. package/lib/components/FluidSelect/FluidSelect.Skeleton.d.ts +15 -0
  104. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +1 -2
  105. package/lib/components/FluidSelect/FluidSelect.d.ts +57 -0
  106. package/lib/components/FluidSelect/FluidSelect.js +1 -2
  107. package/lib/components/FluidSelect/index.d.ts +13 -0
  108. package/lib/components/FluidSelect/index.js +2 -0
  109. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
  110. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -22
  111. package/lib/components/FluidTextArea/FluidTextArea.d.ts +96 -0
  112. package/lib/components/FluidTextArea/FluidTextArea.js +2 -2
  113. package/lib/components/FluidTextArea/index.d.ts +12 -0
  114. package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +83 -0
  115. package/lib/components/FluidTextInput/FluidPasswordInput.js +93 -0
  116. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +15 -0
  117. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +2 -2
  118. package/lib/components/FluidTextInput/FluidTextInput.d.ts +70 -0
  119. package/lib/components/FluidTextInput/FluidTextInput.js +6 -4
  120. package/lib/components/FluidTextInput/index.d.ts +15 -0
  121. package/lib/components/FluidTextInput/index.js +3 -0
  122. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.d.ts +35 -0
  123. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +4 -2
  124. package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +45 -0
  125. package/lib/components/FluidTimePicker/FluidTimePicker.js +6 -6
  126. package/lib/components/FluidTimePicker/index.d.ts +13 -0
  127. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +41 -0
  128. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -2
  129. package/lib/components/FluidTimePickerSelect/index.d.ts +11 -0
  130. package/lib/components/IconButton/index.d.ts +4 -0
  131. package/lib/components/IconButton/index.js +6 -0
  132. package/lib/components/Menu/Menu.js +2 -1
  133. package/lib/components/MultiSelect/FilterableMultiSelect.js +7 -6
  134. package/lib/components/MultiSelect/MultiSelect.js +3 -2
  135. package/lib/components/Notification/Notification.js +4 -2
  136. package/lib/components/OverflowMenu/next/index.js +3 -1
  137. package/lib/components/OverflowMenuV2/index.js +1 -3
  138. package/lib/components/Pagination/Pagination.js +1 -1
  139. package/lib/components/Popover/index.js +3 -3
  140. package/lib/components/Tabs/Tabs.js +1 -1
  141. package/lib/components/Tag/DismissibleTag.d.ts +9 -1
  142. package/lib/components/Tag/DismissibleTag.js +7 -3
  143. package/lib/components/Tag/Tag.js +2 -2
  144. package/lib/components/Toggletip/index.js +2 -1
  145. package/lib/components/UIShell/HeaderPanel.js +1 -1
  146. package/lib/index.js +23 -22
  147. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +763 -2
  148. package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +80 -0
  149. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +121 -5
  150. package/package.json +10 -10
@@ -0,0 +1,76 @@
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
+
8
+ import { offset, autoPlacement, shift, flip, size, hide as hide$1, arrow, inline, limitShift } from '../../core/dist/floating-ui.core.mjs.js';
9
+
10
+ /**
11
+ * Modifies the placement by translating the floating element along the
12
+ * specified axes.
13
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
14
+ * object may be passed.
15
+ * @see https://floating-ui.com/docs/offset
16
+ */
17
+ offset;
18
+
19
+ /**
20
+ * Optimizes the visibility of the floating element by choosing the placement
21
+ * that has the most space available automatically, without needing to specify a
22
+ * preferred placement. Alternative to `flip`.
23
+ * @see https://floating-ui.com/docs/autoPlacement
24
+ */
25
+ autoPlacement;
26
+
27
+ /**
28
+ * Optimizes the visibility of the floating element by shifting it in order to
29
+ * keep it in view when it will overflow the clipping boundary.
30
+ * @see https://floating-ui.com/docs/shift
31
+ */
32
+ shift;
33
+
34
+ /**
35
+ * Optimizes the visibility of the floating element by flipping the `placement`
36
+ * in order to keep it in view when the preferred placement(s) will overflow the
37
+ * clipping boundary. Alternative to `autoPlacement`.
38
+ * @see https://floating-ui.com/docs/flip
39
+ */
40
+ flip;
41
+
42
+ /**
43
+ * Provides data that allows you to change the size of the floating element —
44
+ * for instance, prevent it from overflowing the clipping boundary or match the
45
+ * width of the reference element.
46
+ * @see https://floating-ui.com/docs/size
47
+ */
48
+ size;
49
+
50
+ /**
51
+ * Provides data to hide the floating element in applicable situations, such as
52
+ * when it is not in the same clipping context as the reference element.
53
+ * @see https://floating-ui.com/docs/hide
54
+ */
55
+ const hide = hide$1;
56
+
57
+ /**
58
+ * Provides data to position an inner element of the floating element so that it
59
+ * appears centered to the reference element.
60
+ * @see https://floating-ui.com/docs/arrow
61
+ */
62
+ arrow;
63
+
64
+ /**
65
+ * Provides improved positioning for inline reference elements that can span
66
+ * over multiple lines, such as hyperlinks or range selections.
67
+ * @see https://floating-ui.com/docs/inline
68
+ */
69
+ inline;
70
+
71
+ /**
72
+ * Built-in `limiter` that will stop `shift()` at a certain point.
73
+ */
74
+ limitShift;
75
+
76
+ export { hide };
@@ -5,10 +5,101 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ /**
9
+ * Custom positioning reference element.
10
+ * @see https://floating-ui.com/docs/virtual-elements
11
+ */
12
+
8
13
  const sides = ['top', 'right', 'bottom', 'left'];
14
+ const alignments = ['start', 'end'];
15
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
16
+ const min = Math.min;
17
+ const max = Math.max;
18
+ const oppositeSideMap = {
19
+ left: 'right',
20
+ right: 'left',
21
+ bottom: 'top',
22
+ top: 'bottom'
23
+ };
24
+ const oppositeAlignmentMap = {
25
+ start: 'end',
26
+ end: 'start'
27
+ };
28
+ function clamp(start, value, end) {
29
+ return max(start, min(value, end));
30
+ }
9
31
  function evaluate(value, param) {
10
32
  return typeof value === 'function' ? value(param) : value;
11
33
  }
34
+ function getSide(placement) {
35
+ return placement.split('-')[0];
36
+ }
37
+ function getAlignment(placement) {
38
+ return placement.split('-')[1];
39
+ }
40
+ function getOppositeAxis(axis) {
41
+ return axis === 'x' ? 'y' : 'x';
42
+ }
43
+ function getAxisLength(axis) {
44
+ return axis === 'y' ? 'height' : 'width';
45
+ }
46
+ function getSideAxis(placement) {
47
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
48
+ }
49
+ function getAlignmentAxis(placement) {
50
+ return getOppositeAxis(getSideAxis(placement));
51
+ }
52
+ function getAlignmentSides(placement, rects, rtl) {
53
+ if (rtl === void 0) {
54
+ rtl = false;
55
+ }
56
+ const alignment = getAlignment(placement);
57
+ const alignmentAxis = getAlignmentAxis(placement);
58
+ const length = getAxisLength(alignmentAxis);
59
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
60
+ if (rects.reference[length] > rects.floating[length]) {
61
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
62
+ }
63
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
64
+ }
65
+ function getExpandedPlacements(placement) {
66
+ const oppositePlacement = getOppositePlacement(placement);
67
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
68
+ }
69
+ function getOppositeAlignmentPlacement(placement) {
70
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
71
+ }
72
+ function getSideList(side, isStart, rtl) {
73
+ const lr = ['left', 'right'];
74
+ const rl = ['right', 'left'];
75
+ const tb = ['top', 'bottom'];
76
+ const bt = ['bottom', 'top'];
77
+ switch (side) {
78
+ case 'top':
79
+ case 'bottom':
80
+ if (rtl) return isStart ? rl : lr;
81
+ return isStart ? lr : rl;
82
+ case 'left':
83
+ case 'right':
84
+ return isStart ? tb : bt;
85
+ default:
86
+ return [];
87
+ }
88
+ }
89
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
90
+ const alignment = getAlignment(placement);
91
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
92
+ if (alignment) {
93
+ list = list.map(side => side + "-" + alignment);
94
+ if (flipAlignment) {
95
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
96
+ }
97
+ }
98
+ return list;
99
+ }
100
+ function getOppositePlacement(placement) {
101
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
102
+ }
12
103
  function expandPaddingObject(padding) {
13
104
  return {
14
105
  top: 0,
@@ -27,13 +118,22 @@ function getPaddingObject(padding) {
27
118
  };
28
119
  }
29
120
  function rectToClientRect(rect) {
121
+ const {
122
+ x,
123
+ y,
124
+ width,
125
+ height
126
+ } = rect;
30
127
  return {
31
- ...rect,
32
- top: rect.y,
33
- left: rect.x,
34
- right: rect.x + rect.width,
35
- bottom: rect.y + rect.height
128
+ width,
129
+ height,
130
+ top: y,
131
+ left: x,
132
+ right: x + width,
133
+ bottom: y + height,
134
+ x,
135
+ y
36
136
  };
37
137
  }
38
138
 
39
- export { evaluate, expandPaddingObject, getPaddingObject, rectToClientRect, sides };
139
+ export { alignments, clamp, evaluate, expandPaddingObject, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, sides };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2024
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 type AILabelContentProps = React.HTMLAttributes<HTMLSpanElement>;
9
+ export declare const AILabelContent: React.ForwardRefExoticComponent<AILabelContentProps & React.RefAttributes<unknown>>;
10
+ export type AILabelActionsProps = React.HTMLAttributes<HTMLSpanElement>;
11
+ export declare const AILabelActions: React.ForwardRefExoticComponent<AILabelActionsProps & React.RefAttributes<unknown>>;
12
+ /**
13
+ * Deprecated popover alignment values.
14
+ * @deprecated Use NewPopoverAlignment instead.
15
+ */
16
+ export type DeprecatedAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
17
+ export type NewAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
18
+ export type Alignment = DeprecatedAlignment | NewAlignment;
19
+ interface AILabelProps {
20
+ AILabelContent?: React.ReactNode;
21
+ aiText?: string;
22
+ aiTextLabel?: string;
23
+ textLabel?: string;
24
+ align?: Alignment;
25
+ autoAlign?: boolean;
26
+ children?: React.ReactNode;
27
+ className?: string;
28
+ kind?: 'default' | 'inline';
29
+ onRevertClick?: (evt: React.MouseEvent<HTMLButtonElement>) => void;
30
+ revertActive?: boolean;
31
+ revertLabel?: string;
32
+ size?: 'mini' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
33
+ 'aria-label'?: string;
34
+ slugLabel?: string;
35
+ }
36
+ export declare const AILabel: React.ForwardRefExoticComponent<AILabelProps & React.RefAttributes<HTMLDivElement>>;
37
+ export {};
@@ -12,10 +12,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
13
  var cx = require('classnames');
14
14
  var PropTypes = require('prop-types');
15
+ var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
15
16
  var React = require('react');
16
17
  var usePrefix = require('../../internal/usePrefix.js');
17
18
  var index = require('../Toggletip/index.js');
18
19
  var index$1 = require('../IconButton/index.js');
20
+ var createPropAdapter = require('../../tools/createPropAdapter.js');
19
21
  var iconsReact = require('@carbon/icons-react');
20
22
  var useId = require('../../internal/useId.js');
21
23
  var deprecate = require('../../prop-types/deprecate.js');
@@ -29,11 +31,15 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
31
  var _Undo;
30
32
  const AILabelContent = /*#__PURE__*/React__default["default"].forwardRef(function AILabelContent(_ref, ref) {
31
33
  let {
34
+ className,
32
35
  children,
33
- className
36
+ ...rest
34
37
  } = _ref;
35
38
  const prefix = usePrefix.usePrefix();
36
- const hasAILabelActions = React__default["default"].Children.toArray(children).some(child => child.type?.displayName === 'AILabelActions');
39
+ const hasAILabelActions = React__default["default"].Children.toArray(children).some(child => {
40
+ const item = child;
41
+ item.type?.displayName === 'AILabelActions';
42
+ });
37
43
  const aiLabelContentClasses = cx__default["default"](className, {
38
44
  [`${prefix}--slug-content`]: true,
39
45
  [`${prefix}--slug-content--with-actions`]: hasAILabelActions
@@ -55,16 +61,16 @@ AILabelContent.propTypes = {
55
61
  };
56
62
  const AILabelActions = /*#__PURE__*/React__default["default"].forwardRef(function AILabelActions(_ref2, ref) {
57
63
  let {
64
+ className,
58
65
  children,
59
- className
66
+ ...rest
60
67
  } = _ref2;
61
68
  const prefix = usePrefix.usePrefix();
62
69
  const aiLabelActionsClasses = cx__default["default"](className, {
63
70
  [`${prefix}--slug-actions`]: true
64
71
  });
65
72
  return /*#__PURE__*/React__default["default"].createElement(index.ToggletipActions, {
66
- className: aiLabelActionsClasses,
67
- ref: ref
73
+ className: aiLabelActionsClasses
68
74
  }, children);
69
75
  });
70
76
  AILabelActions.displayName = 'AILabelActions';
@@ -78,6 +84,15 @@ AILabelActions.propTypes = {
78
84
  */
79
85
  className: PropTypes__default["default"].string
80
86
  };
87
+
88
+ /**
89
+ * Deprecated popover alignment values.
90
+ * @deprecated Use NewPopoverAlignment instead.
91
+ */
92
+
93
+ const propMappingFunction = deprecatedValue => {
94
+ return createPropAdapter.mapPopoverAlignProp(deprecatedValue);
95
+ };
81
96
  const AILabel = /*#__PURE__*/React__default["default"].forwardRef(function AILabel(_ref3, ref) {
82
97
  let {
83
98
  aiText = 'AI',
@@ -153,23 +168,32 @@ AILabel.propTypes = {
153
168
  /**
154
169
  * Specify how the popover should align with the button
155
170
  */
156
- align: PropTypes__default["default"].oneOf(['top', 'top-left',
171
+ align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
157
172
  // deprecated use top-start instead
158
- 'top-start', 'top-right',
173
+ 'top-right',
159
174
  // deprecated use top-end instead
160
- 'top-end', 'bottom', 'bottom-left',
175
+
176
+ 'bottom', 'bottom-left',
161
177
  // deprecated use bottom-start instead
162
- 'bottom-start', 'bottom-right',
178
+ 'bottom-right',
163
179
  // deprecated use bottom-end instead
164
- 'bottom-end', 'left', 'left-bottom',
180
+
181
+ 'left', 'left-bottom',
165
182
  // deprecated use left-end instead
166
- 'left-end', 'left-top',
183
+ 'left-top',
167
184
  // deprecated use left-start instead
168
- 'left-start', 'right', 'right-bottom',
185
+
186
+ 'right', 'right-bottom',
169
187
  // deprecated use right-end instead
170
- 'right-end', 'right-top',
188
+ 'right-top',
171
189
  // deprecated use right-start instead
172
- 'right-start']),
190
+
191
+ // new values to match floating-ui
192
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
193
+ //allowed prop values
194
+ ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
195
+ //optional mapper function
196
+ propMappingFunction),
173
197
  /**
174
198
  * Specify the text that will be provided to the aria-label of the `AILabel` button
175
199
  */
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
- import { PropsWithChildren } from 'react';
8
+ import { PropsWithChildren, ReactNode } from 'react';
9
9
  export interface AccordionProps {
10
10
  /**
11
11
  * Specify the alignment of the accordion heading
@@ -17,6 +17,10 @@ export interface AccordionProps {
17
17
  * the container node.
18
18
  */
19
19
  className?: string;
20
+ /**
21
+ * Pass in the children that will be rendered within the Accordion
22
+ */
23
+ children?: ReactNode;
20
24
  /**
21
25
  * Specify whether an individual AccordionItem
22
26
  * should be disabled.
@@ -64,7 +64,7 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
64
64
  ref: ref
65
65
  }, rest), href ? /*#__PURE__*/React__default["default"].createElement(Link["default"], {
66
66
  href: href,
67
- "aria-current": ariaCurrent
67
+ "aria-current": ariaCurrent || isCurrentPage
68
68
  }, children) : /*#__PURE__*/React__default["default"].createElement(Text.Text, {
69
69
  className: `${prefix}--link`
70
70
  }, children));
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import { IconButtonKind } from '../IconButton';
8
9
  import { PolymorphicProps } from '../../types/common';
9
10
  export declare const ButtonKinds: readonly ["primary", "secondary", "danger", "ghost", "danger--primary", "danger--ghost", "danger--tertiary", "tertiary"];
10
11
  export type ButtonKind = (typeof ButtonKinds)[number];
@@ -43,7 +44,7 @@ export interface ButtonBaseProps extends React.ButtonHTMLAttributes<HTMLButtonEl
43
44
  /**
44
45
  * Specify the kind of Button you want to create
45
46
  */
46
- kind?: ButtonKind;
47
+ kind?: ButtonBaseProps['hasIconOnly'] extends true ? IconButtonKind : ButtonKind;
47
48
  /**
48
49
  * Optional prop to allow overriding the icon rendering.
49
50
  * Can be a React component class
@@ -150,8 +150,19 @@ Button.propTypes = {
150
150
  /**
151
151
  * Specify the kind of Button you want to create
152
152
  */
153
- // TODO: this should be either ButtonKinds or IconButtonKinds based on the value of "hasIconOnly"
154
- kind: PropTypes__default["default"].oneOf(ButtonKinds),
153
+ kind: (props, propName, componentName) => {
154
+ const {
155
+ hasIconOnly
156
+ } = props;
157
+ const validKinds = hasIconOnly ? index.IconButtonKinds : ButtonKinds;
158
+ if (props[propName] === undefined) {
159
+ return null;
160
+ }
161
+ if (!validKinds.includes(props[propName])) {
162
+ return new Error(`Invalid prop \`${propName}\` supplied to \`${componentName}\`. Expected one of ${validKinds.join(', ')}.`);
163
+ }
164
+ return null;
165
+ },
155
166
  /**
156
167
  * Provide an optional function to be called when the button element
157
168
  * loses focus
@@ -11,6 +11,10 @@ export interface CodeSnippetProps {
11
11
  * Specify how the trigger should align with the tooltip
12
12
  */
13
13
  align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
14
+ /**
15
+ * **Experimental**: Will attempt to automatically align the tooltip
16
+ */
17
+ autoAlign?: boolean;
14
18
  /**
15
19
  * Specify a label to be read by screen readers on the containing textbox
16
20
  * node
@@ -96,7 +100,7 @@ export interface CodeSnippetProps {
96
100
  */
97
101
  wrapText?: boolean;
98
102
  }
99
- declare function CodeSnippet({ align, className, type, children, disabled, feedback, feedbackTimeout, onClick, ['aria-label']: ariaLabel, ariaLabel: deprecatedAriaLabel, copyText, copyButtonDescription, light, showMoreText, showLessText, hideCopyButton, wrapText, maxCollapsedNumberOfRows, maxExpandedNumberOfRows, minCollapsedNumberOfRows, minExpandedNumberOfRows, ...rest }: PropsWithChildren<CodeSnippetProps>): import("react/jsx-runtime").JSX.Element;
103
+ declare function CodeSnippet({ align, autoAlign, className, type, children, disabled, feedback, feedbackTimeout, onClick, ['aria-label']: ariaLabel, ariaLabel: deprecatedAriaLabel, copyText, copyButtonDescription, light, showMoreText, showLessText, hideCopyButton, wrapText, maxCollapsedNumberOfRows, maxExpandedNumberOfRows, minCollapsedNumberOfRows, minExpandedNumberOfRows, ...rest }: PropsWithChildren<CodeSnippetProps>): import("react/jsx-runtime").JSX.Element;
100
104
  declare namespace CodeSnippet {
101
105
  var propTypes: {
102
106
  /**
@@ -114,6 +118,10 @@ declare namespace CodeSnippet {
114
118
  * node
115
119
  */
116
120
  ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
121
+ /**
122
+ * **Experimental**: Will attempt to automatically align the tooltip
123
+ */
124
+ autoAlign: PropTypes.Requireable<boolean>;
117
125
  /**
118
126
  * Provide the content of your CodeSnippet as a node or string
119
127
  */
@@ -40,6 +40,7 @@ const defaultMinExpandedNumberOfRows = 16;
40
40
  function CodeSnippet(_ref) {
41
41
  let {
42
42
  align = 'bottom',
43
+ autoAlign = false,
43
44
  className,
44
45
  type = 'single',
45
46
  children,
@@ -162,6 +163,7 @@ function CodeSnippet(_ref) {
162
163
  }
163
164
  return /*#__PURE__*/React__default["default"].createElement(Copy["default"], _rollupPluginBabelHelpers["extends"]({}, rest, {
164
165
  align: align,
166
+ autoAlign: autoAlign,
165
167
  onClick: handleCopyClick,
166
168
  "aria-label": deprecatedAriaLabel || ariaLabel,
167
169
  "aria-describedby": uid,
@@ -217,6 +219,7 @@ function CodeSnippet(_ref) {
217
219
  className: `${prefix}--snippet__overflow-indicator--right`
218
220
  }), !hideCopyButton && /*#__PURE__*/React__default["default"].createElement(CopyButton["default"], {
219
221
  align: align,
222
+ autoAlign: autoAlign,
220
223
  size: type === 'multi' ? 'sm' : 'md',
221
224
  disabled: disabled,
222
225
  onClick: handleCopyClick,
@@ -253,6 +256,10 @@ CodeSnippet.propTypes = {
253
256
  * node
254
257
  */
255
258
  ariaLabel: deprecate["default"](PropTypes__default["default"].string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
259
+ /**
260
+ * **Experimental**: Will attempt to automatically align the tooltip
261
+ */
262
+ autoAlign: PropTypes__default["default"].bool,
256
263
  /**
257
264
  * Provide the content of your CodeSnippet as a node or string
258
265
  */
@@ -26,7 +26,7 @@ var usePrefix = require('../../internal/usePrefix.js');
26
26
  require('../FluidForm/FluidForm.js');
27
27
  var FormContext = require('../FluidForm/FormContext.js');
28
28
  var react = require('@floating-ui/react');
29
- var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js');
29
+ var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js');
30
30
  var Text = require('../Text/Text.js');
31
31
  var match = require('../../internal/keyboard/match.js');
32
32
  var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
@@ -46,7 +46,8 @@ const {
46
46
  ItemMouseMove,
47
47
  InputKeyDownArrowUp,
48
48
  InputKeyDownArrowDown,
49
- MenuMouseLeave
49
+ MenuMouseLeave,
50
+ FunctionSelectItem
50
51
  } = Downshift.useCombobox.stateChangeTypes;
51
52
  const defaultItemToString = item => {
52
53
  if (typeof item === 'string') {
@@ -144,7 +145,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
144
145
  } = react.useFloating(autoAlign ? {
145
146
  placement: direction,
146
147
  strategy: 'fixed',
147
- middleware: [react.flip(), floatingUi_core.hide()],
148
+ middleware: [react.flip(), floatingUi_dom.hide()],
148
149
  whileElementsMounted: react.autoUpdate
149
150
  } : {});
150
151
  const parentWidth = refs?.reference?.current?.clientWidth;
@@ -223,19 +224,40 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
223
224
  } = changes;
224
225
  switch (type) {
225
226
  case InputBlur:
226
- if (state.inputValue && highlightedIndex == '-1' && changes.selectedItem) {
227
- return {
228
- ...changes,
229
- inputValue: itemToString(changes.selectedItem)
230
- };
231
- } else if (state.inputValue && highlightedIndex == '-1' && !allowCustomValue && !changes.selectedItem) {
232
- return {
233
- ...changes,
234
- inputValue: ''
235
- };
236
- } else {
227
+ {
228
+ if (allowCustomValue && highlightedIndex == '-1') {
229
+ const customValue = inputValue;
230
+ changes.selectedItem = customValue;
231
+ if (onChange) {
232
+ onChange({
233
+ selectedItem: inputValue,
234
+ inputValue
235
+ });
236
+ }
237
+ return changes;
238
+ }
239
+ if (state.inputValue && highlightedIndex == '-1' && changes.selectedItem) {
240
+ return {
241
+ ...changes,
242
+ inputValue: itemToString(changes.selectedItem)
243
+ };
244
+ }
245
+ if (state.inputValue && highlightedIndex == '-1' && !allowCustomValue && !changes.selectedItem) {
246
+ return {
247
+ ...changes,
248
+ inputValue: ''
249
+ };
250
+ }
237
251
  return changes;
238
252
  }
253
+ case FunctionSelectItem:
254
+ if (onChange) {
255
+ onChange({
256
+ selectedItem: changes.selectedItem,
257
+ inputValue: changes.inputValue
258
+ });
259
+ }
260
+ return changes;
239
261
  case InputKeyDownEnter:
240
262
  if (allowCustomValue) {
241
263
  setInputValue(inputValue);
@@ -302,7 +324,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
302
324
  [`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
303
325
  [`${prefix}--list-box--up`]: direction === 'top',
304
326
  [`${prefix}--combo-box--warning`]: showWarning,
305
- [`${prefix}--combo-box--readonly`]: readOnly
327
+ [`${prefix}--combo-box--readonly`]: readOnly,
328
+ [`${prefix}--autoalign`]: autoAlign
306
329
  });
307
330
  const titleClasses = cx__default["default"](`${prefix}--label`, {
308
331
  [`${prefix}--label--disabled`]: disabled
@@ -23,8 +23,8 @@ var useAttachedMenu = require('../../internal/useAttachedMenu.js');
23
23
  var useId = require('../../internal/useId.js');
24
24
  var usePrefix = require('../../internal/usePrefix.js');
25
25
  var react = require('@floating-ui/react');
26
+ var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js');
26
27
  var mergeRefs = require('../../tools/mergeRefs.js');
27
- var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js');
28
28
 
29
29
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
30
30
 
@@ -62,7 +62,7 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
62
62
  const containerRef = React.useRef(null);
63
63
  const middlewares = [react.flip({
64
64
  crossAxis: false
65
- }), floatingUi_core.hide()];
65
+ }), floatingUi_dom.hide()];
66
66
  if (menuAlignment === 'bottom' || menuAlignment === 'top') {
67
67
  middlewares.push(react.size({
68
68
  apply(_ref2) {
@@ -11,6 +11,10 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
11
11
  * Specify how the trigger should align with the tooltip
12
12
  */
13
13
  align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
14
+ /**
15
+ * **Experimental**: Will attempt to automatically align the tooltip
16
+ */
17
+ autoAlign?: boolean;
14
18
  /**
15
19
  * Specify an optional className to be applied to the underlying `<button>`
16
20
  */
@@ -35,13 +39,17 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
35
39
  */
36
40
  onClick?: MouseEventHandler<HTMLButtonElement>;
37
41
  }
38
- declare function Copy({ align, children, className, feedback, feedbackTimeout, onAnimationEnd, onClick, ...other }: PropsWithChildren<CopyProps>): import("react/jsx-runtime").JSX.Element;
42
+ declare function Copy({ align, autoAlign, children, className, feedback, feedbackTimeout, onAnimationEnd, onClick, ...other }: PropsWithChildren<CopyProps>): import("react/jsx-runtime").JSX.Element;
39
43
  declare namespace Copy {
40
44
  var propTypes: {
41
45
  /**
42
46
  * Specify how the trigger should align with the tooltip
43
47
  */
44
48
  align: PropTypes.Requireable<string>;
49
+ /**
50
+ * **Experimental**: Will attempt to automatically align the tooltip
51
+ */
52
+ autoAlign: PropTypes.Requireable<boolean>;
45
53
  /**
46
54
  * Pass in content to be rendered in the underlying `<button>`
47
55
  */
@@ -29,6 +29,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
29
29
  function Copy(_ref) {
30
30
  let {
31
31
  align = 'bottom',
32
+ autoAlign = false,
32
33
  children,
33
34
  className,
34
35
  feedback = 'Copied!',
@@ -63,6 +64,7 @@ function Copy(_ref) {
63
64
  return /*#__PURE__*/React__default["default"].createElement(index.IconButton, _rollupPluginBabelHelpers["extends"]({
64
65
  closeOnActivation: false,
65
66
  align: align,
67
+ autoAlign: autoAlign,
66
68
  className: classNames,
67
69
  label: animation ? feedback : initialLabel,
68
70
  onClick: events.composeEventHandlers([onClick, handleClick]),
@@ -76,6 +78,10 @@ Copy.propTypes = {
76
78
  * Specify how the trigger should align with the tooltip
77
79
  */
78
80
  align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
81
+ /**
82
+ * **Experimental**: Will attempt to automatically align the tooltip
83
+ */
84
+ autoAlign: PropTypes__default["default"].bool,
79
85
  /**
80
86
  * Pass in content to be rendered in the underlying `<button>`
81
87
  */