@carbon/react 1.44.0 → 1.45.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 (134) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +820 -902
  2. package/es/components/Checkbox/Checkbox.d.ts +1 -1
  3. package/es/components/Checkbox/Checkbox.js +1 -1
  4. package/es/components/CheckboxGroup/CheckboxGroup.js +2 -2
  5. package/es/components/ComboBox/ComboBox.d.ts +1 -1
  6. package/es/components/ComboBox/ComboBox.js +2 -2
  7. package/es/components/ComboButton/index.js +1 -1
  8. package/es/components/ComposedModal/ModalFooter.d.ts +2 -1
  9. package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
  10. package/es/components/DataTable/DataTable.d.ts +2 -0
  11. package/es/components/DataTable/DataTable.js +3 -0
  12. package/es/components/DataTable/TableExpandRow.js +20 -3
  13. package/es/components/DataTable/TableHeader.d.ts +5 -0
  14. package/es/components/DataTable/TableHeader.js +30 -6
  15. package/es/components/DataTable/TableSlugRow.d.ts +31 -0
  16. package/es/components/DataTable/TableSlugRow.js +49 -0
  17. package/es/components/DataTable/index.d.ts +2 -1
  18. package/es/components/DataTable/index.js +3 -0
  19. package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  20. package/es/components/DatePickerInput/DatePickerInput.js +2 -2
  21. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  22. package/es/components/Dropdown/Dropdown.js +2 -2
  23. package/es/components/InlineLoading/InlineLoading.d.ts +68 -0
  24. package/es/components/InlineLoading/InlineLoading.js +4 -4
  25. package/es/components/InlineLoading/index.d.ts +9 -0
  26. package/es/components/Layer/LayerContext.d.ts +8 -0
  27. package/es/components/Layer/LayerLevel.d.ts +5 -0
  28. package/es/components/Layer/LayerLevel.js +12 -0
  29. package/es/components/Layer/index.d.ts +38 -0
  30. package/es/components/Layer/index.js +9 -8
  31. package/es/components/Menu/MenuItem.js +2 -1
  32. package/es/components/MenuButton/index.js +1 -1
  33. package/es/components/Modal/Modal.d.ts +3 -2
  34. package/es/components/MultiSelect/FilterableMultiSelect.js +2 -2
  35. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  36. package/es/components/MultiSelect/MultiSelect.js +5 -2
  37. package/es/components/Notification/Notification.js +1 -0
  38. package/es/components/NumberInput/NumberInput.d.ts +1 -1
  39. package/es/components/NumberInput/NumberInput.js +3 -3
  40. package/es/components/ProgressIndicator/ProgressIndicator.js +4 -0
  41. package/es/components/RadioButton/RadioButton.d.ts +1 -1
  42. package/es/components/RadioButton/RadioButton.js +1 -1
  43. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  44. package/es/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  45. package/es/components/Select/Select.d.ts +1 -1
  46. package/es/components/Select/Select.js +2 -2
  47. package/es/components/Slider/Slider.Skeleton.js +17 -3
  48. package/es/components/Slider/Slider.js +132 -93
  49. package/es/components/Slider/SliderHandles.d.ts +4 -0
  50. package/es/components/Slider/SliderHandles.js +65 -0
  51. package/es/components/Slug/index.js +1 -0
  52. package/es/components/Tabs/Tabs.js +1 -1
  53. package/es/components/Tag/Tag.d.ts +18 -10
  54. package/es/components/Tag/Tag.js +23 -7
  55. package/es/components/TextArea/TextArea.d.ts +7 -3
  56. package/es/components/TextArea/TextArea.js +85 -18
  57. package/es/components/TextInput/TextInput.d.ts +1 -1
  58. package/es/components/TextInput/TextInput.js +2 -2
  59. package/es/components/Tile/Tile.d.ts +8 -8
  60. package/es/components/Tile/Tile.js +11 -7
  61. package/es/components/Tooltip/Tooltip.js +48 -2
  62. package/es/components/UIShell/HeaderPanel.d.ts +36 -0
  63. package/es/components/UIShell/HeaderPanel.js +6 -6
  64. package/es/components/UIShell/Switcher.js +1 -1
  65. package/es/index.js +2 -1
  66. package/es/internal/useAnnouncer.js +2 -1
  67. package/es/internal/useNoInteractiveChildren.js +2 -6
  68. package/lib/components/Checkbox/Checkbox.d.ts +1 -1
  69. package/lib/components/Checkbox/Checkbox.js +1 -1
  70. package/lib/components/CheckboxGroup/CheckboxGroup.js +2 -2
  71. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  72. package/lib/components/ComboBox/ComboBox.js +2 -2
  73. package/lib/components/ComboButton/index.js +1 -1
  74. package/lib/components/ComposedModal/ModalFooter.d.ts +2 -1
  75. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  76. package/lib/components/DataTable/DataTable.d.ts +2 -0
  77. package/lib/components/DataTable/DataTable.js +3 -0
  78. package/lib/components/DataTable/TableExpandRow.js +20 -3
  79. package/lib/components/DataTable/TableHeader.d.ts +5 -0
  80. package/lib/components/DataTable/TableHeader.js +29 -5
  81. package/lib/components/DataTable/TableSlugRow.d.ts +31 -0
  82. package/lib/components/DataTable/TableSlugRow.js +59 -0
  83. package/lib/components/DataTable/index.d.ts +2 -1
  84. package/lib/components/DataTable/index.js +3 -0
  85. package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  86. package/lib/components/DatePickerInput/DatePickerInput.js +2 -2
  87. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  88. package/lib/components/Dropdown/Dropdown.js +2 -2
  89. package/lib/components/InlineLoading/InlineLoading.d.ts +68 -0
  90. package/lib/components/InlineLoading/InlineLoading.js +4 -4
  91. package/lib/components/InlineLoading/index.d.ts +9 -0
  92. package/lib/components/Layer/LayerContext.d.ts +8 -0
  93. package/lib/components/Layer/LayerLevel.d.ts +5 -0
  94. package/lib/components/Layer/LayerLevel.js +18 -0
  95. package/lib/components/Layer/index.d.ts +38 -0
  96. package/lib/components/Layer/index.js +10 -9
  97. package/lib/components/Menu/MenuItem.js +2 -1
  98. package/lib/components/MenuButton/index.js +1 -1
  99. package/lib/components/Modal/Modal.d.ts +3 -2
  100. package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -2
  101. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  102. package/lib/components/MultiSelect/MultiSelect.js +5 -2
  103. package/lib/components/Notification/Notification.js +1 -0
  104. package/lib/components/NumberInput/NumberInput.d.ts +1 -1
  105. package/lib/components/NumberInput/NumberInput.js +3 -3
  106. package/lib/components/ProgressIndicator/ProgressIndicator.js +4 -0
  107. package/lib/components/RadioButton/RadioButton.d.ts +1 -1
  108. package/lib/components/RadioButton/RadioButton.js +1 -1
  109. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  110. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  111. package/lib/components/Select/Select.d.ts +1 -1
  112. package/lib/components/Select/Select.js +2 -2
  113. package/lib/components/Slider/Slider.Skeleton.js +17 -3
  114. package/lib/components/Slider/Slider.js +132 -93
  115. package/lib/components/Slider/SliderHandles.d.ts +4 -0
  116. package/lib/components/Slider/SliderHandles.js +76 -0
  117. package/lib/components/Slug/index.js +1 -0
  118. package/lib/components/Tabs/Tabs.js +1 -1
  119. package/lib/components/Tag/Tag.d.ts +18 -10
  120. package/lib/components/Tag/Tag.js +23 -7
  121. package/lib/components/TextArea/TextArea.d.ts +7 -3
  122. package/lib/components/TextArea/TextArea.js +84 -17
  123. package/lib/components/TextInput/TextInput.d.ts +1 -1
  124. package/lib/components/TextInput/TextInput.js +2 -2
  125. package/lib/components/Tile/Tile.d.ts +8 -8
  126. package/lib/components/Tile/Tile.js +11 -7
  127. package/lib/components/Tooltip/Tooltip.js +47 -1
  128. package/lib/components/UIShell/HeaderPanel.d.ts +36 -0
  129. package/lib/components/UIShell/HeaderPanel.js +7 -7
  130. package/lib/components/UIShell/Switcher.js +1 -1
  131. package/lib/index.js +4 -2
  132. package/lib/internal/useAnnouncer.js +2 -1
  133. package/lib/internal/useNoInteractiveChildren.js +2 -6
  134. package/package.json +4 -7
