@carbon/react 1.66.0-rc.0 → 1.66.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 (64) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +822 -898
  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 +26 -12
  11. package/es/components/Copy/Copy.d.ts +9 -1
  12. package/es/components/Copy/Copy.js +6 -0
  13. package/es/components/CopyButton/CopyButton.d.ts +9 -1
  14. package/es/components/CopyButton/CopyButton.js +6 -0
  15. package/es/components/Dropdown/Dropdown.js +1 -1
  16. package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
  17. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -20
  18. package/es/components/FluidTextArea/FluidTextArea.d.ts +96 -0
  19. package/es/components/FluidTextArea/FluidTextArea.js +2 -2
  20. package/es/components/FluidTextArea/index.d.ts +12 -0
  21. package/es/components/IconButton/index.d.ts +4 -0
  22. package/es/components/IconButton/index.js +6 -0
  23. package/es/components/Menu/Menu.js +2 -1
  24. package/es/components/MultiSelect/FilterableMultiSelect.js +2 -1
  25. package/es/components/MultiSelect/MultiSelect.js +1 -0
  26. package/es/components/OverflowMenu/next/index.js +3 -1
  27. package/es/components/Popover/index.js +1 -1
  28. package/es/components/Tag/DismissibleTag.d.ts +9 -1
  29. package/es/components/Tag/DismissibleTag.js +7 -3
  30. package/es/components/Tag/Tag.js +2 -2
  31. package/es/components/Toggletip/index.js +2 -1
  32. package/es/index.js +2 -2
  33. package/lib/components/AILabel/index.d.ts +37 -0
  34. package/lib/components/AILabel/index.js +38 -14
  35. package/lib/components/Accordion/Accordion.d.ts +5 -1
  36. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  37. package/lib/components/Button/Button.d.ts +2 -1
  38. package/lib/components/Button/Button.js +13 -2
  39. package/lib/components/CodeSnippet/CodeSnippet.d.ts +9 -1
  40. package/lib/components/CodeSnippet/CodeSnippet.js +7 -0
  41. package/lib/components/ComboBox/ComboBox.js +26 -12
  42. package/lib/components/Copy/Copy.d.ts +9 -1
  43. package/lib/components/Copy/Copy.js +6 -0
  44. package/lib/components/CopyButton/CopyButton.d.ts +9 -1
  45. package/lib/components/CopyButton/CopyButton.js +6 -0
  46. package/lib/components/Dropdown/Dropdown.js +1 -1
  47. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +20 -0
  48. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +3 -22
  49. package/lib/components/FluidTextArea/FluidTextArea.d.ts +96 -0
  50. package/lib/components/FluidTextArea/FluidTextArea.js +2 -2
  51. package/lib/components/FluidTextArea/index.d.ts +12 -0
  52. package/lib/components/IconButton/index.d.ts +4 -0
  53. package/lib/components/IconButton/index.js +6 -0
  54. package/lib/components/Menu/Menu.js +2 -1
  55. package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -1
  56. package/lib/components/MultiSelect/MultiSelect.js +1 -0
  57. package/lib/components/OverflowMenu/next/index.js +3 -1
  58. package/lib/components/Popover/index.js +1 -1
  59. package/lib/components/Tag/DismissibleTag.d.ts +9 -1
  60. package/lib/components/Tag/DismissibleTag.js +7 -3
  61. package/lib/components/Tag/Tag.js +2 -2
  62. package/lib/components/Toggletip/index.js +2 -1
  63. package/lib/index.js +4 -4
  64. package/package.json +9 -9
