@carbon/react 1.24.0-rc.0 → 1.25.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 (151) hide show
  1. package/es/components/CodeSnippet/CodeSnippet.js +13 -115
  2. package/es/components/ComboBox/ComboBox.d.ts +6 -0
  3. package/es/components/ComboBox/ComboBox.js +19 -172
  4. package/es/components/ComboButton/index.js +164 -0
  5. package/es/components/ComposedModal/ComposedModal.js +1 -2
  6. package/es/components/DataTable/TableToolbar.d.ts +19 -0
  7. package/es/components/DataTable/TableToolbar.js +1 -1
  8. package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
  9. package/es/components/DataTable/TableToolbarContent.d.ts +21 -0
  10. package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
  11. package/es/components/DataTable/TableToolbarMenu.js +3 -3
  12. package/es/components/DataTable/tools/sorting.js +2 -1
  13. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  14. package/es/components/Dropdown/Dropdown.d.ts +6 -0
  15. package/es/components/Dropdown/Dropdown.js +8 -145
  16. package/es/components/FileUploader/FileUploader.js +1 -1
  17. package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
  18. package/es/components/FileUploader/FileUploaderItem.js +2 -1
  19. package/es/components/FileUploader/Filename.js +8 -2
  20. package/es/components/FluidTextArea/FluidTextArea.js +12 -1
  21. package/es/components/IconButton/index.js +1 -0
  22. package/es/components/ListBox/ListBoxMenuItem.d.ts +2 -2
  23. package/es/components/ListBox/ListBoxSelection.js +4 -23
  24. package/es/components/ListBox/next/ListBoxSelection.js +2 -23
  25. package/es/components/Menu/Menu.js +50 -33
  26. package/es/components/Menu/MenuContext.js +3 -6
  27. package/es/components/Menu/MenuItem.js +1 -0
  28. package/es/components/MenuButton/index.js +127 -0
  29. package/es/components/Modal/Modal.js +4 -3
  30. package/es/components/MultiSelect/FilterableMultiSelect.js +31 -137
  31. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  32. package/es/components/MultiSelect/MultiSelect.js +48 -26
  33. package/es/components/Notification/Notification.js +27 -264
  34. package/es/components/OverflowMenu/OverflowMenu.js +13 -139
  35. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  36. package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  37. package/es/components/OverflowMenuV2/index.js +15 -51
  38. package/es/components/Popover/index.d.ts +55 -0
  39. package/es/components/Popover/index.js +61 -29
  40. package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -4
  41. package/es/components/RadioTile/RadioTile.js +6 -6
  42. package/es/components/Select/Select.d.ts +89 -0
  43. package/es/components/SelectItem/SelectItem.d.ts +62 -0
  44. package/es/components/SelectItem/SelectItem.js +2 -4
  45. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  46. package/es/components/SkeletonText/SkeletonText.js +1 -1
  47. package/es/components/Slider/Slider.Skeleton.d.ts +2 -2
  48. package/es/components/Slider/Slider.d.ts +355 -0
  49. package/es/components/Slider/Slider.js +63 -35
  50. package/es/components/StructuredList/StructuredList.js +10 -38
  51. package/es/components/Tabs/Tabs.js +3 -1
  52. package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  53. package/es/components/TextArea/TextArea.Skeleton.js +5 -5
  54. package/es/components/TextArea/TextArea.d.ts +9 -2
  55. package/es/components/TextArea/TextArea.js +31 -8
  56. package/es/components/TextArea/index.js +1 -0
  57. package/es/components/TextInput/TextInput.d.ts +106 -0
  58. package/es/components/TextInput/TextInput.js +3 -2
  59. package/es/components/Toggle/Toggle.js +8 -19
  60. package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  61. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  62. package/es/components/Tooltip/Tooltip.d.ts +117 -0
  63. package/es/components/Tooltip/Tooltip.js +6 -4
  64. package/es/components/Tooltip/index.d.ts +9 -0
  65. package/es/index.d.ts +2 -0
  66. package/es/index.js +5 -3
  67. package/es/internal/ClickListener.js +1 -2
  68. package/es/internal/keyboard/match.js +1 -1
  69. package/es/internal/useAttachedMenu.js +85 -0
  70. package/es/internal/useDelayedState.d.ts +19 -0
  71. package/es/internal/useDelayedState.js +7 -3
  72. package/es/internal/useId.js +1 -1
  73. package/es/internal/useMergedRefs.d.ts +13 -0
  74. package/es/internal/useMergedRefs.js +2 -5
  75. package/es/internal/useNormalizedInputProps.js +1 -0
  76. package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
  77. package/lib/components/ComboBox/ComboBox.d.ts +6 -0
  78. package/lib/components/ComboBox/ComboBox.js +18 -171
  79. package/lib/components/ComboButton/index.js +174 -0
  80. package/lib/components/ComposedModal/ComposedModal.js +1 -2
  81. package/lib/components/DataTable/TableToolbar.d.ts +19 -0
  82. package/lib/components/DataTable/TableToolbar.js +1 -1
  83. package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
  84. package/lib/components/DataTable/TableToolbarContent.d.ts +21 -0
  85. package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
  86. package/lib/components/DataTable/TableToolbarMenu.js +3 -3
  87. package/lib/components/DataTable/tools/sorting.js +2 -1
  88. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  89. package/lib/components/Dropdown/Dropdown.d.ts +6 -0
  90. package/lib/components/Dropdown/Dropdown.js +7 -144
  91. package/lib/components/FileUploader/FileUploader.js +1 -1
  92. package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
  93. package/lib/components/FileUploader/FileUploaderItem.js +2 -1
  94. package/lib/components/FileUploader/Filename.js +8 -2
  95. package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
  96. package/lib/components/IconButton/index.js +1 -0
  97. package/lib/components/ListBox/ListBoxMenuItem.d.ts +2 -2
  98. package/lib/components/ListBox/ListBoxSelection.js +4 -23
  99. package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
  100. package/lib/components/Menu/Menu.js +50 -33
  101. package/lib/components/Menu/MenuContext.js +3 -6
  102. package/lib/components/Menu/MenuItem.js +1 -0
  103. package/lib/components/MenuButton/index.js +137 -0
  104. package/lib/components/Modal/Modal.js +4 -3
  105. package/lib/components/MultiSelect/FilterableMultiSelect.js +29 -135
  106. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  107. package/lib/components/MultiSelect/MultiSelect.js +47 -25
  108. package/lib/components/Notification/Notification.js +27 -264
  109. package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
  110. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  111. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  112. package/lib/components/OverflowMenuV2/index.js +13 -49
  113. package/lib/components/Popover/index.d.ts +55 -0
  114. package/lib/components/Popover/index.js +61 -29
  115. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +6 -3
  116. package/lib/components/RadioTile/RadioTile.js +6 -6
  117. package/lib/components/Select/Select.d.ts +89 -0
  118. package/lib/components/SelectItem/SelectItem.d.ts +62 -0
  119. package/lib/components/SelectItem/SelectItem.js +1 -3
  120. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  121. package/lib/components/SkeletonText/SkeletonText.js +1 -1
  122. package/lib/components/Slider/Slider.Skeleton.d.ts +2 -2
  123. package/lib/components/Slider/Slider.d.ts +355 -0
  124. package/lib/components/Slider/Slider.js +62 -34
  125. package/lib/components/StructuredList/StructuredList.js +10 -38
  126. package/lib/components/Tabs/Tabs.js +3 -1
  127. package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  128. package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
  129. package/lib/components/TextArea/TextArea.d.ts +9 -2
  130. package/lib/components/TextArea/TextArea.js +30 -7
  131. package/lib/components/TextArea/index.js +2 -0
  132. package/lib/components/TextInput/TextInput.d.ts +106 -0
  133. package/lib/components/TextInput/TextInput.js +3 -2
  134. package/lib/components/Toggle/Toggle.js +8 -19
  135. package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  136. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  137. package/lib/components/Tooltip/Tooltip.d.ts +117 -0
  138. package/lib/components/Tooltip/Tooltip.js +6 -4
  139. package/lib/components/Tooltip/index.d.ts +9 -0
  140. package/lib/index.d.ts +2 -0
  141. package/lib/index.js +50 -46
  142. package/lib/internal/ClickListener.js +1 -2
  143. package/lib/internal/keyboard/match.js +1 -1
  144. package/lib/internal/useAttachedMenu.js +89 -0
  145. package/lib/internal/useDelayedState.d.ts +19 -0
  146. package/lib/internal/useDelayedState.js +7 -3
  147. package/lib/internal/useId.js +1 -1
  148. package/lib/internal/useMergedRefs.d.ts +13 -0
  149. package/lib/internal/useMergedRefs.js +2 -5
  150. package/lib/internal/useNormalizedInputProps.js +1 -0
  151. package/package.json +10 -10
