@igne-agency/react-web-ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -1
- package/dist/components/accordion/accordion.css +24 -19
- package/dist/components/accordion/accordion.d.ts +19 -3
- package/dist/components/accordion/accordion.js +86 -32
- package/dist/components/accordion/accordion.module.js +8 -8
- package/dist/components/active-filters/active-filter-describers.d.ts +1 -1
- package/dist/components/active-filters/active-filter-describers.js +1 -1
- package/dist/components/active-filters/active-filters.d.ts +35 -2
- package/dist/components/active-filters/active-filters.js +57 -52
- package/dist/components/active-filters/index.js +2 -2
- package/dist/components/attachment-tile/attachment-preview.d.ts +11 -9
- package/dist/components/attachment-tile/attachment-preview.js +102 -68
- package/dist/components/attachment-tile/attachment-tile.css +22 -13
- package/dist/components/attachment-tile/attachment-tile.d.ts +51 -6
- package/dist/components/attachment-tile/attachment-tile.js +209 -85
- package/dist/components/attachment-tile/attachment-tile.module.js +10 -10
- package/dist/components/attachment-tile/index.d.ts +1 -1
- package/dist/components/attachment-tile/index.js +2 -2
- package/dist/components/avatar/avatar.d.ts +5 -5
- package/dist/components/avatar/avatar.js +64 -37
- package/dist/components/avatar-group/avatar-group.js +2 -2
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +22 -7
- package/dist/components/breadcrumbs/breadcrumbs.js +189 -170
- package/dist/components/button/button.d.ts +2 -3
- package/dist/components/button/button.js +58 -77
- package/dist/components/button/close-button.d.ts +4 -2
- package/dist/components/button/close-button.js +9 -9
- package/dist/components/checkbox-field/checkbox-field.d.ts +17 -3
- package/dist/components/checkbox-field/checkbox-field.js +108 -131
- package/dist/components/checkbox-field/checkbox.css +26 -34
- package/dist/components/checkbox-field/checkbox.d.ts +51 -8
- package/dist/components/checkbox-field/checkbox.js +221 -57
- package/dist/components/checkbox-field/checkbox.module.js +6 -8
- package/dist/components/checkbox-field/index.d.ts +0 -1
- package/dist/components/checkbox-field/index.js +1 -2
- package/dist/components/checkbox-field/tsf-checkbox-field.d.ts +2 -2
- package/dist/components/checkbox-group-field/checkbox-group-field.d.ts +4 -1
- package/dist/components/checkbox-group-field/checkbox-group-field.js +54 -50
- package/dist/components/checkbox-group-field/checkbox-group.d.ts +7 -2
- package/dist/components/checkbox-group-field/checkbox-group.js +8 -3
- package/dist/components/collapsible/collapsible.css +23 -18
- package/dist/components/collapsible/collapsible.d.ts +18 -3
- package/dist/components/collapsible/collapsible.js +85 -32
- package/dist/components/collapsible/collapsible.module.js +7 -7
- package/dist/components/combobox-field/combobox-field.d.ts +9 -1
- package/dist/components/combobox-field/combobox-field.js +195 -175
- package/dist/components/combobox-field/combobox-items.d.ts +2 -2
- package/dist/components/combobox-field/combobox-items.js +4 -4
- package/dist/components/combobox-field/combobox.css +99 -96
- package/dist/components/combobox-field/combobox.d.ts +94 -15
- package/dist/components/combobox-field/combobox.js +484 -159
- package/dist/components/combobox-field/combobox.module.js +21 -21
- package/dist/components/combobox-field/index.d.ts +0 -1
- package/dist/components/combobox-field/selection.d.ts +4 -1
- package/dist/components/combobox-field/value-state-view.css +7 -3
- package/dist/components/combobox-field/value-state-view.d.ts +4 -2
- package/dist/components/combobox-field/value-state-view.js +15 -15
- package/dist/components/combobox-field/value-state-view.module.js +6 -4
- package/dist/components/composer/composer-attachments.d.ts +11 -3
- package/dist/components/composer/composer-attachments.js +61 -47
- package/dist/components/composer/composer-editor.d.ts +2 -1
- package/dist/components/composer/composer-editor.js +79 -71
- package/dist/components/composer/composer-mentions.js +2 -2
- package/dist/components/composer/composer.d.ts +42 -21
- package/dist/components/composer/composer.js +201 -58
- package/dist/components/composer/mention-text.js +3 -3
- package/dist/components/confirm-dialog/confirm-dialog.d.ts +8 -7
- package/dist/components/confirm-dialog/confirm-dialog.js +10 -9
- package/dist/components/conversation/conversation.context.d.ts +0 -5
- package/dist/components/conversation/conversation.d.ts +63 -29
- package/dist/components/conversation/conversation.js +193 -82
- package/dist/components/conversation/index.d.ts +1 -1
- package/dist/components/date-field/date-field.d.ts +10 -4
- package/dist/components/date-field/date-field.js +57 -43
- package/dist/components/date-field/date-input.d.ts +20 -3
- package/dist/components/date-field/date-input.js +28 -13
- package/dist/components/date-field/index.d.ts +1 -1
- package/dist/components/date-field/tsf-date-field.d.ts +1 -1
- package/dist/components/date-field/tsf-date-field.js +1 -1
- package/dist/components/date-range-field/date-range-field.d.ts +8 -4
- package/dist/components/date-range-field/date-range-field.js +57 -45
- package/dist/components/date-range-field/date-range-input.d.ts +20 -3
- package/dist/components/date-range-field/date-range-input.js +27 -12
- package/dist/components/date-range-field/tsf-date-range-field.d.ts +1 -1
- package/dist/components/date-range-field/tsf-date-range-field.js +1 -1
- package/dist/components/detail-list/detail-list.d.ts +28 -27
- package/dist/components/detail-list/detail-list.js +177 -121
- package/dist/components/dialog/dialog.d.ts +47 -27
- package/dist/components/dialog/dialog.js +101 -38
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.d.ts +48 -30
- package/dist/components/drawer/drawer.js +113 -41
- package/dist/components/email-field/email-field.d.ts +5 -3
- package/dist/components/email-field/email-field.js +1 -3
- package/dist/components/email-field/tsf-email-field.d.ts +3 -2
- package/dist/components/empty-message/empty-message.d.ts +3 -3
- package/dist/components/empty-message/empty-message.js +3 -3
- package/dist/components/error-boundary/error-boundary.d.ts +5 -2
- package/dist/components/error-boundary/error-boundary.js +2 -3
- package/dist/components/error-message/error-message.d.ts +1 -1
- package/dist/components/error-message/error-message.js +1 -1
- package/dist/components/error-text/error-text.js +3 -3
- package/dist/components/field/field.d.ts +5 -5
- package/dist/components/field/field.js +9 -9
- package/dist/components/field/index.js +2 -2
- package/dist/components/field/input-parts.js +1 -1
- package/dist/components/field-placeholder/field-placeholder.d.ts +4 -1
- package/dist/components/field-placeholder/field-placeholder.js +41 -26
- package/dist/components/fieldset/field-group.js +1 -1
- package/dist/components/fieldset/fieldset-root.js +1 -1
- package/dist/components/fieldset/fieldset.css +4 -3
- package/dist/components/fieldset/fieldset.js +1 -1
- package/dist/components/fieldset/fieldset.module.js +2 -2
- package/dist/components/file-field/file-field.css +19 -15
- package/dist/components/file-field/file-field.d.ts +10 -1
- package/dist/components/file-field/file-field.js +130 -109
- package/dist/components/file-field/file-field.module.js +6 -4
- package/dist/components/file-field/file-input.d.ts +32 -9
- package/dist/components/file-field/file-input.js +94 -74
- package/dist/components/filter-bar/filter-bar.d.ts +79 -51
- package/dist/components/filter-bar/filter-bar.js +552 -216
- package/dist/components/form/form.d.ts +4 -6
- package/dist/components/form/form.js +6 -8
- package/dist/components/icon/icon.d.ts +5 -10
- package/dist/components/icon/icon.js +4 -6
- package/dist/components/link/link.js +1 -1
- package/dist/components/link-button/link-button.d.ts +1 -2
- package/dist/components/link-button/link-button.js +12 -22
- package/dist/components/loading-message/loading-message.d.ts +2 -2
- package/dist/components/loading-message/loading-message.js +1 -1
- package/dist/components/locale-provider/locale-provider.js +1 -1
- package/dist/components/menu/menu.d.ts +40 -22
- package/dist/components/menu/menu.js +100 -40
- package/dist/components/nav/nav-context.d.ts +0 -1
- package/dist/components/nav/nav-context.js +1 -2
- package/dist/components/nav/nav-item-view.d.ts +7 -7
- package/dist/components/nav/nav-item-view.js +27 -51
- package/dist/components/nav/nav.css +72 -60
- package/dist/components/nav/nav.d.ts +15 -8
- package/dist/components/nav/nav.js +105 -52
- package/dist/components/nav/nav.module.js +14 -14
- package/dist/components/number-field/number-field.d.ts +7 -1
- package/dist/components/number-field/number-field.js +98 -82
- package/dist/components/number-field/number-input.d.ts +53 -4
- package/dist/components/number-field/number-input.js +68 -21
- package/dist/components/number-field/tsf-number-field.d.ts +1 -1
- package/dist/components/number-field/tsf-number-field.js +1 -1
- package/dist/components/otp-field/otp-input.d.ts +25 -0
- package/dist/components/otp-field/otp-input.js +26 -1
- package/dist/components/pagination/pagination.d.ts +82 -23
- package/dist/components/pagination/pagination.js +656 -229
- package/dist/components/password-field/password-field.d.ts +7 -1
- package/dist/components/password-field/password-field.js +117 -126
- package/dist/components/password-field/password-strength.js +1 -1
- package/dist/components/password-field/tsf-password-field.d.ts +1 -1
- package/dist/components/password-field/tsf-password-field.js +1 -1
- package/dist/components/photo-field/photo-field.d.ts +17 -3
- package/dist/components/photo-field/photo-field.js +168 -89
- package/dist/components/photo-field/photo-input-context.d.ts +25 -0
- package/dist/components/photo-field/photo-input-context.js +14 -0
- package/dist/components/photo-field/photo-input.d.ts +58 -23
- package/dist/components/photo-field/photo-input.js +459 -261
- package/dist/components/popover/popover.d.ts +55 -23
- package/dist/components/popover/popover.js +205 -61
- package/dist/components/radio-group-field/radio-group.js +1 -1
- package/dist/components/search-field/search-field.d.ts +7 -5
- package/dist/components/search-field/search-field.js +4 -6
- package/dist/components/search-field/tsf-search-field.d.ts +1 -1
- package/dist/components/search-field/tsf-search-field.js +1 -1
- package/dist/components/segmented-control-field/segmented-control.js +1 -1
- package/dist/components/select-field/select-field.d.ts +7 -1
- package/dist/components/select-field/select-field.js +151 -139
- package/dist/components/select-field/select.d.ts +28 -6
- package/dist/components/select-field/select.js +234 -149
- package/dist/components/skeleton/skeleton.js +1 -1
- package/dist/components/spinner/spinner.css +47 -1
- package/dist/components/spinner/spinner.js +28 -11
- package/dist/components/spinner/spinner.module.js +18 -3
- package/dist/components/stale/stale.d.ts +17 -21
- package/dist/components/stale/stale.js +307 -129
- package/dist/components/status-message/status-message.css +22 -21
- package/dist/components/status-message/status-message.d.ts +10 -5
- package/dist/components/status-message/status-message.js +20 -24
- package/dist/components/status-message/status-message.module.js +6 -6
- package/dist/components/status-message/status-preset.d.ts +4 -5
- package/dist/components/status-message/status-preset.js +3 -3
- package/dist/components/switch-field/switch.js +1 -1
- package/dist/components/tabs/tabs.d.ts +51 -28
- package/dist/components/tabs/tabs.js +219 -144
- package/dist/components/tag/tag.css +23 -21
- package/dist/components/tag/tag.d.ts +17 -15
- package/dist/components/tag/tag.js +140 -65
- package/dist/components/tag/tag.module.js +3 -3
- package/dist/components/tag-group/tag-group.css +30 -27
- package/dist/components/tag-group/tag-group.d.ts +10 -4
- package/dist/components/tag-group/tag-group.js +47 -35
- package/dist/components/tag-group/tag-group.module.js +4 -4
- package/dist/components/text-field/text-field.d.ts +14 -3
- package/dist/components/text-field/text-field.js +154 -133
- package/dist/components/text-field/text-input.d.ts +89 -3
- package/dist/components/text-field/text-input.js +184 -70
- package/dist/components/textarea-field/textarea.js +1 -1
- package/dist/components/time-field/time-input.d.ts +6 -0
- package/dist/components/time-field/time-input.js +6 -0
- package/dist/components/time-zone-provider/time-zone-provider.js +1 -1
- package/dist/components/toast/index.js +2 -2
- package/dist/components/toast/toast-provider.css +38 -34
- package/dist/components/toast/toast-provider.d.ts +65 -3
- package/dist/components/toast/toast-provider.js +313 -148
- package/dist/components/toast/toast-provider.module.js +11 -17
- package/dist/components/toast/toast.d.ts +5 -1
- package/dist/components/toast/toast.js +2 -1
- package/dist/components/toggle-group-field/toggle-group.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +6 -6
- package/dist/components/tooltip/tooltip.js +7 -7
- package/dist/data-table/data-table-content.d.ts +18 -10
- package/dist/data-table/data-table-content.js +145 -290
- package/dist/data-table/data-table-context.d.ts +4 -2
- package/dist/data-table/data-table-context.js +1 -1
- package/dist/data-table/data-table-parts.d.ts +99 -0
- package/dist/data-table/data-table-parts.js +1182 -0
- package/dist/data-table/data-table-selection.d.ts +7 -3
- package/dist/data-table/data-table-selection.js +62 -37
- package/dist/data-table/data-table.css +100 -95
- package/dist/data-table/data-table.d.ts +49 -25
- package/dist/data-table/data-table.js +95 -83
- package/dist/data-table/data-table.module.js +34 -34
- package/dist/data-table/index.d.ts +2 -1
- package/dist/data-table/index.js +2 -1
- package/dist/data-view/use-data-view.d.ts +2 -2
- package/dist/data-view/use-data-view.js +2 -2
- package/dist/index.js +7 -8
- package/dist/lib/calendar/calendar-navigation.d.ts +9 -2
- package/dist/lib/calendar/calendar-navigation.js +72 -73
- package/dist/lib/calendar/calendar-year.d.ts +4 -3
- package/dist/lib/calendar/calendar-year.js +137 -156
- package/dist/lib/calendar/temporal.d.ts +18 -12
- package/dist/lib/calendar/temporal.js +191 -147
- package/dist/lib/table-storage.d.ts +2 -2
- package/dist/lib/table-storage.js +2 -2
- package/dist/lib/unsaved-changes/leave-guard.js +1 -1
- package/dist/terrazzo/index.d.ts +16 -0
- package/dist/terrazzo/index.js +94 -2
- package/dist/tokens.css +71 -69
- package/package.json +3 -2
- package/tokens/ref.tokens.json +0 -30
- package/tokens/sys.tokens.json +0 -7
- package/dist/assets/spinner.js +0 -28
- package/dist/components/checkbox-field/checkbox-glyph.d.ts +0 -12
- package/dist/components/checkbox-field/checkbox-glyph.js +0 -38
- package/dist/components/combobox-field/combobox-popup-body.d.ts +0 -34
- package/dist/components/combobox-field/combobox-popup-body.js +0 -142
- package/dist/components/conversation/conversation.context.js +0 -4
- package/dist/vendor/@material-design-icons/svg/outlined/add.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_downward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_forward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/arrow_upward.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/attach_file.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/block.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/calendar_today.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/check.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/check_circle.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/chevron_left.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/chevron_right.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/close.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/content_copy.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/date_range.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/description.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/download.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/error.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/error_outline.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/expand_less.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/expand_more.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/filter_alt.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/filter_alt_off.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/first_page.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/info.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/keyboard_arrow_down.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/last_page.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/mail.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/more_horiz.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/photo_camera.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/remove.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/restart_alt.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/restore.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/search.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/unfold_more.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/upload_file.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/visibility.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/visibility_off.js +0 -12
- package/dist/vendor/@material-design-icons/svg/outlined/warning_amber.js +0 -12
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
-
import type
|
|
3
|
-
import { type
|
|
2
|
+
import { type ComponentProps, type ReactElement, type ReactNode } from "react";
|
|
3
|
+
import { type AvatarProps } from "../avatar/index.ts";
|
|
4
|
+
import type { ConversationMessageSide, ConversationMessageStatus } from "./conversation.context.ts";
|
|
4
5
|
import { type ConversationMoment } from "./moment.ts";
|
|
5
6
|
export type ConversationRootProps = useRender.ComponentProps<"div">;
|
|
6
7
|
/**
|
|
@@ -30,7 +31,7 @@ export type ConversationMessageProps = Readonly<{
|
|
|
30
31
|
side: ConversationMessageSide;
|
|
31
32
|
}> & useRender.ComponentProps<"div">;
|
|
32
33
|
/** A burst of messages from one author, aligned to its `side`. */
|
|
33
|
-
declare const Message: ({ side, className, render, ...props }: ConversationMessageProps) =>
|
|
34
|
+
declare const Message: ({ side, className, render, ...props }: ConversationMessageProps) => ReactElement;
|
|
34
35
|
export type ConversationMessageBubbleProps = useRender.ComponentProps<"div">;
|
|
35
36
|
/** One message's bubble, pointed toward its author. */
|
|
36
37
|
declare const MessageBubble: ({ className, render, ...props }: ConversationMessageBubbleProps) => ReactElement;
|
|
@@ -40,14 +41,9 @@ export type ConversationMessageAuthorProps = Readonly<{
|
|
|
40
41
|
}> & useRender.ComponentProps<"div">;
|
|
41
42
|
/** The line above a burst: avatar, name, timestamp and read status. */
|
|
42
43
|
declare const MessageAuthor: ({ side, className, render, ...props }: ConversationMessageAuthorProps) => ReactElement;
|
|
43
|
-
export type ConversationMessageAvatarProps =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/** Diameter relative to the surrounding font size (in `em`). @default 1.5 */
|
|
47
|
-
size?: number;
|
|
48
|
-
}>;
|
|
49
|
-
/** The author's `Avatar`, sized for the author line. */
|
|
50
|
-
declare const MessageAvatar: ({ name, size, }: ConversationMessageAvatarProps) => ReactNode;
|
|
44
|
+
export type ConversationMessageAvatarProps = AvatarProps;
|
|
45
|
+
/** The author's `Avatar`, sized for the author line: 1.5em unless `size` says otherwise. */
|
|
46
|
+
declare const MessageAvatar: ({ size, className, ...props }: ConversationMessageAvatarProps) => ReactNode;
|
|
51
47
|
export type ConversationMessageTimestampProps = Readonly<{
|
|
52
48
|
date: ConversationMoment;
|
|
53
49
|
/** Shows the date as well as the time. @default false */
|
|
@@ -76,19 +72,59 @@ declare const MessageFiles: ({ className, render, ...props }: ConversationMessag
|
|
|
76
72
|
export type ConversationMessageFilesDownloadAllProps = Readonly<{
|
|
77
73
|
/** The button's accessible name and tooltip, such as "Download all files". */
|
|
78
74
|
label: string;
|
|
75
|
+
/** The download glyph. */
|
|
76
|
+
children: ReactNode;
|
|
79
77
|
}> & Omit<useRender.ComponentProps<"button">, "children">;
|
|
80
|
-
/** An icon button that downloads every file of a message. */
|
|
81
|
-
declare const MessageFilesDownloadAll: ({ label, render, ...props }: ConversationMessageFilesDownloadAllProps) => ReactElement;
|
|
78
|
+
/** An icon button that downloads every file of a message; its children are the glyph. */
|
|
79
|
+
declare const MessageFilesDownloadAll: ({ label, children, render, ...props }: ConversationMessageFilesDownloadAllProps) => ReactElement;
|
|
82
80
|
export type ConversationScrollToBottomProps = Readonly<{
|
|
83
81
|
/** The button's accessible name and tooltip, such as "Scroll to latest". */
|
|
84
82
|
label: string;
|
|
83
|
+
/** The jump glyph, such as a down arrow. */
|
|
84
|
+
children: ReactNode;
|
|
85
85
|
}> & Omit<useRender.ComponentProps<"button">, "children">;
|
|
86
|
-
/** An icon button, pinned to the log's bottom corner, that jumps to the latest message. */
|
|
87
|
-
declare const ScrollToBottom: ({ label, className, render, ...props }: ConversationScrollToBottomProps) => ReactElement;
|
|
86
|
+
/** An icon button, pinned to the log's bottom corner, that jumps to the latest message; its children are the glyph. */
|
|
87
|
+
declare const ScrollToBottom: ({ label, children, className, render, ...props }: ConversationScrollToBottomProps) => ReactElement;
|
|
88
88
|
export type ConversationEmptyStateProps = useRender.ComponentProps<"div">;
|
|
89
89
|
/** What the log shows before there are any messages. */
|
|
90
90
|
declare const EmptyState: ({ className, render, ...props }: ConversationEmptyStateProps) => ReactElement;
|
|
91
|
-
|
|
91
|
+
/** One message, as the `Conversation` prefab takes it. */
|
|
92
|
+
export type ConversationMessage = Readonly<{
|
|
93
|
+
id: string;
|
|
94
|
+
/** Who sent it. Consecutive messages with the same author form one burst. */
|
|
95
|
+
authorId: string;
|
|
96
|
+
/** The author's display name, shown above the burst and drawn as initials. */
|
|
97
|
+
authorName: string;
|
|
98
|
+
side: ConversationMessageSide;
|
|
99
|
+
sentAt: ConversationMoment;
|
|
100
|
+
/** The message's text. */
|
|
101
|
+
body: ReactNode;
|
|
102
|
+
/** Whether the other party has read it. A burst shows its last message's status. */
|
|
103
|
+
status?: ConversationMessageStatus;
|
|
104
|
+
/** The files sent with it, such as `SentAttachmentTile`s, laid out as a row. */
|
|
105
|
+
files?: ReactNode;
|
|
106
|
+
}>;
|
|
107
|
+
export type ConversationProps = Omit<ConversationRootProps, "children"> & Readonly<{
|
|
108
|
+
/** The messages, oldest first. */
|
|
109
|
+
messages: ReadonlyArray<ConversationMessage>;
|
|
110
|
+
/** What the separator says for today's messages, such as "Today". */
|
|
111
|
+
todayLabel: string;
|
|
112
|
+
/** What the separator says for yesterday's messages, such as "Yesterday". */
|
|
113
|
+
yesterdayLabel: string;
|
|
114
|
+
/** What a read message's status is announced as, such as "Read". */
|
|
115
|
+
readLabel: string;
|
|
116
|
+
/** What an unread message's status is announced as, such as "Unread". */
|
|
117
|
+
unreadLabel: string;
|
|
118
|
+
/** Cuts each message's text off after this many lines. */
|
|
119
|
+
lineClamp?: number;
|
|
120
|
+
/** What the log shows while there are no messages. */
|
|
121
|
+
empty?: ReactNode;
|
|
122
|
+
/** Anything after the messages, such as a `ScrollToBottom`. */
|
|
123
|
+
children?: ReactNode;
|
|
124
|
+
}>;
|
|
125
|
+
declare const Prefab: ({ messages, todayLabel, yesterdayLabel, readLabel, unreadLabel, lineClamp, empty, children, ...props }: ConversationProps) => ReactElement;
|
|
126
|
+
/** The parts of a conversation, hanging off its prefab. */
|
|
127
|
+
export type ConversationParts = typeof Prefab & Readonly<{
|
|
92
128
|
Root: typeof Root;
|
|
93
129
|
EmptyState: typeof EmptyState;
|
|
94
130
|
Group: typeof Group;
|
|
@@ -107,20 +143,18 @@ type ConversationNamespace = Readonly<{
|
|
|
107
143
|
}>;
|
|
108
144
|
/**
|
|
109
145
|
* A message thread: a log of day groups, each a run of author bursts with their
|
|
110
|
-
* bubbles, timestamps, read status and files.
|
|
111
|
-
*
|
|
146
|
+
* bubbles, timestamps, read status and files. The prefab groups `messages` by
|
|
147
|
+
* day and by author in the provider's time zone; the parts hanging off it build
|
|
148
|
+
* a log by hand, grouped with `groupByDay` and `groupByBurst`.
|
|
112
149
|
*
|
|
113
150
|
* @example
|
|
114
|
-
* <Conversation
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* </Conversation.Message>
|
|
122
|
-
* </Conversation.Group>
|
|
123
|
-
* </Conversation.Root>
|
|
151
|
+
* <Conversation
|
|
152
|
+
* messages={messages}
|
|
153
|
+
* todayLabel="Today"
|
|
154
|
+
* yesterdayLabel="Yesterday"
|
|
155
|
+
* readLabel="Read"
|
|
156
|
+
* unreadLabel="Unread"
|
|
157
|
+
* />
|
|
124
158
|
*/
|
|
125
|
-
export declare const Conversation:
|
|
159
|
+
export declare const Conversation: ConversationParts;
|
|
126
160
|
export {};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import SvgDownload from "../../vendor/@material-design-icons/svg/outlined/download.js";
|
|
2
|
-
import SvgKeyboardArrowDown from "../../vendor/@material-design-icons/svg/outlined/keyboard_arrow_down.js";
|
|
3
1
|
import { Avatar } from "../avatar/avatar.js";
|
|
4
2
|
import { Button } from "../button/button.js";
|
|
5
3
|
import { useLocale } from "../locale-provider/locale-provider.js";
|
|
6
4
|
import { useTimeZone } from "../time-zone-provider/time-zone-provider.js";
|
|
7
|
-
import { ConversationMessageContext } from "./conversation.context.js";
|
|
8
5
|
import conversation_module_default from "./conversation.module.js";
|
|
6
|
+
import { groupByBurst, groupByDay } from "./group-messages.js";
|
|
9
7
|
import { toZonedDateTime } from "./moment.js";
|
|
10
8
|
import { c } from "react/compiler-runtime";
|
|
11
|
-
import {
|
|
9
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
12
10
|
import { clsx } from "clsx";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as Fragment$1 } from "react";
|
|
13
13
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
14
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
15
14
|
import { Intl, Temporal } from "temporal-polyfill";
|
|
16
15
|
// src/components/conversation/conversation.tsx
|
|
17
16
|
var MISSING = "-";
|
|
@@ -209,7 +208,7 @@ var DateSeparator = (t0) => {
|
|
|
209
208
|
};
|
|
210
209
|
/** A burst of messages from one author, aligned to its `side`. */
|
|
211
210
|
var Message = (t0) => {
|
|
212
|
-
const $ = c(
|
|
211
|
+
const $ = c(14);
|
|
213
212
|
let className;
|
|
214
213
|
let props;
|
|
215
214
|
let render;
|
|
@@ -256,24 +255,7 @@ var Message = (t0) => {
|
|
|
256
255
|
$[12] = t2;
|
|
257
256
|
$[13] = t3;
|
|
258
257
|
} else t3 = $[13];
|
|
259
|
-
|
|
260
|
-
let t4;
|
|
261
|
-
if ($[14] !== side) {
|
|
262
|
-
t4 = { side };
|
|
263
|
-
$[14] = side;
|
|
264
|
-
$[15] = t4;
|
|
265
|
-
} else t4 = $[15];
|
|
266
|
-
let t5;
|
|
267
|
-
if ($[16] !== element || $[17] !== t4) {
|
|
268
|
-
t5 = /* @__PURE__ */ jsx(ConversationMessageContext, {
|
|
269
|
-
value: t4,
|
|
270
|
-
children: element
|
|
271
|
-
});
|
|
272
|
-
$[16] = element;
|
|
273
|
-
$[17] = t4;
|
|
274
|
-
$[18] = t5;
|
|
275
|
-
} else t5 = $[18];
|
|
276
|
-
return t5;
|
|
258
|
+
return useRender(t3);
|
|
277
259
|
};
|
|
278
260
|
/** One message's bubble, pointed toward its author. */
|
|
279
261
|
var MessageBubble = (t0) => {
|
|
@@ -364,23 +346,43 @@ var MessageAuthor = (t0) => {
|
|
|
364
346
|
} else t3 = $[13];
|
|
365
347
|
return useRender(t3);
|
|
366
348
|
};
|
|
367
|
-
/** The author's `Avatar`, sized for the author line. */
|
|
349
|
+
/** The author's `Avatar`, sized for the author line: 1.5em unless `size` says otherwise. */
|
|
368
350
|
var MessageAvatar = (t0) => {
|
|
369
|
-
const $ = c(
|
|
370
|
-
|
|
351
|
+
const $ = c(10);
|
|
352
|
+
let className;
|
|
353
|
+
let props;
|
|
354
|
+
let t1;
|
|
355
|
+
if ($[0] !== t0) {
|
|
356
|
+
({size: t1, className, ...props} = t0);
|
|
357
|
+
$[0] = t0;
|
|
358
|
+
$[1] = className;
|
|
359
|
+
$[2] = props;
|
|
360
|
+
$[3] = t1;
|
|
361
|
+
} else {
|
|
362
|
+
className = $[1];
|
|
363
|
+
props = $[2];
|
|
364
|
+
t1 = $[3];
|
|
365
|
+
}
|
|
371
366
|
const size = t1 === void 0 ? 1.5 : t1;
|
|
372
367
|
let t2;
|
|
373
|
-
if ($[
|
|
374
|
-
t2 =
|
|
375
|
-
|
|
368
|
+
if ($[4] !== className) {
|
|
369
|
+
t2 = clsx(conversation_module_default.messageAvatar, className);
|
|
370
|
+
$[4] = className;
|
|
371
|
+
$[5] = t2;
|
|
372
|
+
} else t2 = $[5];
|
|
373
|
+
let t3;
|
|
374
|
+
if ($[6] !== props || $[7] !== size || $[8] !== t2) {
|
|
375
|
+
t3 = /* @__PURE__ */ jsx(Avatar, {
|
|
376
|
+
...props,
|
|
376
377
|
size,
|
|
377
|
-
className:
|
|
378
|
+
className: t2
|
|
378
379
|
});
|
|
379
|
-
$[
|
|
380
|
-
$[
|
|
381
|
-
$[
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
$[6] = props;
|
|
381
|
+
$[7] = size;
|
|
382
|
+
$[8] = t2;
|
|
383
|
+
$[9] = t3;
|
|
384
|
+
} else t3 = $[9];
|
|
385
|
+
return t3;
|
|
384
386
|
};
|
|
385
387
|
/** When a message was sent, in the provider's locale and time zone. */
|
|
386
388
|
var MessageTimestamp = (t0) => {
|
|
@@ -586,30 +588,34 @@ var MessageFiles = (t0) => {
|
|
|
586
588
|
} else t5 = $[8];
|
|
587
589
|
return t4(t5);
|
|
588
590
|
};
|
|
589
|
-
/** An icon button that downloads every file of a message. */
|
|
591
|
+
/** An icon button that downloads every file of a message; its children are the glyph. */
|
|
590
592
|
var MessageFilesDownloadAll = (t0) => {
|
|
591
|
-
const $ = c(
|
|
593
|
+
const $ = c(13);
|
|
592
594
|
let t1;
|
|
593
595
|
let t2;
|
|
594
596
|
let t3;
|
|
595
597
|
let t4;
|
|
596
598
|
if ($[0] !== t0) {
|
|
597
|
-
const { label, render, ...props } = t0;
|
|
599
|
+
const { label, children, render, ...props } = t0;
|
|
598
600
|
t4 = useRender;
|
|
599
601
|
t1 = "button";
|
|
600
|
-
if ($[5] !==
|
|
602
|
+
if ($[5] !== children || $[6] !== label || $[7] !== render) {
|
|
601
603
|
t2 = render ?? /* @__PURE__ */ jsx(Button, {
|
|
602
604
|
variant: "tertiary",
|
|
603
605
|
size: "sm",
|
|
604
606
|
iconOnly: true,
|
|
605
|
-
icon:
|
|
607
|
+
icon: children,
|
|
606
608
|
label
|
|
607
609
|
});
|
|
608
|
-
$[5] =
|
|
609
|
-
$[6] =
|
|
610
|
-
$[7] =
|
|
611
|
-
|
|
612
|
-
|
|
610
|
+
$[5] = children;
|
|
611
|
+
$[6] = label;
|
|
612
|
+
$[7] = render;
|
|
613
|
+
$[8] = t2;
|
|
614
|
+
} else t2 = $[8];
|
|
615
|
+
t3 = mergeProps({
|
|
616
|
+
type: "button",
|
|
617
|
+
children: render === void 0 ? void 0 : children
|
|
618
|
+
}, props);
|
|
613
619
|
$[0] = t0;
|
|
614
620
|
$[1] = t1;
|
|
615
621
|
$[2] = t2;
|
|
@@ -622,44 +628,46 @@ var MessageFilesDownloadAll = (t0) => {
|
|
|
622
628
|
t4 = $[4];
|
|
623
629
|
}
|
|
624
630
|
let t5;
|
|
625
|
-
if ($[
|
|
631
|
+
if ($[9] !== t1 || $[10] !== t2 || $[11] !== t3) {
|
|
626
632
|
t5 = {
|
|
627
633
|
defaultTagName: t1,
|
|
628
634
|
render: t2,
|
|
629
635
|
props: t3
|
|
630
636
|
};
|
|
631
|
-
$[
|
|
632
|
-
$[
|
|
633
|
-
$[
|
|
634
|
-
$[
|
|
635
|
-
} else t5 = $[
|
|
637
|
+
$[9] = t1;
|
|
638
|
+
$[10] = t2;
|
|
639
|
+
$[11] = t3;
|
|
640
|
+
$[12] = t5;
|
|
641
|
+
} else t5 = $[12];
|
|
636
642
|
return t4(t5);
|
|
637
643
|
};
|
|
638
|
-
/** An icon button, pinned to the log's bottom corner, that jumps to the latest message. */
|
|
644
|
+
/** An icon button, pinned to the log's bottom corner, that jumps to the latest message; its children are the glyph. */
|
|
639
645
|
var ScrollToBottom = (t0) => {
|
|
640
|
-
const $ = c(
|
|
646
|
+
const $ = c(13);
|
|
641
647
|
let t1;
|
|
642
648
|
let t2;
|
|
643
649
|
let t3;
|
|
644
650
|
let t4;
|
|
645
651
|
if ($[0] !== t0) {
|
|
646
|
-
const { label, className, render, ...props } = t0;
|
|
652
|
+
const { label, children, className, render, ...props } = t0;
|
|
647
653
|
t4 = useRender;
|
|
648
654
|
t1 = "button";
|
|
649
|
-
if ($[5] !==
|
|
655
|
+
if ($[5] !== children || $[6] !== label || $[7] !== render) {
|
|
650
656
|
t2 = render ?? /* @__PURE__ */ jsx(Button, {
|
|
651
657
|
variant: "tertiary",
|
|
652
658
|
iconOnly: true,
|
|
653
|
-
icon:
|
|
659
|
+
icon: children,
|
|
654
660
|
label
|
|
655
661
|
});
|
|
656
|
-
$[5] =
|
|
657
|
-
$[6] =
|
|
658
|
-
$[7] =
|
|
659
|
-
|
|
662
|
+
$[5] = children;
|
|
663
|
+
$[6] = label;
|
|
664
|
+
$[7] = render;
|
|
665
|
+
$[8] = t2;
|
|
666
|
+
} else t2 = $[8];
|
|
660
667
|
t3 = mergeProps({
|
|
661
668
|
type: "button",
|
|
662
|
-
className: clsx(conversation_module_default.scrollToBottom, className)
|
|
669
|
+
className: clsx(conversation_module_default.scrollToBottom, className),
|
|
670
|
+
children: render === void 0 ? void 0 : children
|
|
663
671
|
}, props);
|
|
664
672
|
$[0] = t0;
|
|
665
673
|
$[1] = t1;
|
|
@@ -673,17 +681,17 @@ var ScrollToBottom = (t0) => {
|
|
|
673
681
|
t4 = $[4];
|
|
674
682
|
}
|
|
675
683
|
let t5;
|
|
676
|
-
if ($[
|
|
684
|
+
if ($[9] !== t1 || $[10] !== t2 || $[11] !== t3) {
|
|
677
685
|
t5 = {
|
|
678
686
|
defaultTagName: t1,
|
|
679
687
|
render: t2,
|
|
680
688
|
props: t3
|
|
681
689
|
};
|
|
682
|
-
$[
|
|
683
|
-
$[
|
|
684
|
-
$[
|
|
685
|
-
$[
|
|
686
|
-
} else t5 = $[
|
|
690
|
+
$[9] = t1;
|
|
691
|
+
$[10] = t2;
|
|
692
|
+
$[11] = t3;
|
|
693
|
+
$[12] = t5;
|
|
694
|
+
} else t5 = $[12];
|
|
687
695
|
return t4(t5);
|
|
688
696
|
};
|
|
689
697
|
/** What the log shows before there are any messages. */
|
|
@@ -724,24 +732,121 @@ var EmptyState = (t0) => {
|
|
|
724
732
|
} else t5 = $[8];
|
|
725
733
|
return t4(t5);
|
|
726
734
|
};
|
|
735
|
+
var Prefab = (t0) => {
|
|
736
|
+
const $ = c(24);
|
|
737
|
+
let children;
|
|
738
|
+
let empty;
|
|
739
|
+
let lineClamp;
|
|
740
|
+
let messages;
|
|
741
|
+
let props;
|
|
742
|
+
let readLabel;
|
|
743
|
+
let todayLabel;
|
|
744
|
+
let unreadLabel;
|
|
745
|
+
let yesterdayLabel;
|
|
746
|
+
if ($[0] !== t0) {
|
|
747
|
+
({messages, todayLabel, yesterdayLabel, readLabel, unreadLabel, lineClamp, empty, children, ...props} = t0);
|
|
748
|
+
$[0] = t0;
|
|
749
|
+
$[1] = children;
|
|
750
|
+
$[2] = empty;
|
|
751
|
+
$[3] = lineClamp;
|
|
752
|
+
$[4] = messages;
|
|
753
|
+
$[5] = props;
|
|
754
|
+
$[6] = readLabel;
|
|
755
|
+
$[7] = todayLabel;
|
|
756
|
+
$[8] = unreadLabel;
|
|
757
|
+
$[9] = yesterdayLabel;
|
|
758
|
+
} else {
|
|
759
|
+
children = $[1];
|
|
760
|
+
empty = $[2];
|
|
761
|
+
lineClamp = $[3];
|
|
762
|
+
messages = $[4];
|
|
763
|
+
props = $[5];
|
|
764
|
+
readLabel = $[6];
|
|
765
|
+
todayLabel = $[7];
|
|
766
|
+
unreadLabel = $[8];
|
|
767
|
+
yesterdayLabel = $[9];
|
|
768
|
+
}
|
|
769
|
+
const days = groupByDay(messages, _temp, useTimeZone());
|
|
770
|
+
let t1;
|
|
771
|
+
if ($[10] !== readLabel || $[11] !== unreadLabel) {
|
|
772
|
+
t1 = {
|
|
773
|
+
read: readLabel,
|
|
774
|
+
unread: unreadLabel
|
|
775
|
+
};
|
|
776
|
+
$[10] = readLabel;
|
|
777
|
+
$[11] = unreadLabel;
|
|
778
|
+
$[12] = t1;
|
|
779
|
+
} else t1 = $[12];
|
|
780
|
+
const statusLabel = t1;
|
|
781
|
+
const T0 = Root;
|
|
782
|
+
const t2 = days.length === 0 && empty !== void 0 ? /* @__PURE__ */ jsx(EmptyState, { children: empty }) : null;
|
|
783
|
+
let t3;
|
|
784
|
+
if ($[13] !== lineClamp || $[14] !== statusLabel || $[15] !== todayLabel || $[16] !== yesterdayLabel) {
|
|
785
|
+
t3 = (day) => /* @__PURE__ */ jsxs(Group, { children: [/* @__PURE__ */ jsx(DateSeparator, {
|
|
786
|
+
date: day.date,
|
|
787
|
+
todayLabel,
|
|
788
|
+
yesterdayLabel
|
|
789
|
+
}), groupByBurst(day.items, _temp2).map((burst) => {
|
|
790
|
+
const [first] = burst.items;
|
|
791
|
+
const { status } = burst.items.at(-1) ?? first;
|
|
792
|
+
return /* @__PURE__ */ jsxs(Message, {
|
|
793
|
+
side: first.side,
|
|
794
|
+
children: [/* @__PURE__ */ jsxs(MessageAuthor, { children: [
|
|
795
|
+
/* @__PURE__ */ jsx(MessageAvatar, { name: first.authorName }),
|
|
796
|
+
first.authorName,
|
|
797
|
+
/* @__PURE__ */ jsx(MessageTimestamp, { date: first.sentAt }),
|
|
798
|
+
status === void 0 ? null : /* @__PURE__ */ jsx(MessageReadIndicator, {
|
|
799
|
+
status,
|
|
800
|
+
label: statusLabel[status]
|
|
801
|
+
})
|
|
802
|
+
] }), burst.items.map((message_1) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MessageBubble, { children: /* @__PURE__ */ jsx(MessageContent, {
|
|
803
|
+
lineClamp,
|
|
804
|
+
children: message_1.body
|
|
805
|
+
}) }), message_1.files === void 0 ? null : /* @__PURE__ */ jsx(MessageFiles, { children: message_1.files })] }, message_1.id))]
|
|
806
|
+
}, burst.key);
|
|
807
|
+
})] }, day.key);
|
|
808
|
+
$[13] = lineClamp;
|
|
809
|
+
$[14] = statusLabel;
|
|
810
|
+
$[15] = todayLabel;
|
|
811
|
+
$[16] = yesterdayLabel;
|
|
812
|
+
$[17] = t3;
|
|
813
|
+
} else t3 = $[17];
|
|
814
|
+
const t4 = days.map(t3);
|
|
815
|
+
let t5;
|
|
816
|
+
if ($[18] !== T0 || $[19] !== children || $[20] !== props || $[21] !== t2 || $[22] !== t4) {
|
|
817
|
+
t5 = /* @__PURE__ */ jsxs(T0, {
|
|
818
|
+
...props,
|
|
819
|
+
children: [
|
|
820
|
+
t2,
|
|
821
|
+
t4,
|
|
822
|
+
children
|
|
823
|
+
]
|
|
824
|
+
});
|
|
825
|
+
$[18] = T0;
|
|
826
|
+
$[19] = children;
|
|
827
|
+
$[20] = props;
|
|
828
|
+
$[21] = t2;
|
|
829
|
+
$[22] = t4;
|
|
830
|
+
$[23] = t5;
|
|
831
|
+
} else t5 = $[23];
|
|
832
|
+
return t5;
|
|
833
|
+
};
|
|
727
834
|
/**
|
|
728
835
|
* A message thread: a log of day groups, each a run of author bursts with their
|
|
729
|
-
* bubbles, timestamps, read status and files.
|
|
730
|
-
*
|
|
836
|
+
* bubbles, timestamps, read status and files. The prefab groups `messages` by
|
|
837
|
+
* day and by author in the provider's time zone; the parts hanging off it build
|
|
838
|
+
* a log by hand, grouped with `groupByDay` and `groupByBurst`.
|
|
731
839
|
*
|
|
732
840
|
* @example
|
|
733
|
-
* <Conversation
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
* </Conversation.Message>
|
|
741
|
-
* </Conversation.Group>
|
|
742
|
-
* </Conversation.Root>
|
|
841
|
+
* <Conversation
|
|
842
|
+
* messages={messages}
|
|
843
|
+
* todayLabel="Today"
|
|
844
|
+
* yesterdayLabel="Yesterday"
|
|
845
|
+
* readLabel="Read"
|
|
846
|
+
* unreadLabel="Unread"
|
|
847
|
+
* />
|
|
743
848
|
*/
|
|
744
|
-
var Conversation = {
|
|
849
|
+
var Conversation = Object.assign(Prefab, {
|
|
745
850
|
Root,
|
|
746
851
|
EmptyState,
|
|
747
852
|
Group,
|
|
@@ -757,5 +862,11 @@ var Conversation = {
|
|
|
757
862
|
MessageFiles,
|
|
758
863
|
MessageFilesDownloadAll,
|
|
759
864
|
ScrollToBottom
|
|
760
|
-
};
|
|
865
|
+
});
|
|
866
|
+
function _temp(message) {
|
|
867
|
+
return message.sentAt;
|
|
868
|
+
}
|
|
869
|
+
function _temp2(message_0) {
|
|
870
|
+
return message_0.authorId;
|
|
871
|
+
}
|
|
761
872
|
export { Conversation };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ConversationMessageSide, ConversationMessageStatus, } from "./conversation.context.ts";
|
|
2
2
|
export * from "./conversation.tsx";
|
|
3
3
|
export * from "./group-messages.ts";
|
|
4
4
|
export type { ConversationMoment } from "./moment.ts";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { CalendarLabels } from "../../lib/calendar/temporal.tsx";
|
|
2
|
+
import type { CalendarIcons, CalendarLabels } from "../../lib/calendar/temporal.tsx";
|
|
3
3
|
import { type FieldBlurHandler, type FieldProps } from "../field/index.ts";
|
|
4
|
-
export type DateFieldProps = FieldProps & CalendarLabels & Readonly<{
|
|
4
|
+
export type DateFieldProps = FieldProps & CalendarLabels & CalendarIcons & Readonly<{
|
|
5
5
|
/** Accessible name of the button that opens the calendar, such as "Open calendar". */
|
|
6
6
|
openCalendarLabel: string;
|
|
7
|
+
/** The icon of the button that opens the calendar. */
|
|
8
|
+
openCalendarIcon: ReactNode;
|
|
7
9
|
/**
|
|
8
10
|
* An ISO plain date, such as `"2026-07-24"`. A date-time or an instant is
|
|
9
11
|
* read as the day it falls on in the `TimeZoneProvider`'s zone.
|
|
@@ -30,7 +32,7 @@ export type DateFieldProps = FieldProps & CalendarLabels & Readonly<{
|
|
|
30
32
|
*
|
|
31
33
|
* @example
|
|
32
34
|
* <DateField
|
|
33
|
-
* label="
|
|
35
|
+
* label="Service date"
|
|
34
36
|
* optionalLabel="optional"
|
|
35
37
|
* openCalendarLabel="Open calendar"
|
|
36
38
|
* previousMonthLabel="Previous month"
|
|
@@ -38,8 +40,12 @@ export type DateFieldProps = FieldProps & CalendarLabels & Readonly<{
|
|
|
38
40
|
* monthLabel="Month"
|
|
39
41
|
* yearLabel="Year"
|
|
40
42
|
* noMatchingYearLabel="No matching year."
|
|
43
|
+
* openCalendarIcon={<CalendarTodayIcon />}
|
|
44
|
+
* previousIcon={<ChevronLeftIcon />}
|
|
45
|
+
* nextIcon={<ChevronRightIcon />}
|
|
46
|
+
* checkIcon={<CheckIcon />}
|
|
41
47
|
* value={date}
|
|
42
48
|
* onValueChange={setDate}
|
|
43
49
|
* />
|
|
44
50
|
*/
|
|
45
|
-
export declare const DateField: ({ label, description, errors, requiredness, optionalLabel, dirty, touched, pending, openCalendarLabel, previousMonthLabel, nextMonthLabel, monthLabel, yearLabel, noMatchingYearLabel, value, defaultValue, onValueChange, onBlur, minValue, maxValue, name, disabled, readOnly, className, }: DateFieldProps) => ReactNode;
|
|
51
|
+
export declare const DateField: ({ label, description, errors, requiredness, optionalLabel, dirty, touched, pending, openCalendarLabel, previousMonthLabel, nextMonthLabel, monthLabel, yearLabel, noMatchingYearLabel, openCalendarIcon, previousIcon, nextIcon, checkIcon, expandIcon, value, defaultValue, onValueChange, onBlur, minValue, maxValue, name, disabled, readOnly, className, }: DateFieldProps) => ReactNode;
|