@carbon/react 1.61.0 → 1.62.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.
@@ -217,7 +217,8 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
217
217
  setHighlightedIndex(changes.selectedItem);
218
218
  if (onChange) {
219
219
  onChange({
220
- selectedItem: changes.selectedItem
220
+ selectedItem: changes.selectedItem,
221
+ inputValue
221
222
  });
222
223
  }
223
224
  return changes;
@@ -430,6 +431,16 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
430
431
  if (highlightedIndex !== -1) {
431
432
  selectItem(filterItems(items, itemToString, inputValue)[highlightedIndex]);
432
433
  }
434
+
435
+ // Since `onChange` does not normally fire when the menu is closed, we should
436
+ // manually fire it when `allowCustomValue` is provided, the menu is closing,
437
+ // and there is a value.
438
+ if (allowCustomValue && isOpen && inputValue) {
439
+ onChange({
440
+ selectedItem,
441
+ inputValue
442
+ });
443
+ }
433
444
  event.preventDownshiftDefault = true;
434
445
  event?.persist?.();
435
446
  }
@@ -21,6 +21,7 @@ import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsT
21
21
  import wrapFocus, { wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
22
22
  import { usePrefix } from '../../internal/usePrefix.js';
23
23
  import { useFeatureFlag } from '../FeatureFlags/index.js';
24
+ import { composeEventHandlers } from '../../tools/events.js';
24
25
  import { match } from '../../internal/keyboard/match.js';
25
26
  import { Escape, Tab } from '../../internal/keyboard/keys.js';
26
27
 
@@ -148,7 +149,7 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
148
149
  }
149
150
  onKeyDown?.(event);
150
151
  }
