rsuite 5.25.0 → 5.26.1

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.
@@ -1,6 +1,6 @@
1
1
  declare const useCalendarDate: (value: Date | null | undefined, defaultDate: Date | undefined) => {
2
2
  calendarDate: Date;
3
3
  setCalendarDate: (date: Date | undefined) => void;
4
- resetCalendarDate: () => void;
4
+ resetCalendarDate: (nextValue?: any) => void;
5
5
  };
6
6
  export default useCalendarDate;
@@ -15,19 +15,25 @@ var useCalendarDate = function useCalendarDate(value, defaultDate) {
15
15
  setValue(date);
16
16
  }
17
17
  }, [calendarDate]);
18
- var resetCalendarDate = useCallback(function () {
19
- var _ref2;
18
+ var resetCalendarDate = useCallback(function (nextValue) {
19
+ var _ref2, _nextValue;
20
20
 
21
- setValue((_ref2 = value !== null && value !== void 0 ? value : defaultDate) !== null && _ref2 !== void 0 ? _ref2 : new Date());
21
+ if (nextValue === void 0) {
22
+ nextValue = value;
23
+ }
24
+
25
+ setValue((_ref2 = (_nextValue = nextValue) !== null && _nextValue !== void 0 ? _nextValue : defaultDate) !== null && _ref2 !== void 0 ? _ref2 : new Date());
22
26
  }, [defaultDate, value]);
23
27
  useUpdateEffect(function () {
24
28
  var _valueRef$current;
25
29
 
26
30
  if ((value === null || value === void 0 ? void 0 : value.valueOf()) !== ((_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current.valueOf())) {
27
- setCalendarDate(value !== null && value !== void 0 ? value : new Date());
31
+ var _ref3;
32
+
33
+ setCalendarDate((_ref3 = value !== null && value !== void 0 ? value : defaultDate) !== null && _ref3 !== void 0 ? _ref3 : new Date());
28
34
  valueRef.current = value;
29
35
  }
30
- }, [value]);
36
+ }, [value, defaultDate]);
31
37
  return {
32
38
  calendarDate: calendarDate,
33
39
  setCalendarDate: setCalendarDate,
@@ -192,7 +192,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
192
192
 
193
193
  var handleClean = useCallback(function (event) {
194
194
  updateValue(event, null);
195
- resetCalendarDate();
195
+ resetCalendarDate(null);
196
196
  }, [resetCalendarDate, updateValue]);
197
197
  /**
198
198
  * Handle keyboard events.
package/esm/Form/Form.js CHANGED
@@ -213,6 +213,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (props, ref) {
213
213
  * so use Ref to get future error
214
214
  */
215
215
  var formError = omit(realFormErrorRef.current, [name]);
216
+ realFormErrorRef.current = formError;
216
217
  setFormError(formError);
217
218
  onCheck === null || onCheck === void 0 ? void 0 : onCheck(formError);
218
219
  }, [onCheck, setFormError]);
@@ -222,6 +223,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (props, ref) {
222
223
  * so use Ref to get future value
223
224
  */
224
225
  var formValue = omit(realFormValueRef.current, [name]);
226
+ realFormValueRef.current = formValue;
225
227
  setFormValue(formValue);
226
228
  onChange === null || onChange === void 0 ? void 0 : onChange(formValue);
227
229
  }, [onChange, setFormValue]);
@@ -14,7 +14,14 @@ import FormContext, { FormValueContext } from '../Form/FormContext';
14
14
  import { FormGroupContext } from '../FormGroup/FormGroup';
15
15
  import { useWillUnmount } from '../utils';
16
16
  import useRegisterModel from './useRegisterModel';
