@carbon/react 1.91.0-rc.0 → 1.92.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 (173) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +969 -934
  2. package/es/components/Accordion/AccordionItem.d.ts +12 -1
  3. package/es/components/Accordion/AccordionItem.js +9 -2
  4. package/es/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +27 -2
  5. package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +27 -4
  6. package/es/components/Breadcrumb/Breadcrumb.js +2 -1
  7. package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
  8. package/es/components/Checkbox/Checkbox.js +2 -2
  9. package/es/components/ComboBox/ComboBox.js +39 -23
  10. package/es/components/ComboButton/index.js +1 -1
  11. package/es/components/ComposedModal/ComposedModal.js +66 -17
  12. package/es/components/ComposedModal/ComposedModalPresence.d.ts +34 -0
  13. package/es/components/ComposedModal/ComposedModalPresence.js +42 -0
  14. package/es/components/ComposedModal/index.d.ts +1 -0
  15. package/es/components/ComposedModal/useComposedModalState.d.ts +7 -0
  16. package/es/components/ComposedModal/useComposedModalState.js +24 -0
  17. package/es/components/ContentSwitcher/ContentSwitcher.js +2 -2
  18. package/es/components/DataTable/TableBatchActions.js +2 -2
  19. package/es/components/DatePickerInput/DatePickerInput.js +2 -2
  20. package/es/components/Dialog/Dialog.js +2 -2
  21. package/es/components/Dropdown/Dropdown.js +5 -5
  22. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  23. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
  24. package/es/components/FeatureFlags/index.d.ts +2 -1
  25. package/es/components/FeatureFlags/index.js +3 -1
  26. package/es/components/FileUploader/FileUploader.js +2 -2
  27. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  28. package/es/components/FluidTextInput/FluidPasswordInput.js +24 -5
  29. package/es/components/FluidTextInput/index.js +1 -1
  30. package/es/components/FormLabel/FormLabel.js +1 -1
  31. package/es/components/ListBox/ListBox.d.ts +1 -1
  32. package/es/components/ListBox/ListBox.js +1 -2
  33. package/es/components/ListItem/ListItem.js +1 -1
  34. package/es/components/Menu/MenuItem.js +2 -2
  35. package/es/components/MenuButton/index.d.ts +1 -1
  36. package/es/components/MenuButton/index.js +1 -1
  37. package/es/components/Modal/Modal.js +60 -10
  38. package/es/components/Modal/ModalPresence.d.ts +32 -0
  39. package/es/components/Modal/ModalPresence.js +37 -0
  40. package/es/components/Modal/index.d.ts +2 -1
  41. package/es/components/Modal/index.js +1 -0
  42. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
  43. package/es/components/MultiSelect/MultiSelect.js +6 -5
  44. package/es/components/Notification/Notification.js +2 -2
  45. package/es/components/NumberInput/NumberInput.d.ts +21 -11
  46. package/es/components/NumberInput/NumberInput.js +40 -26
  47. package/es/components/OverflowMenu/OverflowMenu.js +2 -3
  48. package/es/components/OverflowMenu/next/index.js +1 -1
  49. package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
  50. package/es/components/PageHeader/PageHeader.js +2 -2
  51. package/es/components/PaginationNav/PaginationNav.d.ts +20 -0
  52. package/es/components/PaginationNav/PaginationNav.js +34 -5
  53. package/es/components/ProgressIndicator/ProgressIndicator.js +1 -1
  54. package/es/components/RadioButton/RadioButton.js +3 -3
  55. package/es/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  56. package/es/components/RadioTile/RadioTile.js +2 -2
  57. package/es/components/Select/Select.js +2 -2
  58. package/es/components/Slider/Slider.js +2 -2
  59. package/es/components/StructuredList/StructuredList.js +2 -2
  60. package/es/components/Tabs/Tabs.js +2 -2
  61. package/es/components/Tag/DismissibleTag.js +3 -3
  62. package/es/components/Tag/OperationalTag.js +3 -3
  63. package/es/components/Tag/SelectableTag.js +3 -3
  64. package/es/components/Tag/Tag.js +2 -2
  65. package/es/components/Text/Text.d.ts +1 -1
  66. package/es/components/Text/Text.js +0 -1
  67. package/es/components/Text/TextDirection.d.ts +1 -1
  68. package/es/components/Text/TextDirection.js +0 -1
  69. package/es/components/Text/createTextComponent.d.ts +2 -8
  70. package/es/components/Text/createTextComponent.js +2 -2
  71. package/es/components/Text/index.d.ts +0 -8
  72. package/es/components/TextArea/TextArea.js +2 -2
  73. package/es/components/TextInput/TextInput.js +2 -2
  74. package/es/components/Tile/Tile.js +2 -2
  75. package/es/components/Toggle/Toggle.js +2 -2
  76. package/es/components/UIShell/Switcher.js +0 -26
  77. package/es/index.d.ts +27 -23
  78. package/es/index.js +44 -41
  79. package/es/internal/useNormalizedInputProps.js +2 -2
  80. package/es/internal/usePresence.d.ts +17 -0
  81. package/es/internal/usePresence.js +66 -0
  82. package/es/internal/usePresenceContext.d.ts +25 -0
  83. package/es/internal/usePresenceContext.js +46 -0
  84. package/es/tools/mergeRefs.d.ts +5 -5
  85. package/es/tools/mergeRefs.js +16 -12
  86. package/lib/components/Accordion/AccordionItem.d.ts +12 -1
  87. package/lib/components/Accordion/AccordionItem.js +9 -2
  88. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +27 -2
  89. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +27 -4
  90. package/lib/components/Breadcrumb/Breadcrumb.js +2 -1
  91. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  92. package/lib/components/Checkbox/Checkbox.js +2 -2
  93. package/lib/components/ComboBox/ComboBox.js +39 -23
  94. package/lib/components/ComboButton/index.js +1 -1
  95. package/lib/components/ComposedModal/ComposedModal.js +65 -16
  96. package/lib/components/ComposedModal/ComposedModalPresence.d.ts +34 -0
  97. package/lib/components/ComposedModal/ComposedModalPresence.js +46 -0
  98. package/lib/components/ComposedModal/index.d.ts +1 -0
  99. package/lib/components/ComposedModal/useComposedModalState.d.ts +7 -0
  100. package/lib/components/ComposedModal/useComposedModalState.js +26 -0
  101. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  102. package/lib/components/DataTable/TableBatchActions.js +2 -2
  103. package/lib/components/DatePickerInput/DatePickerInput.js +2 -2
  104. package/lib/components/Dialog/Dialog.js +2 -2
  105. package/lib/components/Dropdown/Dropdown.js +3 -3
  106. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  107. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -1
  108. package/lib/components/FeatureFlags/index.d.ts +2 -1
  109. package/lib/components/FeatureFlags/index.js +3 -1
  110. package/lib/components/FileUploader/FileUploader.js +2 -2
  111. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  112. package/lib/components/FluidTextInput/FluidPasswordInput.js +26 -5
  113. package/lib/components/FluidTextInput/index.js +2 -1
  114. package/lib/components/FormLabel/FormLabel.js +1 -1
  115. package/lib/components/ListBox/ListBox.d.ts +1 -1
  116. package/lib/components/ListBox/ListBox.js +1 -2
  117. package/lib/components/ListItem/ListItem.js +1 -1
  118. package/lib/components/Menu/MenuItem.js +2 -2
  119. package/lib/components/MenuButton/index.d.ts +1 -1
  120. package/lib/components/MenuButton/index.js +1 -1
  121. package/lib/components/Modal/Modal.js +59 -9
  122. package/lib/components/Modal/ModalPresence.d.ts +32 -0
  123. package/lib/components/Modal/ModalPresence.js +41 -0
  124. package/lib/components/Modal/index.d.ts +2 -1
  125. package/lib/components/Modal/index.js +1 -0
  126. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
  127. package/lib/components/MultiSelect/MultiSelect.js +4 -3
  128. package/lib/components/Notification/Notification.js +2 -2
  129. package/lib/components/NumberInput/NumberInput.d.ts +21 -11
  130. package/lib/components/NumberInput/NumberInput.js +40 -26
  131. package/lib/components/OverflowMenu/OverflowMenu.js +2 -3
  132. package/lib/components/OverflowMenu/next/index.js +1 -1
  133. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
  134. package/lib/components/PageHeader/PageHeader.js +2 -2
  135. package/lib/components/PaginationNav/PaginationNav.d.ts +20 -0
  136. package/lib/components/PaginationNav/PaginationNav.js +34 -5
  137. package/lib/components/ProgressIndicator/ProgressIndicator.js +1 -1
  138. package/lib/components/RadioButton/RadioButton.js +3 -3
  139. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +3 -3
  140. package/lib/components/RadioTile/RadioTile.js +2 -2
  141. package/lib/components/Select/Select.js +2 -2
  142. package/lib/components/Slider/Slider.js +2 -2
  143. package/lib/components/StructuredList/StructuredList.js +2 -2
  144. package/lib/components/Tabs/Tabs.js +2 -2
  145. package/lib/components/Tag/DismissibleTag.js +3 -3
  146. package/lib/components/Tag/OperationalTag.js +3 -3
  147. package/lib/components/Tag/SelectableTag.js +3 -3
  148. package/lib/components/Tag/Tag.js +2 -2
  149. package/lib/components/Text/Text.d.ts +1 -1
  150. package/lib/components/Text/Text.js +0 -1
  151. package/lib/components/Text/TextDirection.d.ts +1 -1
  152. package/lib/components/Text/TextDirection.js +0 -1
  153. package/lib/components/Text/createTextComponent.d.ts +2 -8
  154. package/lib/components/Text/createTextComponent.js +2 -2
  155. package/lib/components/Text/index.d.ts +0 -8
  156. package/lib/components/TextArea/TextArea.js +2 -2
  157. package/lib/components/TextInput/TextInput.js +2 -2
  158. package/lib/components/Tile/Tile.js +2 -2
  159. package/lib/components/Toggle/Toggle.js +2 -2
  160. package/lib/components/UIShell/Switcher.js +0 -26
  161. package/lib/index.d.ts +27 -23
  162. package/lib/index.js +55 -6
  163. package/lib/internal/useNormalizedInputProps.js +2 -2
  164. package/lib/internal/usePresence.d.ts +17 -0
  165. package/lib/internal/usePresence.js +68 -0
  166. package/lib/internal/usePresenceContext.d.ts +25 -0
  167. package/lib/internal/usePresenceContext.js +48 -0
  168. package/lib/tools/mergeRefs.d.ts +5 -5
  169. package/lib/tools/mergeRefs.js +16 -14
  170. package/package.json +8 -8
  171. package/telemetry.yml +5 -2
  172. package/es/components/Text/index.js +0 -16
  173. package/lib/components/Text/index.js +0 -20
