@pushwoosh/dumb-components 1.1.148 → 1.1.150
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/AccessForbidden/AccessForbidden.d.ts +3 -0
- package/AccessForbidden/AccessForbidden.js +3 -0
- package/Alert/Alert.d.ts +7 -0
- package/Alert/Alert.js +7 -0
- package/Alert/types.d.ts +6 -0
- package/ApplicationPreloader/ApplicationPreloader.d.ts +8 -0
- package/ApplicationPreloader/ApplicationPreloader.js +6 -0
- package/Badge/Badge.d.ts +6 -0
- package/Badge/Badge.js +6 -0
- package/Badge/types.d.ts +6 -0
- package/Banner/Banner.d.ts +7 -0
- package/Banner/Banner.js +7 -0
- package/Banner/types.d.ts +16 -0
- package/Button/Button.d.ts +19 -0
- package/Button/GhostButton.d.ts +1 -0
- package/Button/GhostButton.js +1 -0
- package/Button/RemoveButton.d.ts +6 -0
- package/Button/RemoveButton.js +6 -0
- package/Button/types.d.ts +21 -0
- package/Calendar/CalendarDropdown/CalendarDropdown.d.ts +12 -0
- package/Calendar/CalendarDropdown/CalendarDropdown.js +12 -0
- package/Calendar/CalendarDropdown/helpers.d.ts +4 -0
- package/Calendar/CalendarDropdown/helpers.js +4 -0
- package/Calendar/CalendarDropdown/types.d.ts +33 -0
- package/Calendar/CalendarSuperForm/CalendarSuperForm.d.ts +7 -0
- package/Calendar/CalendarSuperForm/CalendarSuperForm.js +7 -0
- package/Calendar/CalendarSuperForm/types.d.ts +36 -10
- package/Calendar/helpers.d.ts +10 -0
- package/Calendar/helpers.js +10 -0
- package/Calendar/types.d.ts +16 -1
- package/CardMetric/CardMetric.d.ts +7 -0
- package/CardMetric/CardMetric.js +7 -0
- package/CardMetric/types.d.ts +13 -0
- package/Checkbox/Checkbox.d.ts +6 -0
- package/Checkbox/Checkbox.js +6 -0
- package/Checkbox/types.d.ts +13 -0
- package/Chip/Chip.d.ts +7 -0
- package/Chip/Chip.js +7 -0
- package/Chip/Chip.types.d.ts +9 -0
- package/CodeEditor/CodeEditor.d.ts +7 -0
- package/CodeEditor/CodeEditor.js +7 -0
- package/CodeEditor/languages/html.d.ts +1 -0
- package/CodeEditor/languages/html.js +1 -0
- package/CodeEditor/languages/json.d.ts +1 -0
- package/CodeEditor/languages/json.js +1 -0
- package/CodeEditor/languages/liquid.d.ts +1 -0
- package/CodeEditor/languages/liquid.js +1 -0
- package/CodeEditor/types.d.ts +11 -0
- package/CrashScreen/CrashScreen.d.ts +4 -0
- package/CrashScreen/CrashScreen.js +4 -0
- package/DateTimePicker/components/DatePicker/DatePicker.d.ts +5 -0
- package/DateTimePicker/components/DatePicker/DatePicker.js +5 -0
- package/DateTimePicker/components/DatePicker/types.d.ts +9 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +5 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.js +5 -0
- package/DateTimePicker/components/DatePickerField/types.d.ts +9 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.d.ts +5 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +5 -0
- package/DateTimePicker/components/DateTimePicker/types.d.ts +6 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +5 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +5 -0
- package/DateTimePicker/components/DateTimePickerField/types.d.ts +9 -0
- package/DateTimePicker/types.d.ts +5 -0
- package/Drawer/components/Drawer/Drawer.d.ts +11 -0
- package/Drawer/components/Drawer/Drawer.js +12 -1
- package/Drawer/components/Drawer/types.d.ts +10 -1
- package/Drawer/components/DrawerContent/styles.d.ts +3 -0
- package/Drawer/components/DrawerContent/styles.js +3 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.d.ts +7 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.js +7 -0
- package/Drawer/components/DrawerDocs/hooks.d.ts +4 -0
- package/Drawer/components/DrawerDocs/hooks.js +4 -0
- package/Drawer/components/DrawerDocs/types.d.ts +4 -0
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.d.ts +12 -0
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +12 -0
- package/DropdownMenu/components/DropdownMenu/types.d.ts +15 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.d.ts +8 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -0
- package/DropdownMenu/components/DropdownMenuButton/types.d.ts +16 -0
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.d.ts +7 -0
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +7 -0
- package/DropdownMenu/components/DropdownMenuItem/types.d.ts +6 -0
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.d.ts +8 -0
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +8 -0
- package/DropdownMenu/components/DropdownMenuSection/types.d.ts +3 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.d.ts +9 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +9 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/types.d.ts +5 -0
- package/EditableField/EditableField.d.ts +9 -0
- package/EditableField/EditableField.js +9 -0
- package/EditableField/types.d.ts +12 -0
- package/EmailTemplatePreview/EmailTemplatePreview.d.ts +7 -0
- package/EmailTemplatePreview/EmailTemplatePreview.js +7 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.d.ts +4 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +4 -0
- package/EmailTemplatePreview/helpers.d.ts +8 -0
- package/EmailTemplatePreview/helpers.js +8 -0
- package/EmailTemplatePreview/types.d.ts +7 -0
- package/EnhancedInput/EnhancedInput.d.ts +7 -0
- package/EnhancedInput/EnhancedInput.js +7 -0
- package/EnhancedInput/SearchInput.d.ts +6 -0
- package/EnhancedInput/SearchInput.js +6 -0
- package/EnhancedInput/types.d.ts +5 -0
- package/ExportResult/ExportResult.d.ts +7 -0
- package/ExportResult/ExportResult.js +7 -0
- package/ExportResult/types.d.ts +7 -0
- package/ExternalImagePreview/ExternalImagePreview.d.ts +7 -0
- package/ExternalImagePreview/ExternalImagePreview.js +7 -0
- package/ExternalImagePreview/types.d.ts +7 -0
- package/FieldBox/FieldBox.d.ts +9 -0
- package/FieldBox/FieldBox.js +9 -0
- package/FieldBox/types.d.ts +10 -0
- package/FrequencyCapping/FrequencyCappingEdit.d.ts +7 -0
- package/FrequencyCapping/FrequencyCappingEdit.js +7 -0
- package/FrequencyCapping/FrequencyCappingInApps.d.ts +7 -0
- package/FrequencyCapping/FrequencyCappingInApps.js +7 -0
- package/FrequencyCapping/FrequencyCappingReadonly.d.ts +3 -0
- package/FrequencyCapping/FrequencyCappingReadonly.js +3 -0
- package/FrequencyCapping/types.d.ts +37 -0
- package/FrequencyCapping/types.js +1 -0
- package/GetStartedPage/GetStartedPage.d.ts +7 -0
- package/GetStartedPage/GetStartedPage.js +7 -0
- package/GetStartedPage/types.d.ts +7 -0
- package/InputFile/InputFile.d.ts +7 -0
- package/InputFile/InputFile.js +7 -0
- package/InputFile/types.d.ts +18 -0
- package/Link/Link.d.ts +18 -0
- package/Link/types.d.ts +17 -0
- package/Modal/components/Modal/Modal.d.ts +11 -0
- package/Modal/components/Modal/Modal.js +11 -0
- package/Modal/components/Modal/types.d.ts +6 -0
- package/Modal/components/ModalConfirm/ModalConfirm.d.ts +8 -0
- package/Modal/components/ModalConfirm/ModalConfirm.js +8 -0
- package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +7 -0
- package/Modal/components/ModalConfirm/ModalConfirmProvider.js +7 -0
- package/Modal/components/ModalConfirm/hooks.d.ts +8 -0
- package/Modal/components/ModalConfirm/hooks.js +8 -0
- package/Modal/components/ModalConfirm/types.d.ts +16 -0
- package/Modal/components/ModalContent/styles.d.ts +5 -0
- package/Modal/components/ModalContent/styles.js +5 -0
- package/Modal/components/ModalTitle/ModalTitle.d.ts +6 -0
- package/Modal/components/ModalTitle/ModalTitle.js +6 -0
- package/Modal/components/ModalTitle/types.d.ts +3 -0
- package/NotificationInbox/NotificationBar.d.ts +7 -0
- package/NotificationInbox/NotificationBar.js +7 -0
- package/NotificationInbox/NotificationBell.d.ts +7 -0
- package/NotificationInbox/NotificationBell.js +7 -0
- package/NotificationInbox/NotificationInbox.d.ts +7 -0
- package/NotificationInbox/NotificationInbox.js +7 -0
- package/NotificationInbox/types.d.ts +31 -0
- package/NumberPicker/NumberPicker.d.ts +7 -0
- package/NumberPicker/NumberPicker.js +7 -0
- package/NumberPicker/types.d.ts +12 -0
- package/PageHeader/components/AutosizeInput/AutosizeInput.d.ts +7 -0
- package/PageHeader/components/AutosizeInput/AutosizeInput.js +7 -0
- package/PageHeader/components/AutosizeInput/types.d.ts +7 -0
- package/PageHeader/components/PageHeader/PageHeader.d.ts +7 -0
- package/PageHeader/components/PageHeader/PageHeader.js +7 -0
- package/PageHeader/components/PageHeader/types.d.ts +13 -0
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.d.ts +7 -0
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +7 -0
- package/PageHeader/components/PageHeaderEditable/types.d.ts +19 -0
- package/Pagination/Pagination.d.ts +7 -0
- package/Pagination/Pagination.js +7 -0
- package/Pagination/types.d.ts +7 -0
- package/Popover/Popover.d.ts +10 -0
- package/Popover/Popover.js +10 -0
- package/Popover/styles.d.ts +1 -0
- package/Popover/styles.js +1 -0
- package/Popover/types.d.ts +9 -0
- package/ProgressBar/ProgressBar.d.ts +6 -0
- package/ProgressBar/ProgressBar.js +6 -0
- package/ProgressBar/types.d.ts +7 -0
- package/PushPreview/PushPreview.d.ts +7 -0
- package/PushPreview/PushPreview.js +7 -0
- package/PushPreview/types.d.ts +17 -0
- package/Radio/Radio.d.ts +7 -0
- package/Radio/Radio.js +7 -0
- package/Radio/types.d.ts +14 -0
- package/RadioCard/RadioCard.d.ts +7 -0
- package/RadioCard/RadioCard.js +7 -0
- package/RadioCard/types.d.ts +7 -0
- package/ReCaptcha/ReCaptcha.d.ts +8 -0
- package/ReCaptcha/ReCaptcha.js +8 -0
- package/ReCaptcha/helpers.d.ts +4 -0
- package/ReCaptcha/helpers.js +4 -0
- package/ReCaptcha/hooks.d.ts +4 -0
- package/ReCaptcha/hooks.js +4 -0
- package/ReCaptcha/types.d.ts +5 -0
- package/RichMessageEditor/RichMessageEditor.d.ts +8 -0
- package/RichMessageEditor/RichMessageEditor.js +8 -0
- package/RichMessageEditor/RichMessageEditor.types.d.ts +10 -0
- package/RichMessageEditor/RichMessageViewer.d.ts +10 -0
- package/RichMessageEditor/RichMessageViewer.js +7 -0
- package/RichMessageEditor/slate/types.d.ts +5 -0
- package/RichMessageEditor/types.d.ts +1 -0
- package/RichmediaPreview/RichmediaPreview.d.ts +7 -0
- package/RichmediaPreview/RichmediaPreview.js +7 -0
- package/RichmediaPreview/hooks.d.ts +4 -0
- package/RichmediaPreview/hooks.js +4 -0
- package/RichmediaPreview/types.d.ts +13 -0
- package/Select/Select.d.ts +22 -0
- package/Select/Select.js +22 -0
- package/Select/constants.d.ts +1 -0
- package/Select/constants.js +1 -0
- package/Select/types.d.ts +19 -0
- package/SendRate/SendRateEdit.d.ts +7 -0
- package/SendRate/SendRateEdit.js +7 -0
- package/SendRate/SendRateReadonly.d.ts +3 -0
- package/SendRate/SendRateReadonly.js +3 -0
- package/SendRate/types.d.ts +20 -0
- package/Skeleton/TextSkeleton.d.ts +6 -0
- package/Skeleton/TextSkeleton.js +6 -0
- package/Skeleton/styles.d.ts +2 -0
- package/Skeleton/styles.js +2 -0
- package/Skeleton/types.d.ts +11 -0
- package/SortButton/SortButton.d.ts +6 -0
- package/SortButton/SortButton.js +6 -0
- package/SortButton/types.d.ts +11 -0
- package/Spinner/Spinner.d.ts +6 -0
- package/Spinner/Spinner.js +6 -0
- package/Spinner/types.d.ts +4 -0
- package/StatisticCard/StatisticCard.d.ts +7 -0
- package/StatisticCard/StatisticCard.js +7 -0
- package/StatisticCard/types.d.ts +21 -0
- package/Switch/Switch.d.ts +6 -0
- package/Switch/Switch.js +6 -0
- package/Switch/types.d.ts +8 -0
- package/Tabs/components/Tab/Tab.d.ts +4 -0
- package/Tabs/components/Tab/Tab.js +4 -0
- package/Tabs/components/Tab/types.d.ts +6 -0
- package/Tabs/components/TabBar/TabBar.d.ts +3 -0
- package/Tabs/components/TabBar/TabBar.js +3 -0
- package/Tabs/components/TabBar/types.d.ts +2 -0
- package/Tabs/components/TabPanel/TabPanel.d.ts +4 -0
- package/Tabs/components/TabPanel/TabPanel.js +4 -0
- package/Tabs/components/TabPanel/types.d.ts +3 -0
- package/Tabs/components/Tabs/Tabs.d.ts +11 -0
- package/Tabs/components/Tabs/Tabs.js +11 -0
- package/Tabs/components/Tabs/types.d.ts +4 -0
- package/Tabs/types.d.ts +4 -0
- package/Toast/Toast.d.ts +5 -0
- package/Toast/Toast.js +5 -0
- package/Toast/ToastProvider.d.ts +7 -0
- package/Toast/ToastProvider.js +7 -0
- package/Toast/hooks.d.ts +8 -0
- package/Toast/hooks.js +8 -0
- package/Toast/types.d.ts +24 -0
- package/Tooltip/Tooltip.d.ts +7 -0
- package/Tooltip/Tooltip.js +7 -0
- package/Tooltip/TooltipTrigger.d.ts +13 -0
- package/Tooltip/TooltipTrigger.js +7 -0
- package/Tooltip/types.d.ts +12 -0
- package/hooks/useElementWidth.d.ts +4 -3
- package/hooks/useElementWidth.js +4 -3
- package/hooks/useLayer.d.ts +7 -0
- package/hooks/useLayer.js +7 -0
- package/hooks/useOnClickOutside.d.ts +7 -0
- package/hooks/useOnClickOutside.js +7 -0
- package/native/Input.d.ts +3 -0
- package/native/Input.js +1 -0
- package/native/NativeTimeInput.d.ts +1 -0
- package/native/NativeTimeInput.js +1 -0
- package/native/Select.d.ts +1 -0
- package/native/Select.js +1 -0
- package/native/Textarea.d.ts +1 -0
- package/native/Textarea.js +1 -0
- package/package.json +2 -3
- package/polyglot/react.d.ts +19 -0
- package/polyglot/react.js +19 -0
- package/polyglot/types.d.ts +4 -0
- package/shared/dropdownField/FieldInput.d.ts +1 -0
- package/shared/dropdownField/FieldInput.js +1 -0
- package/shared/dropdownField/FieldShell.d.ts +4 -0
- package/shared/dropdownField/FieldShell.js +4 -0
- package/shared/dropdownField/SuggestionsDropdown.d.ts +4 -0
- package/shared/dropdownField/SuggestionsDropdown.js +4 -0
- package/shared/dropdownField/constants.d.ts +1 -0
- package/shared/dropdownField/constants.js +1 -0
- package/shared/dropdownField/shared.d.ts +7 -0
- package/shared/dropdownField/shared.js +7 -0
- package/shared/dropdownField/types.d.ts +7 -0
- package/shared/dropdownField/useActiveIndex.d.ts +4 -0
- package/shared/dropdownField/useActiveIndex.js +4 -0
- package/shared/dropdownField/useAsyncItems.d.ts +4 -0
- package/shared/dropdownField/useAsyncItems.js +4 -0
- package/shared/dropdownField/useDebouncedValue.d.ts +1 -0
- package/shared/dropdownField/useDebouncedValue.js +1 -0
- package/shared/dropdownField/useDropdownItems.d.ts +4 -0
- package/shared/dropdownField/useDropdownItems.js +4 -0
- package/shared/dropdownField/useDropdownPosition.d.ts +4 -0
- package/shared/dropdownField/useDropdownPosition.js +4 -0
- package/shared/dropdownField/useFieldOpenEffects.d.ts +4 -0
- package/shared/dropdownField/useFieldOpenEffects.js +4 -0
- package/shared/dropdownField/useListNavigation.d.ts +5 -0
- package/shared/dropdownField/useListNavigation.js +5 -0
- package/Alert/ai-documentation.md +0 -132
- package/Badge/ai-documentation.md +0 -155
- package/Banner/ai-documentation.md +0 -285
- package/Button/ai-documentation.md +0 -247
- package/CardMetric/ai-documentation.md +0 -277
- package/Checkbox/ai-documentation.md +0 -231
- package/Chip/ai-documentation.md +0 -281
- package/CodeEditor/ai-documentation.md +0 -350
- package/DateTimePicker/ai-documentation.md +0 -400
- package/Drawer/ai-documentation.md +0 -417
- package/EnhancedInput/ai-documentation.md +0 -352
- package/InputFile/ai-documentation.md +0 -420
- package/Modal/ai-documentation.md +0 -285
- package/PageHeader/ai-documentation.md +0 -511
- package/Pagination/ai-documentation.md +0 -509
- package/Popover/ai-documentation.md +0 -625
- package/ProgressBar/ai-documentation.md +0 -533
- package/Radio/ai-documentation.md +0 -243
- package/Select/ai-documentation.md +0 -374
- package/Skeleton/ai-documentation.md +0 -574
- package/Spinner/ai-documentation.md +0 -607
- package/Switch/ai-documentation.md +0 -312
- package/Tabs/ai-documentation.md +0 -475
- package/Toast/ai-documentation.md +0 -220
- package/Tooltip/ai-documentation.md +0 -340
- package/ai-documentation.md +0 -124
- package/native/ai-documentation.md +0 -485
package/Calendar/helpers.js
CHANGED
|
@@ -32,12 +32,14 @@ export const formatStruct = (ds, template) => {
|
|
|
32
32
|
return value !== undefined ? formatTwoDigitNumber(value) : match;
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
+
/** Returns a new struct with `value` units of `period` added (negative to subtract); rolls over correctly. */
|
|
35
36
|
export const addPeriod = (ds, period, value) => {
|
|
36
37
|
const date = createUTCDate(ds.year, ds.month, ds.day, ds.hour, ds.minute, ds.second);
|
|
37
38
|
const method = periodMethodMap[period];
|
|
38
39
|
date[`setUTC${method}`](date[`getUTC${method}`]() + value);
|
|
39
40
|
return utcDateToStruct(date);
|
|
40
41
|
};
|
|
42
|
+
/** Narrows a {@link DateTimeStruct} to a date-only {@link DateStruct} (drops the time fields). */
|
|
41
43
|
export const pickDateStruct = date => {
|
|
42
44
|
return {
|
|
43
45
|
year: date.year,
|
|
@@ -80,6 +82,7 @@ export const isSamePeriod = (ds1, ds2, period) => {
|
|
|
80
82
|
}
|
|
81
83
|
return true;
|
|
82
84
|
};
|
|
85
|
+
/** Compares two structs chronologically: `-1` if `ds1 < ds2`, `0` if equal, `1` if `ds1 > ds2`. */
|
|
83
86
|
export const compareStructs = (ds1, ds2) => {
|
|
84
87
|
const date1 = createUTCDate(ds1.year, ds1.month, ds1.day, ds1.hour, ds1.minute, ds1.second);
|
|
85
88
|
const date2 = createUTCDate(ds2.year, ds2.month, ds2.day, ds2.hour, ds2.minute, ds2.second);
|
|
@@ -108,12 +111,14 @@ export const getLastDayOfMonth = date => {
|
|
|
108
111
|
d.setUTCDate(0);
|
|
109
112
|
return utcDateToStruct(d);
|
|
110
113
|
};
|
|
114
|
+
/** Returns the start of the given `period` containing `date` (e.g. first instant of the month). */
|
|
111
115
|
export const getPeriodStart = (date, period) => {
|
|
112
116
|
const idx = allPeriods.indexOf(period);
|
|
113
117
|
const values = allPeriods.slice(0, idx + 1).map(period => date[period] || 0);
|
|
114
118
|
const dateObj = createUTCDate(...values);
|
|
115
119
|
return utcDateToStruct(dateObj);
|
|
116
120
|
};
|
|
121
|
+
/** Returns the last instant of the given `period` containing `date` (e.g. 23:59:59.999 of the day). */
|
|
117
122
|
export const getPeriodEnd = (date, period) => {
|
|
118
123
|
const idx = allPeriods.indexOf(period);
|
|
119
124
|
const values = allPeriods.slice(0, idx + 1).map(period => date[period] || 0);
|
|
@@ -123,10 +128,12 @@ export const getPeriodEnd = (date, period) => {
|
|
|
123
128
|
dateObj.setMilliseconds(-1);
|
|
124
129
|
return utcDateToStruct(dateObj);
|
|
125
130
|
};
|
|
131
|
+
/** Converts a `Date` to a {@link DateTimeStruct} shifted by `tzOffsetMinutes` (minutes east of UTC). */
|
|
126
132
|
export const dateToStruct = (date, tzOffsetMinutes) => {
|
|
127
133
|
const localTime = new Date(date.getTime() + tzOffsetMinutes * 60_000);
|
|
128
134
|
return utcDateToStruct(localTime);
|
|
129
135
|
};
|
|
136
|
+
/** Converts a struct back to a `Date`, interpreting it as a wall-clock time `tzOffsetMinutes` east of UTC. */
|
|
130
137
|
export const structToDate = (ds, tzOffsetMinutes) => {
|
|
131
138
|
const hour = ds.hour ?? 0;
|
|
132
139
|
const minute = ds.minute ?? 0;
|
|
@@ -135,6 +142,7 @@ export const structToDate = (ds, tzOffsetMinutes) => {
|
|
|
135
142
|
const utcTime = Date.UTC(ds.year, ds.month - 1, ds.day, hour, minute, second, millisecond);
|
|
136
143
|
return new Date(utcTime - tzOffsetMinutes * 60_000);
|
|
137
144
|
};
|
|
145
|
+
/** Returns the offset in minutes (east of UTC) for an IANA `timezoneName` at the given instant `at`. */
|
|
138
146
|
export function getTimezoneOffset(timezoneName, at = new Date()) {
|
|
139
147
|
var _parts$find, _parts$find2, _parts$find3, _parts$find4, _parts$find5, _parts$find6;
|
|
140
148
|
const dtf = new Intl.DateTimeFormat('en-US', {
|
|
@@ -157,10 +165,12 @@ export function getTimezoneOffset(timezoneName, at = new Date()) {
|
|
|
157
165
|
const asUTC = Date.UTC(y, mo, d, h, mi, s);
|
|
158
166
|
return Math.round((asUTC - at.getTime()) / 60000);
|
|
159
167
|
}
|
|
168
|
+
/** Like {@link dateToStruct} but resolves the offset from an IANA `tzName` (handles DST). */
|
|
160
169
|
export const dateToStructTz = (date, tzName) => {
|
|
161
170
|
const tzOffsetMinutes = getTimezoneOffset(tzName, date);
|
|
162
171
|
return dateToStruct(date, tzOffsetMinutes);
|
|
163
172
|
};
|
|
173
|
+
/** Like {@link structToDate} but resolves the offset from an IANA `tzName` (handles DST). */
|
|
164
174
|
export const structToDateTz = (ds, tzName) => {
|
|
165
175
|
const hour = ds.hour ?? 0;
|
|
166
176
|
const minute = ds.minute ?? 0;
|
package/Calendar/types.d.ts
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
|
+
/** A calendar granularity unit, from `year` down to `millisecond`. */
|
|
1
2
|
export type Period = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
3
|
+
/** Calendar-agnostic date (1-based `month`), used across the Calendar helpers and components. */
|
|
2
4
|
export type DateStruct = {
|
|
5
|
+
/** Full year, e.g. 2026. */
|
|
3
6
|
year: number;
|
|
7
|
+
/** Month, 1–12 (1-based, unlike the native `Date`). */
|
|
4
8
|
month: number;
|
|
9
|
+
/** Day of month, 1–31. */
|
|
5
10
|
day: number;
|
|
6
11
|
};
|
|
12
|
+
/** {@link DateStruct} extended with a time-of-day down to milliseconds. */
|
|
7
13
|
export type DateTimeStruct = {
|
|
14
|
+
/** Full year, e.g. 2026. */
|
|
8
15
|
year: number;
|
|
16
|
+
/** Month, 1–12 (1-based). */
|
|
9
17
|
month: number;
|
|
18
|
+
/** Day of month, 1–31. */
|
|
10
19
|
day: number;
|
|
20
|
+
/** Hour, 0–23. */
|
|
11
21
|
hour: number;
|
|
22
|
+
/** Minute, 0–59. */
|
|
12
23
|
minute: number;
|
|
24
|
+
/** Second, 0–59. */
|
|
13
25
|
second: number;
|
|
26
|
+
/** Millisecond, 0–999. */
|
|
14
27
|
millisecond: number;
|
|
15
28
|
};
|
|
29
|
+
/** A single selected value of type `T`. */
|
|
16
30
|
export type SingleValue<T> = T;
|
|
31
|
+
/** A range selection: `[from, to]`, a partial `[from]`, or empty `[]`. */
|
|
17
32
|
export type RangeValue<T> = [from: T, to: T] | [from: T] | [];
|
|
18
|
-
/**
|
|
33
|
+
/** A timezone value as an IANA name (e.g. `"Europe/Berlin"`). */
|
|
19
34
|
export type TzValue = string;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { CardMetricProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Dashboard metric card with a title, primary/secondary values, optional tooltip,
|
|
5
|
+
* loading state and collapsible body.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <CardMetric title="Sent" metric={1280} extraMetric="+12%" tooltip="Last 24h" />
|
|
9
|
+
*/
|
|
3
10
|
export declare function CardMetric({ view, focus, title, tooltip, description, loading, collapse, metric, extraMetric, extraMetricColor, headerExtra, children, ...otherProps }: CardMetricProps): ReactElement;
|
package/CardMetric/CardMetric.js
CHANGED
|
@@ -6,6 +6,13 @@ import { Spinner } from '../Spinner';
|
|
|
6
6
|
import { Tooltip } from '../Tooltip';
|
|
7
7
|
import { CardChildren } from './CardChildren';
|
|
8
8
|
import { CardContainer, CardHeader, CardTitle, CardInfo, CardMetricValue, CardExtraMetric, CardDescription, CardHeaderLeft } from './styles';
|
|
9
|
+
/**
|
|
10
|
+
* Dashboard metric card with a title, primary/secondary values, optional tooltip,
|
|
11
|
+
* loading state and collapsible body.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <CardMetric title="Sent" metric={1280} extraMetric="+12%" tooltip="Last 24h" />
|
|
15
|
+
*/
|
|
9
16
|
export function CardMetric({
|
|
10
17
|
view = 'rounded',
|
|
11
18
|
focus = false,
|
package/CardMetric/types.d.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/** Props of {@link CardMetric}. */
|
|
2
3
|
export type CardMetricProps = {
|
|
4
|
+
/** Visual style: `rounded` (default) or `stacking`. */
|
|
3
5
|
view?: 'rounded' | 'stacking';
|
|
6
|
+
/** Apply the focused (highlighted) styling. */
|
|
4
7
|
focus?: boolean;
|
|
8
|
+
/** Card title. */
|
|
5
9
|
title?: string | ReactElement;
|
|
10
|
+
/** Help text shown via an info tooltip next to the title. */
|
|
6
11
|
tooltip?: string;
|
|
12
|
+
/** Show a spinner in place of the metric value. */
|
|
7
13
|
loading?: boolean;
|
|
14
|
+
/** Enable collapsing; `isCollapsed` sets the initial collapsed state. */
|
|
8
15
|
collapse?: {
|
|
9
16
|
isCollapsed: boolean;
|
|
10
17
|
};
|
|
18
|
+
/** Footer description text. */
|
|
11
19
|
description?: string;
|
|
20
|
+
/** Primary metric value. */
|
|
12
21
|
metric?: string | number;
|
|
22
|
+
/** Secondary metric shown next to the primary one. */
|
|
13
23
|
extraMetric?: string | number;
|
|
24
|
+
/** Color of the secondary metric. */
|
|
14
25
|
extraMetricColor?: string;
|
|
26
|
+
/** Extra content on the right of the header. */
|
|
15
27
|
headerExtra?: ReactElement;
|
|
28
|
+
/** Additional props forwarded to the card container. */
|
|
16
29
|
[key: string]: any;
|
|
17
30
|
};
|
|
18
31
|
export type CardContainerProps = {
|
package/Checkbox/Checkbox.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { CheckboxProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Labelled checkbox with error and indeterminate states and an optional help tooltip.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <Checkbox label="I agree" isChecked={agreed} onChange={setAgreed} />
|
|
8
|
+
*/
|
|
3
9
|
export declare function Checkbox(props: CheckboxProps): ReactElement;
|
package/Checkbox/Checkbox.js
CHANGED
|
@@ -5,6 +5,12 @@ import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
|
5
5
|
import { NativeLabel, NativeCheckbox } from './styles';
|
|
6
6
|
import { TooltipTrigger } from '../Tooltip';
|
|
7
7
|
let counter = 0;
|
|
8
|
+
/**
|
|
9
|
+
* Labelled checkbox with error and indeterminate states and an optional help tooltip.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <Checkbox label="I agree" isChecked={agreed} onChange={setAgreed} />
|
|
13
|
+
*/
|
|
8
14
|
export function Checkbox(props) {
|
|
9
15
|
const {
|
|
10
16
|
label,
|
package/Checkbox/types.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/** Visual state of a {@link Checkbox}: `normal` or `error` (red). */
|
|
2
3
|
export type CheckboxType = 'normal' | 'error';
|
|
4
|
+
/** Props of {@link Checkbox}. */
|
|
3
5
|
export type CheckboxProps = {
|
|
6
|
+
/** Label rendered next to the box. */
|
|
4
7
|
label?: ReactNode;
|
|
8
|
+
/** Explicit element id; auto-generated when omitted. */
|
|
5
9
|
id?: string;
|
|
10
|
+
/** Form field name. */
|
|
6
11
|
name?: string;
|
|
12
|
+
/** Form field value submitted when checked. */
|
|
7
13
|
value?: string | number;
|
|
14
|
+
/** Visual state: `normal` (default) or `error`. */
|
|
8
15
|
type?: CheckboxType;
|
|
16
|
+
/** Checked state (controlled). */
|
|
9
17
|
isChecked?: boolean;
|
|
18
|
+
/** Disable interaction and render the disabled state. */
|
|
10
19
|
isDisabled?: boolean;
|
|
20
|
+
/** Render the indeterminate (partial) state — visual only, doesn't affect `isChecked`. */
|
|
11
21
|
isIndeterminate?: boolean;
|
|
22
|
+
/** Help text shown via a question-mark tooltip next to the checkbox. */
|
|
12
23
|
tooltip?: string;
|
|
24
|
+
/** CSS color override for the checked box. */
|
|
13
25
|
activeCheckboxColor?: string;
|
|
26
|
+
/** Fires with the new checked state on toggle. */
|
|
14
27
|
onChange?: (checked: boolean) => void;
|
|
15
28
|
};
|
package/Chip/Chip.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact tag/filter pill with color variants, an optional leading icon, a close
|
|
3
|
+
* button or a help tooltip, and ellipsis truncation via `$maxWidth`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <Chip $variant="primary" $onClose={() => remove(tag)}>{tag}</Chip>
|
|
7
|
+
*/
|
|
1
8
|
export declare const Chip: import("react").ForwardRefExoticComponent<{
|
|
2
9
|
$variant?: import("./Chip.types").ChipVariant;
|
|
3
10
|
$selected?: boolean;
|
package/Chip/Chip.js
CHANGED
|
@@ -2,6 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { TooltipTrigger } from '../Tooltip';
|
|
4
4
|
import { ChipCloseIcon, ChipLabel, ChipSlotIcon, ChipStyled } from './styles';
|
|
5
|
+
/**
|
|
6
|
+
* Compact tag/filter pill with color variants, an optional leading icon, a close
|
|
7
|
+
* button or a help tooltip, and ellipsis truncation via `$maxWidth`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <Chip $variant="primary" $onClose={() => remove(tag)}>{tag}</Chip>
|
|
11
|
+
*/
|
|
5
12
|
export const Chip = forwardRef(({
|
|
6
13
|
$variant = 'primary',
|
|
7
14
|
$selected,
|
package/Chip/Chip.types.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { type HTMLAttributes, type PropsWithChildren, type ReactNode } from 'react';
|
|
2
|
+
/** Color variant of a {@link Chip}. */
|
|
2
3
|
export type ChipVariant = 'primary' | 'danger' | 'warning';
|
|
4
|
+
/** Props of {@link Chip} — all `<div>` attributes plus the chip-specific ones. */
|
|
3
5
|
export type ChipProps = PropsWithChildren<{
|
|
6
|
+
/** Color variant (default `primary`). */
|
|
4
7
|
$variant?: ChipVariant;
|
|
8
|
+
/** Render the selected (highlighted) state. */
|
|
5
9
|
$selected?: boolean;
|
|
10
|
+
/** When set (and not `$readOnly`), shows a close (✕) button; called on its click. */
|
|
6
11
|
$onClose?: HTMLAttributes<HTMLDivElement>['onClick'];
|
|
12
|
+
/** Read-only chip — disables the close button (`$onClose` is ignored). */
|
|
7
13
|
$readOnly?: boolean;
|
|
8
14
|
/** CSS max-width value, e.g. "120px", "50%", "10rem". Enables label truncation with ellipsis. */
|
|
9
15
|
$maxWidth?: string;
|
|
16
|
+
/** Leading icon. */
|
|
10
17
|
$icon?: ReactNode;
|
|
18
|
+
/** Help tooltip shown via a trailing question-mark icon (only when not closeable). */
|
|
11
19
|
$tooltip?: ReactNode;
|
|
20
|
+
/** Render as a different element/tag. */
|
|
12
21
|
as?: string;
|
|
13
22
|
}> & HTMLAttributes<HTMLDivElement>;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { type CodeEditorProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* CodeMirror-based code editor with theming, read-only and error states.
|
|
4
|
+
* Provide a language through `extensions` (see the exported `html`, `liquid`, `json` helpers).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <CodeEditor value={code} extensions={json} onChange={setCode} height="200px" />
|
|
8
|
+
*/
|
|
2
9
|
export declare const CodeEditor: ({ value, onChange, readOnly, width, height, onBlur, extensions, themeOptions, hasError, placeholder, }: CodeEditorProps) => import("react/jsx-runtime").JSX.Element;
|
package/CodeEditor/CodeEditor.js
CHANGED
|
@@ -2,6 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import createTheme from '@uiw/codemirror-themes';
|
|
3
3
|
import { defaultTheme } from './constants';
|
|
4
4
|
import { CodeMirrorStyled } from './styles';
|
|
5
|
+
/**
|
|
6
|
+
* CodeMirror-based code editor with theming, read-only and error states.
|
|
7
|
+
* Provide a language through `extensions` (see the exported `html`, `liquid`, `json` helpers).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <CodeEditor value={code} extensions={json} onChange={setCode} height="200px" />
|
|
11
|
+
*/
|
|
5
12
|
export const CodeEditor = ({
|
|
6
13
|
value,
|
|
7
14
|
onChange,
|
package/CodeEditor/types.d.ts
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { type CreateThemeOptions } from '@uiw/codemirror-themes';
|
|
2
2
|
import { type ViewUpdate, type Extension } from '@uiw/react-codemirror';
|
|
3
|
+
/** Props of {@link CodeEditor}. */
|
|
3
4
|
export type CodeEditorProps = {
|
|
5
|
+
/** Editor content (controlled). */
|
|
4
6
|
value: string;
|
|
7
|
+
/** Render read-only (no editing). */
|
|
5
8
|
readOnly?: boolean;
|
|
9
|
+
/** CSS width of the editor. */
|
|
6
10
|
width?: string;
|
|
11
|
+
/** CSS height of the editor. */
|
|
7
12
|
height?: string;
|
|
13
|
+
/** Render the error (red) state. */
|
|
8
14
|
hasError?: boolean;
|
|
15
|
+
/** CodeMirror extensions — pass a language (e.g. `html`, `liquid`, `json`) and any addons. */
|
|
9
16
|
extensions: Extension[];
|
|
17
|
+
/** Placeholder shown when empty. */
|
|
10
18
|
placeholder?: string;
|
|
19
|
+
/** Theme overrides; defaults to the built-in theme when omitted. */
|
|
11
20
|
themeOptions?: CreateThemeOptions;
|
|
21
|
+
/** Fires with the new content and the CodeMirror `ViewUpdate` on every edit. */
|
|
12
22
|
onChange?: (value: string, viewUpdate: ViewUpdate) => void;
|
|
23
|
+
/** Fires when the editor loses focus. */
|
|
13
24
|
onBlur?: () => void;
|
|
14
25
|
};
|
|
@@ -3,6 +3,10 @@ import { Color } from '@pushwoosh/kit-constants';
|
|
|
3
3
|
import { WarningRoundIcon } from '@pushwoosh/kit-icons';
|
|
4
4
|
import { Lang } from './polyglot';
|
|
5
5
|
import { RootBox, IconBox, TitleBox, DescriptionBox } from './styles';
|
|
6
|
+
/**
|
|
7
|
+
* Full-page fallback shown when the app crashes (e.g. from an error boundary), with
|
|
8
|
+
* a warning icon and localized title/description.
|
|
9
|
+
*/
|
|
6
10
|
export function CrashScreen() {
|
|
7
11
|
return _jsxs(RootBox, {
|
|
8
12
|
children: [_jsx(IconBox, {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DatePickerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Inline calendar with month/year/decade views for picking a date.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Use `CalendarDropdown` or `CalendarSuperForm` from Calendar instead.
|
|
7
|
+
*/
|
|
3
8
|
export declare function DatePicker(props: DatePickerProps): ReactElement;
|
|
@@ -6,6 +6,11 @@ import { CalendarBox } from '../../styles';
|
|
|
6
6
|
import { DecadeView } from '../DecadeView';
|
|
7
7
|
import { MonthView } from '../MonthView';
|
|
8
8
|
import { YearView } from '../YearView';
|
|
9
|
+
/**
|
|
10
|
+
* Inline calendar with month/year/decade views for picking a date.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated Use `CalendarDropdown` or `CalendarSuperForm` from Calendar instead.
|
|
13
|
+
*/
|
|
9
14
|
export function DatePicker(props) {
|
|
10
15
|
const {
|
|
11
16
|
value,
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/** Props of {@link DatePicker}. */
|
|
2
3
|
export interface DatePickerProps {
|
|
4
|
+
/** Currently selected date string. */
|
|
3
5
|
value?: string;
|
|
6
|
+
/** Externally driven day that resets the visible month and view. */
|
|
4
7
|
userInputDay?: string;
|
|
8
|
+
/** Earliest selectable date. */
|
|
5
9
|
minDate?: Date | string;
|
|
10
|
+
/** Latest selectable date. */
|
|
6
11
|
maxDate?: Date | string;
|
|
12
|
+
/** Disable selection. */
|
|
7
13
|
isDisabled?: boolean;
|
|
14
|
+
/** Render extra content under the month grid (e.g. time inputs). */
|
|
8
15
|
slotAfterMonth?: () => ReactNode | null;
|
|
16
|
+
/** Fires with the picked day string. */
|
|
9
17
|
onChange: (day: string) => void;
|
|
10
18
|
}
|
|
19
|
+
/** Calendar view level: day grid, month grid or decade grid. */
|
|
11
20
|
export type ViewType = 'month' | 'year' | 'decade';
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DatePickerFieldProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Read-only field showing the selected date that opens a {@link DatePicker} popover on click.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Use `CalendarDropdown` or `CalendarSuperForm` from Calendar instead.
|
|
7
|
+
*/
|
|
3
8
|
export declare function DatePickerField(props: DatePickerFieldProps): ReactElement;
|
|
@@ -6,6 +6,11 @@ import { format, monthName, get } from '../../helpers';
|
|
|
6
6
|
import { Lang } from '../../polyglot';
|
|
7
7
|
import { InputFrame } from '../../styles';
|
|
8
8
|
import { DatePicker } from '../DatePicker';
|
|
9
|
+
/**
|
|
10
|
+
* Read-only field showing the selected date that opens a {@link DatePicker} popover on click.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated Use `CalendarDropdown` or `CalendarSuperForm` from Calendar instead.
|
|
13
|
+
*/
|
|
9
14
|
export function DatePickerField(props) {
|
|
10
15
|
const {
|
|
11
16
|
value,
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { Placement } from '@floating-ui/react-dom';
|
|
2
|
+
/** Props of {@link DatePickerField}. */
|
|
2
3
|
export interface DatePickerFieldProps {
|
|
4
|
+
/** Currently selected date string. */
|
|
3
5
|
value: string;
|
|
6
|
+
/** Earliest selectable date. */
|
|
4
7
|
minDate?: Date | string;
|
|
8
|
+
/** Latest selectable date. */
|
|
5
9
|
maxDate?: Date | string;
|
|
10
|
+
/** Render the field in the error state. */
|
|
6
11
|
error?: boolean;
|
|
12
|
+
/** Allowed floating placements for the popover (default bottom/top start/end). */
|
|
7
13
|
allowedPlacements?: Placement[];
|
|
14
|
+
/** Popover z-index (default `1000`). */
|
|
8
15
|
zIndex?: number;
|
|
16
|
+
/** Close the popover when a date is picked (default `false`). */
|
|
9
17
|
closeOnSelect?: boolean;
|
|
18
|
+
/** Fires with the picked day string. */
|
|
10
19
|
onChange: (day: string) => void;
|
|
11
20
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DateTimePickerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Inline {@link DatePicker} with hour/minute/second number inputs for picking a date and time (UTC).
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Use `CalendarDropdown` or `CalendarSuperForm` from Calendar instead.
|
|
7
|
+
*/
|
|
3
8
|
export declare function DateTimePicker(props: DateTimePickerProps): ReactElement;
|
|
@@ -3,6 +3,11 @@ import { Collapse, Horizontal } from '@pushwoosh/kit-helpers';
|
|
|
3
3
|
import { format, createUTCDate } from '../../helpers';
|
|
4
4
|
import { DatePicker } from '../DatePicker';
|
|
5
5
|
import { NumberPicker } from '../NumberPicker';
|
|
6
|
+
/**
|
|
7
|
+
* Inline {@link DatePicker} with hour/minute/second number inputs for picking a date and time (UTC).
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use `CalendarDropdown` or `CalendarSuperForm` from Calendar instead.
|
|
10
|
+
*/
|
|
6
11
|
export function DateTimePicker(props) {
|
|
7
12
|
const {
|
|
8
13
|
value,
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
/** Props of {@link DateTimePicker}. */
|
|
1
2
|
export interface DateTimePickerProps {
|
|
3
|
+
/** Currently selected date-time string. */
|
|
2
4
|
value: string;
|
|
5
|
+
/** Earliest selectable date. */
|
|
3
6
|
minDate?: Date | string;
|
|
7
|
+
/** Latest selectable date. */
|
|
4
8
|
maxDate?: Date | string;
|
|
9
|
+
/** Externally driven day that resets the visible month and view. */
|
|
5
10
|
userInputDay?: string;
|
|
11
|
+
/** Fires with the picked date-time as a UTC string. */
|
|
6
12
|
onChange: (day: string) => void;
|
|
7
13
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DateTimePickerFieldProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Read-only field showing the selected date-time that opens a {@link DateTimePicker} popover on click.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Use `CalendarDropdown` or `CalendarSuperForm` from Calendar instead.
|
|
7
|
+
*/
|
|
3
8
|
export declare function DateTimePickerField(props: DateTimePickerFieldProps): ReactElement;
|
|
@@ -6,6 +6,11 @@ import { useUTCDate } from './helpers';
|
|
|
6
6
|
import { Lang } from '../../polyglot';
|
|
7
7
|
import { InputFrame } from '../../styles';
|
|
8
8
|
import { DateTimePicker } from '../DateTimePicker';
|
|
9
|
+
/**
|
|
10
|
+
* Read-only field showing the selected date-time that opens a {@link DateTimePicker} popover on click.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated Use `CalendarDropdown` or `CalendarSuperForm` from Calendar instead.
|
|
13
|
+
*/
|
|
9
14
|
export function DateTimePickerField(props) {
|
|
10
15
|
const {
|
|
11
16
|
value,
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { Placement } from '@floating-ui/react-dom';
|
|
2
|
+
/** Props of {@link DateTimePickerField}. */
|
|
2
3
|
export interface DateTimePickerFieldProps {
|
|
4
|
+
/** Currently selected date-time string. */
|
|
3
5
|
value: string;
|
|
6
|
+
/** Earliest selectable date. */
|
|
4
7
|
minDate?: Date | string;
|
|
8
|
+
/** Latest selectable date. */
|
|
5
9
|
maxDate?: Date | string;
|
|
10
|
+
/** Render the field in the error state. */
|
|
6
11
|
error?: boolean;
|
|
12
|
+
/** Allowed floating placements for the popover (default bottom/top start/end). */
|
|
7
13
|
allowedPlacements?: Placement[];
|
|
14
|
+
/** Popover z-index (default `1000`). */
|
|
8
15
|
zIndex?: number;
|
|
16
|
+
/** Close the popover when a value is picked (default `false`). */
|
|
9
17
|
closeOnSelect?: boolean;
|
|
18
|
+
/** Fires with the picked date-time string. */
|
|
10
19
|
onChange: (day: string) => void;
|
|
11
20
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/** Granularity unit used by the (deprecated) date/time picker internals. */
|
|
1
2
|
export type Period = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second';
|
|
3
|
+
/** A value with optional min/max bounds for the (deprecated) date/time picker internals. */
|
|
2
4
|
export type RangeOptions = {
|
|
5
|
+
/** The current date value. */
|
|
3
6
|
value: Date;
|
|
7
|
+
/** Earliest selectable date. */
|
|
4
8
|
minDate?: Date | string;
|
|
9
|
+
/** Latest selectable date. */
|
|
5
10
|
maxDate?: Date | string;
|
|
6
11
|
};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { DrawerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Side panel that slides in from the edge, rendered in a portal, with size presets,
|
|
5
|
+
* layered z-index and optional backdrop-click close. Compose with {@link DrawerHeader},
|
|
6
|
+
* {@link DrawerTitle} and {@link DrawerBody}.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Drawer size="medium" isOpen={open} onClose={close}>
|
|
10
|
+
* <DrawerHeader><DrawerTitle>Title</DrawerTitle></DrawerHeader>
|
|
11
|
+
* <DrawerBody>Content</DrawerBody>
|
|
12
|
+
* </Drawer>
|
|
13
|
+
*/
|
|
3
14
|
export declare function Drawer({ size, isOpen, zIndex, onClose, children, padding, withoutLockScreen, closeOnClickOutside, }: DrawerProps): ReactElement;
|
|
@@ -7,6 +7,17 @@ import { useLayer } from '../../../hooks';
|
|
|
7
7
|
function createDivElement() {
|
|
8
8
|
return document.createElement('div');
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Side panel that slides in from the edge, rendered in a portal, with size presets,
|
|
12
|
+
* layered z-index and optional backdrop-click close. Compose with {@link DrawerHeader},
|
|
13
|
+
* {@link DrawerTitle} and {@link DrawerBody}.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Drawer size="medium" isOpen={open} onClose={close}>
|
|
17
|
+
* <DrawerHeader><DrawerTitle>Title</DrawerTitle></DrawerHeader>
|
|
18
|
+
* <DrawerBody>Content</DrawerBody>
|
|
19
|
+
* </Drawer>
|
|
20
|
+
*/
|
|
10
21
|
export function Drawer({
|
|
11
22
|
size,
|
|
12
23
|
isOpen,
|
|
@@ -52,7 +63,7 @@ export function Drawer({
|
|
|
52
63
|
onMouseDown: handleClickOutside,
|
|
53
64
|
"$padding": padding,
|
|
54
65
|
children: _jsx(DrawerContainer, {
|
|
55
|
-
"$width": drawerSizes[size],
|
|
66
|
+
"$width": size in drawerSizes ? drawerSizes[size] : size,
|
|
56
67
|
onClick: handleClose,
|
|
57
68
|
children: children
|
|
58
69
|
})
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import type { MutableRefObject, PropsWithChildren } from 'react';
|
|
2
2
|
import type { drawerSizes } from './maps';
|
|
3
|
+
/** Per-side CSS padding overrides for the {@link Drawer} content area. */
|
|
3
4
|
export type ContentPadding = {
|
|
4
5
|
top?: string;
|
|
5
6
|
right?: string;
|
|
6
7
|
bottom?: string;
|
|
7
8
|
left?: string;
|
|
8
9
|
};
|
|
10
|
+
/** Props of {@link Drawer}. */
|
|
9
11
|
export type DrawerProps = PropsWithChildren<{
|
|
10
|
-
|
|
12
|
+
/** Width: a predefined preset, or an explicit CSS length (`${number}px` / `${number}%`). */
|
|
13
|
+
readonly size: keyof typeof drawerSizes | `${number}px` | `${number}%`;
|
|
14
|
+
/** Whether the drawer is open. */
|
|
11
15
|
readonly isOpen: boolean;
|
|
16
|
+
/** Stacking z-index; auto-layered when omitted. */
|
|
12
17
|
readonly zIndex?: number;
|
|
18
|
+
/** Fires on backdrop click (if enabled) or layer close. */
|
|
13
19
|
readonly onClose?: () => any;
|
|
20
|
+
/** Don't lock/scrim the page behind the drawer. */
|
|
14
21
|
readonly withoutLockScreen?: boolean;
|
|
22
|
+
/** Close on backdrop click (default `true`). */
|
|
15
23
|
readonly closeOnClickOutside?: boolean;
|
|
24
|
+
/** Per-side padding overrides for the content area. */
|
|
16
25
|
readonly padding?: ContentPadding;
|
|
17
26
|
}>;
|
|
18
27
|
export type DrawerBoxBaseProps = PropsWithChildren<{
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** Top section of a {@link Drawer}; typically wraps a {@link DrawerTitle}. */
|
|
1
2
|
export declare const DrawerHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
/** Heading row of a {@link Drawer} (an `<h2>`); place inside {@link DrawerHeader}. */
|
|
2
4
|
export declare const DrawerTitle: import("styled-components").StyledComponent<"h2", any, {}, never>;
|
|
5
|
+
/** Scrollable main content area of a {@link Drawer}. */
|
|
3
6
|
export declare const DrawerBody: import("styled-components").StyledComponent<"div", any, {}, never>;
|