@@ -18,6 +18,7 @@ const IconButtonKinds = ['primary', 'secondary', 'ghost', 'tertiary'];
18
18
  const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(_ref, ref) {
19
19
  let {
20
20
  align,
21
+ autoAlign = false,
21
22
  children,
22
23
  className,
23
24
  closeOnActivation = true,
@@ -38,6 +39,7 @@ const IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(_r
38
39
  });
39
40
  return /*#__PURE__*/React__default.createElement(Tooltip, {
40
41
  align: align,
42
+ autoAlign: autoAlign,
41
43
  closeOnActivation: closeOnActivation,
42
44
  className: tooltipClasses,
43
45
  defaultOpen: defaultOpen,
@@ -59,6 +61,10 @@ IconButton.propTypes = {
59
61
  * Specify how the trigger should align with the tooltip
60
62
  */
61
63
  align: PropTypes.oneOf(['top', 'top-left', 'top-start', 'top-right', 'top-end', 'bottom', 'bottom-left', 'bottom-start', 'bottom-right', 'bottom-end', 'left', 'right']),
64
+ /**
65
+ * **Experimental**: Will attempt to automatically align the tooltip
66
+ */
67
+ autoAlign: PropTypes.bool,
62
68
  /**
63
69
  * Provide an icon or asset to be rendered inside of the IconButton
64
70
  */
@@ -282,7 +282,8 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(_ref, forwardRef) {
282
282
  [`${prefix}--menu--box-shadow-top`]: menuAlignment && menuAlignment.slice(0, 3) === 'top',
283
283
  [`${prefix}--menu--open`]: open,
284
284
  [`${prefix}--menu--shown`]: open && !legacyAutoalign || position[0] >= 0 && position[1] >= 0,
285
- [`${prefix}--menu--with-icons`]: childContext.state.hasIcons
285
+ [`${prefix}--menu--with-icons`]: childContext.state.hasIcons,
286
+ [`${prefix}--autoalign`]: !legacyAutoalign
286
287
  });
287
288
  const rendered = /*#__PURE__*/React__default.createElement(MenuContext.Provider, {
288
289
  value: childContext
@@ -196,7 +196,8 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
196
196
  [`${prefix}--list-box--up`]: direction === 'top',
197
197
  [`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
198
198
  [`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused,
199
- [`${prefix}--list-box__wrapper--slug`]: slug
199
+ [`${prefix}--list-box__wrapper--slug`]: slug,
200
+ [`${prefix}--autoalign`]: autoAlign
200
201
  });
201
202
  const helperId = !helperText ? undefined : `filterablemultiselect-helper-text-${filterableMultiSelectInstanceId}`;
202
203
  const labelId = `${id}-label`;
@@ -279,6 +279,7 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
279
279
  [`${prefix}--multi-select--selected`]: selectedItems && selectedItems.length > 0,
280
280
  [`${prefix}--list-box--up`]: direction === 'top',
281
281
  [`${prefix}--multi-select--readonly`]: readOnly,
282
+ [`${prefix}--autoalign`]: autoAlign,
282
283
  [`${prefix}--multi-select--selectall`]: selectAll
283
284
  });
284
285
 
@@ -83,7 +83,9 @@ const OverflowMenu = /*#__PURE__*/React__default.forwardRef(function OverflowMen
83
83
  hookOnClick();
84
84
  }
85
85
  }
86
- const containerClasses = cx(className, `${prefix}--overflow-menu__container`);
86
+ const containerClasses = cx(className, `${prefix}--overflow-menu__container`, {
87
+ [`${prefix}--autoalign`]: autoAlign
88
+ });
87
89
  const menuClasses = cx(`${prefix}--overflow-menu__${menuAlignment}`);
88
90
  const triggerClasses = cx(`${prefix}--overflow-menu`, {
89
91
  [`${prefix}--overflow-menu--open`]: open
@@ -189,7 +189,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
189
189
  [`${prefix}--popover--drop-shadow`]: dropShadow,
190
190
  [`${prefix}--popover--high-contrast`]: highContrast,
191
191
  [`${prefix}--popover--open`]: open,
192
- [`${prefix}--popover--auto-align`]: autoAlign,
192
+ [`${prefix}--popover--auto-align ${prefix}--autoalign`]: autoAlign,
193
193
  [`${prefix}--popover--${currentAlignment}`]: true,
194
194
  [`${prefix}--popover--tab-tip`]: isTabTip
195
195
  }, customClassName);
@@ -43,6 +43,10 @@ export interface DismissibleTagBaseProps {
43
43
  * Provide text to be rendered inside of a the tag.
44
44
  */
45
45
  text?: string;
46
+ /**
47
+ * Provide a custom `title` to be inserted in the tag.
48
+ */
49
+ tagTitle?: string;
46
50
  /**
47
51
  * Text to show on clear filters
48
52
  */
@@ -54,7 +58,7 @@ export interface DismissibleTagBaseProps {
54
58
  }
55
59
  export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
56
60
  declare const DismissibleTag: {
57
- <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
61
+ <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, tagTitle, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
58
62
  propTypes: {
59
63
  /**
60
64
  * Provide a custom className that is applied to the containing <span>
@@ -90,6 +94,10 @@ declare const DismissibleTag: {
90
94
  * Provide text to be rendered inside of a the tag.
91
95
  */
92
96
  text: PropTypes.Requireable<string>;
97
+ /**
98
+ * Provide a custom `title` to be inserted in the tag.
99
+ */
100
+ tagTitle: PropTypes.Requireable<string>;
93
101
  /**
94
102
  * Text to show on clear filters
95
103
  */
@@ -31,6 +31,7 @@ const DismissibleTag = _ref => {
31
31
  slug,
32
32
  size,
33
33
  text,
34
+ tagTitle,
34
35
  type,
35
36
  ...other
36
37
  } = _ref;
@@ -76,7 +77,7 @@ const DismissibleTag = _ref => {
76
77
  }, otherProps), /*#__PURE__*/React__default.createElement("div", {
77
78
  className: `${prefix}--interactive--tag-children`
78
79
  }, /*#__PURE__*/React__default.createElement(Text, {
79
- title: text,
80
+ title: tagTitle ? tagTitle : text,
80
81
  className: `${prefix}--tag__label`
81
82
  }, text), /*#__PURE__*/React__default.createElement(Tooltip, {
82
83
  label: isEllipsisApplied ? dismissLabel : title,
@@ -89,8 +90,7 @@ const DismissibleTag = _ref => {
89
90
  className: `${prefix}--tag__close-icon`,
90
91
  onClick: handleClose,
91
92
  disabled: disabled,
92
- "aria-label": title,
93
- title: title
93
+ "aria-label": title
94
94
  }, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null)))), normalizedSlug));
