datocms-react-ui 3.1.0-next.5 → 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/LICENSE-lucide.txt +43 -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 +627 -29
- package/dist/ui-public/icons/index.js +294 -367
- package/dist/ui-public/icons/lucide/app-window.js +33 -0
- package/dist/ui-public/icons/lucide/arrow-big-down.js +22 -0
- package/dist/ui-public/icons/lucide/arrow-down-a-z.js +28 -0
- package/dist/ui-public/icons/lucide/arrow-down-from-line.js +26 -0
- package/dist/ui-public/icons/lucide/arrow-down.js +22 -0
- package/dist/ui-public/icons/lucide/arrow-left.js +22 -0
- package/dist/ui-public/icons/lucide/arrow-right-left.js +27 -0
- package/dist/ui-public/icons/lucide/arrow-right.js +22 -0
- package/dist/ui-public/icons/lucide/arrow-up-down.js +27 -0
- package/dist/ui-public/icons/lucide/arrow-up-from-line.js +26 -0
- package/dist/ui-public/icons/lucide/arrow-up.js +22 -0
- package/dist/ui-public/icons/lucide/ban.js +26 -0
- package/dist/ui-public/icons/lucide/book.js +22 -0
- package/dist/ui-public/icons/lucide/bookmark.js +22 -0
- package/dist/ui-public/icons/lucide/calendar.js +33 -0
- package/dist/ui-public/icons/{regular → lucide}/check.js +9 -3
- package/dist/ui-public/icons/{regular → lucide}/chevron-down.js +9 -3
- package/dist/ui-public/icons/{regular → lucide}/chevron-left.js +9 -3
- package/dist/ui-public/icons/{regular → lucide}/chevron-right.js +9 -3
- package/dist/ui-public/icons/lucide/chevrons-down.js +22 -0
- package/dist/ui-public/icons/lucide/chevrons-left.js +22 -0
- package/dist/ui-public/icons/lucide/chevrons-right.js +22 -0
- package/dist/ui-public/icons/lucide/circle-arrow-up.js +30 -0
- package/dist/ui-public/icons/lucide/circle-check.js +26 -0
- package/dist/ui-public/icons/lucide/circle-dot.js +30 -0
- package/dist/ui-public/icons/lucide/circle-exclamation-point.js +40 -0
- package/dist/ui-public/icons/lucide/circle-question-mark.js +30 -0
- package/dist/ui-public/icons/lucide/clock.js +26 -0
- package/dist/ui-public/icons/lucide/code.js +22 -0
- package/dist/ui-public/icons/lucide/command.js +22 -0
- package/dist/ui-public/icons/lucide/copy-plus.js +44 -0
- package/dist/ui-public/icons/lucide/copy.js +29 -0
- package/dist/ui-public/icons/lucide/corner-left-up.js +22 -0
- package/dist/ui-public/icons/lucide/database.js +31 -0
- package/dist/ui-public/icons/lucide/download.js +26 -0
- package/dist/ui-public/icons/lucide/earth.js +31 -0
- package/dist/ui-public/icons/lucide/ellipsis-vertical.js +38 -0
- package/dist/ui-public/icons/lucide/ellipsis.js +38 -0
- package/dist/ui-public/icons/lucide/external-link.js +26 -0
- package/dist/ui-public/icons/lucide/eye-off.js +27 -0
- package/dist/ui-public/icons/lucide/eye.js +26 -0
- package/dist/ui-public/icons/lucide/file-code.js +27 -0
- package/dist/ui-public/icons/lucide/file-output.js +27 -0
- package/dist/ui-public/icons/lucide/flask-conical.js +26 -0
- package/dist/ui-public/icons/lucide/fold-vertical.js +31 -0
- package/dist/ui-public/icons/lucide/folder-open.js +22 -0
- package/dist/ui-public/icons/lucide/folder-plus.js +26 -0
- package/dist/ui-public/icons/lucide/folder.js +22 -0
- package/dist/ui-public/icons/lucide/folders.js +22 -0
- package/dist/ui-public/icons/lucide/funnel.js +22 -0
- package/dist/ui-public/icons/lucide/gift.js +33 -0
- package/dist/ui-public/icons/lucide/git-branch.js +34 -0
- package/dist/ui-public/icons/lucide/git-fork.js +40 -0
- package/dist/ui-public/icons/lucide/globe.js +30 -0
- package/dist/ui-public/icons/lucide/grip-vertical.js +53 -0
- package/dist/ui-public/icons/lucide/hand.js +27 -0
- package/dist/ui-public/icons/lucide/hard-hat.js +33 -0
- package/dist/ui-public/icons/lucide/heading-1.js +27 -0
- package/dist/ui-public/icons/lucide/heading-2.js +27 -0
- package/dist/ui-public/icons/lucide/heading-3.js +28 -0
- package/dist/ui-public/icons/lucide/heading-4.js +28 -0
- package/dist/ui-public/icons/lucide/heading-5.js +28 -0
- package/dist/ui-public/icons/lucide/heading-6.js +32 -0
- package/dist/ui-public/icons/lucide/highlighter.js +22 -0
- package/dist/ui-public/icons/lucide/hourglass.js +27 -0
- package/dist/ui-public/icons/lucide/house.js +22 -0
- package/dist/ui-public/icons/lucide/image.js +37 -0
- package/dist/ui-public/icons/lucide/images.js +38 -0
- package/dist/ui-public/icons/lucide/info.js +30 -0
- package/dist/ui-public/icons/lucide/italic.js +41 -0
- package/dist/ui-public/icons/lucide/keyboard.js +38 -0
- package/dist/ui-public/icons/lucide/languages.js +29 -0
- package/dist/ui-public/icons/lucide/layers.js +26 -0
- package/dist/ui-public/icons/lucide/layout-grid.js +51 -0
- package/dist/ui-public/icons/lucide/letter-b.js +22 -0
- package/dist/ui-public/icons/lucide/life-buoy.js +37 -0
- package/dist/ui-public/icons/lucide/link.js +22 -0
- package/dist/ui-public/icons/lucide/list-indent-decrease.js +27 -0
- package/dist/ui-public/icons/lucide/list-indent-increase.js +27 -0
- package/dist/ui-public/icons/lucide/list-ordered.js +29 -0
- package/dist/ui-public/icons/lucide/list-tree.js +28 -0
- package/dist/ui-public/icons/lucide/list.js +29 -0
- package/dist/ui-public/icons/lucide/log-out.js +26 -0
- package/dist/ui-public/icons/lucide/mail.js +28 -0
- package/dist/ui-public/icons/lucide/map-pin.js +26 -0
- package/dist/ui-public/icons/lucide/map-pinned.js +30 -0
- package/dist/ui-public/icons/lucide/maximize.js +27 -0
- package/dist/ui-public/icons/lucide/menu.js +26 -0
- package/dist/ui-public/icons/lucide/messages-square.js +22 -0
- package/dist/ui-public/icons/lucide/minimize.js +27 -0
- package/dist/ui-public/icons/lucide/minus.js +22 -0
- package/dist/ui-public/icons/lucide/notepad-text.js +36 -0
- package/dist/ui-public/icons/lucide/octagon-exclamation-point.js +26 -0
- package/dist/ui-public/icons/lucide/palette.js +48 -0
- package/dist/ui-public/icons/lucide/panel-left.js +28 -0
- package/dist/ui-public/icons/lucide/panel-right.js +28 -0
- package/dist/ui-public/icons/lucide/pause.js +34 -0
- package/dist/ui-public/icons/lucide/pen.js +22 -0
- package/dist/ui-public/icons/lucide/pilcrow.js +26 -0
- package/dist/ui-public/icons/lucide/pipette.js +26 -0
- package/dist/ui-public/icons/lucide/play.js +22 -0
- package/dist/ui-public/icons/lucide/plus.js +22 -0
- package/dist/ui-public/icons/lucide/quote.js +22 -0
- package/dist/ui-public/icons/lucide/redo-2.js +22 -0
- package/dist/ui-public/icons/lucide/refresh-cw.js +27 -0
- package/dist/ui-public/icons/lucide/rotate-ccw-clock.js +26 -0
- package/dist/ui-public/icons/lucide/rotate-ccw.js +22 -0
- package/dist/ui-public/icons/lucide/search.js +26 -0
- package/dist/ui-public/icons/lucide/send.js +22 -0
- package/dist/ui-public/icons/lucide/settings-2.js +35 -0
- package/dist/ui-public/icons/lucide/settings.js +26 -0
- package/dist/ui-public/icons/lucide/sliders-horizontal.js +32 -0
- package/dist/ui-public/icons/lucide/smartphone.js +29 -0
- package/dist/ui-public/icons/lucide/square-arrow-left.js +32 -0
- package/dist/ui-public/icons/lucide/square-arrow-up-right.js +32 -0
- package/dist/ui-public/icons/lucide/square-code.js +32 -0
- package/dist/ui-public/icons/lucide/square-dashed.js +35 -0
- package/dist/ui-public/icons/lucide/square-pen.js +22 -0
- package/dist/ui-public/icons/lucide/square-plus.js +32 -0
- package/dist/ui-public/icons/lucide/square-terminal.js +33 -0
- package/dist/ui-public/icons/lucide/store.js +26 -0
- package/dist/ui-public/icons/lucide/strikethrough.js +31 -0
- package/dist/ui-public/icons/lucide/table.js +33 -0
- package/dist/ui-public/icons/lucide/tag.js +27 -0
- package/dist/ui-public/icons/lucide/text-align-center.js +26 -0
- package/dist/ui-public/icons/lucide/text-align-end.js +26 -0
- package/dist/ui-public/icons/lucide/text-align-justify.js +26 -0
- package/dist/ui-public/icons/lucide/text-align-start.js +26 -0
- package/dist/ui-public/icons/lucide/toolbox.js +28 -0
- package/dist/ui-public/icons/lucide/trash.js +28 -0
- package/dist/ui-public/icons/lucide/triangle-exclamation-point.js +26 -0
- package/dist/ui-public/icons/lucide/underline.js +27 -0
- package/dist/ui-public/icons/lucide/undo-2.js +22 -0
- package/dist/ui-public/icons/lucide/unfold-vertical.js +31 -0
- package/dist/ui-public/icons/lucide/user-lock.js +37 -0
- package/dist/ui-public/icons/lucide/user-minus.js +35 -0
- package/dist/ui-public/icons/lucide/user-round-arrow-left.js +31 -0
- package/dist/ui-public/icons/lucide/user.js +26 -0
- package/dist/ui-public/icons/lucide/x.js +22 -0
- package/dist/ui-public/locales/en.js +45 -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 +16 -11
- package/dist/ui-public/src/actions/Button.js +7 -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/actions/disabledReason.js +1 -1
- 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/UploadThreatTriangle.js +1 -1
- 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/content/ValidityTriangles.js +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/PasswordInput.js +1 -9
- 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/FilterToggle.d.ts +1 -1
- package/dist/ui-public/src/layout/Toolbar/FilterToggle.js +12 -4
- 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/navigation/SidebarTree/SidebarTreeNodeActions.d.ts +3 -0
- package/dist/ui-public/src/navigation/SidebarTree/SidebarTreeNodeActions.js +2 -1
- 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/HoverCard/index.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 +71 -0
- package/dist/ui-public/src/patterns/ListDetail/Overview.js +2 -2
- package/dist/ui-public/src/patterns/ListDetail/Page.d.ts +8 -9
- package/dist/ui-public/src/patterns/ListDetail/Page.js +12 -9
- package/dist/ui-public/src/patterns/ListDetail/Panel.d.ts +2 -2
- package/dist/ui-public/src/patterns/ListDetail/Panel.js +12 -11
- package/dist/ui-public/src/patterns/ListDetail/Split.d.ts +25 -11
- package/dist/ui-public/src/patterns/ListDetail/Split.js +99 -115
- package/dist/ui-public/src/patterns/ListDetail/index.d.ts +4 -3
- package/dist/ui-public/src/patterns/ListDetail/useDetailWidthDrag.js +43 -0
- 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 +3 -3
- package/dist/ui-public/icons/brands/gitlab.js +0 -15
- package/dist/ui-public/icons/brands/markdown.js +0 -15
- package/dist/ui-public/icons/custom/language.js +0 -16
- package/dist/ui-public/icons/custom/masonry.js +0 -21
- package/dist/ui-public/icons/light/eye-slash.js +0 -16
- package/dist/ui-public/icons/light/eye.js +0 -16
- package/dist/ui-public/icons/regular/align-left.js +0 -15
- package/dist/ui-public/icons/regular/arrow-down-a-z.js +0 -16
- package/dist/ui-public/icons/regular/arrow-down-from-line.js +0 -16
- package/dist/ui-public/icons/regular/arrow-down-to-line.js +0 -15
- package/dist/ui-public/icons/regular/arrow-down.js +0 -16
- package/dist/ui-public/icons/regular/arrow-left.js +0 -16
- package/dist/ui-public/icons/regular/arrow-right-arrow-left.js +0 -16
- package/dist/ui-public/icons/regular/arrow-right-from-bracket.js +0 -16
- package/dist/ui-public/icons/regular/arrow-right.js +0 -16
- package/dist/ui-public/icons/regular/arrow-rotate-left.js +0 -15
- package/dist/ui-public/icons/regular/arrow-rotate-right.js +0 -16
- package/dist/ui-public/icons/regular/arrow-turn-up.js +0 -16
- package/dist/ui-public/icons/regular/arrow-up-arrow-down.js +0 -16
- package/dist/ui-public/icons/regular/arrow-up-from-line.js +0 -16
- package/dist/ui-public/icons/regular/arrow-up-right-from-square.js +0 -16
- package/dist/ui-public/icons/regular/arrow-up-to-line.js +0 -15
- package/dist/ui-public/icons/regular/arrow-up.js +0 -16
- package/dist/ui-public/icons/regular/arrows-from-line.js +0 -16
- package/dist/ui-public/icons/regular/arrows-rotate.js +0 -16
- package/dist/ui-public/icons/regular/arrows-to-line.js +0 -16
- package/dist/ui-public/icons/regular/arrows-turn-to-dots.js +0 -15
- package/dist/ui-public/icons/regular/badge-check.js +0 -15
- package/dist/ui-public/icons/regular/ballot-check.js +0 -15
- package/dist/ui-public/icons/regular/ban.js +0 -16
- package/dist/ui-public/icons/regular/bars.js +0 -16
- package/dist/ui-public/icons/regular/bold.js +0 -15
- package/dist/ui-public/icons/regular/bolt.js +0 -15
- package/dist/ui-public/icons/regular/book.js +0 -16
- package/dist/ui-public/icons/regular/bookmark.js +0 -16
- package/dist/ui-public/icons/regular/brackets-curly.js +0 -15
- package/dist/ui-public/icons/regular/browser.js +0 -16
- package/dist/ui-public/icons/regular/calendar-clock.js +0 -15
- package/dist/ui-public/icons/regular/calendar.js +0 -16
- package/dist/ui-public/icons/regular/chart-area.js +0 -15
- package/dist/ui-public/icons/regular/chevrons-down.js +0 -16
- package/dist/ui-public/icons/regular/chevrons-left.js +0 -16
- package/dist/ui-public/icons/regular/chevrons-right.js +0 -16
- package/dist/ui-public/icons/regular/circle-arrow-up.js +0 -16
- package/dist/ui-public/icons/regular/circle-check.js +0 -16
- package/dist/ui-public/icons/regular/circle-dot.js +0 -16
- package/dist/ui-public/icons/regular/circle-exclamation.js +0 -16
- package/dist/ui-public/icons/regular/circle-info.js +0 -16
- package/dist/ui-public/icons/regular/circle-question.js +0 -16
- package/dist/ui-public/icons/regular/clapperboard-play.js +0 -15
- package/dist/ui-public/icons/regular/clipboard.js +0 -15
- package/dist/ui-public/icons/regular/clock-rotate-left.js +0 -16
- package/dist/ui-public/icons/regular/clock.js +0 -16
- package/dist/ui-public/icons/regular/clone.js +0 -16
- package/dist/ui-public/icons/regular/cloud-arrow-down.js +0 -15
- package/dist/ui-public/icons/regular/code-branch.js +0 -16
- package/dist/ui-public/icons/regular/code-fork.js +0 -16
- package/dist/ui-public/icons/regular/command.js +0 -16
- package/dist/ui-public/icons/regular/comments.js +0 -16
- package/dist/ui-public/icons/regular/copy.js +0 -16
- package/dist/ui-public/icons/regular/cube.js +0 -15
- package/dist/ui-public/icons/regular/cubes.js +0 -15
- package/dist/ui-public/icons/regular/dash.js +0 -16
- package/dist/ui-public/icons/regular/database.js +0 -16
- package/dist/ui-public/icons/regular/diamond.js +0 -15
- package/dist/ui-public/icons/regular/down.js +0 -16
- package/dist/ui-public/icons/regular/download.js +0 -16
- package/dist/ui-public/icons/regular/earth-europe.js +0 -16
- package/dist/ui-public/icons/regular/ellipsis-vertical.js +0 -16
- package/dist/ui-public/icons/regular/ellipsis.js +0 -16
- package/dist/ui-public/icons/regular/envelope.js +0 -16
- package/dist/ui-public/icons/regular/expand.js +0 -16
- package/dist/ui-public/icons/regular/eye-dropper.js +0 -16
- package/dist/ui-public/icons/regular/eye.js +0 -16
- package/dist/ui-public/icons/regular/file-export.js +0 -16
- package/dist/ui-public/icons/regular/file-lines.js +0 -15
- package/dist/ui-public/icons/regular/file-shield.js +0 -15
- package/dist/ui-public/icons/regular/file.js +0 -15
- package/dist/ui-public/icons/regular/filter.js +0 -16
- package/dist/ui-public/icons/regular/fire-flame-curved.js +0 -15
- package/dist/ui-public/icons/regular/flask-gear.js +0 -16
- package/dist/ui-public/icons/regular/flask.js +0 -16
- package/dist/ui-public/icons/regular/folder-gear.js +0 -15
- package/dist/ui-public/icons/regular/folder-magnifying-glass.js +0 -15
- package/dist/ui-public/icons/regular/folder-open.js +0 -16
- package/dist/ui-public/icons/regular/folder-plus.js +0 -16
- package/dist/ui-public/icons/regular/folder.js +0 -16
- package/dist/ui-public/icons/regular/folders.js +0 -16
- package/dist/ui-public/icons/regular/gear.js +0 -16
- package/dist/ui-public/icons/regular/gift.js +0 -16
- package/dist/ui-public/icons/regular/globe.js +0 -16
- package/dist/ui-public/icons/regular/grid-2.js +0 -16
- package/dist/ui-public/icons/regular/grip-dots-vertical.js +0 -16
- package/dist/ui-public/icons/regular/hand.js +0 -16
- package/dist/ui-public/icons/regular/hourglass-clock.js +0 -16
- package/dist/ui-public/icons/regular/house.js +0 -16
- package/dist/ui-public/icons/regular/images.js +0 -16
- package/dist/ui-public/icons/regular/input-numeric.js +0 -15
- package/dist/ui-public/icons/regular/input-text.js +0 -15
- package/dist/ui-public/icons/regular/keyboard.js +0 -16
- package/dist/ui-public/icons/regular/layer-group.js +0 -16
- package/dist/ui-public/icons/regular/life-ring.js +0 -16
- package/dist/ui-public/icons/regular/link-simple.js +0 -15
- package/dist/ui-public/icons/regular/link.js +0 -16
- package/dist/ui-public/icons/regular/list-tree.js +0 -16
- package/dist/ui-public/icons/regular/list.js +0 -16
- package/dist/ui-public/icons/regular/magnifying-glass-chart.js +0 -15
- package/dist/ui-public/icons/regular/magnifying-glass.js +0 -16
- package/dist/ui-public/icons/regular/map-location-dot.js +0 -16
- package/dist/ui-public/icons/regular/memo.js +0 -16
- package/dist/ui-public/icons/regular/mobile-screen-button.js +0 -16
- package/dist/ui-public/icons/regular/octagon-exclamation.js +0 -16
- package/dist/ui-public/icons/regular/palette.js +0 -16
- package/dist/ui-public/icons/regular/paper-plane.js +0 -16
- package/dist/ui-public/icons/regular/paragraph.js +0 -15
- package/dist/ui-public/icons/regular/paste.js +0 -15
- package/dist/ui-public/icons/regular/pause.js +0 -16
- package/dist/ui-public/icons/regular/pen-paintbrush.js +0 -15
- package/dist/ui-public/icons/regular/pen-to-square.js +0 -16
- package/dist/ui-public/icons/regular/pen.js +0 -16
- package/dist/ui-public/icons/regular/people-arrows.js +0 -16
- package/dist/ui-public/icons/regular/photo-film.js +0 -15
- package/dist/ui-public/icons/regular/play.js +0 -16
- package/dist/ui-public/icons/regular/puzzle-piece.js +0 -15
- package/dist/ui-public/icons/regular/receipt.js +0 -16
- package/dist/ui-public/icons/regular/rectangle-barcode.js +0 -15
- package/dist/ui-public/icons/regular/rectangle-list.js +0 -15
- package/dist/ui-public/icons/regular/right-left.js +0 -15
- package/dist/ui-public/icons/regular/rotate-left.js +0 -16
- package/dist/ui-public/icons/regular/shield.js +0 -15
- package/dist/ui-public/icons/regular/sidebar-flip.js +0 -16
- package/dist/ui-public/icons/regular/sidebar.js +0 -16
- package/dist/ui-public/icons/regular/sliders.js +0 -16
- package/dist/ui-public/icons/regular/sparkles.js +0 -15
- package/dist/ui-public/icons/regular/square-caret-down.js +0 -15
- package/dist/ui-public/icons/regular/square-check.js +0 -15
- package/dist/ui-public/icons/regular/square-dashed.js +0 -15
- package/dist/ui-public/icons/regular/square-left.js +0 -16
- package/dist/ui-public/icons/regular/square-terminal.js +0 -16
- package/dist/ui-public/icons/regular/square-up-right.js +0 -16
- package/dist/ui-public/icons/regular/store.js +0 -16
- package/dist/ui-public/icons/regular/swap-arrows.js +0 -15
- package/dist/ui-public/icons/regular/table.js +0 -16
- package/dist/ui-public/icons/regular/tag.js +0 -16
- package/dist/ui-public/icons/regular/toggle-on.js +0 -15
- package/dist/ui-public/icons/regular/toolbox.js +0 -16
- package/dist/ui-public/icons/regular/trash-undo.js +0 -15
- package/dist/ui-public/icons/regular/trash.js +0 -16
- package/dist/ui-public/icons/regular/triangle-exclamation.js +0 -16
- package/dist/ui-public/icons/regular/turn-up.js +0 -16
- package/dist/ui-public/icons/regular/user-group.js +0 -15
- package/dist/ui-public/icons/regular/user-helmet-safety.js +0 -16
- package/dist/ui-public/icons/regular/user-lock.js +0 -16
- package/dist/ui-public/icons/regular/user-minus.js +0 -16
- package/dist/ui-public/icons/regular/user-tie.js +0 -15
- package/dist/ui-public/icons/regular/user.js +0 -16
- package/dist/ui-public/icons/regular/users.js +0 -15
- package/dist/ui-public/icons/regular/video.js +0 -15
- package/dist/ui-public/icons/regular/webhook.js +0 -15
- package/dist/ui-public/icons/regular/wrench.js +0 -15
- package/dist/ui-public/icons/regular/xmark.js +0 -16
- package/dist/ui-public/icons/solid/align-center.js +0 -16
- package/dist/ui-public/icons/solid/align-justify.js +0 -16
- package/dist/ui-public/icons/solid/align-left.js +0 -16
- package/dist/ui-public/icons/solid/align-right.js +0 -16
- package/dist/ui-public/icons/solid/arrow-rotate-left.js +0 -16
- package/dist/ui-public/icons/solid/arrow-rotate-right.js +0 -16
- package/dist/ui-public/icons/solid/bold.js +0 -16
- package/dist/ui-public/icons/solid/circle-exclamation.js +0 -16
- package/dist/ui-public/icons/solid/closed-captioning.js +0 -15
- package/dist/ui-public/icons/solid/code.js +0 -16
- package/dist/ui-public/icons/solid/compress.js +0 -16
- package/dist/ui-public/icons/solid/download.js +0 -15
- package/dist/ui-public/icons/solid/expand.js +0 -16
- package/dist/ui-public/icons/solid/file-arrow-down.js +0 -15
- package/dist/ui-public/icons/solid/file-code.js +0 -16
- package/dist/ui-public/icons/solid/grid-2.js +0 -16
- package/dist/ui-public/icons/solid/h1.js +0 -16
- package/dist/ui-public/icons/solid/h2.js +0 -16
- package/dist/ui-public/icons/solid/h3.js +0 -16
- package/dist/ui-public/icons/solid/h4.js +0 -16
- package/dist/ui-public/icons/solid/h5.js +0 -16
- package/dist/ui-public/icons/solid/h6.js +0 -16
- package/dist/ui-public/icons/solid/highlighter.js +0 -16
- package/dist/ui-public/icons/solid/horizontal-rule.js +0 -16
- package/dist/ui-public/icons/solid/image.js +0 -16
- package/dist/ui-public/icons/solid/indent.js +0 -16
- package/dist/ui-public/icons/solid/italic.js +0 -16
- package/dist/ui-public/icons/solid/link.js +0 -16
- package/dist/ui-public/icons/solid/list-ol.js +0 -16
- package/dist/ui-public/icons/solid/list-ul.js +0 -16
- package/dist/ui-public/icons/solid/location-dot.js +0 -16
- package/dist/ui-public/icons/solid/music.js +0 -15
- package/dist/ui-public/icons/solid/outdent.js +0 -16
- package/dist/ui-public/icons/solid/paragraph.js +0 -16
- package/dist/ui-public/icons/solid/plus.js +0 -16
- package/dist/ui-public/icons/solid/quote-right.js +0 -16
- package/dist/ui-public/icons/solid/rectangle-code.js +0 -16
- package/dist/ui-public/icons/solid/square-plus.js +0 -16
- package/dist/ui-public/icons/solid/strikethrough.js +0 -16
- package/dist/ui-public/icons/solid/subtitles.js +0 -15
- package/dist/ui-public/icons/solid/table.js +0 -16
- package/dist/ui-public/icons/solid/triangle-exclamation.js +0 -16
- package/dist/ui-public/icons/solid/underline.js +0 -16
|
@@ -1,176 +1,160 @@
|
|
|
1
|
-
import { Misc
|
|
1
|
+
import { Misc } from "../../../icons/index.js";
|
|
2
2
|
import { useRegisterActions } from "../../actions/Actions/registry.js";
|
|
3
3
|
import { useMediaQuery } from "../../hooks/useMediaQuery.js";
|
|
4
4
|
import { CollectionRegionProvider } from "../../layout/Pane/PaneRegion.js";
|
|
5
|
-
import { useSashActionReveal } from "../../layout/SplitView/SashActionButton.js";
|
|
6
5
|
import SplitView_default from "../../layout/SplitView/SplitView.js";
|
|
7
6
|
import { TOGGLE_RIGHT_SIDEBAR_ACTION_ID } from "../../layout/SplitPane/toggle.js";
|
|
8
7
|
import SplitPane from "../../layout/SplitPane/index.js";
|
|
8
|
+
import BlankSlate_default from "../../feedback/BlankSlate.js";
|
|
9
9
|
import { useListDetailWidths } from "./Widths.js";
|
|
10
|
+
import { useDetailWidthDrag } from "./useDetailWidthDrag.js";
|
|
11
|
+
import FloatingDetail_default from "./FloatingDetail.js";
|
|
10
12
|
import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
11
13
|
import classNames from "classnames";
|
|
12
14
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
15
|
//#region ../ui-public/src/patterns/ListDetail/Split.tsx
|
|
14
16
|
var MIN_LIST_WIDTH = 360;
|
|
15
|
-
var DEFAULT_DETAIL_WIDTH = 500;
|
|
16
17
|
var MAX_FIRST_LIST_WIDTH = 1100;
|
|
17
|
-
var MIN_DETAIL_WIDTH = 360;
|
|
18
18
|
var DETAIL_SASH_STYLE = {
|
|
19
19
|
left: "auto",
|
|
20
20
|
right: -5,
|
|
21
21
|
width: 10,
|
|
22
22
|
zIndex: 2
|
|
23
23
|
};
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
left: -5,
|
|
27
|
-
width: 10,
|
|
28
|
-
zIndex: 2
|
|
29
|
-
};
|
|
24
|
+
var CLOSE_DETAIL_ACTION_ID = "listDetail.close";
|
|
25
|
+
var NARROW_VIEWPORT_MEDIA_QUERY = "(max-width: 1100px)";
|
|
30
26
|
var noop = () => {};
|
|
27
|
+
var EMPTY_DETAIL_TITLE = { id: "admin.listDetail.panel.empty.title" };
|
|
28
|
+
var EMPTY_DETAIL_DESCRIPTION = { id: "admin.listDetail.panel.empty.description" };
|
|
31
29
|
var DetailOpenContext = createContext(false);
|
|
32
|
-
var OverlayCloseContext = createContext(void 0);
|
|
33
30
|
function getListDetailMaxWidth(listWidth, detailWidth) {
|
|
34
|
-
return (listWidth ?? MAX_FIRST_LIST_WIDTH) + (detailWidth ??
|
|
31
|
+
return (listWidth ?? MAX_FIRST_LIST_WIDTH) + (detailWidth ?? 500);
|
|
35
32
|
}
|
|
36
33
|
function useIsListDetailOpen() {
|
|
37
34
|
return useContext(DetailOpenContext);
|
|
38
35
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* a row opens or closes, thus the user does not lose the row. When no row is
|
|
46
|
-
* open, there is no detail: the space at the right of the list stays empty.
|
|
47
|
-
* The user resizes the list and the detail; the space at the right of the
|
|
48
|
-
* detail stays empty. On a small viewport, the detail goes over the list.
|
|
49
|
-
* The widths come from the ListDetailWidthsProvider of the app.
|
|
50
|
-
*/
|
|
51
|
-
function ListDetailSplit({ detail, children }) {
|
|
52
|
-
const panel = detail?.panel;
|
|
53
|
-
const onCloseDetail = detail?.onClose ?? noop;
|
|
54
|
-
const { listWidth, onListWidthChange, detailWidth: storedDetailWidth, onDetailWidthChange } = useListDetailWidths();
|
|
55
|
-
const { matches: isOverlay } = useMediaQuery(OVERLAY_MEDIA_QUERY);
|
|
56
|
-
const isOpen = Boolean(panel);
|
|
57
|
-
const [container, setContainer] = useState(null);
|
|
58
|
-
const containerRef = useRef(null);
|
|
59
|
-
const setContainerElement = useCallback((element) => {
|
|
60
|
-
containerRef.current = element;
|
|
61
|
-
setContainer(element);
|
|
36
|
+
function useElementWidth() {
|
|
37
|
+
const [element, setElement] = useState(null);
|
|
38
|
+
const ref = useRef(null);
|
|
39
|
+
const setRef = useCallback((node) => {
|
|
40
|
+
ref.current = node;
|
|
41
|
+
setElement(node);
|
|
62
42
|
}, []);
|
|
63
|
-
const [
|
|
43
|
+
const [width, setWidth] = useState();
|
|
64
44
|
useEffect(() => {
|
|
65
|
-
if (!
|
|
45
|
+
if (!element) return void 0;
|
|
66
46
|
const observer = new ResizeObserver(() => {
|
|
67
|
-
|
|
47
|
+
setWidth(element.offsetWidth);
|
|
68
48
|
});
|
|
69
|
-
observer.observe(
|
|
49
|
+
observer.observe(element);
|
|
70
50
|
return () => observer.disconnect();
|
|
71
|
-
}, [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
dragStart.current = {
|
|
80
|
-
x,
|
|
81
|
-
width: detailWidth,
|
|
82
|
-
last: void 0
|
|
83
|
-
};
|
|
84
|
-
}, [detailWidth]);
|
|
85
|
-
const handleDetailDragMove = useCallback((x) => {
|
|
86
|
-
const { x: startX, width } = dragStart.current;
|
|
87
|
-
const newWidth = Math.max(MIN_DETAIL_WIDTH, width + x - startX);
|
|
88
|
-
dragStart.current.last = newWidth;
|
|
89
|
-
setDragDetailWidth(newWidth);
|
|
90
|
-
}, []);
|
|
91
|
-
const handleDetailDragEnd = useCallback(() => {
|
|
92
|
-
const { last } = dragStart.current;
|
|
93
|
-
if (last !== void 0) onDetailWidthChange(last);
|
|
94
|
-
setDragDetailWidth(void 0);
|
|
95
|
-
}, [onDetailWidthChange]);
|
|
96
|
-
const maxListWidth = containerWidth === void 0 ? void 0 : Math.max(MIN_LIST_WIDTH, containerWidth - MIN_DETAIL_WIDTH);
|
|
97
|
-
const firstListWidth = containerWidth === void 0 ? MAX_FIRST_LIST_WIDTH : Math.max(MIN_LIST_WIDTH, Math.min(MAX_FIRST_LIST_WIDTH, containerWidth - DEFAULT_DETAIL_WIDTH));
|
|
98
|
-
const size = Math.min(listWidth ?? firstListWidth, maxListWidth ?? Number.POSITIVE_INFINITY);
|
|
99
|
-
const hideButton = useSashActionReveal(isOpen && isOverlay);
|
|
51
|
+
}, [element]);
|
|
52
|
+
return {
|
|
53
|
+
ref,
|
|
54
|
+
setRef,
|
|
55
|
+
width
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function useDetailActions(isOpen, onClose, onReopen) {
|
|
100
59
|
useRegisterActions([{
|
|
101
|
-
id:
|
|
60
|
+
id: CLOSE_DETAIL_ACTION_ID,
|
|
102
61
|
name: { id: "admin.listDetail.panel.close" },
|
|
103
62
|
shortcut: { key: "escape" },
|
|
104
63
|
palette: "hidden",
|
|
105
64
|
applicable: () => isOpen,
|
|
106
|
-
run:
|
|
65
|
+
run: onClose
|
|
107
66
|
}, {
|
|
108
67
|
id: TOGGLE_RIGHT_SIDEBAR_ACTION_ID,
|
|
109
68
|
name: { id: "sidebar.toggleRight" },
|
|
110
69
|
icon: Misc.SidebarFlipIcon,
|
|
111
70
|
shortcut: { key: "]" },
|
|
112
|
-
applicable: () => isOpen || Boolean(
|
|
113
|
-
run: () => isOpen ?
|
|
71
|
+
applicable: () => isOpen || Boolean(onReopen),
|
|
72
|
+
run: () => isOpen ? onClose() : onReopen?.()
|
|
114
73
|
}]);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A list on the left and the detail of the open row on the right, as the
|
|
77
|
+
* records of a model in DatoCMS. The list keeps its place and its width when
|
|
78
|
+
* a row opens or closes, so the user does not lose the row.
|
|
79
|
+
* With the "beside" placement, the user resizes the list and the detail, and
|
|
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
|
+
* With the "over" placement, and on a small viewport, the list takes all the
|
|
83
|
+
* width and the open detail goes over it.
|
|
84
|
+
* The widths come from the ListDetailWidthsProvider of the host.
|
|
85
|
+
*/
|
|
86
|
+
function ListDetailSplit({ detail, children }) {
|
|
87
|
+
const panel = detail?.panel;
|
|
88
|
+
const onCloseDetail = detail?.onClose ?? noop;
|
|
89
|
+
const isOpen = Boolean(panel);
|
|
90
|
+
const { matches: isNarrowViewport } = useMediaQuery(NARROW_VIEWPORT_MEDIA_QUERY);
|
|
91
|
+
const placement = isNarrowViewport ? "over" : detail?.placement ?? "beside";
|
|
92
|
+
const container = useElementWidth();
|
|
93
|
+
useDetailActions(isOpen, onCloseDetail, detail?.onReopen);
|
|
115
94
|
const list = /* @__PURE__ */ jsx(DetailOpenContext.Provider, {
|
|
116
95
|
value: isOpen,
|
|
117
96
|
children: /* @__PURE__ */ jsx(CollectionRegionProvider, {
|
|
118
|
-
value:
|
|
97
|
+
value: container.ref,
|
|
119
98
|
children
|
|
120
99
|
})
|
|
121
100
|
});
|
|
122
101
|
return /* @__PURE__ */ jsx("div", {
|
|
123
|
-
ref:
|
|
102
|
+
ref: container.setRef,
|
|
124
103
|
className: classNames("ListDetailSplit", {
|
|
125
104
|
"ListDetailSplit--open": isOpen,
|
|
126
|
-
"ListDetailSplit--
|
|
105
|
+
"ListDetailSplit--over": placement === "over"
|
|
127
106
|
}),
|
|
128
|
-
children:
|
|
107
|
+
children: placement === "over" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
129
108
|
className: "ListDetailSplit__list",
|
|
130
109
|
children: list
|
|
131
|
-
}), isOpen && /* @__PURE__ */
|
|
110
|
+
}), isOpen && /* @__PURE__ */ jsx(FloatingDetail_default, {
|
|
111
|
+
panel,
|
|
112
|
+
onClose: onCloseDetail,
|
|
113
|
+
resizable: !isNarrowViewport,
|
|
114
|
+
containerWidth: container.width,
|
|
115
|
+
container: container.ref
|
|
116
|
+
})] }) : /* @__PURE__ */ jsx(BesideSplit, {
|
|
117
|
+
containerWidth: container.width,
|
|
118
|
+
detail,
|
|
119
|
+
list
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function BesideSplit({ containerWidth, detail, list }) {
|
|
124
|
+
const panel = detail?.panel;
|
|
125
|
+
const { listWidth, onListWidthChange } = useListDetailWidths();
|
|
126
|
+
const { width: detailWidth, sashHandlers } = useDetailWidthDrag({ sashSide: "right" });
|
|
127
|
+
const maxListWidth = containerWidth === void 0 ? void 0 : Math.max(MIN_LIST_WIDTH, containerWidth - 360);
|
|
128
|
+
const firstListWidth = containerWidth === void 0 ? MAX_FIRST_LIST_WIDTH : Math.max(MIN_LIST_WIDTH, Math.min(MAX_FIRST_LIST_WIDTH, containerWidth - 500));
|
|
129
|
+
const size = Math.min(listWidth ?? firstListWidth, maxListWidth ?? Number.POSITIVE_INFINITY);
|
|
130
|
+
return /* @__PURE__ */ jsxs(SplitPane, {
|
|
131
|
+
primaryPane: "right",
|
|
132
|
+
size,
|
|
133
|
+
minSize: MIN_LIST_WIDTH,
|
|
134
|
+
maxSize: maxListWidth,
|
|
135
|
+
onDragFinished: onListWidthChange,
|
|
136
|
+
children: [list, panel ? /* @__PURE__ */ jsxs("div", {
|
|
132
137
|
className: "ListDetailSplit__detail",
|
|
133
|
-
|
|
138
|
+
style: { width: detailWidth },
|
|
134
139
|
children: [/* @__PURE__ */ jsx(SplitView_default.Sash, {
|
|
135
140
|
split: "vertical",
|
|
136
|
-
allowResize:
|
|
137
|
-
style:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
children: panel
|
|
152
|
-
})]
|
|
153
|
-
})] }) : /* @__PURE__ */ jsxs(SplitPane, {
|
|
154
|
-
primaryPane: "right",
|
|
155
|
-
size,
|
|
156
|
-
minSize: MIN_LIST_WIDTH,
|
|
157
|
-
maxSize: maxListWidth,
|
|
158
|
-
onDragFinished: onListWidthChange,
|
|
159
|
-
children: [list, isOpen ? /* @__PURE__ */ jsxs("div", {
|
|
160
|
-
className: "ListDetailSplit__detail",
|
|
161
|
-
style: { width: detailWidth },
|
|
162
|
-
children: [/* @__PURE__ */ jsx(SplitView_default.Sash, {
|
|
163
|
-
split: "vertical",
|
|
164
|
-
allowResize: true,
|
|
165
|
-
style: DETAIL_SASH_STYLE,
|
|
166
|
-
onMouseDown: handleDetailDragStart,
|
|
167
|
-
onMouseMove: handleDetailDragMove,
|
|
168
|
-
onMouseUp: handleDetailDragEnd
|
|
169
|
-
}), panel]
|
|
170
|
-
}) : null]
|
|
171
|
-
})
|
|
141
|
+
allowResize: true,
|
|
142
|
+
style: DETAIL_SASH_STYLE,
|
|
143
|
+
...sashHandlers
|
|
144
|
+
}), panel]
|
|
145
|
+
}) : detail ? /* @__PURE__ */ jsx("div", {
|
|
146
|
+
className: "ListDetailSplit__detail ListDetailSplit__detail--empty",
|
|
147
|
+
style: { width: detailWidth },
|
|
148
|
+
children: /* @__PURE__ */ jsx(BlankSlate_default, {
|
|
149
|
+
placement: "area",
|
|
150
|
+
small: true,
|
|
151
|
+
icon: /* @__PURE__ */ jsx(Misc.SquareDashedIcon, {}),
|
|
152
|
+
title: EMPTY_DETAIL_TITLE,
|
|
153
|
+
description: EMPTY_DETAIL_DESCRIPTION
|
|
154
|
+
})
|
|
155
|
+
}) : null]
|
|
172
156
|
});
|
|
173
157
|
}
|
|
174
158
|
var Split_default = React.memo(ListDetailSplit);
|
|
175
159
|
//#endregion
|
|
176
|
-
export { Split_default as default, getListDetailMaxWidth, useIsListDetailOpen
|
|
160
|
+
export { CLOSE_DETAIL_ACTION_ID, Split_default as default, getListDetailMaxWidth, useIsListDetailOpen };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { getPaginatedListState, type ListDetailPageState, useOpenRowRoute, useReopenLastRow } from './Page.js';
|
|
2
|
-
import { getListDetailMaxWidth, useIsListDetailOpen } from './Split.js';
|
|
2
|
+
import { getListDetailMaxWidth, type ListDetailPlacement, useIsListDetailOpen } from './Split.js';
|
|
3
3
|
import { ListDetailWidthsProvider } from './Widths.js';
|
|
4
4
|
export declare const ListDetail: {
|
|
5
5
|
Page: import("react").MemoExoticComponent<({ detail, title, help, subtitle, menu, display, busy, filter, controls, button, footer, state, overview, children, }: import("./Page.js").ListDetailPageProps) => import("react").JSX.Element>;
|
|
6
6
|
Split: import("react").MemoExoticComponent<({ detail, children }: import("./Split.js").ListDetailSplitProps) => import("react").JSX.Element>;
|
|
7
7
|
Panel: import("react").MemoExoticComponent<({ title, state, fetching, actions, toolbarAction, entity, children, }: import("./Panel.js").ListDetailPanelProps) => import("react").JSX.Element>;
|
|
8
|
-
Overview: import("react").MemoExoticComponent<({ children }: {
|
|
8
|
+
Overview: import("react").MemoExoticComponent<({ children, placement }: {
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
+
placement?: ListDetailPlacement;
|
|
10
11
|
}) => import("react").JSX.Element>;
|
|
11
12
|
};
|
|
12
|
-
export { getListDetailMaxWidth, getPaginatedListState, type ListDetailPageState, ListDetailWidthsProvider, useIsListDetailOpen, useOpenRowRoute, useReopenLastRow, };
|
|
13
|
+
export { getListDetailMaxWidth, getPaginatedListState, type ListDetailPageState, type ListDetailPlacement, ListDetailWidthsProvider, useIsListDetailOpen, useOpenRowRoute, useReopenLastRow, };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useListDetailWidths } from "./Widths.js";
|
|
2
|
+
import { useCallback, useRef, useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The width of the detail and the handlers of its sash. The detail beside
|
|
5
|
+
* the list and the detail over the list share the stored width of
|
|
6
|
+
* ListDetailWidthsProvider. The new width goes to the provider only at the
|
|
7
|
+
* end of the drag.
|
|
8
|
+
*/
|
|
9
|
+
function useDetailWidthDrag({ sashSide, maxWidth }) {
|
|
10
|
+
const { detailWidth: storedWidth, onDetailWidthChange } = useListDetailWidths();
|
|
11
|
+
const [dragWidth, setDragWidth] = useState();
|
|
12
|
+
const width = Math.max(360, Math.min(maxWidth ?? Number.POSITIVE_INFINITY, dragWidth ?? storedWidth ?? 500));
|
|
13
|
+
const drag = useRef({
|
|
14
|
+
x: 0,
|
|
15
|
+
width: 0
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
width,
|
|
19
|
+
sashHandlers: {
|
|
20
|
+
onMouseDown: useCallback((x) => {
|
|
21
|
+
drag.current = {
|
|
22
|
+
x,
|
|
23
|
+
width,
|
|
24
|
+
last: void 0
|
|
25
|
+
};
|
|
26
|
+
}, [width]),
|
|
27
|
+
onMouseMove: useCallback((x) => {
|
|
28
|
+
const { x: startX, width: startWidth } = drag.current;
|
|
29
|
+
const distance = sashSide === "right" ? x - startX : startX - x;
|
|
30
|
+
const newWidth = Math.max(360, Math.min(maxWidth ?? Number.POSITIVE_INFINITY, startWidth + distance));
|
|
31
|
+
drag.current.last = newWidth;
|
|
32
|
+
setDragWidth(newWidth);
|
|
33
|
+
}, [sashSide, maxWidth]),
|
|
34
|
+
onMouseUp: useCallback(() => {
|
|
35
|
+
const { last } = drag.current;
|
|
36
|
+
if (last !== void 0) onDetailWidthChange(last);
|
|
37
|
+
setDragWidth(void 0);
|
|
38
|
+
}, [onDetailWidthChange])
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { useDetailWidthDrag };
|
|
@@ -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;
|
|
@@ -44,7 +44,7 @@ function formatTime(value, localizationSettings, withSeconds = false) {
|
|
|
44
44
|
const pattern = localizationSettings.twentyFourHour ? withSeconds ? "HH:mm:ss" : "HH:mm" : withSeconds ? "hh:mm:ss aa" : "hh:mm aa";
|
|
45
45
|
return format(instant, pattern);
|
|
46
46
|
}
|
|
47
|
-
function isToday(value, localizationSettings) {
|
|
47
|
+
function isToday$1(value, localizationSettings) {
|
|
48
48
|
const instant = typeof value === "string" ? new TZDate(value, localizationSettings.timezone) : new TZDate(value.getTime(), localizationSettings.timezone);
|
|
49
49
|
return format(instant, "dd/MM/yyyy") === format(/* @__PURE__ */ new Date(), "dd/MM/yyyy");
|
|
50
50
|
}
|
|
@@ -52,7 +52,7 @@ function formatDateTime(value, localizationSettings, todayLabel, withSeconds = f
|
|
|
52
52
|
const instant = typeof value === "string" ? new TZDate(value, localizationSettings.timezone) : new TZDate(value.getTime(), localizationSettings.timezone);
|
|
53
53
|
const formattedDate = format(instant, localizationSettings.dateFormat);
|
|
54
54
|
const formattedTime = formatTime(instant, localizationSettings, withSeconds);
|
|
55
|
-
if (todayLabel && isToday(instant, localizationSettings)) return `${todayLabel}, ${formattedTime}`;
|
|
55
|
+
if (todayLabel && isToday$1(instant, localizationSettings)) return `${todayLabel}, ${formattedTime}`;
|
|
56
56
|
return `${formattedDate}, ${formattedTime}`;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -82,7 +82,7 @@ var RELATIVE_TIME_UNITS = [
|
|
|
82
82
|
["second", 1]
|
|
83
83
|
];
|
|
84
84
|
/**
|
|
85
|
-
* The text always has a number ("1 day ago", not "yesterday"),
|
|
85
|
+
* The text always has a number ("1 day ago", not "yesterday"), so it can go
|
|
86
86
|
* after a word, as in "Updated 1 day ago", in all the languages.
|
|
87
87
|
*/
|
|
88
88
|
function formatRelativeTime(value, localizationSettings) {
|
|
@@ -92,4 +92,4 @@ function formatRelativeTime(value, localizationSettings) {
|
|
|
92
92
|
return new Intl.RelativeTimeFormat(localizationSettings.locale, { numeric: "always" }).format(Math.round(seconds / size), unit);
|
|
93
93
|
}
|
|
94
94
|
//#endregion
|
|
95
|
-
export { formatDate, formatDateTime, formatFullDateTime, formatMaybeDateTime, formatRelativeTime, formatTime, isToday, toDateTimeAttribute };
|
|
95
|
+
export { formatDate, formatDateTime, formatFullDateTime, formatMaybeDateTime, formatRelativeTime, formatTime, isToday$1 as isToday, toDateTimeAttribute };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region ../ui-public/src/utils/tickBatcher.ts
|
|
2
|
+
/**
|
|
3
|
+
* Puts the requests of one tick in one call of `load`, one call for each
|
|
4
|
+
* group (for example the options of the call). `load` gives one output for
|
|
5
|
+
* each input, in the same order: each request gets the output at its index.
|
|
6
|
+
* When `load` fails, or gives a value that is not an array with one output
|
|
7
|
+
* for each input, each request gets `fallback`.
|
|
8
|
+
*/
|
|
9
|
+
function createTickBatcher({ groupKey, load, fallback }) {
|
|
10
|
+
const queues = /* @__PURE__ */ new Map();
|
|
11
|
+
function flush(key, group) {
|
|
12
|
+
const requests = queues.get(key) ?? [];
|
|
13
|
+
queues.delete(key);
|
|
14
|
+
load(group, requests.map((request) => request.input)).then((outputs) => {
|
|
15
|
+
const valid = Array.isArray(outputs) && outputs.length === requests.length;
|
|
16
|
+
requests.forEach((request, index) => {
|
|
17
|
+
request.resolve((valid ? outputs[index] : void 0) ?? fallback);
|
|
18
|
+
});
|
|
19
|
+
}, (error) => {
|
|
20
|
+
console.error(error);
|
|
21
|
+
for (const request of requests) request.resolve(fallback);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return function request(group, input) {
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
const key = groupKey(group);
|
|
27
|
+
const queue = queues.get(key);
|
|
28
|
+
if (queue) {
|
|
29
|
+
queue.push({
|
|
30
|
+
input,
|
|
31
|
+
resolve
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
queues.set(key, [{
|
|
36
|
+
input,
|
|
37
|
+
resolve
|
|
38
|
+
}]);
|
|
39
|
+
setTimeout(() => flush(key, group), 0);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { createTickBatcher };
|