@carbon/react 1.66.0 → 1.67.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +971 -911
  2. package/es/components/ComboBox/ComboBox.js +11 -2
  3. package/es/components/ComboButton/index.js +1 -1
  4. package/es/components/DataTable/TableExpandHeader.d.ts +2 -2
  5. package/es/components/DataTable/TableExpandHeader.js +1 -1
  6. package/es/components/DatePicker/DatePicker.js +1 -0
  7. package/es/components/Dropdown/Dropdown.js +1 -1
  8. package/es/components/FeatureFlags/index.js +27 -7
  9. package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +15 -0
  10. package/es/components/FluidNumberInput/FluidNumberInput.d.ts +95 -0
  11. package/es/components/FluidNumberInput/index.d.ts +11 -0
  12. package/es/components/FluidSearch/FluidSearch.Skeleton.d.ts +15 -0
  13. package/es/components/FluidSearch/FluidSearch.Skeleton.js +2 -2
  14. package/es/components/FluidSearch/FluidSearch.d.ts +73 -0
  15. package/es/components/FluidSearch/FluidSearch.js +1 -2
  16. package/es/components/FluidSearch/index.d.ts +11 -0
  17. package/es/components/FluidSelect/FluidSelect.Skeleton.d.ts +15 -0
  18. package/es/components/FluidSelect/FluidSelect.Skeleton.js +1 -2
  19. package/es/components/FluidSelect/FluidSelect.d.ts +57 -0
  20. package/es/components/FluidSelect/FluidSelect.js +1 -2
  21. package/es/components/FluidSelect/index.d.ts +13 -0
  22. package/es/components/FluidSelect/index.js +1 -0
  23. package/es/components/FluidTextInput/FluidPasswordInput.d.ts +83 -0
  24. package/es/components/FluidTextInput/FluidPasswordInput.js +87 -0
  25. package/es/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +15 -0
  26. package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +2 -2
  27. package/es/components/FluidTextInput/FluidTextInput.d.ts +70 -0
  28. package/es/components/FluidTextInput/FluidTextInput.js +6 -4
  29. package/es/components/FluidTextInput/index.d.ts +15 -0
  30. package/es/components/FluidTextInput/index.js +2 -0
  31. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.d.ts +35 -0
  32. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +4 -2
  33. package/es/components/FluidTimePicker/FluidTimePicker.d.ts +45 -0
  34. package/es/components/FluidTimePicker/FluidTimePicker.js +5 -5
  35. package/es/components/FluidTimePicker/index.d.ts +13 -0
  36. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +41 -0
  37. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -2
  38. package/es/components/FluidTimePickerSelect/index.d.ts +11 -0
  39. package/es/components/MultiSelect/FilterableMultiSelect.js +4 -4
  40. package/es/components/MultiSelect/MultiSelect.js +1 -1
  41. package/es/components/Notification/Notification.js +4 -2
  42. package/es/components/OverflowMenuV2/index.js +1 -3
  43. package/es/components/Pagination/Pagination.js +1 -1
  44. package/es/components/Popover/index.js +1 -1
  45. package/es/components/Tabs/Tabs.js +1 -1
  46. package/es/components/UIShell/HeaderPanel.js +1 -1
  47. package/es/index.js +10 -9
  48. package/es/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +757 -4
  49. package/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +76 -0
  50. package/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +106 -6
  51. package/lib/components/ComboBox/ComboBox.js +12 -3
  52. package/lib/components/ComboButton/index.js +2 -2
  53. package/lib/components/DataTable/TableExpandHeader.d.ts +2 -2
  54. package/lib/components/DataTable/TableExpandHeader.js +1 -1
  55. package/lib/components/DatePicker/DatePicker.js +1 -0
  56. package/lib/components/Dropdown/Dropdown.js +2 -2
  57. package/lib/components/FeatureFlags/index.js +27 -7
  58. package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.d.ts +15 -0
  59. package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +95 -0
  60. package/lib/components/FluidNumberInput/index.d.ts +11 -0
  61. package/lib/components/FluidSearch/FluidSearch.Skeleton.d.ts +15 -0
  62. package/lib/components/FluidSearch/FluidSearch.Skeleton.js +2 -2
  63. package/lib/components/FluidSearch/FluidSearch.d.ts +73 -0
  64. package/lib/components/FluidSearch/FluidSearch.js +1 -2
  65. package/lib/components/FluidSearch/index.d.ts +11 -0
  66. package/lib/components/FluidSelect/FluidSelect.Skeleton.d.ts +15 -0
  67. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +1 -2
  68. package/lib/components/FluidSelect/FluidSelect.d.ts +57 -0
  69. package/lib/components/FluidSelect/FluidSelect.js +1 -2
  70. package/lib/components/FluidSelect/index.d.ts +13 -0
  71. package/lib/components/FluidSelect/index.js +2 -0
  72. package/lib/components/FluidTextInput/FluidPasswordInput.d.ts +83 -0
  73. package/lib/components/FluidTextInput/FluidPasswordInput.js +93 -0
  74. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.d.ts +15 -0
  75. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +2 -2
  76. package/lib/components/FluidTextInput/FluidTextInput.d.ts +70 -0
  77. package/lib/components/FluidTextInput/FluidTextInput.js +6 -4
  78. package/lib/components/FluidTextInput/index.d.ts +15 -0
  79. package/lib/components/FluidTextInput/index.js +3 -0
  80. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.d.ts +35 -0
  81. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +4 -2
  82. package/lib/components/FluidTimePicker/FluidTimePicker.d.ts +45 -0
  83. package/lib/components/FluidTimePicker/FluidTimePicker.js +6 -6
  84. package/lib/components/FluidTimePicker/index.d.ts +13 -0
  85. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.d.ts +41 -0
  86. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +2 -2
  87. package/lib/components/FluidTimePickerSelect/index.d.ts +11 -0
  88. package/lib/components/MultiSelect/FilterableMultiSelect.js +5 -5
  89. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  90. package/lib/components/Notification/Notification.js +4 -2
  91. package/lib/components/OverflowMenuV2/index.js +1 -3
  92. package/lib/components/Pagination/Pagination.js +1 -1
  93. package/lib/components/Popover/index.js +2 -2
  94. package/lib/components/Tabs/Tabs.js +1 -1
  95. package/lib/components/UIShell/HeaderPanel.js +1 -1
  96. package/lib/index.js +19 -18
  97. package/lib/node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js +763 -2
  98. package/lib/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js +80 -0
  99. package/lib/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs.js +121 -5
  100. package/package.json +8 -8