17
+ import Toggle from '../Toggle';
18
+ /**
19
+ * Props that FormControl passes to its accepter
20
+ */
21
+
17
22
  var FormControl = /*#__PURE__*/React.forwardRef(function (props, ref) {
23
+ var _accepterProps;
24
+
18
25
  var _useContext = useContext(FormContext),
19
26
  readOnlyContext = _useContext.readOnly,
20
27
  plaintextContext = _useContext.plaintext,
@@ -139,6 +146,15 @@ var FormControl = /*#__PURE__*/React.forwardRef(function (props, ref) {
139
146
  var ariaDescribedby = controlId ? controlId + "-help-text" : null;
140
147
  var fieldHasError = Boolean(messageNode);
141
148
  var ariaErrormessage = fieldHasError && controlId ? controlId + "-error-message" : undefined;
149
+ var valueKey = 'value';
150
+ var defaultValueKey = 'defaultValue'; // Toggle component is a special case that uses `checked` and `defaultChecked` instead of `value` and `defaultValue` props.
151
+
152
+ if (AccepterComponent === Toggle) {
153
+ valueKey = 'checked';
154
+ defaultValueKey = 'defaultChecked';
155
+ }
156
+
157
+ var accepterProps = (_accepterProps = {}, _accepterProps[valueKey] = val, _accepterProps[defaultValueKey] = defaultValue !== null && defaultValue !== void 0 ? defaultValue : formDefaultValue[name], _accepterProps);
142
158
  return /*#__PURE__*/React.createElement(Component, {
143
159
  className: classes,
144
160
  ref: ref
@@ -148,15 +164,13 @@ var FormControl = /*#__PURE__*/React.forwardRef(function (props, ref) {
148
164
  "aria-describedby": ariaDescribedby,
149
165
  "aria-invalid": fieldHasError || undefined,
150
166
  "aria-errormessage": ariaErrormessage
151
- }, rest, {
167
+ }, rest, accepterProps, {
152
168
  readOnly: readOnly,
153
169
  plaintext: plaintext,
154
170
  disabled: disabled,
155
171
  name: name,
156
172
  onChange: handleFieldChange,
157
- onBlur: handleFieldBlur,
158
- defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : formDefaultValue[name],
159
- value: val
173
+ onBlur: handleFieldBlur
160
174
  })), /*#__PURE__*/React.createElement(FormErrorMessage, {
161
175
  id: controlId + "-error-message",
162
176
  role: "alert",
@@ -437,9 +437,15 @@ var InputPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
437
437
  setValue(null);
438
438
  setFocusItemValue(null);
439
439
  setSearchKeyword('');
440
- handleChange(null, event);
440
+
441
+ if (multi) {
442
+ handleChange([], event);
443
+ } else {
444
+ handleChange(null, event);
445
+ }
446
+
441
447
  onClean === null || onClean === void 0 ? void 0 : onClean(event);
442
- }, [disabled, searchKeyword, onClean, handleChange, setValue, setFocusItemValue, setSearchKeyword]);
448
+ }, [disabled, searchKeyword, setValue, setFocusItemValue, setSearchKeyword, multi, onClean, handleChange]);
443
449
  var events = {
444
450
  onMenuPressBackspace: multi ? removeLastItem : handleClean,
445
451
  onMenuKeyDown: onKeyDown,
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  import React, { useContext } from 'react';
4
4
  import PropTypes from 'prop-types';
5
+ import castArray from 'lodash/castArray';
5
6
  import omit from 'lodash/omit';
6
7
  import { mergeRefs, PLACEMENT_8, placementPolyfill, useClassNames } from '../utils';
7
8
  import deprecatePropType from '../utils/deprecatePropType';
@@ -52,7 +53,7 @@ var NavbarDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
52
53
  mergeMenuClassName = _useClassNames2.merge;
53
54
 
54
55
  return /*#__PURE__*/React.createElement(Disclosure, {
55
- trigger: trigger,
56
+ trigger: castArray(trigger),
56
57
  hideOnClickOutside: true,
57
58
  onToggle: function onToggle(open) {
58
59
  _onToggle === null || _onToggle === void 0 ? void 0 : _onToggle(open);
@@ -66,13 +67,15 @@ var NavbarDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
66
67
  }, function (_ref, containerRef) {
67
68
  var _withClassPrefix;
68
69
 
69
- var open = _ref.open;
70
+ var open = _ref.open,
71
+ props = _objectWithoutPropertiesLoose(_ref, ["open"]);
72
+
70
73
  var classes = merge(className, withClassPrefix((_withClassPrefix = {}, _withClassPrefix["placement-" + kebabCase(placementPolyfill(placement))] = !!placement, _withClassPrefix.disabled = disabled, _withClassPrefix.open = open, _withClassPrefix)));
71
- return /*#__PURE__*/React.createElement(Component, {
74
+ return /*#__PURE__*/React.createElement(Component, _extends({
72
75
  ref: mergeRefs(ref, containerRef),
73
76
  className: classes,
74
77
  style: style
75
- }, /*#__PURE__*/React.createElement(Disclosure.Button, null, function (buttonProps, buttonRef) {
78
+ }, props), /*#__PURE__*/React.createElement(Disclosure.Button, null, function (buttonProps, buttonRef) {
76
79
  return /*#__PURE__*/React.createElement(NavbarDropdownToggle, _extends({
77
80
  ref: buttonRef,
78
81
  as: toggleAs,
@@ -1,13 +1,15 @@
1
1
  import { InputPickerProps, TriggerType } from '../InputPicker/InputPicker';
2
2
  import type { PickerComponent } from '../Picker/types';
3
3
  import type { TagProps } from '../Tag';
4
- export interface TagInputProps extends InputPickerProps {
4
+ export interface TagInputProps extends Omit<InputPickerProps<readonly string[]>, 'data'> {
5
5
  /** Tag related props. */
6
6
  tagProps?: TagProps;
7
7
  /**
8
8
  * Set the trigger for creating tags. only valid when creatable
9
+ *
10
+ * @todo Declare as readonly array
9
11
  */
10
- trigger: TriggerType | TriggerType[];
12
+ trigger?: TriggerType | TriggerType[];
11
13
  }
12
14
  declare const TagInput: PickerComponent<TagInputProps>;
13
15
  export default TagInput;
@@ -10,12 +10,13 @@ export { default as fiFI } from './fi_FI';
10
10
  export { default as itIT } from './it_IT';
11
11
  export { default as kkKZ } from './kk_KZ';
12
12
  export { default as koKR } from './ko_KR';
13
+ export { default as nlNL } from './nl_NL';
13
14
  export { default as ptBR } from './pt_BR';
14
15
  export { default as ruRU } from './ru_RU';
15
16
  export { default as svSE } from './sv_SE';
16
17
  export { default as trTR } from './tr_TR';
17
18
  export { default as zhCN } from './zh_CN';
18
- export { default as zhTw } from './zh_TW';
19
+ export { default as zhTW } from './zh_TW';
19
20
  export { default as faIR } from './fa_IR';
20
21
  export { default as frFR } from './fr_FR';
21
22
  declare type PickKeys<T> = {
@@ -9,11 +9,12 @@ export { default as fiFI } from './fi_FI';
9
9
  export { default as itIT } from './it_IT';
10
10
  export { default as kkKZ } from './kk_KZ';
11
11
  export { default as koKR } from './ko_KR';
12
+ export { default as nlNL } from './nl_NL';
12
13
  export { default as ptBR } from './pt_BR';
13
14
  export { default as ruRU } from './ru_RU';
14
15
  export { default as svSE } from './sv_SE';
15
16
  export { default as trTR } from './tr_TR';
16
17
  export { default as zhCN } from './zh_CN';
17
- export { default as zhTw } from './zh_TW';
18
+ export { default as zhTW } from './zh_TW';
18
19
  export { default as faIR } from './fa_IR';
19
20
  export { default as frFR } from './fr_FR';
@@ -0,0 +1,105 @@
1
+ declare const _default: {
2
+ common: {
3
+ loading: string;
4
+ emptyMessage: string;
5
+ };
6
+ Plaintext: {
7
+ unfilled: string;
8
+ notSelected: string;
9
+ notUploaded: string;
10
+ };
11
+ Pagination: {
12
+ more: string;
13
+ prev: string;
14
+ next: string;
15
+ first: string;
16
+ last: string;
17
+ limit: string;
18
+ total: string;
19
+ skip: string;
20
+ };
21
+ Calendar: {
22
+ sunday: string;
23
+ monday: string;
24
+ tuesday: string;
25
+ wednesday: string;
26
+ thursday: string;
27
+ friday: string;
28
+ saturday: string;
29
+ ok: string;
30
+ today: string;
31
+ yesterday: string;
32
+ hours: string;
33
+ minutes: string;
34
+ seconds: string;
35
+ formattedMonthPattern: string;
36
+ formattedDayPattern: string;
37
+ dateLocale: any;
38
+ };
39
+ DatePicker: {
40
+ sunday: string;
41
+ monday: string;
42
+ tuesday: string;
43
+ wednesday: string;
44
+ thursday: string;
45
+ friday: string;
46
+ saturday: string;
47
+ ok: string;
48
+ today: string;
49
+ yesterday: string;
50
+ hours: string;
51
+ minutes: string;
52
+ seconds: string;
53
+ formattedMonthPattern: string;
54
+ formattedDayPattern: string;
55
+ dateLocale: any;
56
+ };
57
+ DateRangePicker: {
58
+ last7Days: string;
59
+ sunday: string;
60
+ monday: string;
61
+ tuesday: string;
62
+ wednesday: string;
63
+ thursday: string;
64
+ friday: string;
65
+ saturday: string;
66
+ ok: string;
67
+ today: string;
68
+ yesterday: string;
69
+ hours: string;
70
+ minutes: string;
71
+ seconds: string;
72
+ formattedMonthPattern: string;
73
+ formattedDayPattern: string;
74
+ dateLocale: any;
75
+ };
76
+ Picker: {
77
+ noResultsText: string;
78
+ placeholder: string;
79
+ searchPlaceholder: string;
80
+ checkAll: string;
81
+ };
82
+ InputPicker: {
83
+ newItem: string;
84
+ createOption: string;
85
+ };
86
+ Uploader: {
87
+ inited: string;
88
+ progress: string;
89
+ error: string;
90
+ complete: string;
91
+ emptyFile: string;
92
+ upload: string;
93
+ };
94
+ CloseButton: {
95
+ closeLabel: string;
96
+ };
97
+ Breadcrumb: {
98
+ expandText: string;
99
+ };
100
+ Toggle: {
101
+ on: string;
102
+ off: string;
103
+ };
104
+ };
105
+ export default _default;
@@ -0,0 +1,74 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import nl from 'date-fns/locale/nl';
3
+ var Calendar = {
4
+ sunday: 'Zo',
5
+ monday: 'Ma',
6
+ tuesday: 'Di',
7
+ wednesday: 'Wo',
8
+ thursday: 'Do',
9
+ friday: 'Vr',
10
+ saturday: 'Za',
11
+ ok: 'Oke',
12
+ today: 'Vandaag',
13
+ yesterday: 'Gisteren',
14
+ hours: 'Uren',
15
+ minutes: 'Mimnuten',
16
+ seconds: 'Seconden',
17
+ formattedMonthPattern: 'MMM, yyyy',
18
+ formattedDayPattern: 'dd MMM, yyyy',
19
+ dateLocale: nl
20
+ };
21
+ export default {
22
+ common: {
23
+ loading: 'Laden...',
24
+ emptyMessage: 'Geen data gevonden'
25
+ },
26
+ Plaintext: {
27
+ unfilled: 'Ongevuld',
28
+ notSelected: 'Niet geselecteerd',
29
+ notUploaded: 'Niet geupload'
30
+ },
31
+ Pagination: {
32
+ more: 'Meer',
33
+ prev: 'Vorige',
34
+ next: 'Volgende',
35
+ first: 'Eerste',
36
+ last: 'Laatste',
37
+ limit: '{0} / pagina',
38
+ total: 'Totaal Rijen: {0}',
39
+ skip: 'Ga naar{0}'
40
+ },
41
+ Calendar: Calendar,
42
+ DatePicker: _extends({}, Calendar),
43
+ DateRangePicker: _extends({}, Calendar, {
44
+ last7Days: 'Laatste 7 Dagen'
45
+ }),
46
+ Picker: {
47
+ noResultsText: 'Geen resultaten gevonden',
48
+ placeholder: 'Selecteren',
49
+ searchPlaceholder: 'Zoeken',
50
+ checkAll: 'Alles'
51
+ },
52
+ InputPicker: {
53
+ newItem: 'Nieuw item',
54
+ createOption: 'Creëer optie "{0}"'
55
+ },
56
+ Uploader: {
57
+ inited: 'Gestart',
58
+ progress: 'Uploaden',
59
+ error: 'Error',
60
+ complete: 'Voltooid',
61
+ emptyFile: 'Leeg',
62
+ upload: 'Upload'
63
+ },
64
+ CloseButton: {
65
+ closeLabel: 'Sluiten'
66
+ },
67
+ Breadcrumb: {
68
+ expandText: 'Toon pad'
69
+ },
70
+ Toggle: {
71
+ on: 'Open',
72
+ off: 'Sluit'
73
+ }
74
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "rsuite/locales/nl_NL",
3
+ "private": true,
4
+ "main": "../../cjs/locales/nl_NL.js",
5
+ "module": "../../esm/locales/nl_NL.js",
6
+ "types": "../../esm/locales/nl_NL.d.ts"
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.25.0",
3
+ "version": "5.26.1",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",