rsuite 5.53.1 → 5.54.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 (106) hide show
  1. package/AutoComplete/styles/index.css +0 -2
  2. package/CHANGELOG.md +28 -0
  3. package/Cascader/styles/index.css +0 -2
  4. package/CheckPicker/styles/index.css +0 -2
  5. package/CheckTree/styles/index.css +0 -2
  6. package/CheckTreePicker/styles/index.css +0 -2
  7. package/DatePicker/styles/index.css +0 -2
  8. package/DateRangePicker/styles/index.css +0 -2
  9. package/FormGroup/styles/index.css +3 -0
  10. package/FormGroup/styles/index.less +2 -0
  11. package/InlineEdit/package.json +7 -0
  12. package/InlineEdit/styles/index.css +112 -0
  13. package/InlineEdit/styles/index.less +48 -0
  14. package/InputGroup/styles/index.css +0 -2
  15. package/InputGroup/styles/index.less +0 -2
  16. package/InputNumber/styles/index.css +0 -2
  17. package/InputPicker/styles/index.css +0 -2
  18. package/MultiCascader/styles/index.css +0 -2
  19. package/Pagination/styles/index.css +0 -2
  20. package/SelectPicker/styles/index.css +0 -2
  21. package/TagInput/styles/index.css +1 -4
  22. package/TagPicker/styles/index.css +1 -4
  23. package/TagPicker/styles/index.less +1 -2
  24. package/cjs/CheckTreePicker/CheckTreePicker.js +20 -10
  25. package/cjs/DatePicker/DatePicker.js +1 -1
  26. package/cjs/DateRangePicker/DateRangePicker.js +5 -0
  27. package/cjs/InlineEdit/EditableControls.d.ts +8 -0
  28. package/cjs/InlineEdit/EditableControls.js +34 -0
  29. package/cjs/InlineEdit/InlineEdit.d.ts +56 -0
  30. package/cjs/InlineEdit/InlineEdit.js +98 -0
  31. package/cjs/InlineEdit/index.d.ts +3 -0
  32. package/cjs/InlineEdit/index.js +9 -0
  33. package/cjs/InlineEdit/renderChildren.d.ts +12 -0
  34. package/cjs/InlineEdit/renderChildren.js +40 -0
  35. package/cjs/InlineEdit/useEditState.d.ts +22 -0
  36. package/cjs/InlineEdit/useEditState.js +82 -0
  37. package/cjs/InlineEdit/useFocusEvent.d.ts +14 -0
  38. package/cjs/InlineEdit/useFocusEvent.js +61 -0
  39. package/cjs/Input/Input.js +6 -3
  40. package/cjs/InputPicker/InputPicker.js +6 -5
  41. package/cjs/Slider/Slider.d.ts +2 -0
  42. package/cjs/Slider/Slider.js +4 -2
  43. package/cjs/TreePicker/TreePicker.js +20 -11
  44. package/cjs/index.d.ts +2 -0
  45. package/cjs/index.js +3 -1
  46. package/cjs/internals/Picker/ListCheckItem.js +0 -1
  47. package/cjs/internals/Picker/Listbox.d.ts +5 -1
  48. package/cjs/internals/Picker/Listbox.js +6 -5
  49. package/cjs/internals/Picker/hooks/usePickerRef.js +2 -0
  50. package/cjs/internals/Picker/types.d.ts +2 -0
  51. package/cjs/internals/symbols.d.ts +2 -0
  52. package/cjs/internals/symbols.js +9 -0
  53. package/cjs/utils/getDataGroupBy.d.ts +0 -1
  54. package/cjs/utils/getDataGroupBy.js +3 -5
  55. package/dist/rsuite-no-reset-rtl.css +91 -4
  56. package/dist/rsuite-no-reset-rtl.min.css +1 -1
  57. package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
  58. package/dist/rsuite-no-reset.css +91 -4
  59. package/dist/rsuite-no-reset.min.css +1 -1
  60. package/dist/rsuite-no-reset.min.css.map +1 -1
  61. package/dist/rsuite-rtl.css +91 -4
  62. package/dist/rsuite-rtl.min.css +1 -1
  63. package/dist/rsuite-rtl.min.css.map +1 -1
  64. package/dist/rsuite.css +91 -4
  65. package/dist/rsuite.js +89 -12
  66. package/dist/rsuite.js.map +1 -1
  67. package/dist/rsuite.min.css +1 -1
  68. package/dist/rsuite.min.css.map +1 -1
  69. package/dist/rsuite.min.js +1 -1
  70. package/dist/rsuite.min.js.map +1 -1
  71. package/esm/CheckTreePicker/CheckTreePicker.js +20 -10
  72. package/esm/DatePicker/DatePicker.js +1 -1
  73. package/esm/DateRangePicker/DateRangePicker.js +5 -0
  74. package/esm/InlineEdit/EditableControls.d.ts +8 -0
  75. package/esm/InlineEdit/EditableControls.js +28 -0
  76. package/esm/InlineEdit/InlineEdit.d.ts +56 -0
  77. package/esm/InlineEdit/InlineEdit.js +92 -0
  78. package/esm/InlineEdit/index.d.ts +3 -0
  79. package/esm/InlineEdit/index.js +3 -0
  80. package/esm/InlineEdit/renderChildren.d.ts +12 -0
  81. package/esm/InlineEdit/renderChildren.js +34 -0
  82. package/esm/InlineEdit/useEditState.d.ts +22 -0
  83. package/esm/InlineEdit/useEditState.js +76 -0
  84. package/esm/InlineEdit/useFocusEvent.d.ts +14 -0
  85. package/esm/InlineEdit/useFocusEvent.js +56 -0
  86. package/esm/Input/Input.js +6 -3
  87. package/esm/InputPicker/InputPicker.js +6 -5
  88. package/esm/Slider/Slider.d.ts +2 -0
  89. package/esm/Slider/Slider.js +4 -2
  90. package/esm/TreePicker/TreePicker.js +20 -11
  91. package/esm/index.d.ts +2 -0
  92. package/esm/index.js +1 -0
  93. package/esm/internals/Picker/ListCheckItem.js +0 -1
  94. package/esm/internals/Picker/Listbox.d.ts +5 -1
  95. package/esm/internals/Picker/Listbox.js +7 -6
  96. package/esm/internals/Picker/hooks/usePickerRef.js +2 -0
  97. package/esm/internals/Picker/types.d.ts +2 -0
  98. package/esm/internals/symbols.d.ts +2 -0
  99. package/esm/internals/symbols.js +3 -0
  100. package/esm/utils/getDataGroupBy.d.ts +0 -1
  101. package/esm/utils/getDataGroupBy.js +2 -3
  102. package/package.json +1 -1
  103. package/styles/color-modes/dark.less +3 -0
  104. package/styles/color-modes/high-contrast.less +3 -0
  105. package/styles/color-modes/light.less +3 -0
  106. package/styles/index.less +1 -0
