@itwin/itwinui-react 2.12.5 → 2.12.7
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/CHANGELOG.md +12 -0
- package/cjs/core/DatePicker/DatePicker.d.ts +5 -8
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +5 -0
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -2
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -2
- package/cjs/styles.js +1 -1
- package/esm/core/DatePicker/DatePicker.d.ts +5 -8
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +5 -0
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -2
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -2
- package/esm/styles.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.12.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1545](https://github.com/iTwin/iTwinUI/pull/1545): `tableFilters.DateRangeFilter` now supports localizing the date picker using `translatedLabels.datePicker`.
|
|
8
|
+
|
|
9
|
+
## 2.12.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1516](https://github.com/iTwin/iTwinUI/pull/1516): Update SearchBox placeholder color to match Input.
|
|
14
|
+
|
|
3
15
|
## 2.12.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { TimePickerProps } from '../TimePicker/index.js';
|
|
3
|
+
export declare type DatePickerLocalizedNames = {
|
|
4
|
+
[key in 'months' | 'shortDays' | 'days']: string[];
|
|
5
|
+
};
|
|
3
6
|
/**
|
|
4
7
|
* Generate localized months and days strings using `Intl.DateTimeFormat` for passed locale to use in DatePicker component.
|
|
5
8
|
* If locale is not passed, browser locale will be used.
|
|
6
9
|
*/
|
|
7
|
-
export declare const generateLocalizedStrings: (locale?: string) =>
|
|
8
|
-
months: string[];
|
|
9
|
-
shortDays: string[];
|
|
10
|
-
days: string[];
|
|
11
|
-
};
|
|
10
|
+
export declare const generateLocalizedStrings: (locale?: string) => DatePickerLocalizedNames;
|
|
12
11
|
export declare type DateRangePickerProps = {
|
|
13
12
|
/**
|
|
14
13
|
* Enable date range support.
|
|
@@ -42,9 +41,7 @@ export declare type DatePickerProps = {
|
|
|
42
41
|
* Pass localized week days (start from sunday) and months.
|
|
43
42
|
* Use helper function `generateLocalizedStrings` to generate strings using `Intl.DateTimeFormat`.
|
|
44
43
|
*/
|
|
45
|
-
localizedNames?:
|
|
46
|
-
[key in 'months' | 'shortDays' | 'days']: string[];
|
|
47
|
-
};
|
|
44
|
+
localizedNames?: DatePickerLocalizedNames;
|
|
48
45
|
/**
|
|
49
46
|
* Set focus on selected day or today.
|
|
50
47
|
* @default false
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { LabeledInputProps } from '../../../LabeledInput/index.js';
|
|
3
|
+
import type { DatePickerLocalizedNames } from '../../../DatePicker/DatePicker.js';
|
|
3
4
|
export declare type DatePickerInputProps = {
|
|
4
5
|
date?: Date;
|
|
5
6
|
onChange: (date?: Date) => void;
|
|
@@ -13,6 +14,10 @@ export declare type DatePickerInputProps = {
|
|
|
13
14
|
* The 'to' date for the 'from' DatePickerInput or the 'from' date for the 'to' DatePickerInput
|
|
14
15
|
*/
|
|
15
16
|
selectedDate?: Date;
|
|
17
|
+
/**
|
|
18
|
+
* Months, short days and days localized names for DatePicker
|
|
19
|
+
*/
|
|
20
|
+
localizedNames?: DatePickerLocalizedNames;
|
|
16
21
|
} & Omit<LabeledInputProps, 'value' | 'onChange' | 'svgIcon' | 'displayStyle'>;
|
|
17
22
|
declare const DatePickerInput: (props: DatePickerInputProps) => JSX.Element;
|
|
18
23
|
export default DatePickerInput;
|
|
@@ -33,7 +33,7 @@ const index_js_2 = require("../../../LabeledInput/index.js");
|
|
|
33
33
|
const index_js_3 = require("../../../DatePicker/index.js");
|
|
34
34
|
const index_js_4 = require("../../../Buttons/index.js");
|
|
35
35
|
const DatePickerInput = (props) => {
|
|
36
|
-
const { onChange, date, parseInput, formatDate, isFromOrTo, selectedDate, ...rest } = props;
|
|
36
|
+
const { onChange, date, parseInput, formatDate, isFromOrTo, selectedDate, localizedNames, ...rest } = props;
|
|
37
37
|
const isDateDisabled = (date) => {
|
|
38
38
|
if (isFromOrTo === 'to') {
|
|
39
39
|
return (0, index_js_1.isBefore)(date, selectedDate);
|
|
@@ -68,7 +68,7 @@ const DatePickerInput = (props) => {
|
|
|
68
68
|
onChange(parsedDate);
|
|
69
69
|
}
|
|
70
70
|
}, [onChange, parseInput]);
|
|
71
|
-
return (React.createElement(index_js_1.Popover, { content: React.createElement(index_js_3.DatePicker, { date: date, onChange: onDateSelected, setFocus: true, isDateDisabled: isDateDisabled }), placement: 'bottom', visible: isVisible, onClickOutside: (_, e) => {
|
|
71
|
+
return (React.createElement(index_js_1.Popover, { content: React.createElement(index_js_3.DatePicker, { date: date, onChange: onDateSelected, setFocus: true, isDateDisabled: isDateDisabled, localizedNames: localizedNames }), placement: 'bottom', visible: isVisible, onClickOutside: (_, e) => {
|
|
72
72
|
var _a;
|
|
73
73
|
if (!((_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
74
74
|
close();
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { FilterButtonBarTranslation } from '../FilterButtonBar.js';
|
|
3
3
|
import type { TableFilterProps } from '../types.js';
|
|
4
|
+
import type { DatePickerLocalizedNames } from '../../../DatePicker/DatePicker.js';
|
|
4
5
|
export declare type DateRangeTranslation = {
|
|
5
6
|
from: string;
|
|
6
7
|
to: string;
|
|
8
|
+
datePicker?: DatePickerLocalizedNames;
|
|
7
9
|
};
|
|
8
10
|
export declare type DateRangeFilterProps<T extends Record<string, unknown>> = TableFilterProps<T> & {
|
|
9
11
|
formatDate?: (date: Date) => string;
|
|
@@ -87,8 +87,8 @@ const DateRangeFilter = (props) => {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
return (React.createElement(BaseFilter_js_1.BaseFilter, null,
|
|
90
|
-
React.createElement(DatePickerInput_js_1.default, { label: translatedStrings.from, date: from, onChange: onFromChange, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder, selectedDate: to, isFromOrTo: 'from', setFocus: true }),
|
|
91
|
-
React.createElement(DatePickerInput_js_1.default, { label: translatedStrings.to, date: to, onChange: onToChange, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder, selectedDate: from, isFromOrTo: 'to' }),
|
|
90
|
+
React.createElement(DatePickerInput_js_1.default, { label: translatedStrings.from, date: from, onChange: onFromChange, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder, selectedDate: to, isFromOrTo: 'from', localizedNames: translatedStrings.datePicker, setFocus: true }),
|
|
91
|
+
React.createElement(DatePickerInput_js_1.default, { label: translatedStrings.to, date: to, onChange: onToChange, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder, selectedDate: from, isFromOrTo: 'to', localizedNames: translatedStrings.datePicker }),
|
|
92
92
|
React.createElement(FilterButtonBar_js_1.FilterButtonBar, { setFilter: () => setFilter([from, to]), clearFilter: clearFilter, translatedLabels: translatedLabels })));
|
|
93
93
|
};
|
|
94
94
|
exports.DateRangeFilter = DateRangeFilter;
|