@payloadcms/ui 4.0.0-internal.cea8867 → 4.0.0-internal.d21c039
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/dist/css/app.css +122 -0
- package/dist/css/colors.css +7 -6
- package/dist/css/forms.css +1 -6
- package/dist/css/preflight.css +1 -0
- package/dist/css/spacing.css +29 -3
- package/dist/css/typography.css +158 -14
- package/dist/css/z-index.css +10 -0
- package/dist/elements/APIKeyInput/index.d.ts +2 -0
- package/dist/elements/APIKeyInput/index.d.ts.map +1 -1
- package/dist/elements/APIKeyInput/index.js +27 -29
- package/dist/elements/APIKeyInput/index.js.map +1 -1
- package/dist/elements/AddNewRelation/index.css +0 -1
- package/dist/elements/AppHeader/EditViewWidthSettings/index.css +6 -0
- package/dist/elements/AppHeader/EditViewWidthSettings/index.d.ts +4 -0
- package/dist/elements/AppHeader/EditViewWidthSettings/index.d.ts.map +1 -0
- package/dist/elements/AppHeader/EditViewWidthSettings/index.js +96 -0
- package/dist/elements/AppHeader/EditViewWidthSettings/index.js.map +1 -0
- package/dist/elements/AppHeader/SettingsMenu/index.css +5 -0
- package/dist/elements/AppHeader/SettingsMenu/index.d.ts +4 -0
- package/dist/elements/AppHeader/SettingsMenu/index.d.ts.map +1 -0
- package/dist/elements/AppHeader/SettingsMenu/index.js +59 -0
- package/dist/elements/AppHeader/SettingsMenu/index.js.map +1 -0
- package/dist/elements/AppHeader/TypeSizeSettings/index.d.ts +3 -0
- package/dist/elements/AppHeader/TypeSizeSettings/index.d.ts.map +1 -0
- package/dist/elements/AppHeader/TypeSizeSettings/index.js +58 -0
- package/dist/elements/AppHeader/TypeSizeSettings/index.js.map +1 -0
- package/dist/elements/AppHeader/index.css +4 -3
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +8 -3
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/ArrayAction/index.d.ts +3 -0
- package/dist/elements/ArrayAction/index.d.ts.map +1 -1
- package/dist/elements/ArrayAction/index.js +83 -29
- package/dist/elements/ArrayAction/index.js.map +1 -1
- package/dist/elements/Autosave/index.d.ts.map +1 -1
- package/dist/elements/Autosave/index.js +2 -3
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/elements/Banner/index.css +4 -0
- package/dist/elements/Banner/index.d.ts.map +1 -1
- package/dist/elements/Banner/index.js +1 -0
- package/dist/elements/Banner/index.js.map +1 -1
- package/dist/elements/BulkUpload/ActionsBar/index.css +1 -0
- package/dist/elements/BulkUpload/AddFilesView/index.css +10 -4
- package/dist/elements/BulkUpload/AddFilesView/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/AddFilesView/index.js +71 -51
- package/dist/elements/BulkUpload/AddFilesView/index.js.map +1 -1
- package/dist/elements/BulkUpload/AddingFilesView/index.css +2 -4
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js +2 -2
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/BulkUpload/FileSidebar/index.css +5 -0
- package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts +2 -2
- package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/createFormData.js +10 -17
- package/dist/elements/BulkUpload/FormsManager/createFormData.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +19 -13
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/BulkUpload/index.css +2 -0
- package/dist/elements/Button/index.css +2 -2
- package/dist/elements/Button/index.d.ts.map +1 -1
- package/dist/elements/Button/index.js +2 -0
- package/dist/elements/Button/index.js.map +1 -1
- package/dist/elements/ClipboardAction/clipboardUtilities.d.ts +8 -1
- package/dist/elements/ClipboardAction/clipboardUtilities.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/clipboardUtilities.js +40 -8
- package/dist/elements/ClipboardAction/clipboardUtilities.js.map +1 -1
- package/dist/elements/ClipboardAction/index.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/index.js +17 -1
- package/dist/elements/ClipboardAction/index.js.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts +10 -0
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js +65 -3
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js.map +1 -1
- package/dist/elements/ClipboardAction/types.d.ts +3 -0
- package/dist/elements/ClipboardAction/types.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/types.js.map +1 -1
- package/dist/elements/ClipboardAction/useCanPasteClipboard.d.ts +10 -0
- package/dist/elements/ClipboardAction/useCanPasteClipboard.d.ts.map +1 -0
- package/dist/elements/ClipboardAction/useCanPasteClipboard.js +21 -0
- package/dist/elements/ClipboardAction/useCanPasteClipboard.js.map +1 -0
- package/dist/elements/CodeEditor/index.css +0 -5
- package/dist/elements/Collapsible/index.css +1 -0
- package/dist/elements/CommandPalette/index.css +0 -7
- package/dist/elements/CopyLocaleData/index.d.ts.map +1 -1
- package/dist/elements/CopyLocaleData/index.js +8 -9
- package/dist/elements/CopyLocaleData/index.js.map +1 -1
- package/dist/elements/CopyToClipboard/index.d.ts +1 -0
- package/dist/elements/CopyToClipboard/index.d.ts.map +1 -1
- package/dist/elements/CopyToClipboard/index.js +10 -8
- package/dist/elements/CopyToClipboard/index.js.map +1 -1
- package/dist/elements/CreateDocumentButton/index.d.ts.map +1 -1
- package/dist/elements/CreateDocumentButton/index.js +4 -1
- package/dist/elements/CreateDocumentButton/index.js.map +1 -1
- package/dist/elements/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/elements/DatePicker/DatePicker.js +1 -0
- package/dist/elements/DatePicker/DatePicker.js.map +1 -1
- package/dist/elements/DatePicker/index.css +3 -1
- package/dist/elements/DeleteDocument/index.d.ts.map +1 -1
- package/dist/elements/DeleteDocument/index.js +16 -1
- package/dist/elements/DeleteDocument/index.js.map +1 -1
- package/dist/elements/DeleteMany/index.d.ts.map +1 -1
- package/dist/elements/DeleteMany/index.js +2 -3
- package/dist/elements/DeleteMany/index.js.map +1 -1
- package/dist/elements/Dialog/index.css +1 -0
- package/dist/elements/DocumentControls/index.css +1 -0
- package/dist/elements/DocumentFields/index.css +2 -0
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.js +4 -1
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts +1 -0
- package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +3 -2
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.css +1 -0
- package/dist/elements/DocumentHeader/Tabs/index.d.ts +1 -0
- package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +5 -3
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.css +22 -2
- package/dist/elements/DocumentHeader/index.d.ts +1 -0
- package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/index.js +6 -3
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/Drawer/index.css +10 -4
- package/dist/elements/Dropzone/index.css +10 -4
- package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js +3 -2
- package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js.map +1 -1
- package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
- package/dist/elements/DuplicateDocument/index.js +2 -3
- package/dist/elements/DuplicateDocument/index.js.map +1 -1
- package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/EditMany/DrawerContent.js +4 -5
- package/dist/elements/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/EditUpload/index.css +1 -1
- package/dist/elements/FieldDiffContainer/index.css +1 -0
- package/dist/elements/FieldDiffLabel/index.css +1 -0
- package/dist/elements/FieldSelect/reduceFieldOptions.d.ts.map +1 -1
- package/dist/elements/FieldSelect/reduceFieldOptions.js +3 -1
- package/dist/elements/FieldSelect/reduceFieldOptions.js.map +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.css +10 -9
- package/dist/elements/FileManager/FilePreview/index.css +3 -3
- package/dist/elements/FileManager/FileToolbar/index.d.ts.map +1 -1
- package/dist/elements/FileManager/FileToolbar/index.js +3 -0
- package/dist/elements/FileManager/FileToolbar/index.js.map +1 -1
- package/dist/elements/FileManager/index.css +35 -52
- package/dist/elements/FileManager/index.d.ts +1 -1
- package/dist/elements/FileManager/index.d.ts.map +1 -1
- package/dist/elements/FileManager/index.js +385 -282
- package/dist/elements/FileManager/index.js.map +1 -1
- package/dist/elements/HTMLDiff/index.css +1 -0
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.css +0 -1
- package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/MoveMany/index.js +2 -3
- package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
- package/dist/elements/Hierarchy/Search/useHierarchySearch.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Search/useHierarchySearch.js +2 -3
- package/dist/elements/Hierarchy/Search/useHierarchySearch.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js +109 -89
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js +2 -0
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/TreeNode/index.css +0 -1
- package/dist/elements/IDLabel/index.css +6 -0
- package/dist/elements/IDLabel/index.d.ts +1 -1
- package/dist/elements/IDLabel/index.d.ts.map +1 -1
- package/dist/elements/IDLabel/index.js +16 -21
- package/dist/elements/IDLabel/index.js.map +1 -1
- package/dist/elements/InputStepper/index.css +0 -1
- package/dist/elements/ItemsDrawer/index.css +3 -0
- package/dist/elements/ListControls/index.css +10 -4
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +7 -1
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListControls/types.d.ts +3 -1
- package/dist/elements/ListControls/types.d.ts.map +1 -1
- package/dist/elements/ListControls/types.js.map +1 -1
- package/dist/elements/ListControlsBar/index.css +8 -3
- package/dist/elements/ListControlsBar/index.js +4 -1
- package/dist/elements/ListControlsBar/index.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.d.ts +1 -7
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.d.ts.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js +26 -32
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.d.ts.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js +3 -4
- package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js.map +1 -1
- package/dist/elements/ListHeader/index.css +6 -1
- package/dist/elements/LivePreview/Window/index.css +1 -0
- package/dist/elements/LivePreview/Window/index.js +1 -1
- package/dist/elements/LivePreview/Window/index.js.map +1 -1
- package/dist/elements/Localizer/index.js +1 -1
- package/dist/elements/Localizer/index.js.map +1 -1
- package/dist/elements/Locked/index.css +0 -8
- package/dist/elements/Locked/index.d.ts.map +1 -1
- package/dist/elements/Locked/index.js +70 -64
- package/dist/elements/Locked/index.js.map +1 -1
- package/dist/elements/MiniCarousel/index.css +39 -37
- package/dist/elements/Nav/SidebarTabs/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/SidebarTabs/index.client.js +12 -5
- package/dist/elements/Nav/SidebarTabs/index.client.js.map +1 -1
- package/dist/elements/Nav/SidebarTabs/index.css +0 -5
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts +1 -0
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts.map +1 -1
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js +5 -3
- package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js.map +1 -1
- package/dist/elements/Nav/index.css +2 -0
- package/dist/elements/NavGroup/index.css +0 -1
- package/dist/elements/PageControls/index.css +1 -0
- package/dist/elements/PillSelector/index.css +1 -0
- package/dist/elements/Popup/PopupButtonList/index.css +1 -1
- package/dist/elements/Popup/index.js +1 -1
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PreviewButton/index.d.ts +1 -2
- package/dist/elements/PreviewButton/index.d.ts.map +1 -1
- package/dist/elements/PreviewButton/index.js +11 -5
- package/dist/elements/PreviewButton/index.js.map +1 -1
- package/dist/elements/PreviewSizes/index.css +10 -9
- package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/index.js +9 -31
- package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.js.map +1 -1
- package/dist/elements/PublishButton/index.css +1 -0
- package/dist/elements/PublishButton/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/index.js +16 -31
- package/dist/elements/PublishButton/index.js.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.js +2 -3
- package/dist/elements/PublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/QueryPresets/QueryPresetBar/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/QueryPresetBar/index.js +15 -4
- package/dist/elements/QueryPresets/QueryPresetBar/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/Heading/index.css +1 -0
- package/dist/elements/ReactSelect/ClearIndicator/index.css +0 -1
- package/dist/elements/ReactSelect/DefaultMenuPortal.d.ts +7 -0
- package/dist/elements/ReactSelect/DefaultMenuPortal.d.ts.map +1 -0
- package/dist/elements/ReactSelect/DefaultMenuPortal.js +120 -0
- package/dist/elements/ReactSelect/DefaultMenuPortal.js.map +1 -0
- package/dist/elements/ReactSelect/MultiValue/index.css +0 -1
- package/dist/elements/ReactSelect/MultiValueLabel/index.css +2 -2
- package/dist/elements/ReactSelect/getMenuListStyles.d.ts +1 -1
- package/dist/elements/ReactSelect/getMenuListStyles.d.ts.map +1 -1
- package/dist/elements/ReactSelect/getMenuListStyles.js +13 -5
- package/dist/elements/ReactSelect/getMenuListStyles.js.map +1 -1
- package/dist/elements/ReactSelect/getMenuStyles.d.ts +10 -0
- package/dist/elements/ReactSelect/getMenuStyles.d.ts.map +1 -0
- package/dist/elements/ReactSelect/getMenuStyles.js +21 -0
- package/dist/elements/ReactSelect/getMenuStyles.js.map +1 -0
- package/dist/elements/ReactSelect/index.css +7 -3
- package/dist/elements/ReactSelect/index.d.ts.map +1 -1
- package/dist/elements/ReactSelect/index.js +24 -101
- package/dist/elements/ReactSelect/index.js.map +1 -1
- package/dist/elements/ReactSelect/types.d.ts +1 -2
- package/dist/elements/ReactSelect/types.d.ts.map +1 -1
- package/dist/elements/ReactSelect/types.js.map +1 -1
- package/dist/elements/RelationshipTable/Pagination.d.ts +0 -1
- package/dist/elements/RelationshipTable/Pagination.d.ts.map +1 -1
- package/dist/elements/RelationshipTable/Pagination.js +27 -77
- package/dist/elements/RelationshipTable/Pagination.js.map +1 -1
- package/dist/elements/RelationshipTable/index.css +0 -2
- package/dist/elements/RelationshipTable/index.d.ts +1 -0
- package/dist/elements/RelationshipTable/index.d.ts.map +1 -1
- package/dist/elements/RelationshipTable/index.js +41 -5
- package/dist/elements/RelationshipTable/index.js.map +1 -1
- package/dist/elements/RenderTitle/index.css +16 -0
- package/dist/elements/RenderTitle/index.d.ts +1 -0
- package/dist/elements/RenderTitle/index.d.ts.map +1 -1
- package/dist/elements/RenderTitle/index.js +36 -18
- package/dist/elements/RenderTitle/index.js.map +1 -1
- package/dist/elements/RestoreMany/index.d.ts.map +1 -1
- package/dist/elements/RestoreMany/index.js +2 -3
- package/dist/elements/RestoreMany/index.js.map +1 -1
- package/dist/elements/SaveDraftButton/index.d.ts.map +1 -1
- package/dist/elements/SaveDraftButton/index.js +2 -3
- package/dist/elements/SaveDraftButton/index.js.map +1 -1
- package/dist/elements/SelectRow/index.d.ts +4 -3
- package/dist/elements/SelectRow/index.d.ts.map +1 -1
- package/dist/elements/SelectRow/index.js +10 -7
- package/dist/elements/SelectRow/index.js.map +1 -1
- package/dist/elements/SidebarToggle/index.css +0 -17
- package/dist/elements/SortColumn/index.d.ts.map +1 -1
- package/dist/elements/SortColumn/index.js +42 -38
- package/dist/elements/SortColumn/index.js.map +1 -1
- package/dist/elements/SortHeader/index.d.ts.map +1 -1
- package/dist/elements/SortHeader/index.js +29 -26
- package/dist/elements/SortHeader/index.js.map +1 -1
- package/dist/elements/Status/index.d.ts.map +1 -1
- package/dist/elements/Status/index.js +2 -3
- package/dist/elements/Status/index.js.map +1 -1
- package/dist/elements/StepNav/index.css +64 -14
- package/dist/elements/StepNav/index.d.ts.map +1 -1
- package/dist/elements/StepNav/index.js +143 -69
- package/dist/elements/StepNav/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/index.js +3 -11
- package/dist/elements/Table/DefaultCell/index.js.map +1 -1
- package/dist/elements/Table/OrderableRow.d.ts +3 -1
- package/dist/elements/Table/OrderableRow.d.ts.map +1 -1
- package/dist/elements/Table/OrderableRow.js +17 -1
- package/dist/elements/Table/OrderableRow.js.map +1 -1
- package/dist/elements/Table/OrderableTable.d.ts.map +1 -1
- package/dist/elements/Table/OrderableTable.js +20 -4
- package/dist/elements/Table/OrderableTable.js.map +1 -1
- package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
- package/dist/elements/Table/RelationshipProvider/index.js +2 -3
- package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
- package/dist/elements/Table/index.css +2 -0
- package/dist/elements/TableSection/index.css +1 -1
- package/dist/elements/Tabs/index.css +1 -0
- package/dist/elements/Thumbnail/index.css +1 -0
- package/dist/elements/Thumbnail/index.d.ts +1 -1
- package/dist/elements/Thumbnail/index.d.ts.map +1 -1
- package/dist/elements/Thumbnail/index.js.map +1 -1
- package/dist/elements/TimezonePicker/index.css +1 -0
- package/dist/elements/TimezonePicker/index.d.ts.map +1 -1
- package/dist/elements/TimezonePicker/index.js +5 -1
- package/dist/elements/TimezonePicker/index.js.map +1 -1
- package/dist/elements/Tooltip/index.css +22 -34
- package/dist/elements/Tooltip/index.d.ts +11 -3
- package/dist/elements/Tooltip/index.d.ts.map +1 -1
- package/dist/elements/Tooltip/index.js +151 -85
- package/dist/elements/Tooltip/index.js.map +1 -1
- package/dist/elements/UnpublishButton/index.d.ts.map +1 -1
- package/dist/elements/UnpublishButton/index.js +3 -4
- package/dist/elements/UnpublishButton/index.js.map +1 -1
- package/dist/elements/UnpublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/DrawerContent.js +2 -3
- package/dist/elements/UnpublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts.map +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.js.map +1 -1
- package/dist/elements/Upload/index.css +39 -37
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +37 -99
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/Upload/usePasteFromClipboard.d.ts +14 -0
- package/dist/elements/Upload/usePasteFromClipboard.d.ts.map +1 -0
- package/dist/elements/Upload/usePasteFromClipboard.js +93 -0
- package/dist/elements/Upload/usePasteFromClipboard.js.map +1 -0
- package/dist/elements/Upload/useUploadFromUrl.d.ts +20 -0
- package/dist/elements/Upload/useUploadFromUrl.d.ts.map +1 -0
- package/dist/elements/Upload/useUploadFromUrl.js +201 -0
- package/dist/elements/Upload/useUploadFromUrl.js.map +1 -0
- package/dist/elements/UploadDropzoneContent/index.css +31 -0
- package/dist/elements/UploadDropzoneContent/index.d.ts +17 -0
- package/dist/elements/UploadDropzoneContent/index.d.ts.map +1 -0
- package/dist/elements/UploadDropzoneContent/index.js +62 -0
- package/dist/elements/UploadDropzoneContent/index.js.map +1 -0
- package/dist/elements/WhereBuilder/Condition/Relationship/index.js +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.css +1 -0
- package/dist/elements/WhereBuilder/conditionValue.d.ts +32 -0
- package/dist/elements/WhereBuilder/conditionValue.d.ts.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.js +32 -0
- package/dist/elements/WhereBuilder/conditionValue.js.map +1 -0
- package/dist/elements/WhereBuilder/index.css +2 -0
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +15 -4
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/exports/client/index.d.ts +7 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +1 -1
- package/dist/exports/client/index.js.map +3 -3
- package/dist/exports/layouts.d.ts +1 -0
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -0
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/rsc/index.d.ts +2 -0
- package/dist/exports/rsc/index.d.ts.map +1 -1
- package/dist/exports/rsc/index.js +2 -0
- package/dist/exports/rsc/index.js.map +1 -1
- package/dist/exports/shared/index.d.ts +1 -0
- package/dist/exports/shared/index.d.ts.map +1 -1
- package/dist/exports/shared/index.js +2 -2
- package/dist/exports/shared/index.js.map +4 -4
- package/dist/fields/Array/ArrayRow.d.ts +1 -0
- package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
- package/dist/fields/Array/ArrayRow.js +99 -160
- package/dist/fields/Array/ArrayRow.js.map +1 -1
- package/dist/fields/Array/index.css +1 -0
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +40 -13
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/BlockRow.d.ts +1 -0
- package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
- package/dist/fields/Blocks/BlockRow.js +136 -195
- package/dist/fields/Blocks/BlockRow.js.map +1 -1
- package/dist/fields/Blocks/RowActions.d.ts +3 -0
- package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
- package/dist/fields/Blocks/RowActions.js +26 -20
- package/dist/fields/Blocks/RowActions.js.map +1 -1
- package/dist/fields/Blocks/index.css +1 -0
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +40 -13
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/Input.d.ts +4 -2
- package/dist/fields/Checkbox/Input.d.ts.map +1 -1
- package/dist/fields/Checkbox/Input.js +32 -26
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Checkbox/index.css +62 -117
- package/dist/fields/FieldDescription/index.css +5 -0
- package/dist/fields/FieldError/index.css +0 -9
- package/dist/fields/FieldError/index.d.ts.map +1 -1
- package/dist/fields/FieldError/index.js +19 -9
- package/dist/fields/FieldError/index.js.map +1 -1
- package/dist/fields/FieldLabel/index.css +22 -28
- package/dist/fields/FieldLabel/index.js +7 -8
- package/dist/fields/FieldLabel/index.js.map +1 -1
- package/dist/fields/Group/index.css +11 -4
- package/dist/fields/Join/index.css +9 -0
- package/dist/fields/Join/index.d.ts.map +1 -1
- package/dist/fields/Join/index.js +13 -9
- package/dist/fields/Join/index.js.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.css +42 -19
- package/dist/fields/RadioGroup/index.css +2 -27
- package/dist/fields/Relationship/Input.d.ts.map +1 -1
- package/dist/fields/Relationship/Input.js +34 -17
- package/dist/fields/Relationship/Input.js.map +1 -1
- package/dist/fields/Relationship/select-components/MultiValueLabel/index.css +1 -1
- package/dist/fields/Row/index.css +2 -0
- package/dist/fields/Slug/index.css +0 -1
- package/dist/fields/Slug/index.d.ts.map +1 -1
- package/dist/fields/Slug/index.js +74 -111
- package/dist/fields/Slug/index.js.map +1 -1
- package/dist/fields/Tabs/index.css +9 -0
- package/dist/fields/Textarea/index.css +1 -1
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +46 -19
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/index.css +19 -4
- package/dist/fields/shared/index.d.ts +1 -1
- package/dist/fields/shared/index.d.ts.map +1 -1
- package/dist/fields/shared/index.js.map +1 -1
- package/dist/forms/Form/context.d.ts +3 -1
- package/dist/forms/Form/context.d.ts.map +1 -1
- package/dist/forms/Form/context.js +3 -1
- package/dist/forms/Form/context.js.map +1 -1
- package/dist/forms/Form/fieldReducer.d.ts.map +1 -1
- package/dist/forms/Form/fieldReducer.js +3 -1
- package/dist/forms/Form/fieldReducer.js.map +1 -1
- package/dist/forms/Form/index.d.ts.map +1 -1
- package/dist/forms/Form/index.js +27 -22
- package/dist/forms/Form/index.js.map +1 -1
- package/dist/forms/Form/types.d.ts +1 -1
- package/dist/forms/Form/types.d.ts.map +1 -1
- package/dist/forms/Form/types.js.map +1 -1
- package/dist/forms/NullifyField/index.d.ts.map +1 -1
- package/dist/forms/NullifyField/index.js +2 -3
- package/dist/forms/NullifyField/index.js.map +1 -1
- package/dist/forms/RenderFields/index.css +10 -2
- package/dist/forms/WatchChildErrors/index.d.ts.map +1 -1
- package/dist/forms/WatchChildErrors/index.js +2 -2
- package/dist/forms/WatchChildErrors/index.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +2 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/renderField.js +4 -5
- package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts +12 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts.map +1 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js +42 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js.map +1 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts +8 -6
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js +22 -9
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/types.d.ts +1 -0
- package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
- package/dist/hooks/useControllableState.js +3 -3
- package/dist/hooks/useControllableState.js.map +1 -1
- package/dist/hooks/usePayloadAPI.d.ts.map +1 -1
- package/dist/hooks/usePayloadAPI.js +2 -3
- package/dist/hooks/usePayloadAPI.js.map +1 -1
- package/dist/icons/Edit/index.d.ts +0 -1
- package/dist/icons/Edit/index.d.ts.map +1 -1
- package/dist/icons/Edit/index.js +4 -4
- package/dist/icons/Edit/index.js.map +1 -1
- package/dist/layouts/Root/index.d.ts +1 -1
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +30 -7
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/layouts/Root/viewport.d.ts +1 -0
- package/dist/layouts/Root/viewport.d.ts.map +1 -1
- package/dist/layouts/Root/viewport.js +4 -1
- package/dist/layouts/Root/viewport.js.map +1 -1
- package/dist/providers/Actions/index.d.ts +1 -0
- package/dist/providers/Actions/index.d.ts.map +1 -1
- package/dist/providers/Actions/index.js +43 -11
- package/dist/providers/Actions/index.js.map +1 -1
- package/dist/providers/Auth/AuthSessionDebug/index.css +48 -0
- package/dist/providers/Auth/AuthSessionDebug/index.d.ts +13 -0
- package/dist/providers/Auth/AuthSessionDebug/index.d.ts.map +1 -0
- package/dist/providers/Auth/AuthSessionDebug/index.js +93 -0
- package/dist/providers/Auth/AuthSessionDebug/index.js.map +1 -0
- package/dist/providers/Auth/AuthSessionDebug/utilities.d.ts +21 -0
- package/dist/providers/Auth/AuthSessionDebug/utilities.d.ts.map +1 -0
- package/dist/providers/Auth/AuthSessionDebug/utilities.js +53 -0
- package/dist/providers/Auth/AuthSessionDebug/utilities.js.map +1 -0
- package/dist/providers/Auth/authSessionRequests.d.ts +27 -0
- package/dist/providers/Auth/authSessionRequests.d.ts.map +1 -0
- package/dist/providers/Auth/authSessionRequests.js +119 -0
- package/dist/providers/Auth/authSessionRequests.js.map +1 -0
- package/dist/providers/Auth/index.d.ts +2 -56
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +283 -135
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/Auth/sessionActivity.d.ts +23 -0
- package/dist/providers/Auth/sessionActivity.d.ts.map +1 -0
- package/dist/providers/Auth/sessionActivity.js +49 -0
- package/dist/providers/Auth/sessionActivity.js.map +1 -0
- package/dist/providers/Auth/sessionTiming.d.ts +11 -0
- package/dist/providers/Auth/sessionTiming.d.ts.map +1 -0
- package/dist/providers/Auth/sessionTiming.js +18 -0
- package/dist/providers/Auth/sessionTiming.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/index.d.ts +17 -0
- package/dist/providers/Auth/tabSessionSync/index.d.ts.map +1 -0
- package/dist/providers/Auth/tabSessionSync/index.js +263 -0
- package/dist/providers/Auth/tabSessionSync/index.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/types.d.ts +107 -0
- package/dist/providers/Auth/tabSessionSync/types.d.ts.map +1 -0
- package/dist/providers/Auth/tabSessionSync/types.js +6 -0
- package/dist/providers/Auth/tabSessionSync/types.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/useTabSessionSync.d.ts +11 -0
- package/dist/providers/Auth/tabSessionSync/useTabSessionSync.d.ts.map +1 -0
- package/dist/providers/Auth/tabSessionSync/useTabSessionSync.js +90 -0
- package/dist/providers/Auth/tabSessionSync/useTabSessionSync.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/utilities.d.ts +26 -0
- package/dist/providers/Auth/tabSessionSync/utilities.d.ts.map +1 -0
- package/dist/providers/Auth/tabSessionSync/utilities.js +159 -0
- package/dist/providers/Auth/tabSessionSync/utilities.js.map +1 -0
- package/dist/providers/Auth/types.d.ts +65 -0
- package/dist/providers/Auth/types.d.ts.map +1 -0
- package/dist/providers/Auth/types.js +2 -0
- package/dist/providers/Auth/types.js.map +1 -0
- package/dist/providers/Auth/useAuthSessionTimers.d.ts +26 -0
- package/dist/providers/Auth/useAuthSessionTimers.d.ts.map +1 -0
- package/dist/providers/Auth/useAuthSessionTimers.js +203 -0
- package/dist/providers/Auth/useAuthSessionTimers.js.map +1 -0
- package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
- package/dist/providers/DocumentInfo/index.js +32 -22
- package/dist/providers/DocumentInfo/index.js.map +1 -1
- package/dist/providers/DocumentTitle/index.d.ts +1 -0
- package/dist/providers/DocumentTitle/index.d.ts.map +1 -1
- package/dist/providers/DocumentTitle/index.js +2 -0
- package/dist/providers/DocumentTitle/index.js.map +1 -1
- package/dist/providers/Embed/index.d.ts +24 -0
- package/dist/providers/Embed/index.d.ts.map +1 -0
- package/dist/providers/Embed/index.js +105 -0
- package/dist/providers/Embed/index.js.map +1 -0
- package/dist/providers/FormErrorHandler/index.d.ts +24 -0
- package/dist/providers/FormErrorHandler/index.d.ts.map +1 -0
- package/dist/providers/FormErrorHandler/index.js +6 -0
- package/dist/providers/FormErrorHandler/index.js.map +1 -0
- package/dist/providers/LivePreview/index.d.ts.map +1 -1
- package/dist/providers/LivePreview/index.js +13 -6
- package/dist/providers/LivePreview/index.js.map +1 -1
- package/dist/providers/Locale/index.d.ts +1 -5
- package/dist/providers/Locale/index.d.ts.map +1 -1
- package/dist/providers/Locale/index.js +64 -138
- package/dist/providers/Locale/index.js.map +1 -1
- package/dist/providers/Root/index.d.ts +6 -1
- package/dist/providers/Root/index.d.ts.map +1 -1
- package/dist/providers/Root/index.js +49 -31
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/providers/RouteTransition/ProgressBar/index.js +4 -1
- package/dist/providers/RouteTransition/ProgressBar/index.js.map +1 -1
- package/dist/providers/RouteTransition/index.d.ts +2 -0
- package/dist/providers/RouteTransition/index.d.ts.map +1 -1
- package/dist/providers/RouteTransition/index.js +42 -14
- package/dist/providers/RouteTransition/index.js.map +1 -1
- package/dist/providers/Selection/index.d.ts.map +1 -1
- package/dist/providers/Selection/index.js +2 -3
- package/dist/providers/Selection/index.js.map +1 -1
- package/dist/providers/ServerFunctions/index.d.ts +5 -1
- package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
- package/dist/providers/ServerFunctions/index.js +15 -0
- package/dist/providers/ServerFunctions/index.js.map +1 -1
- package/dist/providers/SidebarTabs/index.d.ts +3 -2
- package/dist/providers/SidebarTabs/index.d.ts.map +1 -1
- package/dist/providers/SidebarTabs/index.js.map +1 -1
- package/dist/providers/TableColumns/buildColumnState/index.js +1 -2
- package/dist/providers/TableColumns/buildColumnState/index.js.map +1 -1
- package/dist/providers/Theme/index.d.ts +25 -1
- package/dist/providers/Theme/index.d.ts.map +1 -1
- package/dist/providers/Theme/index.js +331 -90
- package/dist/providers/Theme/index.js.map +1 -1
- package/dist/providers/Theme/shared.d.ts +8 -0
- package/dist/providers/Theme/shared.d.ts.map +1 -1
- package/dist/providers/Theme/shared.js +6 -0
- package/dist/providers/Theme/shared.js.map +1 -1
- package/dist/providers/UploadHandlers/index.d.ts +2 -7
- package/dist/providers/UploadHandlers/index.d.ts.map +1 -1
- package/dist/providers/UploadHandlers/index.js +102 -42
- package/dist/providers/UploadHandlers/index.js.map +1 -1
- package/dist/styles.css +208 -30
- package/dist/templates/Default/Wrapper/index.css +2 -0
- package/dist/templates/Default/index.css +1 -0
- package/dist/templates/Default/index.d.ts +1 -0
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +2 -0
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/buildFormState.d.ts.map +1 -1
- package/dist/utilities/buildFormState.js +6 -2
- package/dist/utilities/buildFormState.js.map +1 -1
- package/dist/utilities/combineFieldLabel.d.ts.map +1 -1
- package/dist/utilities/combineFieldLabel.js +5 -1
- package/dist/utilities/combineFieldLabel.js.map +1 -1
- package/dist/utilities/formatAbsoluteURL.d.ts +1 -1
- package/dist/utilities/formatAbsoluteURL.d.ts.map +1 -1
- package/dist/utilities/formatAbsoluteURL.js +18 -8
- package/dist/utilities/formatAbsoluteURL.js.map +1 -1
- package/dist/utilities/formatMetadata.d.ts.map +1 -1
- package/dist/utilities/formatMetadata.js +0 -5
- package/dist/utilities/formatMetadata.js.map +1 -1
- package/dist/utilities/generateFieldID.d.ts +1 -1
- package/dist/utilities/generateFieldID.d.ts.map +1 -1
- package/dist/utilities/generateFieldID.js +2 -2
- package/dist/utilities/generateFieldID.js.map +1 -1
- package/dist/utilities/getFilesFromClipboard.d.ts +10 -0
- package/dist/utilities/getFilesFromClipboard.d.ts.map +1 -0
- package/dist/utilities/getFilesFromClipboard.js +49 -0
- package/dist/utilities/getFilesFromClipboard.js.map +1 -0
- package/dist/utilities/getHasScheduledPublish.d.ts +2 -3
- package/dist/utilities/getHasScheduledPublish.d.ts.map +1 -1
- package/dist/utilities/getHasScheduledPublish.js +2 -5
- package/dist/utilities/getHasScheduledPublish.js.map +1 -1
- package/dist/utilities/getRequestEmbed.d.ts +14 -0
- package/dist/utilities/getRequestEmbed.d.ts.map +1 -0
- package/dist/utilities/getRequestEmbed.js +10 -0
- package/dist/utilities/getRequestEmbed.js.map +1 -0
- package/dist/utilities/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/handleAuthRedirect.js +4 -1
- package/dist/utilities/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/handleServerFunctions.d.ts +32 -8
- package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
- package/dist/utilities/handleServerFunctions.js +21 -39
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/utilities/initReq.d.ts.map +1 -1
- package/dist/utilities/initReq.js +40 -5
- package/dist/utilities/initReq.js.map +1 -1
- package/dist/utilities/isAbsoluteURL.d.ts +3 -0
- package/dist/utilities/isAbsoluteURL.d.ts.map +1 -0
- package/dist/utilities/isAbsoluteURL.js +15 -0
- package/dist/utilities/isAbsoluteURL.js.map +1 -0
- package/dist/utilities/isHttpURL.d.ts +3 -0
- package/dist/utilities/isHttpURL.d.ts.map +1 -0
- package/dist/utilities/isHttpURL.js +12 -0
- package/dist/utilities/isHttpURL.js.map +1 -0
- package/dist/utilities/isPathMatchingRoute.d.ts.map +1 -1
- package/dist/utilities/isPathMatchingRoute.js +7 -5
- package/dist/utilities/isPathMatchingRoute.js.map +1 -1
- package/dist/utilities/isPublicAdminRoute.d.ts.map +1 -1
- package/dist/utilities/isPublicAdminRoute.js +9 -6
- package/dist/utilities/isPublicAdminRoute.js.map +1 -1
- package/dist/utilities/renderTable.d.ts.map +1 -1
- package/dist/utilities/renderTable.js +18 -2
- package/dist/utilities/renderTable.js.map +1 -1
- package/dist/utilities/schedulePublishHandler.d.ts +8 -1
- package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
- package/dist/utilities/schedulePublishHandler.js +72 -5
- package/dist/utilities/schedulePublishHandler.js.map +1 -1
- package/dist/utilities/serverFunctionRegistry.d.ts +12 -7
- package/dist/utilities/serverFunctionRegistry.d.ts.map +1 -1
- package/dist/utilities/serverFunctionRegistry.js +27 -8
- package/dist/utilities/serverFunctionRegistry.js.map +1 -1
- package/dist/utilities/slugify.d.ts.map +1 -1
- package/dist/utilities/slugify.js +52 -6
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/views/API/index.client.d.ts.map +1 -1
- package/dist/views/API/index.client.js +2 -3
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.css +9 -0
- package/dist/views/Account/index.d.ts +1 -1
- package/dist/views/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +8 -5
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js +3 -2
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.js +7 -7
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js +104 -66
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.css +31 -144
- package/dist/views/Dashboard/Default/ModularDashboard/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.js +1 -0
- package/dist/views/Dashboard/Default/ModularDashboard/index.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js +4 -4
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js +3 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +12 -10
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
- package/dist/views/Dashboard/index.d.ts.map +1 -1
- package/dist/views/Dashboard/index.js +2 -3
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Document/handleServerFunction.d.ts.map +1 -1
- package/dist/views/Document/handleServerFunction.js +2 -0
- package/dist/views/Document/handleServerFunction.js.map +1 -1
- package/dist/views/Document/index.d.ts +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +10 -6
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.d.ts +1 -0
- package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
- package/dist/views/Document/renderDocumentSlots.js +7 -4
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/Edit/Auth/APIKey.d.ts +1 -1
- package/dist/views/Edit/Auth/APIKey.d.ts.map +1 -1
- package/dist/views/Edit/Auth/APIKey.js +233 -59
- package/dist/views/Edit/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts +12 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts.map +1 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.js +117 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.js.map +1 -0
- package/dist/views/Edit/Auth/index.css +91 -0
- package/dist/views/Edit/Auth/index.d.ts.map +1 -1
- package/dist/views/Edit/Auth/index.js +10 -28
- package/dist/views/Edit/Auth/index.js.map +1 -1
- package/dist/views/Edit/Auth/types.d.ts +3 -1
- package/dist/views/Edit/Auth/types.d.ts.map +1 -1
- package/dist/views/Edit/Auth/types.js.map +1 -1
- package/dist/views/Edit/SetDocumentTitle/index.d.ts.map +1 -1
- package/dist/views/Edit/SetDocumentTitle/index.js +4 -1
- package/dist/views/Edit/SetDocumentTitle/index.js.map +1 -1
- package/dist/views/Edit/index.css +80 -53
- package/dist/views/Edit/index.d.ts.map +1 -1
- package/dist/views/Edit/index.js +16 -2
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/Edit/useEditViewWidth.d.ts +8 -0
- package/dist/views/Edit/useEditViewWidth.d.ts.map +1 -0
- package/dist/views/Edit/useEditViewWidth.js +56 -0
- package/dist/views/Edit/useEditViewWidth.js.map +1 -0
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.css +14 -0
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +209 -161
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/index.js +2 -11
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.css +1 -0
- package/dist/views/HierarchyList/index.css +17 -1
- package/dist/views/List/ListHeader/index.css +6 -0
- package/dist/views/List/ListHeader/index.d.ts +1 -11
- package/dist/views/List/ListHeader/index.d.ts.map +1 -1
- package/dist/views/List/ListHeader/index.js +3 -9
- package/dist/views/List/ListHeader/index.js.map +1 -1
- package/dist/views/List/handleServerFunction.d.ts.map +1 -1
- package/dist/views/List/handleServerFunction.js +3 -1
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.client.d.ts.map +1 -1
- package/dist/views/List/index.client.js +3 -16
- package/dist/views/List/index.client.js.map +1 -1
- package/dist/views/List/index.css +20 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +6 -1
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Logout/index.d.ts.map +1 -1
- package/dist/views/Logout/index.js +11 -0
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/NotFound/client.d.ts +2 -0
- package/dist/views/NotFound/client.d.ts.map +1 -0
- package/dist/views/NotFound/client.js +4 -0
- package/dist/views/NotFound/client.js.map +1 -0
- package/dist/views/NotFound/page.d.ts.map +1 -1
- package/dist/views/NotFound/page.js +4 -3
- package/dist/views/NotFound/page.js.map +1 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.js.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.js.map +1 -1
- package/dist/views/Root/getCustomViewByKey.d.ts.map +1 -1
- package/dist/views/Root/getCustomViewByKey.js.map +1 -1
- package/dist/views/Root/index.d.ts +12 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +42 -25
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Verify/index.d.ts +1 -1
- package/dist/views/Verify/index.d.ts.map +1 -1
- package/dist/views/Verify/index.js +4 -4
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +10 -13
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.css +29 -9
- package/dist/views/Version/Default/index.d.ts.map +1 -1
- package/dist/views/Version/Default/index.js +16 -13
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts +1 -0
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +56 -50
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +41 -27
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.css +8 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +10 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.css +1 -0
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.css +1 -0
- package/dist/views/Version/RenderFieldsToDiff/index.css +2 -0
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +33 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts +8 -2
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +17 -19
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
- package/dist/views/Version/Restore/index.d.ts.map +1 -1
- package/dist/views/Version/Restore/index.js +9 -6
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/generateVersionViewMetadata.js.map +1 -1
- package/dist/views/Versions/VersionPillLabel/VersionPillLabel.d.ts.map +1 -1
- package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js +2 -3
- package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js.map +1 -1
- package/dist/views/Versions/VersionPillLabel/index.css +1 -0
- package/dist/views/Versions/generateVersionsViewMetadata.js.map +1 -1
- package/dist/views/Versions/index.css +7 -0
- package/dist/widgets/CollectionCards/index.client.js +1 -1
- package/dist/widgets/CollectionCards/index.client.js.map +1 -1
- package/dist/widgets/CollectionCards/index.css +40 -35
- package/dist/widgets/CollectionCards/index.js +1 -1
- package/dist/widgets/CollectionCards/index.js.map +1 -1
- package/dist/widgets/RecentlyViewed/DocumentActivity/index.css +184 -0
- package/dist/widgets/RecentlyViewed/DocumentActivity/index.d.ts +5 -0
- package/dist/widgets/RecentlyViewed/DocumentActivity/index.d.ts.map +1 -0
- package/dist/widgets/RecentlyViewed/DocumentActivity/index.js +225 -0
- package/dist/widgets/RecentlyViewed/DocumentActivity/index.js.map +1 -0
- package/dist/widgets/RecentlyViewed/DocumentItem/index.css +180 -0
- package/dist/widgets/RecentlyViewed/DocumentItem/index.d.ts +11 -0
- package/dist/widgets/RecentlyViewed/DocumentItem/index.d.ts.map +1 -0
- package/dist/widgets/RecentlyViewed/DocumentItem/index.js +104 -0
- package/dist/widgets/RecentlyViewed/DocumentItem/index.js.map +1 -0
- package/dist/widgets/RecentlyViewed/getDocumentThumbnail.d.ts +10 -0
- package/dist/widgets/RecentlyViewed/getDocumentThumbnail.d.ts.map +1 -0
- package/dist/widgets/RecentlyViewed/getDocumentThumbnail.js +85 -0
- package/dist/widgets/RecentlyViewed/getDocumentThumbnail.js.map +1 -0
- package/dist/widgets/RecentlyViewed/getDocumentWidgetData.d.ts +7 -0
- package/dist/widgets/RecentlyViewed/getDocumentWidgetData.d.ts.map +1 -0
- package/dist/widgets/RecentlyViewed/getDocumentWidgetData.js +206 -0
- package/dist/widgets/RecentlyViewed/getDocumentWidgetData.js.map +1 -0
- package/dist/widgets/RecentlyViewed/index.d.ts +3 -5
- package/dist/widgets/RecentlyViewed/index.d.ts.map +1 -1
- package/dist/widgets/RecentlyViewed/index.js +10 -140
- package/dist/widgets/RecentlyViewed/index.js.map +1 -1
- package/dist/widgets/RecentlyViewed/shared.d.ts +38 -0
- package/dist/widgets/RecentlyViewed/shared.d.ts.map +1 -0
- package/dist/widgets/RecentlyViewed/shared.js +70 -0
- package/dist/widgets/RecentlyViewed/shared.js.map +1 -0
- package/dist/widgets/UploadDropzone/index.client.d.ts +7 -0
- package/dist/widgets/UploadDropzone/index.client.d.ts.map +1 -0
- package/dist/widgets/UploadDropzone/index.client.js +134 -0
- package/dist/widgets/UploadDropzone/index.client.js.map +1 -0
- package/dist/widgets/UploadDropzone/index.css +50 -0
- package/dist/widgets/UploadDropzone/index.d.ts +8 -0
- package/dist/widgets/UploadDropzone/index.d.ts.map +1 -0
- package/dist/widgets/UploadDropzone/index.js +29 -0
- package/dist/widgets/UploadDropzone/index.js.map +1 -0
- package/dist/widgets/Welcome/index.css +13 -0
- package/dist/widgets/Welcome/index.d.ts +5 -0
- package/dist/widgets/Welcome/index.d.ts.map +1 -0
- package/dist/widgets/Welcome/index.js +26 -0
- package/dist/widgets/Welcome/index.js.map +1 -0
- package/dist/widgets/WidgetIcon/assets/images.svg +3 -0
- package/dist/widgets/WidgetIcon/assets/pin-solid.svg +3 -0
- package/dist/widgets/WidgetIcon/assets/pin.svg +3 -0
- package/dist/widgets/WidgetIcon/assets/table.svg +3 -0
- package/dist/widgets/WidgetIcon/index.css +23 -0
- package/dist/widgets/WidgetIcon/index.d.ts +6 -0
- package/dist/widgets/WidgetIcon/index.d.ts.map +1 -0
- package/dist/widgets/WidgetIcon/index.js +10 -0
- package/dist/widgets/WidgetIcon/index.js.map +1 -0
- package/package.json +14 -12
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +0 -541
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +0 -1
- package/dist/elements/ColumnSelection/matchesColumnSearch.spec.js +0 -87
- package/dist/elements/ColumnSelection/matchesColumnSearch.spec.js.map +0 -1
- package/dist/elements/CommandPalette/buildActions.spec.js +0 -158
- package/dist/elements/CommandPalette/buildActions.spec.js.map +0 -1
- package/dist/elements/CommandPalette/highlightLabel.spec.js +0 -78
- package/dist/elements/CommandPalette/highlightLabel.spec.js.map +0 -1
- package/dist/elements/RelationshipTable/Pagination.css +0 -39
- package/dist/elements/Toasts/fieldErrors.spec.js +0 -46
- package/dist/elements/Toasts/fieldErrors.spec.js.map +0 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/optionsReducer.spec.js +0 -152
- package/dist/elements/WhereBuilder/Condition/Relationship/optionsReducer.spec.js.map +0 -1
- package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.d.ts +0 -2
- package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.d.ts.map +0 -1
- package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js +0 -67
- package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js.map +0 -1
- package/dist/layouts/Root/index.spec.js +0 -20
- package/dist/layouts/Root/index.spec.js.map +0 -1
- package/dist/scss/app.scss +0 -183
- package/dist/scss/colors.scss +0 -191
- package/dist/scss/custom.css +0 -1
- package/dist/scss/queries.scss +0 -27
- package/dist/scss/styles.scss +0 -9
- package/dist/scss/svg.scss +0 -10
- package/dist/scss/toastify.scss +0 -61
- package/dist/scss/vars.scss +0 -192
- package/dist/scss/z-index.scss +0 -9
- package/dist/utilities/appendCacheTag.spec.js +0 -34
- package/dist/utilities/appendCacheTag.spec.js.map +0 -1
- package/dist/utilities/formatMetadata.spec.js +0 -83
- package/dist/utilities/formatMetadata.spec.js.map +0 -1
- package/dist/utilities/fuzzyMatch.spec.js +0 -38
- package/dist/utilities/fuzzyMatch.spec.js.map +0 -1
- package/dist/utilities/isCustomAdminView.spec.js +0 -90
- package/dist/utilities/isCustomAdminView.spec.js.map +0 -1
- package/dist/utilities/isPathMatchingRoute.spec.js +0 -178
- package/dist/utilities/isPathMatchingRoute.spec.js.map +0 -1
- package/dist/utilities/normalizeRelationshipValue.spec.js +0 -373
- package/dist/utilities/normalizeRelationshipValue.spec.js.map +0 -1
- package/dist/utilities/recentlyViewed.spec.js +0 -92
- package/dist/utilities/recentlyViewed.spec.js.map +0 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.spec.js +0 -168
- package/dist/views/Root/getCustomCollectionViewByRoute.spec.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +0 -861
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +0 -47
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +0 -135
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +0 -1
- package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js +0 -100
- package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isPathMatchingRoute.spec.js","names":["describe","expect","it","isPathMatchingRoute","currentRoute","path","undefined","toBe","exact","sensitive","strict"],"sources":["../../src/utilities/isPathMatchingRoute.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { isPathMatchingRoute } from './isPathMatchingRoute.js'\n\ndescribe('isPathMatchingRoute', () => {\n describe('no path defined', () => {\n it('should return false when path is undefined', () => {\n expect(isPathMatchingRoute({ currentRoute: '/anything', path: undefined })).toBe(false)\n })\n\n it('should return false when path is empty string', () => {\n expect(isPathMatchingRoute({ currentRoute: '/anything', path: '' })).toBe(false)\n })\n })\n\n describe('exact matching', () => {\n it('should match when currentRoute exactly equals the static path', () => {\n expect(\n isPathMatchingRoute({ currentRoute: '/dashboard', exact: true, path: '/dashboard' }),\n ).toBe(true)\n })\n\n it('should not match when currentRoute differs from the path', () => {\n expect(\n isPathMatchingRoute({ currentRoute: '/settings', exact: true, path: '/dashboard' }),\n ).toBe(false)\n })\n\n it('should not match a sub-path when exact is true', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/dashboard/settings',\n exact: true,\n path: '/dashboard',\n }),\n ).toBe(false)\n })\n\n it('should match a parameterized path exactly', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/custom/123',\n exact: true,\n path: '/custom/:id',\n }),\n ).toBe(true)\n })\n\n it('should not match a parameterized path with extra segments', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/custom/123/edit',\n exact: true,\n path: '/custom/:id',\n }),\n ).toBe(false)\n })\n\n it('should match root path exactly', () => {\n expect(isPathMatchingRoute({ currentRoute: '/', exact: true, path: '/' })).toBe(true)\n })\n\n it('should not match root path against other routes when exact', () => {\n expect(isPathMatchingRoute({ currentRoute: '/login', exact: true, path: '/' })).toBe(false)\n })\n })\n\n describe('non-exact (prefix) matching', () => {\n it('should match when currentRoute equals the path', () => {\n expect(isPathMatchingRoute({ currentRoute: '/dashboard', path: '/dashboard' })).toBe(true)\n })\n\n it('should match a sub-path at a segment boundary', () => {\n expect(isPathMatchingRoute({ currentRoute: '/dashboard/settings', path: '/dashboard' })).toBe(\n true,\n )\n })\n\n it('should match deeply nested sub-paths', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/dashboard/settings/advanced/debug',\n path: '/dashboard',\n }),\n ).toBe(true)\n })\n\n it('should not match when route shares a prefix but not at a segment boundary', () => {\n expect(isPathMatchingRoute({ currentRoute: '/dashboard-extra', path: '/dashboard' })).toBe(\n false,\n )\n })\n\n it('should not match a completely different route', () => {\n expect(isPathMatchingRoute({ currentRoute: '/settings', path: '/dashboard' })).toBe(false)\n })\n\n it('should match a parameterized path with a sub-path', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/custom/123/edit',\n path: '/custom/:id',\n }),\n ).toBe(false)\n // pathToRegexp is end-anchored by default, so /custom/:id does not match /custom/123/edit.\n // The literal fallback '/custom/:id' also won't startsWith-match.\n // Parameterized views should use exact: true or include all segments in the pattern.\n })\n\n it('should match when :id captures the full segment including non-slash characters', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/custom/123extra',\n path: '/custom/:id',\n }),\n ).toBe(true)\n // :id captures everything up to the next / — '123extra' is a valid :id value\n })\n })\n\n describe('root path / without exact — regression for route shadowing bug', () => {\n it('should match root path against itself', () => {\n expect(isPathMatchingRoute({ currentRoute: '/', path: '/' })).toBe(true)\n })\n\n it('should not match root path against /login', () => {\n expect(isPathMatchingRoute({ currentRoute: '/login', path: '/' })).toBe(false)\n })\n\n it('should not match root path against /collections/posts', () => {\n expect(isPathMatchingRoute({ currentRoute: '/collections/posts', path: '/' })).toBe(false)\n })\n\n it('should not match root path against /collections/posts/123', () => {\n expect(isPathMatchingRoute({ currentRoute: '/collections/posts/123', path: '/' })).toBe(false)\n })\n })\n\n describe('sensitive option', () => {\n it('should match case-insensitively by default', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/Dashboard',\n exact: true,\n path: '/dashboard',\n }),\n ).toBe(true)\n })\n\n it('should not match different cases when sensitive is true', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/Dashboard',\n exact: true,\n path: '/dashboard',\n sensitive: true,\n }),\n ).toBe(false)\n })\n })\n\n describe('strict option', () => {\n it('should match with or without trailing slash by default', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/dashboard/',\n exact: true,\n path: '/dashboard',\n }),\n ).toBe(true)\n })\n\n it('should not match trailing slash mismatch when strict is true', () => {\n expect(\n isPathMatchingRoute({\n currentRoute: '/dashboard/',\n exact: true,\n path: '/dashboard',\n strict: true,\n }),\n ).toBe(false)\n })\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,mBAAmB,QAAQ;AAEpCH,QAAA,CAAS,uBAAuB;EAC9BA,QAAA,CAAS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,IAAI,CAAC;IACrE;IAEAL,EAAA,CAAG,6CAA6C;MAC9CD,MAAA,CAAOE,mBAAA,CAAoB;QAAEC,YAAA,EAAc;QAAUC,IAAA,EAAM;MAAI,IAAIE,IAAI,CAAC;IAC1E;IAEAL,EAAA,CAAG,yDAAyD;MAC1DD,MAAA,CAAOE,mBAAA,CAAoB;QAAEC,YAAA,EAAc;QAAsBC,IAAA,EAAM;MAAI,IAAIE,IAAI,CAAC;IACtF;IAEAL,EAAA,CAAG,6DAA6D;MAC9DD,MAAA,CAAOE,mBAAA,CAAoB;QAAEC,YAAA,EAAc;QAA0BC,IAAA,EAAM;MAAI,IAAIE,IAAI,CAAC;IAC1F;EACF;EAEAP,QAAA,CAAS,oBAAoB;IAC3BE,EAAA,CAAG,8CAA8C;MAC/CD,MAAA,CACEE,mBAAA,CAAoB;QAClBC,YAAA,EAAc;QACdI,KAAA,EAAO;QACPH,IAAA,EAAM;MACR,IACAE,IAAI,CAAC;IACT;IAEAL,EAAA,CAAG,2DAA2D;MAC5DD,MAAA,CACEE,mBAAA,CAAoB;QAClBC,YAAA,EAAc;QACdI,KAAA,EAAO;QACPH,IAAA,EAAM;QACNI,SAAA,EAAW;MACb,IACAF,IAAI,CAAC;IACT;EACF;EAEAP,QAAA,CAAS,iBAAiB;IACxBE,EAAA,CAAG,0DAA0D;MAC3DD,MAAA,CACEE,mBAAA,CAAoB;QAClBC,YAAA,EAAc;QACdI,KAAA,EAAO;QACPH,IAAA,EAAM;MACR,IACAE,IAAI,CAAC;IACT;IAEAL,EAAA,CAAG,gEAAgE;MACjED,MAAA,CACEE,mBAAA,CAAoB;QAClBC,YAAA,EAAc;QACdI,KAAA,EAAO;QACPH,IAAA,EAAM;QACNK,MAAA,EAAQ;MACV,IACAH,IAAI,CAAC;IACT;EACF;AACF","ignoreList":[]}
|
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { normalizeRelationshipValue } from './normalizeRelationshipValue.js';
|
|
3
|
-
describe('normalizeRelationshipValue', () => {
|
|
4
|
-
describe('Monomorphic relationships (string relationTo)', () => {
|
|
5
|
-
const relationTo = 'users';
|
|
6
|
-
it('should return simple string ID as-is', () => {
|
|
7
|
-
const result = normalizeRelationshipValue('user123', relationTo);
|
|
8
|
-
expect(result).toBe('user123');
|
|
9
|
-
});
|
|
10
|
-
it('should return simple number ID as-is', () => {
|
|
11
|
-
const result = normalizeRelationshipValue(123, relationTo);
|
|
12
|
-
expect(result).toBe(123);
|
|
13
|
-
});
|
|
14
|
-
it('should extract ID from object with relationTo and value', () => {
|
|
15
|
-
const value = {
|
|
16
|
-
relationTo: 'users',
|
|
17
|
-
value: 'user456'
|
|
18
|
-
};
|
|
19
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
20
|
-
expect(result).toBe('user456');
|
|
21
|
-
});
|
|
22
|
-
it('should extract ID from nested value structure', () => {
|
|
23
|
-
const value = {
|
|
24
|
-
relationTo: 'users',
|
|
25
|
-
value: {
|
|
26
|
-
value: 'user789'
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
30
|
-
expect(result).toBe('user789');
|
|
31
|
-
});
|
|
32
|
-
it('should extract ID from deeply nested value structure', () => {
|
|
33
|
-
const value = {
|
|
34
|
-
relationTo: 'users',
|
|
35
|
-
value: {
|
|
36
|
-
value: {
|
|
37
|
-
value: 'user999'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
42
|
-
expect(result).toBe('user999');
|
|
43
|
-
});
|
|
44
|
-
it('should extract ID from populated document', () => {
|
|
45
|
-
const value = {
|
|
46
|
-
relationTo: 'users',
|
|
47
|
-
value: {
|
|
48
|
-
id: 'user111',
|
|
49
|
-
name: 'John Doe',
|
|
50
|
-
email: 'john@example.com'
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
54
|
-
expect(result).toBe('user111');
|
|
55
|
-
});
|
|
56
|
-
it('should extract ID from populated document without relationTo wrapper', () => {
|
|
57
|
-
const value = {
|
|
58
|
-
id: 'user222',
|
|
59
|
-
name: 'Jane Doe',
|
|
60
|
-
email: 'jane@example.com'
|
|
61
|
-
};
|
|
62
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
63
|
-
expect(result).toBe('user222');
|
|
64
|
-
});
|
|
65
|
-
it('should handle null values', () => {
|
|
66
|
-
const result = normalizeRelationshipValue(null, relationTo);
|
|
67
|
-
expect(result).toBeNull();
|
|
68
|
-
});
|
|
69
|
-
it('should handle undefined values', () => {
|
|
70
|
-
const result = normalizeRelationshipValue(undefined, relationTo);
|
|
71
|
-
expect(result).toBeUndefined();
|
|
72
|
-
});
|
|
73
|
-
it('should handle empty object', () => {
|
|
74
|
-
const result = normalizeRelationshipValue({}, relationTo);
|
|
75
|
-
expect(result).toEqual({});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
describe('Polymorphic relationships (array relationTo)', () => {
|
|
79
|
-
const relationTo = ['users', 'posts', 'pages'];
|
|
80
|
-
it('should return simple string ID as-is', () => {
|
|
81
|
-
const result = normalizeRelationshipValue('user123', relationTo);
|
|
82
|
-
expect(result).toBe('user123');
|
|
83
|
-
});
|
|
84
|
-
it('should return simple number ID as-is', () => {
|
|
85
|
-
const result = normalizeRelationshipValue(456, relationTo);
|
|
86
|
-
expect(result).toBe(456);
|
|
87
|
-
});
|
|
88
|
-
it('should preserve relationTo structure with string value', () => {
|
|
89
|
-
const value = {
|
|
90
|
-
relationTo: 'users',
|
|
91
|
-
value: 'user789'
|
|
92
|
-
};
|
|
93
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
94
|
-
expect(result).toEqual({
|
|
95
|
-
relationTo: 'users',
|
|
96
|
-
value: 'user789'
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
it('should preserve relationTo structure with number value', () => {
|
|
100
|
-
const value = {
|
|
101
|
-
relationTo: 'posts',
|
|
102
|
-
value: 123
|
|
103
|
-
};
|
|
104
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
105
|
-
expect(result).toEqual({
|
|
106
|
-
relationTo: 'posts',
|
|
107
|
-
value: 123
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
it('should extract ID from nested value structure', () => {
|
|
111
|
-
const value = {
|
|
112
|
-
relationTo: 'posts',
|
|
113
|
-
value: {
|
|
114
|
-
value: 'post456'
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
118
|
-
expect(result).toEqual({
|
|
119
|
-
relationTo: 'posts',
|
|
120
|
-
value: 'post456'
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
it('should extract ID from deeply nested value structure', () => {
|
|
124
|
-
const value = {
|
|
125
|
-
relationTo: 'pages',
|
|
126
|
-
value: {
|
|
127
|
-
value: {
|
|
128
|
-
value: 'page789'
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
133
|
-
expect(result).toEqual({
|
|
134
|
-
relationTo: 'pages',
|
|
135
|
-
value: 'page789'
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
it('should extract ID from populated document', () => {
|
|
139
|
-
const value = {
|
|
140
|
-
relationTo: 'users',
|
|
141
|
-
value: {
|
|
142
|
-
id: 'user999',
|
|
143
|
-
name: 'John Smith',
|
|
144
|
-
email: 'john.smith@example.com'
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
148
|
-
expect(result).toEqual({
|
|
149
|
-
relationTo: 'users',
|
|
150
|
-
value: 'user999'
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
it('should extract ID from complex populated document', () => {
|
|
154
|
-
const value = {
|
|
155
|
-
relationTo: 'posts',
|
|
156
|
-
value: {
|
|
157
|
-
id: 'post123',
|
|
158
|
-
title: 'My Post',
|
|
159
|
-
author: {
|
|
160
|
-
id: 'author456',
|
|
161
|
-
name: 'Author Name'
|
|
162
|
-
},
|
|
163
|
-
createdAt: '2023-01-01T00:00:00.000Z'
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
167
|
-
expect(result).toEqual({
|
|
168
|
-
relationTo: 'posts',
|
|
169
|
-
value: 'post123'
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
it('should handle different relationTo values', () => {
|
|
173
|
-
const values = [{
|
|
174
|
-
relationTo: 'users',
|
|
175
|
-
value: 'user1'
|
|
176
|
-
}, {
|
|
177
|
-
relationTo: 'posts',
|
|
178
|
-
value: 'post2'
|
|
179
|
-
}, {
|
|
180
|
-
relationTo: 'pages',
|
|
181
|
-
value: 'page3'
|
|
182
|
-
}];
|
|
183
|
-
const results = values.map(v => normalizeRelationshipValue(v, relationTo));
|
|
184
|
-
expect(results).toEqual([{
|
|
185
|
-
relationTo: 'users',
|
|
186
|
-
value: 'user1'
|
|
187
|
-
}, {
|
|
188
|
-
relationTo: 'posts',
|
|
189
|
-
value: 'post2'
|
|
190
|
-
}, {
|
|
191
|
-
relationTo: 'pages',
|
|
192
|
-
value: 'page3'
|
|
193
|
-
}]);
|
|
194
|
-
});
|
|
195
|
-
it('should handle null values', () => {
|
|
196
|
-
const result = normalizeRelationshipValue(null, relationTo);
|
|
197
|
-
expect(result).toBeNull();
|
|
198
|
-
});
|
|
199
|
-
it('should handle undefined values', () => {
|
|
200
|
-
const result = normalizeRelationshipValue(undefined, relationTo);
|
|
201
|
-
expect(result).toBeUndefined();
|
|
202
|
-
});
|
|
203
|
-
it('should extract ID from populated document without relationTo wrapper', () => {
|
|
204
|
-
const value = {
|
|
205
|
-
id: 'doc123',
|
|
206
|
-
title: 'Document Title'
|
|
207
|
-
};
|
|
208
|
-
const result = normalizeRelationshipValue(value, relationTo);
|
|
209
|
-
expect(result).toBe('doc123');
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
describe('Edge cases', () => {
|
|
213
|
-
it('should handle object with only value property (no relationTo)', () => {
|
|
214
|
-
const value = {
|
|
215
|
-
value: 'someValue'
|
|
216
|
-
};
|
|
217
|
-
const result = normalizeRelationshipValue(value, 'users');
|
|
218
|
-
// Since there's no 'id' field and no relationTo, it should return the value as-is
|
|
219
|
-
expect(result).toEqual({
|
|
220
|
-
value: 'someValue'
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
it('should handle object with relationTo but no value', () => {
|
|
224
|
-
const value = {
|
|
225
|
-
relationTo: 'users'
|
|
226
|
-
};
|
|
227
|
-
const result = normalizeRelationshipValue(value, ['users', 'posts']);
|
|
228
|
-
expect(result).toEqual({
|
|
229
|
-
relationTo: 'users'
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
it('should handle empty array relationTo', () => {
|
|
233
|
-
const result = normalizeRelationshipValue('user123', []);
|
|
234
|
-
expect(result).toBe('user123');
|
|
235
|
-
});
|
|
236
|
-
it('should handle single-item array relationTo as polymorphic', () => {
|
|
237
|
-
const value = {
|
|
238
|
-
relationTo: 'users',
|
|
239
|
-
value: 'user123'
|
|
240
|
-
};
|
|
241
|
-
const result = normalizeRelationshipValue(value, ['users']);
|
|
242
|
-
expect(result).toEqual({
|
|
243
|
-
relationTo: 'users',
|
|
244
|
-
value: 'user123'
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
it('should handle numeric IDs in populated documents', () => {
|
|
248
|
-
const value = {
|
|
249
|
-
relationTo: 'users',
|
|
250
|
-
value: {
|
|
251
|
-
id: 12345,
|
|
252
|
-
name: 'User with numeric ID'
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
const result = normalizeRelationshipValue(value, ['users', 'posts']);
|
|
256
|
-
expect(result).toEqual({
|
|
257
|
-
relationTo: 'users',
|
|
258
|
-
value: 12345
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
it('should handle nested null values', () => {
|
|
262
|
-
const value = {
|
|
263
|
-
relationTo: 'users',
|
|
264
|
-
value: null
|
|
265
|
-
};
|
|
266
|
-
const result = normalizeRelationshipValue(value, 'users');
|
|
267
|
-
expect(result).toBeNull();
|
|
268
|
-
});
|
|
269
|
-
it('should handle zero as a valid ID', () => {
|
|
270
|
-
const result = normalizeRelationshipValue(0, 'users');
|
|
271
|
-
expect(result).toBe(0);
|
|
272
|
-
});
|
|
273
|
-
it('should handle empty string as a valid ID', () => {
|
|
274
|
-
const result = normalizeRelationshipValue('', 'users');
|
|
275
|
-
expect(result).toBe('');
|
|
276
|
-
});
|
|
277
|
-
it('should handle false as a value', () => {
|
|
278
|
-
const result = normalizeRelationshipValue(false, 'users');
|
|
279
|
-
expect(result).toBe(false);
|
|
280
|
-
});
|
|
281
|
-
it('should handle array values (return as-is)', () => {
|
|
282
|
-
const result = normalizeRelationshipValue(['user1', 'user2'], 'users');
|
|
283
|
-
expect(result).toEqual(['user1', 'user2']);
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
describe('Real-world scenarios', () => {
|
|
287
|
-
it('should normalize upload field value for monomorphic upload', () => {
|
|
288
|
-
// Upload field with populated media document
|
|
289
|
-
const value = {
|
|
290
|
-
id: 'media123',
|
|
291
|
-
filename: 'image.jpg',
|
|
292
|
-
mimeType: 'image/jpeg',
|
|
293
|
-
filesize: 12345,
|
|
294
|
-
url: '/media/image.jpg'
|
|
295
|
-
};
|
|
296
|
-
const result = normalizeRelationshipValue(value, 'media');
|
|
297
|
-
expect(result).toBe('media123');
|
|
298
|
-
});
|
|
299
|
-
it('should normalize upload field value for polymorphic upload', () => {
|
|
300
|
-
// Upload field with relationTo structure
|
|
301
|
-
const value = {
|
|
302
|
-
relationTo: 'images',
|
|
303
|
-
value: {
|
|
304
|
-
id: 'image456',
|
|
305
|
-
filename: 'photo.png',
|
|
306
|
-
url: '/media/photo.png'
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
const result = normalizeRelationshipValue(value, ['images', 'videos']);
|
|
310
|
-
expect(result).toEqual({
|
|
311
|
-
relationTo: 'images',
|
|
312
|
-
value: 'image456'
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
it('should normalize form submission data', () => {
|
|
316
|
-
// Data coming from form with populated relationship
|
|
317
|
-
const value = {
|
|
318
|
-
relationTo: 'posts',
|
|
319
|
-
value: {
|
|
320
|
-
id: 'post789',
|
|
321
|
-
title: 'Blog Post Title',
|
|
322
|
-
author: {
|
|
323
|
-
id: 'author123',
|
|
324
|
-
name: 'Author'
|
|
325
|
-
},
|
|
326
|
-
publishedDate: '2023-12-01'
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
const result = normalizeRelationshipValue(value, ['posts', 'pages']);
|
|
330
|
-
expect(result).toEqual({
|
|
331
|
-
relationTo: 'posts',
|
|
332
|
-
value: 'post789'
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
it('should normalize API response with nested relationships', () => {
|
|
336
|
-
// Complex nested structure from API
|
|
337
|
-
const value = {
|
|
338
|
-
relationTo: 'categories',
|
|
339
|
-
value: {
|
|
340
|
-
value: {
|
|
341
|
-
id: 'cat123',
|
|
342
|
-
name: 'Category Name'
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
const result = normalizeRelationshipValue(value, ['categories', 'tags']);
|
|
347
|
-
expect(result).toEqual({
|
|
348
|
-
relationTo: 'categories',
|
|
349
|
-
value: 'cat123'
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
it('should handle table cell data normalization', () => {
|
|
353
|
-
// Cell data from table that might be just an ID
|
|
354
|
-
const simpleValue = 'user123';
|
|
355
|
-
const result = normalizeRelationshipValue(simpleValue, 'users');
|
|
356
|
-
expect(result).toBe('user123');
|
|
357
|
-
// Cell data with full structure
|
|
358
|
-
const complexValue = {
|
|
359
|
-
relationTo: 'users',
|
|
360
|
-
value: {
|
|
361
|
-
id: 'user456',
|
|
362
|
-
name: 'John Doe'
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
const result2 = normalizeRelationshipValue(complexValue, ['users', 'admins']);
|
|
366
|
-
expect(result2).toEqual({
|
|
367
|
-
relationTo: 'users',
|
|
368
|
-
value: 'user456'
|
|
369
|
-
});
|
|
370
|
-
});
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
//# sourceMappingURL=normalizeRelationshipValue.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeRelationshipValue.spec.js","names":["describe","it","expect","normalizeRelationshipValue","relationTo","result","toBe","value","id","name","email","toBeNull","undefined","toBeUndefined","toEqual","title","author","createdAt","values","results","map","v","filename","mimeType","filesize","url","publishedDate","simpleValue","complexValue","result2"],"sources":["../../src/utilities/normalizeRelationshipValue.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { normalizeRelationshipValue } from './normalizeRelationshipValue.js'\n\ndescribe('normalizeRelationshipValue', () => {\n describe('Monomorphic relationships (string relationTo)', () => {\n const relationTo = 'users'\n\n it('should return simple string ID as-is', () => {\n const result = normalizeRelationshipValue('user123', relationTo)\n expect(result).toBe('user123')\n })\n\n it('should return simple number ID as-is', () => {\n const result = normalizeRelationshipValue(123, relationTo)\n expect(result).toBe(123)\n })\n\n it('should extract ID from object with relationTo and value', () => {\n const value = { relationTo: 'users', value: 'user456' }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toBe('user456')\n })\n\n it('should extract ID from nested value structure', () => {\n const value = {\n relationTo: 'users',\n value: {\n value: 'user789',\n },\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toBe('user789')\n })\n\n it('should extract ID from deeply nested value structure', () => {\n const value = {\n relationTo: 'users',\n value: {\n value: {\n value: 'user999',\n },\n },\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toBe('user999')\n })\n\n it('should extract ID from populated document', () => {\n const value = {\n relationTo: 'users',\n value: {\n id: 'user111',\n name: 'John Doe',\n email: 'john@example.com',\n },\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toBe('user111')\n })\n\n it('should extract ID from populated document without relationTo wrapper', () => {\n const value = {\n id: 'user222',\n name: 'Jane Doe',\n email: 'jane@example.com',\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toBe('user222')\n })\n\n it('should handle null values', () => {\n const result = normalizeRelationshipValue(null, relationTo)\n expect(result).toBeNull()\n })\n\n it('should handle undefined values', () => {\n const result = normalizeRelationshipValue(undefined, relationTo)\n expect(result).toBeUndefined()\n })\n\n it('should handle empty object', () => {\n const result = normalizeRelationshipValue({}, relationTo)\n expect(result).toEqual({})\n })\n })\n\n describe('Polymorphic relationships (array relationTo)', () => {\n const relationTo = ['users', 'posts', 'pages']\n\n it('should return simple string ID as-is', () => {\n const result = normalizeRelationshipValue('user123', relationTo)\n expect(result).toBe('user123')\n })\n\n it('should return simple number ID as-is', () => {\n const result = normalizeRelationshipValue(456, relationTo)\n expect(result).toBe(456)\n })\n\n it('should preserve relationTo structure with string value', () => {\n const value = { relationTo: 'users', value: 'user789' }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toEqual({ relationTo: 'users', value: 'user789' })\n })\n\n it('should preserve relationTo structure with number value', () => {\n const value = { relationTo: 'posts', value: 123 }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toEqual({ relationTo: 'posts', value: 123 })\n })\n\n it('should extract ID from nested value structure', () => {\n const value = {\n relationTo: 'posts',\n value: {\n value: 'post456',\n },\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toEqual({ relationTo: 'posts', value: 'post456' })\n })\n\n it('should extract ID from deeply nested value structure', () => {\n const value = {\n relationTo: 'pages',\n value: {\n value: {\n value: 'page789',\n },\n },\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toEqual({ relationTo: 'pages', value: 'page789' })\n })\n\n it('should extract ID from populated document', () => {\n const value = {\n relationTo: 'users',\n value: {\n id: 'user999',\n name: 'John Smith',\n email: 'john.smith@example.com',\n },\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toEqual({ relationTo: 'users', value: 'user999' })\n })\n\n it('should extract ID from complex populated document', () => {\n const value = {\n relationTo: 'posts',\n value: {\n id: 'post123',\n title: 'My Post',\n author: {\n id: 'author456',\n name: 'Author Name',\n },\n createdAt: '2023-01-01T00:00:00.000Z',\n },\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toEqual({ relationTo: 'posts', value: 'post123' })\n })\n\n it('should handle different relationTo values', () => {\n const values = [\n { relationTo: 'users', value: 'user1' },\n { relationTo: 'posts', value: 'post2' },\n { relationTo: 'pages', value: 'page3' },\n ]\n\n const results = values.map((v) => normalizeRelationshipValue(v, relationTo))\n\n expect(results).toEqual([\n { relationTo: 'users', value: 'user1' },\n { relationTo: 'posts', value: 'post2' },\n { relationTo: 'pages', value: 'page3' },\n ])\n })\n\n it('should handle null values', () => {\n const result = normalizeRelationshipValue(null, relationTo)\n expect(result).toBeNull()\n })\n\n it('should handle undefined values', () => {\n const result = normalizeRelationshipValue(undefined, relationTo)\n expect(result).toBeUndefined()\n })\n\n it('should extract ID from populated document without relationTo wrapper', () => {\n const value = {\n id: 'doc123',\n title: 'Document Title',\n }\n const result = normalizeRelationshipValue(value, relationTo)\n expect(result).toBe('doc123')\n })\n })\n\n describe('Edge cases', () => {\n it('should handle object with only value property (no relationTo)', () => {\n const value = { value: 'someValue' }\n const result = normalizeRelationshipValue(value, 'users')\n // Since there's no 'id' field and no relationTo, it should return the value as-is\n expect(result).toEqual({ value: 'someValue' })\n })\n\n it('should handle object with relationTo but no value', () => {\n const value = { relationTo: 'users' }\n const result = normalizeRelationshipValue(value, ['users', 'posts'])\n expect(result).toEqual({ relationTo: 'users' })\n })\n\n it('should handle empty array relationTo', () => {\n const result = normalizeRelationshipValue('user123', [])\n expect(result).toBe('user123')\n })\n\n it('should handle single-item array relationTo as polymorphic', () => {\n const value = { relationTo: 'users', value: 'user123' }\n const result = normalizeRelationshipValue(value, ['users'])\n expect(result).toEqual({ relationTo: 'users', value: 'user123' })\n })\n\n it('should handle numeric IDs in populated documents', () => {\n const value = {\n relationTo: 'users',\n value: {\n id: 12345,\n name: 'User with numeric ID',\n },\n }\n const result = normalizeRelationshipValue(value, ['users', 'posts'])\n expect(result).toEqual({ relationTo: 'users', value: 12345 })\n })\n\n it('should handle nested null values', () => {\n const value = {\n relationTo: 'users',\n value: null,\n }\n const result = normalizeRelationshipValue(value, 'users')\n expect(result).toBeNull()\n })\n\n it('should handle zero as a valid ID', () => {\n const result = normalizeRelationshipValue(0, 'users')\n expect(result).toBe(0)\n })\n\n it('should handle empty string as a valid ID', () => {\n const result = normalizeRelationshipValue('', 'users')\n expect(result).toBe('')\n })\n\n it('should handle false as a value', () => {\n const result = normalizeRelationshipValue(false, 'users')\n expect(result).toBe(false)\n })\n\n it('should handle array values (return as-is)', () => {\n const result = normalizeRelationshipValue(['user1', 'user2'], 'users')\n expect(result).toEqual(['user1', 'user2'])\n })\n })\n\n describe('Real-world scenarios', () => {\n it('should normalize upload field value for monomorphic upload', () => {\n // Upload field with populated media document\n const value = {\n id: 'media123',\n filename: 'image.jpg',\n mimeType: 'image/jpeg',\n filesize: 12345,\n url: '/media/image.jpg',\n }\n const result = normalizeRelationshipValue(value, 'media')\n expect(result).toBe('media123')\n })\n\n it('should normalize upload field value for polymorphic upload', () => {\n // Upload field with relationTo structure\n const value = {\n relationTo: 'images',\n value: {\n id: 'image456',\n filename: 'photo.png',\n url: '/media/photo.png',\n },\n }\n const result = normalizeRelationshipValue(value, ['images', 'videos'])\n expect(result).toEqual({ relationTo: 'images', value: 'image456' })\n })\n\n it('should normalize form submission data', () => {\n // Data coming from form with populated relationship\n const value = {\n relationTo: 'posts',\n value: {\n id: 'post789',\n title: 'Blog Post Title',\n author: { id: 'author123', name: 'Author' },\n publishedDate: '2023-12-01',\n },\n }\n const result = normalizeRelationshipValue(value, ['posts', 'pages'])\n expect(result).toEqual({ relationTo: 'posts', value: 'post789' })\n })\n\n it('should normalize API response with nested relationships', () => {\n // Complex nested structure from API\n const value = {\n relationTo: 'categories',\n value: {\n value: {\n id: 'cat123',\n name: 'Category Name',\n },\n },\n }\n const result = normalizeRelationshipValue(value, ['categories', 'tags'])\n expect(result).toEqual({ relationTo: 'categories', value: 'cat123' })\n })\n\n it('should handle table cell data normalization', () => {\n // Cell data from table that might be just an ID\n const simpleValue = 'user123'\n const result = normalizeRelationshipValue(simpleValue, 'users')\n expect(result).toBe('user123')\n\n // Cell data with full structure\n const complexValue = {\n relationTo: 'users',\n value: {\n id: 'user456',\n name: 'John Doe',\n },\n }\n const result2 = normalizeRelationshipValue(complexValue, ['users', 'admins'])\n expect(result2).toEqual({ relationTo: 'users', value: 'user456' })\n })\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAE3CH,QAAA,CAAS,8BAA8B;EACrCA,QAAA,CAAS,iDAAiD;IACxD,MAAMI,UAAA,GAAa;IAEnBH,EAAA,CAAG,wCAAwC;MACzC,MAAMI,MAAA,GAASF,0BAAA,CAA2B,WAAWC,UAAA;MACrDF,MAAA,CAAOG,MAAA,EAAQC,IAAI,CAAC;IACtB;IAEAL,EAAA,CAAG,wCAAwC;MACzC,MAAMI,MAAA,GAASF,0BAAA,CAA2B,KAAKC,UAAA;MAC/CF,MAAA,CAAOG,MAAA,EAAQC,IAAI,CAAC;IACtB;IAEAL,EAAA,CAAG,2DAA2D;MAC5D,MAAMM,KAAA,GAAQ;QAAEH,UAAA,EAAY;QAASG,KAAA,EAAO;MAAU;MACtD,MAAMF,MAAA,GAASF,0BAAA,CAA2BI,KAAA,EAAOH,UAAA;MACjDF,MAAA,CAAOG,MAAA,EAAQC,IAAI,CAAC;IACtB;IAEAL,EAAA,CAAG,iDAAiD;MAClD,MAAMM,KAAA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;MAC5D;MACA,MAAMM,KAAA,GAAQ;QACZH,UAAA,EAAY;QACZG,KAAA,EAAO;UACLA,KAAA,EAAO;YACLC,EAAA,EAAI;YACJC,IAAA,EAAM;UACR;QACF;MACF;MACA,MAAMJ,MAAA,GAASF,0BAAA,CAA2BI,KAAA,EAAO,CAAC,cAAc,OAAO;MACvEL,MAAA,CAAOG,MAAA,EAAQS,OAAO,CAAC;QAAEV,UAAA,EAAY;QAAcG,KAAA,EAAO;MAAS;IACrE;IAEAN,EAAA,CAAG,+CAA+C;MAChD;MACA,MAAM0B,WAAA,GAAc;MACpB,MAAMtB,MAAA,GAASF,0BAAA,CAA2BwB,WAAA,EAAa;MACvDzB,MAAA,CAAOG,MAAA,EAAQC,IAAI,CAAC;MAEpB;MACA,MAAMsB,YAAA,GAAe;QACnBxB,UAAA,EAAY;QACZG,KAAA,EAAO;UACLC,EAAA,EAAI;UACJC,IAAA,EAAM;QACR;MACF;MACA,MAAMoB,OAAA,GAAU1B,0BAAA,CAA2ByB,YAAA,EAAc,CAAC,SAAS,SAAS;MAC5E1B,MAAA,CAAO2B,OAAA,EAASf,OAAO,CAAC;QAAEV,UAAA,EAAY;QAASG,KAAA,EAAO;MAAU;IAClE;EACF;AACF","ignoreList":[]}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { addRecentlyViewedItem, recentlyViewedMaxItems } from './recentlyViewed.js';
|
|
3
|
-
const item = (collectionSlug, id, viewedAt) => ({
|
|
4
|
-
collectionSlug,
|
|
5
|
-
id,
|
|
6
|
-
viewedAt
|
|
7
|
-
});
|
|
8
|
-
describe('addRecentlyViewedItem', () => {
|
|
9
|
-
it('should create the list when there are no existing preferences', () => {
|
|
10
|
-
const next = item('posts', 1, '2026-01-01T00:00:00.000Z');
|
|
11
|
-
const result = addRecentlyViewedItem({
|
|
12
|
-
existing: undefined,
|
|
13
|
-
item: next
|
|
14
|
-
});
|
|
15
|
-
expect(result.items).toEqual([next]);
|
|
16
|
-
});
|
|
17
|
-
it('should prepend the newly viewed document', () => {
|
|
18
|
-
const existing = {
|
|
19
|
-
items: [item('posts', 1, '2026-01-01T00:00:00.000Z')]
|
|
20
|
-
};
|
|
21
|
-
const next = item('pages', 2, '2026-01-02T00:00:00.000Z');
|
|
22
|
-
const result = addRecentlyViewedItem({
|
|
23
|
-
existing,
|
|
24
|
-
item: next
|
|
25
|
-
});
|
|
26
|
-
expect(result.items.map(i => i.id)).toEqual([2, 1]);
|
|
27
|
-
});
|
|
28
|
-
it('should move an already-viewed document to the front and refresh its timestamp', () => {
|
|
29
|
-
const existing = {
|
|
30
|
-
items: [item('pages', 2, '2026-01-02T00:00:00.000Z'), item('posts', 1, '2026-01-01T00:00:00.000Z')]
|
|
31
|
-
};
|
|
32
|
-
const next = item('posts', 1, '2026-01-03T00:00:00.000Z');
|
|
33
|
-
const result = addRecentlyViewedItem({
|
|
34
|
-
existing,
|
|
35
|
-
item: next
|
|
36
|
-
});
|
|
37
|
-
expect(result.items).toEqual([next, item('pages', 2, '2026-01-02T00:00:00.000Z')]);
|
|
38
|
-
});
|
|
39
|
-
it('should treat numeric and string ids consistently when deduping', () => {
|
|
40
|
-
const existing = {
|
|
41
|
-
items: [item('posts', 1, '2026-01-01T00:00:00.000Z')]
|
|
42
|
-
};
|
|
43
|
-
const next = item('posts', '1', '2026-01-02T00:00:00.000Z');
|
|
44
|
-
const result = addRecentlyViewedItem({
|
|
45
|
-
existing,
|
|
46
|
-
item: next
|
|
47
|
-
});
|
|
48
|
-
expect(result.items).toHaveLength(1);
|
|
49
|
-
expect(result.items[0]).toEqual(next);
|
|
50
|
-
});
|
|
51
|
-
it('should not dedupe documents with the same id across different collections', () => {
|
|
52
|
-
const existing = {
|
|
53
|
-
items: [item('posts', 1, '2026-01-01T00:00:00.000Z')]
|
|
54
|
-
};
|
|
55
|
-
const next = item('pages', 1, '2026-01-02T00:00:00.000Z');
|
|
56
|
-
const result = addRecentlyViewedItem({
|
|
57
|
-
existing,
|
|
58
|
-
item: next
|
|
59
|
-
});
|
|
60
|
-
expect(result.items).toHaveLength(2);
|
|
61
|
-
});
|
|
62
|
-
it('should cap the list at the provided max', () => {
|
|
63
|
-
const existing = {
|
|
64
|
-
items: Array.from({
|
|
65
|
-
length: 5
|
|
66
|
-
}, (_, index) => item('posts', index, `2026-01-0${index + 1}T00:00:00.000Z`))
|
|
67
|
-
};
|
|
68
|
-
const next = item('pages', 99, '2026-02-01T00:00:00.000Z');
|
|
69
|
-
const result = addRecentlyViewedItem({
|
|
70
|
-
existing,
|
|
71
|
-
item: next,
|
|
72
|
-
max: 3
|
|
73
|
-
});
|
|
74
|
-
expect(result.items).toHaveLength(3);
|
|
75
|
-
expect(result.items[0]).toEqual(next);
|
|
76
|
-
});
|
|
77
|
-
it('should default the cap to recentlyViewedMaxItems', () => {
|
|
78
|
-
const existing = {
|
|
79
|
-
items: Array.from({
|
|
80
|
-
length: recentlyViewedMaxItems
|
|
81
|
-
}, (_, index) => item('posts', index, '2026-01-01T00:00:00.000Z'))
|
|
82
|
-
};
|
|
83
|
-
const next = item('pages', 99, '2026-02-01T00:00:00.000Z');
|
|
84
|
-
const result = addRecentlyViewedItem({
|
|
85
|
-
existing,
|
|
86
|
-
item: next
|
|
87
|
-
});
|
|
88
|
-
expect(result.items).toHaveLength(recentlyViewedMaxItems);
|
|
89
|
-
expect(result.items[0]).toEqual(next);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
//# sourceMappingURL=recentlyViewed.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recentlyViewed.spec.js","names":["describe","expect","it","addRecentlyViewedItem","recentlyViewedMaxItems","item","collectionSlug","id","viewedAt","next","result","existing","undefined","items","toEqual","map","i","toHaveLength","Array","from","length","_","index","max"],"sources":["../../src/utilities/recentlyViewed.spec.ts"],"sourcesContent":["import type { RecentlyViewedItem } from 'payload'\n\nimport { describe, expect, it } from 'vitest'\n\nimport { addRecentlyViewedItem, recentlyViewedMaxItems } from './recentlyViewed.js'\n\nconst item = (\n collectionSlug: string,\n id: number | string,\n viewedAt: string,\n): RecentlyViewedItem => ({\n collectionSlug,\n id,\n viewedAt,\n})\n\ndescribe('addRecentlyViewedItem', () => {\n it('should create the list when there are no existing preferences', () => {\n const next = item('posts', 1, '2026-01-01T00:00:00.000Z')\n\n const result = addRecentlyViewedItem({ existing: undefined, item: next })\n\n expect(result.items).toEqual([next])\n })\n\n it('should prepend the newly viewed document', () => {\n const existing = { items: [item('posts', 1, '2026-01-01T00:00:00.000Z')] }\n const next = item('pages', 2, '2026-01-02T00:00:00.000Z')\n\n const result = addRecentlyViewedItem({ existing, item: next })\n\n expect(result.items.map((i) => i.id)).toEqual([2, 1])\n })\n\n it('should move an already-viewed document to the front and refresh its timestamp', () => {\n const existing = {\n items: [\n item('pages', 2, '2026-01-02T00:00:00.000Z'),\n item('posts', 1, '2026-01-01T00:00:00.000Z'),\n ],\n }\n const next = item('posts', 1, '2026-01-03T00:00:00.000Z')\n\n const result = addRecentlyViewedItem({ existing, item: next })\n\n expect(result.items).toEqual([next, item('pages', 2, '2026-01-02T00:00:00.000Z')])\n })\n\n it('should treat numeric and string ids consistently when deduping', () => {\n const existing = { items: [item('posts', 1, '2026-01-01T00:00:00.000Z')] }\n const next = item('posts', '1', '2026-01-02T00:00:00.000Z')\n\n const result = addRecentlyViewedItem({ existing, item: next })\n\n expect(result.items).toHaveLength(1)\n expect(result.items[0]).toEqual(next)\n })\n\n it('should not dedupe documents with the same id across different collections', () => {\n const existing = { items: [item('posts', 1, '2026-01-01T00:00:00.000Z')] }\n const next = item('pages', 1, '2026-01-02T00:00:00.000Z')\n\n const result = addRecentlyViewedItem({ existing, item: next })\n\n expect(result.items).toHaveLength(2)\n })\n\n it('should cap the list at the provided max', () => {\n const existing = {\n items: Array.from({ length: 5 }, (_, index) =>\n item('posts', index, `2026-01-0${index + 1}T00:00:00.000Z`),\n ),\n }\n const next = item('pages', 99, '2026-02-01T00:00:00.000Z')\n\n const result = addRecentlyViewedItem({ existing, item: next, max: 3 })\n\n expect(result.items).toHaveLength(3)\n expect(result.items[0]).toEqual(next)\n })\n\n it('should default the cap to recentlyViewedMaxItems', () => {\n const existing = {\n items: Array.from({ length: recentlyViewedMaxItems }, (_, index) =>\n item('posts', index, '2026-01-01T00:00:00.000Z'),\n ),\n }\n const next = item('pages', 99, '2026-02-01T00:00:00.000Z')\n\n const result = addRecentlyViewedItem({ existing, item: next })\n\n expect(result.items).toHaveLength(recentlyViewedMaxItems)\n expect(result.items[0]).toEqual(next)\n })\n})\n"],"mappings":"AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,qBAAqB,EAAEC,sBAAsB,QAAQ;AAE9D,MAAMC,IAAA,GAAOA,CACXC,cAAA,EACAC,EAAA,EACAC,QAAA,MACwB;EACxBF,cAAA;EACAC,EAAA;EACAC;AACF;AAEAR,QAAA,CAAS,yBAAyB;EAChCE,EAAA,CAAG,iEAAiE;IAClE,MAAMO,IAAA,GAAOJ,IAAA,CAAK,SAAS,GAAG;IAE9B,MAAMK,MAAA,GAASP,qBAAA,CAAsB;MAAEQ,QAAA,EAAUC,SAAA;MAAWP,IAAA,EAAMI;IAAK;IAEvER,MAAA,CAAOS,MAAA,CAAOG,KAAK,EAAEC,OAAO,CAAC,CAACL,IAAA,CAAK;EACrC;EAEAP,EAAA,CAAG,4CAA4C;IAC7C,MAAMS,QAAA,GAAW;MAAEE,KAAA,EAAO,CAACR,IAAA,CAAK,SAAS,GAAG;IAA6B;IACzE,MAAMI,IAAA,GAAOJ,IAAA,CAAK,SAAS,GAAG;IAE9B,MAAMK,MAAA,GAASP,qBAAA,CAAsB;MAAEQ,QAAA;MAAUN,IAAA,EAAMI;IAAK;IAE5DR,MAAA,CAAOS,MAAA,CAAOG,KAAK,CAACE,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAET,EAAE,GAAGO,OAAO,CAAC,CAAC,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