95
95
  };
96
96
  DismissibleTag.propTypes = {
@@ -128,6 +128,10 @@ DismissibleTag.propTypes = {
128
128
  * Provide text to be rendered inside of a the tag.
129
129
  */
130
130
  text: PropTypes.string,
131
+ /**
132
+ * Provide a custom `title` to be inserted in the tag.
133
+ */
134
+ tagTitle: PropTypes.string,
131
135
  /**
132
136
  * Text to show on clear filters
133
137
  */
@@ -131,10 +131,10 @@ const Tag = /*#__PURE__*/React__default.forwardRef(function Tag(_ref, forwardRef
131
131
  definition: children !== null && children !== undefined ? children : typeText,
132
132
  className: `${prefix}--definition--tooltip--tag`
133
133
  }, /*#__PURE__*/React__default.createElement(Text, {
134
- title: children !== null && children !== undefined ? children : typeText,
134
+ title: children !== null && children !== undefined && typeof children === 'string' ? children : typeText,
135
135
  className: labelClasses
136
136
  }, children !== null && children !== undefined ? children : typeText)) : /*#__PURE__*/React__default.createElement(Text, {
137
- title: children !== null && children !== undefined ? children : typeText,
137
+ title: children !== null && children !== undefined && typeof children === 'string' ? children : typeText,
138
138
  className: labelClasses
139
139
  }, children !== null && children !== undefined ? children : typeText), normalizedSlug);
140
140
  });
