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
|
@@ -24,9 +24,9 @@ export type SettingsMenuGroupProps = {
|
|
|
24
24
|
};
|
|
25
25
|
/** A group of items, with an optional title */
|
|
26
26
|
declare function Group({ name, children }: SettingsMenuGroupProps): React.JSX.Element;
|
|
27
|
-
/** The item goes to a page of
|
|
27
|
+
/** The item goes to a page of DatoCMS */
|
|
28
28
|
export type SettingsMenuPageItem = {
|
|
29
|
-
/** The page of
|
|
29
|
+
/** The page of DatoCMS, for example "/project-settings/site" */
|
|
30
30
|
to: string;
|
|
31
31
|
/** The item is active only when the URL is exactly `to` */
|
|
32
32
|
exact?: boolean;
|
|
@@ -39,7 +39,7 @@ export type SettingsMenuPageItem = {
|
|
|
39
39
|
onClick?: never;
|
|
40
40
|
newTab?: never;
|
|
41
41
|
};
|
|
42
|
-
/** The item goes to
|
|
42
|
+
/** The item goes to another site */
|
|
43
43
|
export type SettingsMenuLinkItem = {
|
|
44
44
|
/** The address of the page, for example "https://www.datocms.com" */
|
|
45
45
|
href: string;
|
|
@@ -61,7 +61,7 @@ export type SettingsMenuActionItem = {
|
|
|
61
61
|
active?: never;
|
|
62
62
|
href?: never;
|
|
63
63
|
};
|
|
64
|
-
/** Where the item goes: a page of
|
|
64
|
+
/** Where the item goes: a page of DatoCMS, another site, or an action */
|
|
65
65
|
export type SettingsMenuItemDestination = SettingsMenuPageItem | SettingsMenuLinkItem | SettingsMenuActionItem;
|
|
66
66
|
export type SettingsMenuItemProps = SettingsMenuItemDestination & {
|
|
67
67
|
/** An icon before the label */
|
|
@@ -73,14 +73,14 @@ export type SettingsMenuItemProps = SettingsMenuItemDestination & {
|
|
|
73
73
|
};
|
|
74
74
|
/** A section of the settings area */
|
|
75
75
|
declare function Item(props: SettingsMenuItemProps): React.JSX.Element;
|
|
76
|
-
/** The notice opens a page of
|
|
76
|
+
/** The notice opens a page of DatoCMS */
|
|
77
77
|
export type SettingsMenuNoticePageLink = {
|
|
78
|
-
/** The page of
|
|
78
|
+
/** The page of DatoCMS, for example "/project-settings" */
|
|
79
79
|
to: string;
|
|
80
80
|
href?: never;
|
|
81
81
|
newTab?: never;
|
|
82
82
|
};
|
|
83
|
-
/** The notice opens
|
|
83
|
+
/** The notice opens another site */
|
|
84
84
|
export type SettingsMenuNoticeExternalLink = {
|
|
85
85
|
/** The address of the page, for example "https://www.datocms.com" */
|
|
86
86
|
href: string;
|
|
@@ -95,7 +95,7 @@ export type SettingsMenuNoticeProps = (SettingsMenuNoticePageLink | SettingsMenu
|
|
|
95
95
|
children: ReactNode;
|
|
96
96
|
};
|
|
97
97
|
/**
|
|
98
|
-
* A link for the footer of the menu. All the box is the link,
|
|
98
|
+
* A link for the footer of the menu. All the box is the link, so do not
|
|
99
99
|
* put other links in the text.
|
|
100
100
|
*/
|
|
101
101
|
declare function Notice(props: SettingsMenuNoticeProps): React.JSX.Element;
|
|
@@ -63,7 +63,7 @@ function Item(props) {
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* A link for the footer of the menu. All the box is the link,
|
|
66
|
+
* A link for the footer of the menu. All the box is the link, so do not
|
|
67
67
|
* put other links in the text.
|
|
68
68
|
*/
|
|
69
69
|
function Notice(props) {
|
|
@@ -26,7 +26,7 @@ type ClickAction = {
|
|
|
26
26
|
href?: never;
|
|
27
27
|
newTab?: never;
|
|
28
28
|
};
|
|
29
|
-
/** A link to a page of
|
|
29
|
+
/** A link to a page of DatoCMS */
|
|
30
30
|
type LinkAction = {
|
|
31
31
|
/** The page of the node: the path with its query */
|
|
32
32
|
to: string;
|
|
@@ -41,7 +41,7 @@ type LinkAction = {
|
|
|
41
41
|
onClick?: () => void;
|
|
42
42
|
href?: never;
|
|
43
43
|
};
|
|
44
|
-
/** A link to
|
|
44
|
+
/** A link to another site */
|
|
45
45
|
type ExternalLinkAction = {
|
|
46
46
|
href: string;
|
|
47
47
|
/** Opens the page in a new tab */
|
|
@@ -70,7 +70,7 @@ type InTree = {
|
|
|
70
70
|
type OutOfTree = {
|
|
71
71
|
/**
|
|
72
72
|
* The node is next to a tree, but not in it. It keeps the space of the
|
|
73
|
-
* toggle,
|
|
73
|
+
* toggle, so its icon aligns with the icons of the tree.
|
|
74
74
|
* @default false
|
|
75
75
|
*/
|
|
76
76
|
alignWithTree?: boolean;
|
|
@@ -106,7 +106,7 @@ export type SidebarTreeNodeProps = SidebarTreeNodeAction & SidebarTreeNodePlacem
|
|
|
106
106
|
* scrolls the node into view
|
|
107
107
|
*/
|
|
108
108
|
highlighted?: boolean;
|
|
109
|
-
/** Only for the
|
|
109
|
+
/** Only for the position of the node, not for its look */
|
|
110
110
|
className?: string;
|
|
111
111
|
};
|
|
112
112
|
declare function SidebarTreeNode({ label, afterTitle, details, trailing, icon, to, exact, href, newTab, onClick, onDoubleClick, active: isActiveProp, actions, tree, highlighted, alignWithTree, className, }: SidebarTreeNodeProps): React.JSX.Element;
|
|
@@ -4,7 +4,7 @@ export declare const FullscreenModalTitleContext: React.Context<Message | null>;
|
|
|
4
4
|
/**
|
|
5
5
|
* Gives the title of the FullscreenModal around the component, already
|
|
6
6
|
* rendered, or null out of a FullscreenModal. A content that is also a page
|
|
7
|
-
* (a record form, a list) shows it in its toolbar
|
|
7
|
+
* (a record form, a list) shows it in its toolbar instead of the title of
|
|
8
8
|
* the page.
|
|
9
9
|
*/
|
|
10
10
|
export declare function useFullscreenModalTitle(): React.ReactElement | null;
|
|
@@ -6,7 +6,7 @@ var FullscreenModalTitleContext = React.createContext(null);
|
|
|
6
6
|
/**
|
|
7
7
|
* Gives the title of the FullscreenModal around the component, already
|
|
8
8
|
* rendered, or null out of a FullscreenModal. A content that is also a page
|
|
9
|
-
* (a record form, a list) shows it in its toolbar
|
|
9
|
+
* (a record form, a list) shows it in its toolbar instead of the title of
|
|
10
10
|
* the page.
|
|
11
11
|
*/
|
|
12
12
|
function useFullscreenModalTitle() {
|
|
@@ -8,7 +8,7 @@ export type NewZIndexProps = {
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Gives its content a z-index 10 higher than the one of the parent layer.
|
|
11
|
-
* Every floating layer (dialog, menu, tooltip) wraps its box in it,
|
|
11
|
+
* Every floating layer (dialog, menu, tooltip) wraps its box in it, so a
|
|
12
12
|
* layer always shows over its parent.
|
|
13
13
|
*/
|
|
14
14
|
export default function NewZIndex({ children, forcedValue }: NewZIndexProps): React.JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
var ZIndexContext = React.createContext(10050);
|
|
5
5
|
/**
|
|
6
6
|
* Gives its content a z-index 10 higher than the one of the parent layer.
|
|
7
|
-
* Every floating layer (dialog, menu, tooltip) wraps its box in it,
|
|
7
|
+
* Every floating layer (dialog, menu, tooltip) wraps its box in it, so a
|
|
8
8
|
* layer always shows over its parent.
|
|
9
9
|
*/
|
|
10
10
|
function NewZIndex({ children, forcedValue }) {
|
|
@@ -20,7 +20,7 @@ export type PopoverProps = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Runs when the user presses Escape or clicks out of the popover. A click
|
|
22
22
|
* on the anchor does not run it, because the anchor opens and closes the
|
|
23
|
-
* popover. Without it, the popover stays open until
|
|
23
|
+
* popover. Without it, the popover stays open until you remove it.
|
|
24
24
|
*/
|
|
25
25
|
onClose?: () => void;
|
|
26
26
|
/**
|
|
@@ -5,7 +5,7 @@ var PortalWrapperContext = createContext(null);
|
|
|
5
5
|
/**
|
|
6
6
|
* Gives a wrapper to the content of each Portal below it. A portal renders
|
|
7
7
|
* at the end of the body, out of the elements of the host. The `Canvas` of
|
|
8
|
-
* react-ui writes the color tokens on its element,
|
|
8
|
+
* react-ui writes the color tokens on its element, so its wrapper writes
|
|
9
9
|
* them again around the content of a portal. The apps give no wrapper.
|
|
10
10
|
*/
|
|
11
11
|
function PortalWrapperProvider({ value, children }) {
|
|
@@ -11,9 +11,9 @@ var ModalCloseContext = React.createContext({
|
|
|
11
11
|
var openDialogLayers = [];
|
|
12
12
|
/**
|
|
13
13
|
* Gives a dialog its z-index. A dialog shows over its parent layer and over
|
|
14
|
-
* all the dialogs that are open,
|
|
14
|
+
* all the dialogs that are open, even when it is not inside them in the
|
|
15
15
|
* React tree (for example a dialog that opens from the root of the app).
|
|
16
|
-
*
|
|
16
|
+
* So the last dialog that opens is on top. Its `ActionLayer` gets the
|
|
17
17
|
* keys in the same order.
|
|
18
18
|
*/
|
|
19
19
|
function useDialogLayer() {
|
|
@@ -42,7 +42,7 @@ function closeAction(close) {
|
|
|
42
42
|
* element that matches `initialFocus`, or to the dialog. When the dialog
|
|
43
43
|
* closes, the focus goes back to the element that opened it, or to its
|
|
44
44
|
* nearest ancestor when the element left the page. It also gives
|
|
45
|
-
* the language of that element: the dialog is in a Portal,
|
|
45
|
+
* the language of that element: the dialog is in a Portal, so it does not
|
|
46
46
|
* get the `lang` of the page around the trigger.
|
|
47
47
|
*/
|
|
48
48
|
function useDialogFocus(initialFocus) {
|
|
@@ -17,7 +17,7 @@ var INTERACTIVE_SELECTOR = "a, button, input, select, textarea, label, [tabindex
|
|
|
17
17
|
/**
|
|
18
18
|
* Closes the detail on a click in the list area that is not on an
|
|
19
19
|
* interactive element. A click in a portal (a menu, a dialog) is out of the
|
|
20
|
-
* area,
|
|
20
|
+
* area, so it does not close the detail.
|
|
21
21
|
*/
|
|
22
22
|
function useCloseOnEmptyClick(area, detail, onClose) {
|
|
23
23
|
useEffect(() => {
|
|
@@ -40,7 +40,7 @@ function useCloseOnEmptyClick(area, detail, onClose) {
|
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* The detail over the list, at its right. The list keeps all the width and
|
|
43
|
-
* stays usable: a click on another row changes the detail.
|
|
43
|
+
* stays usable: a click on another row changes the detail. So there is
|
|
44
44
|
* no backdrop and no focus trap. A click on an empty part of the list closes
|
|
45
45
|
* the detail.
|
|
46
46
|
*/
|
|
@@ -13,15 +13,14 @@ import { type ListDetailSplitDetail } from './Split.js';
|
|
|
13
13
|
export type ListDetailPageState = 'loading' | 'empty' | 'no-results' | 'ready';
|
|
14
14
|
/**
|
|
15
15
|
* The state of a list that the server filters and paginates. `isEmpty` is
|
|
16
|
-
* undefined until the first load ends
|
|
17
|
-
* the cms).
|
|
16
|
+
* undefined until the first load ends.
|
|
18
17
|
*/
|
|
19
18
|
export declare function getPaginatedListState(isEmpty: boolean | undefined, isFiltering: boolean): ListDetailPageState;
|
|
20
19
|
export type ListDetailPageProps = {
|
|
21
|
-
/** The rows open a detail
|
|
20
|
+
/** The rows open a detail on the right (see ListDetail.Split) */
|
|
22
21
|
detail?: ListDetailSplitDetail;
|
|
23
22
|
/**
|
|
24
|
-
* The Pane uses the title as the label of the filter form,
|
|
23
|
+
* The Pane uses the title as the label of the filter form, so it is a
|
|
25
24
|
* TextMessage
|
|
26
25
|
*/
|
|
27
26
|
title: TextMessage;
|
|
@@ -41,8 +40,8 @@ export type ListDetailPageProps = {
|
|
|
41
40
|
/** The list loads in the background. The title bar shows a small spinner. */
|
|
42
41
|
busy?: boolean;
|
|
43
42
|
/**
|
|
44
|
-
* The filter of the list: the result of useFilterToolbar (
|
|
45
|
-
*
|
|
43
|
+
* The filter of the list: the result of useFilterToolbar (see Toolbar) and the
|
|
44
|
+
* filter form. The form shows in a toolbar under the title bar while
|
|
46
45
|
* the filter toolbar is open. A list without a filter does not set it.
|
|
47
46
|
*/
|
|
48
47
|
filter?: {
|
|
@@ -88,9 +87,9 @@ type ListDetailPageContent =
|
|
|
88
87
|
};
|
|
89
88
|
/**
|
|
90
89
|
* The page of a list with a panel for the open row: a title bar with the
|
|
91
|
-
* filter toggle, the filter form, the list and the panel
|
|
90
|
+
* filter toggle, the filter form, the list and the panel on the right. The
|
|
92
91
|
* page gives the data, the filter form, the table and the panel. Put it in
|
|
93
|
-
*
|
|
92
|
+
* your Main.
|
|
94
93
|
*/
|
|
95
94
|
declare function ListDetailPage({ detail, title, help, subtitle, menu, display, busy, filter, controls, button, footer, state, overview, children, }: ListDetailPageProps): React.JSX.Element;
|
|
96
95
|
declare const _default: React.MemoExoticComponent<typeof ListDetailPage>;
|
|
@@ -98,7 +97,7 @@ export default _default;
|
|
|
98
97
|
/**
|
|
99
98
|
* The open row of a ListDetail.Page is in the URL: "<baseUrl>/<id>". The id
|
|
100
99
|
* can have more segments (for example, "invitations/12"). The open and the
|
|
101
|
-
* close keep the query of the URL,
|
|
100
|
+
* close keep the query of the URL, so the list keeps its filter and its
|
|
102
101
|
* page. When a row is open, the open of another row (for example with the
|
|
103
102
|
* arrows) replaces the step in the history: the history does not keep each
|
|
104
103
|
* row. Give `idPattern` (the source of a regular expression for the segment
|
|
@@ -14,8 +14,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
//#region ../ui-public/src/patterns/ListDetail/Page.tsx
|
|
15
15
|
/**
|
|
16
16
|
* The state of a list that the server filters and paginates. `isEmpty` is
|
|
17
|
-
* undefined until the first load ends
|
|
18
|
-
* the cms).
|
|
17
|
+
* undefined until the first load ends.
|
|
19
18
|
*/
|
|
20
19
|
function getPaginatedListState(isEmpty, isFiltering) {
|
|
21
20
|
if (isEmpty === void 0) return "loading";
|
|
@@ -24,9 +23,9 @@ function getPaginatedListState(isEmpty, isFiltering) {
|
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
26
25
|
* The page of a list with a panel for the open row: a title bar with the
|
|
27
|
-
* filter toggle, the filter form, the list and the panel
|
|
26
|
+
* filter toggle, the filter form, the list and the panel on the right. The
|
|
28
27
|
* page gives the data, the filter form, the table and the panel. Put it in
|
|
29
|
-
*
|
|
28
|
+
* your Main.
|
|
30
29
|
*/
|
|
31
30
|
function ListDetailPage({ detail, title, help, subtitle, menu, display, busy, filter, controls, button, footer, state, overview, children }) {
|
|
32
31
|
const { t, tm, tc } = useTranslation();
|
|
@@ -88,7 +87,7 @@ function matchOpenRowId(pathname, baseUrl, idPattern) {
|
|
|
88
87
|
/**
|
|
89
88
|
* The open row of a ListDetail.Page is in the URL: "<baseUrl>/<id>". The id
|
|
90
89
|
* can have more segments (for example, "invitations/12"). The open and the
|
|
91
|
-
* close keep the query of the URL,
|
|
90
|
+
* close keep the query of the URL, so the list keeps its filter and its
|
|
92
91
|
* page. When a row is open, the open of another row (for example with the
|
|
93
92
|
* arrows) replaces the step in the history: the history does not keep each
|
|
94
93
|
* row. Give `idPattern` (the source of a regular expression for the segment
|
|
@@ -37,7 +37,7 @@ type ListDetailPanelState =
|
|
|
37
37
|
toolbarAction?: React.ReactNode;
|
|
38
38
|
/**
|
|
39
39
|
* The element that the panel shows: its name and a line under it (for
|
|
40
|
-
* example the email of a member), with an optional image
|
|
40
|
+
* example the email of a member), with an optional image on the left
|
|
41
41
|
* (for example an avatar). Without it, the page writes its own
|
|
42
42
|
* `ListDetailPanel__entity` block in the children.
|
|
43
43
|
*/
|
|
@@ -56,7 +56,7 @@ export type ListDetailPanelProps = {
|
|
|
56
56
|
*/
|
|
57
57
|
title: TextMessage;
|
|
58
58
|
} & ListDetailPanelState;
|
|
59
|
-
/** The panel
|
|
59
|
+
/** The panel on the right of a ListDetail.Page that shows the open row */
|
|
60
60
|
declare function ListDetailPanel({ title, state, fetching, actions, toolbarAction, entity, children, }: ListDetailPanelProps): React.JSX.Element;
|
|
61
61
|
declare const _default: React.MemoExoticComponent<typeof ListDetailPanel>;
|
|
62
62
|
export default _default;
|
|
@@ -9,7 +9,7 @@ import Aside from "../../semantic/Aside.js";
|
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region ../ui-public/src/patterns/ListDetail/Panel.tsx
|
|
12
|
-
/** The panel
|
|
12
|
+
/** The panel on the right of a ListDetail.Page that shows the open row */
|
|
13
13
|
function ListDetailPanel({ title, state = "ready", fetching, actions, toolbarAction, entity, children }) {
|
|
14
14
|
const { t, tm, tc } = useTranslation();
|
|
15
15
|
const closeOverlay = useListDetailOverlayClose();
|
|
@@ -20,32 +20,31 @@ export type ListDetailSplitDetail = {
|
|
|
20
20
|
*/
|
|
21
21
|
onReopen?: () => void;
|
|
22
22
|
/**
|
|
23
|
-
* Where the panel goes. "beside":
|
|
23
|
+
* Where the panel goes. "beside": on the right of the list, and the list
|
|
24
24
|
* keeps a part of the width for the panel. Use it for a table with few,
|
|
25
25
|
* narrow columns. "over": the list takes all the width, and the open
|
|
26
26
|
* panel goes over the right part of the list. Use it for a table that
|
|
27
27
|
* needs the width. Below 1100px of window width, the panel always goes
|
|
28
|
-
* over the list.
|
|
29
|
-
* @default "beside"
|
|
28
|
+
* over the list. There is no default: choose the placement for each list.
|
|
30
29
|
*/
|
|
31
|
-
placement
|
|
30
|
+
placement: ListDetailPlacement;
|
|
32
31
|
};
|
|
33
32
|
export type ListDetailSplitProps = {
|
|
34
|
-
/** The rows open a detail
|
|
33
|
+
/** The rows open a detail on the right. Without it, the list is alone. */
|
|
35
34
|
detail?: ListDetailSplitDetail;
|
|
36
35
|
/** The list: a Pane */
|
|
37
36
|
children: React.ReactNode;
|
|
38
37
|
};
|
|
39
38
|
/**
|
|
40
|
-
* A list
|
|
39
|
+
* A list on the left and the detail of the open row on the right, as the
|
|
41
40
|
* records of a model in DatoCMS. The list keeps its place and its width when
|
|
42
|
-
* a row opens or closes,
|
|
41
|
+
* a row opens or closes, so the user does not lose the row.
|
|
43
42
|
* With the "beside" placement, the user resizes the list and the detail, and
|
|
44
|
-
* the space
|
|
45
|
-
*
|
|
43
|
+
* the space on the right of the detail stays empty. When no row is open, the
|
|
44
|
+
* space of the detail shows a blank slate that says to open a row.
|
|
46
45
|
* With the "over" placement, and on a small viewport, the list takes all the
|
|
47
46
|
* width and the open detail goes over it.
|
|
48
|
-
* The widths come from the ListDetailWidthsProvider of the
|
|
47
|
+
* The widths come from the ListDetailWidthsProvider of the host.
|
|
49
48
|
*/
|
|
50
49
|
declare function ListDetailSplit({ detail, children }: ListDetailSplitProps): React.JSX.Element;
|
|
51
50
|
declare const _default: React.MemoExoticComponent<typeof ListDetailSplit>;
|
|
@@ -73,15 +73,15 @@ function useDetailActions(isOpen, onClose, onReopen) {
|
|
|
73
73
|
}]);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* A list
|
|
76
|
+
* A list on the left and the detail of the open row on the right, as the
|
|
77
77
|
* records of a model in DatoCMS. The list keeps its place and its width when
|
|
78
|
-
* a row opens or closes,
|
|
78
|
+
* a row opens or closes, so the user does not lose the row.
|
|
79
79
|
* With the "beside" placement, the user resizes the list and the detail, and
|
|
80
|
-
* the space
|
|
81
|
-
*
|
|
80
|
+
* the space on the right of the detail stays empty. When no row is open, the
|
|
81
|
+
* space of the detail shows a blank slate that says to open a row.
|
|
82
82
|
* With the "over" placement, and on a small viewport, the list takes all the
|
|
83
83
|
* width and the open detail goes over it.
|
|
84
|
-
* The widths come from the ListDetailWidthsProvider of the
|
|
84
|
+
* The widths come from the ListDetailWidthsProvider of the host.
|
|
85
85
|
*/
|
|
86
86
|
function ListDetailSplit({ detail, children }) {
|
|
87
87
|
const panel = detail?.panel;
|
|
@@ -9,14 +9,14 @@ export type ListFormPageProps = {
|
|
|
9
9
|
/** The state of the section (see getListOrOverviewState) */
|
|
10
10
|
state: ListOrOverviewState;
|
|
11
11
|
/**
|
|
12
|
-
* Shows
|
|
12
|
+
* Shows instead of the children when the section is empty: a
|
|
13
13
|
* BlankSlate with titleLevel={1} in a Main
|
|
14
14
|
*/
|
|
15
15
|
overview: ReactElement;
|
|
16
16
|
/**
|
|
17
17
|
* The list of the elements: a Pane with a Pane.Header. With a list, the
|
|
18
18
|
* page shows the list and the children in a split. When the section is
|
|
19
|
-
* empty, the list has no use,
|
|
19
|
+
* empty, the list has no use, so the children (for example the "new"
|
|
20
20
|
* form) show alone.
|
|
21
21
|
*/
|
|
22
22
|
list?: ReactNode;
|
|
@@ -29,7 +29,7 @@ export type ListFormPageProps = {
|
|
|
29
29
|
/**
|
|
30
30
|
* The content of a settings section whose elements are forms (for a list
|
|
31
31
|
* with facts to scan, use ListDetail.Page): a ListOrOverview with the list
|
|
32
|
-
* in a left pane of 300px and the open element
|
|
32
|
+
* in a left pane of 300px and the open element on the right. On the URL of
|
|
33
33
|
* the section, an empty section shows the overview. On another URL (for
|
|
34
34
|
* example the "new" form), it shows the children alone.
|
|
35
35
|
*/
|
|
@@ -7,7 +7,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
/**
|
|
8
8
|
* The content of a settings section whose elements are forms (for a list
|
|
9
9
|
* with facts to scan, use ListDetail.Page): a ListOrOverview with the list
|
|
10
|
-
* in a left pane of 300px and the open element
|
|
10
|
+
* in a left pane of 300px and the open element on the right. On the URL of
|
|
11
11
|
* the section, an empty section shows the overview. On another URL (for
|
|
12
12
|
* example the "new" form), it shows the children alone.
|
|
13
13
|
*/
|
|
@@ -16,7 +16,7 @@ export type HeadingProps = {
|
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* A heading. The level sets the structure of the page for screen readers.
|
|
19
|
-
* The look comes from the class,
|
|
19
|
+
* The look comes from the class, so a level 1 heading can look small.
|
|
20
20
|
* A title that the user can click has a button or a link inside it.
|
|
21
21
|
*/
|
|
22
22
|
export default function Heading({ level, className, id, children, }: HeadingProps): React.JSX.Element;
|
|
@@ -11,7 +11,7 @@ var tags = {
|
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* A heading. The level sets the structure of the page for screen readers.
|
|
14
|
-
* The look comes from the class,
|
|
14
|
+
* The look comes from the class, so a level 1 heading can look small.
|
|
15
15
|
* A title that the user can click has a button or a link inside it.
|
|
16
16
|
*/
|
|
17
17
|
function Heading({ level, className, id, children }) {
|
|
@@ -3,7 +3,7 @@ import "react";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region ../ui-public/src/semantic/Image.tsx
|
|
5
5
|
/**
|
|
6
|
-
* An image. The `alt` is required,
|
|
6
|
+
* An image. The `alt` is required, so the author has to choose a text or an
|
|
7
7
|
* empty text for a decoration (WCAG 2.1 AA 1.1.1).
|
|
8
8
|
*/
|
|
9
9
|
function Image({ alt, ...props }) {
|
|
@@ -16,9 +16,9 @@ export type NavProps = Omit<React.HTMLAttributes<HTMLElement>, 'aria-label' | 'a
|
|
|
16
16
|
ariaLabel?: never;
|
|
17
17
|
});
|
|
18
18
|
/**
|
|
19
|
-
* A list of links that go to other
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* A list of links that go to other pages: a landmark of the page. Do
|
|
20
|
+
* not use it for a list of controls that change the content of the same
|
|
21
|
+
* page (use Tabs).
|
|
22
22
|
*/
|
|
23
23
|
declare const Nav: React.ForwardRefExoticComponent<NavProps & React.RefAttributes<HTMLElement>>;
|
|
24
24
|
export default Nav;
|
|
@@ -3,9 +3,9 @@ import React from "react";
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region ../ui-public/src/semantic/Nav.tsx
|
|
5
5
|
/**
|
|
6
|
-
* A list of links that go to other
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* A list of links that go to other pages: a landmark of the page. Do
|
|
7
|
+
* not use it for a list of controls that change the content of the same
|
|
8
|
+
* page (use Tabs).
|
|
9
9
|
*/
|
|
10
10
|
var Nav = React.forwardRef(function Nav({ ariaLabel, ariaLabelledBy, ...props }, ref) {
|
|
11
11
|
const { tm } = useTranslation();
|
|
@@ -18,7 +18,7 @@ type RawButtonName = {
|
|
|
18
18
|
ariaLabel?: never;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* What the button
|
|
21
|
+
* What the button says about itself. A button is a toggle (`pressed`), it
|
|
22
22
|
* opens and closes other content (`expandable`), it is a tab of a tablist
|
|
23
23
|
* (`tab`), or it is an option of a radio group (`radio`). It is only one of
|
|
24
24
|
* them.
|
|
@@ -66,7 +66,7 @@ export type RawButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
66
66
|
submit?: true;
|
|
67
67
|
/**
|
|
68
68
|
* `true` disables the button and removes it from the Tab order.
|
|
69
|
-
* `'focusable'` keeps the button in the Tab order and
|
|
69
|
+
* `'focusable'` keeps the button in the Tab order and says to a screen
|
|
70
70
|
* reader that it is disabled (`aria-disabled`). The click does nothing.
|
|
71
71
|
* Use it when the user must find out why the button is disabled.
|
|
72
72
|
*/
|
|
@@ -79,7 +79,7 @@ export type RawButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
79
79
|
ariaHidden?: React.AriaAttributes['aria-hidden'];
|
|
80
80
|
};
|
|
81
81
|
/**
|
|
82
|
-
* A button without a look.
|
|
82
|
+
* A button without a look. You draw it with a class. It sets the
|
|
83
83
|
* parts of a button that the keyboard and the screen reader need: the type,
|
|
84
84
|
* the name, the state and the disabled mode.
|
|
85
85
|
*
|
|
@@ -12,7 +12,7 @@ function isHidden(button) {
|
|
|
12
12
|
return Boolean(button.closest("[aria-hidden=\"true\"]")) || getComputedStyle(button).visibility === "hidden";
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* A button without a look.
|
|
15
|
+
* A button without a look. You draw it with a class. It sets the
|
|
16
16
|
* parts of a button that the keyboard and the screen reader need: the type,
|
|
17
17
|
* the name, the state and the disabled mode.
|
|
18
18
|
*
|
|
@@ -12,7 +12,7 @@ export type SearchProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'aria-label
|
|
|
12
12
|
/**
|
|
13
13
|
* The controls that search or filter a collection: the field of the text
|
|
14
14
|
* and the filters. It is a landmark of the page. The native search element
|
|
15
|
-
* is not in the types of React 17,
|
|
15
|
+
* is not in the types of React 17, so it is a div with the role.
|
|
16
16
|
*/
|
|
17
17
|
declare const Search: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "role" | "aria-label" | "aria-labelledby"> & {
|
|
18
18
|
/**
|
|
@@ -5,7 +5,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
/**
|
|
6
6
|
* The controls that search or filter a collection: the field of the text
|
|
7
7
|
* and the filters. It is a landmark of the page. The native search element
|
|
8
|
-
* is not in the types of React 17,
|
|
8
|
+
* is not in the types of React 17, so it is a div with the role.
|
|
9
9
|
*/
|
|
10
10
|
var Search = React.forwardRef(function Search({ ariaLabel, ...props }, ref) {
|
|
11
11
|
const { tm } = useTranslation();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function formatBytes(bytes: number | null, decimalPrecision?: number): string;
|
|
2
|
+
export declare function formatCalls(callCount: number | null, precision?: number, showCalls?: boolean): string;
|
|
3
|
+
/**
|
|
4
|
+
* Formats seconds into a human-readable time string with optional precision.
|
|
5
|
+
*
|
|
6
|
+
* @param num - The number of seconds to format
|
|
7
|
+
* @param precision - Decimal places for values >= 60k seconds (default: 1).
|
|
8
|
+
* The zeros at the end of the decimals do not show.
|
|
9
|
+
*
|
|
10
|
+
* Examples:
|
|
11
|
+
* formatSeconds(1) → "1 sec"
|
|
12
|
+
* formatSeconds(45) → "45 secs"
|
|
13
|
+
* formatSeconds(60) → "1 min"
|
|
14
|
+
* formatSeconds(90) → "2 mins"
|
|
15
|
+
* formatSeconds(3661) → "61 mins"
|
|
16
|
+
* formatSeconds(65000) → "1.1k mins"
|
|
17
|
+
* formatSeconds(65000, 0) → "1k mins"
|
|
18
|
+
* formatSeconds(65000, 2) → "1.08k mins"
|
|
19
|
+
* formatSeconds(216000) → "3.6k mins"
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatSeconds(num: number | null, precision?: number): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region ../ui-public/src/utils/format.ts
|
|
2
|
+
var sizeUnits = [
|
|
3
|
+
"bytes",
|
|
4
|
+
"KB",
|
|
5
|
+
"MB",
|
|
6
|
+
"GB",
|
|
7
|
+
"TB",
|
|
8
|
+
"PB"
|
|
9
|
+
];
|
|
10
|
+
function toFixedTrimmed(value, precision) {
|
|
11
|
+
return String(Number(value.toFixed(precision)));
|
|
12
|
+
}
|
|
13
|
+
function formatBytes(bytes, decimalPrecision = 1) {
|
|
14
|
+
if (!bytes || Number.isNaN(bytes) || !Number.isFinite(bytes)) return "-";
|
|
15
|
+
if (bytes === 0) return "0 bytes";
|
|
16
|
+
const unitIndex = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
17
|
+
return `${toFixedTrimmed(bytes / 1024 ** unitIndex, decimalPrecision)}${sizeUnits[unitIndex]}`;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { formatBytes };
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
export type DateSettings = {
|
|
6
6
|
/**
|
|
7
7
|
* A BCP 47 language tag, for example 'it'. formatRelativeTime uses it for
|
|
8
|
-
* the words of a relative time ("3 giorni fa").
|
|
8
|
+
* the words of a relative time ("3 giorni fa"). The calendar of the date
|
|
9
|
+
* inputs uses it for the names of the months and of the days, and for the
|
|
10
|
+
* first day of the week. SmartDate does not use it.
|
|
9
11
|
*/
|
|
10
12
|
locale: string;
|
|
11
13
|
/**
|
|
@@ -16,6 +18,12 @@ export type DateSettings = {
|
|
|
16
18
|
/** An IANA time zone, for example 'Europe/Rome' */
|
|
17
19
|
timezone: string;
|
|
18
20
|
twentyFourHour: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The IANA time zone of the project, for example 'America/New_York'.
|
|
23
|
+
* `DateTimeInput` gives its value with the offset of this time zone, as
|
|
24
|
+
* the API does. Without it, the inputs use `timezone`.
|
|
25
|
+
*/
|
|
26
|
+
projectTimezone?: string;
|
|
19
27
|
};
|
|
20
28
|
/**
|
|
21
29
|
* Two kinds of values flow through these helpers, and they want different
|
|
@@ -56,7 +64,7 @@ export declare function formatDateTime(value: string | Date, localizationSetting
|
|
|
56
64
|
export declare function formatFullDateTime(value: string | Date, localizationSettings: DateSettings): string;
|
|
57
65
|
export declare function formatMaybeDateTime(value: any, localizationSettings: DateSettings): any;
|
|
58
66
|
/**
|
|
59
|
-
* The text always has a number ("1 day ago", not "yesterday"),
|
|
67
|
+
* The text always has a number ("1 day ago", not "yesterday"), so it can go
|
|
60
68
|
* after a word, as in "Updated 1 day ago", in all the languages.
|
|
61
69
|
*/
|
|
62
70
|
export declare function formatRelativeTime(value: string | Date, localizationSettings: DateSettings): string;
|