@@ -0,0 +1,76 @@
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 { offset, autoPlacement, shift, flip, size, hide as hide$1, arrow, inline, limitShift } from '../../core/dist/floating-ui.core.mjs.js';
9
+
10
+ /**
11
+ * Modifies the placement by translating the floating element along the
12
+ * specified axes.
13
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
14
+ * object may be passed.
15
+ * @see https://floating-ui.com/docs/offset
16
+ */
17
+ offset;
18
+
19
+ /**
20
+ * Optimizes the visibility of the floating element by choosing the placement
21
+ * that has the most space available automatically, without needing to specify a
22
+ * preferred placement. Alternative to `flip`.
23
+ * @see https://floating-ui.com/docs/autoPlacement
24
+ */
25
+ autoPlacement;
26
+
27
+ /**
28
+ * Optimizes the visibility of the floating element by shifting it in order to
29
+ * keep it in view when it will overflow the clipping boundary.
30
+ * @see https://floating-ui.com/docs/shift
31
+ */
32
+ shift;
33
+
34
+ /**
35
+ * Optimizes the visibility of the floating element by flipping the `placement`
36
+ * in order to keep it in view when the preferred placement(s) will overflow the
37
+ * clipping boundary. Alternative to `autoPlacement`.
38
+ * @see https://floating-ui.com/docs/flip
39
+ */
40
+ flip;
41
+
42
+ /**
43
+ * Provides data that allows you to change the size of the floating element —
44
+ * for instance, prevent it from overflowing the clipping boundary or match the
45
+ * width of the reference element.
46
+ * @see https://floating-ui.com/docs/size
47
+ */
48
+ size;
49
+
50
+ /**
51
+ * Provides data to hide the floating element in applicable situations, such as
52
+ * when it is not in the same clipping context as the reference element.
53
+ * @see https://floating-ui.com/docs/hide
54
+ */
55
+ const hide = hide$1;
56
+
57
+ /**
58
+ * Provides data to position an inner element of the floating element so that it
59
+ * appears centered to the reference element.
60
+ * @see https://floating-ui.com/docs/arrow
61
+ */
62
+ arrow;
63
+
64
+ /**
65
+ * Provides improved positioning for inline reference elements that can span
66
+ * over multiple lines, such as hyperlinks or range selections.
67
+ * @see https://floating-ui.com/docs/inline
68
+ */
69
+ inline;
70
+
71
+ /**
72
+ * Built-in `limiter` that will stop `shift()` at a certain point.
73
+ */
74
+ limitShift;
75
+
76
+ export { hide };
@@ -5,10 +5,101 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ /**
9
+ * Custom positioning reference element.
10
+ * @see https://floating-ui.com/docs/virtual-elements
11
+ */
12
+
8
13
  const sides = ['top', 'right', 'bottom', 'left'];