151
- function handleMousedown(evt) {
152
+ function handleOnClick(evt) {
152
153
  const target = evt.target;
153
154
  evt.stopPropagation();
154
155
  if (!preventCloseOnClickOutside && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
@@ -256,7 +257,7 @@ const ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedMo
256
257
  ref: ref,
257
258
  "aria-hidden": !open,
258
259
  onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
259
- onMouseDown: handleMousedown,
260
+ onClick: composeEventHandlers([rest?.onClick, handleOnClick]),
260
261
  onKeyDown: handleKeyDown,
261
262
  className: modalClass
262
263
  }), /*#__PURE__*/React__default.createElement("div", {
@@ -25,14 +25,16 @@ var carbonFlatpickrRangePlugin = (config => {
25
25
  origSetDate.call(this, dates, triggerChange, format);
26
26
  // If `triggerChange` is `true`, `onValueUpdate` Flatpickr event is fired
27
27
  // where Flatpickr's range plugin takes care of fixing the first `<input>`
28
- if (!triggerChange) {
28
+ if (!triggerChange && dates.length === 2) {
29
29
  const {
30
- _input: inputDates
30
+ _input: inputFrom
31
31
  } = fp;
32
- const inputDatesArray = inputDates.value.split(' ');
33
- [inputDatesArray[0], inputDatesArray[2]].forEach((input, i) => {
32
+ const {
33
+ input: inputTo
34
+ } = config;
35
+ [inputFrom, inputTo].forEach((input, i) => {
34
36
  if (input) {
35
- input = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
37
+ input.value = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
36
38
  }
37
39
  });
38
40
  }
@@ -26,6 +26,7 @@ import { IconButton } from '../IconButton/index.js';
26
26
  import { noopFn } from '../../internal/noopFn.js';
27
27
  import '../Text/index.js';
28
28
  import { useFeatureFlag } from '../FeatureFlags/index.js';
29
+ import { composeEventHandlers } from '../../tools/events.js';
29
30
  import { Text } from '../Text/Text.js';
30
31
  import { match } from '../../internal/keyboard/match.js';
31
32
  import { Escape, Enter, Tab } from '../../internal/keyboard/keys.js';
@@ -106,7 +107,7 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
106
107
  }
107
108
  }
108
109
  }
109
- function handleMousedown(evt) {
110
+ function handleOnClick(evt) {
110
111
  const target = evt.target;
111
112
  evt.stopPropagation();
112
113
  if (!preventCloseOnClickOutside && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
@@ -305,7 +306,7 @@ const Modal = /*#__PURE__*/React__default.forwardRef(function Modal(_ref, ref) {
305
306
  return /*#__PURE__*/React__default.createElement(Layer, _extends({}, rest, {
306
307
  level: 0,
307
308
  onKeyDown: handleKeyDown,
308
- onMouseDown: handleMousedown,
309
+ onClick: composeEventHandlers([rest?.onClick, handleOnClick]),
309
310
  onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
310
311
  className: modalClasses,
311
312
  role: "presentation",
@@ -36,7 +36,7 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
36
36
  */
37
37
  disabled?: boolean;
38
38
  /**
39
- * The callback to format the label associated with the minimum/maximum value.
39
+ * The callback to format the label associated with the minimum/maximum value and the value tooltip when hideTextInput is true.
40
40
  */
41
41
  formatLabel?: (value: number, label: string | undefined) => string;
42
42
  /**
@@ -1092,13 +1092,14 @@ class Slider extends PureComponent {
1092
1092
  }, other), /*#__PURE__*/React__default.createElement(ThumbWrapper, _extends({
1093
1093
  hasTooltip: hideTextInput,
1094
1094
  className: lowerThumbWrapperClasses,
1095
- label: `${value}`,
1095
+ label: `${formatLabel(value, '')}`,
1096
1096
  align: "top"
1097
1097
  }, lowerThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
1098
1098
  className: lowerThumbClasses,
1099
1099
  role: "slider",
1100
1100
  id: twoHandles ? undefined : id,
1101
1101
  tabIndex: !readOnly ? 0 : -1,
1102
+ "aria-valuetext": `${formatLabel(value, '')}`,
1102
1103
  "aria-valuemax": twoHandles ? valueUpper : max,
1103
1104
  "aria-valuemin": min,
1104
1105
  "aria-valuenow": value,
@@ -1111,7 +1112,7 @@ class Slider extends PureComponent {
1111
1112
  }, 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({
1112
1113
  hasTooltip: hideTextInput,
1113
1114
  className: upperThumbWrapperClasses,
1114
- label: `${valueUpper}`,
1115
+ label: `${formatLabel(valueUpper || 0, '')}`,
1115
1116
  align: "top"
1116
1117
  }, upperThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
1117
1118
  className: upperThumbClasses,
@@ -13,7 +13,7 @@ import debounce from 'lodash.debounce';
13
13
  import PropTypes from 'prop-types';
14
14
  import React__default, { useState, useRef, useCallback, useEffect, forwardRef, useLayoutEffect } from 'react';
15
15
  import '../Grid/FlexGrid.js';
16
- import '../Grid/Grid.js';
16
+ import { Grid as GridAsGridComponent } from '../Grid/Grid.js';
17
17
  import '../Grid/Row.js';
18
18
  import '../Grid/Column.js';
19
19
  import '../Grid/ColumnHang.js';
@@ -35,9 +35,10 @@ import { useMatchMedia } from '../../internal/useMatchMedia.js';
35
35
  import '../Text/index.js';
36
36
  import { Text } from '../Text/Text.js';
37
37
  import { matches, match } from '../../internal/keyboard/match.js';
38
- import { ArrowRight, ArrowLeft, Home, End, Delete } from '../../internal/keyboard/keys.js';
38
+ import { ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp, Delete } from '../../internal/keyboard/keys.js';
39
39
 
40
40
  var _ChevronLeft, _ChevronRight;
41
+ const verticalTabHeight = 64;
41
42
 
42
43
  // Used to manage the overall state of the Tabs
43
44
 
@@ -58,7 +59,7 @@ const TabContext = /*#__PURE__*/React__default.createContext({
58
59
  hasSecondaryLabel: false
59
60
  });
60
61
  const lgMediaQuery = `(min-width: ${breakpoints.lg.width})`;
61
- `(max-width: ${breakpoints.md.width})`;
62
+ const smMediaQuery = `(max-width: ${breakpoints.md.width})`;
62
63
 
63
64
  // Used to keep track of position in a list of tab panels
64
65
  const TabPanelContext = /*#__PURE__*/React__default.createContext(0);
@@ -137,7 +138,47 @@ Tabs.propTypes = {
137
138
  */
138
139
  selectedIndex: PropTypes.number
139
140
  };
140
- ({
141
+ function TabsVertical(_ref2) {
142
+ let {
143
+ children,
144
+ height,
145
+ defaultSelectedIndex = 0,
146
+ onChange,
147
+ selectedIndex: controlledSelectedIndex,
148
+ ...rest
149
+ } = _ref2;
150
+ const [selectedIndex, setSelectedIndex] = useControllableState({
151
+ value: controlledSelectedIndex,
152
+ defaultValue: defaultSelectedIndex,
153
+ onChange: value => onChange?.({
154
+ selectedIndex: value
155
+ })
156
+ });
157
+ const props = {
158
+ ...rest,
159
+ selectedIndex,
160
+ onChange: _ref3 => {
161
+ let {
162
+ selectedIndex
163
+ } = _ref3;
164
+ return setSelectedIndex(selectedIndex);
165
+ }
166
+ };
167
+ const isSm = useMatchMedia(smMediaQuery);
168
+ if (!isSm) {
169
+ return (
170
+ /*#__PURE__*/
171
+ // eslint-disable-next-line react/forbid-component-props
172
+ React__default.createElement(GridAsGridComponent, {
173
+ style: {
174
+ height: height
175
+ }
176
+ }, /*#__PURE__*/React__default.createElement(Tabs, props, children))
177
+ );
178
+ }
179
+ return /*#__PURE__*/React__default.createElement(Tabs, props, children);
180
+ }
181
+ TabsVertical.propTypes = {
141
182
  /**
142
183
  * Provide child elements to be rendered inside the `TabsVertical`.
143
184
  * These elements should render either `TabsListVertical` or `TabsPanels`
@@ -162,7 +203,7 @@ Tabs.propTypes = {
162
203
  * in a controlled mode and should be used along with `onChange`
163
204
  */
164
205
  selectedIndex: PropTypes.number
165
- });
206
+ };
166
207
 
167
208
  /**
168
209
  * Get the next index for a given keyboard event
@@ -183,6 +224,25 @@ function getNextIndex(event, total, index) {
183
224
  }
184
225
  }
185
226
 
227
+ /**
228
+ * Get the next index for a given keyboard event
229
+ * given a count of the total items and the current index
230
+ */
231
+ function getNextIndexVertical(event, total, index) {
232
+ switch (true) {
233
+ case match(event, ArrowDown):
234
+ return (index + 1) % total;
235
+ case match(event, ArrowUp):
236
+ return (total + index - 1) % total;
237
+ case match(event, Home):
238
+ return 0;
239
+ case match(event, End):
240
+ return total - 1;
241
+ default:
242
+ return index;
243
+ }
244
+ }
245
+
186
246
  /**
187
247
  * TabList
188
248
  */
@@ -477,7 +537,133 @@ TabList.propTypes = {
477
537
  */
478
538
  scrollIntoView: PropTypes.bool
479
539
  };
480
- ({
540
+
541
+ /**
542
+ * TabListVertical
543
+ */
544
+
545
+ // type TabElement = HTMLElement & { disabled?: boolean };
546
+
547
+ function TabListVertical(_ref7) {
548
+ let {
549
+ activation = 'automatic',
550
+ 'aria-label': label,
551
+ children,
552
+ className: customClassName,
553
+ scrollIntoView,
554
+ ...rest
555
+ } = _ref7;
556
+ const {
557
+ activeIndex,
558
+ selectedIndex,
559
+ setSelectedIndex,
560
+ setActiveIndex
561
+ } = React__default.useContext(TabsContext);
562
+ const prefix = usePrefix();
563
+ const ref = useRef(null);
564
+ const [isOverflowingBottom, setIsOverflowingBottom] = useState(false);
565
+ const [isOverflowingTop, setIsOverflowingTop] = useState(false);
566
+ const isSm = useMatchMedia(smMediaQuery);
567
+ const className = cx(`${prefix}--tabs`, `${prefix}--tabs--vertical`, `${prefix}--tabs--contained`, customClassName);
568
+ const tabs = useRef([]);
569
+ function onKeyDown(event) {
570
+ if (matches(event, [ArrowDown, ArrowUp, Home, End])) {
571
+ event.preventDefault();
572
+ const filtredTabs = tabs.current.filter(tab => tab !== null);
573
+ const activeTabs = filtredTabs.filter(tab => !tab.disabled);
574
+ const currentIndex = activeTabs.indexOf(tabs.current[activation === 'automatic' ? selectedIndex : activeIndex]);
575
+ const nextIndex = tabs.current.indexOf(activeTabs[getNextIndexVertical(event, activeTabs.length, currentIndex)]);
576
+ if (activation === 'automatic') {
577
+ setSelectedIndex(nextIndex);
578
+ } else if (activation === 'manual') {
579
+ setActiveIndex(nextIndex);
580
+ }
581
+ tabs.current[nextIndex]?.focus();
582
+ }
583
+ }
584
+ useEffectOnce(() => {
585
+ if (tabs.current[selectedIndex]?.disabled) {
586
+ const activeTabs = tabs.current.filter(tab => {
587
+ return !tab.disabled;
588
+ });
589
+ if (activeTabs.length > 0) {
590
+ const tab = activeTabs[0];
591
+ setSelectedIndex(tabs.current.indexOf(tab));
592
+ }
593
+ }
594
+ });
595
+ useEffect(() => {
596
+ function handler() {
597
+ const containerHeight = ref.current?.offsetHeight;
598
+ const containerTop = ref.current?.getBoundingClientRect().top;
599
+ const selectedPositionTop = tabs.current[selectedIndex]?.getBoundingClientRect().top;
600
+ const halfTabHeight = verticalTabHeight / 2;
601
+ if (containerTop && containerHeight) {
602
+ // scrolls so selected tab is in view
603
+ if (selectedPositionTop - halfTabHeight < containerTop || selectedPositionTop - containerTop + verticalTabHeight + halfTabHeight > containerHeight) {
604
+ ref.current.scrollTo({
605
+ top: (selectedIndex - 1) * verticalTabHeight,
606
+ behavior: 'smooth'
607
+ });
608
+ }
609
+ }
610
+ }
611
+ window.addEventListener('resize', handler);
612
+ handler();
613
+ return () => {
614
+ window.removeEventListener('resize', handler);
615
+ };
616
+ }, [selectedIndex, scrollIntoView]);
617
+ useEffect(() => {
618
+ const element = ref.current;
619
+ if (!element) {
620
+ return;
621
+ }
622
+ const handler = () => {
623
+ const halfTabHeight = verticalTabHeight / 2;
624
+ setIsOverflowingBottom(element.scrollTop + element.clientHeight + halfTabHeight <= element.scrollHeight);
625
+ setIsOverflowingTop(element.scrollTop > halfTabHeight);
626
+ };
627
+ const resizeObserver = new ResizeObserver(() => handler());
628
+ resizeObserver.observe(element);
629
+ element.addEventListener('scroll', handler);
630
+ return () => {
631
+ resizeObserver.disconnect();
632
+ element.removeEventListener('scroll', handler);
633
+ };
634
+ });
635
+ if (isSm) {
636
+ return /*#__PURE__*/React__default.createElement(TabList, _extends({}, rest, {
637
+ "aria-label": label,
638
+ contained: true
639
+ }), children);
640
+ }
641
+ return /*#__PURE__*/React__default.createElement("div", {
642
+ className: className
643
+ }, isOverflowingTop && /*#__PURE__*/React__default.createElement("div", {
644
+ className: `${prefix}--tab--list-gradient_top`
645
+ }), /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
646
+ "aria-label": label,
647
+ ref: ref,
648
+ role: "tablist",
649
+ className: `${prefix}--tab--list`,
650
+ onKeyDown: onKeyDown
651
+ }), React__default.Children.map(children, (child, index) => {
652
+ return !isElement(child) ? null : /*#__PURE__*/React__default.createElement(TabContext.Provider, {
653
+ value: {
654
+ index,
655
+ hasSecondaryLabel: false
656
+ }
657
+ }, /*#__PURE__*/React__default.cloneElement(child, {
658
+ ref: node => {
659
+ tabs.current[index] = node;
660
+ }
661
+ }));
662
+ })), isOverflowingBottom && /*#__PURE__*/React__default.createElement("div", {
663
+ className: `${prefix}--tab--list-gradient_bottom`
664
+ }));
665
+ }
666
+ TabListVertical.propTypes = {
481
667
  /**
482
668
  * Specify whether the content tab should be activated automatically or
483
669
  * manually
@@ -497,7 +683,7 @@ TabList.propTypes = {
497
683
  * Specify an optional className to be added to the container node
498
684
  */
499
685
  className: PropTypes.string
500
- });
686
+ };
501
687
 
502
688
  /**
503
689
  * Helper function to set up the behavior when a button is "long pressed".
@@ -603,7 +789,7 @@ const Tab = /*#__PURE__*/forwardRef(function Tab(_ref8, forwardRef) {
603
789
  useEvent(dismissIconRef, 'mouseleave', onDismissIconMouseLeave);
604
790
  useLayoutEffect(() => {
605
791
  function handler() {
606
- const elementTabId = document.getElementById(`${id}`);
792
+ const elementTabId = document.getElementById(`${id}`) || tabRef.current;
607
793
  const newElement = elementTabId?.getElementsByClassName(`${prefix}--tabs__nav-item-label`)[0];
608
794
  isEllipsisActive(newElement);
609
795
  }
@@ -986,4 +1172,4 @@ TabPanels.propTypes = {
986
1172
  children: PropTypes.node
987
1173
  };
988
1174
 
989
- export { IconTab, Tab, TabList, TabPanel, TabPanels, Tabs };
1175
+ export { IconTab, Tab, TabList, TabListVertical, TabPanel, TabPanels, Tabs, TabsVertical };
@@ -7,4 +7,4 @@
7
7
  import { Tabs } from './Tabs';
8
8
  export default Tabs;
9
9
  export { default as TabsSkeleton } from './Tabs.Skeleton';
10
- export { TabPanels, type TabPanelsProps, TabPanel, type TabPanelProps, TabList, type TabListProps, IconTab, type IconTabProps, Tabs, type TabsProps, } from './Tabs';
10
+ export { TabPanels, type TabPanelsProps, TabPanel, type TabPanelProps, TabList, type TabListProps, TabListVertical, type TabListVerticalProps, IconTab, type IconTabProps, Tabs, type TabsProps, TabsVertical, type TabsVerticalProps, } from './Tabs';
@@ -390,6 +390,7 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
390
390
  const [interactive, setInteractive] = useState(true);
391
391
  const aboveTheFold = useRef(null);
392
392
  const belowTheFold = useRef(null);
393
+ const chevronInteractiveRef = useRef(null);
393
394
  const tileContent = useRef(null);
394
395
  const tile = useRef(null);
395
396
  const ref = useMergedRefs([forwardRef, tile]);
@@ -421,7 +422,7 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
421
422
  setMaxHeight();
422
423
  }
423
424
  function handleKeyUp(evt) {
424
- if (evt.target !== tile.current) {
425
+ if (evt.target !== tile.current && evt.target !== chevronInteractiveRef.current) {
425
426
  if (matches(evt, [Enter, Space])) {
426
427
  evt.preventDefault();
427
428
  }
@@ -515,6 +516,7 @@ const ExpandableTile = /*#__PURE__*/React__default.forwardRef(function Expandabl
515
516
  onKeyUp: composeEventHandlers([onKeyUp, handleKeyUp]),
516
517
  onClick: composeEventHandlers([onClick, handleClick]),
517
518
  "aria-label": isExpanded ? tileExpandedIconText : tileCollapsedIconText,
519
+ ref: chevronInteractiveRef,
518
520
  className: chevronInteractiveClassNames
519
521
  }, _ChevronDown || (_ChevronDown = /*#__PURE__*/React__default.createElement(ChevronDown, null))), /*#__PURE__*/React__default.createElement("div", {
520
522
  ref: belowTheFold,
package/es/index.js CHANGED
@@ -107,7 +107,7 @@ export { StructuredListBody, StructuredListCell, StructuredListHead, StructuredL
107
107
  export { default as StructuredListSkeleton } from './components/StructuredList/StructuredList.Skeleton.js';
108
108
  export { default as Switch } from './components/Switch/Switch.js';
109
109
  export { default as IconSwitch } from './components/Switch/IconSwitch.js';
110
- export { IconTab, Tab, TabList, TabPanel, TabPanels, Tabs } from './components/Tabs/Tabs.js';
110
+ export { IconTab, Tab, TabList, TabListVertical, TabPanel, TabPanels, Tabs, TabsVertical } from './components/Tabs/Tabs.js';
111
111
  export { default as TabContent } from './components/TabContent/TabContent.js';
112
112
  export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
113
113
  export { default as Tag } from './components/Tag/Tag.js';
@@ -227,7 +227,8 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
227
227
  setHighlightedIndex(changes.selectedItem);
228
228
  if (onChange) {
229
229
  onChange({
230
- selectedItem: changes.selectedItem
230
+ selectedItem: changes.selectedItem,
231
+ inputValue
231
232
  });
232
233
  }
233
234
  return changes;
@@ -440,6 +441,16 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
440
441
  if (highlightedIndex !== -1) {
441
442
  selectItem(filterItems(items, itemToString, inputValue)[highlightedIndex]);
442
443
  }
444
+
445
+ // Since `onChange` does not normally fire when the menu is closed, we should
446
+ // manually fire it when `allowCustomValue` is provided, the menu is closing,
447
+ // and there is a value.
448
+ if (allowCustomValue && isOpen && inputValue) {
449
+ onChange({
450
+ selectedItem,
451
+ inputValue
452
+ });
453
+ }
443
454
  event.preventDownshiftDefault = true;
444
455
  event?.persist?.();
445
456
  }
@@ -25,6 +25,7 @@ var requiredIfGivenPropIsTruthy = require('../../prop-types/requiredIfGivenPropI
25
25
  var wrapFocus = require('../../internal/wrapFocus.js');
26
26
  var usePrefix = require('../../internal/usePrefix.js');
27
27
  var index$1 = require('../FeatureFlags/index.js');
28
+ var events = require('../../tools/events.js');
28
29
  var match = require('../../internal/keyboard/match.js');
29
30
  var keys = require('../../internal/keyboard/keys.js');
30
31
 
@@ -159,7 +160,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
159
160
  }
160
161
  onKeyDown?.(event);
161
162
  }
162
- function handleMousedown(evt) {
163
+ function handleOnClick(evt) {
163
164
  const target = evt.target;
164
165
  evt.stopPropagation();
165
166
  if (!preventCloseOnClickOutside && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
@@ -267,7 +268,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
267
268
  ref: ref,
268
269
  "aria-hidden": !open,
269
270
  onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
270
- onMouseDown: handleMousedown,
271
+ onClick: events.composeEventHandlers([rest?.onClick, handleOnClick]),
271
272
  onKeyDown: handleKeyDown,
272
273
  className: modalClass
273
274
  }), /*#__PURE__*/React__default["default"].createElement("div", {
@@ -33,14 +33,16 @@ var carbonFlatpickrRangePlugin = (config => {
33
33
  origSetDate.call(this, dates, triggerChange, format);
34
34
  // If `triggerChange` is `true`, `onValueUpdate` Flatpickr event is fired
35
35
  // where Flatpickr's range plugin takes care of fixing the first `<input>`
36
- if (!triggerChange) {
36
+ if (!triggerChange && dates.length === 2) {
37
37
  const {
38
- _input: inputDates
38
+ _input: inputFrom
39
39
  } = fp;
40
- const inputDatesArray = inputDates.value.split(' ');
41
- [inputDatesArray[0], inputDatesArray[2]].forEach((input, i) => {
40
+ const {
41
+ input: inputTo
42
+ } = config;
43
+ [inputFrom, inputTo].forEach((input, i) => {
42
44
  if (input) {
43
- input = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
45
+ input.value = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
44
46
  }
45
47
  });
46
48
  }
@@ -30,6 +30,7 @@ var index$2 = require('../IconButton/index.js');
30
30
  var noopFn = require('../../internal/noopFn.js');
31
31
  require('../Text/index.js');
32
32
  var index = require('../FeatureFlags/index.js');
33
+ var events = require('../../tools/events.js');
33
34
  var Text = require('../Text/Text.js');
34
35
  var match = require('../../internal/keyboard/match.js');
35
36
  var keys = require('../../internal/keyboard/keys.js');
@@ -117,7 +118,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
117
118
  }
118
119
  }
119
120
  }
120
- function handleMousedown(evt) {
121
+ function handleOnClick(evt) {
121
122
  const target = evt.target;
122
123
  evt.stopPropagation();
123
124
  if (!preventCloseOnClickOutside && !wrapFocus.elementOrParentIsFloatingMenu(target, selectorsFloatingMenus) && innerModal.current && !innerModal.current.contains(target)) {
@@ -316,7 +317,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
316
317
  return /*#__PURE__*/React__default["default"].createElement(index$1.Layer, _rollupPluginBabelHelpers["extends"]({}, rest, {
317
318
  level: 0,
318
319
  onKeyDown: handleKeyDown,
319
- onMouseDown: handleMousedown,
320
+ onClick: events.composeEventHandlers([rest?.onClick, handleOnClick]),
320
321
  onBlur: !focusTrapWithoutSentinels ? handleBlur : () => {},
321
322
  className: modalClasses,
322
323
  role: "presentation",
@@ -36,7 +36,7 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
36
36
  */
37
37
  disabled?: boolean;
38
38
  /**
39
- * The callback to format the label associated with the minimum/maximum value.
39
+ * The callback to format the label associated with the minimum/maximum value and the value tooltip when hideTextInput is true.
40
40
  */
41
41
  formatLabel?: (value: number, label: string | undefined) => string;
42
42
  /**
@@ -1103,13 +1103,14 @@ class Slider extends React.PureComponent {
1103
1103
  }, other), /*#__PURE__*/React__default["default"].createElement(ThumbWrapper, _rollupPluginBabelHelpers["extends"]({
1104
1104
  hasTooltip: hideTextInput,
1105
1105
  className: lowerThumbWrapperClasses,
1106
- label: `${value}`,
1106
+ label: `${formatLabel(value, '')}`,
1107
1107
  align: "top"
1108
1108
  }, lowerThumbWrapperProps), /*#__PURE__*/React__default["default"].createElement("div", {
1109
1109
  className: lowerThumbClasses,
1110
1110
  role: "slider",
1111
1111
  id: twoHandles ? undefined : id,
1112
1112
  tabIndex: !readOnly ? 0 : -1,
1113
+ "aria-valuetext": `${formatLabel(value, '')}`,
1113
1114
  "aria-valuemax": twoHandles ? valueUpper : max,
1114
1115
  "aria-valuemin": min,
1115
1116
  "aria-valuenow": value,
@@ -1122,7 +1123,7 @@ class Slider extends React.PureComponent {
1122
1123
  }, twoHandles && !isRtl ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, _LowerHandle || (_LowerHandle = /*#__PURE__*/React__default["default"].createElement(SliderHandles.LowerHandle, null)), _LowerHandleFocus || (_LowerHandleFocus = /*#__PURE__*/React__default["default"].createElement(SliderHandles.LowerHandleFocus, null))) : twoHandles && isRtl ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, _UpperHandle || (_UpperHandle = /*#__PURE__*/React__default["default"].createElement(SliderHandles.UpperHandle, null)), _UpperHandleFocus || (_UpperHandleFocus = /*#__PURE__*/React__default["default"].createElement(SliderHandles.UpperHandleFocus, null))) : undefined)), twoHandles ? /*#__PURE__*/React__default["default"].createElement(ThumbWrapper, _rollupPluginBabelHelpers["extends"]({
1123
1124
  hasTooltip: hideTextInput,
1124
1125
  className: upperThumbWrapperClasses,
1125
- label: `${valueUpper}`,
1126
+ label: `${formatLabel(valueUpper || 0, '')}`,
1126
1127
  align: "top"
1127
1128
  }, upperThumbWrapperProps), /*#__PURE__*/React__default["default"].createElement("div", {
1128
1129
  className: upperThumbClasses,