@carbon/react 1.112.0-rc.0 → 1.112.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.
@@ -12,7 +12,7 @@ import { deprecate } from "../../prop-types/deprecate.js";
12
12
  import { isComponentElement } from "../../internal/utils.js";
13
13
  import DatePickerInput_default from "../DatePickerInput/index.js";
14
14
  import { appendToPlugin } from "./plugins/appendToPlugin.js";
15
- import fixEventsPlugin from "./plugins/fixEventsPlugin.js";
15
+ import { fixEventsPlugin } from "./plugins/fixEventsPlugin.js";
16
16
  import { isEmptyDateValue } from "./utils.js";
17
17
  import { rangePlugin } from "./plugins/rangePlugin.js";
18
18
  import { useSavedCallback } from "../../internal/useSavedCallback.js";
@@ -283,7 +283,6 @@ const DatePicker = forwardRef((props, ref) => {
283
283
  fixEventsPlugin({
284
284
  inputFrom: startInputField.current,
285
285
  inputTo: endInputField.current,
286
- lastStartValue,
287
286
  container: wrapperRef.current
288
287
  })
289
288
  ],
@@ -8,11 +8,8 @@ import type { Plugin } from 'flatpickr/dist/types/options';
8
8
  interface FixEventsPluginConfig {
9
9
  inputFrom: HTMLInputElement;
10
10
  inputTo?: HTMLInputElement | null;
11
- lastStartValue: {
12
- current: string;
13
- };
14
11
  container?: HTMLElement | null;
15
12
  }
16
13
  type FixEventsPlugin = (config: FixEventsPluginConfig) => Plugin;
17
- declare const fixEventsPlugin: FixEventsPlugin;
18
- export default fixEventsPlugin;
14
+ export declare const fixEventsPlugin: FixEventsPlugin;
15
+ export {};
@@ -9,14 +9,13 @@ import { ArrowDown, Enter } from "../../../internal/keyboard/keys.js";
9
9
  import { match } from "../../../internal/keyboard/match.js";
10
10
  //#region src/components/DatePicker/plugins/fixEventsPlugin.ts
11
11
  const fixEventsPlugin = (config) => (fp) => {
12
- const { inputFrom, inputTo, lastStartValue, container } = config;
12
+ const { inputFrom, inputTo, container } = config;
13
13
  let mouseDownInside = false;
14
- const getEventPath = (event) => typeof event.composedPath === "function" ? event.composedPath() : [];
15
14
  const isEventInside = (event) => {
16
- const path = getEventPath(event);
15
+ const path = event.composedPath();
17
16
  const { target } = event;
18
17
  if (!(target instanceof Node)) return false;
19
- return Boolean(container && (path.includes(container) || container.contains(target)) || fp.calendarContainer && (path.includes(fp.calendarContainer) || fp.calendarContainer.contains(target)) || inputFrom && (path.includes(inputFrom) || inputFrom.contains(target)) || inputTo && (path.includes(inputTo) || inputTo.contains(target)));
18
+ return Boolean(container && (path.includes(container) || container.contains(target)) || path.includes(fp.calendarContainer) || fp.calendarContainer.contains(target) || inputFrom && (path.includes(inputFrom) || inputFrom.contains(target)) || inputTo && (path.includes(inputTo) || inputTo.contains(target)));
20
19
  };
21
20
  /**
22
21
  * Handles `click` outside to close calendar
@@ -62,6 +61,7 @@ const fixEventsPlugin = (config) => (fp) => {
62
61
  }
63
62
  };
64
63
  const parseDateWithFormat = (dateStr) => fp.parseDate(dateStr, fp.config.dateFormat);
64
+ const isValidDate = (date) => date?.toString() !== "Invalid Date";
65
65
  /**
66
66
  * Handles `blur` event.
67
67
  *
@@ -78,16 +78,9 @@ const fixEventsPlugin = (config) => (fp) => {
78
78
  const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
79
79
  if (selectedToDate && currentValueToDate && selectedToDate !== currentValueToDate) fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
80
80
  }
81
- const isValidDate = (date) => date?.toString() !== "Invalid Date";
82
81
  if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
83
82
  if (isValidDate(parseDateWithFormat(inputTo.value))) fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
84
83
  }
85
- if (inputTo === target && !inputFrom.value && lastStartValue.current) {
86
- if (isValidDate(parseDateWithFormat(lastStartValue.current))) {
87
- inputFrom.value = lastStartValue.current;
88
- if (inputTo.value) fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
89
- }
90
- }
91
84
  };
92
85
  /**
93
86
  * Releases event listeners used in this Flatpickr plugin.
@@ -128,4 +121,4 @@ const fixEventsPlugin = (config) => (fp) => {
128
121
  };
129
122
  };
130
123
  //#endregion
131
- export { fixEventsPlugin as default };
124
+ export { fixEventsPlugin };
@@ -9,6 +9,7 @@ import { type ReactNode } from 'react';
9
9
  export interface FeatureFlagsProps {
10
10
  children?: ReactNode;
11
11
  flags?: Record<string, boolean>;
12
+ enableV12Release?: boolean;
12
13
  enableV12TileDefaultIcons?: boolean;
13
14
  enableV12TileRadioIcons?: boolean;
14
15
  enableV12Overflowmenu?: boolean;
@@ -26,13 +27,14 @@ export interface FeatureFlagsProps {
26
27
  * a feature flag is enabled or disabled in a given React tree
27
28
  */
28
29
  export declare const FeatureFlags: {
29
- ({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): import("react/jsx-runtime").JSX.Element;
30
+ ({ children, flags, enableV12Release, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): import("react/jsx-runtime").JSX.Element;
30
31
  propTypes: {
31
32
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
32
33
  /**
33
34
  * Provide the feature flags to enabled or disabled in the current Rea,ct tree
34
35
  */
35
36
  flags: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
37
+ enableV12Release: PropTypes.Requireable<boolean>;
36
38
  enableV12TileDefaultIcons: PropTypes.Requireable<boolean>;
37
39
  enableV12TileRadioIcons: PropTypes.Requireable<boolean>;
38
40
  enableV12Overflowmenu: PropTypes.Requireable<boolean>;
@@ -23,6 +23,7 @@ import { jsx } from "react/jsx-runtime";
23
23
  */
24
24
  const FeatureFlagContext = createContext(FeatureFlags);
25
25
  const PROP_TO_FLAG = {
26
+ enableV12Release: "enable-v12-release",
26
27
  enableV12TileDefaultIcons: "enable-v12-tile-default-icons",
27
28
  enableV12TileRadioIcons: "enable-v12-tile-radio-icons",
28
29
  enableV12Overflowmenu: "enable-v12-overflowmenu",
@@ -39,10 +40,11 @@ const PROP_TO_FLAG = {
39
40
  * along with the current `FeatureFlagContext` to provide consumers to check if
40
41
  * a feature flag is enabled or disabled in a given React tree
41
42
  */
42
- const FeatureFlags$1 = ({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence }) => {
43
+ const FeatureFlags$1 = ({ children, flags, enableV12Release, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence }) => {
43
44
  const parentScope = useContext(FeatureFlagContext);
44
45
  const scope = useMemo(() => {
45
46
  const flagProps = {
47
+ enableV12Release,
46
48
  enableV12TileDefaultIcons,
47
49
  enableV12TileRadioIcons,
48
50
  enableV12Overflowmenu,
@@ -64,6 +66,7 @@ const FeatureFlags$1 = ({ children, flags, enableV12TileDefaultIcons, enableV12T
64
66
  scope.mergeWithScope(parentScope);
65
67
  return scope;
66
68
  }, [
69
+ enableV12Release,
67
70
  enableV12TileDefaultIcons,
68
71
  enableV12TileRadioIcons,
69
72
  enableV12Overflowmenu,
@@ -88,6 +91,7 @@ FeatureFlags$1.propTypes = {
88
91
  * Provide the feature flags to enabled or disabled in the current Rea,ct tree
89
92
  */
90
93
  flags: deprecate(PropTypes.objectOf(PropTypes.bool), "The `flags` prop for `FeatureFlag` has been deprecated. Please run the `featureflag-deprecate-flags-prop` codemod to migrate to individual boolean props.npx @carbon/upgrade migrate featureflag-deprecate-flags-prop --write"),
94
+ enableV12Release: PropTypes.bool,
91
95
  enableV12TileDefaultIcons: PropTypes.bool,
92
96
  enableV12TileRadioIcons: PropTypes.bool,
93
97
  enableV12Overflowmenu: PropTypes.bool,
@@ -56,6 +56,11 @@ export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
56
56
  * clear selection element fires a mouseup event
57
57
  */
58
58
  onMouseUp?: React.MouseEventHandler<HTMLButtonElement>;
59
+ /**
60
+ * Specify an optional `onMouseDown` handler that is called when the underlying
61
+ * clear selection element fires a mousedown event
62
+ */
63
+ onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
59
64
  }
60
65
  declare function ListBoxSelection({ clearSelection, selectionCount, translateWithId: t, disabled, readOnly, onClearSelection, ...rest }: ListBoxSelectionProps): import("react/jsx-runtime").JSX.Element;
61
66
  declare namespace ListBoxSelection {
@@ -84,8 +89,13 @@ declare namespace ListBoxSelection {
84
89
  */
85
90
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
86
91
  /**
87
- * Specify an optional `onClick` handler that is called when the underlying
88
- * clear selection element is clicked
92
+ * Specify an optional `onMouseDown` handler that is called when the underlying
93
+ * clear selection element fires a mousedown event
94
+ */
95
+ onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
96
+ /**
97
+ * Specify an optional `onMouseUp` handler that is called when the underlying
98
+ * clear selection element fires a mouseup event
89
99
  */
90
100
  onMouseUp: PropTypes.Requireable<(...args: any[]) => any>;
91
101
  /**
@@ -106,8 +106,13 @@ ListBoxSelection.propTypes = {
106
106
  */
107
107
  onClick: PropTypes.func,
108
108
  /**
109
- * Specify an optional `onClick` handler that is called when the underlying
110
- * clear selection element is clicked
109
+ * Specify an optional `onMouseDown` handler that is called when the underlying
110
+ * clear selection element fires a mousedown event
111
+ */
112
+ onMouseDown: PropTypes.func,
113
+ /**
114
+ * Specify an optional `onMouseUp` handler that is called when the underlying
115
+ * clear selection element fires a mouseup event
111
116
  */
112
117
  onMouseUp: PropTypes.func,
113
118
  /**
@@ -302,8 +302,8 @@ const ModalDialog = React.forwardRef(function ModalDialog({ "aria-label": ariaLa
302
302
  focusAfterCloseRef: launcherButtonRef,
303
303
  modal: true,
304
304
  ref: innerModal,
305
- role: isAlertDialog ? "alertdialog" : "",
306
- "aria-describedby": isAlertDialog ? modalBodyId : "",
305
+ role: isAlertDialog ? "alertdialog" : void 0,
306
+ "aria-describedby": isAlertDialog ? modalBodyId : void 0,
307
307
  className: containerClasses,
308
308
  "aria-label": ariaLabel,
309
309
  "data-exiting": presenceContext?.isExiting || void 0,
@@ -44,7 +44,7 @@ import isEqual from "react-fast-compare";
44
44
  * This source code is licensed under the Apache-2.0 license found in the
45
45
  * LICENSE file in the root directory of this source tree.
46
46
  */
47
- const { InputBlur, InputKeyDownEnter, ItemClick, MenuMouseLeave, InputKeyDownArrowUp, InputKeyDownArrowDown, ItemMouseMove, InputClick, ToggleButtonClick, FunctionToggleMenu, InputChange, InputKeyDownEscape, FunctionSetHighlightedIndex } = useCombobox.stateChangeTypes;
47
+ const { InputBlur, InputKeyDownEnter, ItemClick, MenuMouseLeave, InputKeyDownArrowUp, InputKeyDownArrowDown, ItemMouseMove, InputClick, ToggleButtonClick, FunctionToggleMenu, InputChange, InputKeyDownEscape, FunctionSetHighlightedIndex, FunctionSetInputValue } = useCombobox.stateChangeTypes;
48
48
  const { SelectedItemKeyDownBackspace, SelectedItemKeyDownDelete, DropdownKeyDownBackspace, FunctionRemoveSelectedItem } = useMultipleSelection.stateChangeTypes;
49
49
  const FilterableMultiSelect = forwardRef(function FilterableMultiSelect({ autoAlign = false, className: containerClassName, clearSelectionDescription = "Total items selected: ", clearSelectionText = "To clear selection, press Delete or Backspace", compareItems = defaultCompareItems, decorator, direction = "bottom", disabled = false, downshiftProps, filterItems = defaultFilterItems, helperText, hideLabel, id, initialSelectedItems = [], invalid = false, invalidText, items, itemToElement: ItemToElement, itemToString = defaultItemToString, light, locale = "en", onInputValueChange, open = false, onChange, onMenuChange, placeholder, readOnly, titleText, type, selectionFeedback = "top-after-reopen", selectedItems: selected, size: size$1, sortItems = defaultSortItems, translateWithId, useTitleInItem, warn = false, warnText, slug, inputProps }, ref) {
50
50
  const { isFluid } = useContext(FormContext);
@@ -364,8 +364,15 @@ const FilterableMultiSelect = forwardRef(function FilterableMultiSelect({ autoAl
364
364
  });
365
365
  function clearInputValue(event) {
366
366
  const value = textInput.current?.value;
367
- if (value?.length === 1 || event && "key" in event && match(event, Escape)) setInputValue("");
368
- else setInputValue(value ?? "");
367
+ const isEscape = event && "key" in event && match(event, Escape);
368
+ const isClick = value && !(event && "key" in event);
369
+ if (value?.length === 1 || isEscape || isClick) {
370
+ setInputValue("");
371
+ onInputValueChange?.({
372
+ inputValue: "",
373
+ type: FunctionSetInputValue
374
+ });
375
+ } else setInputValue(value ?? "");
369
376
  if (textInput.current) textInput.current.focus();
370
377
  }
371
378
  const candidate = slug ?? decorator;
@@ -508,6 +515,9 @@ const FilterableMultiSelect = forwardRef(function FilterableMultiSelect({ autoAl
508
515
  disabled,
509
516
  translateWithId,
510
517
  readOnly,
518
+ onMouseDown: (event) => {
519
+ event.preventDefault();
520
+ },
511
521
  onMouseUp: (event) => {
512
522
  event.stopPropagation();
513
523
  }
@@ -17,6 +17,7 @@ merge({
17
17
  "enable-css-custom-properties": true,
18
18
  "enable-css-grid": true,
19
19
  "enable-v11-release": true,
20
+ "enable-v12-release": false,
20
21
  "enable-experimental-tile-contrast": false,
21
22
  "enable-tile-contrast": false,
22
23
  "enable-v12-tile-radio-icons": false,
@@ -286,10 +286,9 @@ const DatePicker = (0, react.forwardRef)((props, ref) => {
286
286
  classFlatpickrCurrentMonth: "cur-month",
287
287
  locale
288
288
  }),
289
- require_fixEventsPlugin.default({
289
+ require_fixEventsPlugin.fixEventsPlugin({
290
290
  inputFrom: startInputField.current,
291
291
  inputTo: endInputField.current,
292
- lastStartValue,
293
292
  container: wrapperRef.current
294
293
  })
295
294
  ],
@@ -8,11 +8,8 @@ import type { Plugin } from 'flatpickr/dist/types/options';
8
8
  interface FixEventsPluginConfig {
9
9
  inputFrom: HTMLInputElement;
10
10
  inputTo?: HTMLInputElement | null;
11
- lastStartValue: {
12
- current: string;
13
- };
14
11
  container?: HTMLElement | null;
15
12
  }
16
13
  type FixEventsPlugin = (config: FixEventsPluginConfig) => Plugin;
17
- declare const fixEventsPlugin: FixEventsPlugin;
18
- export default fixEventsPlugin;
14
+ export declare const fixEventsPlugin: FixEventsPlugin;
15
+ export {};
@@ -9,14 +9,13 @@ const require_keys = require("../../../internal/keyboard/keys.js");
9
9
  const require_match = require("../../../internal/keyboard/match.js");
10
10
  //#region src/components/DatePicker/plugins/fixEventsPlugin.ts
11
11
  const fixEventsPlugin = (config) => (fp) => {
12
- const { inputFrom, inputTo, lastStartValue, container } = config;
12
+ const { inputFrom, inputTo, container } = config;
13
13
  let mouseDownInside = false;
14
- const getEventPath = (event) => typeof event.composedPath === "function" ? event.composedPath() : [];
15
14
  const isEventInside = (event) => {
16
- const path = getEventPath(event);
15
+ const path = event.composedPath();
17
16
  const { target } = event;
18
17
  if (!(target instanceof Node)) return false;
19
- return Boolean(container && (path.includes(container) || container.contains(target)) || fp.calendarContainer && (path.includes(fp.calendarContainer) || fp.calendarContainer.contains(target)) || inputFrom && (path.includes(inputFrom) || inputFrom.contains(target)) || inputTo && (path.includes(inputTo) || inputTo.contains(target)));
18
+ return Boolean(container && (path.includes(container) || container.contains(target)) || path.includes(fp.calendarContainer) || fp.calendarContainer.contains(target) || inputFrom && (path.includes(inputFrom) || inputFrom.contains(target)) || inputTo && (path.includes(inputTo) || inputTo.contains(target)));
20
19
  };
21
20
  /**
22
21
  * Handles `click` outside to close calendar
@@ -62,6 +61,7 @@ const fixEventsPlugin = (config) => (fp) => {
62
61
  }
63
62
  };
64
63
  const parseDateWithFormat = (dateStr) => fp.parseDate(dateStr, fp.config.dateFormat);
64
+ const isValidDate = (date) => date?.toString() !== "Invalid Date";
65
65
  /**
66
66
  * Handles `blur` event.
67
67
  *
@@ -78,16 +78,9 @@ const fixEventsPlugin = (config) => (fp) => {
78
78
  const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
79
79
  if (selectedToDate && currentValueToDate && selectedToDate !== currentValueToDate) fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
80
80
  }
81
- const isValidDate = (date) => date?.toString() !== "Invalid Date";
82
81
  if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
83
82
  if (isValidDate(parseDateWithFormat(inputTo.value))) fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
84
83
  }
85
- if (inputTo === target && !inputFrom.value && lastStartValue.current) {
86
- if (isValidDate(parseDateWithFormat(lastStartValue.current))) {
87
- inputFrom.value = lastStartValue.current;
88
- if (inputTo.value) fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
89
- }
90
- }
91
84
  };
92
85
  /**
93
86
  * Releases event listeners used in this Flatpickr plugin.
@@ -128,4 +121,4 @@ const fixEventsPlugin = (config) => (fp) => {
128
121
  };
129
122
  };
130
123
  //#endregion
131
- exports.default = fixEventsPlugin;
124
+ exports.fixEventsPlugin = fixEventsPlugin;
@@ -9,6 +9,7 @@ import { type ReactNode } from 'react';
9
9
  export interface FeatureFlagsProps {
10
10
  children?: ReactNode;
11
11
  flags?: Record<string, boolean>;
12
+ enableV12Release?: boolean;
12
13
  enableV12TileDefaultIcons?: boolean;
13
14
  enableV12TileRadioIcons?: boolean;
14
15
  enableV12Overflowmenu?: boolean;
@@ -26,13 +27,14 @@ export interface FeatureFlagsProps {
26
27
  * a feature flag is enabled or disabled in a given React tree
27
28
  */
28
29
  export declare const FeatureFlags: {
29
- ({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): import("react/jsx-runtime").JSX.Element;
30
+ ({ children, flags, enableV12Release, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): import("react/jsx-runtime").JSX.Element;
30
31
  propTypes: {
31
32
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
32
33
  /**
33
34
  * Provide the feature flags to enabled or disabled in the current Rea,ct tree
34
35
  */
35
36
  flags: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
37
+ enableV12Release: PropTypes.Requireable<boolean>;
36
38
  enableV12TileDefaultIcons: PropTypes.Requireable<boolean>;
37
39
  enableV12TileRadioIcons: PropTypes.Requireable<boolean>;
38
40
  enableV12Overflowmenu: PropTypes.Requireable<boolean>;
@@ -26,6 +26,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
26
26
  */
27
27
  const FeatureFlagContext = (0, react.createContext)(_carbon_feature_flags.FeatureFlags);
28
28
  const PROP_TO_FLAG = {
29
+ enableV12Release: "enable-v12-release",
29
30
  enableV12TileDefaultIcons: "enable-v12-tile-default-icons",
30
31
  enableV12TileRadioIcons: "enable-v12-tile-radio-icons",
31
32
  enableV12Overflowmenu: "enable-v12-overflowmenu",
@@ -42,10 +43,11 @@ const PROP_TO_FLAG = {
42
43
  * along with the current `FeatureFlagContext` to provide consumers to check if
43
44
  * a feature flag is enabled or disabled in a given React tree
44
45
  */
45
- const FeatureFlags = ({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence }) => {
46
+ const FeatureFlags = ({ children, flags, enableV12Release, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence }) => {
46
47
  const parentScope = (0, react.useContext)(FeatureFlagContext);
47
48
  const scope = (0, react.useMemo)(() => {
48
49
  const flagProps = {
50
+ enableV12Release,
49
51
  enableV12TileDefaultIcons,
50
52
  enableV12TileRadioIcons,
51
53
  enableV12Overflowmenu,
@@ -67,6 +69,7 @@ const FeatureFlags = ({ children, flags, enableV12TileDefaultIcons, enableV12Til
67
69
  scope.mergeWithScope(parentScope);
68
70
  return scope;
69
71
  }, [
72
+ enableV12Release,
70
73
  enableV12TileDefaultIcons,
71
74
  enableV12TileRadioIcons,
72
75
  enableV12Overflowmenu,
@@ -91,6 +94,7 @@ FeatureFlags.propTypes = {
91
94
  * Provide the feature flags to enabled or disabled in the current Rea,ct tree
92
95
  */
93
96
  flags: require_deprecate.deprecate(prop_types.default.objectOf(prop_types.default.bool), "The `flags` prop for `FeatureFlag` has been deprecated. Please run the `featureflag-deprecate-flags-prop` codemod to migrate to individual boolean props.npx @carbon/upgrade migrate featureflag-deprecate-flags-prop --write"),
97
+ enableV12Release: prop_types.default.bool,
94
98
  enableV12TileDefaultIcons: prop_types.default.bool,
95
99
  enableV12TileRadioIcons: prop_types.default.bool,
96
100
  enableV12Overflowmenu: prop_types.default.bool,
@@ -56,6 +56,11 @@ export interface ListBoxSelectionProps extends TranslateWithId<TranslationKey> {
56
56
  * clear selection element fires a mouseup event
57
57
  */
58
58
  onMouseUp?: React.MouseEventHandler<HTMLButtonElement>;
59
+ /**
60
+ * Specify an optional `onMouseDown` handler that is called when the underlying
61
+ * clear selection element fires a mousedown event
62
+ */
63
+ onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
59
64
  }
60
65
  declare function ListBoxSelection({ clearSelection, selectionCount, translateWithId: t, disabled, readOnly, onClearSelection, ...rest }: ListBoxSelectionProps): import("react/jsx-runtime").JSX.Element;
61
66
  declare namespace ListBoxSelection {
@@ -84,8 +89,13 @@ declare namespace ListBoxSelection {
84
89
  */
85
90
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
86
91
  /**
87
- * Specify an optional `onClick` handler that is called when the underlying
88
- * clear selection element is clicked
92
+ * Specify an optional `onMouseDown` handler that is called when the underlying
93
+ * clear selection element fires a mousedown event
94
+ */
95
+ onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
96
+ /**
97
+ * Specify an optional `onMouseUp` handler that is called when the underlying
98
+ * clear selection element fires a mouseup event
89
99
  */
90
100
  onMouseUp: PropTypes.Requireable<(...args: any[]) => any>;
91
101
  /**
@@ -110,8 +110,13 @@ ListBoxSelection.propTypes = {
110
110
  */
111
111
  onClick: prop_types.default.func,
112
112
  /**
113
- * Specify an optional `onClick` handler that is called when the underlying
114
- * clear selection element is clicked
113
+ * Specify an optional `onMouseDown` handler that is called when the underlying
114
+ * clear selection element fires a mousedown event
115
+ */
116
+ onMouseDown: prop_types.default.func,
117
+ /**
118
+ * Specify an optional `onMouseUp` handler that is called when the underlying
119
+ * clear selection element fires a mouseup event
115
120
  */
116
121
  onMouseUp: prop_types.default.func,
117
122
  /**
@@ -306,8 +306,8 @@ const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label"
306
306
  focusAfterCloseRef: launcherButtonRef,
307
307
  modal: true,
308
308
  ref: innerModal,
309
- role: isAlertDialog ? "alertdialog" : "",
310
- "aria-describedby": isAlertDialog ? modalBodyId : "",
309
+ role: isAlertDialog ? "alertdialog" : void 0,
310
+ "aria-describedby": isAlertDialog ? modalBodyId : void 0,
311
311
  className: containerClasses,
312
312
  "aria-label": ariaLabel,
313
313
  "data-exiting": presenceContext?.isExiting || void 0,
@@ -50,7 +50,7 @@ react_fast_compare = require_runtime.__toESM(react_fast_compare);
50
50
  * This source code is licensed under the Apache-2.0 license found in the
51
51
  * LICENSE file in the root directory of this source tree.
52
52
  */
53
- const { InputBlur, InputKeyDownEnter, ItemClick, MenuMouseLeave, InputKeyDownArrowUp, InputKeyDownArrowDown, ItemMouseMove, InputClick, ToggleButtonClick, FunctionToggleMenu, InputChange, InputKeyDownEscape, FunctionSetHighlightedIndex } = downshift.useCombobox.stateChangeTypes;
53
+ const { InputBlur, InputKeyDownEnter, ItemClick, MenuMouseLeave, InputKeyDownArrowUp, InputKeyDownArrowDown, ItemMouseMove, InputClick, ToggleButtonClick, FunctionToggleMenu, InputChange, InputKeyDownEscape, FunctionSetHighlightedIndex, FunctionSetInputValue } = downshift.useCombobox.stateChangeTypes;
54
54
  const { SelectedItemKeyDownBackspace, SelectedItemKeyDownDelete, DropdownKeyDownBackspace, FunctionRemoveSelectedItem } = downshift.useMultipleSelection.stateChangeTypes;
55
55
  const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSelect({ autoAlign = false, className: containerClassName, clearSelectionDescription = "Total items selected: ", clearSelectionText = "To clear selection, press Delete or Backspace", compareItems = require_sorting.defaultCompareItems, decorator, direction = "bottom", disabled = false, downshiftProps, filterItems = require_filter.defaultFilterItems, helperText, hideLabel, id, initialSelectedItems = [], invalid = false, invalidText, items, itemToElement: ItemToElement, itemToString = require_defaultItemToString.defaultItemToString, light, locale = "en", onInputValueChange, open = false, onChange, onMenuChange, placeholder, readOnly, titleText, type, selectionFeedback = "top-after-reopen", selectedItems: selected, size, sortItems = require_sorting.defaultSortItems, translateWithId, useTitleInItem, warn = false, warnText, slug, inputProps }, ref) {
56
56
  const { isFluid } = (0, react.useContext)(require_FormContext.FormContext);
@@ -370,8 +370,15 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
370
370
  });
371
371
  function clearInputValue(event) {
372
372
  const value = textInput.current?.value;
373
- if (value?.length === 1 || event && "key" in event && require_match.match(event, require_keys.Escape)) setInputValue("");
374
- else setInputValue(value ?? "");
373
+ const isEscape = event && "key" in event && require_match.match(event, require_keys.Escape);
374
+ const isClick = value && !(event && "key" in event);
375
+ if (value?.length === 1 || isEscape || isClick) {
376
+ setInputValue("");
377
+ onInputValueChange?.({
378
+ inputValue: "",
379
+ type: FunctionSetInputValue
380
+ });
381
+ } else setInputValue(value ?? "");
375
382
  if (textInput.current) textInput.current.focus();
376
383
  }
377
384
  const candidate = slug ?? decorator;
@@ -514,6 +521,9 @@ const FilterableMultiSelect = (0, react.forwardRef)(function FilterableMultiSele
514
521
  disabled,
515
522
  translateWithId,
516
523
  readOnly,
524
+ onMouseDown: (event) => {
525
+ event.preventDefault();
526
+ },
517
527
  onMouseUp: (event) => {
518
528
  event.stopPropagation();
519
529
  }
@@ -16,6 +16,7 @@
16
16
  "enable-css-custom-properties": true,
17
17
  "enable-css-grid": true,
18
18
  "enable-v11-release": true,
19
+ "enable-v12-release": false,
19
20
  "enable-experimental-tile-contrast": false,
20
21
  "enable-tile-contrast": false,
21
22
  "enable-v12-tile-radio-icons": false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.112.0-rc.0",
4
+ "version": "1.112.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -38,10 +38,13 @@
38
38
  },
39
39
  "scripts": {
40
40
  "build": "yarn clean && node tasks/build-styles.js && node tasks/build.js",
41
- "clean": "rimraf es lib icons/index.js icons/index.d.ts icons/index.esm.js storybook-static",
41
+ "clean": "rimraf es lib icons/index.js icons/index.d.ts icons/index.esm.js storybook-static storybook-static-v12 .storybook-v12/generated",
42
42
  "postinstall": "ibmtelemetry --config=telemetry.yml",
43
- "storybook": "storybook dev -p 3000",
43
+ "storybook": "storybook dev -p 3011",
44
44
  "storybook:build": "storybook build",
45
+ "storybook:v12": "yarn storybook:v12:prepare && storybook dev -p 3012 --config-dir .storybook-v12",
46
+ "storybook:v12:build": "yarn storybook:v12:prepare && storybook build --config-dir .storybook-v12 --output-dir storybook-static-v12",
47
+ "storybook:v12:prepare": "node ../../tasks/prepare-v12-storybook.mjs .",
45
48
  "telemetry:config": "npx -y @ibm/telemetry-js-config-generator generate --id fd89d12b-6a39-48b4-adf4-30c94dc0dddd --endpoint https://www-api.ibm.com/ibm-telemetry/v1/metrics --files ./src/components/**/*.(tsx|js|jsx)"
46
49
  },
47
50
  "peerDependencies": {
@@ -52,11 +55,11 @@
52
55
  },
53
56
  "dependencies": {
54
57
  "@babel/runtime": "^7.27.3",
55
- "@carbon/feature-flags": "^1.4.0",
56
- "@carbon/icons-react": "^11.84.0-rc.0",
57
- "@carbon/layout": "^11.55.0-rc.0",
58
- "@carbon/styles": "^1.111.0-rc.0",
59
- "@carbon/utilities": "^0.22.0-rc.0",
58
+ "@carbon/feature-flags": "^1.5.0",
59
+ "@carbon/icons-react": "^11.84.0",
60
+ "@carbon/layout": "^11.55.0",
61
+ "@carbon/styles": "^1.111.0",
62
+ "@carbon/utilities": "^0.22.0",
60
63
  "@floating-ui/react": "^0.27.4",
61
64
  "@ibm/telemetry-js": "^1.5.0",
62
65
  "classnames": "2.5.1",
@@ -79,7 +82,7 @@
79
82
  "@babel/preset-react": "^7.27.1",
80
83
  "@babel/preset-typescript": "^7.27.1",
81
84
  "@carbon/test-utils": "^10.41.0",
82
- "@carbon/themes": "^11.77.0-rc.0",
85
+ "@carbon/themes": "^11.77.0",
83
86
  "@figma/code-connect": "^1.4.7",
84
87
  "@stackblitz/sdk": "^1.11.0",
85
88
  "@storybook/addon-a11y": "^10.3.5",
@@ -111,7 +114,7 @@
111
114
  "tinyclip": "^0.1.12",
112
115
  "tsdown": "^0.22.0",
113
116
  "typescript": "^6.0.3",
114
- "typescript-config-carbon": "^0.11.0-rc.0",
117
+ "typescript-config-carbon": "^0.11.0",
115
118
  "use-sync-external-store": "^1.5.0",
116
119
  "vite": "^8.0.0"
117
120
  },
@@ -126,5 +129,5 @@
126
129
  "**/*.scss",
127
130
  "**/*.css"
128
131
  ],
129
- "gitHead": "1738a92e35dc0b9ba19877b9a4319bcc3336c5b1"
132
+ "gitHead": "5102bd860864c2580048183ffaf50d1ffd4400b5"
130
133
  }
package/telemetry.yml CHANGED
@@ -174,6 +174,7 @@ collect:
174
174
  - onKeyUp
175
175
  - onLoadingSuccess
176
176
  - onMenuChange
177
+ - onMouseDown
177
178
  - onMouseEnter
178
179
  - onMouseLeave
179
180
  - onMouseUp
@@ -359,6 +360,7 @@ collect:
359
360
  - enableTreeviewControllable
360
361
  - enableV12DynamicFloatingStyles
361
362
  - enableV12Overflowmenu
363
+ - enableV12Release
362
364
  - enableV12TileDefaultIcons
363
365
  - enableV12TileRadioIcons
364
366
  - flags
@@ -475,7 +477,6 @@ collect:
475
477
  - closeMenu
476
478
  - handleOverflowMenuItemFocus
477
479
  - isDelete
478
- - onMouseDown
479
480
  - requireTitle
480
481
  - wrapperClassName
481
482
  # PageHeaderBreadcrumbBar