@pushwoosh/dumb-components 1.1.148 → 1.1.149
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 +11 -0
- package/Drawer/components/Drawer/types.d.ts +9 -0
- 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
|
@@ -2,6 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import accessForbiddenImage from './assets/AccessForbidden.svg?url';
|
|
3
3
|
import { Lang, useLang } from './polyglot';
|
|
4
4
|
import { RootBox, ImageBox, TitleBox, DescriptionBox } from './styles';
|
|
5
|
+
/**
|
|
6
|
+
* Full-page "access forbidden" state with an illustration and localized title/description.
|
|
7
|
+
*/
|
|
5
8
|
export function AccessForbidden() {
|
|
6
9
|
const lang = useLang();
|
|
7
10
|
return _jsxs(RootBox, {
|
package/Alert/Alert.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { AlertProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Inline message banner with info/warning/error styling; collapses into an
|
|
4
|
+
* accordion when given `children`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <Alert type="warning" title="Heads up">Details about the warning.</Alert>
|
|
8
|
+
*/
|
|
2
9
|
export declare const Alert: ({ isExpandedDefault, title, type, children }: AlertProps) => import("react/jsx-runtime").JSX.Element;
|
package/Alert/Alert.js
CHANGED
|
@@ -5,6 +5,13 @@ import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
|
5
5
|
import { ChevronIcon } from '@pushwoosh/kit-icons';
|
|
6
6
|
import { AlertTypeMap } from './maps';
|
|
7
7
|
import { AccordionHeader, Container } from './styles';
|
|
8
|
+
/**
|
|
9
|
+
* Inline message banner with info/warning/error styling; collapses into an
|
|
10
|
+
* accordion when given `children`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <Alert type="warning" title="Heads up">Details about the warning.</Alert>
|
|
14
|
+
*/
|
|
8
15
|
export const Alert = ({
|
|
9
16
|
isExpandedDefault,
|
|
10
17
|
title,
|
package/Alert/types.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/** Severity of an {@link Alert}, driving its icon and colors. */
|
|
2
3
|
export type AlertType = 'info' | 'warning' | 'error';
|
|
4
|
+
/** Props of {@link Alert}. */
|
|
3
5
|
export type AlertProps = {
|
|
6
|
+
/** Always-visible header content. */
|
|
4
7
|
title: ReactNode;
|
|
8
|
+
/** Severity — sets the icon and background color. */
|
|
5
9
|
type: AlertType;
|
|
10
|
+
/** Start expanded (only relevant when `children` are provided). */
|
|
6
11
|
isExpandedDefault?: boolean;
|
|
12
|
+
/** Collapsible body; when present the alert becomes an accordion. */
|
|
7
13
|
readonly children?: ReactNode;
|
|
8
14
|
};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
/** Props of {@link ApplicationPreloader}. */
|
|
1
2
|
export type ApplicationPreloaderProps = {
|
|
3
|
+
/** Fill the viewport (default `true`); when `false` fills the parent. */
|
|
2
4
|
fullscreen?: boolean;
|
|
3
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Branded loading animation shown while the app boots; fullscreen by default.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <ApplicationPreloader />
|
|
11
|
+
*/
|
|
4
12
|
export declare function ApplicationPreloader({ fullscreen }: ApplicationPreloaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ApplicationPreloaderBox, ApplicationPreloaderAnimation } from './styles';
|
|
3
|
+
/**
|
|
4
|
+
* Branded loading animation shown while the app boots; fullscreen by default.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <ApplicationPreloader />
|
|
8
|
+
*/
|
|
3
9
|
export function ApplicationPreloader({
|
|
4
10
|
fullscreen = true
|
|
5
11
|
}) {
|
package/Badge/Badge.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { BadgeProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Small colored label for statuses and counts.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <Badge color="green">Active</Badge>
|
|
8
|
+
*/
|
|
3
9
|
export declare function Badge(props: BadgeProps): ReactElement;
|
package/Badge/Badge.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { BadgeBox } from './styles';
|
|
3
|
+
/**
|
|
4
|
+
* Small colored label for statuses and counts.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <Badge color="green">Active</Badge>
|
|
8
|
+
*/
|
|
3
9
|
export function Badge(props) {
|
|
4
10
|
const {
|
|
5
11
|
boxRef,
|
package/Badge/types.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { Ref, ReactNode } from 'react';
|
|
2
|
+
/** Color of a {@link Badge}. */
|
|
2
3
|
export type BadgeColor = 'gray' | 'green' | 'orange' | 'red' | 'purple' | 'sky' | 'locked' | 'black';
|
|
4
|
+
/** Props of {@link Badge} — all `<div>` attributes plus the badge-specific ones. */
|
|
3
5
|
export type BadgeProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & {
|
|
6
|
+
/** Ref to the badge `<div>`. */
|
|
4
7
|
readonly boxRef?: Ref<HTMLDivElement>;
|
|
8
|
+
/** Badge color. */
|
|
5
9
|
readonly color: BadgeColor;
|
|
10
|
+
/** Use the saturated (solid) variant instead of the tinted one. */
|
|
6
11
|
readonly isSaturated?: boolean;
|
|
12
|
+
/** Badge content. */
|
|
7
13
|
readonly children: ReactNode;
|
|
8
14
|
};
|
package/Banner/Banner.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { BannerPropsWithButton, RequiredBannerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Prominent page-level message with severity styling, an optional action button,
|
|
5
|
+
* a loading state and a dismiss button. Hides itself once closed.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Banner type="success" title="Saved" canBeClosed action={{ buttonText: 'Undo', onClick: undo }} />
|
|
9
|
+
*/
|
|
3
10
|
export declare function Banner(props: RequiredBannerProps | BannerPropsWithButton): ReactElement | null;
|
package/Banner/Banner.js
CHANGED
|
@@ -6,6 +6,13 @@ import { H4 } from '@pushwoosh/kit-typography';
|
|
|
6
6
|
import { Spinner } from '../Spinner';
|
|
7
7
|
import { BannerPropsToBannerBoxMap, BannerPropsToIconContainerMap, BannerTypeToSpinnerColorMap } from './maps';
|
|
8
8
|
import { ActionButton, BannerContent, BannerSpinner, CloseButton, IconContainer } from './styles';
|
|
9
|
+
/**
|
|
10
|
+
* Prominent page-level message with severity styling, an optional action button,
|
|
11
|
+
* a loading state and a dismiss button. Hides itself once closed.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Banner type="success" title="Saved" canBeClosed action={{ buttonText: 'Undo', onClick: undo }} />
|
|
15
|
+
*/
|
|
9
16
|
export function Banner(props) {
|
|
10
17
|
const [isOpen, setIsOpen] = useState(true);
|
|
11
18
|
const [isActionPressed, setIsActionPressed] = useState(false);
|
package/Banner/types.d.ts
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/** Severity of a {@link Banner}, driving its icon and colors. */
|
|
2
3
|
export type BannerType = 'error' | 'warning' | 'info' | 'success';
|
|
4
|
+
/** Base props of {@link Banner}. */
|
|
3
5
|
export type RequiredBannerProps = {
|
|
6
|
+
/** Ref to the banner root element. */
|
|
4
7
|
readonly boxRef?: any;
|
|
8
|
+
/** Severity — sets the default icon and colors. */
|
|
5
9
|
readonly type: BannerType;
|
|
10
|
+
/** Banner heading. */
|
|
6
11
|
readonly title: string;
|
|
12
|
+
/** Surface style: `shape` (filled, default) or `ghost`. */
|
|
7
13
|
readonly view?: 'shape' | 'ghost';
|
|
14
|
+
/** Custom icon; falls back to the type's default icon. */
|
|
8
15
|
readonly icon?: ReactElement;
|
|
16
|
+
/** Extra CSS class on the banner root. */
|
|
9
17
|
readonly className?: string;
|
|
18
|
+
/** Show the loading state on the action button. */
|
|
10
19
|
readonly isLoading?: boolean;
|
|
20
|
+
/** Show a close (✕) button. */
|
|
11
21
|
readonly canBeClosed?: boolean;
|
|
22
|
+
/** Fires when the close button is clicked. */
|
|
12
23
|
readonly onClose?: () => void;
|
|
24
|
+
/** Body content under the title. */
|
|
13
25
|
readonly children?: ReactNode;
|
|
14
26
|
};
|
|
27
|
+
/** {@link Banner} props with an optional action button. */
|
|
15
28
|
export type BannerPropsWithButton = RequiredBannerProps & {
|
|
29
|
+
/** Action button shown on the right. */
|
|
16
30
|
readonly action?: {
|
|
31
|
+
/** Fires when the action button is clicked. */
|
|
17
32
|
readonly onClick: () => void;
|
|
33
|
+
/** Action button caption. */
|
|
18
34
|
readonly buttonText: string;
|
|
19
35
|
};
|
|
20
36
|
};
|
package/Button/Button.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { ButtonPropsWithoutAs, ButtonPropsWithAsTag, ButtonPropsWithAsComponent } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Primary action button with color/size/view variants, icons and a loading state.
|
|
5
|
+
* Renders a native `<button>`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Button color="primary" isLoading={saving} onClick={save}>Save</Button>
|
|
9
|
+
*/
|
|
3
10
|
export declare function Button(props: ButtonPropsWithoutAs): ReactElement | null;
|
|
11
|
+
/**
|
|
12
|
+
* Button rendered as another intrinsic tag via `as` (keeping the button styling).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <Button as="a" href="/docs" color="secondary">Docs</Button>
|
|
16
|
+
*/
|
|
4
17
|
export declare function Button<AS extends keyof HTMLElementTagNameMap>(props: ButtonPropsWithAsTag<AS>): ReactElement | null;
|
|
18
|
+
/**
|
|
19
|
+
* Button rendered as a custom component via `as` (e.g. a router link).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <Button as={RouterLink} to="/home" color="primary">Home</Button>
|
|
23
|
+
*/
|
|
5
24
|
export declare function Button<OuterProps extends object>(props: ButtonPropsWithAsComponent<OuterProps>): ReactElement | null;
|
package/Button/GhostButton.d.ts
CHANGED
package/Button/GhostButton.js
CHANGED
package/Button/RemoveButton.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { type JSX, type ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Small round button with a close (✕) icon, for removing/dismissing an item.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <RemoveButton aria-label="Remove" onClick={remove} />
|
|
7
|
+
*/
|
|
2
8
|
export declare function RemoveButton(props: Omit<JSX.IntrinsicElements['button'], 'ref' | 'children'>): ReactElement;
|
package/Button/RemoveButton.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { CloseIcon } from '@pushwoosh/kit-icons';
|
|
3
3
|
import { RemoveButtonBox } from './styles';
|
|
4
|
+
/**
|
|
5
|
+
* Small round button with a close (✕) icon, for removing/dismissing an item.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <RemoveButton aria-label="Remove" onClick={remove} />
|
|
9
|
+
*/
|
|
4
10
|
export function RemoveButton(props) {
|
|
5
11
|
return _jsx(RemoveButtonBox, {
|
|
6
12
|
...props,
|
package/Button/types.d.ts
CHANGED
|
@@ -1,26 +1,47 @@
|
|
|
1
1
|
import type { JSX, ReactNode, Ref, ComponentType } from 'react';
|
|
2
|
+
/** Props shared by every {@link Button} variant, regardless of the rendered element. */
|
|
2
3
|
export type RequiredButtonProps = {
|
|
4
|
+
/** Ref forwarded to the underlying element; prefer the typed `boxRef` on the variant props. */
|
|
3
5
|
readonly boxRef?: any;
|
|
6
|
+
/** Visual intent: `primary` (main action), `secondary` (neutral), `danger` (destructive). */
|
|
4
7
|
readonly color: 'primary' | 'secondary' | 'danger';
|
|
8
|
+
/** Height preset: `field` (default, form-line height) or `compact` (denser). */
|
|
5
9
|
readonly size?: 'field' | 'compact';
|
|
10
|
+
/** Surface style: `shape` (filled, default) or `ghost` (transparent). */
|
|
6
11
|
readonly view?: 'shape' | 'ghost';
|
|
12
|
+
/** Extra CSS class applied to the button element. */
|
|
7
13
|
readonly className?: string;
|
|
14
|
+
/** Disable interaction and render the disabled state. */
|
|
8
15
|
readonly isDisabled?: boolean;
|
|
16
|
+
/** Show a spinner (in place of the left icon, or overlaid on the label). */
|
|
9
17
|
readonly isLoading?: boolean;
|
|
18
|
+
/** Mark the button as expanded/active, e.g. when it toggles a dropdown. */
|
|
10
19
|
readonly isOpen?: boolean;
|
|
20
|
+
/** Icon rendered before the label. */
|
|
11
21
|
readonly icon?: ReactNode;
|
|
22
|
+
/** Icon rendered after the label. */
|
|
12
23
|
readonly rightIcon?: ReactNode;
|
|
24
|
+
/** Button label. */
|
|
13
25
|
readonly children?: ReactNode;
|
|
14
26
|
};
|
|
27
|
+
/** Default {@link Button} props — renders a native `<button>`. */
|
|
15
28
|
export type ButtonPropsWithoutAs = Omit<JSX.IntrinsicElements['button'], 'ref'> & RequiredButtonProps & {
|
|
29
|
+
/** Ref to the underlying `<button>` element. */
|
|
16
30
|
readonly boxRef?: Ref<HTMLButtonElement>;
|
|
31
|
+
/** Native button type. */
|
|
17
32
|
readonly type?: 'button' | 'submit';
|
|
18
33
|
};
|
|
34
|
+
/** {@link Button} props when rendering as another intrinsic HTML tag via `as` (e.g. `as="a"`). */
|
|
19
35
|
export type ButtonPropsWithAsTag<AS extends keyof HTMLElementTagNameMap> = Omit<JSX.IntrinsicElements[AS], 'ref'> & RequiredButtonProps & {
|
|
36
|
+
/** Ref to the element produced by `as`. */
|
|
20
37
|
readonly boxRef?: Ref<HTMLElementTagNameMap[AS]>;
|
|
38
|
+
/** Intrinsic tag name to render instead of `<button>`. */
|
|
21
39
|
readonly as?: AS;
|
|
22
40
|
};
|
|
41
|
+
/** {@link Button} props when rendering as a custom component via `as` (e.g. a router `Link`). */
|
|
23
42
|
export type ButtonPropsWithAsComponent<OuterProps extends object> = OuterProps & RequiredButtonProps & {
|
|
43
|
+
/** Ref to the rendered component's root element. */
|
|
24
44
|
readonly boxRef?: Ref<HTMLElement>;
|
|
45
|
+
/** Custom component to render instead of `<button>`; receives `OuterProps`. */
|
|
25
46
|
readonly as?: ComponentType<OuterProps>;
|
|
26
47
|
};
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
2
|
import { type CalendarDropdownProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Button that opens a {@link CalendarSuperForm} in a popover, formats the selection on
|
|
5
|
+
* the button, supports range presets and commits via `onSubmit`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <CalendarDropdown
|
|
9
|
+
* mode="range-date"
|
|
10
|
+
* calendarProps={{}}
|
|
11
|
+
* value={range}
|
|
12
|
+
* onSubmit={(value, tz) => save(value, tz)}
|
|
13
|
+
* />
|
|
14
|
+
*/
|
|
3
15
|
export declare const CalendarDropdown: FC<CalendarDropdownProps>;
|
|
@@ -12,6 +12,18 @@ import { Chip } from '../../Chip';
|
|
|
12
12
|
import { useLayer, useOnClickOutside } from '../../hooks';
|
|
13
13
|
import { CalendarSuperForm } from '../CalendarSuperForm';
|
|
14
14
|
import { Lang, useLang } from '../polyglot';
|
|
15
|
+
/**
|
|
16
|
+
* Button that opens a {@link CalendarSuperForm} in a popover, formats the selection on
|
|
17
|
+
* the button, supports range presets and commits via `onSubmit`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <CalendarDropdown
|
|
21
|
+
* mode="range-date"
|
|
22
|
+
* calendarProps={{}}
|
|
23
|
+
* value={range}
|
|
24
|
+
* onSubmit={(value, tz) => save(value, tz)}
|
|
25
|
+
* />
|
|
26
|
+
*/
|
|
15
27
|
export const CalendarDropdown = props => {
|
|
16
28
|
const {
|
|
17
29
|
mode,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { type DateStruct, type DateTimeStruct, type RangeValue, type SingleValue } from '../types';
|
|
2
2
|
export declare function formatDate(val: DateStruct | DateTimeStruct, withTime?: boolean): string;
|
|
3
|
+
/**
|
|
4
|
+
* Formats a single value or range for display in the {@link CalendarDropdown} button:
|
|
5
|
+
* `"Jan 01, 2026"`, `"Jan 01, 2026 – Jan 05, 2026"`, with time and a short timezone when `withTime`.
|
|
6
|
+
*/
|
|
3
7
|
export declare const stringifyValue: (value: SingleValue<DateStruct | DateTimeStruct> | RangeValue<DateStruct | DateTimeStruct>, withTime: boolean, timezone?: string) => string;
|
|
@@ -17,6 +17,10 @@ export function formatDate(val, withTime = true) {
|
|
|
17
17
|
year: 'numeric'
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Formats a single value or range for display in the {@link CalendarDropdown} button:
|
|
22
|
+
* `"Jan 01, 2026"`, `"Jan 01, 2026 – Jan 05, 2026"`, with time and a short timezone when `withTime`.
|
|
23
|
+
*/
|
|
20
24
|
export const stringifyValue = (value, withTime, timezone) => {
|
|
21
25
|
let result = '';
|
|
22
26
|
if (Array.isArray(value)) {
|
|
@@ -2,48 +2,81 @@ import { type ReactNode } from 'react';
|
|
|
2
2
|
import { type RequiredButtonProps } from '../../Button';
|
|
3
3
|
import type { CalendarRangeDateProps, CalendarRangeDateTimeProps, CalendarSingleDateProps, CalendarSingleDateTimeProps } from '../CalendarSuperForm/types';
|
|
4
4
|
import type { DateStruct, DateTimeStruct, RangeValue, TzValue } from '../types';
|
|
5
|
+
/** Props shared by every {@link CalendarDropdown} mode (the trigger button + commit behaviour). */
|
|
5
6
|
interface BaseProps {
|
|
7
|
+
/** Trigger button size. */
|
|
6
8
|
buttonSize?: RequiredButtonProps['size'];
|
|
9
|
+
/** Trigger button color (default `secondary`). */
|
|
7
10
|
buttonColor?: RequiredButtonProps['color'];
|
|
11
|
+
/** Trigger button view. */
|
|
8
12
|
buttonView?: RequiredButtonProps['view'];
|
|
13
|
+
/** Override the button label instead of the formatted value. */
|
|
9
14
|
buttonTextCustom?: string;
|
|
15
|
+
/** Allow submitting with no value selected. */
|
|
10
16
|
allowEmpty?: boolean;
|
|
11
17
|
}
|
|
18
|
+
/** {@link CalendarDropdown} props for picking a single date. */
|
|
12
19
|
export interface CalendarDropdownSingleDateProps extends BaseProps {
|
|
20
|
+
/** Single date-only mode. */
|
|
13
21
|
mode: 'single-date';
|
|
22
|
+
/** Props forwarded to the inner {@link CalendarSuperForm} (minus mode/value/onChange). */
|
|
14
23
|
calendarProps: Omit<CalendarSingleDateProps, 'mode' | 'value' | 'onChange'>;
|
|
24
|
+
/** Currently selected date. */
|
|
15
25
|
value?: DateStruct;
|
|
26
|
+
/** Fires on every in-popover change (before commit). */
|
|
16
27
|
onChange?: (value: DateStruct) => void;
|
|
28
|
+
/** Fires with the committed date and timezone when the user applies the selection. */
|
|
17
29
|
onSubmit: (value: DateStruct, tz: TzValue) => void;
|
|
18
30
|
}
|
|
31
|
+
/** {@link CalendarDropdown} props for picking a single date and time. */
|
|
19
32
|
export interface CalendarDropdownSingleDateTimeProps extends BaseProps {
|
|
33
|
+
/** Single date-time mode. */
|
|
20
34
|
mode: 'single-datetime';
|
|
35
|
+
/** Props forwarded to the inner {@link CalendarSuperForm} (minus mode/value/onChange). */
|
|
21
36
|
calendarProps: Omit<CalendarSingleDateTimeProps, 'mode' | 'value' | 'onChange'>;
|
|
37
|
+
/** Currently selected date-time. */
|
|
22
38
|
value?: DateTimeStruct;
|
|
39
|
+
/** Fires on every in-popover change (before commit). */
|
|
23
40
|
onChange?: (value: DateTimeStruct) => void;
|
|
41
|
+
/** Fires with the committed date-time and timezone when applied. */
|
|
24
42
|
onSubmit: (value: DateTimeStruct, tz: TzValue) => void;
|
|
25
43
|
}
|
|
44
|
+
/** {@link CalendarDropdown} props for picking a date range, with optional presets. */
|
|
26
45
|
export interface CalendarDropdownRangeDateProps extends BaseProps {
|
|
46
|
+
/** Date range mode. */
|
|
27
47
|
mode: 'range-date';
|
|
48
|
+
/** Props forwarded to the inner {@link CalendarSuperForm} (minus mode/value/onChange). */
|
|
28
49
|
calendarProps: Omit<CalendarRangeDateProps, 'mode' | 'value' | 'onChange'>;
|
|
50
|
+
/** Currently selected range. */
|
|
29
51
|
value?: RangeValue<DateStruct>;
|
|
52
|
+
/** Fires on every in-popover change (before commit). */
|
|
30
53
|
onChange?: (value: RangeValue<DateStruct>) => void;
|
|
54
|
+
/** Fires with the committed range and timezone when applied. */
|
|
31
55
|
onSubmit: (value: RangeValue<DateStruct>, tz: TzValue) => void;
|
|
56
|
+
/** Quick-pick presets shown beside the calendar. */
|
|
32
57
|
presets?: Array<{
|
|
33
58
|
label: ReactNode | string;
|
|
34
59
|
value: [DateStruct, DateStruct];
|
|
35
60
|
}>;
|
|
36
61
|
}
|
|
62
|
+
/** {@link CalendarDropdown} props for picking a date-time range, with optional presets. */
|
|
37
63
|
export interface CalendarDropdownRangeDateTimeProps extends BaseProps {
|
|
64
|
+
/** Date-time range mode. */
|
|
38
65
|
mode: 'range-datetime';
|
|
66
|
+
/** Props forwarded to the inner {@link CalendarSuperForm} (minus mode/value/onChange). */
|
|
39
67
|
calendarProps: Omit<CalendarRangeDateTimeProps, 'mode' | 'value' | 'onChange'>;
|
|
68
|
+
/** Currently selected range. */
|
|
40
69
|
value?: RangeValue<DateTimeStruct>;
|
|
70
|
+
/** Fires on every in-popover change (before commit). */
|
|
41
71
|
onChange?: (value: RangeValue<DateTimeStruct>) => void;
|
|
72
|
+
/** Fires with the committed range and timezone when applied. */
|
|
42
73
|
onSubmit: (value: RangeValue<DateTimeStruct>, tz: TzValue) => void;
|
|
74
|
+
/** Quick-pick presets shown beside the calendar. */
|
|
43
75
|
presets?: Array<{
|
|
44
76
|
label: ReactNode | string;
|
|
45
77
|
value: [DateTimeStruct, DateTimeStruct];
|
|
46
78
|
}>;
|
|
47
79
|
}
|
|
80
|
+
/** Props of {@link CalendarDropdown} — a discriminated union keyed by `mode`. */
|
|
48
81
|
export type CalendarDropdownProps = CalendarDropdownSingleDateProps | CalendarDropdownSingleDateTimeProps | CalendarDropdownRangeDateProps | CalendarDropdownRangeDateTimeProps;
|
|
49
82
|
export {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
2
|
import { type CalendarSuperFormProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Inline calendar form supporting single/range and date/date-time selection via `mode`,
|
|
5
|
+
* with optional timezone, day-count limits and a custom footer.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <CalendarSuperForm mode="range-date" value={range} onChange={setRange} />
|
|
9
|
+
*/
|
|
3
10
|
export declare const CalendarSuperForm: FC<CalendarSuperFormProps>;
|
|
@@ -4,6 +4,13 @@ import { Vertical } from '@pushwoosh/kit-helpers';
|
|
|
4
4
|
import { Text } from '@pushwoosh/kit-typography';
|
|
5
5
|
import { CalendarRangePicker } from './components/CalendarRangePicker/CalendarRangePicker';
|
|
6
6
|
import { CalendarTimeAndTimezoneSection } from './components/CalendarTimeAndTimezoneSection/CalendarTimeAndTimezoneSection';
|
|
7
|
+
/**
|
|
8
|
+
* Inline calendar form supporting single/range and date/date-time selection via `mode`,
|
|
9
|
+
* with optional timezone, day-count limits and a custom footer.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <CalendarSuperForm mode="range-date" value={range} onChange={setRange} />
|
|
13
|
+
*/
|
|
7
14
|
export const CalendarSuperForm = props => {
|
|
8
15
|
const {
|
|
9
16
|
mode,
|
|
@@ -1,61 +1,87 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type DateStruct, type DateTimeStruct, type RangeValue, type SingleValue, type TzValue } from '../types';
|
|
3
|
+
/** Props shared by every {@link CalendarSuperForm} mode. */
|
|
3
4
|
interface BaseProps {
|
|
4
|
-
/**
|
|
5
|
+
/** Number of months shown side by side. */
|
|
5
6
|
visibleCount?: number;
|
|
6
|
-
/**
|
|
7
|
+
/** Width of a single month grid, in pixels. */
|
|
7
8
|
monthWidth?: number;
|
|
8
|
-
/**
|
|
9
|
+
/** Gap between months, in pixels. */
|
|
9
10
|
gap?: number;
|
|
10
|
-
/**
|
|
11
|
+
/** Disable all dates on and before this date (inclusive). */
|
|
11
12
|
disableOnAndBefore?: DateStruct;
|
|
12
|
-
/**
|
|
13
|
+
/** Disable all dates on and after this date (inclusive). */
|
|
13
14
|
disableOnAndAfter?: DateStruct;
|
|
14
|
-
/**
|
|
15
|
+
/** First day of the week: `0` = Sunday, `1` = Monday (default `0`). */
|
|
15
16
|
firstDayOfWeek?: 0 | 1;
|
|
16
|
-
/**
|
|
17
|
+
/** Month the calendar opens on; defaults to the range start (`value[0]`) or the current month. */
|
|
17
18
|
initialVisibleMonth?: DateStruct;
|
|
18
|
-
/**
|
|
19
|
+
/** Custom footer node rendered below the calendar and the min/max-days notice. */
|
|
19
20
|
footerContent?: ReactNode;
|
|
20
21
|
}
|
|
22
|
+
/** Selection mode of {@link CalendarSuperForm}: single vs range, date-only vs date-time. */
|
|
21
23
|
export type CalendarMode = 'single-date' | 'single-datetime' | 'range-date' | 'range-datetime';
|
|
24
|
+
/** {@link CalendarSuperForm} props for picking a single date (no time, no timezone). */
|
|
22
25
|
export interface CalendarSingleDateProps extends BaseProps {
|
|
26
|
+
/** Single date-only mode. */
|
|
23
27
|
mode: 'single-date';
|
|
24
|
-
/**
|
|
28
|
+
/** Not used and disallowed in this mode. */
|
|
25
29
|
timezone?: never;
|
|
26
30
|
onChangeTimezone?: never;
|
|
27
31
|
minDays?: never;
|
|
28
32
|
maxDays?: never;
|
|
33
|
+
/** Currently selected date. */
|
|
29
34
|
value?: SingleValue<DateStruct>;
|
|
35
|
+
/** Fires with the newly selected date. */
|
|
30
36
|
onChange: (value: SingleValue<DateStruct>) => void;
|
|
31
37
|
}
|
|
38
|
+
/** {@link CalendarSuperForm} props for picking a single date and time in a timezone. */
|
|
32
39
|
export interface CalendarSingleDateTimeProps extends BaseProps {
|
|
40
|
+
/** Single date-time mode. */
|
|
33
41
|
mode: 'single-datetime';
|
|
34
|
-
/**
|
|
42
|
+
/** Required IANA timezone name (e.g. `'America/New_York'`). */
|
|
35
43
|
timezone: TzValue;
|
|
44
|
+
/** Fires when the timezone changes. */
|
|
36
45
|
onChangeTimezone: (timezone: TzValue) => void;
|
|
37
46
|
minDays?: never;
|
|
38
47
|
maxDays?: never;
|
|
48
|
+
/** Currently selected date-time. */
|
|
39
49
|
value?: SingleValue<DateTimeStruct>;
|
|
50
|
+
/** Fires with the newly selected date-time. */
|
|
40
51
|
onChange: (payload: SingleValue<DateTimeStruct>) => void;
|
|
41
52
|
}
|
|
53
|
+
/** {@link CalendarSuperForm} props for picking a date range (no time, no timezone). */
|
|
42
54
|
export interface CalendarRangeDateProps extends BaseProps {
|
|
55
|
+
/** Date range mode. */
|
|
43
56
|
mode: 'range-date';
|
|
44
57
|
timezone?: never;
|
|
45
58
|
onChangeTimezone?: never;
|
|
59
|
+
/** Minimum allowed range length, in days. */
|
|
46
60
|
minDays?: number;
|
|
61
|
+
/** Maximum allowed range length, in days. */
|
|
47
62
|
maxDays?: number;
|
|
63
|
+
/** Currently selected range. */
|
|
48
64
|
value: RangeValue<DateStruct>;
|
|
65
|
+
/** Fires with the newly selected range. */
|
|
49
66
|
onChange: (value: RangeValue<DateStruct>) => void;
|
|
50
67
|
}
|
|
68
|
+
/** {@link CalendarSuperForm} props for picking a date-time range in a timezone. */
|
|
51
69
|
export interface CalendarRangeDateTimeProps extends BaseProps {
|
|
70
|
+
/** Date-time range mode. */
|
|
52
71
|
mode: 'range-datetime';
|
|
72
|
+
/** Required IANA timezone name. */
|
|
53
73
|
timezone: TzValue;
|
|
74
|
+
/** Fires when the timezone changes. */
|
|
54
75
|
onChangeTimezone: (timezone: TzValue) => void;
|
|
76
|
+
/** Minimum allowed range length, in days. */
|
|
55
77
|
minDays?: number;
|
|
78
|
+
/** Maximum allowed range length, in days. */
|
|
56
79
|
maxDays?: number;
|
|
80
|
+
/** Currently selected range. */
|
|
57
81
|
value: RangeValue<DateTimeStruct>;
|
|
82
|
+
/** Fires with the newly selected range. */
|
|
58
83
|
onChange: (payload: RangeValue<DateTimeStruct>) => void;
|
|
59
84
|
}
|
|
85
|
+
/** Props of {@link CalendarSuperForm} — a discriminated union keyed by `mode`. */
|
|
60
86
|
export type CalendarSuperFormProps = CalendarSingleDateProps | CalendarSingleDateTimeProps | CalendarRangeDateProps | CalendarRangeDateTimeProps;
|
|
61
87
|
export {};
|
package/Calendar/helpers.d.ts
CHANGED
|
@@ -6,20 +6,30 @@ export declare const createUTCDate: (year: number, month?: number, day?: number,
|
|
|
6
6
|
export declare const parseStringToDate: (date: string) => Date;
|
|
7
7
|
export declare const formatTwoDigitNumber: (value: number) => string;
|
|
8
8
|
export declare const formatStruct: (ds: DateStruct, template: string) => string;
|
|
9
|
+
/** Returns a new struct with `value` units of `period` added (negative to subtract); rolls over correctly. */
|
|
9
10
|
export declare const addPeriod: <T extends DateTimeStruct | DateStruct>(ds: T, period: Period, value: number) => T;
|
|
11
|
+
/** Narrows a {@link DateTimeStruct} to a date-only {@link DateStruct} (drops the time fields). */
|
|
10
12
|
export declare const pickDateStruct: (date: DateTimeStruct) => DateStruct;
|
|
11
13
|
export declare const setPeriodStruct: <T extends DateTimeStruct | DateStruct>(ds: T, period: Period, value: number) => T;
|
|
12
14
|
export declare const extendPeriodStruct: (struct: DateTimeStruct, extend: Partial<DateTimeStruct>) => DateTimeStruct;
|
|
13
15
|
export declare const differenceInDays: (ds1: DateStruct, ds2: DateStruct) => number;
|
|
14
16
|
export declare const monthName: (month: number, monthFormat?: "short" | "long") => string;
|
|
15
17
|
export declare const isSamePeriod: <T extends DateTimeStruct | DateStruct>(ds1: T, ds2: T, period: Period) => boolean;
|
|
18
|
+
/** Compares two structs chronologically: `-1` if `ds1 < ds2`, `0` if equal, `1` if `ds1 > ds2`. */
|
|
16
19
|
export declare const compareStructs: <T extends DateTimeStruct | DateStruct>(ds1: T, ds2: T) => 1 | 0 | -1;
|
|
17
20
|
export declare const getFirstDayOfWeek: (date: DateStruct, firstDayOfWeek?: number) => DateStruct;
|
|
18
21
|
export declare const getLastDayOfMonth: (date: DateStruct) => DateStruct;
|
|
22
|
+
/** Returns the start of the given `period` containing `date` (e.g. first instant of the month). */
|
|
19
23
|
export declare const getPeriodStart: (date: DateTimeStruct | DateStruct, period: Period) => DateTimeStruct;
|
|
24
|
+
/** Returns the last instant of the given `period` containing `date` (e.g. 23:59:59.999 of the day). */
|
|
20
25
|
export declare const getPeriodEnd: (date: DateTimeStruct | DateStruct, period: Period) => DateTimeStruct;
|
|
26
|
+
/** Converts a `Date` to a {@link DateTimeStruct} shifted by `tzOffsetMinutes` (minutes east of UTC). */
|
|
21
27
|
export declare const dateToStruct: (date: Date, tzOffsetMinutes: number) => DateTimeStruct;
|
|
28
|
+
/** Converts a struct back to a `Date`, interpreting it as a wall-clock time `tzOffsetMinutes` east of UTC. */
|
|
22
29
|
export declare const structToDate: (ds: DateTimeStruct | DateStruct, tzOffsetMinutes: number) => Date;
|
|
30
|
+
/** Returns the offset in minutes (east of UTC) for an IANA `timezoneName` at the given instant `at`. */
|
|
23
31
|
export declare function getTimezoneOffset(timezoneName: string, at?: Date): number;
|
|
32
|
+
/** Like {@link dateToStruct} but resolves the offset from an IANA `tzName` (handles DST). */
|
|
24
33
|
export declare const dateToStructTz: (date: Date, tzName: string) => DateTimeStruct;
|
|
34
|
+
/** Like {@link structToDate} but resolves the offset from an IANA `tzName` (handles DST). */
|
|
25
35
|
export declare const structToDateTz: (ds: DateTimeStruct | DateStruct, tzName: string) => Date;
|