@@ -29,8 +29,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
29
  var _CheckmarkFilled;
30
30
 
31
31
  var _excluded = ["children", "className", "disabled", "light", "checked", "name", "value", "id", "onChange", "tabIndex"];
32
-
33
- function RadioTile(_ref) {
32
+ var RadioTile = /*#__PURE__*/React__default["default"].forwardRef(function RadioTile(_ref, ref) {
34
33
  var _cx;
35
34
 
36
35
  var children = _ref.children,
@@ -70,7 +69,8 @@ function RadioTile(_ref) {
70
69
  onKeyDown: !disabled ? handleOnKeyDown : null,
71
70
  tabIndex: !disabled ? tabIndex : null,
72
71
  type: "radio",
73
- value: value
72
+ value: value,
73
+ ref: ref
74
74
  }), /*#__PURE__*/React__default["default"].createElement("label", _rollupPluginBabelHelpers["extends"]({}, rest, {
75
75
  htmlFor: inputId,
76
76
  className: className
@@ -79,8 +79,7 @@ function RadioTile(_ref) {
79
79
  }, _CheckmarkFilled || (_CheckmarkFilled = /*#__PURE__*/React__default["default"].createElement(iconsReact.CheckmarkFilled, null))), /*#__PURE__*/React__default["default"].createElement("span", {
80
80
  className: "".concat(prefix, "--tile-content")
81
81
  }, children)));
82
- }
83
-
82
+ });
84
83
  RadioTile.propTypes = {
85
84
  /**
86
85
  * `true` if this tile should be selected.
@@ -137,5 +136,6 @@ RadioTile.defaultProps = {
137
136
  onChange: function onChange() {},
138
137
  tabIndex: 0
139
138
  };
139
+ var RadioTile$1 = RadioTile;
140
140
 
141
- exports["default"] = RadioTile;
141
+ exports["default"] = RadioTile$1;
@@ -0,0 +1,89 @@
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, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
8
+ type ExcludedAttributes = 'size';
9
+ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
10
+ /**
11
+ * Provide the contents of your Select
12
+ */
13
+ children?: ReactNode;
14
+ /**
15
+ * Specify an optional className to be applied to the node containing the label and the select box
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Optionally provide the default value of the `<select>`
20
+ */
21
+ defaultValue?: any;
22
+ /**
23
+ * Specify whether the control is disabled
24
+ */
25
+ disabled?: boolean;
26
+ /**
27
+ * Provide text that is used alongside the control label for additional help
28
+ */
29
+ helperText?: ReactNode;
30
+ /**
31
+ * Specify whether the label should be hidden, or not
32
+ */
33
+ hideLabel?: boolean;
34
+ /**
35
+ * Specify a custom `id` for the `<select>`
36
+ */
37
+ id: string;
38
+ /**
39
+ * Specify whether you want the inline version of this control
40
+ */
41
+ inline?: boolean;
42
+ /**
43
+ * Specify if the currently value is invalid.
44
+ */
45
+ invalid?: boolean;
46
+ /**
47
+ * Message which is displayed if the value is invalid.
48
+ */
49
+ invalidText?: ReactNode;
50
+ /**
51
+ * Provide label text to be read by screen readers when interacting with the control.
52
+ */
53
+ labelText?: ReactNode;
54
+ /**
55
+ * `true` to use the light version. For use on $ui-01 backgrounds only.
56
+ * Don't use this to make tile background color same as container background color.
57
+ *
58
+ * @deprecated The `light` prop for `Select` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component.
59
+ * It will be moved in the next major release.
60
+ */
61
+ light?: boolean;
62
+ /**
63
+ * Reserved for use with <Pagination> component. Will not render a label for the
64
+ * select since Pagination renders one for us.
65
+ */
66
+ noLabel?: boolean;
67
+ /**
68
+ * Provide an optional `onChange` hook that is called each time the value of the underlying `<input>` changes.
69
+ */
70
+ onChange?: ChangeEventHandler<HTMLSelectElement>;
71
+ /**
72
+ * Whether the select should be read-only
73
+ */
74
+ readOnly?: boolean;
75
+ /**
76
+ * Specify the size of the Select Input.
77
+ */
78
+ size?: 'sm' | 'md' | 'lg';
79
+ /**
80
+ * Specify whether the control is currently in warning state
81
+ */
82
+ warn?: boolean;
83
+ /**
84
+ * Provide the text that is displayed when the control is in warning state
85
+ */
86
+ warnText?: ReactNode;
87
+ }
88
+ declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "value" | "children" | "className" | "disabled" | "size" | "form" | "slot" | "style" | "title" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "autoComplete" | "multiple" | "key" | "id" | "onAnimationEnd" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "inline" | "name" | "readOnly" | "required" | "labelText" | "hideLabel" | "light" | "invalid" | "invalidText" | "warn" | "warnText" | "helperText" | "noLabel"> & React.RefAttributes<HTMLSelectElement>>;
89
+ export default Select;
@@ -0,0 +1,62 @@
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 PropTypes from 'prop-types';
8
+ import { HTMLAttributes } from 'react';
9
+ export interface SelectItemProps extends HTMLAttributes<HTMLOptionElement> {
10
+ /**
11
+ * Specify an optional className to be applied to the node
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Specify whether the <SelectItem> should be disabled
16
+ */
17
+ disabled?: boolean;
18
+ /**
19
+ * Specify whether the <SelectItem> is hidden
20
+ */
21
+ hidden?: boolean;
22
+ /**
23
+ * Provide the contents of your <SelectItem>
24
+ */
25
+ text: string;
26
+ /**
27
+ * Specify the value of the <SelectItem>
28
+ */
29
+ value: any;
30
+ }
31
+ declare const SelectItem: {
32
+ ({ className, value, disabled, hidden, text, ...other }: SelectItemProps): JSX.Element;
33
+ propTypes: {
34
+ /**
35
+ * Specify an optional className to be applied to the node
36
+ */
37
+ className: PropTypes.Requireable<string>;
38
+ /**
39
+ * Specify whether the <SelectItem> should be disabled
40
+ */
41
+ disabled: PropTypes.Requireable<boolean>;
42
+ /**
43
+ * Specify whether the <SelectItem> is hidden
44
+ */
45
+ hidden: PropTypes.Requireable<boolean>;
46
+ /**
47
+ * Provide the contents of your <SelectItem>
48
+ */
49
+ text: PropTypes.Validator<string>;
50
+ /**
51
+ * Specify the value of the <SelectItem>
52
+ */
53
+ value: PropTypes.Validator<any>;
54
+ };
55
+ defaultProps: {
56
+ disabled: boolean;
57
+ hidden: boolean;
58
+ value: string;
59
+ text: string;
60
+ };
61
+ };
62
+ export default SelectItem;
@@ -24,8 +24,6 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
  var _excluded = ["className", "value", "disabled", "hidden", "text"];
