@carbon/react 1.91.0 → 1.92.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 (163) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +989 -1014
  2. package/es/components/Accordion/AccordionItem.d.ts +12 -1
  3. package/es/components/Accordion/AccordionItem.js +9 -2
  4. package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
  5. package/es/components/Checkbox/Checkbox.js +2 -2
  6. package/es/components/ComboBox/ComboBox.js +39 -23
  7. package/es/components/ComboButton/index.js +1 -1
  8. package/es/components/ComposedModal/ComposedModal.js +66 -17
  9. package/es/components/ComposedModal/ComposedModalPresence.d.ts +34 -0
  10. package/es/components/ComposedModal/ComposedModalPresence.js +42 -0
  11. package/es/components/ComposedModal/index.d.ts +1 -0
  12. package/es/components/ComposedModal/useComposedModalState.d.ts +7 -0
  13. package/es/components/ComposedModal/useComposedModalState.js +24 -0
  14. package/es/components/DataTable/TableBatchActions.js +2 -2
  15. package/es/components/DatePicker/DatePicker.js +14 -6
  16. package/es/components/DatePickerInput/DatePickerInput.js +3 -3
  17. package/es/components/Dialog/Dialog.js +2 -2
  18. package/es/components/Dropdown/Dropdown.js +5 -5
  19. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  20. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
  21. package/es/components/FeatureFlags/index.d.ts +2 -1
  22. package/es/components/FeatureFlags/index.js +3 -1
  23. package/es/components/FileUploader/FileUploader.js +2 -2
  24. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  25. package/es/components/FluidTextInput/FluidPasswordInput.js +24 -5
  26. package/es/components/FluidTextInput/index.js +1 -1
  27. package/es/components/FormLabel/FormLabel.js +1 -1
  28. package/es/components/ListBox/ListBox.d.ts +1 -1
  29. package/es/components/ListBox/ListBox.js +1 -2
  30. package/es/components/ListItem/ListItem.js +1 -1
  31. package/es/components/Menu/MenuItem.js +2 -2
  32. package/es/components/MenuButton/index.d.ts +2 -2
  33. package/es/components/MenuButton/index.js +2 -2
  34. package/es/components/Modal/Modal.js +60 -10
  35. package/es/components/Modal/ModalPresence.d.ts +32 -0
  36. package/es/components/Modal/ModalPresence.js +37 -0
  37. package/es/components/Modal/index.d.ts +2 -1
  38. package/es/components/Modal/index.js +1 -0
  39. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
  40. package/es/components/MultiSelect/MultiSelect.js +6 -5
  41. package/es/components/Notification/Notification.js +2 -2
  42. package/es/components/NumberInput/NumberInput.d.ts +21 -11
  43. package/es/components/NumberInput/NumberInput.js +40 -26
  44. package/es/components/OverflowMenu/OverflowMenu.js +2 -3
  45. package/es/components/OverflowMenu/next/index.js +1 -1
  46. package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
  47. package/es/components/PageHeader/PageHeader.js +2 -2
  48. package/es/components/ProgressIndicator/ProgressIndicator.js +1 -1
  49. package/es/components/RadioButton/RadioButton.js +3 -3
  50. package/es/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  51. package/es/components/RadioTile/RadioTile.js +2 -2
  52. package/es/components/Select/Select.js +2 -2
  53. package/es/components/Slider/Slider.js +2 -2
  54. package/es/components/StructuredList/StructuredList.js +2 -2
  55. package/es/components/Tabs/Tabs.js +2 -2
  56. package/es/components/Tag/DismissibleTag.js +3 -3
  57. package/es/components/Tag/OperationalTag.js +3 -3
  58. package/es/components/Tag/SelectableTag.js +3 -3
  59. package/es/components/Tag/Tag.js +2 -2
  60. package/es/components/Text/Text.d.ts +1 -1
  61. package/es/components/Text/Text.js +0 -1
  62. package/es/components/Text/TextDirection.d.ts +1 -1
  63. package/es/components/Text/TextDirection.js +0 -1
  64. package/es/components/Text/createTextComponent.d.ts +2 -8
  65. package/es/components/Text/createTextComponent.js +2 -2
  66. package/es/components/Text/index.d.ts +0 -8
  67. package/es/components/TextArea/TextArea.js +2 -2
  68. package/es/components/TextInput/TextInput.js +2 -2
  69. package/es/components/Tile/Tile.js +2 -2
  70. package/es/components/Toggle/Toggle.js +2 -2
  71. package/es/components/UIShell/Switcher.js +0 -26
  72. package/es/index.d.ts +1 -1
  73. package/es/index.js +6 -4
  74. package/es/internal/useNormalizedInputProps.js +2 -2
  75. package/es/internal/usePresence.d.ts +17 -0
  76. package/es/internal/usePresence.js +66 -0
  77. package/es/internal/usePresenceContext.d.ts +25 -0
  78. package/es/internal/usePresenceContext.js +46 -0
  79. package/es/tools/mergeRefs.d.ts +5 -5
  80. package/es/tools/mergeRefs.js +16 -12
  81. package/lib/components/Accordion/AccordionItem.d.ts +12 -1
  82. package/lib/components/Accordion/AccordionItem.js +9 -2
  83. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  84. package/lib/components/Checkbox/Checkbox.js +2 -2
  85. package/lib/components/ComboBox/ComboBox.js +39 -23
  86. package/lib/components/ComboButton/index.js +1 -1
  87. package/lib/components/ComposedModal/ComposedModal.js +65 -16
  88. package/lib/components/ComposedModal/ComposedModalPresence.d.ts +34 -0
  89. package/lib/components/ComposedModal/ComposedModalPresence.js +46 -0
  90. package/lib/components/ComposedModal/index.d.ts +1 -0
  91. package/lib/components/ComposedModal/useComposedModalState.d.ts +7 -0
  92. package/lib/components/ComposedModal/useComposedModalState.js +26 -0
  93. package/lib/components/DataTable/TableBatchActions.js +2 -2
  94. package/lib/components/DatePicker/DatePicker.js +14 -6
  95. package/lib/components/DatePickerInput/DatePickerInput.js +3 -3
  96. package/lib/components/Dialog/Dialog.js +2 -2
  97. package/lib/components/Dropdown/Dropdown.js +3 -3
  98. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  99. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -1
  100. package/lib/components/FeatureFlags/index.d.ts +2 -1
  101. package/lib/components/FeatureFlags/index.js +3 -1
  102. package/lib/components/FileUploader/FileUploader.js +2 -2
  103. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  104. package/lib/components/FluidTextInput/FluidPasswordInput.js +26 -5
  105. package/lib/components/FluidTextInput/index.js +2 -1
  106. package/lib/components/FormLabel/FormLabel.js +1 -1
  107. package/lib/components/ListBox/ListBox.d.ts +1 -1
  108. package/lib/components/ListBox/ListBox.js +1 -2
  109. package/lib/components/ListItem/ListItem.js +1 -1
  110. package/lib/components/Menu/MenuItem.js +2 -2
  111. package/lib/components/MenuButton/index.d.ts +2 -2
  112. package/lib/components/MenuButton/index.js +2 -2
  113. package/lib/components/Modal/Modal.js +59 -9
  114. package/lib/components/Modal/ModalPresence.d.ts +32 -0
  115. package/lib/components/Modal/ModalPresence.js +41 -0
  116. package/lib/components/Modal/index.d.ts +2 -1
  117. package/lib/components/Modal/index.js +1 -0
  118. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
  119. package/lib/components/MultiSelect/MultiSelect.js +4 -3
  120. package/lib/components/Notification/Notification.js +2 -2
  121. package/lib/components/NumberInput/NumberInput.d.ts +21 -11
  122. package/lib/components/NumberInput/NumberInput.js +40 -26
  123. package/lib/components/OverflowMenu/OverflowMenu.js +2 -3
  124. package/lib/components/OverflowMenu/next/index.js +1 -1
  125. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
  126. package/lib/components/PageHeader/PageHeader.js +2 -2
  127. package/lib/components/ProgressIndicator/ProgressIndicator.js +1 -1
  128. package/lib/components/RadioButton/RadioButton.js +3 -3
  129. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +3 -3
  130. package/lib/components/RadioTile/RadioTile.js +2 -2
  131. package/lib/components/Select/Select.js +2 -2
  132. package/lib/components/Slider/Slider.js +2 -2
  133. package/lib/components/StructuredList/StructuredList.js +2 -2
  134. package/lib/components/Tabs/Tabs.js +2 -2
  135. package/lib/components/Tag/DismissibleTag.js +3 -3
  136. package/lib/components/Tag/OperationalTag.js +3 -3
  137. package/lib/components/Tag/SelectableTag.js +3 -3
  138. package/lib/components/Tag/Tag.js +2 -2
  139. package/lib/components/Text/Text.d.ts +1 -1
  140. package/lib/components/Text/Text.js +0 -1
  141. package/lib/components/Text/TextDirection.d.ts +1 -1
  142. package/lib/components/Text/TextDirection.js +0 -1
  143. package/lib/components/Text/createTextComponent.d.ts +2 -8
  144. package/lib/components/Text/createTextComponent.js +2 -2
  145. package/lib/components/Text/index.d.ts +0 -8
  146. package/lib/components/TextArea/TextArea.js +2 -2
  147. package/lib/components/TextInput/TextInput.js +2 -2
  148. package/lib/components/Tile/Tile.js +2 -2
  149. package/lib/components/Toggle/Toggle.js +2 -2
  150. package/lib/components/UIShell/Switcher.js +0 -26
  151. package/lib/index.d.ts +1 -1
  152. package/lib/index.js +13 -8
  153. package/lib/internal/useNormalizedInputProps.js +2 -2
  154. package/lib/internal/usePresence.d.ts +17 -0
  155. package/lib/internal/usePresence.js +68 -0
  156. package/lib/internal/usePresenceContext.d.ts +25 -0
  157. package/lib/internal/usePresenceContext.js +48 -0
  158. package/lib/tools/mergeRefs.d.ts +5 -5
  159. package/lib/tools/mergeRefs.js +16 -14
  160. package/package.json +7 -7
  161. package/telemetry.yml +4 -0
  162. package/es/components/Text/index.js +0 -16
  163. package/lib/components/Text/index.js +0 -20