@@ -16,62 +16,59 @@ import deprecate from '../../prop-types/deprecate.js';
16
16
  import { FeatureFlagContext } from '../FeatureFlags/index.js';
17
17
  import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
18
18
  import '../Text/index.js';
19
+ import '../Tooltip/DefinitionTooltip.js';
20
+ import { Tooltip } from '../Tooltip/Tooltip.js';
21
+ import { LowerHandle, LowerHandleFocus, UpperHandle, UpperHandleFocus } from './SliderHandles.js';
19
22
  import { matches } from '../../internal/keyboard/match.js';
20
23
  import { Text } from '../Text/Text.js';
21
24
 
22
- var _path, _path2, _path3, _path4, _path5, _path6, _path7, _path8, _path9, _path10, _path11, _path12, _path13, _path14, _LowerHandle, _LowerHandleFocus, _UpperHandle, _UpperHandleFocus, _UpperHandle2, _UpperHandleFocus2, _LowerHandle2, _LowerHandleFocus2;
23
- const LowerHandle = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
24
- xmlns: "http://www.w3.org/2000/svg",
25
- viewBox: "0 0 16 24",
26
- className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--lower`
27
- }, _path || (_path = /*#__PURE__*/React__default.createElement("path", {
28
- d: "M15.08 6.46H16v11.08h-.92zM4.46 17.54c-.25 0-.46-.21-.46-.46V6.92a.465.465 0 0 1 .69-.4l8.77 5.08a.46.46 0 0 1 0 .8l-8.77 5.08c-.07.04-.15.06-.23.06Z"
29
- })), _path2 || (_path2 = /*#__PURE__*/React__default.createElement("path", {
30
- fill: "none",
31
- d: "M-4 0h24v24H-4z"
32
- }))));
33
- const LowerHandleFocus = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
34
- xmlns: "http://www.w3.org/2000/svg",
35
- viewBox: "0 0 16 24",
36
- className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--lower ${prefix}--slider__thumb-icon--focus`
37
- }, _path3 || (_path3 = /*#__PURE__*/React__default.createElement("path", {
38
- d: "M15.08 6.46H16v11.08h-.92zM4.46 17.54c-.25 0-.46-.21-.46-.46V6.92a.465.465 0 0 1 .69-.4l8.77 5.08a.46.46 0 0 1 0 .8l-8.77 5.08c-.07.04-.15.06-.23.06Z"
39
- })), _path4 || (_path4 = /*#__PURE__*/React__default.createElement("path", {
40
- fill: "none",
41
- d: "M-4 0h24v24H-4z"
42
- })), _path5 || (_path5 = /*#__PURE__*/React__default.createElement("path", {
43
- d: "M15.08 0H16v6.46h-.92z"
44
- })), _path6 || (_path6 = /*#__PURE__*/React__default.createElement("path", {
45
- d: "M0 0h.92v24H0zM15.08 0H16v24h-.92z"
46
- })), _path7 || (_path7 = /*#__PURE__*/React__default.createElement("path", {
47
- d: "M0 .92V0h16v.92zM0 24v-.92h16V24z"
48
- }))));
49
- const UpperHandle = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
50
- xmlns: "http://www.w3.org/2000/svg",
51
- viewBox: "0 0 16 24",
52
- className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--upper`
53
- }, _path8 || (_path8 = /*#__PURE__*/React__default.createElement("path", {
54
- d: "M0 6.46h.92v11.08H0zM11.54 6.46c.25 0 .46.21.46.46v10.15a.465.465 0 0 1-.69.4L2.54 12.4a.46.46 0 0 1 0-.8l8.77-5.08c.07-.04.15-.06.23-.06Z"
55
- })), _path9 || (_path9 = /*#__PURE__*/React__default.createElement("path", {
56
- fill: "none",
57
- d: "M-4 0h24v24H-4z"
58
- }))));
59
- const UpperHandleFocus = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
60
- xmlns: "http://www.w3.org/2000/svg",
61
- viewBox: "0 0 16 24",
62
- className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--upper ${prefix}--slider__thumb-icon--focus`
63
- }, _path10 || (_path10 = /*#__PURE__*/React__default.createElement("path", {
64
- d: "M0 6.46h.92v11.08H0zM11.54 6.46c.25 0 .46.21.46.46v10.15a.465.465 0 0 1-.69.4L2.54 12.4a.46.46 0 0 1 0-.8l8.77-5.08c.07-.04.15-.06.23-.06Z"
65
- })), _path11 || (_path11 = /*#__PURE__*/React__default.createElement("path", {
66
- fill: "none",
67
- d: "M-4 0h24v24H-4z"
68
- })), _path12 || (_path12 = /*#__PURE__*/React__default.createElement("path", {
69
- d: "M.92 24H0v-6.46h.92z"
70
- })), _path13 || (_path13 = /*#__PURE__*/React__default.createElement("path", {
71
- d: "M16 24h-.92V0H16zM.92 24H0V0h.92z"
72
- })), _path14 || (_path14 = /*#__PURE__*/React__default.createElement("path", {
73
- d: "M16 23.08V24H0v-.92zM16 0v.92H0V0z"
74
- }))));
25
+ var _LowerHandle, _LowerHandleFocus, _UpperHandle, _UpperHandleFocus, _UpperHandle2, _UpperHandleFocus2, _LowerHandle2, _LowerHandleFocus2;
26
+ const ThumbWrapper = _ref => {
27
+ let {
28
+ hasTooltip = false,
29
+ className,
30
+ style,
31
+ children,
32
+ ...rest
33
+ } = _ref;
34
+ if (hasTooltip) {
35
+ return (
36
+ /*#__PURE__*/
37
+ // eslint-disable-next-line react/forbid-component-props
38
+ React__default.createElement(Tooltip, _extends({
39
+ className: className,
40
+ style: style
41
+ }, rest), children)
42
+ );
43
+ } else {
44
+ return (
45
+ /*#__PURE__*/
46
+ // eslint-disable-next-line react/forbid-dom-props
47
+ React__default.createElement("div", {
48
+ className: className,
49
+ style: style
50
+ }, children)
51
+ );
52
+ }
53
+ };
54
+ ThumbWrapper.propTypes = {
55
+ /**
56
+ * The thumb node itself.
57
+ */
58
+ children: PropTypes.node,
59
+ /**
60
+ * CSS wrapper class names.
61
+ */
62
+ className: PropTypes.string,
63
+ /**
64
+ * Should the thumb show a tooltip with the current value?
65
+ */
66
+ hasTooltip: PropTypes.bool.isRequired,
67
+ /**
68
+ * Percentage offset for the select thumb value.
69
+ */
70
+ style: PropTypes.object
71
+ };
75
72
  const translationIds = {
76
73
  autoCorrectAnnouncement: 'carbon.slider.auto-correct-announcement'
77
74
  };