25
25
 
26
26
  var SelectItem = function SelectItem(_ref) {
27
- var _classNames;
28
-
29
27
  var className = _ref.className,
30
28
  value = _ref.value,
31
29
  disabled = _ref.disabled,
@@ -34,7 +32,7 @@ var SelectItem = function SelectItem(_ref) {
34
32
  other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
35
33
 
36
34
  var prefix = usePrefix.usePrefix();
37
- var selectItemClasses = cx__default["default"]((_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--select-option"), true), _rollupPluginBabelHelpers.defineProperty(_classNames, className, className), _classNames));
35
+ var selectItemClasses = cx__default["default"](_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--select-option"), true), className && _rollupPluginBabelHelpers.defineProperty({}, className, className)));
38
36
  return /*#__PURE__*/React__default["default"].createElement("option", _rollupPluginBabelHelpers["extends"]({}, other, {
39
37
  className: selectItemClasses,
40
38
  value: value,
@@ -0,0 +1,52 @@
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 PropTypes from 'prop-types';
8
+ import { HTMLAttributes, ReactNode } from 'react';
9
+ export interface SelectItemGroupProps extends HTMLAttributes<HTMLOptGroupElement> {
10
+ /**
11
+ * Provide the contents of your <SelectItemGroup>
12
+ */
13
+ children?: ReactNode;
14
+ /**
15
+ * Specify an optional className to be applied to the node
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Specify whether the <SelectItemGroup> should be disabled
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * Specify the label to be displayed
24
+ */
25
+ label: string;
26
+ }
27
+ declare const SelectItemGroup: {
28
+ ({ children, className, disabled, label, ...other }: SelectItemGroupProps): JSX.Element;
29
+ propTypes: {
30
+ /**
31
+ * Provide the contents of your <SelectItemGroup>
32
+ */
33
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
34
+ /**
35
+ * Specify an optional className to be applied to the node
36
+ */
37
+ className: PropTypes.Requireable<string>;
38
+ /**
39
+ * Specify whether the <SelectItemGroup> should be disabled
40
+ */
41
+ disabled: PropTypes.Requireable<boolean>;
42
+ /**
43
+ * Specify the label to be displayed
44
+ */
45
+ label: PropTypes.Validator<string>;
46
+ };
47
+ defaultProps: {
48
+ disabled: boolean;
49
+ label: string | undefined;
50
+ };
51
+ };
52
+ export default SelectItemGroup;
@@ -56,7 +56,7 @@ var SkeletonText = function SkeletonText(_ref) {
56
56
  useIsomorphicEffect["default"](function () {
57
57
  refs.current.map(function (item, j) {
58
58
  var randomPercentWidth = getRandomInt(0, 75, j) + 'px';
59
- var randomPxWidth = getRandomInt(widthNum - 75, widthNum, j) + 'px';
59
+ var randomPxWidth = getRandomInt(Math.max(widthNum - 75, 0), widthNum, j) + 'px';
60
60
 
61
61
  if (item) {
62
62
  if (widthPercent && paragraph) {
@@ -8,8 +8,8 @@ import PropTypes from 'prop-types';
8
8
  import { HTMLAttributes } from 'react';
9
9
  export interface SliderSkeletonProps extends HTMLAttributes<HTMLDivElement> {
10
10
  /**
11
- * Specify an optional className to add to the form item wrapper.
12
- */
11
+ * Specify an optional className to add to the form item wrapper.
12
+ */
13
13
  className?: string;
14
14
  /**
15
15
  * Specify whether the label should be hidden, or not
@@ -0,0 +1,355 @@
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, { KeyboardEventHandler, PureComponent } from 'react';
8
+ import PropTypes, { ReactNodeLike } from 'prop-types';
9
+ type ExcludedAttributes = 'onChange' | 'onBlur';
10
+ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
11
+ /**
12
+ * The `ariaLabel` for the `<input>`.
13
+ */
14
+ ariaLabelInput?: string;
15
+ /**
16
+ * The child nodes.
17
+ */
18
+ children?: ReactNodeLike;
19
+ /**
20
+ * The CSS class name for the slider.
21
+ */
22
+ className?: string;
23
+ /**
24
+ * `true` to disable this slider.
25
+ */
26
+ disabled?: boolean;
27
+ /**
28
+ * The callback to format the label associated with the minimum/maximum value.
29
+ */
30
+ formatLabel?: (value: number, label: string | undefined) => string;
31
+ /**
32
+ * `true` to hide the number input box.
33
+ */
34
+ hideTextInput?: boolean;
35
+ /**
36
+ * The ID of the `<input>`.
37
+ */
38
+ id?: string;
39
+ /**
40
+ * The `type` attribute of the `<input>`.
41
+ */
42
+ inputType?: string;
43
+ /**
44
+ * `true` to specify if the control is invalid.
45
+ */
46
+ invalid?: boolean;
47
+ /**
48
+ * The label for the slider.
49
+ */
50
+ labelText?: ReactNodeLike;
51
+ /**
52
+ * @deprecated
53
+ * `true` to use the light version.
54
+ */
55
+ light?: boolean;
56
+ /**
57
+ * The maximum value.
58
+ */
59
+ max: number;
60
+ /**
61
+ * The label associated with the maximum value.
62
+ */
63
+ maxLabel?: string;
64
+ /**
65
+ * The minimum value.
66
+ */
67
+ min: number;
68
+ /**
69
+ * The label associated with the minimum value.
70
+ */
71
+ minLabel?: string;
72
+ /**
73
+ * The `name` attribute of the `<input>`.
74
+ */
75
+ name?: string;
76
+ /**
77
+ * Provide an optional function to be called when the input element
78
+ * loses focus
79
+ */
80
+ onBlur?: (data: {
81
+ value: string;
82
+ }) => void;
83
+ /**
84
+ * The callback to get notified of change in value.
85
+ * `({ value}) => void`
86
+ // * @param {{ value }}
87
+ */
88
+ onChange?: (data: {
89
+ value: SliderProps['value'];
90
+ }) => void;
91
+ /**
92
+ * Provide an optional function to be called when a key is pressed in the number input
93
+ */
94
+ onInputKeyUp?: KeyboardEventHandler<HTMLInputElement>;
95
+ /**
96
+ * The callback to get notified of value on handle release.
97
+ */
98
+ onRelease?: (data: {
99
+ value: SliderProps['value'];
100
+ }) => void;
101
+ /**
102
+ * Whether the slider should be read-only
103
+ */
104
+ readOnly?: boolean;
105
+ /**
106
+ * `true` to specify if the control is required.
107
+ */
108
+ required?: boolean;
109
+ /**
110
+ * A value determining how much the value should increase/decrease by moving the thumb by mouse. If a value other than 1 is provided and the input is *not* hidden, the new step requirement should be added to a visible label. Values outside of the `step` increment will be considered invalid.
111
+ */
112
+ step?: number;
113
+ /**
114
+ * A value determining how much the value should increase/decrease by Shift+arrow keys,
115
+ * which will be `(max - min) / stepMultiplier`.
116
+ */
117
+ stepMultiplier?: number;
118
+ /**
119
+ * The value.
120
+ */
121
+ value: number;
122
+ }
123
+ interface CalcValueProps {
124
+ clientX?: number;
125
+ value?: number;
126
+ useRawValue?: boolean;
127
+ }
128
+ export default class Slider extends PureComponent<SliderProps> {
129
+ static propTypes: {
130
+ /**
131
+ * The `ariaLabel` for the `<input>`.
132
+ */
133
+ ariaLabelInput: PropTypes.Requireable<string>;
134
+ /**
135
+ * The child nodes.
136
+ */
137
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
138
+ /**
139
+ * The CSS class name for the slider.
140
+ */
141
+ className: PropTypes.Requireable<string>;
142
+ /**
143
+ * `true` to disable this slider.
144
+ */
145
+ disabled: PropTypes.Requireable<boolean>;
146
+ /**
147
+ * The callback to format the label associated with the minimum/maximum value.
148
+ */
149
+ formatLabel: PropTypes.Requireable<(...args: any[]) => any>;
150
+ /**
151
+ * `true` to hide the number input box.
152
+ */
153
+ hideTextInput: PropTypes.Requireable<boolean>;
154
+ /**
155
+ * The ID of the `<input>`.
156
+ */
157
+ id: PropTypes.Requireable<string>;
158
+ /**
159
+ * The `type` attribute of the `<input>`.
160
+ */
161
+ inputType: PropTypes.Requireable<string>;
162
+ /**
163
+ * `true` to specify if the control is invalid.
164
+ */
165
+ invalid: PropTypes.Requireable<boolean>;
166
+ /**
167
+ * The label for the slider.
168
+ */
169
+ labelText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
170
+ /**
171
+ * `true` to use the light version.
172
+ */
173
+ light: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
174
+ /**
175
+ * The maximum value.
176
+ */
177
+ max: PropTypes.Validator<number>;
178
+ /**
179
+ * The label associated with the maximum value.
180
+ */
181
+ maxLabel: PropTypes.Requireable<string>;
182
+ /**
183
+ * The minimum value.
184
+ */
185
+ min: PropTypes.Validator<number>;
186
+ /**
187
+ * The label associated with the minimum value.
188
+ */
189
+ minLabel: PropTypes.Requireable<string>;
190
+ /**
191
+ * The `name` attribute of the `<input>`.
192
+ */
193
+ name: PropTypes.Requireable<string>;
194
+ /**
195
+ * Provide an optional function to be called when the input element
196
+ * loses focus
197
+ */
198
+ onBlur: PropTypes.Requireable<(...args: any[]) => any>;
199
+ /**
200
+ * The callback to get notified of change in value.
201
+ */
202
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
203
+ /**
204
+ * Provide an optional function to be called when a key is pressed in the number input
205
+ */
206
+ onInputKeyUp: PropTypes.Requireable<(...args: any[]) => any>;
207
+ /**
208
+ * The callback to get notified of value on handle release.
209
+ */
210
+ onRelease: PropTypes.Requireable<(...args: any[]) => any>;
211
+ /**
212
+ * Whether the slider should be read-only
213
+ */
214
+ readOnly: PropTypes.Requireable<boolean>;
215
+ /**
216
+ * `true` to specify if the control is required.
217
+ */
218
+ required: PropTypes.Requireable<boolean>;
219
+ /**
220
+ * A value determining how much the value should increase/decrease by moving the thumb by mouse. If a value other than 1 is provided and the input is *not* hidden, the new step requirement should be added to a visible label. Values outside of the `step` increment will be considered invalid.
221
+ */
222
+ step: PropTypes.Requireable<number>;
223
+ /**
224
+ * A value determining how much the value should increase/decrease by Shift+arrow keys,
225
+ * which will be `(max - min) / stepMultiplier`.
226
+ */
227
+ stepMultiplier: PropTypes.Requireable<number>;
228
+ /**
229
+ * The value.
230
+ */
231
+ value: PropTypes.Validator<number>;
232
+ };
233
+ static defaultProps: {
234
+ hideTextInput: boolean;
235
+ step: number;
236
+ stepMultiplier: number;
237
+ disabled: boolean;
238
+ minLabel: string;
239
+ maxLabel: string;
240
+ inputType: string;
241
+ ariaLabelInput: string | undefined;
242
+ readOnly: boolean;
243
+ };
244
+ static contextType: React.Context<any>;
245
+ state: {
246
+ value: number;
247
+ left: number;
248
+ needsOnRelease: boolean;
249
+ isValid: boolean;
250
+ };
251
+ thumbRef: React.RefObject<HTMLDivElement>;
252
+ filledTrackRef: React.RefObject<HTMLDivElement>;
253
+ element: HTMLDivElement | null;
254
+ inputId: string;
255
+ track: HTMLDivElement | null | undefined;
256
+ constructor(props: any);
257
+ /**
258
+ * Sets up initial slider position and value in response to component mount.
259
+ */
260
+ componentDidMount(): void;
261
+ /**
262
+ * Handles firing of `onChange` and `onRelease` callbacks to parent in
263
+ * response to state changes.
264
+ *
265
+ * @param {*} prevProps prevProps
266
+ * @param {*} prevState The previous Slider state, used to see if callbacks
267
+ * should be called.
268
+ */
269
+ componentDidUpdate(prevProps: any, prevState: any): void;
270
+ /**
271
+ * Synonymous to ECMA2017+ `Math.clamp`.
272
+ *
273
+ * @param {number} val
274
+ * @param {number} min
275
+ * @param {number} max
276
+ *
277
+ * @returns `val` if `max>=val>=min`; `min` if `val<min`; `max` if `val>max`.
278
+ */
279
+ clamp(val: any, min: any, max: any): number;
280
+ /**
281
+ * Sets up "drag" event handlers and calls `this.onDrag` in case dragging
282
+ * started on somewhere other than the thumb without a corresponding "move"
283
+ * event.
284
+ *
285
+ * @param {Event} evt The event.
286
+ */
287
+ onDragStart: (evt: any) => void;
288
+ /**
289
+ * Unregisters "drag" and "drag stop" event handlers and calls sets the flag
290
+ * indicating that the `onRelease` callback should be called.
291
+ */
292
+ onDragStop: () => void;
293
+ /**
294
+ * Handles a "drag" event by recalculating the value/thumb and setting state
295
+ * accordingly.
296
+ *
297
+ * @param {Event} evt The event.
298
+ */
299
+ _onDrag: (evt: any) => void;
300
+ /**
301
+ * Throttles calls to `this._onDrag` by limiting events to being processed at
302
+ * most once every `EVENT_THROTTLE` milliseconds.
303
+ */
304
+ onDrag: any;
305
+ /**
306
+ * Handles a `keydown` event by recalculating the value/thumb and setting
307
+ * state accordingly.
308
+ *
309
+ * @param {Event} evt The event.
310
+ */
311
+ onKeyDown: (evt: any) => void;
312
+ /**
313
+ * Provides the two-way binding for the input field of the Slider. It also
314
+ * Handles a change to the input field by recalculating the value/thumb and
315
+ * setting state accordingly.
316
+ *
317
+ * @param {Event} evt The event.
318
+ */
319
+ onChange: (evt: any) => void;
320
+ /**
321
+ * Checks for validity of input value after clicking out of the input. It also
322
+ * Handles state change to isValid state.
323
+ *
324
+ * @param {Event} evt The event.
325
+ */
326
+ onBlur: (evt: React.FocusEvent<HTMLInputElement>) => void;
327
+ /**
328
+ * Calculates a new Slider `value` and `left` (thumb offset) given a `clientX`,
329
+ * `value`, or neither of those.
330
+ * - If `clientX` is specified, it will be used in
331
+ * conjunction with the Slider's bounding rectangle to calculate the new
332
+ * values.
333
+ * - If `clientX` is not specified and `value` is, it will be used to
334
+ * calculate new values as though it were the current value of the Slider.
335
+ * - If neither `clientX` nor `value` are specified, `this.props.value` will
336
+ * be used to calculate the new values as though it were the current value
337
+ * of the Slider.
338
+ *
339
+ * @param {object} params
340
+ * @param {number} [params.clientX] Optional clientX value expected to be from
341
+ * an event fired by one of the Slider's `DRAG_EVENT_TYPES` events.
342
+ * @param {number} [params.value] Optional value use during calculations if
343
+ * clientX is not provided.
344
+ * @param {boolean} [params.useRawValue=false] `true` to use the given value as-is.
345
+ */
346
+ calcValue: ({ clientX, value, useRawValue }: CalcValueProps) => {
347
+ value: number | undefined;
348
+ left: number;
349
+ };
350
+ static getDerivedStateFromProps(props: any, state: any): {
351
+ isValid: boolean;
352
+ } | null;
353
+ render(): JSX.Element;
354
+ }
355
+ export {};