@@ -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
  * ----------
@@ -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
  };
@@ -7,7 +7,6 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React from 'react';
10
- import './index.js';
11
10
  import { Text } from './Text.js';
12
11
 
13
12
  /**
@@ -27,5 +26,6 @@ const createTextComponent = (element, displayName) => {
27
26
  }
28
27
  return TextWrapper;
29
28
  };
29
+ const Legend = createTextComponent('legend', 'Legend');
30
30
 
31
- export { createTextComponent };
31
+ export { Legend };
@@ -7,11 +7,3 @@
7
7
  export * from './Text';
8
8
  export * from './TextDirection';
9
9
  export * from './TextDirectionContext';
10
- export declare const Label: {
11
- (props: import("./Text").TextProps<import("react").ElementType>): import("react/jsx-runtime").JSX.Element;
12
- displayName: string;
13
- };
14
- export declare const Legend: {
15
- (props: import("./Text").TextProps<import("react").ElementType>): import("react/jsx-runtime").JSX.Element;
16
- displayName: string;
17
- };
@@ -19,10 +19,10 @@ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
19
19
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
20
20
  import { useId } from '../../internal/useId.js';
21
21
  import { noopFn } from '../../internal/noopFn.js';
22
- import '../Text/index.js';
22
+ import { Text } from '../Text/Text.js';
23
+ import '../Text/TextDirection.js';
23
24
  import { AILabel } from '../AILabel/index.js';
24
25
  import { isComponentElement } from '../../internal/utils.js';
25
- import { Text } from '../Text/Text.js';
26
26
 
27
27
  const frFn = forwardRef;
28
28
  const TextArea = frFn((props, forwardRef) => {
@@ -16,10 +16,10 @@ import { FormContext } from '../FluidForm/FormContext.js';
16
16
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
17
17
  import { usePrefix } from '../../internal/usePrefix.js';
18
18
  import { getAnnouncement } from '../../internal/getAnnouncement.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 TextInput = /*#__PURE__*/React.forwardRef(({
25
25
  className,
@@ -21,10 +21,10 @@ import { getInteractiveContent, getRoleContent } from '../../internal/useNoInter
21
21
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
22
22
  import { useFeatureFlag } from '../FeatureFlags/index.js';
23
23
  import { useId } from '../../internal/useId.js';
24
- import '../Text/index.js';
24
+ import { Text } from '../Text/Text.js';
25
+ import '../Text/TextDirection.js';
25
26
  import { AILabel } from '../AILabel/index.js';
26
27
  import { isComponentElement } from '../../internal/utils.js';
27
- import { Text } from '../Text/Text.js';
28
28
 
29
29
  var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
30
30
  const Tile = /*#__PURE__*/React.forwardRef(({
@@ -11,8 +11,8 @@ import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import { useControllableState } from '../../internal/useControllableState.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
- import '../Text/index.js';
15
14
  import { Text } from '../Text/Text.js';
15
+ import '../Text/TextDirection.js';
16
16
 
17
17
  var _path;
18
18
  function Toggle({
@@ -101,7 +101,7 @@ function Toggle({
101
101
  className: appearanceClasses
102
102
  }, /*#__PURE__*/React.createElement("div", {
103
103
  className: switchClasses
104
- }, isSm && /*#__PURE__*/React.createElement("svg", {
104
+ }, isSm && !readOnly && /*#__PURE__*/React.createElement("svg", {
105
105
  "aria-hidden": "true",
106
106
  focusable: "false",
107
107
  className: `${prefix}--toggle__check`,
@@ -12,34 +12,8 @@ import { usePrefix } from '../../internal/usePrefix.js';
12
12
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
13
13
  import PropTypes from 'prop-types';
14
14
  import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
15
- import './Content.js';
16
- import './Header.js';
17
- import './HeaderContainer.js';
18
- import './HeaderGlobalAction.js';
19
- import './HeaderGlobalBar.js';
20
- import './HeaderMenu.js';
21
- import './HeaderMenuButton.js';
22
- import './HeaderMenuItem.js';
23
- import './HeaderName.js';
24
- import './HeaderNavigation.js';
25
- import './HeaderPanel.js';
26
- import './HeaderSideNavItems.js';
27
15
  import SwitcherItem from './SwitcherItem.js';
28
16
  import SwitcherDivider from './SwitcherDivider.js';
29
- import './SkipToContent.js';
30
- import './SideNav.js';
31
- import './SideNavDetails.js';
32
- import './SideNavDivider.js';
33
- import './SideNavFooter.js';
34
- import './SideNavHeader.js';
35
- import './SideNavIcon.js';
36
- import './SideNavItem.js';
37
- import './SideNavItems.js';
38
- import './SideNavLink.js';
39
- import './SideNavLinkText.js';
40
- import './SideNavMenu.js';
41
- import './SideNavMenuItem.js';
42
- import './SideNavSwitcher.js';
43
17
 
44
18
  const Switcher = /*#__PURE__*/forwardRef((props, forwardRef) => {
45
19
  const switcherRef = useRef(null);
package/es/index.d.ts CHANGED
@@ -111,7 +111,7 @@ export { FluidMultiSelect, FluidMultiSelectSkeleton, FluidMultiSelect as unstabl
111
111
  export { FluidSelect, FluidSelectSkeleton, FluidSelect as unstable__FluidSelect, FluidSelectSkeleton as unstable__FluidSelectSkeleton, FluidSelect as preview__FluidSelect, FluidSelectSkeleton as preview__FluidSelectSkeleton, } from './components/FluidSelect';
112
112
  export { FluidSearch, FluidSearchSkeleton, FluidSearch as unstable__FluidSearch, FluidSearchSkeleton as unstable__FluidSearchSkeleton, FluidSearch as preview__FluidSearch, FluidSearchSkeleton as preview__FluidSearchSkeleton, } from './components/FluidSearch';
113
113
  export { FluidTextArea, FluidTextAreaSkeleton, FluidTextArea as unstable__FluidTextArea, FluidTextAreaSkeleton as unstable__FluidTextAreaSkeleton, FluidTextArea as preview__FluidTextArea, FluidTextAreaSkeleton as preview__FluidTextAreaSkeleton, } from './components/FluidTextArea';
114
- export { FluidTextInput, FluidTextInputSkeleton, FluidTextInput as unstable__FluidTextInput, FluidTextInputSkeleton as unstable__FluidTextInputSkeleton, FluidTextInput as preview__FluidTextInput, FluidTextInputSkeleton as preview__FluidTextInputSkeleton, } from './components/FluidTextInput';
114
+ export { FluidPasswordInput, FluidTextInput, FluidTextInputSkeleton, FluidTextInput as unstable__FluidTextInput, FluidTextInputSkeleton as unstable__FluidTextInputSkeleton, FluidTextInput as preview__FluidTextInput, FluidTextInputSkeleton as preview__FluidTextInputSkeleton, } from './components/FluidTextInput';
115
115
  export { FluidNumberInput, FluidNumberInputSkeleton, FluidNumberInput as unstable__FluidNumberInput, FluidNumberInputSkeleton as unstable__FluidNumberInputSkeleton, FluidNumberInput as preview__FluidNumberInput, FluidNumberInputSkeleton as preview__FluidNumberInputSkeleton, } from './components/FluidNumberInput';
116
116
  export { FluidTimePicker, FluidTimePickerSkeleton, FluidTimePicker as unstable__FluidTimePicker, FluidTimePickerSkeleton as unstable__FluidTimePickerSkeleton, FluidTimePicker as preview__FluidTimePicker, FluidTimePickerSkeleton as preview__FluidTimePickerSkeleton, } from './components/FluidTimePicker';
117
117
  export { FluidTimePickerSelect, FluidTimePickerSelect as unstable__FluidTimePickerSelect, FluidTimePickerSelect as preview__FluidTimePickerSelect, } from './components/FluidTimePickerSelect';