@algolia/satellite 1.0.0-beta.132 → 1.0.0-beta.133
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.
- package/cjs/AnnouncementBadge/AnnouncementBadge.d.ts +1 -0
- package/cjs/AnnouncementBadge/AnnouncementBadge.js +3 -2
- package/cjs/AutoComplete/AutoComplete.d.ts +24 -14
- package/cjs/AutoComplete/AutoComplete.js +84 -15
- package/cjs/AutoComplete/components/DefaultOptionItem.d.ts +6 -2
- package/cjs/AutoComplete/components/DefaultOptionItem.js +5 -2
- package/cjs/AutoComplete/types.d.ts +26 -18
- package/cjs/AutoComplete/utils.d.ts +4 -4
- package/cjs/DatePicker/DatePicker/DatePicker.d.ts +5 -11
- package/cjs/DatePicker/DatePicker/DatePicker.js +10 -6
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.d.ts +5 -11
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.js +12 -6
- package/cjs/DatePicker/DateRangePicker/DateRangePickerDisplay.d.ts +2 -0
- package/cjs/DatePicker/DateRangePicker/DateRangePickerDisplay.js +3 -2
- package/cjs/DatePicker/components/Calendar.d.ts +4 -1
- package/cjs/DatePicker/components/Calendar.js +3 -1
- package/cjs/DatePicker/components/Display.d.ts +1 -1
- package/cjs/DatePicker/components/FooterActions.d.ts +2 -0
- package/cjs/DatePicker/components/FooterActions.js +4 -3
- package/cjs/DatePicker/components/Modal.d.ts +2 -2
- package/cjs/DatePicker/components/NavBar.d.ts +4 -1
- package/cjs/DatePicker/components/NavBar.js +4 -3
- package/cjs/DatePicker/types.d.ts +17 -0
- package/cjs/DatePicker/types.js +5 -0
- package/cjs/HelpUnderline/HelpUnderline.d.ts +1 -0
- package/cjs/KeyboardKey/KeyboardKey.d.ts +1 -0
- package/cjs/Modal/Modal.d.ts +4 -2
- package/cjs/Modal/Modal.js +2 -3
- package/cjs/Pagination/CompactPagination/CompactPagination.d.ts +12 -0
- package/cjs/Pagination/CompactPagination/CompactPagination.js +6 -6
- package/cjs/Pagination/DotPagination/DotPagination.d.ts +4 -1
- package/cjs/Pagination/DotPagination/DotPagination.js +5 -2
- package/cjs/Pagination/Pagination/Pagination.d.ts +7 -1
- package/cjs/Pagination/Pagination/Pagination.js +15 -8
- package/cjs/ScrollIndicator/ScrollIndicator.d.ts +2 -0
- package/cjs/Sidebar/Sidebar.d.ts +2 -0
- package/cjs/Tables/DataTable/DataTable.d.ts +11 -1
- package/cjs/Tables/DataTable/DataTable.js +3 -2
- package/cjs/Tables/DataTable/components/Body.d.ts +2 -2
- package/cjs/Tables/DataTable/components/Body.js +6 -5
- package/cjs/Tables/DataTable/components/Loader.d.ts +3 -1
- package/cjs/Tables/DataTable/components/Loader.js +4 -3
- package/cjs/Tag/Tag.d.ts +4 -1
- package/cjs/Tag/Tag.js +3 -2
- package/cjs/Tooltip/OverflowTooltipWrapper.d.ts +1 -0
- package/cjs/Tooltip/OverflowTooltipWrapper.js +1 -0
- package/cjs/utils/pluralize.js +6 -1
- package/esm/AnnouncementBadge/AnnouncementBadge.d.ts +1 -0
- package/esm/AnnouncementBadge/AnnouncementBadge.js +3 -2
- package/esm/AutoComplete/AutoComplete.d.ts +24 -14
- package/esm/AutoComplete/AutoComplete.js +85 -15
- package/esm/AutoComplete/components/DefaultOptionItem.d.ts +6 -2
- package/esm/AutoComplete/components/DefaultOptionItem.js +5 -2
- package/esm/AutoComplete/types.d.ts +26 -18
- package/esm/AutoComplete/utils.d.ts +4 -4
- package/esm/DatePicker/DatePicker/DatePicker.d.ts +5 -11
- package/esm/DatePicker/DatePicker/DatePicker.js +10 -6
- package/esm/DatePicker/DateRangePicker/DateRangePicker.d.ts +5 -11
- package/esm/DatePicker/DateRangePicker/DateRangePicker.js +12 -6
- package/esm/DatePicker/DateRangePicker/DateRangePickerDisplay.d.ts +2 -0
- package/esm/DatePicker/DateRangePicker/DateRangePickerDisplay.js +3 -2
- package/esm/DatePicker/components/Calendar.d.ts +4 -1
- package/esm/DatePicker/components/Calendar.js +3 -1
- package/esm/DatePicker/components/Display.d.ts +1 -1
- package/esm/DatePicker/components/FooterActions.d.ts +2 -0
- package/esm/DatePicker/components/FooterActions.js +4 -3
- package/esm/DatePicker/components/Modal.d.ts +2 -2
- package/esm/DatePicker/components/NavBar.d.ts +4 -1
- package/esm/DatePicker/components/NavBar.js +4 -3
- package/esm/DatePicker/types.d.ts +17 -0
- package/esm/DatePicker/types.js +1 -0
- package/esm/HelpUnderline/HelpUnderline.d.ts +1 -0
- package/esm/KeyboardKey/KeyboardKey.d.ts +1 -0
- package/esm/Modal/Modal.d.ts +4 -2
- package/esm/Modal/Modal.js +2 -3
- package/esm/Pagination/CompactPagination/CompactPagination.d.ts +12 -0
- package/esm/Pagination/CompactPagination/CompactPagination.js +6 -6
- package/esm/Pagination/DotPagination/DotPagination.d.ts +4 -1
- package/esm/Pagination/DotPagination/DotPagination.js +5 -2
- package/esm/Pagination/Pagination/Pagination.d.ts +7 -1
- package/esm/Pagination/Pagination/Pagination.js +15 -8
- package/esm/ScrollIndicator/ScrollIndicator.d.ts +2 -0
- package/esm/Sidebar/Sidebar.d.ts +2 -0
- package/esm/Tables/DataTable/DataTable.d.ts +11 -1
- package/esm/Tables/DataTable/DataTable.js +3 -2
- package/esm/Tables/DataTable/components/Body.d.ts +2 -2
- package/esm/Tables/DataTable/components/Body.js +6 -5
- package/esm/Tables/DataTable/components/Loader.d.ts +3 -1
- package/esm/Tables/DataTable/components/Loader.js +4 -3
- package/esm/Tag/Tag.d.ts +4 -1
- package/esm/Tag/Tag.js +3 -2
- package/esm/Tooltip/OverflowTooltipWrapper.d.ts +1 -0
- package/esm/Tooltip/OverflowTooltipWrapper.js +2 -0
- package/esm/utils/pluralize.js +6 -1
- package/package.json +1 -1
- package/satellite.min.css +1 -1
@@ -4,6 +4,7 @@ export interface AnnouncementBadgeProps extends HTMLAttributes<HTMLSpanElement>
|
|
4
4
|
size?: AnnouncementBadgeSizes;
|
5
5
|
text?: "new" | "beta" | "internal" | "pilot";
|
6
6
|
variant?: "accent" | "red";
|
7
|
+
locale?: string;
|
7
8
|
children?: never;
|
8
9
|
}
|
9
10
|
export declare const AnnouncementBadge: FunctionComponent<AnnouncementBadgeProps>;
|
@@ -19,7 +19,7 @@ var _satellitePrefixer = _interopRequireDefault(require("../styles/helpers/satel
|
|
19
19
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
21
21
|
|
22
|
-
var _excluded = ["size", "text", "variant", "className"];
|
22
|
+
var _excluded = ["size", "text", "variant", "className", "locale"];
|
23
23
|
|
24
24
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
25
25
|
|
@@ -40,11 +40,12 @@ var AnnouncementBadge = function AnnouncementBadge(_ref) {
|
|
40
40
|
text = _ref$text === void 0 ? "new" : _ref$text,
|
41
41
|
variantProp = _ref.variant,
|
42
42
|
className = _ref.className,
|
43
|
+
locale = _ref.locale,
|
43
44
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
44
45
|
var variant = typeof variantProp === "string" ? variantProp : text === "internal" ? "red" : "accent";
|
45
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", _objectSpread(_objectSpread({}, props), {}, {
|
46
47
|
className: (0, _classnames["default"])(DEFAULT_CLASSNAME, variant === "red" ? (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["bg-red-600"]))) : (0, _satellitePrefixer["default"])(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["bg-accent-600"]))), SIZE_CLASSNAMES[size], className),
|
47
|
-
children: text
|
48
|
+
children: locale || text
|
48
49
|
}));
|
49
50
|
};
|
50
51
|
|
@@ -1,14 +1,17 @@
|
|
1
|
-
import { ControllerStateAndHelpers } from "downshift";
|
1
|
+
import type { A11yStatusMessageOptions, ControllerStateAndHelpers } from "downshift";
|
2
2
|
import { Component } from "react";
|
3
3
|
import type { ChangeEvent, FocusEvent, KeyboardEvent, MouseEvent } from "react";
|
4
4
|
import { FieldState } from "../Field/FieldStateContext";
|
5
|
-
import type { AutoCompleteProps, Option } from "./types";
|
5
|
+
import type { AutoCompleteLocale, AutoCompleteProps, Option, OptionItemProps } from "./types";
|
6
6
|
interface State {
|
7
7
|
inputFocused: boolean;
|
8
8
|
inputValue: string;
|
9
9
|
inputWidth?: number;
|
10
10
|
showAllResults: boolean;
|
11
11
|
}
|
12
|
+
declare type DefaultOptionProps = OptionItemProps & {
|
13
|
+
locale?: AutoCompleteLocale;
|
14
|
+
};
|
12
15
|
/**
|
13
16
|
* Autocomplete is a search-as-you-type function that matches what a person types, usually the beginning of a word, or a prefix, with a word list. Not to be confused with auto-suggestion that predicts the end of a query.
|
14
17
|
*
|
@@ -25,37 +28,44 @@ interface State {
|
|
25
28
|
* - Provide matching results quickly
|
26
29
|
* - Style different data
|
27
30
|
*/
|
28
|
-
export declare class AutoComplete<T extends Option> extends Component<AutoCompleteProps
|
31
|
+
export declare class AutoComplete<T extends Option = Option> extends Component<AutoCompleteProps<T>, State> {
|
29
32
|
static defaultProps: {
|
30
33
|
clearable: boolean;
|
31
34
|
creatable: boolean;
|
32
35
|
multiple: boolean;
|
33
36
|
maxResults: number;
|
34
|
-
|
35
|
-
createFromInputValue: import("./types").CreateFromInputValue;
|
37
|
+
createFromInputValue: <T_1 extends Option = Option>(options: T_1[] | undefined, inputValue: string) => Option[];
|
36
38
|
options: never[];
|
37
39
|
separatorKeyCodes: never[];
|
38
40
|
separatorKeys: never[];
|
39
|
-
optionItemComponent:
|
41
|
+
optionItemComponent: ({ locale, ...props }: DefaultOptionProps) => JSX.Element;
|
40
42
|
noWrap: boolean;
|
43
|
+
locale: {
|
44
|
+
clearInputButton: string;
|
45
|
+
emptyStateTitle: string;
|
46
|
+
itemsAvailable: (resultCount: number) => string;
|
47
|
+
showMoreButton: (extraResults: number) => string;
|
48
|
+
optionItemPrefix: (multiple: boolean) => "Add" | "Use";
|
49
|
+
};
|
41
50
|
};
|
42
51
|
state: State;
|
43
52
|
inputContainerRef: HTMLDivElement | null;
|
44
53
|
inputRef: HTMLInputElement | null;
|
45
|
-
componentDidUpdate(prevProps: AutoCompleteProps): void;
|
54
|
+
componentDidUpdate(prevProps: AutoCompleteProps<T>): void;
|
46
55
|
handleClearClick: () => void;
|
47
56
|
handleFakeInputClick: () => void | null;
|
48
|
-
handleInputBlur: (state: ControllerStateAndHelpers<Option>) => (evt: FocusEvent<HTMLInputElement>) => void;
|
57
|
+
handleInputBlur: (state: ControllerStateAndHelpers<T | Option>) => (evt: FocusEvent<HTMLInputElement>) => void;
|
49
58
|
handleInputChange: (evt: ChangeEvent<HTMLInputElement>) => void;
|
50
59
|
handleInputContainerRefUpdate: (el: HTMLDivElement | null) => void;
|
51
60
|
updateInputWidth: () => void;
|
52
|
-
handleKeyDown: (state: ControllerStateAndHelpers<Option>) => (evt: KeyboardEvent<any>) => void;
|
53
|
-
handleChange: (option:
|
61
|
+
handleKeyDown: (state: ControllerStateAndHelpers<T | Option>) => (evt: KeyboardEvent<any>) => void;
|
62
|
+
handleChange: (option: T) => void;
|
54
63
|
handleShowAllResults: (evt: MouseEvent<HTMLButtonElement>) => void;
|
55
|
-
removeValue: (removedOption:
|
56
|
-
|
57
|
-
|
58
|
-
|
64
|
+
removeValue: (removedOption: T) => void;
|
65
|
+
getA11yStatusMessage: (options: A11yStatusMessageOptions<any>) => string;
|
66
|
+
renderInput: (results: T[], autocompleteHelpers: ControllerStateAndHelpers<T | Option>, fieldState: FieldState) => JSX.Element;
|
67
|
+
renderMenu: (results: T[], autocompleteHelpers: ControllerStateAndHelpers<T | Option>) => JSX.Element;
|
68
|
+
renderSelect: (autocompleteHelpers: ControllerStateAndHelpers<T | Option>, fieldState: FieldState) => JSX.Element;
|
59
69
|
render(): JSX.Element;
|
60
70
|
}
|
61
71
|
export default AutoComplete;
|
@@ -27,6 +27,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
27
27
|
|
28
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
29
29
|
|
30
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
31
|
+
|
30
32
|
var _classnames = _interopRequireDefault(require("classnames"));
|
31
33
|
|
32
34
|
var _downshift = _interopRequireDefault(require("downshift"));
|
@@ -65,14 +67,16 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
65
67
|
|
66
68
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
|
67
69
|
|
68
|
-
|
69
|
-
|
70
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
70
|
+
var _excluded = ["locale"];
|
71
71
|
|
72
72
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
73
73
|
|
74
74
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
75
75
|
|
76
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
77
|
+
|
78
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
79
|
+
|
76
80
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
77
81
|
|
78
82
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
@@ -140,9 +144,31 @@ var MENU_POPPER_MODFIERS = [{
|
|
140
144
|
}
|
141
145
|
}];
|
142
146
|
var BACKSPACE_KEY_CODE = 8;
|
143
|
-
|
144
|
-
|
145
|
-
|
147
|
+
|
148
|
+
/** @ignore */
|
149
|
+
var DefaultEmptyState = function DefaultEmptyState(_ref) {
|
150
|
+
var _locale$emptyStateTit;
|
151
|
+
|
152
|
+
var locale = _ref.locale;
|
153
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AutoCompleteEmptyState["default"], {
|
154
|
+
title: (_locale$emptyStateTit = locale === null || locale === void 0 ? void 0 : locale.emptyStateTitle) !== null && _locale$emptyStateTit !== void 0 ? _locale$emptyStateTit : AutoComplete.defaultProps.locale.emptyStateTitle
|
155
|
+
});
|
156
|
+
};
|
157
|
+
|
158
|
+
/** @ignore */
|
159
|
+
var DefaultOption = function DefaultOption(_ref2) {
|
160
|
+
var locale = _ref2.locale,
|
161
|
+
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
162
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultOptionItem["default"], _objectSpread(_objectSpread({}, props), {}, {
|
163
|
+
locale: {
|
164
|
+
optionItemPrefix: function optionItemPrefix(multiple) {
|
165
|
+
var _locale$optionItemPre, _locale$optionItemPre2;
|
166
|
+
|
167
|
+
return (_locale$optionItemPre = locale === null || locale === void 0 ? void 0 : (_locale$optionItemPre2 = locale.optionItemPrefix) === null || _locale$optionItemPre2 === void 0 ? void 0 : _locale$optionItemPre2.call(locale, multiple)) !== null && _locale$optionItemPre !== void 0 ? _locale$optionItemPre : AutoComplete.defaultProps.locale.optionItemPrefix(multiple);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}));
|
171
|
+
};
|
146
172
|
/**
|
147
173
|
* Autocomplete is a search-as-you-type function that matches what a person types, usually the beginning of a word, or a prefix, with a word list. Not to be confused with auto-suggestion that predicts the end of a query.
|
148
174
|
*
|
@@ -160,6 +186,7 @@ var defaultEmptyState = /*#__PURE__*/(0, _jsxRuntime.jsx)(_AutoCompleteEmptyStat
|
|
160
186
|
* - Style different data
|
161
187
|
*/
|
162
188
|
|
189
|
+
|
163
190
|
var AutoComplete = /*#__PURE__*/function (_Component) {
|
164
191
|
(0, _inherits2["default"])(AutoComplete, _Component);
|
165
192
|
|
@@ -333,7 +360,28 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
333
360
|
|
334
361
|
_this.props.onChange(newOptions);
|
335
362
|
});
|
363
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getA11yStatusMessage", function (options) {
|
364
|
+
if (!options.isOpen) {
|
365
|
+
return "";
|
366
|
+
}
|
367
|
+
|
368
|
+
if (!options.resultCount) {
|
369
|
+
var _this$props$locale$em, _this$props$locale;
|
370
|
+
|
371
|
+
return (_this$props$locale$em = (_this$props$locale = _this.props.locale) === null || _this$props$locale === void 0 ? void 0 : _this$props$locale.emptyStateTitle) !== null && _this$props$locale$em !== void 0 ? _this$props$locale$em : "";
|
372
|
+
}
|
373
|
+
|
374
|
+
if (options.resultCount > 0) {
|
375
|
+
var _this$props$locale$it, _this$props$locale2, _this$props$locale2$i;
|
376
|
+
|
377
|
+
return (_this$props$locale$it = (_this$props$locale2 = _this.props.locale) === null || _this$props$locale2 === void 0 ? void 0 : (_this$props$locale2$i = _this$props$locale2.itemsAvailable) === null || _this$props$locale2$i === void 0 ? void 0 : _this$props$locale2$i.call(_this$props$locale2, options.resultCount)) !== null && _this$props$locale$it !== void 0 ? _this$props$locale$it : "";
|
378
|
+
}
|
379
|
+
|
380
|
+
return "";
|
381
|
+
});
|
336
382
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderInput", function (results, autocompleteHelpers, fieldState) {
|
383
|
+
var _this$props$locale3;
|
384
|
+
|
337
385
|
var _this$props3 = _this.props,
|
338
386
|
id = _this$props3.id,
|
339
387
|
placeholder = _this$props3.placeholder,
|
@@ -431,7 +479,7 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
431
479
|
type: "button",
|
432
480
|
className: (0, _satellitePrefixer["default"])(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["w-6 flex items-center justify-center text-grey-500"]))),
|
433
481
|
onClick: _this.handleClearClick,
|
434
|
-
"aria-label":
|
482
|
+
"aria-label": (_this$props$locale3 = _this.props.locale) === null || _this$props$locale3 === void 0 ? void 0 : _this$props$locale3.clearInputButton,
|
435
483
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFeather.X, {
|
436
484
|
size: ".75rem"
|
437
485
|
})
|
@@ -447,12 +495,15 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
447
495
|
highlightedIndex = autocompleteHelpers.highlightedIndex,
|
448
496
|
inputValue = autocompleteHelpers.inputValue,
|
449
497
|
isOpen = autocompleteHelpers.isOpen;
|
498
|
+
var defaultEmptyState = /*#__PURE__*/(0, _jsxRuntime.jsx)(DefaultEmptyState, {
|
499
|
+
locale: _this.props.locale
|
500
|
+
});
|
450
501
|
var _this$props4 = _this.props,
|
451
502
|
menuClassName = _this$props4.menuClassName,
|
452
503
|
menuSize = _this$props4.menuSize,
|
453
|
-
_this$props4$emptySta = _this$props4.emptyState,
|
454
|
-
emptyState = _this$props4$emptySta === void 0 ? AutoComplete.defaultProps.emptyState : _this$props4$emptySta,
|
455
504
|
menuFooter = _this$props4.menuFooter,
|
505
|
+
_this$props4$emptySta = _this$props4.emptyState,
|
506
|
+
emptyState = _this$props4$emptySta === void 0 ? defaultEmptyState : _this$props4$emptySta,
|
456
507
|
_this$props4$maxResul = _this$props4.maxResults,
|
457
508
|
maxResults = _this$props4$maxResul === void 0 ? AutoComplete.defaultProps.maxResults : _this$props4$maxResul,
|
458
509
|
_this$props4$multiple = _this$props4.multiple,
|
@@ -487,6 +538,8 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
487
538
|
referenceElement: (_this$inputContainerR3 = _this.inputContainerRef) !== null && _this$inputContainerR3 !== void 0 ? _this$inputContainerR3 : undefined,
|
488
539
|
modifiers: MENU_POPPER_MODFIERS,
|
489
540
|
children: function children(popper) {
|
541
|
+
var _this$props$locale4, _this$props$locale4$s;
|
542
|
+
|
490
543
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
491
544
|
className: (0, _classnames["default"])((0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["z-dropdown"]))), menuClassName),
|
492
545
|
style: _objectSpread(_objectSpread({}, popper.style), dropdownStyle),
|
@@ -509,16 +562,17 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
509
562
|
})), {}, {
|
510
563
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(OptionItem, _objectSpread(_objectSpread({}, optionItemProps), {}, {
|
511
564
|
highlighted: index === highlightedIndex,
|
512
|
-
option: result
|
565
|
+
option: result,
|
566
|
+
locale: _this.props.locale
|
513
567
|
}))
|
514
568
|
}), result.value);
|
515
569
|
}), extraResults > 0 && !showAllResults && /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
516
570
|
className: (0, _satellitePrefixer["default"])(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["p-2 text-right"]))),
|
517
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
571
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
518
572
|
variant: "subtle",
|
519
573
|
size: "small",
|
520
574
|
onMouseDown: _this.handleShowAllResults,
|
521
|
-
children:
|
575
|
+
children: (_this$props$locale4 = _this.props.locale) === null || _this$props$locale4 === void 0 ? void 0 : (_this$props$locale4$s = _this$props$locale4.showMoreButton) === null || _this$props$locale4$s === void 0 ? void 0 : _this$props$locale4$s.call(_this$props$locale4, extraResults)
|
522
576
|
})
|
523
577
|
})]
|
524
578
|
}))
|
@@ -589,6 +643,7 @@ var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
589
643
|
*/
|
590
644
|
,
|
591
645
|
selectedItem: null,
|
646
|
+
getA11yStatusMessage: _this2.getA11yStatusMessage,
|
592
647
|
onChange: _this2.handleChange,
|
593
648
|
itemToString: optionToString,
|
594
649
|
defaultHighlightedIndex: 0,
|
@@ -609,13 +664,27 @@ exports.AutoComplete = AutoComplete;
|
|
609
664
|
creatable: false,
|
610
665
|
multiple: false,
|
611
666
|
maxResults: 7,
|
612
|
-
emptyState: defaultEmptyState,
|
613
667
|
createFromInputValue: _utils.defaultCreateFromInputValue,
|
614
668
|
options: [],
|
615
669
|
separatorKeyCodes: [],
|
616
670
|
separatorKeys: [],
|
617
|
-
optionItemComponent:
|
618
|
-
noWrap: false
|
671
|
+
optionItemComponent: DefaultOption,
|
672
|
+
noWrap: false,
|
673
|
+
locale: {
|
674
|
+
clearInputButton: "Clear input value",
|
675
|
+
emptyStateTitle: "No matches found",
|
676
|
+
itemsAvailable: function itemsAvailable(resultCount) {
|
677
|
+
return "".concat((0, _pluralize["default"])(resultCount, "item is", {
|
678
|
+
plural: "items are"
|
679
|
+
}), " available");
|
680
|
+
},
|
681
|
+
showMoreButton: function showMoreButton(extraResults) {
|
682
|
+
return "Show ".concat((0, _pluralize["default"])(extraResults, "result"), " more");
|
683
|
+
},
|
684
|
+
optionItemPrefix: function optionItemPrefix(multiple) {
|
685
|
+
return multiple ? "Add" : "Use";
|
686
|
+
}
|
687
|
+
}
|
619
688
|
});
|
620
689
|
var _default = AutoComplete;
|
621
690
|
exports["default"] = _default;
|
@@ -1,3 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/// <reference types="react" />
|
2
|
+
import type { AutoCompleteLocale, OptionItemProps } from "../types";
|
3
|
+
declare type DefaultOptionItemProps = OptionItemProps & {
|
4
|
+
locale?: AutoCompleteLocale;
|
5
|
+
};
|
6
|
+
declare const DefaultOptionItem: ({ option, multiple, locale }: DefaultOptionItemProps) => JSX.Element;
|
3
7
|
export default DefaultOptionItem;
|
@@ -21,13 +21,16 @@ var metadataSpacer = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
21
21
|
});
|
22
22
|
|
23
23
|
var DefaultOptionItem = function DefaultOptionItem(_ref) {
|
24
|
+
var _locale$optionItemPre;
|
25
|
+
|
24
26
|
var option = _ref.option,
|
25
|
-
multiple = _ref.multiple
|
27
|
+
multiple = _ref.multiple,
|
28
|
+
locale = _ref.locale;
|
26
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
27
30
|
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["truncate py-2"]))),
|
28
31
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
29
32
|
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["font-semibold text-md text-grey-900"]))),
|
30
|
-
children: option["new"] ? "".concat(
|
33
|
+
children: option["new"] ? "".concat(locale === null || locale === void 0 ? void 0 : (_locale$optionItemPre = locale.optionItemPrefix) === null || _locale$optionItemPre === void 0 ? void 0 : _locale$optionItemPre.call(locale, multiple), " ").concat(option.label) : option.label
|
31
34
|
}), option.metadata && option.metadata.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
32
35
|
className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["flex text-grey-600"]))),
|
33
36
|
children: option.metadata.map(function (metadata, idx) {
|
@@ -1,7 +1,14 @@
|
|
1
1
|
import type { ComponentType, FocusEventHandler, ReactNode } from "react";
|
2
2
|
import type { IconComponentType } from "../types";
|
3
3
|
export declare type AutoCompleteVariant = "medium" | "large";
|
4
|
-
export
|
4
|
+
export declare type AutoCompleteLocale = {
|
5
|
+
emptyStateTitle?: string;
|
6
|
+
clearInputButton?: string;
|
7
|
+
itemsAvailable?: (resultCount: number) => string;
|
8
|
+
showMoreButton?: (extraResults: number) => string;
|
9
|
+
optionItemPrefix?: (multiple: boolean) => string;
|
10
|
+
};
|
11
|
+
export interface AutoCompleteBaseProps<T extends Option = Option> {
|
5
12
|
id?: string;
|
6
13
|
icon?: IconComponentType;
|
7
14
|
name?: string;
|
@@ -12,7 +19,7 @@ export interface AutoCompleteBaseProps {
|
|
12
19
|
placeholder?: string;
|
13
20
|
disabled?: boolean;
|
14
21
|
autoFocus?: boolean;
|
15
|
-
options?:
|
22
|
+
options?: T[];
|
16
23
|
inputValue?: string;
|
17
24
|
onTextChange?: (text: string) => any;
|
18
25
|
onFocus?: FocusEventHandler<HTMLInputElement>;
|
@@ -21,13 +28,13 @@ export interface AutoCompleteBaseProps {
|
|
21
28
|
clearable?: boolean;
|
22
29
|
selectOnBlur?: boolean;
|
23
30
|
maxResults?: number;
|
24
|
-
createFromInputValue?: CreateFromInputValue
|
31
|
+
createFromInputValue?: CreateFromInputValue<T>;
|
25
32
|
separatorKeyCodes?: number[];
|
26
33
|
separatorKeys?: string[];
|
27
|
-
renderValueTemplate?: (args: RenderValueTemplateArgs) => JSX.Element;
|
34
|
+
renderValueTemplate?: (args: RenderValueTemplateArgs<T>) => JSX.Element;
|
28
35
|
emptyState?: ReactNode;
|
29
36
|
menuFooter?: ReactNode;
|
30
|
-
optionItemComponent?: OptionItemComponentType
|
37
|
+
optionItemComponent?: OptionItemComponentType<T>;
|
31
38
|
/** Keep the input on a single line */
|
32
39
|
noWrap?: boolean;
|
33
40
|
endItem?: ReactNode;
|
@@ -36,18 +43,19 @@ export interface AutoCompleteBaseProps {
|
|
36
43
|
* @default "medium"
|
37
44
|
*/
|
38
45
|
menuSize?: "medium" | "large";
|
46
|
+
locale?: AutoCompleteLocale;
|
39
47
|
}
|
40
|
-
export interface AutoCompleteSingleProps extends AutoCompleteBaseProps {
|
48
|
+
export interface AutoCompleteSingleProps<T extends Option = Option> extends AutoCompleteBaseProps<T> {
|
41
49
|
multiple?: false;
|
42
|
-
value?:
|
43
|
-
onChange: (option:
|
50
|
+
value?: T;
|
51
|
+
onChange: (option: T | null) => void;
|
44
52
|
}
|
45
|
-
export interface AutoCompleteMultiProps extends AutoCompleteBaseProps {
|
53
|
+
export interface AutoCompleteMultiProps<T extends Option = Option> extends AutoCompleteBaseProps<T> {
|
46
54
|
multiple: true;
|
47
|
-
value?:
|
48
|
-
onChange: (option:
|
55
|
+
value?: T[];
|
56
|
+
onChange: (option: T[] | null) => void;
|
49
57
|
}
|
50
|
-
export declare type AutoCompleteProps = AutoCompleteMultiProps | AutoCompleteSingleProps
|
58
|
+
export declare type AutoCompleteProps<T extends Option = Option> = AutoCompleteMultiProps<T> | AutoCompleteSingleProps<T>;
|
51
59
|
declare type OptionsValue = string | number | boolean;
|
52
60
|
export interface Option {
|
53
61
|
value: OptionsValue;
|
@@ -57,22 +65,22 @@ export interface Option {
|
|
57
65
|
disabled?: boolean;
|
58
66
|
bypassNeedleMatch?: boolean;
|
59
67
|
}
|
60
|
-
export interface OptionItemProps {
|
61
|
-
option:
|
68
|
+
export interface OptionItemProps<T extends Option = Option> {
|
69
|
+
option: T;
|
62
70
|
multiple: boolean;
|
63
71
|
inputValue: string;
|
64
72
|
highlighted: boolean;
|
65
73
|
}
|
66
|
-
export declare type OptionItemComponentType = ComponentType<OptionItemProps
|
74
|
+
export declare type OptionItemComponentType<T extends Option = Option> = ComponentType<OptionItemProps<T>>;
|
67
75
|
export interface OptionRendererParams {
|
68
76
|
multiple: boolean;
|
69
77
|
inputValue: string;
|
70
78
|
highlighted: boolean;
|
71
79
|
}
|
72
|
-
export interface RenderValueTemplateArgs {
|
73
|
-
option:
|
80
|
+
export interface RenderValueTemplateArgs<T extends Option = Option> {
|
81
|
+
option: T;
|
74
82
|
key: string;
|
75
83
|
editable: boolean;
|
76
84
|
}
|
77
|
-
export declare type CreateFromInputValue = (options:
|
85
|
+
export declare type CreateFromInputValue<T extends Option = Option> = (options: T[] | undefined, inputValue: string) => Option[];
|
78
86
|
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { AutoCompleteMultiProps, AutoCompleteProps,
|
2
|
-
export declare function isAutoCompleteMultiProps(props: AutoCompleteProps): props is AutoCompleteMultiProps
|
3
|
-
export declare const defaultCreateFromInputValue:
|
4
|
-
export declare const caseInsensitiveCreateFromInputValue:
|
1
|
+
import type { AutoCompleteMultiProps, AutoCompleteProps, Option } from "./types";
|
2
|
+
export declare function isAutoCompleteMultiProps<T extends Option = Option>(props: AutoCompleteProps<T>): props is AutoCompleteMultiProps<T>;
|
3
|
+
export declare const defaultCreateFromInputValue: <T extends Option = Option>(options: T[] | undefined, inputValue: string) => Option[];
|
4
|
+
export declare const caseInsensitiveCreateFromInputValue: <T extends Option = Option>(options: T[] | undefined, inputValue: string) => Option[];
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { Dispatch, FunctionComponent, MouseEvent, ReactNode } from "react";
|
2
|
-
import { CalendarProps } from "../components/Calendar";
|
3
|
-
import { DisplayProps } from "../components/Display";
|
4
|
-
import { FooterActionsProps } from "../components/FooterActions";
|
5
|
-
import {
|
2
|
+
import type { CalendarProps } from "../components/Calendar";
|
3
|
+
import type { DisplayProps } from "../components/Display";
|
4
|
+
import type { FooterActionsProps } from "../components/FooterActions";
|
5
|
+
import type { SharedDatePickerProps } from "../types";
|
6
6
|
import { DatePickerReducerAction, DatePickerReducerState } from "./datePickerReducer";
|
7
7
|
interface LeftFooterComponentArgs {
|
8
8
|
state: DatePickerReducerState;
|
@@ -29,12 +29,6 @@ export declare type DatePickerProps = {
|
|
29
29
|
value?: Date | null;
|
30
30
|
initialValue?: Date | null;
|
31
31
|
buttonSize?: DisplayProps["size"];
|
32
|
-
|
33
|
-
} & ({
|
34
|
-
editableYear?: false;
|
35
|
-
} | {
|
36
|
-
editableYear: true;
|
37
|
-
years?: number[];
|
38
|
-
});
|
32
|
+
} & SharedDatePickerProps;
|
39
33
|
declare const DatePicker: FunctionComponent<DatePickerProps>;
|
40
34
|
export default DatePicker;
|
@@ -42,7 +42,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
42
42
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
43
43
|
|
44
44
|
var DatePicker = function DatePicker(props) {
|
45
|
-
var _props$initialValue, _props$validate, _props$validate$call, _props$calendarProps;
|
45
|
+
var _props$initialValue, _props$validate, _props$validate$call, _props$locale, _props$calendarProps;
|
46
46
|
|
47
47
|
var _useState = (0, _react.useState)(null),
|
48
48
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
@@ -127,7 +127,7 @@ var DatePicker = function DatePicker(props) {
|
|
127
127
|
children: value ? /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {
|
128
128
|
dateTime: value.toISOString(),
|
129
129
|
children: (0, _utils.formatDate)(value)
|
130
|
-
}) : "Enter a date..."
|
130
|
+
}) : ((_props$locale = props.locale) === null || _props$locale === void 0 ? void 0 : _props$locale.openButton) || "Enter a date..."
|
131
131
|
})
|
132
132
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal["default"], {
|
133
133
|
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["date-picker"]))),
|
@@ -145,12 +145,14 @@ var DatePicker = function DatePicker(props) {
|
|
145
145
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
146
146
|
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["flex"]))),
|
147
147
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
148
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Calendar["default"], _objectSpread(_objectSpread({
|
148
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Calendar["default"], _objectSpread(_objectSpread(_objectSpread({
|
149
149
|
numberOfMonths: 1
|
150
150
|
}, (_props$calendarProps = props === null || props === void 0 ? void 0 : props.calendarProps) !== null && _props$calendarProps !== void 0 ? _props$calendarProps : {}), {}, {
|
151
151
|
selectedDays: value !== null && value !== void 0 ? value : undefined,
|
152
152
|
onDayClick: handleDayClick
|
153
|
-
}, yearProps)
|
153
|
+
}, yearProps), {}, {
|
154
|
+
locale: props.locale
|
155
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Footer["default"], {
|
154
156
|
children: [props.renderLeftFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
155
157
|
children: props.renderLeftFooter({
|
156
158
|
state: state,
|
@@ -159,7 +161,8 @@ var DatePicker = function DatePicker(props) {
|
|
159
161
|
}), !props.renderRightPanel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FooterActions["default"], {
|
160
162
|
onCancel: handleClose,
|
161
163
|
onApply: handleApply,
|
162
|
-
disableApply: !isValid
|
164
|
+
disableApply: !isValid,
|
165
|
+
locale: props.locale
|
163
166
|
})]
|
164
167
|
})]
|
165
168
|
}), props.renderRightPanel && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
@@ -172,7 +175,8 @@ var DatePicker = function DatePicker(props) {
|
|
172
175
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FooterActions["default"], {
|
173
176
|
onCancel: handleClose,
|
174
177
|
onApply: handleApply,
|
175
|
-
disableApply: !isValid
|
178
|
+
disableApply: !isValid,
|
179
|
+
locale: props.locale
|
176
180
|
})]
|
177
181
|
})]
|
178
182
|
})]
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { Dispatch, FunctionComponent, ReactNode } from "react";
|
2
|
-
import { CalendarProps } from "../components/Calendar";
|
3
|
-
import {
|
4
|
-
import { DateRangePickerDisplayProps } from "./DateRangePickerDisplay";
|
2
|
+
import type { CalendarProps } from "../components/Calendar";
|
3
|
+
import type { SharedDatePickerProps } from "../types";
|
4
|
+
import type { DateRangePickerDisplayProps } from "./DateRangePickerDisplay";
|
5
5
|
import { dateRangePickerReducer, DateRangePickerReducerAction, DateRangePickerReducerState } from "./dateRangePickerReducer";
|
6
|
-
import { DateRangePickerTimeRange } from "./dateRangePickerTimeRange";
|
6
|
+
import type { DateRangePickerTimeRange } from "./dateRangePickerTimeRange";
|
7
7
|
interface LeftFooterComponentArgs {
|
8
8
|
state: DateRangePickerReducerState;
|
9
9
|
dispatch: Dispatch<DateRangePickerReducerAction>;
|
@@ -29,12 +29,6 @@ export declare type DateRangePickerProps = {
|
|
29
29
|
renderLeftFooter?: (args: LeftFooterComponentArgs) => ReactNode;
|
30
30
|
renderRightPanel?: (args: RightSidePanelComponentArgs) => ReactNode;
|
31
31
|
buttonSize?: DateRangePickerDisplayProps["buttonSize"];
|
32
|
-
|
33
|
-
} & ({
|
34
|
-
editableYear?: false;
|
35
|
-
} | {
|
36
|
-
editableYear: true;
|
37
|
-
years?: number[];
|
38
|
-
});
|
32
|
+
} & SharedDatePickerProps;
|
39
33
|
declare const DateRangePicker: FunctionComponent<DateRangePickerProps>;
|
40
34
|
export default DateRangePicker;
|
@@ -39,7 +39,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
39
39
|
|
40
40
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
41
41
|
|
42
|
-
var _excluded = ["id", "range", "displayOnlyRanges", "calendarProps", "initialState", "stateReducer", "onAction", "validate", "renderTarget", "renderLeftFooter", "renderRightPanel", "buttonSize", "modalPlacement"];
|
42
|
+
var _excluded = ["id", "range", "displayOnlyRanges", "calendarProps", "initialState", "stateReducer", "onAction", "validate", "renderTarget", "renderLeftFooter", "renderRightPanel", "buttonSize", "modalPlacement", "locale"];
|
43
43
|
|
44
44
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
45
45
|
|
@@ -70,6 +70,7 @@ var DateRangePicker = function DateRangePicker(_ref2) {
|
|
70
70
|
renderRightPanel = _ref2.renderRightPanel,
|
71
71
|
buttonSize = _ref2.buttonSize,
|
72
72
|
modalPlacement = _ref2.modalPlacement,
|
73
|
+
locale = _ref2.locale,
|
73
74
|
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
74
75
|
|
75
76
|
var _useState = (0, _react.useState)(null),
|
@@ -204,7 +205,8 @@ var DateRangePicker = function DateRangePicker(_ref2) {
|
|
204
205
|
start: null,
|
205
206
|
end: null
|
206
207
|
},
|
207
|
-
buttonSize: buttonSize
|
208
|
+
buttonSize: buttonSize,
|
209
|
+
locale: locale
|
208
210
|
})
|
209
211
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal["default"], {
|
210
212
|
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["date-range-picker"]))),
|
@@ -222,7 +224,7 @@ var DateRangePicker = function DateRangePicker(_ref2) {
|
|
222
224
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
223
225
|
className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["flex"]))),
|
224
226
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
225
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Calendar["default"], _objectSpread(_objectSpread({
|
227
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Calendar["default"], _objectSpread(_objectSpread(_objectSpread({
|
226
228
|
numberOfMonths: 2
|
227
229
|
}, calendarProps), {}, {
|
228
230
|
selectedDays: selectedDays,
|
@@ -230,7 +232,9 @@ var DateRangePicker = function DateRangePicker(_ref2) {
|
|
230
232
|
onDayClick: handleDayClick,
|
231
233
|
onDayMouseEnter: handleMouseEnter,
|
232
234
|
onDayMouseLeave: handleMouseLeave
|
233
|
-
}, yearProps)
|
235
|
+
}, yearProps), {}, {
|
236
|
+
locale: locale
|
237
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Footer["default"], {
|
234
238
|
children: [renderLeftFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
235
239
|
children: renderLeftFooter({
|
236
240
|
state: state,
|
@@ -239,7 +243,8 @@ var DateRangePicker = function DateRangePicker(_ref2) {
|
|
239
243
|
}), !renderRightPanel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_FooterActions["default"], {
|
240
244
|
onCancel: handleCancel,
|
241
245
|
onApply: handleApply,
|
242
|
-
disableApply: !isValid
|
246
|
+
disableApply: !isValid,
|
247
|
+
locale: locale
|
243
248
|
})]
|
244
249
|
})]
|
245
250
|
}), renderRightPanel && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
@@ -252,7 +257,8 @@ var DateRangePicker = function DateRangePicker(_ref2) {
|
|
252
257
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FooterActions["default"], {
|
253
258
|
onCancel: handleCancel,
|
254
259
|
onApply: handleApply,
|
255
|
-
disableApply: !isValid
|
260
|
+
disableApply: !isValid,
|
261
|
+
locale: locale
|
256
262
|
})]
|
257
263
|
})]
|
258
264
|
})]
|
@@ -1,11 +1,13 @@
|
|
1
1
|
import type { FunctionComponent } from "react";
|
2
2
|
import { DisplayProps } from "../components/Display";
|
3
|
+
import type { DatePickerLocale } from "../types";
|
3
4
|
import { DateRangePickerTimeRange } from "./dateRangePickerTimeRange";
|
4
5
|
export interface DateRangePickerDisplayProps {
|
5
6
|
id?: string;
|
6
7
|
onClick: DisplayProps["onClick"];
|
7
8
|
range: DateRangePickerTimeRange;
|
8
9
|
buttonSize?: DisplayProps["size"];
|
10
|
+
locale?: DatePickerLocale;
|
9
11
|
}
|
10
12
|
declare const DateRangePickerDisplay: FunctionComponent<DateRangePickerDisplayProps>;
|
11
13
|
export default DateRangePickerDisplay;
|