@@ -17,6 +17,26 @@ export declare const translationIds: {
17
17
  type TranslationKey = keyof typeof translationIds;
18
18
  type ExcludedAttributes = 'defaultValue' | 'id' | 'min' | 'max' | 'onChange' | 'onClick' | 'size' | 'step' | 'value';
19
19
  export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<TranslationKey> {
20
+ /**
21
+ * Optional validation function that is called with the input value and locale.
22
+ * This is called before other validations, giving consumers the ability
23
+ * to short-circuit or extend validation without replacing built-in rules
24
+ * @example
25
+ * // Using the built-in separator validation
26
+ * <NumberInput validate={validateNumberSeparators} />
27
+ *
28
+ * // Combining with custom validation
29
+ * <NumberInput
30
+ * validate={(value, locale) => {
31
+ * return validateNumberSeparators(value, locale) && customValidation(value)
32
+ * }}
33
+ * />
34
+ * - Return `false` to immediately fail validation.
35
+ * - Return `true` to pass this validation, but still run other checks (min, max, required, etc.).
36
+ * - Return `undefined` to defer entirely to built-in validation logic.
37
+ *
38
+ */
39
+ validate?: (value: string, locale: string) => boolean | undefined;
20
40
  /**
21
41
  * `true` to allow empty string.
22
42
  */
@@ -186,16 +206,6 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
186
206
  */
187
207
  warnText?: ReactNode;
188
208
  }
209
+ export declare const validateNumberSeparators: (input: string, locale: string) => boolean;
189
210
  declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
190
- export interface Label {
191
- disabled?: boolean;
192
- hideLabel?: boolean;
193
- id?: string;
194
- label?: ReactNode;
195
- }
196
- export interface HelperTextProps {
197
- id?: string;
198
- description?: ReactNode;
199
- disabled?: boolean;
200
- }
201
211
  export { NumberInput };
@@ -16,7 +16,8 @@ import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import { deprecate } from '../../prop-types/deprecate.js';
17
17
  import '../FluidForm/FluidForm.js';
18
18
  import { FormContext } from '../FluidForm/FormContext.js';
19
- import '../Text/index.js';
19
+ import { Text } from '../Text/Text.js';
20
+ import '../Text/TextDirection.js';
20
21
  import { clamp } from '../../internal/clamp.js';
21
22
  import { useControllableState } from '../../internal/useControllableState.js';
22
23
  import { NumberParser, NumberFormatter } from '@carbon/utilities';
@@ -25,7 +26,6 @@ import { match } from '../../internal/keyboard/match.js';
25
26
  import { NumberFormatOptionsPropType } from './NumberFormatPropTypes.js';
26
27
  import { AILabel } from '../AILabel/index.js';
27
28
  import { isComponentElement } from '../../internal/utils.js';
28
- import { Text } from '../Text/Text.js';
29
29
 
30
30
  var _Subtract, _Add;
31
31
  const translationIds = {
@@ -41,6 +41,7 @@ const defaultTranslations = {
41
41
  [translationIds['increment.number']]: 'Increment number',
42
42
  [translationIds['decrement.number']]: 'Decrement number'
43
43
  };
44
+
44
45
  // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
45
46
  const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
46
47
  const {
@@ -75,6 +76,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
75
76
  translateWithId: t = id => defaultTranslations[id],
76
77
  type = 'number',
77
78
  defaultValue = type === 'number' ? 0 : NaN,
79
+ validate,
78
80
  warn = false,
79
81
  warnText = '',
80
82
  stepStartValue = 0,
@@ -121,7 +123,6 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
121
123
  * Only used when type="text"
122
124
  */
123
125
  const [previousNumberValue, setPreviousNumberValue] = useState(numberValue);
124
-
125
126
  /**
126
127
  * The current text value of the input.
127
128
  * Only used when type=text
@@ -152,9 +153,11 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
152
153
  const isInputValid = getInputValidity({
153
154
  allowEmpty,
154
155
  invalid,
155
- value: type === 'number' ? value : numberValue,
156
+ value: validate ? inputValue : type === 'number' ? value : numberValue,
156
157
  max,
157
- min
158
+ min,
159
+ validate,
160
+ locale
158
161
  });
159
162
  const normalizedProps = useNormalizedInputProps({
160
163
  id,
@@ -212,8 +215,6 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
212
215
  }
213
216
  if (type === 'text') {
214
217
  const _value = allowEmpty && event.target.value === '' ? '' : event.target.value;
215
-
216
- // When isControlled, setNumberValue will not update numberValue in useControllableState.
217
218
  setNumberValue(numberParser.parse(_value));
218
219
  setInputValue(_value);
219
220
  // The onChange prop isn't called here because it will be called on blur
@@ -263,7 +264,7 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
263
264
  rawValue = currentValue - step;
264
265
  }
265
266
  const precision = Math.max(getDecimalPlaces(currentValue), getDecimalPlaces(step));
266
- const floatValue = parseFloat(rawValue.toFixed(precision));
267
+ const floatValue = parseFloat(Number(rawValue).toFixed(precision));
267
268
  const newValue = clamp(floatValue, min ?? -Infinity, max ?? Infinity);
268
269
  const state = {
269
270
  value: newValue,
@@ -374,13 +375,15 @@ const NumberInput = /*#__PURE__*/React.forwardRef((props, forwardRef) => {
374
375
  // they've passed in.
375
376
  const _numberValue = isControlled ? numberParser.parse(inputValue) : numberValue;
376
377
  const formattedValue = isNaN(_numberValue) ? '' : format(_numberValue);
377
- setInputValue(formattedValue);
378
-
378
+ const rawValue = e.target.value;
379
+ // Validate raw input
380
+ const isValid = validate ? validate(rawValue, locale) : true;
381
+ setInputValue(isValid ? formattedValue : rawValue);
379
382
  // Calling format() can alter the number (such as rounding it)
380
383
  // causing the _numberValue to mismatch the formatted value in
381
384
  // the input. To avoid this, formattedValue is re-parsed.
382
385
  const parsedFormattedNewValue = numberParser.parse(formattedValue);
383
- if (onChange) {
386
+ if (onChange && isValid) {
384
387
  const state = {
385
388
  value: parsedFormattedNewValue,
386
389
  direction: previousNumberValue < parsedFormattedNewValue ? 'up' : 'down'
@@ -614,7 +617,18 @@ NumberInput.propTypes = {
614
617
  /**
615
618
  * Provide the text that is displayed when the control is in warning state
616
619
  */
617
- warnText: PropTypes.node
620
+ warnText: PropTypes.node,
621
+ /**
622
+ * Optional validation function that is called with the input value and locale.
623
+ *
624
+ * - Return `false` to immediately fail validation.
625
+ * - Return `true` to pass this validation, but still run other checks (min, max, required, etc.).
626
+ * - Return `undefined` to defer entirely to built-in validation logic.
627
+ *
628
+ * This is called before other validations, giving consumers the ability
629
+ * to short-circuit or extend validation without replacing built-in rules.
630
+ */
631
+ validate: PropTypes.func
618
632
  };
619
633
  const Label = ({
620
634
  disabled,
@@ -637,17 +651,11 @@ const Label = ({
637
651
  }
638
652
  return null;
639
653
  };
640
- Label.propTypes = {
641
- disabled: PropTypes.bool,
642
- hideLabel: PropTypes.bool,
643
- id: PropTypes.string,
644
- label: PropTypes.node
645
- };
646
- function HelperText({
654
+ const HelperText = ({
647
655
  disabled,
648
656
  description,
649
657
  id
650
- }) {
658
+ }) => {
651
659
  const prefix = usePrefix();
652
660
  const className = cx(`${prefix}--form__helper-text`, {
653
661
  [`${prefix}--form__helper-text--disabled`]: disabled
@@ -660,11 +668,6 @@ function HelperText({
660
668
  }, description);
661
669
  }
662
670
  return null;
663
- }
664
- HelperText.propTypes = {
665
- description: PropTypes.node,
666
- disabled: PropTypes.bool,
667
- id: PropTypes.string
668
671
  };
669
672
 
670
673
  /**
@@ -678,6 +681,8 @@ HelperText.propTypes = {
678
681
  * @param {number} config.value
679
682
  * @param {number} config.max
680
683
  * @param {number} config.min
684
+ * @param {Function} config.validate
685
+ * @param {string} config.locale
681
686
  * @returns {boolean}
682
687
  */
683
688
  function getInputValidity({
@@ -685,8 +690,17 @@ function getInputValidity({
685
690
  invalid,
686
691
  value,
687
692
  max,
688
- min
693
+ min,
694
+ validate,
695
+ locale
689
696
  }) {
697
+ if (typeof validate === 'function') {
698
+ const result = validate(value, locale);
699
+ if (result === false) {
700
+ return false; // immediate invalid
701
+ }
702
+ // If true or undefined, continue to further validations
703
+ }
690
704
  if (invalid) {
691
705
  return false;
692
706
  }
@@ -17,7 +17,7 @@ import { matches } from '../../internal/keyboard/match.js';
17
17
  import { noopFn } from '../../internal/noopFn.js';
18
18
  import { PrefixContext } from '../../internal/usePrefix.js';
19
19
  import { deprecate } from '../../prop-types/deprecate.js';
20
- import mergeRefs from '../../tools/mergeRefs.js';
20
+ import { mergeRefs } from '../../tools/mergeRefs.js';
21
21
  import { setupGetInstanceId } from '../../tools/setupGetInstanceId.js';
22
22
  import { IconButton } from '../IconButton/index.js';
23
23
  import { useOutsideClick } from '../../internal/useOutsideClick.js';
@@ -171,8 +171,7 @@ const OverflowMenu = /*#__PURE__*/forwardRef(({
171
171
  if (onCloseMenu) {
172
172
  onCloseMenu();
173
173
  }
174
- onClose();
175
- }, [onClose]);
174
+ }, []);
176
175
  const closeMenuAndFocus = useCallback(() => {
177
176
  const wasClicked = click;
178
177
  const wasOpen = open;
@@ -15,7 +15,7 @@ import { useFeatureFlag } from '../../FeatureFlags/index.js';
15
15
  import { IconButton } from '../../IconButton/index.js';
16
16
  import { Menu } from '../../Menu/Menu.js';
17
17
  import '../../Menu/MenuItem.js';
18
- import mergeRefs from '../../../tools/mergeRefs.js';
18
+ import { mergeRefs } from '../../../tools/mergeRefs.js';
19
19
  import { useId } from '../../../internal/useId.js';
20
20
  import { usePrefix } from '../../../internal/usePrefix.js';
21
21
  import { useAttachedMenu } from '../../../internal/useAttachedMenu.js';
@@ -13,8 +13,8 @@ import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
13
13
  import { match } from '../../internal/keyboard/match.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
15
  import { warning } from '../../internal/warning.js';
16
- import '../Text/index.js';
17
16
  import { Text } from '../Text/Text.js';
17
+ import '../Text/TextDirection.js';
18
18
 
19
19
  const frFn = forwardRef;
20
20
  const OverflowMenuItem = frFn((props, ref) => {
@@ -12,7 +12,8 @@ import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
  import { breakpoints } from '@carbon/layout';
14
14
  import { useMatchMedia } from '../../internal/useMatchMedia.js';
15
- import '../Text/index.js';
15
+ import { Text } from '../Text/Text.js';
16
+ import '../Text/TextDirection.js';
16
17
  import { MenuButton } from '../MenuButton/index.js';
17
18
  import '../Menu/Menu.js';
18
19
  import { MenuItem } from '../Menu/MenuItem.js';
@@ -34,7 +35,6 @@ import '../Grid/Row.js';
34
35
  import Column from '../Grid/Column.js';
35
36
  import '../Grid/ColumnHang.js';
36
37
  import '../Grid/GridContext.js';
37
- import { Text } from '../Text/Text.js';
38
38
 
39
39
  /**
40
40
  * ----------
@@ -6,6 +6,8 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import { TranslateWithId } from '../../types/common';
9
+ type TooltipAlignment = 'start' | 'center' | 'end';
10
+ type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
9
11
  declare const translationIds: {
10
12
  readonly 'carbon.pagination-nav.next': "Next";
11
13
  readonly 'carbon.pagination-nav.previous': "Previous";
@@ -34,6 +36,14 @@ export interface DirectionButtonProps {
34
36
  * The callback function called when the button is clicked.
35
37
  */
36
38
  onClick?: React.MouseEventHandler;
39
+ /**
40
+ * Specify the alignment of the tooltip for the icon-only next/prev buttons.
41
+ */
42
+ tooltipAlignment?: TooltipAlignment;
43
+ /**
44
+ * Specify the position of the tooltip for the icon-only next/prev buttons.
45
+ */
46
+ tooltipPosition?: TooltipPosition;
37
47
  }
38
48
  export interface PaginationItemProps extends TranslateWithId<'carbon.pagination-nav.item' | 'carbon.pagination-nav.active'> {
39
49
  /**
@@ -98,6 +108,16 @@ export interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElemen
98
108
  * Specify the size of the PaginationNav.
99
109
  */
100
110
  size?: 'sm' | 'md' | 'lg';
111
+ /**
112
+ * Specify the alignment of the tooltip for the icon-only next/prev buttons.
113
+ * Can be one of: start, center, or end.
114
+ */
115
+ tooltipAlignment?: TooltipAlignment;
116
+ /**
117
+ * Specify the position of the tooltip for the icon-only next/prev buttons.
118
+ * Can be one of: top, right, bottom, or left.
119
+ */
120
+ tooltipPosition?: TooltipPosition;
101
121
  /**
102
122
  * The total number of items.
103
123
  */
@@ -68,13 +68,16 @@ function DirectionButton({
68
68
  direction,
69
69
  label,
70
70
  disabled,
71
- onClick
71
+ onClick,
72
+ tooltipAlignment = 'center',
73
+ tooltipPosition = 'bottom'
72
74
  }) {
73
75
  const prefix = usePrefix();
76
+ const align = tooltipAlignment === 'center' ? tooltipPosition : `${tooltipPosition}-${tooltipAlignment}`;
74
77
  return /*#__PURE__*/React.createElement("li", {
75
78
  className: `${prefix}--pagination-nav__list-item`
76
79
  }, /*#__PURE__*/React.createElement(IconButton, {
77
- align: "bottom",
80
+ align: align,
78
81
  disabled: disabled,
79
82
  kind: "ghost",
80
83
  label: label,
@@ -173,6 +176,8 @@ const PaginationNav = /*#__PURE__*/React.forwardRef(({
173
176
  page = 0,
174
177
  loop = false,
175
178
  size = 'lg',
179
+ tooltipAlignment,
180
+ tooltipPosition,
176
181
  translateWithId: t = translateWithId,
177
182
  ...rest
178
183
  }, ref) => {
@@ -276,7 +281,9 @@ const PaginationNav = /*#__PURE__*/React.forwardRef(({
276
281
  "aria-label": t('carbon.pagination-nav.previous'),
277
282
  label: t('carbon.pagination-nav.previous'),
278
283
  disabled: backwardButtonDisabled,
279
- onClick: jumpToPrevious
284
+ onClick: jumpToPrevious,
285
+ tooltipAlignment: tooltipAlignment,
286
+ tooltipPosition: tooltipPosition
280
287
  }),
281
288
  // render first item if at least 5 items can be displayed or
282
289
  // 4 items can be displayed and the current page is either 0 or 1
@@ -321,7 +328,9 @@ const PaginationNav = /*#__PURE__*/React.forwardRef(({
321
328
  "aria-label": t('carbon.pagination-nav.next'),
322
329
  label: t('carbon.pagination-nav.next'),
323
330
  disabled: forwardButtonDisabled,
324
- onClick: jumpToNext
331
+ onClick: jumpToNext,
332
+ tooltipAlignment: tooltipAlignment,
333
+ tooltipPosition: tooltipPosition
325
334
  })), /*#__PURE__*/React.createElement("div", {
326
335
  "aria-live": "polite",
327
336
  "aria-atomic": "true",
@@ -344,7 +353,17 @@ DirectionButton.propTypes = {
344
353
  /**
345
354
  * The callback function called when the button is clicked.
346
355
  */
347
- onClick: PropTypes.func
356
+ onClick: PropTypes.func,
357
+ /**
358
+ * Specify how the tooltip should align with the navigation button.
359
+ * Can be one of: start, center, or end.
360
+ */
361
+ tooltipAlignment: PropTypes.oneOf(['start', 'center', 'end']),
362
+ /**
363
+ * Specify the position of the tooltip relative to the navigation button.
364
+ * Can be one of: top, right, bottom, or left.
365
+ */
366
+ tooltipPosition: PropTypes.oneOf(['top', 'right', 'bottom', 'left'])
348
367
  };
349
368
  PaginationItem.propTypes = {
350
369
  /**
@@ -415,6 +434,16 @@ PaginationNav.propTypes = {
415
434
  * Specify the size of the PaginationNav.
416
435
  */
417
436
  size: PropTypes.oneOf(['sm', 'md', 'lg']),
437
+ /**
438
+ * Specify the alignment of the tooltip for the icon-only prev/next buttons.
439
+ * Can be one of: start, center, or end.
440
+ */
441
+ tooltipAlignment: PropTypes.oneOf(['start', 'center', 'end']),
442
+ /**
443
+ * Specify the position of the tooltip for the icon-only prev/next buttons.
444
+ * Can be one of: top, right, bottom, or left.
445
+ */
446
+ tooltipPosition: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
418
447
  /**
419
448
  * The total number of items.
420
449
  */
@@ -13,8 +13,8 @@ import { Enter, Space } from '../../internal/keyboard/keys.js';
13
13
  import { matches } from '../../internal/keyboard/match.js';
14
14
  import { Warning, Incomplete, CheckmarkOutline, CircleDash } from '@carbon/icons-react';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
- import '../Text/index.js';
17
16
  import { Text } from '../Text/Text.js';
17
+ import '../Text/TextDirection.js';
18
18
 
19
19
  const defaultTranslations = {
20
20
  'carbon.progress-step.complete': 'Complete',
@@ -9,14 +9,14 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import PropTypes from 'prop-types';
10
10
  import React, { useRef, cloneElement } from 'react';
11
11
  import cx from 'classnames';
12
- import '../Text/index.js';
12
+ import { Text } from '../Text/Text.js';
13
+ import '../Text/TextDirection.js';
13
14
  import { deprecate } from '../../prop-types/deprecate.js';
14
15
  import { usePrefix } from '../../internal/usePrefix.js';
15
16
  import { useId } from '../../internal/useId.js';
16
- import mergeRefs from '../../tools/mergeRefs.js';
17
+ import { mergeRefs } from '../../tools/mergeRefs.js';
17
18
  import { AILabel } from '../AILabel/index.js';
18
19
  import { isComponentElement } from '../../internal/utils.js';
19
- import { Text } from '../Text/Text.js';
20
20
 
21
21
  const RadioButton = /*#__PURE__*/React.forwardRef((props, ref) => {
22
22
  const {
@@ -9,11 +9,11 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import PropTypes from 'prop-types';
10
10
  import React, { useState, useRef, cloneElement } from 'react';
11
11
  import cx from 'classnames';
12
- import { Legend } from '../Text/index.js';
12
+ import { Legend } from '../Text/createTextComponent.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
15
15
  import { deprecate } from '../../prop-types/deprecate.js';
16
- import mergeRefs from '../../tools/mergeRefs.js';
16
+ import { mergeRefs } from '../../tools/mergeRefs.js';
17
17
  import { useId } from '../../internal/useId.js';
18
18
  import { AILabel } from '../AILabel/index.js';
19
19
  import { isComponentElement } from '../../internal/utils.js';
@@ -16,11 +16,11 @@ import { useFallbackId } from '../../internal/useId.js';
16
16
  import { usePrefix } from '../../internal/usePrefix.js';
17
17
  import { deprecate } from '../../prop-types/deprecate.js';
18
18
  import { noopFn } from '../../internal/noopFn.js';
19
- import '../Text/index.js';
19
+ import { Text } from '../Text/Text.js';
20
+ import '../Text/TextDirection.js';
20
21
  import { useFeatureFlag } from '../FeatureFlags/index.js';
21
22
  import { AILabel } from '../AILabel/index.js';
22
23
  import { isComponentElement } from '../../internal/utils.js';
23
- import { Text } from '../Text/Text.js';
24
24
 
25
25
  var _RadioButtonChecked, _RadioButton, _CheckmarkFilled;
26
26
  const RadioTile = /*#__PURE__*/React.forwardRef(({
@@ -16,10 +16,10 @@ import '../FluidForm/FluidForm.js';
16
16
  import { FormContext } from '../FluidForm/FormContext.js';
17
17
  import { useId } from '../../internal/useId.js';
18
18
  import { composeEventHandlers } from '../../tools/events.js';
19
- import '../Text/index.js';
19
+ import { Text } from '../Text/Text.js';
20
+ import '../Text/TextDirection.js';
20
21
  import { AILabel } from '../AILabel/index.js';
21
22
  import { isComponentElement } from '../../internal/utils.js';
22
- import { Text } from '../Text/Text.js';
23
23
 
24
24
  const Select = /*#__PURE__*/React.forwardRef(({
25
25
  className,
@@ -14,13 +14,13 @@ import { matches } from '../../internal/keyboard/match.js';
14
14
  import { PrefixContext } from '../../internal/usePrefix.js';
15
15
  import { deprecate } from '../../prop-types/deprecate.js';
16
16
  import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
17
- import '../Text/index.js';
17
+ import { Text } from '../Text/Text.js';
18
+ import '../Text/TextDirection.js';
18
19
  import '../Tooltip/DefinitionTooltip.js';
19
20
  import { Tooltip } from '../Tooltip/Tooltip.js';
20
21
  import { LowerHandle, LowerHandleFocus, UpperHandle, UpperHandleFocus } from './SliderHandles.js';
21
22
  import { clamp } from '../../internal/clamp.js';
22
23
  import { throttle } from '../../node_modules/es-toolkit/dist/compat/function/throttle.js';
23
- import { Text } from '../Text/Text.js';
24
24
 
25
25
  const ThumbWrapper = ({
26
26
  hasTooltip,
@@ -12,10 +12,10 @@ import cx from 'classnames';
12
12
  import { useId } from '../../internal/useId.js';
13
13
  import { deprecate } from '../../prop-types/deprecate.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
- import '../Text/index.js';
15
+ import { Text } from '../Text/Text.js';
16
+ import '../Text/TextDirection.js';
16
17
  import { RadioButtonChecked, RadioButton } from '@carbon/icons-react';
17
18
  import { useOutsideClick } from '../../internal/useOutsideClick.js';
18
- import { Text } from '../Text/Text.js';
19
19
 
20
20
  var _StructuredListCell;
21
21
  const GridSelectedRowStateContext = /*#__PURE__*/React.createContext(null);
@@ -32,10 +32,10 @@ import { usePressable } from './usePressable.js';
32
32
  import { deprecate } from '../../prop-types/deprecate.js';
33
33
  import { useEvent } from '../../internal/useEvent.js';
34
34
  import { useMatchMedia } from '../../internal/useMatchMedia.js';
35
- import '../Text/index.js';
35
+ import { Text } from '../Text/Text.js';
36
+ import '../Text/TextDirection.js';
36
37
  import { BadgeIndicator } from '../BadgeIndicator/index.js';
37
38
  import { debounce } from '../../node_modules/es-toolkit/dist/compat/function/debounce.js';
38
- import { Text } from '../Text/Text.js';
39
39
 
40
40
  var _ChevronLeft, _ChevronRight, _BadgeIndicator;
41
41
  const verticalTabHeight = 64;
@@ -16,12 +16,12 @@ import Tag, { TYPES, SIZES } from './Tag.js';
16
16
  import { Close } from '@carbon/icons-react';
17
17
  import '../Tooltip/DefinitionTooltip.js';
18
18
  import { Tooltip } from '../Tooltip/Tooltip.js';
19
- import '../Text/index.js';
19
+ import { Text } from '../Text/Text.js';
20
+ import '../Text/TextDirection.js';
20
21
  import { isEllipsisActive } from './isEllipsisActive.js';
21
- import mergeRefs from '../../tools/mergeRefs.js';
22
+ import { mergeRefs } from '../../tools/mergeRefs.js';
22
23
  import { AILabel } from '../AILabel/index.js';
23
24
  import { isComponentElement } from '../../internal/utils.js';
24
- import { Text } from '../Text/Text.js';
25
25
 
26
26
  var _Close;
27
27
  // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
@@ -14,10 +14,10 @@ import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import Tag, { SIZES } from './Tag.js';
15
15
  import '../Tooltip/DefinitionTooltip.js';
16
16
  import { Tooltip } from '../Tooltip/Tooltip.js';
17
- import '../Text/index.js';
18
- import { isEllipsisActive } from './isEllipsisActive.js';
19
- import mergeRefs from '../../tools/mergeRefs.js';
20
17
  import { Text } from '../Text/Text.js';
18
+ import '../Text/TextDirection.js';
19
+ import { isEllipsisActive } from './isEllipsisActive.js';
20
+ import { mergeRefs } from '../../tools/mergeRefs.js';
21
21
 
22
22
  const TYPES = {
23
23
  red: 'Red',
@@ -14,11 +14,11 @@ import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import Tag, { SIZES } from './Tag.js';
15
15
  import '../Tooltip/DefinitionTooltip.js';
16
16
  import { Tooltip } from '../Tooltip/Tooltip.js';
17
- import '../Text/index.js';
17
+ import { Text } from '../Text/Text.js';
18
+ import '../Text/TextDirection.js';
18
19
  import { isEllipsisActive } from './isEllipsisActive.js';
19
- import mergeRefs from '../../tools/mergeRefs.js';
20
+ import { mergeRefs } from '../../tools/mergeRefs.js';
20
21
  import { useControllableState } from '../../internal/useControllableState.js';
21
- import { Text } from '../Text/Text.js';
22
22
 
23
23
  // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
24
24
  const SelectableTag = /*#__PURE__*/forwardRef(({
@@ -12,7 +12,8 @@ import cx from 'classnames';
12
12
  import { Close } from '@carbon/icons-react';
13
13
  import { useId } from '../../internal/useId.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
- import '../Text/index.js';
15
+ import { Text } from '../Text/Text.js';
16
+ import '../Text/TextDirection.js';
16
17
  import { deprecate } from '../../prop-types/deprecate.js';
17
18
  import { DefinitionTooltip } from '../Tooltip/DefinitionTooltip.js';
18
19
  import '../Tooltip/Tooltip.js';
@@ -20,7 +21,6 @@ import { isEllipsisActive } from './isEllipsisActive.js';
20
21
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
21
22
  import { AILabel } from '../AILabel/index.js';
22
23
  import { isComponentElement } from '../../internal/utils.js';
23
- import { Text } from '../Text/Text.js';
24
24
 
25
25
  var _Close;
26
26
  const TYPES = {
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { type ElementType, type ReactElement, type ReactNode } from 'react';
8
8
  import { PolymorphicComponentPropWithRef, PolymorphicRef } from '../../internal/PolymorphicProps';
9
- import { type TextDir } from '.';
9
+ import { type TextDir } from './TextDirectionContext';
10
10
  export interface TextBaseProps {
11
11
  dir?: TextDir;
12
12
  children?: ReactNode;
@@ -8,7 +8,6 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
10
  import React, { useContext, Children } from 'react';
11
- import './index.js';
12
11
  import { TextDirectionContext } from './TextDirectionContext.js';
13
12
 
14
13
  // eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20071
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import { ReactNode } from 'react';
9
- import { type GetTextDirection, type TextDir } from '.';
9
+ import { type GetTextDirection, type TextDir } from './TextDirectionContext';
10
10
  export interface TextDirectionProps {
11
11
  children: ReactNode;
12
12
  dir?: TextDir;
@@ -7,7 +7,6 @@
7
7
 
8
8
  import PropTypes from 'prop-types';
9
9
  import React, { useRef, useMemo, useEffect } from 'react';
10
- import './index.js';
11
10
  import { TextDirectionContext } from './TextDirectionContext.js';
12
11
 
13
12
  const TextDirection = ({
@@ -5,14 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { type ElementType } from 'react';
8
- import { TextProps } from '.';
9
- /**
10
- * Create a text component wrapper for a given text node type. Useful for
11
- * returning a `Text` component for a text node like a `<label>`.
12
- * @param {string} element
13
- * @param {string} displayName
14
- */
15
- export declare const createTextComponent: (element: ElementType, displayName: string) => {
8
+ import { TextProps } from './Text';
9
+ export declare const Legend: {
16
10
  (props: TextProps<ElementType>): import("react/jsx-runtime").JSX.Element;
17
11
  displayName: string;
18
12
  };