@@ -148,6 +145,12 @@ class Slider extends PureComponent {
148
145
  return;
149
146
  }
150
147
 
148
+ // We're going to force focus on one of the handles later on here, b/c we're
149
+ // firing on a mousedown event, we need to call event.preventDefault() to
150
+ // keep the focus from leaving the HTMLElement.
151
+ // @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#notes
152
+ evt.preventDefault();
153
+
151
154
  // Register drag stop handlers
152
155
  DRAG_STOP_EVENT_TYPES.forEach(element => {
153
156
  this.element?.ownerDocument.addEventListener(element, this.onDragStop);
@@ -160,14 +163,34 @@ class Slider extends PureComponent {
160
163
  const clientX = this.getClientXFromEvent(evt);
161
164
  let activeHandle;
162
165
  if (this.hasTwoHandles()) {
163
- const distanceToLower = this.calcDistanceToHandle(HandlePosition.LOWER, clientX);
164
- const distanceToUpper = this.calcDistanceToHandle(HandlePosition.UPPER, clientX);
165
- if (distanceToLower <= distanceToUpper) {
166
+ if (evt.target == this.thumbRef.current) {
166
167
  activeHandle = HandlePosition.LOWER;
167
- } else {
168
+ } else if (evt.target == this.thumbRefUpper.current) {
168
169
  activeHandle = HandlePosition.UPPER;
170
+ } else {
171
+ const distanceToLower = this.calcDistanceToHandle(HandlePosition.LOWER, clientX);
172
+ const distanceToUpper = this.calcDistanceToHandle(HandlePosition.UPPER, clientX);
173
+ if (distanceToLower <= distanceToUpper) {
174
+ activeHandle = HandlePosition.LOWER;
175
+ } else {
176
+ activeHandle = HandlePosition.UPPER;
177
+ }
169
178
  }
170
179
  }
180
+
181
+ // Force focus to the appropriate handle.
182
+ const focusOptions = {
183
+ preventScroll: true
184
+ };
185
+ if (this.hasTwoHandles()) {
186
+ if (this.thumbRef.current && activeHandle === HandlePosition.LOWER) {
187
+ this.thumbRef.current.focus(focusOptions);
188
+ } else if (this.thumbRefUpper.current && activeHandle === HandlePosition.UPPER) {
189
+ this.thumbRefUpper.current.focus(focusOptions);
190
+ }
191
+ } else if (this.thumbRef.current) {
192
+ this.thumbRef.current.focus(focusOptions);
193
+ }
171
194
  this.setState({
172
195
  activeHandle
173
196
  });
@@ -465,12 +488,12 @@ class Slider extends PureComponent {
465
488
  }
466
489
  }
467
490
  });
468
- _defineProperty(this, "calcLeftPercent", _ref => {
491
+ _defineProperty(this, "calcLeftPercent", _ref2 => {
469
492
  let {
470
493
  clientX,
471
494
  value,
472
495
  range
473
- } = _ref;
496
+ } = _ref2;
474
497
  const boundingRect = this.element?.getBoundingClientRect?.();
475
498
  let width = boundingRect ? boundingRect.right - boundingRect.left : 0;
476
499
 
@@ -492,11 +515,11 @@ class Slider extends PureComponent {
492
515
  // re-assure Typescript, return 0.
493
516
  return 0;
494
517
  });
495
- _defineProperty(this, "calcSteppedValuePercent", _ref2 => {
518
+ _defineProperty(this, "calcSteppedValuePercent", _ref3 => {
496
519
  let {
497
520
  leftPercent,
498
521
  range
499
- } = _ref2;
522
+ } = _ref3;
500
523
  const {
501
524
  step = 1
502
525
  } = this.props;
@@ -525,12 +548,12 @@ class Slider extends PureComponent {
525
548
  * clientX is not provided.
526
549
  * @param {boolean} [params.useRawValue=false] `true` to use the given value as-is.
527
550
  */
528
- _defineProperty(this, "calcValue", _ref3 => {
551
+ _defineProperty(this, "calcValue", _ref4 => {
529
552
  let {
530
553
  clientX,
531
554
  value,
532
555
  useRawValue = false
533
- } = _ref3;
556
+ } = _ref4;
534
557
  const range = this.props.max - this.props.min;
535
558
 
536
559
  // @todo solve for rtl.
@@ -581,11 +604,11 @@ class Slider extends PureComponent {
581
604
  *
582
605
  * Guards against setting either lower or upper values beyond its counterpart.
583
606
  */
584
- _defineProperty(this, "setValueLeftForHandle", (handle, _ref4) => {
607
+ _defineProperty(this, "setValueLeftForHandle", (handle, _ref5) => {
585
608
  let {
586
609
  value: newValue,
587
610
  left: newLeft
588
- } = _ref4;
611
+ } = _ref5;
589
612
  const {
590
613
  value,
591
614
  valueUpper,
@@ -620,13 +643,13 @@ class Slider extends PureComponent {
620
643
  });
621
644
  }
622
645
  });
623
- _defineProperty(this, "isValidValueForPosition", _ref5 => {
646
+ _defineProperty(this, "isValidValueForPosition", _ref6 => {
624
647
  let {
625
648
  handle,
626
649
  value: newValue,
627
650
  min,
628
651
  max
629
- } = _ref5;
652
+ } = _ref6;
630
653
  const {
631
654
  value,
632
655
  valueUpper
@@ -645,21 +668,21 @@ class Slider extends PureComponent {
645
668
  }
646
669
  return false;
647
670
  });
648
- _defineProperty(this, "isValidValue", _ref6 => {
671
+ _defineProperty(this, "isValidValue", _ref7 => {
649
672
  let {
650
673
  value,
651
674
  min,
652
675
  max
653
- } = _ref6;
676
+ } = _ref7;
654
677
  return !(value < min || value > max);
655
678
  });
656
- _defineProperty(this, "getAdjustedValueForPosition", _ref7 => {
679
+ _defineProperty(this, "getAdjustedValueForPosition", _ref8 => {
657
680
  let {
658
681
  handle,
659
682
  value: newValue,
660
683
  min,
661
684
  max
662
- } = _ref7;
685
+ } = _ref8;
663
686
  const {
664
687
  value,
665
688
  valueUpper
@@ -678,12 +701,12 @@ class Slider extends PureComponent {
678
701
  }
679
702
  return newValue;
680
703
  });
681
- _defineProperty(this, "getAdjustedValue", _ref8 => {
704
+ _defineProperty(this, "getAdjustedValue", _ref9 => {
682
705
  let {
683
706
  value,
684
707
  min,
685
708
  max
686
- } = _ref8;
709
+ } = _ref9;
687
710
  if (value < min) {
688
711
  value = min;
689
712
  }
@@ -768,22 +791,10 @@ class Slider extends PureComponent {
768
791
  // Fire onChange event handler if present, if there's a usable value, and
769
792
  // if the value is different from the last one
770
793
  if (this.hasTwoHandles()) {
771
- if (this.thumbRef.current) {
772
- this.thumbRef.current.style.insetInlineStart = `${this.state.left}%`;
773
- if (this.state.isRtl) {
774
- this.thumbRef.current.style.transform = `translate(100%, -50%)`;
775
- }
776
- }
777
- if (this.thumbRefUpper.current) {
778
- this.thumbRefUpper.current.style.insetInlineStart = `${this.state.leftUpper}%`;
779
- }
780
794
  if (this.filledTrackRef.current) {
781
795
  this.filledTrackRef.current.style.transform = this.state.isRtl ? `translate(${100 - this.state.leftUpper}%, -50%) scaleX(${(this.state.leftUpper - this.state.left) / 100})` : `translate(${this.state.left}%, -50%) scaleX(${(this.state.leftUpper - this.state.left) / 100})`;
782
796
  }
783
797
  } else {
784
- if (this.thumbRef.current) {
785
- this.thumbRef.current.style.insetInlineStart = this.state.isRtl ? `calc(${this.state.left}% - 14px)` : `${this.state.left}%`;
786
- }
787
798
  if (this.filledTrackRef.current) {
788
799
  this.filledTrackRef.current.style.transform = this.state.isRtl ? `translate(100%, -50%) scaleX(-${this.state.left / 100})` : `translate(0%, -50%) scaleX(${this.state.left / 100})`;
789
800
  }
@@ -977,7 +988,8 @@ class Slider extends PureComponent {
977
988
  const containerClasses = cx(`${prefix}--slider-container`, {
978
989
  [`${prefix}--slider-container--two-handles`]: twoHandles,
979
990
  [`${prefix}--slider-container--disabled`]: disabled,
980
- [`${prefix}--slider-container--readonly`]: readOnly
991
+ [`${prefix}--slider-container--readonly`]: readOnly,
992
+ [`${prefix}--slider-container--rtl`]: isRtl
981
993
  });
982
994
  const sliderClasses = cx(`${prefix}--slider`, {
983
995
  [`${prefix}--slider--disabled`]: disabled,
@@ -985,8 +997,7 @@ class Slider extends PureComponent {
985
997
  });
986
998
  const fixedInputClasses = [`${prefix}--text-input`, `${prefix}--slider-text-input`];
987
999
  const conditionalInputClasses = {
988
- [`${prefix}--text-input--light`]: light,
989
- [`${prefix}--slider-text-input--hidden`]: hideTextInput
1000
+ [`${prefix}--text-input--light`]: light
990
1001
  };
991
1002
  const lowerInputClasses = cx([...fixedInputClasses, `${prefix}--slider-text-input--lower`, conditionalInputClasses, {
992
1003
  [`${prefix}--text-input--invalid`]: !readOnly && !isValid,
@@ -997,10 +1008,12 @@ class Slider extends PureComponent {
997
1008
  [`${prefix}--slider-text-input--warn`]: showWarningUpper
998
1009
  }]);
999
1010
  const lowerInputWrapperClasses = cx([`${prefix}--text-input-wrapper`, `${prefix}--slider-text-input-wrapper`, `${prefix}--slider-text-input-wrapper--lower`, {
1000
- [`${prefix}--text-input-wrapper--readonly`]: readOnly
1011
+ [`${prefix}--text-input-wrapper--readonly`]: readOnly,
1012
+ [`${prefix}--slider-text-input-wrapper--hidden`]: hideTextInput
1001
1013
  }]);
1002
1014
  const upperInputWrapperClasses = cx([`${prefix}--text-input-wrapper`, `${prefix}--slider-text-input-wrapper`, `${prefix}--slider-text-input-wrapper--upper`, {
1003
- [`${prefix}--text-input-wrapper--readonly`]: readOnly
1015
+ [`${prefix}--text-input-wrapper--readonly`]: readOnly,
1016
+ [`${prefix}--slider-text-input-wrapper--hidden`]: hideTextInput
1004
1017
  }]);
1005
1018
  const lowerThumbClasses = cx(`${prefix}--slider__thumb`, {
1006
1019
  [`${prefix}--slider__thumb--lower`]: twoHandles
@@ -1008,6 +1021,22 @@ class Slider extends PureComponent {
1008
1021
  const upperThumbClasses = cx(`${prefix}--slider__thumb`, {
1009
1022
  [`${prefix}--slider__thumb--upper`]: twoHandles
1010
1023
  });
1024
+ const lowerThumbWrapperClasses = cx([`${prefix}--icon-tooltip`, `${prefix}--slider__thumb-wrapper`, {
1025
+ [`${prefix}--slider__thumb-wrapper--lower`]: twoHandles
1026
+ }]);
1027
+ const upperThumbWrapperClasses = cx([`${prefix}--icon-tooltip`, `${prefix}--slider__thumb-wrapper`, {
1028
+ [`${prefix}--slider__thumb-wrapper--upper`]: twoHandles
1029
+ }]);
1030
+ const lowerThumbWrapperProps = {
1031
+ style: {
1032
+ insetInlineStart: `${this.state.left}%`
1033
+ }
1034
+ };
1035
+ const upperThumbWrapperProps = {
1036
+ style: {
1037
+ insetInlineStart: `${this.state.leftUpper}%`
1038
+ }
1039
+ };
1011
1040
  return /*#__PURE__*/React__default.createElement("div", {
1012
1041
  className: cx(`${prefix}--form-item`, className)
1013
1042
  }, /*#__PURE__*/React__default.createElement(Text, {
@@ -1056,7 +1085,12 @@ class Slider extends PureComponent {
1056
1085
  role: "presentation",
1057
1086
  tabIndex: -1,
1058
1087
  "data-invalid": (twoHandles ? !isValid || !isValidUpper : !isValid) && !readOnly ? true : null
1059
- }, other), /*#__PURE__*/React__default.createElement("div", {
1088
+ }, other), /*#__PURE__*/React__default.createElement(ThumbWrapper, _extends({
1089
+ hasTooltip: hideTextInput,
1090
+ className: lowerThumbWrapperClasses,
1091
+ label: `${value}`,
1092
+ align: twoHandles ? 'top-right' : 'top'
1093
+ }, lowerThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
1060
1094
  className: lowerThumbClasses,
1061
1095
  role: "slider",
1062
1096
  id: twoHandles ? undefined : id,
@@ -1070,7 +1104,12 @@ class Slider extends PureComponent {
1070
1104
  onFocus: () => this.setState({
1071
1105
  activeHandle: HandlePosition.LOWER
1072
1106
  })
1073
- }, twoHandles && !isRtl && (_LowerHandle || (_LowerHandle = /*#__PURE__*/React__default.createElement(LowerHandle, null))), twoHandles && !isRtl && (_LowerHandleFocus || (_LowerHandleFocus = /*#__PURE__*/React__default.createElement(LowerHandleFocus, null))), twoHandles && isRtl && (_UpperHandle || (_UpperHandle = /*#__PURE__*/React__default.createElement(UpperHandle, null))), twoHandles && isRtl && (_UpperHandleFocus || (_UpperHandleFocus = /*#__PURE__*/React__default.createElement(UpperHandleFocus, null)))), twoHandles ? /*#__PURE__*/React__default.createElement("div", {
1107
+ }, twoHandles && !isRtl ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, _LowerHandle || (_LowerHandle = /*#__PURE__*/React__default.createElement(LowerHandle, null)), _LowerHandleFocus || (_LowerHandleFocus = /*#__PURE__*/React__default.createElement(LowerHandleFocus, null))) : twoHandles && isRtl ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, _UpperHandle || (_UpperHandle = /*#__PURE__*/React__default.createElement(UpperHandle, null)), _UpperHandleFocus || (_UpperHandleFocus = /*#__PURE__*/React__default.createElement(UpperHandleFocus, null))) : undefined)), twoHandles ? /*#__PURE__*/React__default.createElement(ThumbWrapper, _extends({
1108
+ hasTooltip: hideTextInput,
1109
+ className: upperThumbWrapperClasses,
1110
+ label: `${valueUpper}`,
1111
+ align: "top-left"
1112
+ }, upperThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
1074
1113
  className: upperThumbClasses,
1075
1114
  role: "slider",
1076
1115
  tabIndex: !readOnly ? 0 : -1,
@@ -1082,7 +1121,7 @@ class Slider extends PureComponent {
1082
1121
  onFocus: () => this.setState({
1083
1122
  activeHandle: HandlePosition.UPPER
1084
1123
  })
1085
- }, twoHandles && !isRtl && (_UpperHandle2 || (_UpperHandle2 = /*#__PURE__*/React__default.createElement(UpperHandle, null))), twoHandles && !isRtl && (_UpperHandleFocus2 || (_UpperHandleFocus2 = /*#__PURE__*/React__default.createElement(UpperHandleFocus, null))), twoHandles && isRtl && (_LowerHandle2 || (_LowerHandle2 = /*#__PURE__*/React__default.createElement(LowerHandle, null))), twoHandles && isRtl && (_LowerHandleFocus2 || (_LowerHandleFocus2 = /*#__PURE__*/React__default.createElement(LowerHandleFocus, null)))) : null, /*#__PURE__*/React__default.createElement("div", {
1124
+ }, twoHandles && !isRtl ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, _UpperHandle2 || (_UpperHandle2 = /*#__PURE__*/React__default.createElement(UpperHandle, null)), _UpperHandleFocus2 || (_UpperHandleFocus2 = /*#__PURE__*/React__default.createElement(UpperHandleFocus, null))) : twoHandles && isRtl ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, _LowerHandle2 || (_LowerHandle2 = /*#__PURE__*/React__default.createElement(LowerHandle, null)), _LowerHandleFocus2 || (_LowerHandleFocus2 = /*#__PURE__*/React__default.createElement(LowerHandleFocus, null))) : undefined)) : null, /*#__PURE__*/React__default.createElement("div", {
1086
1125
  className: `${prefix}--slider__track`,
1087
1126
  ref: node => {
1088
1127
  this.track = node;
@@ -0,0 +1,4 @@
1
+ export declare const LowerHandle: () => JSX.Element;
2
+ export declare const LowerHandleFocus: () => JSX.Element;
3
+ export declare const UpperHandle: () => JSX.Element;
4
+ export declare const UpperHandleFocus: () => JSX.Element;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { PrefixContext } from '../../internal/usePrefix.js';
9
+ import React__default from 'react';
10
+
11
+ var _path, _path2, _path3, _path4, _path5, _path6, _path7, _path8, _path9, _path10, _path11, _path12, _path13, _path14;
12
+ const LowerHandle = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ viewBox: "0 0 16 24",
15
+ className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--lower`
16
+ }, _path || (_path = /*#__PURE__*/React__default.createElement("path", {
17
+ d: "M15.08 6.46H16v11.08h-.92zM4.46 17.54c-.25 0-.46-.21-.46-.46V6.92a.465.465 0 0 1 .69-.4l8.77 5.08a.46.46 0 0 1 0 .8l-8.77 5.08c-.07.04-.15.06-.23.06Z"
18
+ })), _path2 || (_path2 = /*#__PURE__*/React__default.createElement("path", {
19
+ fill: "none",
20
+ d: "M-4 0h24v24H-4z"
21
+ }))));
22
+ const LowerHandleFocus = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
23
+ xmlns: "http://www.w3.org/2000/svg",
24
+ viewBox: "0 0 16 24",
25
+ className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--lower ${prefix}--slider__thumb-icon--focus`
26
+ }, _path3 || (_path3 = /*#__PURE__*/React__default.createElement("path", {
27
+ d: "M15.08 6.46H16v11.08h-.92zM4.46 17.54c-.25 0-.46-.21-.46-.46V6.92a.465.465 0 0 1 .69-.4l8.77 5.08a.46.46 0 0 1 0 .8l-8.77 5.08c-.07.04-.15.06-.23.06Z"
28
+ })), _path4 || (_path4 = /*#__PURE__*/React__default.createElement("path", {
29
+ fill: "none",
30
+ d: "M-4 0h24v24H-4z"
31
+ })), _path5 || (_path5 = /*#__PURE__*/React__default.createElement("path", {
32
+ d: "M15.08 0H16v6.46h-.92z"
33
+ })), _path6 || (_path6 = /*#__PURE__*/React__default.createElement("path", {
34
+ d: "M0 0h.92v24H0zM15.08 0H16v24h-.92z"
35
+ })), _path7 || (_path7 = /*#__PURE__*/React__default.createElement("path", {
36
+ d: "M0 .92V0h16v.92zM0 24v-.92h16V24z"
37
+ }))));
38
+ const UpperHandle = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
39
+ xmlns: "http://www.w3.org/2000/svg",
40
+ viewBox: "0 0 16 24",
41
+ className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--upper`
42
+ }, _path8 || (_path8 = /*#__PURE__*/React__default.createElement("path", {
43
+ d: "M0 6.46h.92v11.08H0zM11.54 6.46c.25 0 .46.21.46.46v10.15a.465.465 0 0 1-.69.4L2.54 12.4a.46.46 0 0 1 0-.8l8.77-5.08c.07-.04.15-.06.23-.06Z"
44
+ })), _path9 || (_path9 = /*#__PURE__*/React__default.createElement("path", {
45
+ fill: "none",
46
+ d: "M-4 0h24v24H-4z"
47
+ }))));
48
+ const UpperHandleFocus = () => /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => /*#__PURE__*/React__default.createElement("svg", {
49
+ xmlns: "http://www.w3.org/2000/svg",
50
+ viewBox: "0 0 16 24",
51
+ className: `${prefix}--slider__thumb-icon ${prefix}--slider__thumb-icon--upper ${prefix}--slider__thumb-icon--focus`
52
+ }, _path10 || (_path10 = /*#__PURE__*/React__default.createElement("path", {
53
+ d: "M0 6.46h.92v11.08H0zM11.54 6.46c.25 0 .46.21.46.46v10.15a.465.465 0 0 1-.69.4L2.54 12.4a.46.46 0 0 1 0-.8l8.77-5.08c.07-.04.15-.06.23-.06Z"
54
+ })), _path11 || (_path11 = /*#__PURE__*/React__default.createElement("path", {
55
+ fill: "none",
56
+ d: "M-4 0h24v24H-4z"
57
+ })), _path12 || (_path12 = /*#__PURE__*/React__default.createElement("path", {
58
+ d: "M.92 24H0v-6.46h.92z"
59
+ })), _path13 || (_path13 = /*#__PURE__*/React__default.createElement("path", {
60
+ d: "M16 24h-.92V0H16zM.92 24H0V0h.92z"
61
+ })), _path14 || (_path14 = /*#__PURE__*/React__default.createElement("path", {
62
+ d: "M16 23.08V24H0v-.92zM16 0v.92H0V0z"
63
+ }))));
64
+
65
+ export { LowerHandle, LowerHandleFocus, UpperHandle, UpperHandleFocus };
@@ -125,6 +125,7 @@ const Slug = /*#__PURE__*/React__default.forwardRef(function Slug(_ref3, ref) {
125
125
  className: `${prefix}--slug__additional-text`
126
126
  }, aiTextLabel)), children));
127
127
  });
128
+ Slug.displayName = 'Slug';
128
129
  Slug.propTypes = {
129
130
  /**
130
131
  * Specify the correct translation of the AI text
@@ -257,7 +257,7 @@ function TabList(_ref2) {
257
257
  }
258
258
  }, [scrollLeft, children, dismissable]);
259
259
  useEffectOnce(() => {
260
- if (tabs.current[selectedIndex].disabled) {
260
+ if (tabs.current[selectedIndex]?.disabled) {
261
261
  const activeTabs = tabs.current.filter(tab => {
262
262
  return !tab.disabled;
263
263
  });
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import PropTypes from 'prop-types';
7
+ import PropTypes, { ReactNodeLike } from 'prop-types';
8
8
  import React from 'react';
9
9
  import { PolymorphicProps } from '../../types/common';
10
10
  declare const TYPES: {
@@ -23,7 +23,7 @@ declare const TYPES: {
23
23
  };
24
24
  export interface TagBaseProps {
25
25
  /**
26
- * Provide content to be rendered inside of a <Tag>
26
+ * Provide content to be rendered inside of a `Tag`
27
27
  */
28
28
  children?: React.ReactNode;
29
29
  /**
@@ -31,11 +31,11 @@ export interface TagBaseProps {
31
31
  */
32
32
  className?: string;
33
33
  /**
34
- * Specify if the <Tag> is disabled
34
+ * Specify if the `Tag` is disabled
35
35
  */
36
36
  disabled?: boolean;
37
37
  /**
38
- * Determine if <Tag> is a filter/chip
38
+ * Determine if `Tag` is a filter/chip
39
39
  */
40
40
  filter?: boolean;
41
41
  /**
@@ -56,18 +56,22 @@ export interface TagBaseProps {
56
56
  * 'md' (default) sizes.
57
57
  */
58
58
  size?: 'sm' | 'md';
59
+ /**
60
+ * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
61
+ */
62
+ slug?: ReactNodeLike;
59
63
  /**
60
64
  * Text to show on clear filters
61
65
  */
62
66
  title?: string;
63
67
  /**
64
- * Specify the type of the <Tag>
68
+ * Specify the type of the `Tag`
65
69
  */
66
70
  type?: keyof typeof TYPES;
67
71
  }
68
72
  export type TagProps<T extends React.ElementType> = PolymorphicProps<T, TagBaseProps>;
69
73
  declare const Tag: {
70
- <T extends React.ElementType<any>>({ children, className, id, type, filter, renderIcon: CustomIconElement, title, disabled, onClose, size, as: BaseComponent, ...other }: TagProps<T>): JSX.Element;
74
+ <T extends React.ElementType<any>>({ children, className, id, type, filter, renderIcon: CustomIconElement, title, disabled, onClose, size, as: BaseComponent, slug, ...other }: TagProps<T>): JSX.Element;
71
75
  propTypes: {
72
76
  /**
73
77
  * Provide an alternative tag or component to use instead of the default
@@ -75,7 +79,7 @@ declare const Tag: {
75
79
  */
76
80
  as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
77
81
  /**
78
- * Provide content to be rendered inside of a <Tag>
82
+ * Provide content to be rendered inside of a `Tag`
79
83
  */
80
84
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
81
85
  /**
@@ -83,11 +87,11 @@ declare const Tag: {
83
87
  */
84
88
  className: PropTypes.Requireable<string>;
85
89
  /**
86
- * Specify if the <Tag> is disabled
90
+ * Specify if the `Tag` is disabled
87
91
  */
88
92
  disabled: PropTypes.Requireable<boolean>;
89
93
  /**
90
- * Determine if <Tag> is a filter/chip
94
+ * Determine if `Tag` is a filter/chip
91
95
  */
92
96
  filter: PropTypes.Requireable<boolean>;
93
97
  /**
@@ -108,12 +112,16 @@ declare const Tag: {
108
112
  * 'md' (default) sizes.
109
113
  */
110
114
  size: PropTypes.Requireable<string>;
115
+ /**
116
+ * **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
117
+ */
118
+ slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
111
119
  /**
112
120
  * Text to show on clear filters
113
121
  */
114
122
  title: PropTypes.Requireable<string>;
115
123
  /**
116
- * Specify the type of the <Tag>
124
+ * Specify the type of the `Tag`
117
125
  */
118
126
  type: PropTypes.Requireable<string>;
119
127
  };