14
+ const alignments = ['start', 'end'];
15
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
16
+ const min = Math.min;
17
+ const max = Math.max;
18
+ const oppositeSideMap = {
19
+ left: 'right',
20
+ right: 'left',
21
+ bottom: 'top',
22
+ top: 'bottom'
23
+ };
24
+ const oppositeAlignmentMap = {
25
+ start: 'end',
26
+ end: 'start'
27
+ };
28
+ function clamp(start, value, end) {
29
+ return max(start, min(value, end));
30
+ }
9
31
  function evaluate(value, param) {
10
32
  return typeof value === 'function' ? value(param) : value;
11
33
  }
34
+ function getSide(placement) {
35
+ return placement.split('-')[0];
36
+ }
37
+ function getAlignment(placement) {
38
+ return placement.split('-')[1];
39
+ }
40
+ function getOppositeAxis(axis) {
41
+ return axis === 'x' ? 'y' : 'x';
42
+ }
43
+ function getAxisLength(axis) {
44
+ return axis === 'y' ? 'height' : 'width';
45
+ }
46
+ function getSideAxis(placement) {
47
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
48
+ }
49
+ function getAlignmentAxis(placement) {
50
+ return getOppositeAxis(getSideAxis(placement));
51
+ }
52
+ function getAlignmentSides(placement, rects, rtl) {
53
+ if (rtl === void 0) {
54
+ rtl = false;
55
+ }
56
+ const alignment = getAlignment(placement);
57
+ const alignmentAxis = getAlignmentAxis(placement);
58
+ const length = getAxisLength(alignmentAxis);
59
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
60
+ if (rects.reference[length] > rects.floating[length]) {
61
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
62
+ }
63
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
64
+ }
65
+ function getExpandedPlacements(placement) {
66
+ const oppositePlacement = getOppositePlacement(placement);
67
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
68
+ }
69
+ function getOppositeAlignmentPlacement(placement) {
70
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
71
+ }
72
+ function getSideList(side, isStart, rtl) {
73
+ const lr = ['left', 'right'];
74
+ const rl = ['right', 'left'];
75
+ const tb = ['top', 'bottom'];
76
+ const bt = ['bottom', 'top'];
77
+ switch (side) {
78
+ case 'top':
79
+ case 'bottom':
80
+ if (rtl) return isStart ? rl : lr;
81
+ return isStart ? lr : rl;
82
+ case 'left':
83
+ case 'right':
84
+ return isStart ? tb : bt;
85
+ default:
86
+ return [];
87
+ }
88
+ }
89
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
90
+ const alignment = getAlignment(placement);
91
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
92
+ if (alignment) {
93
+ list = list.map(side => side + "-" + alignment);
94
+ if (flipAlignment) {
95
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
96
+ }
97
+ }
98
+ return list;
99
+ }
100
+ function getOppositePlacement(placement) {
101
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
102
+ }
12
103
  function expandPaddingObject(padding) {
13
104
  return {
14
105
  top: 0,
@@ -27,13 +118,22 @@ function getPaddingObject(padding) {
27
118
  };
28
119
  }
29
120
  function rectToClientRect(rect) {
121
+ const {
122
+ x,
123
+ y,
124
+ width,
125
+ height
126
+ } = rect;
30
127
  return {
31
- ...rect,
32
- top: rect.y,
33
- left: rect.x,
34
- right: rect.x + rect.width,
35
- bottom: rect.y + rect.height
128
+ width,
129
+ height,
130
+ top: y,
131
+ left: x,
132
+ right: x + width,
133
+ bottom: y + height,
134
+ x,
135
+ y
36
136
  };
37
137
  }
38
138
 
39
- export { evaluate, expandPaddingObject, getPaddingObject, rectToClientRect, sides };
139
+ export { alignments, clamp, evaluate, expandPaddingObject, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, sides };
@@ -26,7 +26,7 @@ var usePrefix = require('../../internal/usePrefix.js');
26
26
  require('../FluidForm/FluidForm.js');
27
27
  var FormContext = require('../FluidForm/FormContext.js');
28
28
  var react = require('@floating-ui/react');
29
- var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js');
29
+ var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js');
30
30
  var Text = require('../Text/Text.js');
31
31
  var match = require('../../internal/keyboard/match.js');
32
32
  var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
@@ -46,7 +46,8 @@ const {
46
46
  ItemMouseMove,
47
47
  InputKeyDownArrowUp,
48
48
  InputKeyDownArrowDown,
49
- MenuMouseLeave
49
+ MenuMouseLeave,
50
+ FunctionSelectItem
50
51
  } = Downshift.useCombobox.stateChangeTypes;
51
52
  const defaultItemToString = item => {
52
53
  if (typeof item === 'string') {
@@ -144,7 +145,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
144
145
  } = react.useFloating(autoAlign ? {
145
146
  placement: direction,
146
147
  strategy: 'fixed',
147
- middleware: [react.flip(), floatingUi_core.hide()],
148
+ middleware: [react.flip(), floatingUi_dom.hide()],
148
149
  whileElementsMounted: react.autoUpdate
149
150
  } : {});
150
151
  const parentWidth = refs?.reference?.current?.clientWidth;
@@ -249,6 +250,14 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
249
250
  }
250
251
  return changes;
251
252
  }
