datocms-react-ui 3.1.0-next.6 → 4.0.0-next.7
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 +2 -1
- package/dist/DateInput.d.ts +2 -0
- package/dist/DateInput.js +2 -0
- package/dist/DateTimeInput.d.ts +2 -0
- package/dist/DateTimeInput.js +2 -0
- package/dist/DateTimeRangeInput.d.ts +2 -0
- package/dist/DateTimeRangeInput.js +2 -0
- package/dist/FilterBuilder.d.ts +2 -0
- package/dist/FilterBuilder.js +2 -0
- package/dist/RecordRow.d.ts +2 -0
- package/dist/RecordRow.js +2 -0
- package/dist/UploadCard.js +2 -2
- package/dist/UploadPreview.d.ts +2 -2
- package/dist/UploadPreview.js +1 -1
- package/dist/UserRow.d.ts +2 -0
- package/dist/UserRow.js +2 -0
- package/dist/react-ui/src/Canvas.d.ts +7 -1
- package/dist/react-ui/src/Canvas.js +26 -4
- package/dist/react-ui/src/ctxAnswer.js +21 -0
- package/dist/react-ui/src/ctxDateSettings.js +7 -5
- package/dist/react-ui/src/ctxRecordPresentation.js +34 -0
- package/dist/react-ui/src/ctxUploads.js +23 -0
- package/dist/styles.css +592 -11
- package/dist/ui-public/icons/index.js +79 -81
- package/dist/ui-public/locales/en.js +43 -5
- package/dist/ui-public/src/Message.d.ts +3 -4
- package/dist/ui-public/src/UiTextKey.d.ts +1 -1
- package/dist/ui-public/src/actions/Actions/ActionTooltip.js +1 -1
- package/dist/ui-public/src/actions/Actions/registry.d.ts +2 -2
- package/dist/ui-public/src/actions/Actions/registry.js +2 -2
- package/dist/ui-public/src/actions/Button.d.ts +10 -10
- package/dist/ui-public/src/actions/Button.js +1 -1
- package/dist/ui-public/src/actions/Dropdown/Menu.d.ts +2 -2
- package/dist/ui-public/src/actions/Dropdown/Option.d.ts +7 -7
- package/dist/ui-public/src/actions/Dropdown/index.d.ts +1 -1
- package/dist/ui-public/src/actions/Dropdown/triggers/ButtonTrigger.d.ts +5 -5
- package/dist/ui-public/src/actions/Dropdown/triggers/DropdownTriggerButton.d.ts +2 -2
- package/dist/ui-public/src/actions/Dropdown/triggers/IconTrigger.d.ts +6 -6
- package/dist/ui-public/src/actions/Dropdown/triggers/IconTrigger.js +1 -1
- package/dist/ui-public/src/actions/EditorToolbar/Button.d.ts +1 -1
- package/dist/ui-public/src/actions/MultipleSelectionActionBar.d.ts +1 -1
- package/dist/ui-public/src/actions/SplitButton/Caret.js +2 -2
- package/dist/ui-public/src/actions/SplitButton/Halves.js +1 -1
- package/dist/ui-public/src/actions/SplitButton/index.d.ts +3 -3
- package/dist/ui-public/src/actions/disabledReason.d.ts +4 -4
- package/dist/ui-public/src/content/Avatar.d.ts +3 -3
- package/dist/ui-public/src/content/Avatar.js +2 -2
- package/dist/ui-public/src/content/CodeSnippet.d.ts +1 -1
- package/dist/ui-public/src/content/CopyableValue.d.ts +1 -1
- package/dist/ui-public/src/content/EnvironmentPill.d.ts +1 -1
- package/dist/ui-public/src/content/EnvironmentPill.js +1 -1
- package/dist/ui-public/src/content/IconAvatar.d.ts +1 -1
- package/dist/ui-public/src/content/ItemStatus.d.ts +1 -1
- package/dist/ui-public/src/content/Pill.d.ts +1 -1
- package/dist/ui-public/src/content/SmartDate.d.ts +1 -1
- package/dist/ui-public/src/content/UploadPreview/asset.js +200 -0
- package/dist/ui-public/src/content/UploadPreview/audio.js +120 -0
- package/dist/ui-public/src/content/{UploadPreview.d.ts → UploadPreview/box.d.ts} +10 -10
- package/dist/ui-public/src/content/{UploadPreview.js → UploadPreview/box.js} +7 -7
- package/dist/ui-public/src/content/{uploadPreviewFit.d.ts → UploadPreview/fit.d.ts} +2 -2
- package/dist/ui-public/src/content/{uploadPreviewFit.js → UploadPreview/fit.js} +3 -3
- package/dist/ui-public/src/content/UploadPreview/index.d.ts +61 -0
- package/dist/ui-public/src/content/UploadPreview/index.js +36 -0
- package/dist/ui-public/src/content/UploadPreview/presentation.js +63 -0
- package/dist/ui-public/src/content/UploadPreview/thumbhash.js +91 -0
- package/dist/ui-public/src/content/UploadPreview/upload.d.ts +104 -0
- package/dist/ui-public/src/content/UploadPreview/upload.js +112 -0
- package/dist/ui-public/src/content/UsageMeter.d.ts +1 -1
- package/dist/ui-public/src/content/ValidityTriangles.d.ts +1 -1
- package/dist/ui-public/src/feedback/BlankSlate.d.ts +5 -5
- package/dist/ui-public/src/feedback/Callout.d.ts +5 -5
- package/dist/ui-public/src/feedback/Callout.js +1 -1
- package/dist/ui-public/src/feedback/ProgressBar.d.ts +4 -4
- package/dist/ui-public/src/feedback/Spinner.d.ts +6 -6
- package/dist/ui-public/src/feedback/Spinner.js +1 -1
- package/dist/ui-public/src/form/DateInput.d.ts +13 -0
- package/dist/ui-public/src/form/DateInput.js +16 -0
- package/dist/ui-public/src/form/DateTimeInput/Base.d.ts +89 -0
- package/dist/ui-public/src/form/DateTimeInput/Base.js +330 -0
- package/dist/ui-public/src/form/DateTimeInput/CalendarGrid.d.ts +29 -0
- package/dist/ui-public/src/form/DateTimeInput/CalendarGrid.js +195 -0
- package/dist/ui-public/src/form/DateTimeInput/dateText.js +38 -0
- package/dist/ui-public/src/form/DateTimeInput/index.d.ts +10 -0
- package/dist/ui-public/src/form/DateTimeInput/index.js +18 -0
- package/dist/ui-public/src/form/DateTimeInput/value.js +31 -0
- package/dist/ui-public/src/form/DateTimeRangeInput/Panel.js +167 -0
- package/dist/ui-public/src/form/DateTimeRangeInput/index.d.ts +123 -0
- package/dist/ui-public/src/form/DateTimeRangeInput/index.js +186 -0
- package/dist/ui-public/src/form/DateTimeRangeInput/rangeLabel.js +46 -0
- package/dist/ui-public/src/form/FieldHint.d.ts +2 -2
- package/dist/ui-public/src/form/FieldWrapper.d.ts +9 -9
- package/dist/ui-public/src/form/FieldWrapper.js +3 -3
- package/dist/ui-public/src/form/FilterBuilder/Editor.js +123 -0
- package/dist/ui-public/src/form/FilterBuilder/index.d.ts +9 -0
- package/dist/ui-public/src/form/FilterBuilder/index.js +294 -0
- package/dist/ui-public/src/form/FilterBuilder/types.d.ts +188 -0
- package/dist/ui-public/src/form/FilterBuilder/values.js +86 -0
- package/dist/ui-public/src/form/InputGroup.d.ts +2 -2
- package/dist/ui-public/src/form/InputGroup.js +1 -1
- package/dist/ui-public/src/form/KeyValueList.d.ts +1 -1
- package/dist/ui-public/src/form/Label.d.ts +2 -2
- package/dist/ui-public/src/form/RadioGroupInput.d.ts +2 -2
- package/dist/ui-public/src/form/RadioGroupInput.js +1 -1
- package/dist/ui-public/src/form/SelectInput/SelectMenu.d.ts +2 -2
- package/dist/ui-public/src/form/SelectInput/index.d.ts +3 -3
- package/dist/ui-public/src/form/SwitchInput.d.ts +2 -2
- package/dist/ui-public/src/form/SwitchList.d.ts +1 -1
- package/dist/ui-public/src/form/SwitchList.js +1 -1
- package/dist/ui-public/src/form/TableList.d.ts +2 -2
- package/dist/ui-public/src/form/TextareaInput.js +1 -1
- package/dist/ui-public/src/form/inputProps.d.ts +6 -6
- package/dist/ui-public/src/hooks/useAsyncSelectOptions.d.ts +1 -1
- package/dist/ui-public/src/hooks/useSmartRowClick.d.ts +1 -1
- package/dist/ui-public/src/hooks/useSmartRowClick.js +1 -1
- package/dist/ui-public/src/layout/Page/PageGroup.d.ts +2 -2
- package/dist/ui-public/src/layout/Page/PageGroup.js +1 -1
- package/dist/ui-public/src/layout/Pane/FormHeader.d.ts +1 -1
- package/dist/ui-public/src/layout/Pane/FormHeader.js +1 -1
- package/dist/ui-public/src/layout/Pane/ListFilter.d.ts +1 -1
- package/dist/ui-public/src/layout/Pane/ListPresets.d.ts +1 -1
- package/dist/ui-public/src/layout/Pane/PaneHeader.d.ts +1 -1
- package/dist/ui-public/src/layout/Pane/index.d.ts +2 -2
- package/dist/ui-public/src/layout/SidebarPanel.d.ts +1 -1
- package/dist/ui-public/src/layout/SplitPane/Rail.js +1 -1
- package/dist/ui-public/src/layout/SplitPane/index.d.ts +6 -6
- package/dist/ui-public/src/layout/Toolbar/AddNewButton.d.ts +2 -2
- package/dist/ui-public/src/layout/Toolbar/Help.d.ts +3 -3
- package/dist/ui-public/src/layout/Toolbar/Help.js +2 -2
- package/dist/ui-public/src/layout/Toolbar/Note.d.ts +1 -1
- package/dist/ui-public/src/layout/Toolbar/Note.js +1 -1
- package/dist/ui-public/src/layout/Toolbar/Pagination.d.ts +1 -1
- package/dist/ui-public/src/layout/Toolbar/Pagination.js +1 -1
- package/dist/ui-public/src/layout/Toolbar/PresetsTitle.d.ts +3 -3
- package/dist/ui-public/src/layout/Toolbar/PresetsTitle.js +2 -2
- package/dist/ui-public/src/layout/Toolbar/PrimaryButton.d.ts +3 -3
- package/dist/ui-public/src/layout/Toolbar/Root.d.ts +1 -1
- package/dist/ui-public/src/layout/Toolbar/Root.js +4 -1
- package/dist/ui-public/src/layout/Toolbar/ToolbarTitleTrigger.js +1 -1
- package/dist/ui-public/src/lists/CardList.d.ts +3 -3
- package/dist/ui-public/src/lists/EmptySlot.d.ts +1 -1
- package/dist/ui-public/src/lists/InfoList/User.d.ts +1 -1
- package/dist/ui-public/src/lists/InfoList/Value.d.ts +1 -1
- package/dist/ui-public/src/lists/InfoList/Value.js +1 -1
- package/dist/ui-public/src/lists/InfoList/index.d.ts +3 -3
- package/dist/ui-public/src/lists/InfoList/index.js +1 -1
- package/dist/ui-public/src/lists/MediaCard.d.ts +7 -7
- package/dist/ui-public/src/lists/RecordRow/Image.d.ts +24 -0
- package/dist/ui-public/src/lists/RecordRow/Image.js +22 -0
- package/dist/ui-public/src/lists/RecordRow/List.d.ts +26 -0
- package/dist/ui-public/src/lists/RecordRow/List.js +30 -0
- package/dist/ui-public/src/lists/RecordRow/context.js +31 -0
- package/dist/ui-public/src/lists/RecordRow/index.d.ts +94 -0
- package/dist/ui-public/src/lists/RecordRow/index.js +122 -0
- package/dist/ui-public/src/lists/RecordRow/presentation.js +73 -0
- package/dist/ui-public/src/lists/RecordRow/types.d.ts +58 -0
- package/dist/ui-public/src/lists/RowList.d.ts +5 -5
- package/dist/ui-public/src/lists/SettingsList.d.ts +3 -3
- package/dist/ui-public/src/lists/SettingsList.js +2 -2
- package/dist/ui-public/src/lists/Table/Row.d.ts +5 -5
- package/dist/ui-public/src/lists/Table/Table.d.ts +3 -3
- package/dist/ui-public/src/lists/Table/TreeToggle.d.ts +2 -2
- package/dist/ui-public/src/lists/Table/TreeToggle.js +1 -1
- package/dist/ui-public/src/lists/Table/cells/LinkCell.d.ts +1 -1
- package/dist/ui-public/src/lists/TreeRow/Action.d.ts +1 -1
- package/dist/ui-public/src/lists/TreeRow/Action.js +1 -1
- package/dist/ui-public/src/lists/TreeRow/Link.d.ts +1 -1
- package/dist/ui-public/src/lists/TreeRow/Link.js +1 -1
- package/dist/ui-public/src/lists/UploadCard.d.ts +66 -3
- package/dist/ui-public/src/lists/UploadCard.js +116 -7
- package/dist/ui-public/src/lists/UserRow.d.ts +122 -0
- package/dist/ui-public/src/lists/UserRow.js +104 -0
- package/dist/ui-public/src/lists/dnd/DragHandle.d.ts +2 -2
- package/dist/ui-public/src/lists/dnd/SortableList.d.ts +1 -1
- package/dist/ui-public/src/lists/dnd/dropTargetClassName.d.ts +1 -1
- package/dist/ui-public/src/lists/dnd/tree/SortableTree.d.ts +2 -2
- package/dist/ui-public/src/navigation/Chevron.d.ts +4 -4
- package/dist/ui-public/src/navigation/Chevron.js +1 -1
- package/dist/ui-public/src/navigation/Link.d.ts +5 -5
- package/dist/ui-public/src/navigation/Link.js +1 -1
- package/dist/ui-public/src/navigation/NavList.d.ts +1 -1
- package/dist/ui-public/src/navigation/NavList.js +1 -1
- package/dist/ui-public/src/navigation/NavigationProvider.d.ts +1 -1
- package/dist/ui-public/src/navigation/SegmentedControl.d.ts +2 -2
- package/dist/ui-public/src/navigation/SettingsMenu.d.ts +8 -8
- package/dist/ui-public/src/navigation/SettingsMenu.js +1 -1
- package/dist/ui-public/src/navigation/SidebarTree/SidebarTreeNode.d.ts +4 -4
- package/dist/ui-public/src/overlays/FullscreenModal/TitleContext.d.ts +1 -1
- package/dist/ui-public/src/overlays/FullscreenModal/TitleContext.js +1 -1
- package/dist/ui-public/src/overlays/NewZIndex.d.ts +1 -1
- package/dist/ui-public/src/overlays/NewZIndex.js +1 -1
- package/dist/ui-public/src/overlays/Popover.d.ts +1 -1
- package/dist/ui-public/src/overlays/PortalWrapper.js +1 -1
- package/dist/ui-public/src/overlays/useModalClose.js +3 -3
- package/dist/ui-public/src/patterns/ListDetail/FloatingDetail.js +2 -2
- package/dist/ui-public/src/patterns/ListDetail/Page.d.ts +8 -9
- package/dist/ui-public/src/patterns/ListDetail/Page.js +4 -5
- package/dist/ui-public/src/patterns/ListDetail/Panel.d.ts +2 -2
- package/dist/ui-public/src/patterns/ListDetail/Panel.js +1 -1
- package/dist/ui-public/src/patterns/ListDetail/Split.d.ts +9 -10
- package/dist/ui-public/src/patterns/ListDetail/Split.js +5 -5
- package/dist/ui-public/src/patterns/ListFormPage.d.ts +3 -3
- package/dist/ui-public/src/patterns/ListFormPage.js +1 -1
- package/dist/ui-public/src/semantic/Heading.d.ts +1 -1
- package/dist/ui-public/src/semantic/Heading.js +1 -1
- package/dist/ui-public/src/semantic/Image.js +1 -1
- package/dist/ui-public/src/semantic/Nav.d.ts +3 -3
- package/dist/ui-public/src/semantic/Nav.js +3 -3
- package/dist/ui-public/src/semantic/RawButton.d.ts +3 -3
- package/dist/ui-public/src/semantic/RawButton.js +1 -1
- package/dist/ui-public/src/semantic/Search.d.ts +1 -1
- package/dist/ui-public/src/semantic/Search.js +1 -1
- package/dist/ui-public/src/utils/format.d.ts +21 -0
- package/dist/ui-public/src/utils/format.js +20 -0
- package/dist/ui-public/src/utils/formatDate.d.ts +10 -2
- package/dist/ui-public/src/utils/formatDate.js +4 -4
- package/dist/ui-public/src/utils/tickBatcher.js +44 -0
- package/dist/ui-public/src/utils/timezones.js +277 -0
- package/dist/ui-public/src/utils/weekStartForLocale.js +25 -0
- package/dist/utils/format.d.ts +1 -0
- package/dist/utils/format.js +2 -0
- package/package.json +2 -2
- package/dist/ui-public/icons/lucide/receipt.js +0 -26
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import type { BoxSize, UploadPreviewPadding } from '../content/UploadPreview/fit.js';
|
|
3
|
+
import { type UploadFieldValue, type UploadPreviewUpload } from '../content/UploadPreview/upload.js';
|
|
2
4
|
import { type MediaCardCaption, type MediaCardProps } from './MediaCard.js';
|
|
3
5
|
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
4
6
|
/** The upload of the asset, while it is in progress */
|
|
@@ -15,7 +17,10 @@ export type UploadCardProgress = {
|
|
|
15
17
|
*/
|
|
16
18
|
onCancel?: (event: React.MouseEvent) => void;
|
|
17
19
|
};
|
|
18
|
-
|
|
20
|
+
type CardProps = DistributiveOmit<MediaCardProps, 'caption' | 'captionAction' | 'children'>;
|
|
21
|
+
/** Mode "preview": you give the preview and the caption of the asset. */
|
|
22
|
+
export type UploadCardPreviewModeProps = CardProps & {
|
|
23
|
+
upload?: never;
|
|
19
24
|
/** The preview of the asset, an `UploadPreview` */
|
|
20
25
|
children: ReactNode;
|
|
21
26
|
/**
|
|
@@ -25,12 +30,56 @@ export type UploadCardProps = DistributiveOmit<MediaCardProps, 'caption' | 'capt
|
|
|
25
30
|
caption?: MediaCardCaption;
|
|
26
31
|
/**
|
|
27
32
|
* The asset uploads. The caption shows in the subtle ink. Without a
|
|
28
|
-
* caption, the caption
|
|
33
|
+
* caption, the caption shows the percent or the analysis.
|
|
29
34
|
*/
|
|
30
35
|
progress?: UploadCardProgress;
|
|
31
36
|
/** The antivirus found a threat in the file: the card shows a badge. */
|
|
32
37
|
threatDetected?: boolean;
|
|
33
38
|
};
|
|
39
|
+
export type { UploadFieldValue } from '../content/UploadPreview/upload.js';
|
|
40
|
+
/**
|
|
41
|
+
* Mode "upload": the card shows an asset of the Media Area, as DatoCMS
|
|
42
|
+
* shows it, with its preview, its caption and the antivirus badge. A sound
|
|
43
|
+
* file gets a play action.
|
|
44
|
+
*/
|
|
45
|
+
export type UploadCardUploadModeProps = CardProps & {
|
|
46
|
+
/**
|
|
47
|
+
* The asset as `ctx` gives it, or its ID. An ID loads through the
|
|
48
|
+
* provider of the host: `Canvas` mounts it. `null` is an asset that does
|
|
49
|
+
* not exist: the preview shows a blank file icon.
|
|
50
|
+
*/
|
|
51
|
+
upload: string | UploadPreviewUpload | null;
|
|
52
|
+
/**
|
|
53
|
+
* The locale of the default metadata of the asset, for the caption, for
|
|
54
|
+
* example the locale of the field. When it has no value, the caption uses
|
|
55
|
+
* the main locale of the project, which the provider of the host gives.
|
|
56
|
+
*/
|
|
57
|
+
preferredLocale?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The value of the field that holds the asset. Its title and alternate
|
|
60
|
+
* text come before the default metadata of the asset, and its
|
|
61
|
+
* `poster_time` gives the frame of a video.
|
|
62
|
+
*/
|
|
63
|
+
fieldValue?: UploadFieldValue;
|
|
64
|
+
/**
|
|
65
|
+
* The text below the preview. Without it, the card computes it with
|
|
66
|
+
* `uploadCardCaption`. `null` shows no caption.
|
|
67
|
+
*/
|
|
68
|
+
caption?: MediaCardCaption | null;
|
|
69
|
+
/** The size of the preview, in px. Without it, the CSS gives the size. */
|
|
70
|
+
box?: BoxSize;
|
|
71
|
+
/** The space around the asset in the preview, as in `UploadPreview`. */
|
|
72
|
+
padding?: UploadPreviewPadding;
|
|
73
|
+
/** The preview is a link. */
|
|
74
|
+
link?: {
|
|
75
|
+
href: string;
|
|
76
|
+
target?: string;
|
|
77
|
+
};
|
|
78
|
+
children?: never;
|
|
79
|
+
progress?: never;
|
|
80
|
+
threatDetected?: never;
|
|
81
|
+
};
|
|
82
|
+
export type UploadCardProps = UploadCardPreviewModeProps | UploadCardUploadModeProps;
|
|
34
83
|
/** The metadata of an asset that give its caption */
|
|
35
84
|
export type UploadCaptionMetadata = {
|
|
36
85
|
/** The title of the asset in the record */
|
|
@@ -51,9 +100,23 @@ export type UploadCaptionMetadata = {
|
|
|
51
100
|
* or no `defaultTitle`.
|
|
52
101
|
*/
|
|
53
102
|
export declare function uploadCaption({ title, alt, defaultTitle, defaultAlt, filename, }: UploadCaptionMetadata): MediaCardCaption;
|
|
103
|
+
/**
|
|
104
|
+
* The caption of an asset in a card, as the gallery field of DatoCMS shows
|
|
105
|
+
* it: the metadata of the value of the field, then the default metadata of
|
|
106
|
+
* the asset in `preferredLocale`, then in `mainLocale`. A sound file falls
|
|
107
|
+
* back to its file name. `UploadCard` takes `mainLocale` from the provider
|
|
108
|
+
* of the host. Give it when you call this function outside a `Canvas`.
|
|
109
|
+
*/
|
|
110
|
+
export declare function uploadCardCaption(upload: UploadPreviewUpload, { preferredLocale, mainLocale, fieldValue, }?: {
|
|
111
|
+
preferredLocale?: string;
|
|
112
|
+
/** The main locale of the project: the first of `ctx.site.attributes.locales` */
|
|
113
|
+
mainLocale?: string;
|
|
114
|
+
fieldValue?: UploadFieldValue;
|
|
115
|
+
}): MediaCardCaption;
|
|
54
116
|
/**
|
|
55
117
|
* The card of an asset: a `MediaCard` with the preview of the asset, its
|
|
56
|
-
* caption, the progress of its upload and the antivirus badge.
|
|
118
|
+
* caption, the progress of its upload and the antivirus badge. With
|
|
119
|
+
* `upload`, the card gets them from an asset of the Media Area.
|
|
57
120
|
*/
|
|
58
121
|
declare const UploadCard: React.ForwardRefExoticComponent<UploadCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
59
122
|
export default UploadCard;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Generic, Status } from "../../icons/index.js";
|
|
2
2
|
import { useTranslation } from "../i18n.js";
|
|
3
|
+
import { useLoadedUpload, useUploadMainLocale } from "../content/UploadPreview/presentation.js";
|
|
3
4
|
import Button from "../actions/Button.js";
|
|
4
5
|
import MediaCard from "./MediaCard.js";
|
|
5
|
-
import {
|
|
6
|
+
import { useAudioPlayback } from "../content/UploadPreview/audio.js";
|
|
7
|
+
import { uploadDefaultMetadata } from "../content/UploadPreview/upload.js";
|
|
8
|
+
import { UploadAssetPreview } from "../content/UploadPreview/asset.js";
|
|
9
|
+
import { forwardRef, useMemo } from "react";
|
|
6
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
11
|
//#region ../ui-public/src/lists/UploadCard.tsx
|
|
8
12
|
/**
|
|
@@ -20,11 +24,7 @@ function uploadCaption({ title, alt, defaultTitle, defaultAlt, filename }) {
|
|
|
20
24
|
function hasCheckbox(props) {
|
|
21
25
|
return !!props.selection?.checkbox;
|
|
22
26
|
}
|
|
23
|
-
|
|
24
|
-
* The card of an asset: a `MediaCard` with the preview of the asset, its
|
|
25
|
-
* caption, the progress of its upload and the antivirus badge.
|
|
26
|
-
*/
|
|
27
|
-
var UploadCard = forwardRef(function UploadCard({ children, caption, progress, threatDetected, ...mediaCardProps }, ref) {
|
|
27
|
+
var PreviewModeCard = forwardRef(function PreviewModeCard({ children, caption, progress, threatDetected, upload: _, ...mediaCardProps }, ref) {
|
|
28
28
|
const { tm } = useTranslation();
|
|
29
29
|
const progressText = progress ? progress.percent < 100 ? {
|
|
30
30
|
id: "imageMetadata.uploadInProgress",
|
|
@@ -62,5 +62,114 @@ var UploadCard = forwardRef(function UploadCard({ children, caption, progress, t
|
|
|
62
62
|
}), children]
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
+
/**
|
|
66
|
+
* The caption of an asset in a card, as the gallery field of DatoCMS shows
|
|
67
|
+
* it: the metadata of the value of the field, then the default metadata of
|
|
68
|
+
* the asset in `preferredLocale`, then in `mainLocale`. A sound file falls
|
|
69
|
+
* back to its file name. `UploadCard` takes `mainLocale` from the provider
|
|
70
|
+
* of the host. Give it when you call this function outside a `Canvas`.
|
|
71
|
+
*/
|
|
72
|
+
function uploadCardCaption(upload, { preferredLocale, mainLocale, fieldValue } = {}) {
|
|
73
|
+
const locales = [preferredLocale, mainLocale].filter((locale) => !!locale);
|
|
74
|
+
const defaults = uploadDefaultMetadata(upload, locales);
|
|
75
|
+
return uploadCaption({
|
|
76
|
+
title: fieldValue?.title,
|
|
77
|
+
alt: fieldValue?.alt,
|
|
78
|
+
defaultTitle: defaults.title,
|
|
79
|
+
defaultAlt: defaults.alt,
|
|
80
|
+
filename: upload.attributes.mime_type?.startsWith("audio/") ? upload.attributes.filename : null
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function useActionsWithPlay(url, { actions, options, compact }) {
|
|
84
|
+
const playback = useAudioPlayback(url);
|
|
85
|
+
const { isPlaying, toggle } = playback;
|
|
86
|
+
return useMemo(() => {
|
|
87
|
+
if (!url) return {
|
|
88
|
+
playback: void 0,
|
|
89
|
+
actions,
|
|
90
|
+
options
|
|
91
|
+
};
|
|
92
|
+
const play = {
|
|
93
|
+
id: "play",
|
|
94
|
+
icon: isPlaying ? Status.PauseIcon : Status.PlayIcon,
|
|
95
|
+
label: { id: isPlaying ? "audioPlayer.pause" : "audioPlayer.play" },
|
|
96
|
+
onClick: (e) => {
|
|
97
|
+
e?.stopPropagation();
|
|
98
|
+
toggle();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
return compact ? {
|
|
102
|
+
playback,
|
|
103
|
+
actions,
|
|
104
|
+
options: [play, ...options ?? []]
|
|
105
|
+
} : {
|
|
106
|
+
playback,
|
|
107
|
+
actions: [play, ...actions ?? []],
|
|
108
|
+
options
|
|
109
|
+
};
|
|
110
|
+
}, [
|
|
111
|
+
url,
|
|
112
|
+
playback,
|
|
113
|
+
isPlaying,
|
|
114
|
+
toggle,
|
|
115
|
+
actions,
|
|
116
|
+
options,
|
|
117
|
+
compact
|
|
118
|
+
]);
|
|
119
|
+
}
|
|
120
|
+
var UploadModeCard = forwardRef(function UploadModeCard({ upload: uploadOrId, preferredLocale, fieldValue, caption, box, padding, link, ...mediaCardProps }, ref) {
|
|
121
|
+
const upload = useLoadedUpload(uploadOrId);
|
|
122
|
+
const mainLocale = useUploadMainLocale();
|
|
123
|
+
const attributes = upload?.attributes;
|
|
124
|
+
const { playback, actions, options } = useActionsWithPlay(attributes?.mime_type?.startsWith("audio/") && attributes.url ? attributes.url : null, mediaCardProps);
|
|
125
|
+
const cardCaption = caption === null ? void 0 : caption ?? (upload ? uploadCardCaption(upload, {
|
|
126
|
+
preferredLocale,
|
|
127
|
+
mainLocale,
|
|
128
|
+
fieldValue
|
|
129
|
+
}) : upload === null && typeof uploadOrId === "string" ? {
|
|
130
|
+
text: {
|
|
131
|
+
id: "uploadCard.fallbackTitle",
|
|
132
|
+
values: { id: uploadOrId }
|
|
133
|
+
},
|
|
134
|
+
muted: true
|
|
135
|
+
} : upload === void 0 ? {
|
|
136
|
+
text: { id: "uploadCard.loading" },
|
|
137
|
+
muted: true
|
|
138
|
+
} : void 0);
|
|
139
|
+
const cardProps = {
|
|
140
|
+
...mediaCardProps,
|
|
141
|
+
actions,
|
|
142
|
+
options
|
|
143
|
+
};
|
|
144
|
+
return /* @__PURE__ */ jsx(PreviewModeCard, {
|
|
145
|
+
...cardProps,
|
|
146
|
+
ref,
|
|
147
|
+
caption: cardCaption,
|
|
148
|
+
threatDetected: upload?.meta?.antivirus?.status === "infected",
|
|
149
|
+
children: /* @__PURE__ */ jsx(UploadAssetPreview, {
|
|
150
|
+
upload,
|
|
151
|
+
box,
|
|
152
|
+
padding,
|
|
153
|
+
link,
|
|
154
|
+
posterTime: fieldValue?.poster_time ?? void 0,
|
|
155
|
+
audioPlayback: playback
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* The card of an asset: a `MediaCard` with the preview of the asset, its
|
|
161
|
+
* caption, the progress of its upload and the antivirus badge. With
|
|
162
|
+
* `upload`, the card gets them from an asset of the Media Area.
|
|
163
|
+
*/
|
|
164
|
+
var UploadCard = forwardRef(function UploadCard(props, ref) {
|
|
165
|
+
if (props.upload !== void 0) return /* @__PURE__ */ jsx(UploadModeCard, {
|
|
166
|
+
...props,
|
|
167
|
+
ref
|
|
168
|
+
});
|
|
169
|
+
return /* @__PURE__ */ jsx(PreviewModeCard, {
|
|
170
|
+
...props,
|
|
171
|
+
ref
|
|
172
|
+
});
|
|
173
|
+
});
|
|
65
174
|
//#endregion
|
|
66
|
-
export { UploadCard as default, uploadCaption };
|
|
175
|
+
export { UploadCard as default, uploadCaption, uploadCardCaption };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { type Message, type TextMessage } from '../Message.js';
|
|
3
|
+
/**
|
|
4
|
+
* A person as the API gives it, and as `ctx` gives it to a plugin (for
|
|
5
|
+
* example `ctx.currentUser`, `ctx.loadUsers()`): a collaborator, an account,
|
|
6
|
+
* an organization, an SSO user, an API token or an invitation. The row reads
|
|
7
|
+
* only these fields.
|
|
8
|
+
*/
|
|
9
|
+
export type UserRowEntity = {
|
|
10
|
+
type: 'user';
|
|
11
|
+
attributes: {
|
|
12
|
+
full_name?: string | null;
|
|
13
|
+
email: string;
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
type: 'account';
|
|
17
|
+
attributes: {
|
|
18
|
+
first_name?: string | null;
|
|
19
|
+
last_name?: string | null;
|
|
20
|
+
email: string;
|
|
21
|
+
};
|
|
22
|
+
} | {
|
|
23
|
+
type: 'organization';
|
|
24
|
+
attributes: {
|
|
25
|
+
name: string;
|
|
26
|
+
};
|
|
27
|
+
} | {
|
|
28
|
+
type: 'sso_user';
|
|
29
|
+
attributes: {
|
|
30
|
+
first_name?: string | null;
|
|
31
|
+
last_name?: string | null;
|
|
32
|
+
username: string;
|
|
33
|
+
};
|
|
34
|
+
} | {
|
|
35
|
+
type: 'access_token';
|
|
36
|
+
attributes: {
|
|
37
|
+
name?: string | null;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
type: 'site_invitation';
|
|
41
|
+
attributes: {
|
|
42
|
+
email: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/** The data of a person that the row shows */
|
|
46
|
+
export type UserRowPresentation = {
|
|
47
|
+
/** The name. Without it, the email is the title. */
|
|
48
|
+
name: string | null | undefined;
|
|
49
|
+
/** The email. It gives the Gravatar image and the color of the initials. */
|
|
50
|
+
email: string | null | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The URL of the image of the avatar. Without it, the avatar is the
|
|
53
|
+
* Gravatar image of the email, and the initials of the name when the
|
|
54
|
+
* email has no Gravatar image.
|
|
55
|
+
*/
|
|
56
|
+
imageUrl?: string | null;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The name and the email of a person, as DatoCMS shows them. The name falls
|
|
60
|
+
* back to the email. It is null only for an API token without a name: show
|
|
61
|
+
* the kind (`userKindLabel`) in its place.
|
|
62
|
+
*/
|
|
63
|
+
export declare function userPresentation(user: UserRowEntity): {
|
|
64
|
+
name: string | null;
|
|
65
|
+
email: string | null;
|
|
66
|
+
};
|
|
67
|
+
/** The name of the kind of a person, for example "SSO user" */
|
|
68
|
+
export declare function userKindLabel(type: UserRowEntity['type']): TextMessage;
|
|
69
|
+
type Content =
|
|
70
|
+
/** The person as the API gives it */
|
|
71
|
+
{
|
|
72
|
+
/** The person. The row reads its name and its email. */
|
|
73
|
+
user: UserRowEntity;
|
|
74
|
+
/**
|
|
75
|
+
* Shows the kind of the person after the name, for example "SSO
|
|
76
|
+
* user". Use it when the list or the menu mixes people of different
|
|
77
|
+
* kinds.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
showKind?: boolean;
|
|
81
|
+
presentation?: never;
|
|
82
|
+
kind?: never;
|
|
83
|
+
}
|
|
84
|
+
/** The data of the person, already resolved */
|
|
85
|
+
| {
|
|
86
|
+
/** The name, the email and the image of the person */
|
|
87
|
+
presentation: UserRowPresentation;
|
|
88
|
+
/**
|
|
89
|
+
* The kind of person, after the name in the subtle ink. For example
|
|
90
|
+
* "SSO user", "API token" or "Invitation".
|
|
91
|
+
*/
|
|
92
|
+
kind?: Message;
|
|
93
|
+
user?: never;
|
|
94
|
+
showKind?: never;
|
|
95
|
+
};
|
|
96
|
+
type Layout = {
|
|
97
|
+
/**
|
|
98
|
+
* "row" shows the email below the name, with an avatar of 32px: a row
|
|
99
|
+
* of a list, an option of a menu.
|
|
100
|
+
*/
|
|
101
|
+
layout: 'row';
|
|
102
|
+
/**
|
|
103
|
+
* The line below the name, in place of the email. Write the email in
|
|
104
|
+
* it when the row needs it.
|
|
105
|
+
*/
|
|
106
|
+
children?: ReactNode;
|
|
107
|
+
} | {
|
|
108
|
+
/**
|
|
109
|
+
* "inline" shows the name on one line, with an avatar of 20px: a
|
|
110
|
+
* chip, the value of a select, a cell of a table, a person in a text.
|
|
111
|
+
*/
|
|
112
|
+
layout: 'inline';
|
|
113
|
+
children?: never;
|
|
114
|
+
};
|
|
115
|
+
export type UserRowProps = Content & Layout;
|
|
116
|
+
/**
|
|
117
|
+
* A person in a row: the avatar, the name, the email and the kind. It
|
|
118
|
+
* shows only the content: the container gives the surface, the hover and
|
|
119
|
+
* the click.
|
|
120
|
+
*/
|
|
121
|
+
declare function UserRow(props: UserRowProps): React.JSX.Element;
|
|
122
|
+
export default UserRow;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useTranslation } from "../i18n.js";
|
|
2
|
+
import EntityRow_default from "./EntityRow.js";
|
|
3
|
+
import Avatar from "../content/Avatar.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region ../ui-public/src/lists/UserRow.tsx
|
|
7
|
+
function fullName(...parts) {
|
|
8
|
+
return parts.filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The name and the email of a person, as DatoCMS shows them. The name falls
|
|
12
|
+
* back to the email. It is null only for an API token without a name: show
|
|
13
|
+
* the kind (`userKindLabel`) in its place.
|
|
14
|
+
*/
|
|
15
|
+
function userPresentation(user) {
|
|
16
|
+
let name = null;
|
|
17
|
+
let email = null;
|
|
18
|
+
switch (user.type) {
|
|
19
|
+
case "account":
|
|
20
|
+
email = user.attributes.email;
|
|
21
|
+
name = fullName(user.attributes.first_name, user.attributes.last_name);
|
|
22
|
+
break;
|
|
23
|
+
case "organization":
|
|
24
|
+
name = user.attributes.name;
|
|
25
|
+
break;
|
|
26
|
+
case "user":
|
|
27
|
+
email = user.attributes.email;
|
|
28
|
+
name = user.attributes.full_name;
|
|
29
|
+
break;
|
|
30
|
+
case "site_invitation":
|
|
31
|
+
email = user.attributes.email;
|
|
32
|
+
break;
|
|
33
|
+
case "access_token":
|
|
34
|
+
name = user.attributes.name;
|
|
35
|
+
break;
|
|
36
|
+
case "sso_user":
|
|
37
|
+
email = user.attributes.username;
|
|
38
|
+
name = fullName(user.attributes.first_name, user.attributes.last_name);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
name: name || email || null,
|
|
42
|
+
email
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var kindLabels = {
|
|
46
|
+
account: "userType.account",
|
|
47
|
+
organization: "userType.organization",
|
|
48
|
+
user: "userType.user",
|
|
49
|
+
access_token: "userType.apiToken",
|
|
50
|
+
sso_user: "userType.ssoUser",
|
|
51
|
+
site_invitation: "userType.siteInvitation"
|
|
52
|
+
};
|
|
53
|
+
/** The name of the kind of a person, for example "SSO user" */
|
|
54
|
+
function userKindLabel(type) {
|
|
55
|
+
return { id: kindLabels[type] };
|
|
56
|
+
}
|
|
57
|
+
var avatarSizes = {
|
|
58
|
+
inline: "small",
|
|
59
|
+
row: "xlarge"
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* A person in a row: the avatar, the name, the email and the kind. It
|
|
63
|
+
* shows only the content: the container gives the surface, the hover and
|
|
64
|
+
* the click.
|
|
65
|
+
*/
|
|
66
|
+
function UserRow(props) {
|
|
67
|
+
const { tm } = useTranslation();
|
|
68
|
+
const { layout } = props;
|
|
69
|
+
let name;
|
|
70
|
+
let email;
|
|
71
|
+
let imageUrl;
|
|
72
|
+
let kind;
|
|
73
|
+
if (props.user) {
|
|
74
|
+
({name, email} = userPresentation(props.user));
|
|
75
|
+
const kindLabel = userKindLabel(props.user.type);
|
|
76
|
+
name = name || tm(kindLabel);
|
|
77
|
+
kind = props.showKind ? kindLabel : void 0;
|
|
78
|
+
} else {
|
|
79
|
+
({name, email, imageUrl} = props.presentation);
|
|
80
|
+
kind = props.kind;
|
|
81
|
+
}
|
|
82
|
+
const title = name || email || "";
|
|
83
|
+
const image = /* @__PURE__ */ jsx(Avatar, {
|
|
84
|
+
name,
|
|
85
|
+
email,
|
|
86
|
+
size: avatarSizes[layout],
|
|
87
|
+
...imageUrl ? { imageUrl } : { gravatar: true }
|
|
88
|
+
});
|
|
89
|
+
if (layout === "inline") return /* @__PURE__ */ jsx(EntityRow_default, {
|
|
90
|
+
layout: "inline",
|
|
91
|
+
image,
|
|
92
|
+
title,
|
|
93
|
+
aside: kind
|
|
94
|
+
});
|
|
95
|
+
return /* @__PURE__ */ jsx(EntityRow_default, {
|
|
96
|
+
layout: "row",
|
|
97
|
+
image,
|
|
98
|
+
title,
|
|
99
|
+
aside: kind,
|
|
100
|
+
children: props.children ?? (email && email !== title ? email : void 0)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { UserRow as default, userKindLabel, userPresentation };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type DragHandleProps = {
|
|
3
3
|
/**
|
|
4
|
-
* Puts the handle in the gutter
|
|
4
|
+
* Puts the handle in the gutter on the left of the item, out of its
|
|
5
5
|
* content. "wide" is a wider gutter, for a table row. The item must have a
|
|
6
6
|
* CSS `position`. Without it, the handle stays in the flow, and its place
|
|
7
7
|
* comes from `className`.
|
|
8
8
|
*/
|
|
9
9
|
gutter?: 'normal' | 'wide';
|
|
10
|
-
/** A class for the
|
|
10
|
+
/** A class for the position of the handle in its block */
|
|
11
11
|
className?: string;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
@@ -40,7 +40,7 @@ export type SortableListProps = {
|
|
|
40
40
|
*/
|
|
41
41
|
onDrop: (result: SortableDropResult) => void;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Says if an item can go in a container. By default, all the items can
|
|
44
44
|
* go in all the containers. For example, a fieldset cannot go in another
|
|
45
45
|
* fieldset.
|
|
46
46
|
*/
|
|
@@ -9,7 +9,7 @@ export type DropTargetClassNameArgs = {
|
|
|
9
9
|
ringOnly?: boolean;
|
|
10
10
|
/**
|
|
11
11
|
* A drag is in progress, and the target does not take the dragged
|
|
12
|
-
* element. The target fades,
|
|
12
|
+
* element. The target fades, so the user sees where the element cannot
|
|
13
13
|
* go before the pointer gets there. Read the drag with `useActiveDrag`.
|
|
14
14
|
* @default false
|
|
15
15
|
*/
|
|
@@ -52,12 +52,12 @@ export type SortableTreeProps<D = any> = {
|
|
|
52
52
|
*/
|
|
53
53
|
isNestingEnabled?: boolean;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Says if the dragged item can go in this item, for example only in a
|
|
56
56
|
* folder. It has an effect only with `isNestingEnabled`. By default, all
|
|
57
57
|
* the items take children.
|
|
58
58
|
*/
|
|
59
59
|
canNest?: (item: TreeItem<D>) => boolean;
|
|
60
|
-
/**
|
|
60
|
+
/** Says if the user can drag this item. By default, all the items move. */
|
|
61
61
|
canDrag?: (item: TreeItem<D>) => boolean;
|
|
62
62
|
/**
|
|
63
63
|
* How the rows show their indent
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
export type DisclosureChevronProps = {
|
|
3
3
|
/** True when the content is open. The chevron turns down. */
|
|
4
4
|
open: boolean;
|
|
5
|
-
/** A class for the
|
|
5
|
+
/** A class for the position of the chevron (margin, alignment) */
|
|
6
6
|
className?: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
@@ -16,7 +16,7 @@ export declare const DisclosureChevron: React.NamedExoticComponent<DisclosureChe
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const DisclosureChevronPlaceholder: React.NamedExoticComponent<object>;
|
|
18
18
|
export type MenuChevronProps = {
|
|
19
|
-
/** A class for the
|
|
19
|
+
/** A class for the position of the chevron (margin, alignment) */
|
|
20
20
|
className?: string;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
@@ -27,7 +27,7 @@ export type MenuChevronProps = {
|
|
|
27
27
|
export declare const MenuChevron: React.NamedExoticComponent<MenuChevronProps>;
|
|
28
28
|
export type LoadMoreChevronProps = {
|
|
29
29
|
/**
|
|
30
|
-
* True while the items load. A spinner shows
|
|
30
|
+
* True while the items load. A spinner shows instead of the chevron, with
|
|
31
31
|
* the same size.
|
|
32
32
|
* @default false
|
|
33
33
|
*/
|
|
@@ -35,6 +35,6 @@ export type LoadMoreChevronProps = {
|
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* For a control that loads more items of a list. Put it before the label,
|
|
38
|
-
*
|
|
38
|
+
* where the DisclosureChevron is in the other rows.
|
|
39
39
|
*/
|
|
40
40
|
export declare const LoadMoreChevron: React.NamedExoticComponent<LoadMoreChevronProps>;
|
|
@@ -37,7 +37,7 @@ var MenuChevron = React.memo(function MenuChevron({ className }) {
|
|
|
37
37
|
});
|
|
38
38
|
/**
|
|
39
39
|
* For a control that loads more items of a list. Put it before the label,
|
|
40
|
-
*
|
|
40
|
+
* where the DisclosureChevron is in the other rows.
|
|
41
41
|
*/
|
|
42
42
|
var LoadMoreChevron = React.memo(function LoadMoreChevron({ loading }) {
|
|
43
43
|
if (loading) return /* @__PURE__ */ jsx("span", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type LinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
|
|
3
3
|
/**
|
|
4
|
-
* The page of
|
|
4
|
+
* The page of DatoCMS that the link opens: the path with its query, for
|
|
5
5
|
* example "/editor?tab=fields"
|
|
6
6
|
*/
|
|
7
7
|
to: string;
|
|
@@ -18,21 +18,21 @@ export type LinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'hre
|
|
|
18
18
|
*/
|
|
19
19
|
active?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* The link replaces the current entry of the history,
|
|
21
|
+
* The link replaces the current entry of the history, so the Back
|
|
22
22
|
* button of the browser does not come back to the current page
|
|
23
23
|
* @default false
|
|
24
24
|
*/
|
|
25
25
|
replace?: boolean;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
* A link to a page of
|
|
28
|
+
* A link to a page of DatoCMS, through the router of the host (see
|
|
29
29
|
* NavigationProvider). When its page is open, it gets `aria-current="page"`:
|
|
30
30
|
* give the active look with that attribute. For a link to another site, use
|
|
31
31
|
* a normal `a`.
|
|
32
32
|
*/
|
|
33
33
|
declare const Link: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & {
|
|
34
34
|
/**
|
|
35
|
-
* The page of
|
|
35
|
+
* The page of DatoCMS that the link opens: the path with its query, for
|
|
36
36
|
* example "/editor?tab=fields"
|
|
37
37
|
*/
|
|
38
38
|
to: string;
|
|
@@ -49,7 +49,7 @@ declare const Link: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttribu
|
|
|
49
49
|
*/
|
|
50
50
|
active?: boolean;
|
|
51
51
|
/**
|
|
52
|
-
* The link replaces the current entry of the history,
|
|
52
|
+
* The link replaces the current entry of the history, so the Back
|
|
53
53
|
* button of the browser does not come back to the current page
|
|
54
54
|
* @default false
|
|
55
55
|
*/
|
|
@@ -6,7 +6,7 @@ function isModifiedEvent(event) {
|
|
|
6
6
|
return event.metaKey || event.altKey || event.ctrlKey || event.shiftKey;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* A link to a page of
|
|
9
|
+
* A link to a page of DatoCMS, through the router of the host (see
|
|
10
10
|
* NavigationProvider). When its page is open, it gets `aria-current="page"`:
|
|
11
11
|
* give the active look with that attribute. For a link to another site, use
|
|
12
12
|
* a normal `a`.
|
|
@@ -14,7 +14,7 @@ export type NavListProps = {
|
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* A list of rows in a sidebar. Each row opens a page of
|
|
17
|
+
* A list of rows in a sidebar. Each row opens a page of DatoCMS, and the row
|
|
18
18
|
* of the open page is selected. It is a RowList in a navigation landmark.
|
|
19
19
|
*/
|
|
20
20
|
declare function BaseNavList({ ariaLabel, children }: NavListProps): React.JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { useEffect, useRef } from "react";
|
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region ../ui-public/src/navigation/NavList.tsx
|
|
7
7
|
/**
|
|
8
|
-
* A list of rows in a sidebar. Each row opens a page of
|
|
8
|
+
* A list of rows in a sidebar. Each row opens a page of DatoCMS, and the row
|
|
9
9
|
* of the open page is selected. It is a RowList in a navigation landmark.
|
|
10
10
|
*/
|
|
11
11
|
function BaseNavList({ ariaLabel, children }) {
|
|
@@ -33,7 +33,7 @@ export type NavigationAdapter = {
|
|
|
33
33
|
/**
|
|
34
34
|
* Gives the `href` attribute of a link to `to`. Without it, the `href` is
|
|
35
35
|
* `to`. A host that is not on the origin of the page (a plugin in a frame)
|
|
36
|
-
* gives the absolute URL,
|
|
36
|
+
* gives the absolute URL, so a new tab opens the correct page.
|
|
37
37
|
*/
|
|
38
38
|
href?: (to: string) => string;
|
|
39
39
|
};
|
|
@@ -49,7 +49,7 @@ export type SegmentedControlProps<T extends string> = SegmentedControlName & Seg
|
|
|
49
49
|
onChange: (value: T) => void;
|
|
50
50
|
/**
|
|
51
51
|
* The height of the options, with the padding of the Button sizes. The
|
|
52
|
-
* size of
|
|
52
|
+
* size of its container by default: "milli" in a toolbar, "field" in a
|
|
53
53
|
* toolbar of fields, "small" out of a toolbar (see useButtonSize).
|
|
54
54
|
*/
|
|
55
55
|
size?: ButtonSize;
|
|
@@ -57,7 +57,7 @@ export type SegmentedControlProps<T extends string> = SegmentedControlName & Seg
|
|
|
57
57
|
fill?: boolean;
|
|
58
58
|
/** Turns off all the options */
|
|
59
59
|
disabled?: boolean;
|
|
60
|
-
/** Only for the
|
|
60
|
+
/** Only for the position of the control (margin), not for its look */
|
|
61
61
|
className?: string;
|
|
62
62
|
};
|
|
63
63
|
/**
|