rsuite 5.79.0 → 5.80.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.
- package/CHANGELOG.md +24 -0
- package/cjs/Calendar/Calendar.js +1 -2
- package/cjs/Calendar/CalendarBody.js +0 -2
- package/cjs/Calendar/CalendarContainer.js +1 -2
- package/cjs/Calendar/CalendarProvider.d.ts +1 -1
- package/cjs/Calendar/Grid/GridHeaderRow.js +1 -2
- package/cjs/Calendar/Grid/GridRow.d.ts +2 -0
- package/cjs/Calendar/Grid/GridRow.js +6 -4
- package/cjs/Calendar/hooks/useCalendar.d.ts +25 -2
- package/cjs/Calendar/hooks/useCalendar.js +36 -1
- package/cjs/CustomProvider/CustomContext.d.ts +253 -0
- package/cjs/CustomProvider/CustomContext.js +8 -0
- package/cjs/CustomProvider/CustomProvider.d.ts +1 -258
- package/cjs/CustomProvider/CustomProvider.js +2 -3
- package/cjs/CustomProvider/FormattedDate.js +2 -2
- package/cjs/CustomProvider/FormattedNumber.js +2 -2
- package/cjs/CustomProvider/index.d.ts +2 -2
- package/cjs/CustomProvider/index.js +4 -4
- package/cjs/CustomProvider/useCustom.js +2 -2
- package/cjs/DatePicker/DatePicker.js +1 -2
- package/cjs/DateRangePicker/DateRangePicker.js +1 -2
- package/cjs/DateRangePicker/utils.d.ts +1 -1
- package/cjs/DateRangePicker/utils.js +2 -1
- package/cjs/Image/hooks/useImage.js +2 -3
- package/cjs/InlineEdit/InlineEdit.js +3 -1
- package/cjs/InlineEdit/useEditState.d.ts +2 -0
- package/cjs/InlineEdit/useEditState.js +9 -1
- package/cjs/List/List.js +6 -2
- package/cjs/List/helper/useSortHelper.d.ts +7 -5
- package/cjs/List/helper/useSortHelper.js +109 -16
- package/cjs/List/helper/utils.js +15 -7
- package/cjs/internals/Picker/propTypes.d.ts +2 -2
- package/cjs/internals/hooks/useClassNames.js +2 -2
- package/cjs/internals/utils/date/getWeekStartDates.d.ts +0 -1
- package/cjs/internals/utils/date/getWeekStartDates.js +2 -5
- package/cjs/internals/utils/date/index.d.ts +1 -0
- package/cjs/internals/utils/date/index.js +4 -1
- package/cjs/useToaster/useToaster.js +2 -2
- package/dist/rsuite.js +69 -25
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Calendar/Calendar.js +1 -2
- package/esm/Calendar/CalendarBody.js +0 -2
- package/esm/Calendar/CalendarContainer.js +1 -2
- package/esm/Calendar/CalendarProvider.d.ts +1 -1
- package/esm/Calendar/Grid/GridHeaderRow.js +1 -2
- package/esm/Calendar/Grid/GridRow.d.ts +2 -0
- package/esm/Calendar/Grid/GridRow.js +6 -4
- package/esm/Calendar/hooks/useCalendar.d.ts +25 -2
- package/esm/Calendar/hooks/useCalendar.js +36 -2
- package/esm/CustomProvider/CustomContext.d.ts +253 -0
- package/esm/CustomProvider/CustomContext.js +3 -0
- package/esm/CustomProvider/CustomProvider.d.ts +1 -258
- package/esm/CustomProvider/CustomProvider.js +1 -1
- package/esm/CustomProvider/FormattedDate.js +1 -1
- package/esm/CustomProvider/FormattedNumber.js +1 -1
- package/esm/CustomProvider/index.d.ts +2 -2
- package/esm/CustomProvider/index.js +1 -1
- package/esm/CustomProvider/useCustom.js +1 -1
- package/esm/DatePicker/DatePicker.js +1 -2
- package/esm/DateRangePicker/DateRangePicker.js +1 -2
- package/esm/DateRangePicker/utils.d.ts +1 -1
- package/esm/DateRangePicker/utils.js +2 -1
- package/esm/Image/hooks/useImage.js +1 -1
- package/esm/InlineEdit/InlineEdit.js +3 -1
- package/esm/InlineEdit/useEditState.d.ts +2 -0
- package/esm/InlineEdit/useEditState.js +9 -1
- package/esm/List/List.js +6 -2
- package/esm/List/helper/useSortHelper.d.ts +7 -5
- package/esm/List/helper/useSortHelper.js +109 -16
- package/esm/List/helper/utils.js +15 -7
- package/esm/internals/Picker/propTypes.d.ts +2 -2
- package/esm/internals/hooks/useClassNames.js +1 -1
- package/esm/internals/utils/date/getWeekStartDates.d.ts +0 -1
- package/esm/internals/utils/date/getWeekStartDates.js +2 -5
- package/esm/internals/utils/date/index.d.ts +1 -0
- package/esm/internals/utils/date/index.js +1 -0
- package/esm/useToaster/useToaster.js +1 -1
- package/package.json +2 -2
package/esm/Calendar/Calendar.js
CHANGED
|
@@ -28,8 +28,7 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
28
28
|
_propsWithDefaults$de = propsWithDefaults.defaultValue,
|
|
29
29
|
defaultValue = _propsWithDefaults$de === void 0 ? startOfDay(new Date()) : _propsWithDefaults$de,
|
|
30
30
|
isoWeek = propsWithDefaults.isoWeek,
|
|
31
|
-
|
|
32
|
-
weekStart = _propsWithDefaults$we === void 0 ? 0 : _propsWithDefaults$we,
|
|
31
|
+
weekStart = propsWithDefaults.weekStart,
|
|
33
32
|
locale = propsWithDefaults.locale,
|
|
34
33
|
onChange = propsWithDefaults.onChange,
|
|
35
34
|
onMonthChange = propsWithDefaults.onMonthChange,
|
|
@@ -18,7 +18,6 @@ var CalendarBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
18
18
|
var _useCalendar = useCalendar(),
|
|
19
19
|
_useCalendar$date = _useCalendar.date,
|
|
20
20
|
date = _useCalendar$date === void 0 ? new Date() : _useCalendar$date,
|
|
21
|
-
isoWeek = _useCalendar.isoWeek,
|
|
22
21
|
overrideLocale = _useCalendar.locale,
|
|
23
22
|
weekStart = _useCalendar.weekStart;
|
|
24
23
|
var _useCustom = useCustom(),
|
|
@@ -35,7 +34,6 @@ var CalendarBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
35
34
|
className: classes
|
|
36
35
|
}), /*#__PURE__*/React.createElement(Grid, {
|
|
37
36
|
rows: getWeekStartDates(thisMonthDate, {
|
|
38
|
-
isoWeek: isoWeek,
|
|
39
37
|
weekStart: weekStart,
|
|
40
38
|
locale: locale === null || locale === void 0 ? void 0 : locale.dateLocale
|
|
41
39
|
}),
|
|
@@ -29,8 +29,7 @@ var CalendarContainer = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
29
29
|
inline = props.inline,
|
|
30
30
|
_props$isoWeek = props.isoWeek,
|
|
31
31
|
isoWeek = _props$isoWeek === void 0 ? false : _props$isoWeek,
|
|
32
|
-
|
|
33
|
-
weekStart = _props$weekStart === void 0 ? 0 : _props$weekStart,
|
|
32
|
+
weekStart = props.weekStart,
|
|
34
33
|
targetId = props.targetId,
|
|
35
34
|
limitEndYear = props.limitEndYear,
|
|
36
35
|
limitStartYear = props.limitStartYear,
|
|
@@ -34,7 +34,7 @@ export interface CalendarInnerContextValue {
|
|
|
34
34
|
* The start day of the week in the calendar.
|
|
35
35
|
* 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday
|
|
36
36
|
*/
|
|
37
|
-
weekStart
|
|
37
|
+
weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
38
38
|
/**
|
|
39
39
|
* Indicates whether week numbers should be shown in the calendar.
|
|
40
40
|
*/
|
|
@@ -17,13 +17,12 @@ var GridHeaderRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
17
17
|
var _useCalendar = useCalendar(),
|
|
18
18
|
locale = _useCalendar.locale,
|
|
19
19
|
showWeekNumbers = _useCalendar.showWeekNumbers,
|
|
20
|
-
isoWeek = _useCalendar.isoWeek,
|
|
21
20
|
weekStart = _useCalendar.weekStart;
|
|
22
21
|
var _useClassNames = useClassNames(classPrefix),
|
|
23
22
|
merge = _useClassNames.merge,
|
|
24
23
|
prefix = _useClassNames.prefix;
|
|
25
24
|
var classes = merge(className, prefix('row', 'header-row'));
|
|
26
|
-
var weeks = getWeekKeys(
|
|
25
|
+
var weeks = getWeekKeys(weekStart);
|
|
27
26
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
28
27
|
role: "row"
|
|
29
28
|
}, rest, {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { RsRefForwardingComponent, WithAsProps } from '../../internals/types';
|
|
2
2
|
export interface GridRowProps extends WithAsProps {
|
|
3
|
+
/** The weekend: Sunday */
|
|
3
4
|
weekendDate?: Date;
|
|
5
|
+
/** The index of the row */
|
|
4
6
|
rowIndex?: number;
|
|
5
7
|
}
|
|
6
8
|
declare const GridRow: RsRefForwardingComponent<'div', GridRowProps>;
|
|
@@ -95,12 +95,14 @@ var GridRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
95
95
|
};
|
|
96
96
|
var classes = merge(className, prefix('row'));
|
|
97
97
|
var _ref3 = (_locale$dateLocale$op = locale === null || locale === void 0 || (_locale$dateLocale = locale.dateLocale) === null || _locale$dateLocale === void 0 ? void 0 : _locale$dateLocale.options) !== null && _locale$dateLocale$op !== void 0 ? _locale$dateLocale$op : {},
|
|
98
|
-
firstWeekContainsDate = _ref3.firstWeekContainsDate
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
firstWeekContainsDate = _ref3.firstWeekContainsDate;
|
|
99
|
+
|
|
100
|
+
// ISO week starts on Monday
|
|
101
|
+
var date = isoWeek ? addDays(weekendDate, 1) : weekendDate;
|
|
102
|
+
var week = format(date, isoWeek ? 'I' : 'w', {
|
|
101
103
|
locale: locale === null || locale === void 0 ? void 0 : locale.dateLocale,
|
|
102
104
|
firstWeekContainsDate: firstWeekContainsDate,
|
|
103
|
-
weekStartsOn: weekStart
|
|
105
|
+
weekStartsOn: weekStart
|
|
104
106
|
});
|
|
105
107
|
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
106
108
|
ref: ref,
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="date-fns" />
|
|
3
|
+
export declare const useCalendar: () => {
|
|
4
|
+
formatDate?: typeof import("date-fns").format | undefined;
|
|
5
|
+
date?: Date | undefined;
|
|
6
|
+
dateRange?: Date[] | undefined;
|
|
7
|
+
format?: string | undefined;
|
|
8
|
+
hoverRangeValue?: [Date, Date] | undefined;
|
|
9
|
+
inline?: boolean | undefined;
|
|
10
|
+
targetId?: string | undefined;
|
|
11
|
+
monthDropdownProps?: import("../types").MonthDropdownProps | undefined;
|
|
12
|
+
disabledDate?: ((date: Date, selectRangeValue?: Date[] | undefined, type?: string | undefined) => boolean) | undefined;
|
|
13
|
+
inSameMonth?: ((date: Date) => boolean) | undefined;
|
|
14
|
+
onChangeMonth?: ((nextPageDate: Date, event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
15
|
+
onChangeTime?: ((nextPageTime: Date, event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
16
|
+
onMouseMove?: ((date: Date) => void) | undefined;
|
|
17
|
+
onSelect?: ((date: Date, event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
18
|
+
renderCell?: ((date: Date) => import("react").ReactNode) | undefined;
|
|
19
|
+
renderCellOnPicker?: ((date: Date) => import("react").ReactNode) | undefined;
|
|
20
|
+
cellClassName?: ((date: Date) => string | undefined) | undefined;
|
|
21
|
+
locale: import("../..").CalendarLocale | undefined;
|
|
22
|
+
showWeekNumbers: boolean | undefined;
|
|
23
|
+
isoWeek: boolean;
|
|
24
|
+
weekStart: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
25
|
+
};
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
var _excluded = ["locale", "showWeekNumbers", "isoWeek", "weekStart"];
|
|
5
|
+
import { useContext, useMemo } from 'react';
|
|
3
6
|
import { CalendarContext } from "../CalendarProvider.js";
|
|
4
7
|
export var useCalendar = function useCalendar() {
|
|
5
|
-
|
|
8
|
+
var _locale$dateLocale2;
|
|
9
|
+
var _useContext = useContext(CalendarContext),
|
|
10
|
+
locale = _useContext.locale,
|
|
11
|
+
showWeekNumbers = _useContext.showWeekNumbers,
|
|
12
|
+
isoWeek = _useContext.isoWeek,
|
|
13
|
+
weekStartProp = _useContext.weekStart,
|
|
14
|
+
rest = _objectWithoutPropertiesLoose(_useContext, _excluded);
|
|
15
|
+
|
|
16
|
+
// Determine the start of the week based on various conditions
|
|
17
|
+
var weekStart = useMemo(function () {
|
|
18
|
+
var _locale$dateLocale;
|
|
19
|
+
// If weekStartProp is explicitly provided, use it
|
|
20
|
+
if (typeof weekStartProp !== 'undefined') {
|
|
21
|
+
return weekStartProp;
|
|
22
|
+
}
|
|
23
|
+
// If using ISO week, start on Monday (1)
|
|
24
|
+
else if (isoWeek) {
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
// If locale specifies a weekStartsOn option, use it
|
|
28
|
+
else if ((locale === null || locale === void 0 || (_locale$dateLocale = locale.dateLocale) === null || _locale$dateLocale === void 0 || (_locale$dateLocale = _locale$dateLocale.options) === null || _locale$dateLocale === void 0 ? void 0 : _locale$dateLocale.weekStartsOn) !== undefined) {
|
|
29
|
+
return locale.dateLocale.options.weekStartsOn;
|
|
30
|
+
}
|
|
31
|
+
// Default to Sunday (0) if no other condition is met
|
|
32
|
+
return 0;
|
|
33
|
+
}, [weekStartProp, isoWeek, locale === null || locale === void 0 || (_locale$dateLocale2 = locale.dateLocale) === null || _locale$dateLocale2 === void 0 || (_locale$dateLocale2 = _locale$dateLocale2.options) === null || _locale$dateLocale2 === void 0 ? void 0 : _locale$dateLocale2.weekStartsOn]);
|
|
34
|
+
return _extends({
|
|
35
|
+
locale: locale,
|
|
36
|
+
showWeekNumbers: showWeekNumbers,
|
|
37
|
+
isoWeek: isoWeek,
|
|
38
|
+
weekStart: weekStart
|
|
39
|
+
}, rest);
|
|
6
40
|
};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FormatDateOptions } from '../internals/utils/date/types';
|
|
3
|
+
import type { ToastContainerInstance } from '../toaster/ToastContainer';
|
|
4
|
+
import type { ReactSuiteComponents } from './types';
|
|
5
|
+
import type { Locale } from '../locales';
|
|
6
|
+
export interface CustomValue<T = Locale> {
|
|
7
|
+
/**
|
|
8
|
+
* The prefix of the component CSS class
|
|
9
|
+
*/
|
|
10
|
+
classPrefix?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The locale object that contains the language and formatting rules for the date.
|
|
13
|
+
*/
|
|
14
|
+
locale: T;
|
|
15
|
+
/**
|
|
16
|
+
* Right-to-left text direction.
|
|
17
|
+
*/
|
|
18
|
+
rtl: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Return the formatted date string in the given format. The result may vary by locale.
|
|
21
|
+
*
|
|
22
|
+
* Example:
|
|
23
|
+
*
|
|
24
|
+
* import format from 'date-fns/format';
|
|
25
|
+
* import eo from 'date-fns/locale/eo'
|
|
26
|
+
*
|
|
27
|
+
* function formatDate(date, formatStr) {
|
|
28
|
+
* return format(date, formatStr, { locale: eo });
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
formatDate: (date: Date | number, format: string, options?: FormatDateOptions) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Return the date parsed from string using the given format string.
|
|
35
|
+
*
|
|
36
|
+
* Example:
|
|
37
|
+
*
|
|
38
|
+
* import parse from 'date-fns/parse';
|
|
39
|
+
* import eo from 'date-fns/locale/eo'
|
|
40
|
+
*
|
|
41
|
+
* function parseDate(date, formatStr) {
|
|
42
|
+
* return parse(date, formatStr, new Date(), { locale: eo });
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
parseDate: (dateString: string, formatString: string, referenceDate?: Date | number, options?: FormatDateOptions) => Date;
|
|
47
|
+
/**
|
|
48
|
+
* A Map of toast containers
|
|
49
|
+
*/
|
|
50
|
+
toasters?: React.MutableRefObject<Map<string, ToastContainerInstance>>;
|
|
51
|
+
/**
|
|
52
|
+
* If true, the ripple effect is disabled.
|
|
53
|
+
* Affected components include: Button, Nav.Item, Pagination.
|
|
54
|
+
*/
|
|
55
|
+
disableRipple?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>> {
|
|
58
|
+
/**
|
|
59
|
+
* Supported themes
|
|
60
|
+
*/
|
|
61
|
+
theme?: 'light' | 'dark' | 'high-contrast';
|
|
62
|
+
/**
|
|
63
|
+
* The prefix of the icon CSS class
|
|
64
|
+
*/
|
|
65
|
+
iconClassPrefix?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Primary content
|
|
68
|
+
*/
|
|
69
|
+
children?: React.ReactNode;
|
|
70
|
+
/**
|
|
71
|
+
* Sets a container for toast rendering
|
|
72
|
+
*/
|
|
73
|
+
toastContainer?: HTMLElement | (() => HTMLElement | null) | null;
|
|
74
|
+
csp?: {
|
|
75
|
+
/**
|
|
76
|
+
* Content Security Policy nonce
|
|
77
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
|
|
78
|
+
*/
|
|
79
|
+
nonce?: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Disable inline styles
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
disableInlineStyles?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* components allows setting default props for specific components globally.
|
|
88
|
+
* It accepts an object where each key represents a component name (e.g., 'Button', 'Input'),
|
|
89
|
+
* and the corresponding value is an object containing the `defaultProps` object.
|
|
90
|
+
* The `defaultProps` object defines the default props for that component.
|
|
91
|
+
* These props will be automatically applied to the component unless overridden by specific props
|
|
92
|
+
* passed in an individual component instance.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```js
|
|
96
|
+
* components={{
|
|
97
|
+
* Button: { defaultProps: { appearance: 'primary', size: 'lg' } },
|
|
98
|
+
* Input: { defaultProps: { placeholder: 'Enter text', size: 'lg' } }
|
|
99
|
+
* }}
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
components?: Partial<ReactSuiteComponents>;
|
|
103
|
+
}
|
|
104
|
+
export declare const CustomContext: React.Context<CustomProviderProps<{
|
|
105
|
+
code?: string | undefined;
|
|
106
|
+
common?: {
|
|
107
|
+
loading: string;
|
|
108
|
+
emptyMessage: string;
|
|
109
|
+
remove: string;
|
|
110
|
+
clear: string;
|
|
111
|
+
} | undefined;
|
|
112
|
+
Plaintext?: {
|
|
113
|
+
unfilled: string;
|
|
114
|
+
notSelected: string;
|
|
115
|
+
notUploaded: string;
|
|
116
|
+
} | undefined;
|
|
117
|
+
Pagination?: {
|
|
118
|
+
more: string;
|
|
119
|
+
prev: string;
|
|
120
|
+
next: string;
|
|
121
|
+
first: string;
|
|
122
|
+
last: string;
|
|
123
|
+
limit: string;
|
|
124
|
+
total: string;
|
|
125
|
+
skip: string;
|
|
126
|
+
} | undefined;
|
|
127
|
+
DateTimeFormats?: {
|
|
128
|
+
sunday: string;
|
|
129
|
+
monday: string;
|
|
130
|
+
tuesday: string;
|
|
131
|
+
wednesday: string;
|
|
132
|
+
thursday: string;
|
|
133
|
+
friday: string;
|
|
134
|
+
saturday: string;
|
|
135
|
+
ok: string;
|
|
136
|
+
today: string;
|
|
137
|
+
yesterday: string;
|
|
138
|
+
now: string;
|
|
139
|
+
hours: string;
|
|
140
|
+
minutes: string;
|
|
141
|
+
seconds: string;
|
|
142
|
+
formattedMonthPattern: string;
|
|
143
|
+
formattedDayPattern: string;
|
|
144
|
+
shortDateFormat: string;
|
|
145
|
+
shortTimeFormat: string;
|
|
146
|
+
dateLocale: any;
|
|
147
|
+
} | undefined;
|
|
148
|
+
Calendar?: {
|
|
149
|
+
sunday: string;
|
|
150
|
+
monday: string;
|
|
151
|
+
tuesday: string;
|
|
152
|
+
wednesday: string;
|
|
153
|
+
thursday: string;
|
|
154
|
+
friday: string;
|
|
155
|
+
saturday: string;
|
|
156
|
+
ok: string;
|
|
157
|
+
today: string;
|
|
158
|
+
yesterday: string;
|
|
159
|
+
now: string;
|
|
160
|
+
hours: string;
|
|
161
|
+
minutes: string;
|
|
162
|
+
seconds: string;
|
|
163
|
+
formattedMonthPattern: string;
|
|
164
|
+
formattedDayPattern: string;
|
|
165
|
+
shortDateFormat: string;
|
|
166
|
+
shortTimeFormat: string;
|
|
167
|
+
dateLocale: any;
|
|
168
|
+
} | undefined;
|
|
169
|
+
DatePicker?: {
|
|
170
|
+
sunday: string;
|
|
171
|
+
monday: string;
|
|
172
|
+
tuesday: string;
|
|
173
|
+
wednesday: string;
|
|
174
|
+
thursday: string;
|
|
175
|
+
friday: string;
|
|
176
|
+
saturday: string;
|
|
177
|
+
ok: string;
|
|
178
|
+
today: string;
|
|
179
|
+
yesterday: string;
|
|
180
|
+
now: string;
|
|
181
|
+
hours: string;
|
|
182
|
+
minutes: string;
|
|
183
|
+
seconds: string;
|
|
184
|
+
formattedMonthPattern: string;
|
|
185
|
+
formattedDayPattern: string;
|
|
186
|
+
shortDateFormat: string;
|
|
187
|
+
shortTimeFormat: string;
|
|
188
|
+
dateLocale: any;
|
|
189
|
+
} | undefined;
|
|
190
|
+
DateRangePicker?: {
|
|
191
|
+
last7Days: string;
|
|
192
|
+
sunday: string;
|
|
193
|
+
monday: string;
|
|
194
|
+
tuesday: string;
|
|
195
|
+
wednesday: string;
|
|
196
|
+
thursday: string;
|
|
197
|
+
friday: string;
|
|
198
|
+
saturday: string;
|
|
199
|
+
ok: string;
|
|
200
|
+
today: string;
|
|
201
|
+
yesterday: string;
|
|
202
|
+
now: string;
|
|
203
|
+
hours: string;
|
|
204
|
+
minutes: string;
|
|
205
|
+
seconds: string;
|
|
206
|
+
formattedMonthPattern: string;
|
|
207
|
+
formattedDayPattern: string;
|
|
208
|
+
shortDateFormat: string;
|
|
209
|
+
shortTimeFormat: string;
|
|
210
|
+
dateLocale: any;
|
|
211
|
+
} | undefined;
|
|
212
|
+
Combobox?: {
|
|
213
|
+
noResultsText: string;
|
|
214
|
+
placeholder: string;
|
|
215
|
+
searchPlaceholder: string;
|
|
216
|
+
checkAll: string;
|
|
217
|
+
} | undefined;
|
|
218
|
+
InputPicker?: {
|
|
219
|
+
newItem: string;
|
|
220
|
+
createOption: string;
|
|
221
|
+
noResultsText: string;
|
|
222
|
+
placeholder: string;
|
|
223
|
+
searchPlaceholder: string;
|
|
224
|
+
checkAll: string;
|
|
225
|
+
} | undefined;
|
|
226
|
+
TagPicker?: {
|
|
227
|
+
newItem: string;
|
|
228
|
+
createOption: string;
|
|
229
|
+
noResultsText: string;
|
|
230
|
+
placeholder: string;
|
|
231
|
+
searchPlaceholder: string;
|
|
232
|
+
checkAll: string;
|
|
233
|
+
} | undefined;
|
|
234
|
+
Uploader?: {
|
|
235
|
+
inited: string;
|
|
236
|
+
progress: string;
|
|
237
|
+
error: string;
|
|
238
|
+
complete: string;
|
|
239
|
+
emptyFile: string;
|
|
240
|
+
upload: string;
|
|
241
|
+
removeFile: string;
|
|
242
|
+
} | undefined;
|
|
243
|
+
CloseButton?: {
|
|
244
|
+
closeLabel: string;
|
|
245
|
+
} | undefined;
|
|
246
|
+
Breadcrumb?: {
|
|
247
|
+
expandText: string;
|
|
248
|
+
} | undefined;
|
|
249
|
+
Toggle?: {
|
|
250
|
+
on: string;
|
|
251
|
+
off: string;
|
|
252
|
+
} | undefined;
|
|
253
|
+
}>>;
|
|
@@ -1,262 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { ToastContainerInstance } from '../toaster/ToastContainer';
|
|
4
|
-
import type { FormatDateOptions } from '../internals/utils/date/types';
|
|
5
|
-
import type { ReactSuiteComponents } from './types';
|
|
6
|
-
export interface CustomValue<T = Locale> {
|
|
7
|
-
/**
|
|
8
|
-
* The prefix of the component CSS class
|
|
9
|
-
*/
|
|
10
|
-
classPrefix?: string;
|
|
11
|
-
/**
|
|
12
|
-
* The locale object that contains the language and formatting rules for the date.
|
|
13
|
-
*/
|
|
14
|
-
locale: T;
|
|
15
|
-
/**
|
|
16
|
-
* Right-to-left text direction.
|
|
17
|
-
*/
|
|
18
|
-
rtl: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Return the formatted date string in the given format. The result may vary by locale.
|
|
21
|
-
*
|
|
22
|
-
* Example:
|
|
23
|
-
*
|
|
24
|
-
* import format from 'date-fns/format';
|
|
25
|
-
* import eo from 'date-fns/locale/eo'
|
|
26
|
-
*
|
|
27
|
-
* function formatDate(date, formatStr) {
|
|
28
|
-
* return format(date, formatStr, { locale: eo });
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
formatDate: (date: Date | number, format: string, options?: FormatDateOptions) => string;
|
|
33
|
-
/**
|
|
34
|
-
* Return the date parsed from string using the given format string.
|
|
35
|
-
*
|
|
36
|
-
* Example:
|
|
37
|
-
*
|
|
38
|
-
* import parse from 'date-fns/parse';
|
|
39
|
-
* import eo from 'date-fns/locale/eo'
|
|
40
|
-
*
|
|
41
|
-
* function parseDate(date, formatStr) {
|
|
42
|
-
* return parse(date, formatStr, new Date(), { locale: eo });
|
|
43
|
-
* }
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
parseDate: (dateString: string, formatString: string, referenceDate?: Date | number, options?: FormatDateOptions) => Date;
|
|
47
|
-
/**
|
|
48
|
-
* A Map of toast containers
|
|
49
|
-
*/
|
|
50
|
-
toasters?: React.MutableRefObject<Map<string, ToastContainerInstance>>;
|
|
51
|
-
/**
|
|
52
|
-
* If true, the ripple effect is disabled.
|
|
53
|
-
* Affected components include: Button, Nav.Item, Pagination.
|
|
54
|
-
*/
|
|
55
|
-
disableRipple?: boolean;
|
|
56
|
-
}
|
|
57
|
-
export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>> {
|
|
58
|
-
/**
|
|
59
|
-
* Supported themes
|
|
60
|
-
*/
|
|
61
|
-
theme?: 'light' | 'dark' | 'high-contrast';
|
|
62
|
-
/**
|
|
63
|
-
* The prefix of the icon CSS class
|
|
64
|
-
*/
|
|
65
|
-
iconClassPrefix?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Primary content
|
|
68
|
-
*/
|
|
69
|
-
children?: React.ReactNode;
|
|
70
|
-
/**
|
|
71
|
-
* Sets a container for toast rendering
|
|
72
|
-
*/
|
|
73
|
-
toastContainer?: HTMLElement | (() => HTMLElement | null) | null;
|
|
74
|
-
csp?: {
|
|
75
|
-
/**
|
|
76
|
-
* Content Security Policy nonce
|
|
77
|
-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
|
|
78
|
-
*/
|
|
79
|
-
nonce?: string;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Disable inline styles
|
|
83
|
-
* @default false
|
|
84
|
-
*/
|
|
85
|
-
disableInlineStyles?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* components allows setting default props for specific components globally.
|
|
88
|
-
* It accepts an object where each key represents a component name (e.g., 'Button', 'Input'),
|
|
89
|
-
* and the corresponding value is an object containing the `defaultProps` object.
|
|
90
|
-
* The `defaultProps` object defines the default props for that component.
|
|
91
|
-
* These props will be automatically applied to the component unless overridden by specific props
|
|
92
|
-
* passed in an individual component instance.
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* ```js
|
|
96
|
-
* components={{
|
|
97
|
-
* Button: { defaultProps: { appearance: 'primary', size: 'lg' } },
|
|
98
|
-
* Input: { defaultProps: { placeholder: 'Enter text', size: 'lg' } }
|
|
99
|
-
* }}
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
components?: Partial<ReactSuiteComponents>;
|
|
103
|
-
}
|
|
104
|
-
export declare const CustomContext: React.Context<CustomProviderProps<{
|
|
105
|
-
code?: string | undefined;
|
|
106
|
-
common?: {
|
|
107
|
-
loading: string;
|
|
108
|
-
emptyMessage: string;
|
|
109
|
-
remove: string;
|
|
110
|
-
clear: string;
|
|
111
|
-
} | undefined;
|
|
112
|
-
Plaintext?: {
|
|
113
|
-
unfilled: string;
|
|
114
|
-
notSelected: string;
|
|
115
|
-
notUploaded: string;
|
|
116
|
-
} | undefined;
|
|
117
|
-
Pagination?: {
|
|
118
|
-
more: string;
|
|
119
|
-
prev: string;
|
|
120
|
-
next: string;
|
|
121
|
-
first: string;
|
|
122
|
-
last: string;
|
|
123
|
-
limit: string;
|
|
124
|
-
total: string;
|
|
125
|
-
skip: string;
|
|
126
|
-
} | undefined;
|
|
127
|
-
DateTimeFormats?: {
|
|
128
|
-
sunday: string;
|
|
129
|
-
monday: string;
|
|
130
|
-
tuesday: string;
|
|
131
|
-
wednesday: string;
|
|
132
|
-
thursday: string;
|
|
133
|
-
friday: string;
|
|
134
|
-
saturday: string;
|
|
135
|
-
ok: string;
|
|
136
|
-
today: string;
|
|
137
|
-
yesterday: string;
|
|
138
|
-
now: string;
|
|
139
|
-
hours: string;
|
|
140
|
-
minutes: string;
|
|
141
|
-
seconds: string;
|
|
142
|
-
formattedMonthPattern: string;
|
|
143
|
-
formattedDayPattern: string;
|
|
144
|
-
shortDateFormat: string;
|
|
145
|
-
shortTimeFormat: string;
|
|
146
|
-
dateLocale: any;
|
|
147
|
-
} | undefined;
|
|
148
|
-
Calendar?: {
|
|
149
|
-
sunday: string;
|
|
150
|
-
monday: string;
|
|
151
|
-
tuesday: string;
|
|
152
|
-
wednesday: string;
|
|
153
|
-
thursday: string;
|
|
154
|
-
friday: string;
|
|
155
|
-
saturday: string;
|
|
156
|
-
ok: string;
|
|
157
|
-
today: string;
|
|
158
|
-
yesterday: string;
|
|
159
|
-
now: string;
|
|
160
|
-
hours: string;
|
|
161
|
-
minutes: string;
|
|
162
|
-
seconds: string;
|
|
163
|
-
formattedMonthPattern: string;
|
|
164
|
-
formattedDayPattern: string;
|
|
165
|
-
shortDateFormat: string;
|
|
166
|
-
shortTimeFormat: string;
|
|
167
|
-
dateLocale: any;
|
|
168
|
-
} | undefined;
|
|
169
|
-
DatePicker?: {
|
|
170
|
-
sunday: string;
|
|
171
|
-
monday: string;
|
|
172
|
-
tuesday: string;
|
|
173
|
-
wednesday: string;
|
|
174
|
-
thursday: string;
|
|
175
|
-
friday: string;
|
|
176
|
-
saturday: string;
|
|
177
|
-
ok: string;
|
|
178
|
-
today: string;
|
|
179
|
-
yesterday: string;
|
|
180
|
-
now: string;
|
|
181
|
-
hours: string;
|
|
182
|
-
minutes: string;
|
|
183
|
-
seconds: string;
|
|
184
|
-
formattedMonthPattern: string;
|
|
185
|
-
formattedDayPattern: string;
|
|
186
|
-
shortDateFormat: string;
|
|
187
|
-
shortTimeFormat: string;
|
|
188
|
-
dateLocale: any;
|
|
189
|
-
} | undefined;
|
|
190
|
-
DateRangePicker?: {
|
|
191
|
-
last7Days: string;
|
|
192
|
-
sunday: string;
|
|
193
|
-
monday: string;
|
|
194
|
-
tuesday: string;
|
|
195
|
-
wednesday: string;
|
|
196
|
-
thursday: string;
|
|
197
|
-
friday: string;
|
|
198
|
-
saturday: string;
|
|
199
|
-
ok: string;
|
|
200
|
-
today: string;
|
|
201
|
-
yesterday: string;
|
|
202
|
-
now: string;
|
|
203
|
-
hours: string;
|
|
204
|
-
minutes: string;
|
|
205
|
-
seconds: string;
|
|
206
|
-
formattedMonthPattern: string;
|
|
207
|
-
formattedDayPattern: string;
|
|
208
|
-
shortDateFormat: string;
|
|
209
|
-
shortTimeFormat: string;
|
|
210
|
-
dateLocale: any;
|
|
211
|
-
} | undefined;
|
|
212
|
-
Combobox?: {
|
|
213
|
-
noResultsText: string;
|
|
214
|
-
placeholder: string; /**
|
|
215
|
-
* The locale object that contains the language and formatting rules for the date.
|
|
216
|
-
*/
|
|
217
|
-
searchPlaceholder: string;
|
|
218
|
-
checkAll: string;
|
|
219
|
-
} | undefined;
|
|
220
|
-
InputPicker?: {
|
|
221
|
-
newItem: string;
|
|
222
|
-
createOption: string;
|
|
223
|
-
noResultsText: string;
|
|
224
|
-
placeholder: string; /**
|
|
225
|
-
* The locale object that contains the language and formatting rules for the date.
|
|
226
|
-
*/
|
|
227
|
-
searchPlaceholder: string;
|
|
228
|
-
checkAll: string;
|
|
229
|
-
} | undefined;
|
|
230
|
-
TagPicker?: {
|
|
231
|
-
newItem: string;
|
|
232
|
-
createOption: string;
|
|
233
|
-
noResultsText: string;
|
|
234
|
-
placeholder: string; /**
|
|
235
|
-
* The locale object that contains the language and formatting rules for the date.
|
|
236
|
-
*/
|
|
237
|
-
searchPlaceholder: string;
|
|
238
|
-
checkAll: string;
|
|
239
|
-
} | undefined;
|
|
240
|
-
Uploader?: {
|
|
241
|
-
inited: string;
|
|
242
|
-
progress: string;
|
|
243
|
-
error: string;
|
|
244
|
-
complete: string;
|
|
245
|
-
emptyFile: string;
|
|
246
|
-
upload: string;
|
|
247
|
-
removeFile: string;
|
|
248
|
-
} | undefined;
|
|
249
|
-
CloseButton?: {
|
|
250
|
-
closeLabel: string;
|
|
251
|
-
} | undefined;
|
|
252
|
-
Breadcrumb?: {
|
|
253
|
-
expandText: string;
|
|
254
|
-
} | undefined;
|
|
255
|
-
Toggle?: {
|
|
256
|
-
on: string;
|
|
257
|
-
off: string;
|
|
258
|
-
} | undefined;
|
|
259
|
-
}>>;
|
|
2
|
+
import { CustomProviderProps } from './CustomContext';
|
|
260
3
|
/**
|
|
261
4
|
* CustomProvider is used to provide global configuration, such as language, theme, etc.
|
|
262
5
|
*
|