253
+ case FunctionSelectItem:
254
+ if (onChange) {
255
+ onChange({
256
+ selectedItem: changes.selectedItem,
257
+ inputValue: changes.inputValue
258
+ });
259
+ }
260
+ return changes;
252
261
  case InputKeyDownEnter:
253
262
  if (allowCustomValue) {
254
263
  setInputValue(inputValue);
@@ -23,8 +23,8 @@ var useAttachedMenu = require('../../internal/useAttachedMenu.js');
23
23
  var useId = require('../../internal/useId.js');
24
24
  var usePrefix = require('../../internal/usePrefix.js');
25
25
  var react = require('@floating-ui/react');
26
+ var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js');
26
27
  var mergeRefs = require('../../tools/mergeRefs.js');
27
- var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js');
28
28
 
29
29
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
30
30
 
@@ -62,7 +62,7 @@ const ComboButton = /*#__PURE__*/React__default["default"].forwardRef(function C
62
62
  const containerRef = React.useRef(null);
63
63
  const middlewares = [react.flip({
64
64
  crossAxis: false
65
- }), floatingUi_core.hide()];
65
+ }), floatingUi_dom.hide()];
66
66
  if (menuAlignment === 'bottom' || menuAlignment === 'top') {
67
67
  middlewares.push(react.size({
68
68
  apply(_ref2) {
@@ -22,7 +22,7 @@ type TableExpandHeaderPropsBase = {
22
22
  * Specify the string read by a voice reader when the expand trigger is
23
23
  * focused
24
24
  */
25
- ['aria-label']: string;
25
+ ['aria-label']?: string;
26
26
  /**
27
27
  * @deprecated The enableExpando prop is being replaced by `enableToggle`
28
28
  */
@@ -79,7 +79,7 @@ declare const TableExpandHeader: {
79
79
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
80
80
  className: PropTypes.Requireable<string>;
81
81
  /**
82
- * The enableExpando prop is being replaced by enableToggle
82
+ * The enableExpando prop is being replaced by TableExpandHeader
83
83
  */
84
84
  enableExpando: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
85
85
  /**
@@ -79,7 +79,7 @@ TableExpandHeader.propTypes = {
79
79
  children: PropTypes__default["default"].node,
80
80
  className: PropTypes__default["default"].string,
81
81
  /**
82
- * The enableExpando prop is being replaced by enableToggle
82
+ * The enableExpando prop is being replaced by TableExpandHeader
83
83
  */
84
84
  enableExpando: deprecate["default"](PropTypes__default["default"].bool, 'The `enableExpando` prop has been deprecated in favor of `enableToggle`. This prop will be removed in the next major release.'),
85
85
  /**
@@ -566,6 +566,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
566
566
  if (!calendarRef.current || !startInputField.current) return;
567
567
  const handleKeyDown = event => {
568
568
  if (match.match(event, keys.Tab) && !event.shiftKey && document.activeElement === endInputField.current && calendarRef.current.isOpen) {
569
+ event.preventDefault();
569
570
  calendarRef.current.close();
570
571
  // Remove focus from endDate calendar input
571
572
  document.activeElement instanceof HTMLElement &&
@@ -23,7 +23,7 @@ require('../FluidForm/FluidForm.js');
23
23
  var FormContext = require('../FluidForm/FormContext.js');
24
24
  var useId = require('../../internal/useId.js');
25
25
  var react = require('@floating-ui/react');
26
- var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs.js');
26
+ var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js');
27
27
  var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
28
28
 
29
29
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -103,7 +103,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
103
103
  width: `${rects.reference.width}px`
104
104
  });
105
105
  }
106
- }), react.flip(), floatingUi_core.hide()],
106
+ }), react.flip(), floatingUi_dom.hide()],
107
107
  whileElementsMounted: react.autoUpdate
108
108
  } : {} // When autoAlign is turned off, floating-ui will not be used
109
109
  );
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var FeatureFlags$1 = require('@carbon/feature-flags');
13
13
  var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
+ var deprecate = require('../../prop-types/deprecate.js');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
@@ -32,17 +33,30 @@ const FeatureFlagContext = /*#__PURE__*/React.createContext(FeatureFlags$1.Featu
32
33
  function FeatureFlags(_ref) {
33
34
  let {
34
35
  children,
35
- flags = {}
36
+ flags = {},
37
+ enableV12TileDefaultIcons = false,
38
+ enableV12TileRadioIcons = false,
39
+ enableV12Overflowmenu = false,
40
+ enableTreeviewControllable = false,
41
+ enableExperimentalFocusWrapWithoutSentinels = false
36
42
  } = _ref;
37
43
  const parentScope = React.useContext(FeatureFlagContext);
38
44
  const [prevParentScope, setPrevParentScope] = React.useState(parentScope);
45
+ const combinedFlags = {
46
+ 'enable-v12-tile-default-icons': enableV12TileDefaultIcons,
47
+ 'enable-v12-tile-radio-icons': enableV12TileRadioIcons,
48
+ 'enable-v12-overflowmenu': enableV12Overflowmenu,
49
+ 'enable-treeview-controllable': enableTreeviewControllable,
50
+ 'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
51
+ ...flags
52
+ };
39
53
  const [scope, updateScope] = React.useState(() => {
40
- const scope = FeatureFlags$1.createScope(flags);
54
+ const scope = FeatureFlags$1.createScope(combinedFlags);
41
55
  scope.mergeWithScope(parentScope);
42
56
  return scope;
43
57
  });
44
58
  if (parentScope !== prevParentScope) {
45
- const scope = FeatureFlags$1.createScope(flags);
59
+ const scope = FeatureFlags$1.createScope(combinedFlags);
46
60
  scope.mergeWithScope(parentScope);
47
61
  updateScope(scope);
48
62
  setPrevParentScope(parentScope);
@@ -51,7 +65,7 @@ function FeatureFlags(_ref) {
51
65
  // We use a custom hook to detect if any of the keys or their values change
52
66
  // for flags that are passed in. If they have changed, then we re-create the
53
67
  // FeatureFlagScope using the new flags
54
- useChangedValue(flags, isEqual, changedFlags => {
68
+ useChangedValue(combinedFlags, isEqual, changedFlags => {
55
69
  const scope = FeatureFlags$1.createScope(changedFlags);
56
70
  scope.mergeWithScope(parentScope);
57
71
  updateScope(scope);
@@ -63,9 +77,14 @@ function FeatureFlags(_ref) {
63
77
  FeatureFlags.propTypes = {
64
78
  children: PropTypes__default["default"].node,
65
79
  /**
66
- * Provide the feature flags to enabled or disabled in the current React tree
80
+ * Provide the feature flags to enabled or disabled in the current Rea,ct tree
67
81
  */
68
- flags: PropTypes__default["default"].objectOf(PropTypes__default["default"].bool)
82
+ flags: deprecate["default"](PropTypes__default["default"].objectOf(PropTypes__default["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`),
83
+ enableV12TileDefaultIcons: PropTypes__default["default"].bool,
84
+ enableV12TileRadioIcons: PropTypes__default["default"].bool,
85
+ enableV12Overflowmenu: PropTypes__default["default"].bool,
86
+ enableTreeviewControllable: PropTypes__default["default"].bool,
87
+ enableExperimentalFocusWrapWithoutSentinels: PropTypes__default["default"].bool
69
88
  };
70
89
 
71
90
  /**
@@ -107,7 +126,8 @@ function useChangedValue(value, compare, callback) {
107
126
  */
108
127
  function useFeatureFlag(flag) {
109
128
  const scope = React.useContext(FeatureFlagContext);
110
- return scope.enabled(flag);
129
+ //updated to return false for undefined flags
130
+ return scope.enabled(flag) ?? false;
111
131
  }
112
132
 
113
133
  /**
@@ -0,0 +1,15 @@
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
+ import React from 'react';
8
+ export interface FluidNumberInputSkeletonProps {
9
+ /**
10
+ * Specify an optional className to be applied to the outer FluidForm wrapper
11
+ */
12
+ className?: string;
13
+ }
14
+ declare const FluidNumberInputSkeleton: React.FC<FluidNumberInputSkeletonProps>;
15
+ export default FluidNumberInputSkeleton;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022
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
+ import React from 'react';
8
+ export interface FluidNumberInputProps {
9
+ /**
10
+ * `true` to allow empty string.
11
+ */
12
+ allowEmpty?: boolean;
13
+ /**
14
+ * Specify an optional className to be applied to the wrapper node
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Optional starting value for uncontrolled state
19
+ */
20
+ defaultValue?: number | string;
21
+ /**
22
+ * Specify if the wheel functionality for the input should be disabled, or not
23
+ */
24
+ disableWheel?: boolean;
25
+ /**
26
+ * Specify if the control should be disabled, or not
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * Provide a description for up/down icons that can be read by screen readers
31
+ */
32
+ iconDescription?: string;
33
+ /**
34
+ * Specify a custom `id` for the input
35
+ */
36
+ id: string;
37
+ /**
38
+ * Specify if the currently value is invalid.
39
+ */
40
+ invalid?: boolean;
41
+ /**
42
+ * Message which is displayed if the value is invalid.
43
+ */
44
+ invalidText?: React.ReactNode;
45
+ /**
46
+ * Generic `label` that will be used as the textual representation of what
47
+ * this field is for
48
+ */
49
+ label?: React.ReactNode;
50
+ /**
51
+ * The maximum value.
52
+ */
53
+ max?: number;
54
+ /**
55
+ * The minimum value.
56
+ */
57
+ min?: number;
58
+ onChange?: (event: React.MouseEvent<HTMLButtonElement>, state: {
59
+ value: number | string;
60
+ direction: string;
61
+ }) => void;
62
+ /**
63
+ * Provide an optional function to be called when the up/down button is clicked
64
+ */
65
+ onClick?: (event: React.MouseEvent<HTMLElement>, state?: {
66
+ value: number | string;
67
+ direction: string;
68
+ }) => void;
69
+ /**
70
+ * Provide an optional function to be called when a key is pressed in the number input
71
+ */
72
+ onKeyUp?: React.KeyboardEventHandler<HTMLInputElement>;
73
+ /**
74
+ * Specify how much the values should increase/decrease upon clicking on up/down button
75
+ */
76
+ step?: number;
77
+ /**
78
+ * Provide custom text for the component for each translation id
79
+ */
80
+ translateWithId?: (id: string) => string;
81
+ /**
82
+ * Specify the value of the input
83
+ */
84
+ value?: number | string;
85
+ /**
86
+ * Specify whether the control is currently in warning state
87
+ */
88
+ warn?: boolean;
89
+ /**
90
+ * Provide the text that is displayed when the control is in warning state
91
+ */
92
+ warnText?: React.ReactNode;
93
+ }
94
+ declare const FluidNumberInput: React.FC<FluidNumberInputProps>;
95
+ export default FluidNumberInput;
@@ -0,0 +1,11 @@
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
+ import { FluidNumberInputProps } from './FluidNumberInput';
8
+ import { FluidNumberInputSkeletonProps } from './FluidNumberInput.Skeleton';
9
+ export { type FluidNumberInputProps, type FluidNumberInputSkeletonProps };
10
+ export { default, default as FluidNumberInput } from './FluidNumberInput';
11
+ export { default as FluidNumberInputSkeleton } from './FluidNumberInput.Skeleton';
@@ -0,0 +1,15 @@
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
+ import React from 'react';
8
+ export interface FluidSearchSkeletonProps {
9
+ /**
10
+ * Specify an optional className to be applied to the outer FluidForm wrapper
11
+ */
12
+ className?: string;
13
+ }
14
+ declare const FluidSearchSkeleton: React.FC<FluidSearchSkeletonProps>;
15
+ export default FluidSearchSkeleton;
@@ -22,7 +22,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
22
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
 
25
- function FluidSearchSkeleton(_ref) {
25
+ const FluidSearchSkeleton = _ref => {
26
26
  let {
27
27
  className,
28
28
  ...other
@@ -39,7 +39,7 @@ function FluidSearchSkeleton(_ref) {
39
39
  }), /*#__PURE__*/React__default["default"].createElement("div", {
40
40
  className: `${prefix}--skeleton ${prefix}--text-input`
41
41
  })));
42
- }
42
+ };
43
43
  FluidSearchSkeleton.propTypes = {
44
44
  /**
45
45
  * Specify an optional className to be applied to the outer FluidForm wrapper
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022
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
+ import React from 'react';
8
+ export interface FluidSearchProps {
9
+ /**
10
+ * Specify an optional value for the `autocomplete` property on the underlying
11
+ * `<input>`, defaults to "off"
12
+ */
13
+ autoComplete?: string;
14
+ /**
15
+ * Specify an optional className to be applied to the container node
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Specify a label to be read by screen readers on the "close" button
20
+ */
21
+ closeButtonLabelText?: string;
22
+ /**
23
+ * Optionally provide the default value of the `<input>`
24
+ */
25
+ defaultValue?: string | number;
26
+ /**
27
+ * Specify whether the `<input>` should be disabled
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * Specify a custom `id` for the input
32
+ */
33
+ id?: string;
34
+ /**
35
+ * Provide the label text for the Search icon
36
+ */
37
+ labelText: React.ReactNode;
38
+ /**
39
+ * Optional callback called when the search value changes.
40
+ */
41
+ onChange?(e: {
42
+ target: HTMLInputElement;
43
+ type: 'change';
44
+ }): void;
45
+ /**
46
+ * Optional callback called when the search value is cleared.
47
+ */
48
+ onClear?: () => void;
49
+ /**
50
+ * Provide a handler that is invoked on the key down event for the input
51
+ */
52
+ onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
53
+ /**
54
+ * Provide an optional placeholder text for the Search.
55
+ * Note: if the label and placeholder differ,
56
+ * VoiceOver on Mac will read both
57
+ */
58
+ placeholder?: string;
59
+ /**
60
+ * Specify the role for the underlying `<input>`, defaults to `searchbox`
61
+ */
62
+ role?: string;
63
+ /**
64
+ * Optional prop to specify the type of the `<input>`
65
+ */
66
+ type?: string;
67
+ /**
68
+ * Specify the value of the `<input>`
69
+ */
70
+ value?: string | number;
71
+ }
72
+ declare const FluidSearch: React.FC<FluidSearchProps>;
73
+ export default FluidSearch;
@@ -101,6 +101,5 @@ FluidSearch.propTypes = {
101
101
  */
102
102
  value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
103
103
  };
104
- var FluidSearch$1 = FluidSearch;
105
104
 
106
- exports["default"] = FluidSearch$1;
105
+ exports["default"] = FluidSearch;
@@ -0,0 +1,11 @@
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
+ import { FluidSearchProps } from './FluidSearch';
8
+ import { FluidSearchSkeletonProps } from './FluidSearch.Skeleton';
9
+ export { default, default as FluidSearch } from './FluidSearch';
10
+ export { type FluidSearchProps, type FluidSearchSkeletonProps };
11
+ export { default as FluidSearchSkeleton } from './FluidSearch.Skeleton';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022
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
+ import React from 'react';
8
+ export interface FluidSelectSkeletonProps {
9
+ /**
10
+ * Specify an optional className to add.
11
+ */
12
+ className?: string;
13
+ }
14
+ declare const FluidSelectSkeleton: React.FC<FluidSelectSkeletonProps>;
15
+ export default FluidSelectSkeleton;