@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
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { ReactElement, ReactEventHandler } from 'react';
|
|
2
|
+
/** Props of {@link ExternalImagePreview}. */
|
|
2
3
|
export interface ExternalImagePreviewProps {
|
|
4
|
+
/** Image URL to load. */
|
|
3
5
|
src: string;
|
|
6
|
+
/** Alt text (default "External image preview"). */
|
|
4
7
|
alt?: string;
|
|
8
|
+
/** CSS width of the preview box. */
|
|
5
9
|
width: string | number;
|
|
10
|
+
/** CSS height of the preview box. */
|
|
6
11
|
height: string | number;
|
|
12
|
+
/** Node shown while loading or when the image fails to load. */
|
|
7
13
|
placeholder: ReactElement;
|
|
14
|
+
/** Fires when the image fails to load. */
|
|
8
15
|
onError?: (error: ReactEventHandler<HTMLImageElement>) => void;
|
|
9
16
|
}
|
package/FieldBox/FieldBox.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { FieldBoxProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Form-field wrapper: renders a title row (with optional marker, tooltip, link and
|
|
5
|
+
* actions) above its children and a description or error line below.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <FieldBox title="Name" description="Shown publicly" error={errors.name}>
|
|
9
|
+
* <EnhancedInput value={name} onChange={onChange} />
|
|
10
|
+
* </FieldBox>
|
|
11
|
+
*/
|
|
3
12
|
export declare function FieldBox(props: FieldBoxProps): ReactElement;
|
package/FieldBox/FieldBox.js
CHANGED
|
@@ -5,6 +5,15 @@ import { OpenIcon, InfoRoundIcon } from '@pushwoosh/kit-icons';
|
|
|
5
5
|
import { Text } from '@pushwoosh/kit-typography';
|
|
6
6
|
import { Tooltip } from '../Tooltip';
|
|
7
7
|
import { TitleBox, Link } from './styles';
|
|
8
|
+
/**
|
|
9
|
+
* Form-field wrapper: renders a title row (with optional marker, tooltip, link and
|
|
10
|
+
* actions) above its children and a description or error line below.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <FieldBox title="Name" description="Shown publicly" error={errors.name}>
|
|
14
|
+
* <EnhancedInput value={name} onChange={onChange} />
|
|
15
|
+
* </FieldBox>
|
|
16
|
+
*/
|
|
8
17
|
export function FieldBox(props) {
|
|
9
18
|
const {
|
|
10
19
|
title,
|
package/FieldBox/types.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { type PropsWithChildren, type ReactNode, type Ref } from 'react';
|
|
2
|
+
/** Props of {@link FieldBox}. */
|
|
2
3
|
export type FieldBoxProps = PropsWithChildren<{
|
|
4
|
+
/** Field heading. */
|
|
3
5
|
title?: ReactNode;
|
|
6
|
+
/** Helper text under the field (hidden while `error` is set). */
|
|
4
7
|
description?: ReactNode;
|
|
8
|
+
/** Append an "(optional)" marker after the title. */
|
|
5
9
|
isOptional?: boolean;
|
|
10
|
+
/** URL for an external-link icon next to the title. */
|
|
6
11
|
link?: string;
|
|
12
|
+
/** Help text shown via an info tooltip next to the title. */
|
|
7
13
|
tooltip?: string;
|
|
14
|
+
/** Controls rendered on the right of the title row. */
|
|
8
15
|
actions?: ReactNode;
|
|
16
|
+
/** Error text under the field; replaces `description` and switches to the error color. */
|
|
9
17
|
error?: ReactNode;
|
|
18
|
+
/** Ref to the outer wrapper. */
|
|
10
19
|
boxRef?: Ref<HTMLDivElement>;
|
|
20
|
+
/** Ref to the actions container. */
|
|
11
21
|
actionsRef?: Ref<HTMLDivElement>;
|
|
12
22
|
}>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import { type CappingBase, type FrequencyCappingEditProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Editable frequency-capping control: pick global/ignore/custom mode and configure
|
|
5
|
+
* the per-message message/day limits.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <FrequencyCappingEdit capping={capping} globalCapping={global} applicationCode={code} onChange={setCapping} editGlobalClicked={openGlobal} />
|
|
9
|
+
*/
|
|
3
10
|
export declare function FrequencyCappingEdit<T extends CappingBase>({ capping, globalCapping, onChange, applicationCode, editGlobalClicked, isInJourney, isDisabled, }: FrequencyCappingEditProps<T>): ReactElement;
|
|
@@ -14,6 +14,13 @@ import { Select } from '../Select';
|
|
|
14
14
|
import { cappingOptions } from './constants';
|
|
15
15
|
import { useLang } from './polyglot';
|
|
16
16
|
import { Container, LinkWrapper } from './styles';
|
|
17
|
+
/**
|
|
18
|
+
* Editable frequency-capping control: pick global/ignore/custom mode and configure
|
|
19
|
+
* the per-message message/day limits.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <FrequencyCappingEdit capping={capping} globalCapping={global} applicationCode={code} onChange={setCapping} editGlobalClicked={openGlobal} />
|
|
23
|
+
*/
|
|
17
24
|
export function FrequencyCappingEdit({
|
|
18
25
|
capping,
|
|
19
26
|
globalCapping,
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import { type FrequencyCappingInAppsProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Editable in-app frequency-capping control with total, per-period and
|
|
5
|
+
* minimum-interval limits.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <FrequencyCappingInApps capping={capping} globalCapping={global} applicationCode={code} onChange={setCapping} editGlobalClicked={openGlobal} />
|
|
9
|
+
*/
|
|
3
10
|
export declare function FrequencyCappingInApps(props: FrequencyCappingInAppsProps): ReactElement;
|
|
@@ -14,6 +14,13 @@ import { Select } from '../Select';
|
|
|
14
14
|
import { cappingOptions } from './constants';
|
|
15
15
|
import { useLang } from './polyglot';
|
|
16
16
|
import { Container, LinkWrapper } from './styles';
|
|
17
|
+
/**
|
|
18
|
+
* Editable in-app frequency-capping control with total, per-period and
|
|
19
|
+
* minimum-interval limits.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <FrequencyCappingInApps capping={capping} globalCapping={global} applicationCode={code} onChange={setCapping} editGlobalClicked={openGlobal} />
|
|
23
|
+
*/
|
|
17
24
|
export function FrequencyCappingInApps(props) {
|
|
18
25
|
const {
|
|
19
26
|
capping,
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { type CappingBase, type FrequencyCappingReadonlyProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Read-only summary of a frequency-capping config, with a link to edit the global cap.
|
|
4
|
+
*/
|
|
2
5
|
export declare function FrequencyCappingReadonly<T extends CappingBase>({ capping, globalCapping, applicationCode, editGlobalClicked, isInJourney, }: FrequencyCappingReadonlyProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,9 @@ import { getGlobalCappingLinkText } from './helpers/getGlobalCappingLinkText';
|
|
|
7
7
|
import { getReadonlyCappingLabel } from './helpers/getReadonlyCappingHelpers';
|
|
8
8
|
import { useLang } from './polyglot';
|
|
9
9
|
import { CappingTypes } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Read-only summary of a frequency-capping config, with a link to edit the global cap.
|
|
12
|
+
*/
|
|
10
13
|
export function FrequencyCappingReadonly({
|
|
11
14
|
capping,
|
|
12
15
|
globalCapping,
|
|
@@ -1,63 +1,100 @@
|
|
|
1
|
+
/** Frequency-capping mode: follow the global cap, ignore it, or use a custom cap. */
|
|
1
2
|
export declare enum CappingTypes {
|
|
2
3
|
GLOBAL = "global",
|
|
3
4
|
IGNORE = "ignore",
|
|
4
5
|
CUSTOM = "custom"
|
|
5
6
|
}
|
|
7
|
+
/** A capping-mode option for the mode selector. */
|
|
6
8
|
export type CappingOption = {
|
|
9
|
+
/** Human-readable label. */
|
|
7
10
|
label: string;
|
|
11
|
+
/** Corresponding capping mode. */
|
|
8
12
|
value: CappingTypes;
|
|
9
13
|
};
|
|
14
|
+
/** Per-message capping config (exported publicly as `LocalCapping`). */
|
|
10
15
|
export type CappingBase = {
|
|
16
|
+
/** Whether custom capping is enabled. */
|
|
11
17
|
enabled: boolean;
|
|
18
|
+
/** Max number of messages within `days`. */
|
|
12
19
|
messages: number;
|
|
20
|
+
/** Window length in days. */
|
|
13
21
|
days: number;
|
|
22
|
+
/** Ignore the account-wide global cap. */
|
|
14
23
|
ignoreGlobalCapping: boolean;
|
|
15
24
|
};
|
|
25
|
+
/** In-app capping config with total / per-period / minimum-interval limits. */
|
|
16
26
|
export type CappingInAppBase = {
|
|
27
|
+
/** Whether in-app capping is enabled. */
|
|
17
28
|
enabled: boolean;
|
|
29
|
+
/** Ignore the account-wide global cap. */
|
|
18
30
|
ignoreGlobalCapping: boolean;
|
|
31
|
+
/** Lifetime total limit. */
|
|
19
32
|
total?: {
|
|
20
33
|
count: number;
|
|
21
34
|
};
|
|
35
|
+
/** Limit of `count` per `days`. */
|
|
22
36
|
perDays?: {
|
|
23
37
|
count: number;
|
|
24
38
|
days: number;
|
|
25
39
|
};
|
|
40
|
+
/** Minimum gap between shows, in days. */
|
|
26
41
|
leastDays?: {
|
|
27
42
|
count: number;
|
|
28
43
|
};
|
|
29
44
|
};
|
|
45
|
+
/** Props of {@link FrequencyCappingEdit}. */
|
|
30
46
|
export type FrequencyCappingEditProps<T extends CappingBase> = {
|
|
47
|
+
/** Current capping config. */
|
|
31
48
|
capping: T;
|
|
49
|
+
/** The account-wide global cap, for reference/comparison. */
|
|
32
50
|
globalCapping: {
|
|
33
51
|
count: number;
|
|
34
52
|
days: number;
|
|
35
53
|
};
|
|
54
|
+
/** Fires with the updated capping config. */
|
|
36
55
|
onChange: (newCappingState: T) => void;
|
|
56
|
+
/** Fires when the "edit global capping" link is clicked. */
|
|
37
57
|
editGlobalClicked: () => void;
|
|
58
|
+
/** Application code the capping applies to. */
|
|
38
59
|
applicationCode: string;
|
|
60
|
+
/** Adjust copy/behavior for the Customer Journey context. */
|
|
39
61
|
isInJourney?: boolean;
|
|
62
|
+
/** Disable editing. */
|
|
40
63
|
isDisabled?: boolean;
|
|
41
64
|
};
|
|
65
|
+
/** Props of {@link FrequencyCappingReadonly}. */
|
|
42
66
|
export type FrequencyCappingReadonlyProps<T extends CappingBase> = {
|
|
67
|
+
/** Capping config to summarize. */
|
|
43
68
|
capping: T;
|
|
69
|
+
/** The account-wide global cap, for reference. */
|
|
44
70
|
globalCapping: {
|
|
45
71
|
count: number;
|
|
46
72
|
days: number;
|
|
47
73
|
};
|
|
74
|
+
/** Application code the capping applies to. */
|
|
48
75
|
applicationCode: string;
|
|
76
|
+
/** Fires when the "edit global capping" link is clicked. */
|
|
49
77
|
editGlobalClicked: () => void;
|
|
78
|
+
/** Adjust copy for the Customer Journey context. */
|
|
50
79
|
isInJourney?: boolean;
|
|
51
80
|
};
|
|
81
|
+
/** Props of {@link FrequencyCappingInApps}. */
|
|
52
82
|
export type FrequencyCappingInAppsProps = {
|
|
83
|
+
/** Current in-app capping config. */
|
|
53
84
|
capping: CappingInAppBase;
|
|
85
|
+
/** The account-wide global cap, for reference. */
|
|
54
86
|
globalCapping: {
|
|
55
87
|
count: number;
|
|
56
88
|
days: number;
|
|
57
89
|
};
|
|
90
|
+
/** Fires with the updated in-app capping config. */
|
|
58
91
|
onChange: (newCappingState: CappingInAppBase) => void;
|
|
92
|
+
/** Fires when the "edit global capping" link is clicked. */
|
|
59
93
|
editGlobalClicked: () => void;
|
|
94
|
+
/** Application code the capping applies to. */
|
|
60
95
|
applicationCode: string;
|
|
96
|
+
/** Adjust copy/behavior for the Customer Journey context. */
|
|
61
97
|
isInJourney?: boolean;
|
|
98
|
+
/** Disable editing. */
|
|
62
99
|
isDisabled?: boolean;
|
|
63
100
|
};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { GetStartedPageProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Onboarding/empty-state page with a title, description, illustration, optional
|
|
5
|
+
* checklist, help banner and action controls.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <GetStartedPage title="Welcome" description="Set up your first app" image={img} actions={<Button color="primary">Start</Button>} />
|
|
9
|
+
*/
|
|
3
10
|
export declare function GetStartedPage(props: GetStartedPageProps): ReactElement;
|
|
@@ -5,6 +5,13 @@ import { CheckRoundIcon, LockIcon } from '@pushwoosh/kit-icons';
|
|
|
5
5
|
import { H1, Paragraph } from '@pushwoosh/kit-typography';
|
|
6
6
|
import { Banner } from '../Banner';
|
|
7
7
|
import { GradientBackground, Wrapper, ContentBox, UnorderedList, UnorderedListItem, UnorderedListIcon, UnorderedListText, Image } from './styles';
|
|
8
|
+
/**
|
|
9
|
+
* Onboarding/empty-state page with a title, description, illustration, optional
|
|
10
|
+
* checklist, help banner and action controls.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <GetStartedPage title="Welcome" description="Set up your first app" image={img} actions={<Button color="primary">Start</Button>} />
|
|
14
|
+
*/
|
|
8
15
|
export function GetStartedPage(props) {
|
|
9
16
|
const {
|
|
10
17
|
title,
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/** Props of {@link GetStartedPage}. */
|
|
2
3
|
export interface GetStartedPageProps {
|
|
4
|
+
/** Page title. */
|
|
3
5
|
title: string;
|
|
6
|
+
/** Intro paragraph. */
|
|
4
7
|
description: string;
|
|
8
|
+
/** Illustration image URL. */
|
|
5
9
|
image: string;
|
|
10
|
+
/** Optional help banner text. */
|
|
6
11
|
helpText?: string;
|
|
12
|
+
/** Checklist items rendered with check icons. */
|
|
7
13
|
checkList?: string[];
|
|
14
|
+
/** Call-to-action controls. */
|
|
8
15
|
actions?: ReactNode;
|
|
9
16
|
}
|
package/InputFile/InputFile.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { InputFileProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* File picker with a read-only name field, a browse button, size validation and
|
|
5
|
+
* error display. Reads the chosen file as a data-URL and returns it via `onChange`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <InputFile name="avatar" label="Avatar" accept="image/*" maxSize={2} onChange={handleFile} />
|
|
9
|
+
*/
|
|
3
10
|
export declare function InputFile({ fileId, textId, buttonId, label, buttonText, accept, placeholder, disabled, fileName, errorText, name, maxSize, onError, onChange, isIgnoreFileSize, }: InputFileProps): ReactElement;
|
package/InputFile/InputFile.js
CHANGED
|
@@ -5,6 +5,13 @@ import { AttachmentIcon } from '@pushwoosh/kit-icons';
|
|
|
5
5
|
import { Button } from '../Button';
|
|
6
6
|
import { FieldBox } from '../FieldBox';
|
|
7
7
|
import { InputFileFieldsStyled, InputFileButtonStyled, InputFileInputStyled, InputFileInputHiddenStyled, InputFileErrorStyled } from './styles';
|
|
8
|
+
/**
|
|
9
|
+
* File picker with a read-only name field, a browse button, size validation and
|
|
10
|
+
* error display. Reads the chosen file as a data-URL and returns it via `onChange`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <InputFile name="avatar" label="Avatar" accept="image/*" maxSize={2} onChange={handleFile} />
|
|
14
|
+
*/
|
|
8
15
|
export function InputFile({
|
|
9
16
|
fileId,
|
|
10
17
|
textId,
|
package/InputFile/types.d.ts
CHANGED
|
@@ -1,24 +1,42 @@
|
|
|
1
|
+
/** Props of {@link InputFile}. */
|
|
1
2
|
export type InputFileProps = {
|
|
3
|
+
/** Field name; also used as the key holding the data-URL in the `onChange` result. */
|
|
2
4
|
name: string;
|
|
5
|
+
/** Name of the currently selected file, shown in the read-only text field. */
|
|
3
6
|
fileName?: string;
|
|
7
|
+
/** Error message; shown under the field and switches it to the error state. */
|
|
4
8
|
errorText?: string;
|
|
9
|
+
/** Id of the hidden `<input type="file">`. */
|
|
5
10
|
fileId?: string;
|
|
11
|
+
/** Id of the read-only text field showing the file name. */
|
|
6
12
|
textId?: string;
|
|
13
|
+
/** Id of the browse button. */
|
|
7
14
|
buttonId?: string;
|
|
15
|
+
/** Accepted file types (the native `accept` attribute, e.g. `"image/*"`). */
|
|
8
16
|
accept?: string;
|
|
17
|
+
/** Field label rendered by the surrounding {@link FieldBox}. */
|
|
9
18
|
label?: string;
|
|
19
|
+
/** Browse button caption. */
|
|
10
20
|
buttonText?: string;
|
|
21
|
+
/** CSS width of the browse button. */
|
|
11
22
|
buttonWidth?: string;
|
|
23
|
+
/** Placeholder shown in the text field when no file is chosen. */
|
|
12
24
|
placeholder?: string;
|
|
25
|
+
/** Disable the field and button. */
|
|
13
26
|
disabled?: boolean;
|
|
27
|
+
/** Maximum allowed file size, in megabytes. */
|
|
14
28
|
maxSize?: number;
|
|
29
|
+
/** Skip the empty-file and `maxSize` checks. */
|
|
15
30
|
isIgnoreFileSize?: boolean;
|
|
31
|
+
/** Fires with `{ file, [name]: dataUrl }` once a valid file is read. */
|
|
16
32
|
onChange: (result: any) => void;
|
|
33
|
+
/** Fires with `(message, name)` when validation fails. */
|
|
17
34
|
onError?: (message: string, field: string) => void;
|
|
18
35
|
};
|
|
19
36
|
type FileProp = {
|
|
20
37
|
file: File;
|
|
21
38
|
};
|
|
39
|
+
/** Shape passed to {@link InputFileProps.onChange}: the `File` plus its data-URL under the field `name`. */
|
|
22
40
|
export type InputFileData = FileProp & {
|
|
23
41
|
[name: string]: string;
|
|
24
42
|
};
|
package/Link/Link.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { LinkPropsWithoutAs, LinkPropsWithAsTag, LinkPropsWithAsComponent } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Styled hyperlink. Renders a native `<a>` by default.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <Link href="/docs" title="Docs">Open docs</Link>
|
|
8
|
+
*/
|
|
3
9
|
export declare function Link(props: LinkPropsWithoutAs): ReactElement;
|
|
10
|
+
/**
|
|
11
|
+
* Link rendered as another intrinsic tag via `as`.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Link as="button" onClick={go}>Go</Link>
|
|
15
|
+
*/
|
|
4
16
|
export declare function Link<AS extends keyof JSX.IntrinsicElements>(props: LinkPropsWithAsTag<AS>): ReactElement;
|
|
17
|
+
/**
|
|
18
|
+
* Link rendered as a custom component via `as` (e.g. a router link).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <Link as={RouterLink} to="/home">Home</Link>
|
|
22
|
+
*/
|
|
5
23
|
export declare function Link<OuterProps extends object>(props: LinkPropsWithAsComponent<OuterProps>): ReactElement;
|
package/Link/types.d.ts
CHANGED
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
import type { Ref, ReactNode, ComponentType } from 'react';
|
|
2
|
+
/** Default {@link Link} props — renders a styled `<a>` (requires `title` and `href`). */
|
|
2
3
|
export type LinkPropsWithoutAs = Omit<JSX.IntrinsicElements['a'], 'ref'> & {
|
|
4
|
+
/** Ref to the `<a>` element. */
|
|
3
5
|
readonly boxRef?: Ref<HTMLAnchorElement>;
|
|
6
|
+
/** Native title attribute. */
|
|
4
7
|
readonly title: string;
|
|
8
|
+
/** Link target URL. */
|
|
5
9
|
readonly href: string;
|
|
10
|
+
/** Link content. */
|
|
6
11
|
readonly children: ReactNode;
|
|
7
12
|
};
|
|
13
|
+
/** {@link Link} props when rendering as another intrinsic tag via `as` (e.g. `as="button"`). */
|
|
8
14
|
export type LinkPropsWithAsTag<AS extends keyof JSX.IntrinsicElements> = Omit<JSX.IntrinsicElements[AS], 'ref'> & {
|
|
15
|
+
/** Ref to the element produced by `as`. */
|
|
9
16
|
readonly boxRef?: Ref<JSX.IntrinsicElements[AS]>;
|
|
17
|
+
/** Intrinsic tag name to render instead of `<a>`. */
|
|
10
18
|
readonly as: AS;
|
|
19
|
+
/** Native title attribute. */
|
|
11
20
|
readonly title?: string;
|
|
21
|
+
/** Link target URL. */
|
|
12
22
|
readonly href?: string;
|
|
23
|
+
/** Link content. */
|
|
13
24
|
readonly children: ReactNode;
|
|
14
25
|
};
|
|
26
|
+
/** {@link Link} props when rendering as a custom component via `as` (e.g. a router link). */
|
|
15
27
|
export type LinkPropsWithAsComponent<OuterProps extends object> = OuterProps & {
|
|
28
|
+
/** Ref to the rendered component's root element. */
|
|
16
29
|
readonly boxRef?: Ref<HTMLElement>;
|
|
30
|
+
/** Custom component to render instead of `<a>`; receives `OuterProps`. */
|
|
17
31
|
readonly as: ComponentType<OuterProps>;
|
|
32
|
+
/** Native title attribute. */
|
|
18
33
|
readonly title?: string;
|
|
34
|
+
/** Link target URL. */
|
|
19
35
|
readonly href?: string;
|
|
36
|
+
/** Link content. */
|
|
20
37
|
readonly children: ReactNode;
|
|
21
38
|
};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { ModalProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Centered modal dialog rendered in a portal, with size presets, layered z-index
|
|
5
|
+
* and backdrop-click close. Compose the inside with {@link ModalTitle},
|
|
6
|
+
* {@link ModalHeader}, {@link ModalBody} and {@link ModalFooter}.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Modal size="medium" isOpen={open} onClose={close}>
|
|
10
|
+
* <ModalHeader><ModalTitle onClose={close}>Title</ModalTitle></ModalHeader>
|
|
11
|
+
* <ModalBody>Content</ModalBody>
|
|
12
|
+
* </Modal>
|
|
13
|
+
*/
|
|
3
14
|
export declare function Modal(props: ModalProps): ReactElement;
|
|
@@ -7,6 +7,17 @@ import { useLayer } from '../../../hooks';
|
|
|
7
7
|
function createDivElement() {
|
|
8
8
|
return document.createElement('div');
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Centered modal dialog rendered in a portal, with size presets, layered z-index
|
|
12
|
+
* and backdrop-click close. Compose the inside with {@link ModalTitle},
|
|
13
|
+
* {@link ModalHeader}, {@link ModalBody} and {@link ModalFooter}.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <Modal size="medium" isOpen={open} onClose={close}>
|
|
17
|
+
* <ModalHeader><ModalTitle onClose={close}>Title</ModalTitle></ModalHeader>
|
|
18
|
+
* <ModalBody>Content</ModalBody>
|
|
19
|
+
* </Modal>
|
|
20
|
+
*/
|
|
10
21
|
export function Modal(props) {
|
|
11
22
|
const {
|
|
12
23
|
size,
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { MutableRefObject, PropsWithChildren } from 'react';
|
|
2
2
|
import type { modalSizes } from './maps';
|
|
3
|
+
/** Props of {@link Modal}. */
|
|
3
4
|
export type ModalProps = PropsWithChildren<{
|
|
5
|
+
/** Width preset (one of the predefined modal sizes). */
|
|
4
6
|
readonly size: keyof typeof modalSizes;
|
|
7
|
+
/** Stacking z-index; auto-layered when omitted. */
|
|
5
8
|
readonly zIndex?: number;
|
|
9
|
+
/** Whether the modal is open. */
|
|
6
10
|
readonly isOpen: boolean;
|
|
11
|
+
/** Fires on backdrop click or layer close. */
|
|
7
12
|
readonly onClose?: () => any;
|
|
8
13
|
}>;
|
|
14
|
+
/** Internal props of the modal transition box. */
|
|
9
15
|
export type ModalBoxBaseProps = PropsWithChildren<{
|
|
10
16
|
isOpen: boolean;
|
|
11
17
|
className?: string;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
2
|
import type { ModalConfirmProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Ready-made confirmation dialog (title, description, confirm/cancel buttons) with
|
|
5
|
+
* a built-in loading state and inline error banner. For imperative use prefer
|
|
6
|
+
* {@link useModalConfirm} via {@link ModalConfirmProvider}.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <ModalConfirm isOpen={open} title="Delete?" confirmButtonColor="danger" onAccept={remove} onCancel={close} />
|
|
10
|
+
*/
|
|
3
11
|
export declare function ModalConfirm(props: ModalConfirmProps): ReactElement;
|
|
@@ -7,6 +7,14 @@ import { useLang } from '../../polyglot';
|
|
|
7
7
|
import { Modal } from '../Modal';
|
|
8
8
|
import { ModalHeader, ModalBody, ModalFooter } from '../ModalContent';
|
|
9
9
|
import { ModalTitle } from '../ModalTitle';
|
|
10
|
+
/**
|
|
11
|
+
* Ready-made confirmation dialog (title, description, confirm/cancel buttons) with
|
|
12
|
+
* a built-in loading state and inline error banner. For imperative use prefer
|
|
13
|
+
* {@link useModalConfirm} via {@link ModalConfirmProvider}.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <ModalConfirm isOpen={open} title="Delete?" confirmButtonColor="danger" onAccept={remove} onCancel={close} />
|
|
17
|
+
*/
|
|
10
18
|
export function ModalConfirm(props) {
|
|
11
19
|
const lang = useLang();
|
|
12
20
|
const {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { type ReactElement, type PropsWithChildren } from 'react';
|
|
2
2
|
import type { ModalConfirmContextProps } from './types';
|
|
3
3
|
export declare const ModalConfirmContext: import("react").Context<ModalConfirmContextProps | null>;
|
|
4
|
+
/**
|
|
5
|
+
* Provides the confirm-dialog context and renders a single shared {@link ModalConfirm}.
|
|
6
|
+
* Wrap your app once, then trigger dialogs with {@link useModalConfirm}.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <ModalConfirmProvider><App /></ModalConfirmProvider>
|
|
10
|
+
*/
|
|
4
11
|
export declare function ModalConfirmProvider(props: PropsWithChildren): ReactElement;
|
|
@@ -2,6 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, createContext } from 'react';
|
|
3
3
|
import { ModalConfirm } from './ModalConfirm';
|
|
4
4
|
export const ModalConfirmContext = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* Provides the confirm-dialog context and renders a single shared {@link ModalConfirm}.
|
|
7
|
+
* Wrap your app once, then trigger dialogs with {@link useModalConfirm}.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <ModalConfirmProvider><App /></ModalConfirmProvider>
|
|
11
|
+
*/
|
|
5
12
|
export function ModalConfirmProvider(props) {
|
|
6
13
|
const {
|
|
7
14
|
children
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { ModalConfirmContextProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns `{ openModalConfirm, closeModalConfirm }` for showing confirm dialogs.
|
|
4
|
+
* Must be used within a {@link ModalConfirmProvider}, otherwise it throws.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const { openModalConfirm } = useModalConfirm();
|
|
8
|
+
* openModalConfirm({ title: 'Delete?', onAccept: remove });
|
|
9
|
+
*/
|
|
2
10
|
export declare const useModalConfirm: () => ModalConfirmContextProps;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { ModalConfirmContext } from './ModalConfirmProvider';
|
|
3
|
+
/**
|
|
4
|
+
* Returns `{ openModalConfirm, closeModalConfirm }` for showing confirm dialogs.
|
|
5
|
+
* Must be used within a {@link ModalConfirmProvider}, otherwise it throws.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { openModalConfirm } = useModalConfirm();
|
|
9
|
+
* openModalConfirm({ title: 'Delete?', onAccept: remove });
|
|
10
|
+
*/
|
|
3
11
|
export const useModalConfirm = () => {
|
|
4
12
|
const context = useContext(ModalConfirmContext);
|
|
5
13
|
if (!context) {
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type modalSizes } from '../Modal/maps';
|
|
3
|
+
/** Color of the confirm button in a {@link ModalConfirm}. */
|
|
3
4
|
export type ConfirmButtonColor = 'primary' | 'secondary' | 'danger';
|
|
5
|
+
/** Props of {@link ModalConfirm}. */
|
|
4
6
|
export interface ModalConfirmProps {
|
|
7
|
+
/** Whether the dialog is open. */
|
|
5
8
|
isOpen: boolean;
|
|
9
|
+
/** Heading (defaults to a localized "Confirm" title). */
|
|
6
10
|
title?: string;
|
|
11
|
+
/** Width preset (default `small`). */
|
|
7
12
|
size?: keyof typeof modalSizes;
|
|
13
|
+
/** Body text/content. */
|
|
8
14
|
description?: ReactNode;
|
|
15
|
+
/** Confirm button caption (defaults to localized "Confirm"). */
|
|
9
16
|
confirmButtonText?: string;
|
|
17
|
+
/** Confirm button color (default `primary`). */
|
|
10
18
|
confirmButtonColor?: ConfirmButtonColor;
|
|
19
|
+
/** Cancel button caption (defaults to localized "Cancel"). */
|
|
11
20
|
cancelButtonText?: string;
|
|
21
|
+
/** Extra async work run before `onAccept`; errors are shown inline. */
|
|
12
22
|
callback?: () => void;
|
|
23
|
+
/** Fires when the user confirms (after `callback`). */
|
|
13
24
|
onAccept: () => void;
|
|
25
|
+
/** Fires when the user cancels or closes. */
|
|
14
26
|
onCancel: () => void;
|
|
15
27
|
}
|
|
28
|
+
/** Arguments for {@link ModalConfirmContextProps.openModalConfirm}; `isOpen`/`onCancel` are optional. */
|
|
16
29
|
export type OpenModalConfirmParams = Omit<ModalConfirmProps, 'isOpen' | 'onCancel'> & {
|
|
17
30
|
isOpen?: ModalConfirmProps['isOpen'];
|
|
18
31
|
onCancel?: () => void;
|
|
19
32
|
};
|
|
33
|
+
/** Value returned by {@link useModalConfirm}. */
|
|
20
34
|
export interface ModalConfirmContextProps {
|
|
35
|
+
/** Open a confirm dialog with the given params. */
|
|
21
36
|
openModalConfirm: (params: OpenModalConfirmParams) => void;
|
|
37
|
+
/** Close the confirm dialog. */
|
|
22
38
|
closeModalConfirm: () => void;
|
|
23
39
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/** Top section of a {@link Modal}; typically wraps a {@link ModalTitle}. */
|
|
1
2
|
export declare const ModalHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
/** Groups {@link ModalBodyItem}s with hairline dividers between them, inside a {@link ModalBody}. */
|
|
2
4
|
export declare const ModalBodyGroup: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
3
5
|
$alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
|
|
4
6
|
$alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
@@ -11,8 +13,11 @@ export declare const ModalBodyGroup: import("styled-components").StyledComponent
|
|
|
11
13
|
} & {
|
|
12
14
|
$gridAutoFlow: string;
|
|
13
15
|
}, "$gridAutoFlow">;
|
|
16
|
+
/** A single row within a {@link ModalBodyGroup}; pass `$vPadding` to add vertical padding. */
|
|
14
17
|
export declare const ModalBodyItem: import("styled-components").StyledComponent<"div", any, {
|
|
15
18
|
$vPadding?: boolean;
|
|
16
19
|
}, never>;
|
|
20
|
+
/** Scrollable main content area of a {@link Modal}; self-pads unless it holds a {@link ModalBodyGroup}. */
|
|
17
21
|
export declare const ModalBody: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
22
|
+
/** Bottom action bar of a {@link Modal}, divided from the body; typically holds buttons. */
|
|
18
23
|
export declare const ModalFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|