datocms-react-ui 3.1.0-next.5 → 3.1.0-next.9
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 +3 -2
- 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/FieldTypeAvatar.d.ts +2 -0
- package/dist/FieldTypeAvatar.js +2 -0
- package/dist/FieldTypeName.d.ts +2 -0
- package/dist/FieldTypeName.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 +669 -63
- package/dist/ui-public/icons/index.js +313 -379
- 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/braces.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/hash.js +47 -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/letter-text.js +28 -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/rows-3.js +32 -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/toggle-right.js +32 -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 +76 -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/FieldTypeAvatar.d.ts +22 -0
- package/dist/ui-public/src/content/FieldTypeAvatar.js +35 -0
- package/dist/ui-public/src/content/FieldTypeName.d.ts +19 -0
- package/dist/ui-public/src/content/FieldTypeName.js +25 -0
- package/dist/ui-public/src/content/IconAvatar.d.ts +3 -2
- 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 +8 -8
- package/dist/ui-public/src/layout/Pane/index.js +17 -8
- 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/SplitPane/index.js +16 -2
- 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 +5 -4
- 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/fieldTypes.d.ts +29 -0
- package/dist/ui-public/src/utils/fieldTypes.js +94 -0
- 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/fieldTypes.d.ts +1 -0
- package/dist/utils/fieldTypes.js +2 -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/fieldgroup-boolean.js +0 -18
- package/dist/ui-public/icons/custom/fieldgroup-color.js +0 -18
- package/dist/ui-public/icons/custom/fieldgroup-datetime.js +0 -49
- package/dist/ui-public/icons/custom/fieldgroup-json.js +0 -18
- package/dist/ui-public/icons/custom/fieldgroup-location.js +0 -19
- package/dist/ui-public/icons/custom/fieldgroup-media.js +0 -18
- package/dist/ui-public/icons/custom/fieldgroup-number.js +0 -18
- package/dist/ui-public/icons/custom/fieldgroup-reference.js +0 -18
- package/dist/ui-public/icons/custom/fieldgroup-rich_text.js +0 -18
- package/dist/ui-public/icons/custom/fieldgroup-seo.js +0 -22
- package/dist/ui-public/icons/custom/fieldgroup-structured_text.js +0 -61
- 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
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { useTranslation } from "../../i18n.js";
|
|
2
|
+
import DebouncedTextInput_default from "../DebouncedTextInput.js";
|
|
3
|
+
import SelectInput from "../SelectInput/index.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region ../ui-public/src/form/FilterBuilder/Editor.tsx
|
|
7
|
+
var COMPLETE_NUMBER = /^-?\d+(\.\d+)?$/;
|
|
8
|
+
function formatNumber(value) {
|
|
9
|
+
return typeof value === "number" ? String(value) : "";
|
|
10
|
+
}
|
|
11
|
+
function formatList(value) {
|
|
12
|
+
return Array.isArray(value) ? value.join(", ") : "";
|
|
13
|
+
}
|
|
14
|
+
function parseList(text) {
|
|
15
|
+
return text ? text.split(/\s*,\s*/) : [];
|
|
16
|
+
}
|
|
17
|
+
function noop() {}
|
|
18
|
+
/** The input of the value of a condition */
|
|
19
|
+
function Editor({ editor, value, onChange: onChangeProp, disabled, readOnly, ariaLabel, fieldLabel }) {
|
|
20
|
+
const { t, tm } = useTranslation();
|
|
21
|
+
const onChange = readOnly ? noop : onChangeProp;
|
|
22
|
+
const changeNumber = (text) => {
|
|
23
|
+
const trimmed = (text ?? "").trim();
|
|
24
|
+
if (trimmed === "") onChange(null);
|
|
25
|
+
else if (COMPLETE_NUMBER.test(trimmed)) onChange(Number(trimmed));
|
|
26
|
+
};
|
|
27
|
+
switch (editor.type) {
|
|
28
|
+
case "none": return null;
|
|
29
|
+
case "text": return /* @__PURE__ */ jsx(DebouncedTextInput_default, {
|
|
30
|
+
autosize: true,
|
|
31
|
+
"aria-label": ariaLabel,
|
|
32
|
+
placeholder: editor.placeholder,
|
|
33
|
+
value: typeof value === "string" ? value : "",
|
|
34
|
+
onChange: (text) => onChange(text ?? ""),
|
|
35
|
+
onBlur: (text) => onChange(text ?? ""),
|
|
36
|
+
disabled,
|
|
37
|
+
readOnly
|
|
38
|
+
});
|
|
39
|
+
case "number": return /* @__PURE__ */ jsx(DebouncedTextInput_default, {
|
|
40
|
+
autosize: true,
|
|
41
|
+
inputMode: "decimal",
|
|
42
|
+
"aria-label": ariaLabel,
|
|
43
|
+
placeholder: editor.placeholder,
|
|
44
|
+
value: formatNumber(value),
|
|
45
|
+
onChange: changeNumber,
|
|
46
|
+
onBlur: changeNumber,
|
|
47
|
+
disabled,
|
|
48
|
+
readOnly
|
|
49
|
+
});
|
|
50
|
+
case "list": return /* @__PURE__ */ jsx(DebouncedTextInput_default, {
|
|
51
|
+
autosize: true,
|
|
52
|
+
"aria-label": ariaLabel,
|
|
53
|
+
placeholder: editor.placeholder,
|
|
54
|
+
value: formatList(value),
|
|
55
|
+
onChange: (text) => onChange(parseList(text)),
|
|
56
|
+
onBlur: (text) => onChange(parseList(text)),
|
|
57
|
+
disabled,
|
|
58
|
+
readOnly
|
|
59
|
+
});
|
|
60
|
+
case "select": {
|
|
61
|
+
const options = editor.options.map((option) => ({
|
|
62
|
+
value: option.value,
|
|
63
|
+
label: tm(option.label)
|
|
64
|
+
}));
|
|
65
|
+
return editor.multiple ? /* @__PURE__ */ jsx(SelectInput, {
|
|
66
|
+
multiple: true,
|
|
67
|
+
autosize: true,
|
|
68
|
+
variant: "filter",
|
|
69
|
+
"aria-label": ariaLabel,
|
|
70
|
+
options,
|
|
71
|
+
value: Array.isArray(value) ? value : [],
|
|
72
|
+
onChange: (next) => onChange(next ?? []),
|
|
73
|
+
disabled,
|
|
74
|
+
readOnly
|
|
75
|
+
}) : /* @__PURE__ */ jsx(SelectInput, {
|
|
76
|
+
autosize: true,
|
|
77
|
+
variant: "filter",
|
|
78
|
+
"aria-label": ariaLabel,
|
|
79
|
+
options,
|
|
80
|
+
value: typeof value === "string" ? value : null,
|
|
81
|
+
onChange: (next) => onChange(next),
|
|
82
|
+
disabled,
|
|
83
|
+
readOnly
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
case "group": {
|
|
87
|
+
const record = typeof value === "object" && value !== null ? value : {};
|
|
88
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: editor.arguments.map((argument) => {
|
|
89
|
+
const label = tm(argument.label);
|
|
90
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
91
|
+
className: "FilterBuilder__argument",
|
|
92
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
93
|
+
className: "FilterBuilder__argument-label",
|
|
94
|
+
children: [label, ":"]
|
|
95
|
+
}), /* @__PURE__ */ jsx(Editor, {
|
|
96
|
+
editor: argument.editor,
|
|
97
|
+
value: record[argument.id],
|
|
98
|
+
onChange: (next) => onChange({
|
|
99
|
+
...record,
|
|
100
|
+
[argument.id]: next
|
|
101
|
+
}),
|
|
102
|
+
disabled,
|
|
103
|
+
readOnly,
|
|
104
|
+
ariaLabel: t("filterBuilder.argument", {
|
|
105
|
+
argument: label,
|
|
106
|
+
field: fieldLabel
|
|
107
|
+
}),
|
|
108
|
+
fieldLabel
|
|
109
|
+
})]
|
|
110
|
+
}, argument.id);
|
|
111
|
+
}) });
|
|
112
|
+
}
|
|
113
|
+
case "custom": return /* @__PURE__ */ jsx(Fragment$1, { children: editor.render({
|
|
114
|
+
value,
|
|
115
|
+
onChange,
|
|
116
|
+
disabled,
|
|
117
|
+
readOnly,
|
|
118
|
+
ariaLabel
|
|
119
|
+
}) });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { Editor as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FilterBuilderProps } from './types.js';
|
|
3
|
+
export type { FilterArgument, FilterBuilderProps, FilterCondition, FilterCustomEditor, FilterEditor, FilterEditorRenderProps, FilterField, FilterGroupEditor, FilterNoneEditor, FilterOperator, FilterSelectEditor, FilterSelectOption, FilterTextEditor, } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The conditions of a filter, as tiles: a field, an operator and a value.
|
|
6
|
+
* It is controlled: it has no copy of the conditions.
|
|
7
|
+
*/
|
|
8
|
+
declare function FilterBuilder({ fields, value, onChange, disabled, readOnly, emptyLabel, oneConditionPerField, }: FilterBuilderProps): React.JSX.Element;
|
|
9
|
+
export default FilterBuilder;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { Generic, UI } from "../../../icons/index.js";
|
|
2
|
+
import { useTranslation } from "../../i18n.js";
|
|
3
|
+
import { InSearchContext } from "../../layout/Toolbar/context.js";
|
|
4
|
+
import Button from "../../actions/Button.js";
|
|
5
|
+
import { Dropdown } from "../../actions/Dropdown/index.js";
|
|
6
|
+
import FieldWrapper_default, { useFieldInput } from "../FieldWrapper.js";
|
|
7
|
+
import { getEditState } from "../getEditState.js";
|
|
8
|
+
import SelectInput from "../SelectInput/index.js";
|
|
9
|
+
import Editor from "./Editor.js";
|
|
10
|
+
import { carriedValue, defaultValueOf, freeOperators, newCondition } from "./values.js";
|
|
11
|
+
import { useContext, useEffect, useRef, useState } from "react";
|
|
12
|
+
import classNames from "classnames";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { createFilter } from "react-select";
|
|
15
|
+
//#region ../ui-public/src/form/FilterBuilder/index.tsx
|
|
16
|
+
var defaultFilterOption = createFilter();
|
|
17
|
+
/** The name of a field in a menu, with its code after it */
|
|
18
|
+
function FieldName({ label, code }) {
|
|
19
|
+
return code ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
20
|
+
label,
|
|
21
|
+
" ",
|
|
22
|
+
/* @__PURE__ */ jsx("code", { children: code })
|
|
23
|
+
] }) : /* @__PURE__ */ jsx(Fragment$1, { children: label });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A field with one operator shows it as text: a select with one option
|
|
27
|
+
* looks like a choice that the user does not have.
|
|
28
|
+
*/
|
|
29
|
+
function hasOnlyOperator(field, operator) {
|
|
30
|
+
const visible = field.operators.filter((other) => !other.deprecated);
|
|
31
|
+
return visible.length === 1 && visible[0] === operator;
|
|
32
|
+
}
|
|
33
|
+
function Tile({ condition, field, fields, others, uniqueness, edit, onChange, onRemove }) {
|
|
34
|
+
const { disabled, showsReadOnly: readOnly, locked } = edit;
|
|
35
|
+
const { t, tm } = useTranslation();
|
|
36
|
+
const fieldLabel = tm(field.label);
|
|
37
|
+
const operator = field.operators.find((op) => op.id === condition.operator);
|
|
38
|
+
const fieldOptions = fields.filter((other) => other.id === field.id || freeOperators(other, others, uniqueness).length > 0).map((other) => ({
|
|
39
|
+
value: other.id,
|
|
40
|
+
label: tm(other.label),
|
|
41
|
+
code: other.code ? tm(other.code) : void 0
|
|
42
|
+
}));
|
|
43
|
+
const free = freeOperators(field, others, uniqueness);
|
|
44
|
+
const operatorOptions = field.operators.filter((op) => op.id === condition.operator || free.includes(op)).map((op) => ({
|
|
45
|
+
value: op.id,
|
|
46
|
+
label: tm(op.label)
|
|
47
|
+
}));
|
|
48
|
+
const deprecatedIds = field.operators.filter((op) => op.deprecated).map((op) => op.id);
|
|
49
|
+
const handleFieldChange = (fieldId) => {
|
|
50
|
+
if (!fieldId || fieldId === field.id) return;
|
|
51
|
+
const nextField = fields.find((other) => other.id === fieldId);
|
|
52
|
+
const next = nextField && newCondition(nextField, others, uniqueness);
|
|
53
|
+
if (next) onChange(next);
|
|
54
|
+
};
|
|
55
|
+
const handleOperatorChange = (operatorId) => {
|
|
56
|
+
const nextOperator = field.operators.find((op) => op.id === operatorId);
|
|
57
|
+
if (!nextOperator || nextOperator === operator) return;
|
|
58
|
+
onChange({
|
|
59
|
+
field: field.id,
|
|
60
|
+
operator: nextOperator.id,
|
|
61
|
+
value: operator ? carriedValue(operator.editor, nextOperator.editor, condition.value) : defaultValueOf(nextOperator.editor)
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
65
|
+
className: "FilterBuilder__tile",
|
|
66
|
+
role: "group",
|
|
67
|
+
"aria-label": t("filterBuilder.condition", {
|
|
68
|
+
field: fieldLabel,
|
|
69
|
+
operator: operator ? tm(operator.label) : ""
|
|
70
|
+
}),
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx(SelectInput, {
|
|
73
|
+
autosize: true,
|
|
74
|
+
variant: "filter-field",
|
|
75
|
+
className: "FilterBuilder__field",
|
|
76
|
+
"aria-label": t("filterBuilder.field"),
|
|
77
|
+
options: fieldOptions,
|
|
78
|
+
value: field.id,
|
|
79
|
+
onChange: handleFieldChange,
|
|
80
|
+
disabled,
|
|
81
|
+
readOnly,
|
|
82
|
+
maxMenuHeight: 275,
|
|
83
|
+
formatOptionLabel: (option, { context }) => context === "menu" ? /* @__PURE__ */ jsx(FieldName, {
|
|
84
|
+
label: option.label,
|
|
85
|
+
code: option.code
|
|
86
|
+
}) : option.label
|
|
87
|
+
}),
|
|
88
|
+
operator && hasOnlyOperator(field, operator) ? /* @__PURE__ */ jsx("span", {
|
|
89
|
+
className: "FilterBuilder__operator FilterBuilder__operator--static",
|
|
90
|
+
children: tm(operator.label)
|
|
91
|
+
}) : /* @__PURE__ */ jsx(SelectInput, {
|
|
92
|
+
autosize: true,
|
|
93
|
+
variant: "filter",
|
|
94
|
+
className: "FilterBuilder__operator",
|
|
95
|
+
"aria-label": t("filterBuilder.operator", { field: fieldLabel }),
|
|
96
|
+
options: operatorOptions,
|
|
97
|
+
filterOption: (option, input) => !deprecatedIds.includes(option.value) && defaultFilterOption(option, input),
|
|
98
|
+
value: operator ? operator.id : null,
|
|
99
|
+
onChange: handleOperatorChange,
|
|
100
|
+
disabled,
|
|
101
|
+
readOnly,
|
|
102
|
+
maxMenuHeight: 275
|
|
103
|
+
}),
|
|
104
|
+
operator && operator.editor.type !== "none" && /* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: "FilterBuilder__value",
|
|
106
|
+
children: /* @__PURE__ */ jsx(Editor, {
|
|
107
|
+
editor: operator.editor,
|
|
108
|
+
value: condition.value,
|
|
109
|
+
onChange: (value) => onChange({
|
|
110
|
+
...condition,
|
|
111
|
+
value
|
|
112
|
+
}),
|
|
113
|
+
disabled,
|
|
114
|
+
readOnly,
|
|
115
|
+
ariaLabel: t("filterBuilder.value", { field: fieldLabel }),
|
|
116
|
+
fieldLabel
|
|
117
|
+
})
|
|
118
|
+
}),
|
|
119
|
+
!readOnly && /* @__PURE__ */ jsx(Button, {
|
|
120
|
+
tone: "ghost",
|
|
121
|
+
size: "micro",
|
|
122
|
+
iconOnly: true,
|
|
123
|
+
icon: Generic.CloseIcon,
|
|
124
|
+
label: {
|
|
125
|
+
id: "filterBuilder.remove",
|
|
126
|
+
values: { field: fieldLabel }
|
|
127
|
+
},
|
|
128
|
+
onClick: onRemove,
|
|
129
|
+
disabled: locked,
|
|
130
|
+
className: "FilterBuilder__remove"
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* After the user removes a condition, the focus goes to the remove button
|
|
137
|
+
* of the next tile, or to the "+" button when no tile is left. Without it,
|
|
138
|
+
* the focus goes to the page, because the button that had it is gone.
|
|
139
|
+
*/
|
|
140
|
+
function useFocusAfterRemove(count) {
|
|
141
|
+
const rootRef = useRef(null);
|
|
142
|
+
const removedIndex = useRef(null);
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
const index = removedIndex.current;
|
|
145
|
+
const root = rootRef.current;
|
|
146
|
+
removedIndex.current = null;
|
|
147
|
+
if (index === null || !root) return;
|
|
148
|
+
const removeButtons = root.querySelectorAll(".FilterBuilder__remove");
|
|
149
|
+
(removeButtons[Math.min(index, removeButtons.length - 1)] ?? root.querySelector(".FilterBuilder__add button"))?.focus();
|
|
150
|
+
}, [count]);
|
|
151
|
+
return {
|
|
152
|
+
rootRef,
|
|
153
|
+
onRemove: (index) => {
|
|
154
|
+
removedIndex.current = index;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
var lastTileKey = 0;
|
|
159
|
+
var newTileKey = () => `tile-${++lastTileKey}`;
|
|
160
|
+
/**
|
|
161
|
+
* Gives to each new condition the key of the old condition with the same
|
|
162
|
+
* field and operator. A condition that changed its field or operator in place
|
|
163
|
+
* keeps the key of its index, when the count of the conditions is the same.
|
|
164
|
+
*/
|
|
165
|
+
function matchTileKeys(previous, value) {
|
|
166
|
+
const used = /* @__PURE__ */ new Set();
|
|
167
|
+
const sameCount = previous.value.length === value.length;
|
|
168
|
+
return value.map((condition, index) => {
|
|
169
|
+
let match = previous.value.findIndex((old, i) => !used.has(i) && old.field === condition.field && old.operator === condition.operator);
|
|
170
|
+
if (match === -1 && sameCount && !used.has(index)) match = index;
|
|
171
|
+
if (match === -1) return newTileKey();
|
|
172
|
+
used.add(match);
|
|
173
|
+
return previous.keys[match];
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* A key for each tile. The conditions have no id, and an index key gives the
|
|
178
|
+
* editor of a removed tile to the next tile: a text editor that waits for a
|
|
179
|
+
* pause then writes into the wrong condition.
|
|
180
|
+
*/
|
|
181
|
+
function useTileKeys(value) {
|
|
182
|
+
const [known, setKnown] = useState(() => ({
|
|
183
|
+
value,
|
|
184
|
+
keys: value.map(newTileKey)
|
|
185
|
+
}));
|
|
186
|
+
if (known.value === value) return known.keys;
|
|
187
|
+
const keys = matchTileKeys(known, value);
|
|
188
|
+
setKnown({
|
|
189
|
+
value,
|
|
190
|
+
keys
|
|
191
|
+
});
|
|
192
|
+
return keys;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The conditions of a filter, as tiles: a field, an operator and a value.
|
|
196
|
+
* It is controlled: it has no copy of the conditions.
|
|
197
|
+
*/
|
|
198
|
+
function FilterBuilder({ fields, value, onChange, disabled, readOnly, emptyLabel, oneConditionPerField = false }) {
|
|
199
|
+
const { tc, tm } = useTranslation();
|
|
200
|
+
const inSearch = useContext(InSearchContext);
|
|
201
|
+
const field = useFieldInput({});
|
|
202
|
+
const uniqueness = oneConditionPerField ? "field" : "operator";
|
|
203
|
+
const edit = getEditState({
|
|
204
|
+
disabled,
|
|
205
|
+
readOnly
|
|
206
|
+
});
|
|
207
|
+
const addable = fields.filter((candidate) => freeOperators(candidate, value, uniqueness).length > 0);
|
|
208
|
+
const focus = useFocusAfterRemove(value.length);
|
|
209
|
+
const tileKeys = useTileKeys(value);
|
|
210
|
+
const replace = (index, condition) => onChange(value.map((other, i) => i === index ? condition : other));
|
|
211
|
+
const remove = (index) => {
|
|
212
|
+
focus.onRemove(index);
|
|
213
|
+
onChange(value.filter((_, i) => i !== index));
|
|
214
|
+
};
|
|
215
|
+
const clear = () => {
|
|
216
|
+
focus.onRemove(0);
|
|
217
|
+
onChange([]);
|
|
218
|
+
};
|
|
219
|
+
const add = (candidate) => {
|
|
220
|
+
const condition = newCondition(candidate, value, uniqueness);
|
|
221
|
+
if (condition) onChange([...value, condition]);
|
|
222
|
+
};
|
|
223
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
224
|
+
ref: focus.rootRef,
|
|
225
|
+
className: classNames("FilterBuilder", edit.stateClass),
|
|
226
|
+
role: "group",
|
|
227
|
+
id: field.id,
|
|
228
|
+
"aria-labelledby": field["aria-labelledby"],
|
|
229
|
+
"aria-describedby": field["aria-describedby"],
|
|
230
|
+
children: [inSearch && /* @__PURE__ */ jsx("span", {
|
|
231
|
+
className: "FilterBuilder__icon",
|
|
232
|
+
"aria-hidden": "true",
|
|
233
|
+
children: /* @__PURE__ */ jsx(UI.FilterIcon, {})
|
|
234
|
+
}), /* @__PURE__ */ jsxs(FieldWrapper_default.Boundary, { children: [/* @__PURE__ */ jsxs("div", {
|
|
235
|
+
className: "FilterBuilder__box",
|
|
236
|
+
children: [
|
|
237
|
+
value.map((condition, index) => {
|
|
238
|
+
const conditionField = fields.find((candidate) => candidate.id === condition.field);
|
|
239
|
+
if (!conditionField) return null;
|
|
240
|
+
return /* @__PURE__ */ jsx(Tile, {
|
|
241
|
+
condition,
|
|
242
|
+
field: conditionField,
|
|
243
|
+
fields,
|
|
244
|
+
others: value.filter((_, i) => i !== index),
|
|
245
|
+
uniqueness,
|
|
246
|
+
edit,
|
|
247
|
+
onChange: (next) => replace(index, next),
|
|
248
|
+
onRemove: () => remove(index)
|
|
249
|
+
}, tileKeys[index]);
|
|
250
|
+
}),
|
|
251
|
+
value.length === 0 && /* @__PURE__ */ jsx("span", {
|
|
252
|
+
className: "FilterBuilder__empty",
|
|
253
|
+
children: tc(emptyLabel ?? { id: "filterBuilder.empty" })
|
|
254
|
+
}),
|
|
255
|
+
!edit.showsReadOnly && /* @__PURE__ */ jsx(Dropdown, {
|
|
256
|
+
triggerComponent: Dropdown.ButtonTrigger,
|
|
257
|
+
size: "micro",
|
|
258
|
+
iconOnly: true,
|
|
259
|
+
icon: Generic.AddIcon,
|
|
260
|
+
label: { id: "filterBuilder.add" },
|
|
261
|
+
disabled: edit.locked || addable.length === 0,
|
|
262
|
+
className: "FilterBuilder__add",
|
|
263
|
+
children: /* @__PURE__ */ jsx(Dropdown.Menu, {
|
|
264
|
+
placement: "bottom-start",
|
|
265
|
+
minWidth: 220,
|
|
266
|
+
children: /* @__PURE__ */ jsx(Dropdown.Group, {
|
|
267
|
+
name: { id: "filterBuilder.addMenu" },
|
|
268
|
+
children: addable.map((candidate) => /* @__PURE__ */ jsx(Dropdown.Option, {
|
|
269
|
+
onPick: () => add(candidate),
|
|
270
|
+
children: /* @__PURE__ */ jsx(FieldName, {
|
|
271
|
+
label: tm(candidate.label),
|
|
272
|
+
code: candidate.code ? tm(candidate.code) : void 0
|
|
273
|
+
})
|
|
274
|
+
}, candidate.id))
|
|
275
|
+
})
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
}), value.length > 0 && !edit.showsReadOnly && /* @__PURE__ */ jsx("span", {
|
|
280
|
+
className: "FilterBuilder__clear",
|
|
281
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
282
|
+
tone: "ghost",
|
|
283
|
+
size: "micro",
|
|
284
|
+
iconOnly: true,
|
|
285
|
+
icon: Generic.CloseIcon,
|
|
286
|
+
label: { id: "filterBuilder.clear" },
|
|
287
|
+
onClick: clear,
|
|
288
|
+
disabled: edit.locked
|
|
289
|
+
})
|
|
290
|
+
})] })]
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
export { FilterBuilder as default };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type Message, type TextMessage } from '../../Message.js';
|
|
3
|
+
/** One condition of the filter: a tile with a field, an operator and a value */
|
|
4
|
+
export type FilterCondition = {
|
|
5
|
+
/** The `id` of the field of the condition */
|
|
6
|
+
field: string;
|
|
7
|
+
/** The `id` of the operator of the condition, in the `operators` of the field */
|
|
8
|
+
operator: string;
|
|
9
|
+
/**
|
|
10
|
+
* The value of the condition. Its shape comes from the editor of the
|
|
11
|
+
* operator (see `FilterEditor`).
|
|
12
|
+
*/
|
|
13
|
+
value: unknown;
|
|
14
|
+
};
|
|
15
|
+
/** A thing that the user can filter by, for example a field of a model */
|
|
16
|
+
export type FilterField = {
|
|
17
|
+
/** The key of the field. It goes in the `field` of a condition. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** The name of the field, in the select of a tile and in the "+" menu */
|
|
20
|
+
label: TextMessage;
|
|
21
|
+
/**
|
|
22
|
+
* A code of the field, for example its API key or its path in your data.
|
|
23
|
+
* The menus show it after the label, in a monospaced font. The tile shows
|
|
24
|
+
* only the label.
|
|
25
|
+
* @example "author.name"
|
|
26
|
+
*/
|
|
27
|
+
code?: TextMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The ways to compare the field, in the order of the select of a tile. A
|
|
30
|
+
* new condition takes the first operator that is free and not deprecated.
|
|
31
|
+
*/
|
|
32
|
+
operators: FilterOperator[];
|
|
33
|
+
};
|
|
34
|
+
/** One way to compare a field, for example "is", "contains" or "is after" */
|
|
35
|
+
export type FilterOperator = {
|
|
36
|
+
/** The key of the operator. It goes in the `operator` of a condition. */
|
|
37
|
+
id: string;
|
|
38
|
+
/** The text of the operator, in the select of a tile */
|
|
39
|
+
label: TextMessage;
|
|
40
|
+
/** The input of the value of the condition */
|
|
41
|
+
editor: FilterEditor;
|
|
42
|
+
/**
|
|
43
|
+
* An operator that you keep for the filters that use it. A condition that
|
|
44
|
+
* has it still shows it, but the user cannot pick it.
|
|
45
|
+
*/
|
|
46
|
+
deprecated?: boolean;
|
|
47
|
+
};
|
|
48
|
+
/** One option of a select editor */
|
|
49
|
+
export type FilterSelectOption = {
|
|
50
|
+
/** The value that goes in the condition */
|
|
51
|
+
value: string;
|
|
52
|
+
/** The text of the option */
|
|
53
|
+
label: TextMessage;
|
|
54
|
+
};
|
|
55
|
+
/** The operator has no value, for example "is empty". The value is `null`. */
|
|
56
|
+
export type FilterNoneEditor = {
|
|
57
|
+
type: 'none';
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* A text input. "text" gives a string, "number" gives a number or `null`,
|
|
61
|
+
* and "list" gives a list of strings: the user separates them with commas.
|
|
62
|
+
*/
|
|
63
|
+
export type FilterTextEditor = {
|
|
64
|
+
type: 'text' | 'number' | 'list';
|
|
65
|
+
/** The text of the input when it is empty */
|
|
66
|
+
placeholder?: TextMessage;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* A select. The value is a string or `null`, or a list of strings with
|
|
70
|
+
* `multiple`.
|
|
71
|
+
*/
|
|
72
|
+
export type FilterSelectEditor = {
|
|
73
|
+
type: 'select';
|
|
74
|
+
/** The options of the select */
|
|
75
|
+
options: FilterSelectOption[];
|
|
76
|
+
/** The user can pick more than one option */
|
|
77
|
+
multiple?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* The value of a new condition, and the value after a change of operator
|
|
80
|
+
* that cannot keep the old value. Give a list with `multiple`. Use it when
|
|
81
|
+
* a condition with no value means nothing, for example "Featured is" with
|
|
82
|
+
* the options "Yes" and "No".
|
|
83
|
+
* @default null, or an empty list with `multiple`
|
|
84
|
+
*/
|
|
85
|
+
defaultValue?: string | string[] | null;
|
|
86
|
+
};
|
|
87
|
+
/** One input of a group editor */
|
|
88
|
+
export type FilterArgument = {
|
|
89
|
+
/** The key of the value of the argument, in the value of the group */
|
|
90
|
+
id: string;
|
|
91
|
+
/** The text before the input, in the tile */
|
|
92
|
+
label: TextMessage;
|
|
93
|
+
/** The input of the argument. A group cannot contain a group. */
|
|
94
|
+
editor: Exclude<FilterEditor, FilterGroupEditor>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* More than one input, each with a label, for example a distance and a
|
|
98
|
+
* point. The value is an object with one key for each argument.
|
|
99
|
+
*/
|
|
100
|
+
export type FilterGroupEditor = {
|
|
101
|
+
type: 'group';
|
|
102
|
+
/** The inputs of the group, in the order of the tile */
|
|
103
|
+
arguments: FilterArgument[];
|
|
104
|
+
};
|
|
105
|
+
/** What the `render` function of a custom editor gets */
|
|
106
|
+
export type FilterEditorRenderProps = {
|
|
107
|
+
/** The value of the condition */
|
|
108
|
+
value: unknown;
|
|
109
|
+
/** Call it with the new value when the user changes it */
|
|
110
|
+
onChange: (value: unknown) => void;
|
|
111
|
+
/** The user cannot change the value. The input has the disabled look. */
|
|
112
|
+
disabled: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The user can read and copy the value, but cannot change it. Give it to
|
|
115
|
+
* the `readOnly` of your input. It is `false` when `disabled` is `true`.
|
|
116
|
+
*/
|
|
117
|
+
readOnly: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* The name of the input for a screen reader, for example "Value of
|
|
120
|
+
* Author". Give it to your input as its `aria-label`.
|
|
121
|
+
*/
|
|
122
|
+
ariaLabel: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* An input of your own, for example a date picker or a record picker. Draw
|
|
126
|
+
* a bare input, with no border: the tile draws the border.
|
|
127
|
+
*/
|
|
128
|
+
export type FilterCustomEditor = {
|
|
129
|
+
type: 'custom';
|
|
130
|
+
/**
|
|
131
|
+
* The kind of the value. When the user changes the operator, the value
|
|
132
|
+
* stays only when the two custom editors have the same kind.
|
|
133
|
+
* @example "date"
|
|
134
|
+
*/
|
|
135
|
+
kind: string;
|
|
136
|
+
/**
|
|
137
|
+
* The value is a list of values of the kind. When the user changes between
|
|
138
|
+
* a single and a multiple editor of the same kind, the value becomes a list
|
|
139
|
+
* of one value, or the first value of the list.
|
|
140
|
+
*/
|
|
141
|
+
multiple?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* The value of a new condition, and the value after a change of operator
|
|
144
|
+
* that cannot keep the old value
|
|
145
|
+
*/
|
|
146
|
+
defaultValue: unknown;
|
|
147
|
+
/** Draws the input */
|
|
148
|
+
render: (props: FilterEditorRenderProps) => ReactNode;
|
|
149
|
+
};
|
|
150
|
+
/** The input of the value of a condition, for one operator */
|
|
151
|
+
export type FilterEditor =
|
|
152
|
+
/** No value */
|
|
153
|
+
FilterNoneEditor
|
|
154
|
+
/** A text, a number or a list of texts */
|
|
155
|
+
| FilterTextEditor
|
|
156
|
+
/** One or more options */
|
|
157
|
+
| FilterSelectEditor
|
|
158
|
+
/** More than one input */
|
|
159
|
+
| FilterGroupEditor
|
|
160
|
+
/** An input of your own */
|
|
161
|
+
| FilterCustomEditor;
|
|
162
|
+
/** The props of `FilterBuilder` */
|
|
163
|
+
export type FilterBuilderProps = {
|
|
164
|
+
/** The things that the user can filter by */
|
|
165
|
+
fields: FilterField[];
|
|
166
|
+
/** The conditions, in the order of the tiles */
|
|
167
|
+
value: FilterCondition[];
|
|
168
|
+
/** Runs with all the conditions when the user changes one of them */
|
|
169
|
+
onChange: (value: FilterCondition[]) => void;
|
|
170
|
+
/** The user cannot change the conditions. The tiles have the disabled look. */
|
|
171
|
+
disabled?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* The user can read and copy the conditions, but cannot change them. The
|
|
174
|
+
* tiles show with no "+" button, no remove button and no clear button.
|
|
175
|
+
*/
|
|
176
|
+
readOnly?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* The text when there are no conditions
|
|
179
|
+
* @default "No filters set"
|
|
180
|
+
*/
|
|
181
|
+
emptyLabel?: Message;
|
|
182
|
+
/**
|
|
183
|
+
* A field can have only one condition. Without it, a field can have one
|
|
184
|
+
* condition for each operator.
|
|
185
|
+
* @default false
|
|
186
|
+
*/
|
|
187
|
+
oneConditionPerField?: boolean;
|
|
188
|
+
};
|