@@ -74,7 +74,8 @@ function Toggletip(_ref2) {
74
74
  const prefix = usePrefix();
75
75
  const id = useId();
76
76
  const className = cx(`${prefix}--toggletip`, customClassName, {
77
- [`${prefix}--toggletip--open`]: open
77
+ [`${prefix}--toggletip--open`]: open,
78
+ [`${prefix}--autoalign`]: autoAlign
78
79
  });
79
80
  const actions = {
80
81
  toggle: () => {
package/es/index.js CHANGED
@@ -159,6 +159,8 @@ export { default as SideNavMenuItem } from './components/UIShell/SideNavMenuItem
159
159
  export { default as SideNavSwitcher } from './components/UIShell/SideNavSwitcher.js';
160
160
  export { default as UnorderedList } from './components/UnorderedList/UnorderedList.js';
161
161
  export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from './components/FeatureFlags/index.js';
162
+ export { default as unstable__FluidTextArea } from './components/FluidTextArea/FluidTextArea.js';
163
+ export { default as unstable__FluidTextAreaSkeleton } from './components/FluidTextArea/FluidTextArea.Skeleton.js';
162
164
  export { Heading, Section } from './components/Heading/index.js';
163
165
  export { IconButton, IconButtonKinds } from './components/IconButton/index.js';
164
166
  export { Layer, useLayer } from './components/Layer/index.js';
@@ -180,8 +182,6 @@ export { PrefixContext, usePrefix } from './internal/usePrefix.js';
180
182
  export { useIdPrefix } from './internal/useIdPrefix.js';
181
183
  export { default as unstable__FluidDatePickerSkeleton } from './components/FluidDatePicker/FluidDatePicker.Skeleton.js';
182
184
  export { default as unstable__FluidSearchSkeleton } from './components/FluidSearch/FluidSearch.Skeleton.js';
183
- export { default as unstable__FluidTextArea } from './components/FluidTextArea/FluidTextArea.js';
184
- export { default as unstable__FluidTextAreaSkeleton } from './components/FluidTextArea/FluidTextArea.Skeleton.js';
185
185
  export { default as unstable__FluidTextInput } from './components/FluidTextInput/FluidTextInput.js';
186
186
  export { default as unstable__FluidTextInputSkeleton } from './components/FluidTextInput/FluidTextInput.Skeleton.js';
187
187
  export { default as unstable_PageSelector } from './components/Pagination/experimental/PageSelector.js';
@@ -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
  */
@@ -223,17 +223,30 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
223
223
  } = changes;
224
224
  switch (type) {
225
225
  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 {
226
+ {
227
+ if (allowCustomValue && highlightedIndex == '-1') {
228
+ const customValue = inputValue;
229
+ changes.selectedItem = customValue;
230
+ if (onChange) {
231
+ onChange({
232
+ selectedItem: inputValue,
233
+ inputValue
234
+ });
235
+ }
236
+ return changes;
237
+ }
238
+ if (state.inputValue && highlightedIndex == '-1' && changes.selectedItem) {
239
+ return {
240
+ ...changes,
241
+ inputValue: itemToString(changes.selectedItem)
242
+ };
243
+ }
244
+ if (state.inputValue && highlightedIndex == '-1' && !allowCustomValue && !changes.selectedItem) {
245
+ return {
246
+ ...changes,
247
+ inputValue: ''
248
+ };
249
+ }
237
250
  return changes;
238
251
  }
239
252
  case InputKeyDownEnter:
@@ -302,7 +315,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
302
315
  [`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
303
316
  [`${prefix}--list-box--up`]: direction === 'top',
304
317
  [`${prefix}--combo-box--warning`]: showWarning,
305
- [`${prefix}--combo-box--readonly`]: readOnly
318
+ [`${prefix}--combo-box--readonly`]: readOnly,
319
+ [`${prefix}--autoalign`]: autoAlign
306
320
  });
307
321
  const titleClasses = cx__default["default"](`${prefix}--label`, {
308
322
  [`${prefix}--label--disabled`]: disabled
@@ -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
  */
@@ -12,6 +12,10 @@ export interface CopyButtonProps extends ButtonProps<'button'> {
12
12
  * Specify how the trigger should align with the tooltip
13
13
  */
14
14
  align?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'right';
15
+ /**
16
+ * **Experimental**: Will attempt to automatically align the tooltip
17
+ */
18
+ autoAlign?: boolean;
15
19
  /**
16
20
  * Specify an optional className to be applied to the underlying `<button>`
17
21
  */
@@ -36,13 +40,17 @@ export interface CopyButtonProps extends ButtonProps<'button'> {
36
40
  */
37
41
  onClick?: MouseEventHandler<HTMLButtonElement>;
38
42
  }
39
- declare function CopyButton({ align, feedback, feedbackTimeout, iconDescription, className, onClick, ...other }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
43
+ declare function CopyButton({ align, autoAlign, feedback, feedbackTimeout, iconDescription, className, onClick, ...other }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
40
44
  declare namespace CopyButton {
41
45
  var propTypes: {
42
46
  /**
43
47
  * Specify how the trigger should align with the tooltip
44
48
  */
45
49
  align: PropTypes.Requireable<string>;
50
+ /**
51
+ * **Experimental**: Will attempt to automatically align the tooltip
52
+ */
53
+ autoAlign: PropTypes.Requireable<boolean>;
46
54
  /**
47
55
  * Specify an optional className to be applied to the underlying `<button>`
48
56
  */
@@ -28,6 +28,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
28
28
  function CopyButton(_ref) {
29
29
  let {
30
30
  align = 'bottom',
31
+ autoAlign = false,
31
32
  feedback = 'Copied!',
32
33
  feedbackTimeout = 2000,
33
34
  iconDescription = 'Copy to clipboard',
@@ -46,6 +47,7 @@ function CopyButton(_ref) {
46
47
  feedbackTimeout: feedbackTimeout,
47
48
  onClick: onClick,
48
49
  align: align,
50
+ autoAlign: autoAlign,
49
51
  className: cx__default["default"](className, `${prefix}--copy-btn`),
50
52
  "aria-label": iconDescription
51
53
  }, other), /*#__PURE__*/React__default["default"].createElement(iconsReact.Copy, {
@@ -57,6 +59,10 @@ CopyButton.propTypes = {
57
59
  * Specify how the trigger should align with the tooltip
58
60
  */
59
61
  align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
62
+ /**
63
+ * **Experimental**: Will attempt to automatically align the tooltip
64
+ */
65
+ autoAlign: PropTypes__default["default"].bool,
60
66
  /**
61
67
  * Specify an optional className to be applied to the underlying `<button>`
62
68
  */