package/esm/index.js CHANGED
@@ -57,6 +57,7 @@ export { default as Uploader } from './Uploader';
57
57
  export { default as Slider } from './Slider';
58
58
  export { default as RangeSlider } from './RangeSlider';
59
59
  export { default as Rate } from './Rate';
60
+ export { default as InlineEdit } from './InlineEdit';
60
61
  // Data display
61
62
  export { default as Tree } from './Tree';
62
63
  export { default as CheckTree } from './CheckTree';
@@ -65,7 +65,6 @@ var ListCheckItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
65
65
  onClick: handleSelectItem,
66
66
  onCheckboxClick: handleCheck
67
67
  };
68
- console.log(className, 'className');
69
68
  return /*#__PURE__*/React.createElement(Component, _extends({
70
69
  role: "option",
71
70
  "aria-selected": active,
@@ -1,9 +1,13 @@
1
1
  import React from 'react';
2
2
  import { ListProps, ListHandle } from '../../internals/Windowing';
3
3
  import { StandardProps, ItemDataType } from '../../@types/common';
4
+ import { RSUITE_PICKER_GROUP_KEY } from '../../internals/symbols';
5
+ interface InnerItemDataType extends ItemDataType {
6
+ [RSUITE_PICKER_GROUP_KEY]?: boolean;
7
+ }
4
8
  export interface ListboxProps<Multiple = false> extends StandardProps, Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
5
9
  classPrefix: string;
6
- data?: ItemDataType[];
10
+ data?: InnerItemDataType[];
7
11
  group?: boolean;
8
12
  groupBy?: string;
9
13
  disabledItemValues?: any[];
@@ -17,8 +17,9 @@ import { List, AutoSizer, VariableSizeList } from '../../internals/Windowing';
17
17
  import shallowEqual from '../../utils/shallowEqual';
18
18
  import { mergeRefs, useClassNames, useMount, useEventCallback } from '../../utils';
19
19
  import ListItemGroup from './ListItemGroup';
20
- import { KEY_GROUP, KEY_GROUP_TITLE } from '../../utils/getDataGroupBy';
20
+ import { KEY_GROUP_TITLE } from '../../utils/getDataGroupBy';
21
21
  import useCombobox from './hooks/useCombobox';
22
+ import { RSUITE_PICKER_GROUP_KEY } from '../../internals/symbols';
22
23
  var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
23
24
  var _props$data = props.data,
24
25
  data = _props$data === void 0 ? [] : _props$data,
@@ -86,7 +87,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
86
87
  });
87
88
  var getRowHeight = function getRowHeight(list, index) {
88
89
  var item = list[index];
89
- if (group && item[KEY_GROUP] && index !== 0) {
90
+ if (group && item[RSUITE_PICKER_GROUP_KEY] && index !== 0) {
90
91
  return rowGroupHeight;
91
92
  }
92
93
  return rowHeight;
@@ -115,7 +116,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
115
116
  var filteredItems = group ? data.filter(function (item) {
116
117
  var _item$parent;
117
118
  // Display group title items
118
- if (item[KEY_GROUP]) return true;
119
+ if (item[RSUITE_PICKER_GROUP_KEY]) return true;
119
120
 
120
121
  // Display items under the unfolded group
121
122
  // FIXME-Doma
@@ -139,7 +140,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
139
140
  var item = itemData || data[index];
140
141
  var value = item[valueKey];
141
142
  var label = item[labelKey];
142
- if (isUndefined(label) && !item[KEY_GROUP]) {
143
+ if (isUndefined(label) && !item[RSUITE_PICKER_GROUP_KEY]) {
143
144
  throw Error("labelKey \"" + labelKey + "\" is not defined in \"data\" : " + index);
144
145
  }
145
146
 
@@ -150,7 +151,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
150
151
  * Render <ListboxGroup>
151
152
  * when if `group` is enabled
152
153
  */
153
- if (group && item[KEY_GROUP]) {
154
+ if (group && item[RSUITE_PICKER_GROUP_KEY]) {
154
155
  var groupValue = item[KEY_GROUP_TITLE];
155
156
  // TODO: grouped options should be owned by group
156
157
  return /*#__PURE__*/React.createElement(ListItemGroup, {
@@ -164,7 +165,7 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
164
165
  key: "group-" + groupValue,
165
166
  onClick: handleGroupTitleClick.bind(null, groupValue)
166
167
  }, renderMenuGroup ? renderMenuGroup(groupValue, item) : groupValue);
167
- } else if (isUndefined(value) && !isUndefined(item[KEY_GROUP])) {
168
+ } else if (isUndefined(value) && !isUndefined(item[RSUITE_PICKER_GROUP_KEY])) {
168
169
  throw Error("valueKey \"" + valueKey + "\" is not defined in \"data\" : " + index + " ");
169
170
  }
170
171
  var disabled = disabledItemValues === null || disabledItemValues === void 0 ? void 0 : disabledItemValues.some(function (disabledValue) {
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  import { useImperativeHandle, useRef } from 'react';
3
3
  import useEventCallback from '../../../utils/useEventCallback';
4
+ import { RSUITE_PICKER_TYPE } from '../../../internals/symbols';
4
5
  /**
5
6
  * A hook of the exposed method of Picker
6
7
  */
@@ -64,6 +65,7 @@ function usePickerRef(ref, parmas) {
64
65
  }
65
66
  return list === null || list === void 0 ? void 0 : list.current;
66
67
  },
68
+ type: RSUITE_PICKER_TYPE,
67
69
  updatePosition: handleUpdatePosition,
68
70
  open: handleOpen,
69
71
  close: handleClose
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { RsRefForwardingComponent } from '../../@types/common';
3
3
  import type { ListHandle } from '../../internals/Windowing';
4
+ import { RSUITE_PICKER_TYPE } from '../../internals/symbols';
4
5
  export interface PickerHandle {
6
+ type?: typeof RSUITE_PICKER_TYPE;
5
7
  root: HTMLElement | null;
6
8
  list?: ListHandle;
7
9
  overlay?: HTMLElement | null;
@@ -0,0 +1,2 @@
1
+ export declare const RSUITE_PICKER_TYPE: symbol;
2
+ export declare const RSUITE_PICKER_GROUP_KEY: unique symbol;
@@ -0,0 +1,3 @@
1
+ 'use client';
2
+ export var RSUITE_PICKER_TYPE = Symbol.for('rsuite.picker');
3
+ export var RSUITE_PICKER_GROUP_KEY = Symbol.for('rsuite.picker_group_key');
@@ -1,4 +1,3 @@
1
- export declare const KEY_GROUP: string | symbol;
2
1
  export declare const KEY_GROUP_TITLE = "groupTitle";
3
2
  export declare function getDataGroupBy<T>(data: readonly T[], key: string, sort?: (isGroup: boolean) => <T>(a: T, b: T) => number): (T | {
4
3
  groupTitle: string;
@@ -1,8 +1,7 @@
1
1
  'use client';
2
2
  import _groupBy from "lodash/groupBy";
3
3
  import { WalkTreeStrategy, flattenTree } from '../utils/treeUtils';
4
- var hasSymbol = typeof Symbol === 'function';
5
- export var KEY_GROUP = hasSymbol ? Symbol('_$grouped') : '_$grouped';
4
+ import { RSUITE_PICKER_GROUP_KEY } from '../internals/symbols';
6
5
  export var KEY_GROUP_TITLE = 'groupTitle';
7
6
  export function getDataGroupBy(data, key, sort) {
8
7
  var groupMap = _groupBy(data, key);
@@ -13,7 +12,7 @@ export function getDataGroupBy(data, key, sort) {
13
12
  children = _ref[1];
14
13
  return _ref2 = {
15
14
  children: isSort ? children.sort(sort(false)) : children
16
- }, _ref2[KEY_GROUP_TITLE] = groupTitle, _ref2[KEY_GROUP] = true, _ref2;
15
+ }, _ref2[KEY_GROUP_TITLE] = groupTitle, _ref2[RSUITE_PICKER_GROUP_KEY] = true, _ref2;
17
16
  });
18
17
  if (isSort) {
19
18
  groups.sort(sort(true));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.53.1",
3
+ "version": "5.54.0",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -242,6 +242,9 @@
242
242
  --rs-input-focus-border: var(--rs-primary-500);
243
243
  --rs-input-disabled-bg: var(--rs-gray-700);
244
244
 
245
+ // InlineEdit
246
+ --rs-inline-edit-hover-bg: var(--rs-gray-500);
247
+
245
248
  // ARIA Listboxes
246
249
  --rs-listbox-option-hover-bg: var(--rs-gray-600);
247
250
  --rs-listbox-option-hover-text: currentColor;
@@ -247,6 +247,9 @@
247
247
  --rs-input-focus-border: var(--rs-primary-500);
248
248
  --rs-input-disabled-bg: var(--rs-gray-700);
249
249
 
250
+ // InlineEdit
251
+ --rs-inline-edit-hover-bg: transparent;
252
+
250
253
  // ARIA Listboxes
251
254
  --rs-listbox-option-hover-bg: transparent;
252
255
  --rs-listbox-option-hover-text: var(--rs-primary-500);
@@ -253,6 +253,9 @@
253
253
  --rs-input-focus-border: var(--rs-primary-500);
254
254
  --rs-input-disabled-bg: var(--rs-gray-50);
255
255
 
256
+ // InlineEdit
257
+ --rs-inline-edit-hover-bg: var(--rs-gray-200);
258
+
256
259
  // ARIA Listboxes
257
260
  --rs-listbox-option-hover-bg: rgb(from var(--rs-primary-100) r g b / 50%);
258
261
  --rs-listbox-option-hover-text: var(--rs-primary-700);
package/styles/index.less CHANGED
@@ -41,6 +41,7 @@
41
41
  @import '../InputGroup/styles/index';
42
42
  @import '../InputNumber/styles/index';
43
43
  @import '../InputPicker/styles/index';
44
+ @import '../InlineEdit/styles/index';
44
45
  @import '../List/styles/index';
45
46
  @import '../Loader/styles/index';
46
47
  @import '../Message/styles/index';