@payloadcms/ui 4.0.0-canary.3 → 4.0.0-canary.5
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/colors.css +3 -0
- package/dist/css/utilities.css +3 -2
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +7 -0
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/ArrayAction/index.js +2 -2
- package/dist/elements/ArrayAction/index.js.map +1 -1
- package/dist/elements/BulkUpload/ActionsBar/index.css +4 -8
- package/dist/elements/BulkUpload/ActionsBar/index.d.ts +1 -5
- package/dist/elements/BulkUpload/ActionsBar/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/ActionsBar/index.js +15 -22
- package/dist/elements/BulkUpload/ActionsBar/index.js.map +1 -1
- package/dist/elements/BulkUpload/AddFilesView/index.css +14 -8
- package/dist/elements/BulkUpload/AddFilesView/index.d.ts +2 -2
- package/dist/elements/BulkUpload/AddFilesView/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/AddFilesView/index.js +41 -36
- package/dist/elements/BulkUpload/AddFilesView/index.js.map +1 -1
- package/dist/elements/BulkUpload/AddingFilesView/index.css +158 -6
- package/dist/elements/BulkUpload/AddingFilesView/index.d.ts +5 -1
- package/dist/elements/BulkUpload/AddingFilesView/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/AddingFilesView/index.js +134 -65
- package/dist/elements/BulkUpload/AddingFilesView/index.js.map +1 -1
- package/dist/elements/BulkUpload/DiscardWithoutSaving/index.js +4 -4
- package/dist/elements/BulkUpload/DiscardWithoutSaving/index.js.map +1 -1
- package/dist/elements/BulkUpload/EditForm/index.d.ts +1 -1
- package/dist/elements/BulkUpload/EditForm/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditForm/index.js +16 -17
- package/dist/elements/BulkUpload/EditForm/index.js.map +1 -1
- package/dist/elements/BulkUpload/EditForm/types.d.ts +2 -3
- package/dist/elements/BulkUpload/EditForm/types.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditForm/types.js.map +1 -1
- package/dist/elements/BulkUpload/EditMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js +78 -64
- package/dist/elements/BulkUpload/EditMany/DrawerContent.js.map +1 -1
- package/dist/elements/BulkUpload/EditMany/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/EditMany/index.js +28 -10
- package/dist/elements/BulkUpload/EditMany/index.js.map +1 -1
- package/dist/elements/BulkUpload/FileSidebar/index.css +63 -143
- package/dist/elements/BulkUpload/FileSidebar/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FileSidebar/index.js +42 -175
- package/dist/elements/BulkUpload/FileSidebar/index.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/BulkUpload/index.css +48 -0
- package/dist/elements/BulkUpload/index.d.ts +6 -5
- package/dist/elements/BulkUpload/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/index.js +42 -41
- package/dist/elements/BulkUpload/index.js.map +1 -1
- package/dist/elements/Button/index.d.ts.map +1 -1
- package/dist/elements/Button/index.js +5 -0
- package/dist/elements/Button/index.js.map +1 -1
- package/dist/elements/Card/index.css +1 -1
- package/dist/elements/ClipboardAction/index.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/index.js +1 -0
- package/dist/elements/ClipboardAction/index.js.map +1 -1
- package/dist/elements/Collapsible/index.d.ts.map +1 -1
- package/dist/elements/Collapsible/index.js +2 -0
- package/dist/elements/Collapsible/index.js.map +1 -1
- package/dist/elements/ColumnSelection/Popup.d.ts +12 -0
- package/dist/elements/ColumnSelection/Popup.d.ts.map +1 -0
- package/dist/elements/{ColumnSelector/index.js → ColumnSelection/Popup.js} +23 -12
- package/dist/elements/ColumnSelection/Popup.js.map +1 -0
- package/dist/elements/ColumnSelection/index.d.ts +10 -0
- package/dist/elements/ColumnSelection/index.d.ts.map +1 -0
- package/dist/elements/{ColumnsButton → ColumnSelection}/index.js +23 -17
- package/dist/elements/ColumnSelection/index.js.map +1 -0
- package/dist/elements/CopyLocaleData/index.js +1 -1
- package/dist/elements/CopyLocaleData/index.js.map +1 -1
- package/dist/elements/CreateDocumentButton/index.d.ts.map +1 -1
- package/dist/elements/CreateDocumentButton/index.js +0 -1
- package/dist/elements/CreateDocumentButton/index.js.map +1 -1
- package/dist/elements/DatePicker/index.css +8 -8
- package/dist/elements/Dialog/DialogHeader/index.d.ts +4 -0
- package/dist/elements/Dialog/DialogHeader/index.d.ts.map +1 -1
- package/dist/elements/Dialog/DialogHeader/index.js +45 -30
- package/dist/elements/Dialog/DialogHeader/index.js.map +1 -1
- package/dist/elements/Dialog/DialogModal/index.d.ts +5 -0
- package/dist/elements/Dialog/DialogModal/index.d.ts.map +1 -1
- package/dist/elements/Dialog/DialogModal/index.js +58 -31
- package/dist/elements/Dialog/DialogModal/index.js.map +1 -1
- package/dist/elements/Dialog/DialogTitle/index.css +9 -0
- package/dist/elements/Dialog/DialogTitle/index.d.ts +5 -0
- package/dist/elements/Dialog/DialogTitle/index.d.ts.map +1 -0
- package/dist/elements/Dialog/DialogTitle/index.js +10 -0
- package/dist/elements/Dialog/DialogTitle/index.js.map +1 -0
- package/dist/elements/Dialog/index.css +7 -1
- package/dist/elements/DocumentControls/index.css +1 -1
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +13 -3
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerHeader/index.js +5 -3
- package/dist/elements/DocumentDrawer/DrawerHeader/index.js.map +1 -1
- package/dist/elements/DocumentFields/index.css +5 -2
- package/dist/elements/DocumentFields/index.d.ts +5 -0
- package/dist/elements/DocumentFields/index.d.ts.map +1 -1
- package/dist/elements/DocumentFields/index.js +9 -1
- package/dist/elements/DocumentFields/index.js.map +1 -1
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.d.ts +12 -0
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.d.ts.map +1 -0
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.js +28 -0
- package/dist/elements/DocumentHeader/DocumentHeaderRoot/index.js.map +1 -0
- package/dist/elements/DocumentHeader/index.js +2 -3
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/DraggableSortable/DragOverlayPreview/index.css +1 -1
- package/dist/elements/DrawerActionHeader/index.css +1 -1
- package/dist/elements/{BulkUpload/Header → DrawerHeader}/index.css +7 -1
- package/dist/elements/DrawerHeader/index.d.ts +10 -0
- package/dist/elements/DrawerHeader/index.d.ts.map +1 -0
- package/dist/elements/{BulkUpload/Header → DrawerHeader}/index.js +16 -11
- package/dist/elements/DrawerHeader/index.js.map +1 -0
- package/dist/elements/Dropzone/index.css +5 -13
- package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js +1 -1
- package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js.map +1 -1
- package/dist/elements/EditUpload/index.css +97 -158
- package/dist/elements/EditUpload/index.d.ts +2 -1
- package/dist/elements/EditUpload/index.d.ts.map +1 -1
- package/dist/elements/EditUpload/index.js +205 -231
- package/dist/elements/EditUpload/index.js.map +1 -1
- package/dist/elements/EditUpload/{library.scss → library.css} +108 -46
- package/dist/elements/FileDetails/DraggableFileDetails/index.d.ts +1 -1
- package/dist/elements/FileDetails/DraggableFileDetails/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/DraggableFileDetails/index.js.map +1 -1
- package/dist/elements/FileDetails/FileMeta/index.css +27 -0
- package/dist/elements/FileDetails/FileMeta/index.d.ts +1 -1
- package/dist/elements/FileDetails/FileMeta/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/FileMeta/index.js +1 -1
- package/dist/elements/FileDetails/FileMeta/index.js.map +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.css +140 -0
- package/dist/elements/FileDetails/StaticFileDetails/index.d.ts +2 -2
- package/dist/elements/FileDetails/StaticFileDetails/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.js +1 -1
- package/dist/elements/FileDetails/StaticFileDetails/index.js.map +1 -1
- package/dist/elements/FileDetails/index.d.ts +1 -1
- package/dist/elements/FileDetails/index.d.ts.map +1 -1
- package/dist/elements/FileDetails/index.js.map +1 -1
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.css +8 -0
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.d.ts +10 -0
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.js +24 -0
- package/dist/elements/FileManager/FilePreview/AudioPreview/index.js.map +1 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.css +9 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.d.ts +12 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.js +27 -0
- package/dist/elements/FileManager/FilePreview/PdfPreview/index.js.map +1 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.css +8 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.d.ts +10 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.js +24 -0
- package/dist/elements/FileManager/FilePreview/VideoPreview/index.js.map +1 -0
- package/dist/elements/FileManager/FilePreview/index.css +83 -0
- package/dist/elements/FileManager/FilePreview/index.d.ts +13 -0
- package/dist/elements/FileManager/FilePreview/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FilePreview/index.js +140 -0
- package/dist/elements/FileManager/FilePreview/index.js.map +1 -0
- package/dist/elements/FileManager/FileToolbar/index.css +91 -0
- package/dist/elements/FileManager/FileToolbar/index.d.ts +14 -0
- package/dist/elements/FileManager/FileToolbar/index.d.ts.map +1 -0
- package/dist/elements/FileManager/FileToolbar/index.js +106 -0
- package/dist/elements/FileManager/FileToolbar/index.js.map +1 -0
- package/dist/elements/FileManager/index.css +154 -0
- package/dist/elements/FileManager/index.d.ts +19 -0
- package/dist/elements/FileManager/index.d.ts.map +1 -0
- package/dist/elements/FileManager/index.js +424 -0
- package/dist/elements/FileManager/index.js.map +1 -0
- package/dist/elements/GroupBy/Popup.d.ts +21 -0
- package/dist/elements/GroupBy/Popup.d.ts.map +1 -0
- package/dist/elements/GroupBy/Popup.js +268 -0
- package/dist/elements/GroupBy/Popup.js.map +1 -0
- package/dist/elements/GroupBy/index.d.ts +12 -0
- package/dist/elements/GroupBy/index.d.ts.map +1 -0
- package/dist/elements/GroupBy/index.js +91 -0
- package/dist/elements/GroupBy/index.js.map +1 -0
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.css +2 -2
- package/dist/elements/Hierarchy/Drawer/index.css +1 -1
- package/dist/elements/ListColumnSelectionButton/index.d.ts +11 -0
- package/dist/elements/ListColumnSelectionButton/index.d.ts.map +1 -0
- package/dist/elements/ListColumnSelectionButton/index.js +37 -0
- package/dist/elements/ListColumnSelectionButton/index.js.map +1 -0
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +7 -8
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListDrawer/DrawerContent.js +1 -1
- package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/ListDrawer/Provider.d.ts +1 -1
- package/dist/elements/ListDrawer/Provider.d.ts.map +1 -1
- package/dist/elements/ListDrawer/Provider.js.map +1 -1
- package/dist/elements/ListGroupByButton/index.d.ts +12 -0
- package/dist/elements/ListGroupByButton/index.d.ts.map +1 -0
- package/dist/elements/ListGroupByButton/index.js +55 -0
- package/dist/elements/ListGroupByButton/index.js.map +1 -0
- package/dist/elements/ListHeader/DrawerRelationshipSelect/index.d.ts.map +1 -1
- package/dist/elements/ListHeader/DrawerRelationshipSelect/index.js +2 -0
- package/dist/elements/ListHeader/DrawerRelationshipSelect/index.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js +4 -4
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js.map +1 -1
- package/dist/elements/ListWhereBuilder/index.d.ts +16 -0
- package/dist/elements/ListWhereBuilder/index.d.ts.map +1 -0
- package/dist/elements/ListWhereBuilder/index.js +62 -0
- package/dist/elements/ListWhereBuilder/index.js.map +1 -0
- package/dist/elements/LivePreview/Toolbar/Controls/index.js +2 -2
- package/dist/elements/LivePreview/Toolbar/Controls/index.js.map +1 -1
- package/dist/elements/LivePreview/Toolbar/SizeInput/index.css +5 -44
- package/dist/elements/LivePreview/Toolbar/SizeInput/index.d.ts.map +1 -1
- package/dist/elements/LivePreview/Toolbar/SizeInput/index.js +25 -43
- package/dist/elements/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
- package/dist/elements/MiniCarousel/index.css +94 -0
- package/dist/elements/MiniCarousel/index.d.ts +15 -0
- package/dist/elements/MiniCarousel/index.d.ts.map +1 -0
- package/dist/elements/MiniCarousel/index.js +84 -0
- package/dist/elements/MiniCarousel/index.js.map +1 -0
- package/dist/elements/Nav/SettingsMenuButton/index.css +5 -0
- package/dist/elements/Nav/SettingsMenuButton/index.d.ts +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.d.ts.map +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.js +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.js.map +1 -1
- package/dist/elements/Nav/index.css +2 -2
- package/dist/elements/NavGroup/index.css +1 -1
- package/dist/elements/Popup/PopupTrigger/index.d.ts +1 -0
- package/dist/elements/Popup/PopupTrigger/index.d.ts.map +1 -1
- package/dist/elements/Popup/PopupTrigger/index.js +3 -0
- package/dist/elements/Popup/PopupTrigger/index.js.map +1 -1
- package/dist/elements/Popup/index.d.ts +7 -1
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +45 -12
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PreviewSizes/index.css +149 -0
- package/dist/elements/PreviewSizes/index.d.ts +2 -2
- package/dist/elements/PreviewSizes/index.d.ts.map +1 -1
- package/dist/elements/PreviewSizes/index.js +1 -1
- package/dist/elements/PreviewSizes/index.js.map +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/{index.scss → index.css} +1 -3
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.d.ts +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.js +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.js +77 -48
- package/dist/elements/QueryPresets/fields/ColumnsField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.js +12 -21
- package/dist/elements/QueryPresets/fields/GroupByField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/Heading/index.css +52 -0
- package/dist/elements/QueryPresets/fields/Heading/index.d.ts +7 -0
- package/dist/elements/QueryPresets/fields/Heading/index.d.ts.map +1 -0
- package/dist/elements/QueryPresets/fields/Heading/index.js +31 -0
- package/dist/elements/QueryPresets/fields/Heading/index.js.map +1 -0
- package/dist/elements/QueryPresets/fields/WhereField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/WhereField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/WhereField/index.js +24 -23
- package/dist/elements/QueryPresets/fields/WhereField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/fields.css +23 -0
- package/dist/elements/ReactSelect/DropdownIndicator/index.css +1 -1
- package/dist/elements/ReactSelect/DropdownIndicator/index.d.ts.map +1 -1
- package/dist/elements/ReactSelect/DropdownIndicator/index.js +19 -12
- package/dist/elements/ReactSelect/DropdownIndicator/index.js.map +1 -1
- package/dist/elements/ReactSelect/types.d.ts +1 -0
- package/dist/elements/ReactSelect/types.d.ts.map +1 -1
- package/dist/elements/ReactSelect/types.js.map +1 -1
- package/dist/elements/RelationshipTable/AddNewButton.d.ts.map +1 -1
- package/dist/elements/RelationshipTable/AddNewButton.js +1 -2
- package/dist/elements/RelationshipTable/AddNewButton.js.map +1 -1
- package/dist/elements/RelationshipTable/index.js +2 -2
- package/dist/elements/RelationshipTable/index.js.map +1 -1
- package/dist/elements/Search/SearchInput/index.js +1 -1
- package/dist/elements/Search/SearchInput/index.js.map +1 -1
- package/dist/elements/SortColumn/index.css +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +21 -2
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
- package/dist/elements/Table/index.css +24 -2
- package/dist/elements/Thumbnail/index.css +41 -0
- package/dist/elements/Thumbnail/index.d.ts +3 -3
- package/dist/elements/Thumbnail/index.d.ts.map +1 -1
- package/dist/elements/Thumbnail/index.js +1 -1
- package/dist/elements/Thumbnail/index.js.map +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts +11 -0
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts.map +1 -0
- package/dist/elements/Upload/UploadFromURLModal/index.js +88 -0
- package/dist/elements/Upload/UploadFromURLModal/index.js.map +1 -0
- package/dist/elements/Upload/index.css +134 -45
- package/dist/elements/Upload/index.d.ts +3 -8
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +71 -92
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.d.ts +1 -0
- package/dist/elements/WhereBuilder/Condition/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.js +17 -2
- package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
- package/dist/elements/WhereBuilder/index.d.ts +4 -3
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +71 -62
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/elements/WhereBuilder/types.d.ts +6 -5
- package/dist/elements/WhereBuilder/types.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/types.js.map +1 -1
- package/dist/exports/client/index.d.ts +6 -2
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +26 -26
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/rsc/index.d.ts +1 -0
- package/dist/exports/rsc/index.d.ts.map +1 -1
- package/dist/exports/rsc/index.js +1 -0
- package/dist/exports/rsc/index.js.map +1 -1
- package/dist/exports/shared/index.js +2 -2
- package/dist/exports/shared/index.js.map +2 -2
- package/dist/fields/Blocks/BlockSelector/BlockSearch/index.css +1 -1
- package/dist/fields/Blocks/BlockSelector/index.css +2 -5
- package/dist/fields/Blocks/SectionTitle/index.d.ts.map +1 -1
- package/dist/fields/Blocks/SectionTitle/index.js +1 -0
- package/dist/fields/Blocks/SectionTitle/index.js.map +1 -1
- package/dist/fields/Checkbox/index.css +2 -2
- package/dist/fields/Group/index.css +3 -3
- package/dist/fields/Number/Input.d.ts.map +1 -1
- package/dist/fields/Number/Input.js +47 -35
- package/dist/fields/Number/Input.js.map +1 -1
- package/dist/fields/Number/index.css +19 -0
- package/dist/fields/Number/types.d.ts +6 -0
- package/dist/fields/Number/types.d.ts.map +1 -1
- package/dist/fields/Number/types.js.map +1 -1
- package/dist/fields/Relationship/Input.d.ts.map +1 -1
- package/dist/fields/Relationship/Input.js +2 -0
- package/dist/fields/Relationship/Input.js.map +1 -1
- package/dist/fields/Relationship/select-components/MultiValueLabel/index.css +1 -1
- package/dist/fields/Select/Input.d.ts.map +1 -1
- package/dist/fields/Select/Input.js +1 -0
- package/dist/fields/Select/Input.js.map +1 -1
- package/dist/fields/Text/Input.d.ts.map +1 -1
- package/dist/fields/Text/Input.js +31 -28
- package/dist/fields/Text/Input.js.map +1 -1
- package/dist/fields/Text/types.d.ts +5 -0
- package/dist/fields/Text/types.d.ts.map +1 -1
- package/dist/fields/Text/types.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +12 -11
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/index.js +1 -1
- package/dist/fields/Upload/index.js.map +1 -1
- package/dist/graphics/Icon/index.js +1 -1
- package/dist/graphics/Icon/index.js.map +1 -1
- package/dist/hooks/useElementHeightVariable.d.ts +15 -0
- package/dist/hooks/useElementHeightVariable.d.ts.map +1 -0
- package/dist/hooks/useElementHeightVariable.js +53 -0
- package/dist/hooks/useElementHeightVariable.js.map +1 -0
- package/dist/icons/Crop/index.css +5 -0
- package/dist/icons/Crop/index.d.ts +7 -0
- package/dist/icons/Crop/index.d.ts.map +1 -0
- package/dist/icons/Crop/index.js +24 -0
- package/dist/icons/Crop/index.js.map +1 -0
- package/dist/icons/Download/index.css +5 -0
- package/dist/icons/{ExternalLink → Download}/index.d.ts +1 -1
- package/dist/icons/Download/index.d.ts.map +1 -0
- package/dist/icons/Download/index.js +27 -0
- package/dist/icons/Download/index.js.map +1 -0
- package/dist/icons/{ExternalLink → NewTab}/index.css +1 -1
- package/dist/icons/NewTab/index.d.ts +7 -0
- package/dist/icons/NewTab/index.d.ts.map +1 -0
- package/dist/icons/NewTab/index.js +25 -0
- package/dist/icons/NewTab/index.js.map +1 -0
- package/dist/icons/Replace/index.css +5 -0
- package/dist/icons/Replace/index.d.ts +6 -0
- package/dist/icons/Replace/index.d.ts.map +1 -0
- package/dist/icons/Replace/index.js +20 -0
- package/dist/icons/Replace/index.js.map +1 -0
- package/dist/icons/Reset/index.css +5 -0
- package/dist/icons/Reset/index.d.ts +7 -0
- package/dist/icons/Reset/index.d.ts.map +1 -0
- package/dist/icons/Reset/index.js +25 -0
- package/dist/icons/Reset/index.js.map +1 -0
- package/dist/icons/Swap/index.js +1 -1
- package/dist/icons/Swap/index.js.map +1 -1
- package/dist/scss/app.scss +9 -2
- package/dist/styles.css +1 -1
- package/dist/templates/Default/index.js +1 -1
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/reduceFieldsToOptions.js +1 -1
- package/dist/utilities/reduceFieldsToOptions.js.map +1 -1
- package/dist/views/API/index.client.js +2 -2
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetConfigDrawer.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetConfigDrawer.js +27 -23
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetConfigDrawer.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.css +2 -0
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js +2 -2
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +2 -2
- package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +1 -0
- 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 +47 -1
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/Edit/index.css +143 -6
- package/dist/views/Edit/index.d.ts +1 -1
- package/dist/views/Edit/index.d.ts.map +1 -1
- package/dist/views/Edit/index.js +34 -31
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.css +2 -2
- package/dist/views/List/ListHeader/index.css +5 -0
- package/dist/views/List/index.client.d.ts.map +1 -1
- package/dist/views/List/index.client.js +6 -6
- package/dist/views/List/index.client.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +1 -0
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Versions/index.css +0 -4
- package/dist/widgets/CollectionQuery/SortField/index.d.ts +3 -0
- package/dist/widgets/CollectionQuery/SortField/index.d.ts.map +1 -0
- package/dist/widgets/CollectionQuery/SortField/index.js +118 -0
- package/dist/widgets/CollectionQuery/SortField/index.js.map +1 -0
- package/dist/widgets/CollectionQuery/getCollectionFieldPaths.d.ts +18 -0
- package/dist/widgets/CollectionQuery/getCollectionFieldPaths.d.ts.map +1 -0
- package/dist/widgets/CollectionQuery/getCollectionFieldPaths.js +91 -0
- package/dist/widgets/CollectionQuery/getCollectionFieldPaths.js.map +1 -0
- package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js +100 -0
- package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js.map +1 -0
- package/dist/widgets/CollectionQuery/index.css +206 -0
- package/dist/widgets/CollectionQuery/index.d.ts +17 -0
- package/dist/widgets/CollectionQuery/index.d.ts.map +1 -0
- package/dist/widgets/CollectionQuery/index.js +399 -0
- package/dist/widgets/CollectionQuery/index.js.map +1 -0
- package/package.json +5 -5
- package/dist/elements/BulkUpload/Header/index.d.ts +0 -9
- package/dist/elements/BulkUpload/Header/index.d.ts.map +0 -1
- package/dist/elements/BulkUpload/Header/index.js.map +0 -1
- package/dist/elements/ColumnSelector/index.d.ts +0 -9
- package/dist/elements/ColumnSelector/index.d.ts.map +0 -1
- package/dist/elements/ColumnSelector/index.js.map +0 -1
- package/dist/elements/ColumnsButton/index.d.ts +0 -7
- package/dist/elements/ColumnsButton/index.d.ts.map +0 -1
- package/dist/elements/ColumnsButton/index.js.map +0 -1
- package/dist/elements/FileDetails/FileMeta/index.scss +0 -31
- package/dist/elements/FileDetails/StaticFileDetails/index.scss +0 -134
- package/dist/elements/GroupByBuilder/index.d.ts +0 -12
- package/dist/elements/GroupByBuilder/index.d.ts.map +0 -1
- package/dist/elements/GroupByBuilder/index.js +0 -164
- package/dist/elements/GroupByBuilder/index.js.map +0 -1
- package/dist/elements/GroupByBuilder/index.scss +0 -39
- package/dist/elements/GroupByControl/index.d.ts +0 -9
- package/dist/elements/GroupByControl/index.d.ts.map +0 -1
- package/dist/elements/GroupByControl/index.js +0 -254
- package/dist/elements/GroupByControl/index.js.map +0 -1
- package/dist/elements/Nav/SettingsMenuButton/index.scss +0 -11
- package/dist/elements/PreviewSizes/index.scss +0 -147
- package/dist/elements/QueryPresets/fields/ColumnsField/index.scss +0 -17
- package/dist/elements/QueryPresets/fields/GroupByField/index.scss +0 -17
- package/dist/elements/QueryPresets/fields/WhereField/index.scss +0 -23
- package/dist/elements/Thumbnail/index.scss +0 -53
- package/dist/icons/ExternalLink/index.d.ts.map +0 -1
- package/dist/icons/ExternalLink/index.js +0 -26
- package/dist/icons/ExternalLink/index.js.map +0 -1
- /package/dist/elements/{ColumnSelector/index.css → ColumnSelection/Popup.css} +0 -0
- /package/dist/elements/{GroupByControl/index.css → GroupBy/Popup.css} +0 -0
|
@@ -14,6 +14,20 @@ const PopupContext = /*#__PURE__*/createContext(null);
|
|
|
14
14
|
* Selector for all elements the browser considers tabbable.
|
|
15
15
|
*/
|
|
16
16
|
const TABBABLE_SELECTOR = ['a[href]', 'button:not(:disabled)', 'input:not(:disabled):not([type="hidden"])', 'select:not(:disabled)', 'textarea:not(:disabled)', '[tabindex]', '[contenteditable]:not([contenteditable="false"])', 'audio[controls]', 'video[controls]', 'summary'].map(s => `${s}:not([tabindex="-1"])`).join(', ');
|
|
17
|
+
/**
|
|
18
|
+
* Returns whether the element has a `position: fixed` ancestor (e.g. an open Drawer).
|
|
19
|
+
* Such popups must be positioned with `fixed` so they don't drift when the background scrolls.
|
|
20
|
+
*/
|
|
21
|
+
const hasFixedAncestor = element => {
|
|
22
|
+
let node = element?.parentElement;
|
|
23
|
+
while (node && node !== document.body) {
|
|
24
|
+
if (window.getComputedStyle(node).position === 'fixed') {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
node = node.parentElement;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
17
31
|
/**
|
|
18
32
|
* Component that renders a popup, as well as a button that triggers the popup.
|
|
19
33
|
*
|
|
@@ -24,6 +38,7 @@ export const Popup = props => {
|
|
|
24
38
|
const {
|
|
25
39
|
id,
|
|
26
40
|
button,
|
|
41
|
+
buttonAriaLabel,
|
|
27
42
|
buttonClassName,
|
|
28
43
|
buttonSize,
|
|
29
44
|
buttonType = 'default',
|
|
@@ -43,13 +58,18 @@ export const Popup = props => {
|
|
|
43
58
|
showOnHover = false,
|
|
44
59
|
showScrollbar = false,
|
|
45
60
|
side,
|
|
46
|
-
size = '
|
|
61
|
+
size = 'fit-content',
|
|
47
62
|
theme = 'dark',
|
|
48
63
|
verticalAlign = 'bottom'
|
|
49
64
|
} = props;
|
|
50
65
|
const popupRef = useRef(null);
|
|
51
66
|
const triggerRef = useRef(null);
|
|
52
67
|
/**
|
|
68
|
+
* Whether the trigger is inside a `position: fixed` ancestor (e.g. a Drawer),
|
|
69
|
+
* in which case the popup is positioned with `fixed` instead of `absolute`.
|
|
70
|
+
*/
|
|
71
|
+
const isFixedRef = useRef(false);
|
|
72
|
+
/**
|
|
53
73
|
* Keeps track of whether the popup was opened via keyboard.
|
|
54
74
|
* This is used to determine whether to autofocus the first element in the popup.
|
|
55
75
|
* If the popup was opened via mouse, we do not want to autofocus the first element.
|
|
@@ -87,6 +107,11 @@ export const Popup = props => {
|
|
|
87
107
|
}
|
|
88
108
|
const triggerRect = trigger.getBoundingClientRect();
|
|
89
109
|
const popupRect = popup.getBoundingClientRect();
|
|
110
|
+
// Inside a fixed ancestor, use `fixed` (no scroll offset) so background scrolling
|
|
111
|
+
// doesn't shift the popup. Otherwise use page coordinates (absolute).
|
|
112
|
+
const useFixed = isFixedRef.current;
|
|
113
|
+
const scrollY = useFixed ? 0 : window.scrollY;
|
|
114
|
+
const scrollX = useFixed ? 0 : window.scrollX;
|
|
90
115
|
// Gap between the popup and the trigger/viewport edges (in pixels)
|
|
91
116
|
const offset = 10;
|
|
92
117
|
// Additional gap used in side mode so the child popup has breathing room from its parent
|
|
@@ -102,9 +127,9 @@ export const Popup = props => {
|
|
|
102
127
|
// viewport space.
|
|
103
128
|
// /////////////////////////////////////
|
|
104
129
|
// Top: align with trigger top, clamped to viewport
|
|
105
|
-
top = triggerRect.top +
|
|
106
|
-
const maxTop =
|
|
107
|
-
top = Math.max(
|
|
130
|
+
top = triggerRect.top + scrollY;
|
|
131
|
+
const maxTop = scrollY + window.innerHeight - popupRect.height - offset;
|
|
132
|
+
top = Math.max(scrollY + offset, Math.min(top, maxTop));
|
|
108
133
|
// Use the parent popup's bounding rect as the reference for left/right positioning
|
|
109
134
|
// so the child appears 4px from the parent popup edge, not just the trigger button.
|
|
110
135
|
const anchorRect = parentPopup?.popupRef.current ? parentPopup.popupRef.current.getBoundingClientRect() : triggerRect;
|
|
@@ -121,7 +146,7 @@ export const Popup = props => {
|
|
|
121
146
|
left = anchorRect.left - popupRect.width - sideOffset;
|
|
122
147
|
}
|
|
123
148
|
}
|
|
124
|
-
left = left +
|
|
149
|
+
left = left + scrollX;
|
|
125
150
|
// Caret not used in side mode; set a neutral value
|
|
126
151
|
caretLeft = popupRect.width / 2;
|
|
127
152
|
setIsOnTop(false);
|
|
@@ -134,20 +159,20 @@ export const Popup = props => {
|
|
|
134
159
|
// /////////////////////////////////////
|
|
135
160
|
let onTop = verticalAlign === 'top';
|
|
136
161
|
if (verticalAlign === 'bottom') {
|
|
137
|
-
top = triggerRect.bottom +
|
|
162
|
+
top = triggerRect.bottom + scrollY + offset;
|
|
138
163
|
if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {
|
|
139
164
|
// Try to flip above — only do so if there's actually enough room
|
|
140
|
-
const topIfAbove = triggerRect.top +
|
|
141
|
-
if (topIfAbove >=
|
|
165
|
+
const topIfAbove = triggerRect.top + scrollY - popupRect.height - offset;
|
|
166
|
+
if (topIfAbove >= scrollY) {
|
|
142
167
|
top = topIfAbove;
|
|
143
168
|
onTop = true;
|
|
144
169
|
}
|
|
145
170
|
// else: not enough room above either — keep below and let it overflow rather than going off-screen
|
|
146
171
|
}
|
|
147
172
|
} else {
|
|
148
|
-
top = triggerRect.top +
|
|
173
|
+
top = triggerRect.top + scrollY - popupRect.height - offset;
|
|
149
174
|
if (triggerRect.top - popupRect.height - offset < 0) {
|
|
150
|
-
top = triggerRect.bottom +
|
|
175
|
+
top = triggerRect.bottom + scrollY + offset;
|
|
151
176
|
onTop = false;
|
|
152
177
|
}
|
|
153
178
|
}
|
|
@@ -179,8 +204,12 @@ export const Popup = props => {
|
|
|
179
204
|
// Values are rounded to match browser's CSS precision and avoid false updates.
|
|
180
205
|
// /////////////////////////////////////
|
|
181
206
|
const newTop = `${Math.round(top)}px`;
|
|
182
|
-
const newLeft = `${Math.round(left +
|
|
207
|
+
const newLeft = `${Math.round(left + scrollX)}px`;
|
|
183
208
|
const newCaretLeft = `${Math.round(caretLeft)}px`;
|
|
209
|
+
const newPosition = useFixed ? 'fixed' : '';
|
|
210
|
+
if (popup.style.position !== newPosition) {
|
|
211
|
+
popup.style.position = newPosition;
|
|
212
|
+
}
|
|
184
213
|
if (popup.style.top !== newTop) {
|
|
185
214
|
popup.style.top = newTop;
|
|
186
215
|
}
|
|
@@ -281,6 +310,7 @@ export const Popup = props => {
|
|
|
281
310
|
// `.popup__hidden-content` takes effect. Without this, the inline
|
|
282
311
|
// styles set during positioning would win over the CSS rule, keeping
|
|
283
312
|
// portaled children (e.g. a ReactSelect menu) visually on-screen.
|
|
313
|
+
popup_1.style.position = '';
|
|
284
314
|
popup_1.style.top = '';
|
|
285
315
|
popup_1.style.left = '';
|
|
286
316
|
}
|
|
@@ -301,9 +331,11 @@ export const Popup = props => {
|
|
|
301
331
|
// after the browser has finished laying out the newly-visible popup
|
|
302
332
|
// content. The rAF call is the authoritative one — it catches cases
|
|
303
333
|
// where the popup height wasn't stable yet during the first call
|
|
304
|
-
// (e.g.
|
|
334
|
+
// (e.g. ColumnSelection popup content rendering after hidden → visible
|
|
305
335
|
// class switch), which was causing incorrect flip-to-top decisions.
|
|
306
336
|
// /////////////////////////////////////
|
|
337
|
+
// Decide the positioning strategy once per open.
|
|
338
|
+
isFixedRef.current = hasFixedAncestor(triggerRef.current);
|
|
307
339
|
updatePosition();
|
|
308
340
|
const rafId = requestAnimationFrame(() => {
|
|
309
341
|
updatePosition();
|
|
@@ -353,6 +385,7 @@ export const Popup = props => {
|
|
|
353
385
|
const Trigger = /*#__PURE__*/_jsx(PopupTrigger, {
|
|
354
386
|
active: active,
|
|
355
387
|
button: button,
|
|
388
|
+
buttonAriaLabel: buttonAriaLabel,
|
|
356
389
|
buttonType: buttonType,
|
|
357
390
|
className: buttonClassName,
|
|
358
391
|
disabled: disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["PopupList","React","createContext","use","useCallback","useEffect","useRef","useState","createPortal","useEffectEvent","ThemeProvider","PopupTrigger","baseClass","PopupContext","TABBABLE_SELECTOR","map","s","join","Popup","props","id","button","buttonClassName","buttonSize","buttonType","caret","children","className","disabled","forceOpen","horizontalAlign","initActive","noBackground","onToggleClose","onToggleOpen","portalClassName","render","renderButton","showOnHover","showScrollbar","side","size","theme","verticalAlign","popupRef","triggerRef","openedViaKeyboardRef","parentPopup","mounted","setMounted","active","setActiveInternal","isOnTop","setIsOnTop","setActive","isActive","viaKeyboard","current","updatePosition","trigger","popup","triggerRect","getBoundingClientRect","popupRect","offset","sideOffset","top","left","caretLeft","window","scrollY","maxTop","innerHeight","height","Math","max","min","anchorRect","width","right","innerWidth","scrollX","onTop","bottom","topIfAbove","triggerCenter","newTop","round","newLeft","newCaretLeft","style","getPropertyValue","setProperty","handleClickOutside","e","target","isOutsidePopup","contains","isOutsideTrigger","clickedPopupContent","closest","isInsideChildPopup","handleKeyDown","key","preventDefault","querySelector","focus","focusable","Array","from","querySelectorAll","length","currentIndex","findIndex","el","document","activeElement","goBackward","shiftKey","nextIndex","handleActionableClick","actionable","rafId","requestAnimationFrame","firstFocusable","addEventListener","capture","passive","cancelAnimationFrame","removeEventListener","undefined","Trigger","_jsx","_jsxs","filter","Boolean","ref","onMouseEnter","onMouseLeave","role","tabIndex","value","_Fragment","close","body"],"sources":["../../../src/elements/Popup/index.tsx"],"sourcesContent":["'use client'\nimport type { CSSProperties } from 'react'\n\nexport * as PopupList from './PopupButtonList/index.js'\n\nimport React, { createContext, use, useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEffectEvent } from '../../hooks/useEffectEvent.js'\nimport { ThemeProvider } from '../../providers/Theme/index.js'\nimport './index.css'\nimport { PopupTrigger } from './PopupTrigger/index.js'\n\nconst baseClass = 'popup'\n\ntype PopupContextValue = {\n popupRef: React.RefObject<HTMLDivElement | null>\n}\n\nconst PopupContext = createContext<null | PopupContextValue>(null)\n\n/**\n * Selector for all elements the browser considers tabbable.\n */\nconst TABBABLE_SELECTOR = [\n 'a[href]',\n 'button:not(:disabled)',\n 'input:not(:disabled):not([type=\"hidden\"])',\n 'select:not(:disabled)',\n 'textarea:not(:disabled)',\n '[tabindex]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n 'audio[controls]',\n 'video[controls]',\n 'summary',\n]\n .map((s) => `${s}:not([tabindex=\"-1\"])`)\n .join(', ')\n\nexport type PopupProps = {\n backgroundColor?: CSSProperties['backgroundColor']\n boundingRef?: React.RefObject<HTMLElement>\n button?: React.ReactNode\n /**\n * The class name to apply to the button that triggers the popup.\n */\n buttonClassName?: string\n buttonSize?: 'large' | 'medium'\n buttonType?: 'custom' | 'default'\n caret?: boolean\n children?: React.ReactNode\n /**\n * The class name to apply to the popup container containing the trigger.\n * This does not wrap the actual popup content, which is rendered in a portal.\n */\n className?: string\n disabled?: boolean\n /**\n * Force control the open state of the popup, regardless of the trigger.\n */\n forceOpen?: boolean\n /**\n * Preferred horizontal alignment of the popup, if there is enough space available.\n *\n * @default 'left'\n */\n horizontalAlign?: 'center' | 'left' | 'right'\n id?: string\n initActive?: boolean\n noBackground?: boolean\n onToggleClose?: () => void\n onToggleOpen?: (active: boolean) => void\n /**\n * Class name to apply to the portal container.\n */\n portalClassName?: string\n render?: (args: { close: () => void }) => React.ReactNode\n /**\n * Render prop for custom trigger button. Receives onClick/onKeyDown/aria props.\n * When provided, `button` and `buttonType` are ignored.\n */\n renderButton?: (props: {\n active: boolean\n 'aria-expanded': boolean\n 'aria-haspopup': true\n onClick: React.MouseEventHandler\n onKeyDown: React.KeyboardEventHandler\n }) => React.ReactNode\n showOnHover?: boolean\n /**\n * By default, the scrollbar is hidden. If you want to show it, set this to true.\n * In both cases, the container is still scrollable.\n *\n * @default false\n */\n showScrollbar?: boolean\n /**\n * Position the popup to the side of the trigger instead of above/below.\n * The popup's top edge aligns with the trigger's top edge (with viewport clamping).\n * Automatically flips to the opposite side if there is not enough space.\n * When set, `verticalAlign`, `horizontalAlign`, and the caret are ignored.\n */\n side?: 'left' | 'right'\n size?: 'fit-content' | 'large' | 'medium' | 'small'\n /**\n * Theme for the popup content. Defaults to 'dark'.\n * Set to 'auto' to inherit the current theme.\n *\n * @default 'dark'\n */\n theme?: 'auto' | 'dark' | 'light'\n /**\n * Preferred vertical alignment of the popup (position below or above the trigger),\n * if there is enough space available.\n *\n * If the popup is too close to the edge of the viewport, it will flip to the opposite side\n * regardless of the preferred vertical alignment.\n *\n * @default 'bottom'\n */\n verticalAlign?: 'bottom' | 'top'\n}\n\n/**\n * Component that renders a popup, as well as a button that triggers the popup.\n *\n * The popup is rendered in a portal, and is automatically positioned above / below the trigger,\n * depending on the verticalAlign prop and the space available.\n */\nexport const Popup: React.FC<PopupProps> = (props) => {\n const {\n id,\n button,\n buttonClassName,\n buttonSize,\n buttonType = 'default',\n caret = true,\n children,\n className,\n disabled,\n forceOpen,\n horizontalAlign = 'left',\n initActive = false,\n noBackground,\n onToggleClose,\n onToggleOpen,\n portalClassName,\n render,\n renderButton,\n showOnHover = false,\n showScrollbar = false,\n side,\n size = 'medium',\n theme = 'dark',\n verticalAlign = 'bottom',\n } = props\n\n const popupRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n /**\n * Keeps track of whether the popup was opened via keyboard.\n * This is used to determine whether to autofocus the first element in the popup.\n * If the popup was opened via mouse, we do not want to autofocus the first element.\n */\n const openedViaKeyboardRef = useRef(false)\n\n const parentPopup = use(PopupContext)\n\n const [mounted, setMounted] = useState(false)\n const [active, setActiveInternal] = useState(initActive)\n const [isOnTop, setIsOnTop] = useState(verticalAlign === 'top')\n\n // Track when component is mounted to avoid SSR/client hydration mismatch\n useEffect(() => {\n setMounted(true)\n }, [])\n\n const setActive = useCallback(\n (isActive: boolean, viaKeyboard = false) => {\n if (isActive) {\n openedViaKeyboardRef.current = viaKeyboard\n onToggleOpen?.(true)\n } else {\n onToggleClose?.()\n }\n setActiveInternal(isActive)\n },\n [onToggleClose, onToggleOpen],\n )\n\n // /////////////////////////////////////\n // Position Calculation\n //\n // Calculates and applies popup position relative to trigger.\n // Always checks viewport bounds (for flipping), but only updates\n // styles if the calculated position differs from current position.\n // /////////////////////////////////////\n\n const updatePosition = useEffectEvent(() => {\n const trigger = triggerRef.current\n const popup = popupRef.current\n if (!trigger || !popup) {\n return\n }\n\n const triggerRect = trigger.getBoundingClientRect()\n const popupRect = popup.getBoundingClientRect()\n\n // Gap between the popup and the trigger/viewport edges (in pixels)\n const offset = 10\n // Additional gap used in side mode so the child popup has breathing room from its parent\n const sideOffset = 4\n\n let top: number\n let left: number\n let caretLeft: number\n\n if (side) {\n // /////////////////////////////////////\n // Side Positioning\n // Places the popup to the left or right of the parent popup (not just the trigger),\n // top-aligned with the trigger. Flips to the opposite side if there is not enough\n // viewport space.\n // /////////////////////////////////////\n\n // Top: align with trigger top, clamped to viewport\n top = triggerRect.top + window.scrollY\n const maxTop = window.scrollY + window.innerHeight - popupRect.height - offset\n top = Math.max(window.scrollY + offset, Math.min(top, maxTop))\n\n // Use the parent popup's bounding rect as the reference for left/right positioning\n // so the child appears 4px from the parent popup edge, not just the trigger button.\n const anchorRect = parentPopup?.popupRef.current\n ? parentPopup.popupRef.current.getBoundingClientRect()\n : triggerRect\n\n if (side === 'left') {\n left = anchorRect.left - popupRect.width - sideOffset\n if (left < offset) {\n // flip to right side\n left = anchorRect.right + sideOffset\n }\n } else {\n left = anchorRect.right + sideOffset\n if (left + popupRect.width + offset > window.innerWidth) {\n // flip to left side\n left = anchorRect.left - popupRect.width - sideOffset\n }\n }\n\n left = left + window.scrollX\n // Caret not used in side mode; set a neutral value\n caretLeft = popupRect.width / 2\n\n setIsOnTop(false)\n } else {\n // /////////////////////////////////////\n // Vertical Positioning\n // Calculates the `top` position in absolute page coordinates.\n // Uses `verticalAlign` prop as the preferred direction, but flips\n // to the opposite side if there's not enough viewport space.\n // /////////////////////////////////////\n\n let onTop = verticalAlign === 'top'\n\n if (verticalAlign === 'bottom') {\n top = triggerRect.bottom + window.scrollY + offset\n\n if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {\n // Try to flip above — only do so if there's actually enough room\n const topIfAbove = triggerRect.top + window.scrollY - popupRect.height - offset\n if (topIfAbove >= window.scrollY) {\n top = topIfAbove\n onTop = true\n }\n // else: not enough room above either — keep below and let it overflow rather than going off-screen\n }\n } else {\n top = triggerRect.top + window.scrollY - popupRect.height - offset\n\n if (triggerRect.top - popupRect.height - offset < 0) {\n top = triggerRect.bottom + window.scrollY + offset\n onTop = false\n }\n }\n\n setIsOnTop(onTop)\n\n // /////////////////////////////////////\n // Horizontal Positioning\n // Calculates the `left` position based on `horizontalAlign` prop:\n // - 'left': aligns popup's left edge with trigger's left edge\n // - 'right': aligns popup's right edge with trigger's right edge\n // - 'center': centers popup horizontally relative to trigger\n // Then clamps to keep the popup within viewport bounds.\n // /////////////////////////////////////\n\n left =\n horizontalAlign === 'right'\n ? triggerRect.right - popupRect.width\n : horizontalAlign === 'center'\n ? triggerRect.left + triggerRect.width / 2 - popupRect.width / 2\n : triggerRect.left\n\n left = Math.max(offset, Math.min(left, window.innerWidth - popupRect.width - offset))\n\n // /////////////////////////////////////\n // Caret Positioning\n // Positions the caret arrow to point at the trigger's horizontal center.\n // Clamps between 12px from edges to prevent caret from overflowing the popup.\n // /////////////////////////////////////\n\n const triggerCenter = triggerRect.left + triggerRect.width / 2\n caretLeft = Math.max(12, Math.min(triggerCenter - left, popupRect.width - 12))\n }\n\n // /////////////////////////////////////\n // Apply Styles (only if changed)\n // Compares calculated position with current styles to avoid unnecessary\n // DOM updates during scroll. This prevents visual lag by relying on the absolute\n // positioning where possible (popup slightly lags behind when scrolling really fast),\n // while still allowing position changes when needed (e.g., sticky parent, viewport flip).\n // Values are rounded to match browser's CSS precision and avoid false updates.\n // /////////////////////////////////////\n\n const newTop = `${Math.round(top)}px`\n const newLeft = `${Math.round(left + window.scrollX)}px`\n const newCaretLeft = `${Math.round(caretLeft)}px`\n\n if (popup.style.top !== newTop) {\n popup.style.top = newTop\n }\n if (popup.style.left !== newLeft) {\n popup.style.left = newLeft\n }\n if (popup.style.getPropertyValue('--caret-left') !== newCaretLeft) {\n popup.style.setProperty('--caret-left', newCaretLeft)\n }\n })\n\n // /////////////////////////////////////\n // Click Outside Handler\n // Closes popup when clicking outside both the popup and trigger.\n // Distinguishes between parent and child popups:\n // - Click in child popup: parent stays open\n // - Click in parent popup: child closes\n // /////////////////////////////////////\n\n const handleClickOutside = useEffectEvent((e: MouseEvent) => {\n const target = e.target as Node\n const isOutsidePopup = !popupRef.current?.contains(target)\n const isOutsideTrigger = !triggerRef.current?.contains(target)\n\n // Check if click is inside a popup portal\n const clickedPopupContent = (target as Element).closest?.('.popup__content')\n\n // If the clicked popup contains this popup's trigger, it's a parent popup\n // and we should close. If it doesn't contain our trigger, it's a child popup\n // and we should stay open to avoid closing parent when interacting with child.\n const isInsideChildPopup =\n clickedPopupContent && !clickedPopupContent.contains(triggerRef.current)\n\n if (isOutsidePopup && isOutsideTrigger && !isInsideChildPopup) {\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Keyboard Navigation\n // Handles keyboard interactions when popup is open:\n // - Escape: closes popup and returns focus to trigger\n // - Tab/Shift+Tab: cycles through focusable items with wrapping\n // - ArrowUp/ArrowDown: same as Shift+Tab/Tab for menu-style navigation\n // Focus is managed manually to support elements the browser might skip.\n // /////////////////////////////////////\n\n const handleKeyDown = useEffectEvent((e: KeyboardEvent) => {\n const popup = popupRef.current\n if (!popup || !active) {\n return\n }\n\n if (e.key === 'Escape') {\n e.preventDefault()\n setActive(false)\n triggerRef.current?.querySelector<HTMLElement>('button, [tabindex=\"0\"]')?.focus()\n return\n }\n\n if (e.key === 'Tab' || e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n const focusable = Array.from(popup.querySelectorAll<HTMLElement>(TABBABLE_SELECTOR))\n if (focusable.length === 0) {\n return\n }\n\n e.preventDefault()\n\n const currentIndex = focusable.findIndex((el) => el === document.activeElement)\n const goBackward = e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)\n\n let nextIndex: number\n if (currentIndex === -1) {\n nextIndex = goBackward ? focusable.length - 1 : 0\n } else if (goBackward) {\n nextIndex = currentIndex === 0 ? focusable.length - 1 : currentIndex - 1\n } else {\n nextIndex = currentIndex === focusable.length - 1 ? 0 : currentIndex + 1\n }\n\n focusable[nextIndex].focus()\n }\n })\n\n // /////////////////////////////////////\n // Click Handler for Actionable Elements\n // Closes popup when buttons/links inside are clicked (includes Enter/Space activation).\n // /////////////////////////////////////\n\n const handleActionableClick = useEffectEvent((e: MouseEvent) => {\n const target = e.target as HTMLElement\n\n // Allow opting out with data-popup-prevent-close attribute on element or ancestor\n if (target.closest('[data-popup-prevent-close]')) {\n return\n }\n\n // Check if the clicked element or any ancestor is an actionable element\n const actionable = target.closest('button, a[href], [role=\"button\"], [role=\"menuitem\"]')\n if (actionable && popupRef.current?.contains(actionable)) {\n // Don't close if clicking a nested popup's trigger — it will manage its own open state\n if (actionable.closest(`.${baseClass}__trigger-wrap`)) {\n return\n }\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Effect: Setup/Teardown position and focus management\n // /////////////////////////////////////\n\n useEffect(() => {\n if (!active) {\n const popup = popupRef.current\n if (popup) {\n // Clear inline position styles so the CSS `top: -9999px` rule on\n // `.popup__hidden-content` takes effect. Without this, the inline\n // styles set during positioning would win over the CSS rule, keeping\n // portaled children (e.g. a ReactSelect menu) visually on-screen.\n popup.style.top = ''\n popup.style.left = ''\n }\n return\n }\n\n const popup = popupRef.current\n if (!popup) {\n return\n }\n\n // /////////////////////////////////////\n // Initial Position\n // Calculate and apply popup position.\n // getBoundingClientRect() forces synchronous layout.\n //\n // We call updatePosition() twice: once synchronously (so the popup\n // snaps to roughly the right place immediately rather than flashing\n // from -9999px) and once in a requestAnimationFrame, which fires\n // after the browser has finished laying out the newly-visible popup\n // content. The rAF call is the authoritative one — it catches cases\n // where the popup height wasn't stable yet during the first call\n // (e.g. ColumnSelector content rendering after hidden → visible\n // class switch), which was causing incorrect flip-to-top decisions.\n // /////////////////////////////////////\n\n updatePosition()\n const rafId = requestAnimationFrame(() => {\n updatePosition()\n })\n\n // /////////////////////////////////////\n // Focus Management\n // When opened via keyboard, autofocus the first focusable button.\n // When opened via mouse, skip autofocus to avoid unwanted highlights.\n // /////////////////////////////////////\n\n if (openedViaKeyboardRef.current) {\n // Use requestAnimationFrame to ensure DOM is ready.\n requestAnimationFrame(() => {\n const firstFocusable = popup.querySelector<HTMLElement>(TABBABLE_SELECTOR)\n firstFocusable?.focus()\n })\n }\n\n // /////////////////////////////////////\n // Event Listeners\n // - resize/scroll: recalculate position (only applies styles if changed)\n // - mousedown: detect clicks outside to close\n // - keydown: handle keyboard navigation\n // /////////////////////////////////////\n\n window.addEventListener('resize', updatePosition)\n window.addEventListener('scroll', updatePosition, { capture: true, passive: true })\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleKeyDown)\n popup.addEventListener('click', handleActionableClick)\n\n return () => {\n cancelAnimationFrame(rafId)\n window.removeEventListener('resize', updatePosition)\n window.removeEventListener('scroll', updatePosition, { capture: true })\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleKeyDown)\n popup.removeEventListener('click', handleActionableClick)\n }\n }, [active])\n\n useEffect(() => {\n if (forceOpen !== undefined) {\n setActive(forceOpen)\n }\n }, [forceOpen, setActive])\n\n const Trigger = (\n <PopupTrigger\n active={active}\n button={button}\n buttonType={buttonType}\n className={buttonClassName}\n disabled={disabled}\n noBackground={noBackground}\n renderButton={renderButton}\n setActive={setActive}\n size={buttonSize}\n />\n )\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')} id={id}>\n <div className={`${baseClass}__trigger-wrap`} ref={triggerRef}>\n {showOnHover ? (\n <div\n className={`${baseClass}__on-hover-watch`}\n onMouseEnter={() => setActive(true)}\n onMouseLeave={() => setActive(false)}\n role=\"button\"\n tabIndex={0}\n >\n {Trigger}\n </div>\n ) : (\n Trigger\n )}\n </div>\n\n {mounted\n ? // We need to make sure the popup is part of the DOM (although invisible), even if it's not active.\n // This ensures that components within the popup, like modals, do not unmount when the popup closes.\n // Otherwise, modals opened from the popup will close unexpectedly when clicking within the modal, since\n // that closes the popup due to the click outside handler.\n createPortal(\n <PopupContext value={{ popupRef }}>\n <div\n className={\n active\n ? [\n `${baseClass}__content`,\n `${baseClass}--size-${size}`,\n side\n ? `${baseClass}--side-${side}`\n : isOnTop\n ? `${baseClass}--v-top`\n : `${baseClass}--v-bottom`,\n portalClassName,\n ]\n .filter(Boolean)\n .join(' ')\n : // Do not share any class names between active and disabled popups, to make sure\n // tests do not accidentally target inactive popups.\n `${baseClass}__hidden-content`\n }\n data-popup-id={id || undefined}\n data-theme={theme === 'auto' ? undefined : theme}\n ref={popupRef}\n >\n <div\n className={`${baseClass}__scroll-container${showScrollbar ? ` ${baseClass}__scroll-container--show-scrollbar` : ''}`}\n >\n {theme === 'auto' ? (\n <>\n {render?.({ close: () => setActive(false) })}\n {children}\n </>\n ) : (\n <ThemeProvider theme={theme}>\n {render?.({ close: () => setActive(false) })}\n {children}\n </ThemeProvider>\n )}\n </div>\n {caret && !side && <div className={`${baseClass}__caret`} />}\n </div>\n </PopupContext>,\n document.body,\n )\n : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,SAAS,MAAM;AAE3B,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AACpF,SAASC,YAAY,QAAQ;AAE7B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,OAAO;AACP,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY;AAMlB,MAAMC,YAAA,gBAAeX,aAAA,CAAwC;AAE7D;;;AAGA,MAAMY,iBAAA,GAAoB,CACxB,WACA,yBACA,6CACA,yBACA,2BACA,cACA,oDACA,mBACA,mBACA,UACD,CACEC,GAAG,CAAEC,CAAA,IAAM,GAAGA,CAAA,uBAAwB,EACtCC,IAAI,CAAC;AAsFR;;;;;;AAMA,OAAO,MAAMC,KAAA,GAA+BC,KAAA;EAC1C,MAAM;IACJC,EAAE;IACFC,MAAM;IACNC,eAAe;IACfC,UAAU;IACVC,UAAA,GAAa,SAAS;IACtBC,KAAA,GAAQ,IAAI;IACZC,QAAQ;IACRC,SAAS;IACTC,QAAQ;IACRC,SAAS;IACTC,eAAA,GAAkB,MAAM;IACxBC,UAAA,GAAa,KAAK;IAClBC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,eAAe;IACfC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,SAAA,EAAW,GAAGf,SAAA,qBAA8B2B,aAAA,GAAgB,IAAI3B,SAAA,oCAA6C,GAAG,IAAI;oBAEnH8B,KAAA,KAAU,sBACT2F,KAAA,CAAAS,SAAA;uBACG1G,MAAA,GAAS;cAAE2G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC5B,QAAA;4BAGH2G,KAAA,CAAC3H,aAAA;YAAcgC,KAAA,EAAOA,KAAA;uBACnBN,MAAA,GAAS;cAAE2G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC5B,QAAA;;YAIND,KAAA,IAAS,CAACe,IAAA,iBAAQ4F,IAAA,CAAC;UAAIzG,SAAA,EAAW,GAAGf,SAAA;;;QAG1CuG,QAAA,CAAS6B,IAAI,IAEf;;AAGV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["PopupList","React","createContext","use","useCallback","useEffect","useRef","useState","createPortal","useEffectEvent","ThemeProvider","PopupTrigger","baseClass","PopupContext","TABBABLE_SELECTOR","map","s","join","hasFixedAncestor","element","node","parentElement","document","body","window","getComputedStyle","position","Popup","props","id","button","buttonAriaLabel","buttonClassName","buttonSize","buttonType","caret","children","className","disabled","forceOpen","horizontalAlign","initActive","noBackground","onToggleClose","onToggleOpen","portalClassName","render","renderButton","showOnHover","showScrollbar","side","size","theme","verticalAlign","popupRef","triggerRef","isFixedRef","openedViaKeyboardRef","parentPopup","mounted","setMounted","active","setActiveInternal","isOnTop","setIsOnTop","setActive","isActive","viaKeyboard","current","updatePosition","trigger","popup","triggerRect","getBoundingClientRect","popupRect","useFixed","scrollY","scrollX","offset","sideOffset","top","left","caretLeft","maxTop","innerHeight","height","Math","max","min","anchorRect","width","right","innerWidth","onTop","bottom","topIfAbove","triggerCenter","newTop","round","newLeft","newCaretLeft","newPosition","style","getPropertyValue","setProperty","handleClickOutside","e","target","isOutsidePopup","contains","isOutsideTrigger","clickedPopupContent","closest","isInsideChildPopup","handleKeyDown","key","preventDefault","querySelector","focus","focusable","Array","from","querySelectorAll","length","currentIndex","findIndex","el","activeElement","goBackward","shiftKey","nextIndex","handleActionableClick","actionable","rafId","requestAnimationFrame","firstFocusable","addEventListener","capture","passive","cancelAnimationFrame","removeEventListener","undefined","Trigger","_jsx","_jsxs","filter","Boolean","ref","onMouseEnter","onMouseLeave","role","tabIndex","value","_Fragment","close"],"sources":["../../../src/elements/Popup/index.tsx"],"sourcesContent":["'use client'\nimport type { CSSProperties } from 'react'\n\nexport * as PopupList from './PopupButtonList/index.js'\n\nimport React, { createContext, use, useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEffectEvent } from '../../hooks/useEffectEvent.js'\nimport { ThemeProvider } from '../../providers/Theme/index.js'\nimport './index.css'\nimport { PopupTrigger } from './PopupTrigger/index.js'\n\nconst baseClass = 'popup'\n\ntype PopupContextValue = {\n popupRef: React.RefObject<HTMLDivElement | null>\n}\n\nconst PopupContext = createContext<null | PopupContextValue>(null)\n\n/**\n * Selector for all elements the browser considers tabbable.\n */\nconst TABBABLE_SELECTOR = [\n 'a[href]',\n 'button:not(:disabled)',\n 'input:not(:disabled):not([type=\"hidden\"])',\n 'select:not(:disabled)',\n 'textarea:not(:disabled)',\n '[tabindex]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n 'audio[controls]',\n 'video[controls]',\n 'summary',\n]\n .map((s) => `${s}:not([tabindex=\"-1\"])`)\n .join(', ')\n\n/**\n * Returns whether the element has a `position: fixed` ancestor (e.g. an open Drawer).\n * Such popups must be positioned with `fixed` so they don't drift when the background scrolls.\n */\nconst hasFixedAncestor = (element: HTMLElement | null): boolean => {\n let node = element?.parentElement\n while (node && node !== document.body) {\n if (window.getComputedStyle(node).position === 'fixed') {\n return true\n }\n node = node.parentElement\n }\n return false\n}\n\nexport type PopupProps = {\n backgroundColor?: CSSProperties['backgroundColor']\n boundingRef?: React.RefObject<HTMLElement>\n button?: React.ReactNode\n /**\n * Accessible label for the trigger button.\n * Necessary when the button has an icon-only content,\n * so the button has an accessible name for screen readers.\n */\n buttonAriaLabel?: string\n /**\n * The class name to apply to the button that triggers the popup.\n */\n buttonClassName?: string\n buttonSize?: 'large' | 'medium'\n buttonType?: 'custom' | 'default'\n caret?: boolean\n children?: React.ReactNode\n /**\n * The class name to apply to the popup container containing the trigger.\n * This does not wrap the actual popup content, which is rendered in a portal.\n */\n className?: string\n disabled?: boolean\n /**\n * Force control the open state of the popup, regardless of the trigger.\n */\n forceOpen?: boolean\n /**\n * Preferred horizontal alignment of the popup, if there is enough space available.\n *\n * @default 'left'\n */\n horizontalAlign?: 'center' | 'left' | 'right'\n id?: string\n initActive?: boolean\n noBackground?: boolean\n onToggleClose?: () => void\n onToggleOpen?: (active: boolean) => void\n /**\n * Class name to apply to the portal container.\n */\n portalClassName?: string\n render?: (args: { close: () => void }) => React.ReactNode\n /**\n * Render prop for custom trigger button. Receives onClick/onKeyDown/aria props.\n * When provided, `button` and `buttonType` are ignored.\n */\n renderButton?: (props: {\n active: boolean\n 'aria-expanded': boolean\n 'aria-haspopup': true\n onClick: React.MouseEventHandler\n onKeyDown: React.KeyboardEventHandler\n }) => React.ReactNode\n showOnHover?: boolean\n /**\n * By default, the scrollbar is hidden. If you want to show it, set this to true.\n * In both cases, the container is still scrollable.\n *\n * @default false\n */\n showScrollbar?: boolean\n /**\n * Position the popup to the side of the trigger instead of above/below.\n * The popup's top edge aligns with the trigger's top edge (with viewport clamping).\n * Automatically flips to the opposite side if there is not enough space.\n * When set, `verticalAlign`, `horizontalAlign`, and the caret are ignored.\n */\n side?: 'left' | 'right'\n size?: 'fit-content' | 'large' | 'small'\n /**\n * Theme for the popup content. Defaults to 'dark'.\n * Set to 'auto' to inherit the current theme.\n *\n * @default 'dark'\n */\n theme?: 'auto' | 'dark' | 'light'\n /**\n * Preferred vertical alignment of the popup (position below or above the trigger),\n * if there is enough space available.\n *\n * If the popup is too close to the edge of the viewport, it will flip to the opposite side\n * regardless of the preferred vertical alignment.\n *\n * @default 'bottom'\n */\n verticalAlign?: 'bottom' | 'top'\n}\n\n/**\n * Component that renders a popup, as well as a button that triggers the popup.\n *\n * The popup is rendered in a portal, and is automatically positioned above / below the trigger,\n * depending on the verticalAlign prop and the space available.\n */\nexport const Popup: React.FC<PopupProps> = (props) => {\n const {\n id,\n button,\n buttonAriaLabel,\n buttonClassName,\n buttonSize,\n buttonType = 'default',\n caret = true,\n children,\n className,\n disabled,\n forceOpen,\n horizontalAlign = 'left',\n initActive = false,\n noBackground,\n onToggleClose,\n onToggleOpen,\n portalClassName,\n render,\n renderButton,\n showOnHover = false,\n showScrollbar = false,\n side,\n size = 'fit-content',\n theme = 'dark',\n verticalAlign = 'bottom',\n } = props\n\n const popupRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n /**\n * Whether the trigger is inside a `position: fixed` ancestor (e.g. a Drawer),\n * in which case the popup is positioned with `fixed` instead of `absolute`.\n */\n const isFixedRef = useRef(false)\n\n /**\n * Keeps track of whether the popup was opened via keyboard.\n * This is used to determine whether to autofocus the first element in the popup.\n * If the popup was opened via mouse, we do not want to autofocus the first element.\n */\n const openedViaKeyboardRef = useRef(false)\n\n const parentPopup = use(PopupContext)\n\n const [mounted, setMounted] = useState(false)\n const [active, setActiveInternal] = useState(initActive)\n const [isOnTop, setIsOnTop] = useState(verticalAlign === 'top')\n\n // Track when component is mounted to avoid SSR/client hydration mismatch\n useEffect(() => {\n setMounted(true)\n }, [])\n\n const setActive = useCallback(\n (isActive: boolean, viaKeyboard = false) => {\n if (isActive) {\n openedViaKeyboardRef.current = viaKeyboard\n onToggleOpen?.(true)\n } else {\n onToggleClose?.()\n }\n setActiveInternal(isActive)\n },\n [onToggleClose, onToggleOpen],\n )\n\n // /////////////////////////////////////\n // Position Calculation\n //\n // Calculates and applies popup position relative to trigger.\n // Always checks viewport bounds (for flipping), but only updates\n // styles if the calculated position differs from current position.\n // /////////////////////////////////////\n\n const updatePosition = useEffectEvent(() => {\n const trigger = triggerRef.current\n const popup = popupRef.current\n if (!trigger || !popup) {\n return\n }\n\n const triggerRect = trigger.getBoundingClientRect()\n const popupRect = popup.getBoundingClientRect()\n\n // Inside a fixed ancestor, use `fixed` (no scroll offset) so background scrolling\n // doesn't shift the popup. Otherwise use page coordinates (absolute).\n const useFixed = isFixedRef.current\n const scrollY = useFixed ? 0 : window.scrollY\n const scrollX = useFixed ? 0 : window.scrollX\n\n // Gap between the popup and the trigger/viewport edges (in pixels)\n const offset = 10\n // Additional gap used in side mode so the child popup has breathing room from its parent\n const sideOffset = 4\n\n let top: number\n let left: number\n let caretLeft: number\n\n if (side) {\n // /////////////////////////////////////\n // Side Positioning\n // Places the popup to the left or right of the parent popup (not just the trigger),\n // top-aligned with the trigger. Flips to the opposite side if there is not enough\n // viewport space.\n // /////////////////////////////////////\n\n // Top: align with trigger top, clamped to viewport\n top = triggerRect.top + scrollY\n const maxTop = scrollY + window.innerHeight - popupRect.height - offset\n top = Math.max(scrollY + offset, Math.min(top, maxTop))\n\n // Use the parent popup's bounding rect as the reference for left/right positioning\n // so the child appears 4px from the parent popup edge, not just the trigger button.\n const anchorRect = parentPopup?.popupRef.current\n ? parentPopup.popupRef.current.getBoundingClientRect()\n : triggerRect\n\n if (side === 'left') {\n left = anchorRect.left - popupRect.width - sideOffset\n if (left < offset) {\n // flip to right side\n left = anchorRect.right + sideOffset\n }\n } else {\n left = anchorRect.right + sideOffset\n if (left + popupRect.width + offset > window.innerWidth) {\n // flip to left side\n left = anchorRect.left - popupRect.width - sideOffset\n }\n }\n\n left = left + scrollX\n // Caret not used in side mode; set a neutral value\n caretLeft = popupRect.width / 2\n\n setIsOnTop(false)\n } else {\n // /////////////////////////////////////\n // Vertical Positioning\n // Calculates the `top` position in absolute page coordinates.\n // Uses `verticalAlign` prop as the preferred direction, but flips\n // to the opposite side if there's not enough viewport space.\n // /////////////////////////////////////\n\n let onTop = verticalAlign === 'top'\n\n if (verticalAlign === 'bottom') {\n top = triggerRect.bottom + scrollY + offset\n\n if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {\n // Try to flip above — only do so if there's actually enough room\n const topIfAbove = triggerRect.top + scrollY - popupRect.height - offset\n if (topIfAbove >= scrollY) {\n top = topIfAbove\n onTop = true\n }\n // else: not enough room above either — keep below and let it overflow rather than going off-screen\n }\n } else {\n top = triggerRect.top + scrollY - popupRect.height - offset\n\n if (triggerRect.top - popupRect.height - offset < 0) {\n top = triggerRect.bottom + scrollY + offset\n onTop = false\n }\n }\n\n setIsOnTop(onTop)\n\n // /////////////////////////////////////\n // Horizontal Positioning\n // Calculates the `left` position based on `horizontalAlign` prop:\n // - 'left': aligns popup's left edge with trigger's left edge\n // - 'right': aligns popup's right edge with trigger's right edge\n // - 'center': centers popup horizontally relative to trigger\n // Then clamps to keep the popup within viewport bounds.\n // /////////////////////////////////////\n\n left =\n horizontalAlign === 'right'\n ? triggerRect.right - popupRect.width\n : horizontalAlign === 'center'\n ? triggerRect.left + triggerRect.width / 2 - popupRect.width / 2\n : triggerRect.left\n\n left = Math.max(offset, Math.min(left, window.innerWidth - popupRect.width - offset))\n\n // /////////////////////////////////////\n // Caret Positioning\n // Positions the caret arrow to point at the trigger's horizontal center.\n // Clamps between 12px from edges to prevent caret from overflowing the popup.\n // /////////////////////////////////////\n\n const triggerCenter = triggerRect.left + triggerRect.width / 2\n caretLeft = Math.max(12, Math.min(triggerCenter - left, popupRect.width - 12))\n }\n\n // /////////////////////////////////////\n // Apply Styles (only if changed)\n // Compares calculated position with current styles to avoid unnecessary\n // DOM updates during scroll. This prevents visual lag by relying on the absolute\n // positioning where possible (popup slightly lags behind when scrolling really fast),\n // while still allowing position changes when needed (e.g., sticky parent, viewport flip).\n // Values are rounded to match browser's CSS precision and avoid false updates.\n // /////////////////////////////////////\n\n const newTop = `${Math.round(top)}px`\n const newLeft = `${Math.round(left + scrollX)}px`\n const newCaretLeft = `${Math.round(caretLeft)}px`\n const newPosition = useFixed ? 'fixed' : ''\n\n if (popup.style.position !== newPosition) {\n popup.style.position = newPosition\n }\n if (popup.style.top !== newTop) {\n popup.style.top = newTop\n }\n if (popup.style.left !== newLeft) {\n popup.style.left = newLeft\n }\n if (popup.style.getPropertyValue('--caret-left') !== newCaretLeft) {\n popup.style.setProperty('--caret-left', newCaretLeft)\n }\n })\n\n // /////////////////////////////////////\n // Click Outside Handler\n // Closes popup when clicking outside both the popup and trigger.\n // Distinguishes between parent and child popups:\n // - Click in child popup: parent stays open\n // - Click in parent popup: child closes\n // /////////////////////////////////////\n\n const handleClickOutside = useEffectEvent((e: MouseEvent) => {\n const target = e.target as Node\n const isOutsidePopup = !popupRef.current?.contains(target)\n const isOutsideTrigger = !triggerRef.current?.contains(target)\n\n // Check if click is inside a popup portal\n const clickedPopupContent = (target as Element).closest?.('.popup__content')\n\n // If the clicked popup contains this popup's trigger, it's a parent popup\n // and we should close. If it doesn't contain our trigger, it's a child popup\n // and we should stay open to avoid closing parent when interacting with child.\n const isInsideChildPopup =\n clickedPopupContent && !clickedPopupContent.contains(triggerRef.current)\n\n if (isOutsidePopup && isOutsideTrigger && !isInsideChildPopup) {\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Keyboard Navigation\n // Handles keyboard interactions when popup is open:\n // - Escape: closes popup and returns focus to trigger\n // - Tab/Shift+Tab: cycles through focusable items with wrapping\n // - ArrowUp/ArrowDown: same as Shift+Tab/Tab for menu-style navigation\n // Focus is managed manually to support elements the browser might skip.\n // /////////////////////////////////////\n\n const handleKeyDown = useEffectEvent((e: KeyboardEvent) => {\n const popup = popupRef.current\n if (!popup || !active) {\n return\n }\n\n if (e.key === 'Escape') {\n e.preventDefault()\n setActive(false)\n triggerRef.current?.querySelector<HTMLElement>('button, [tabindex=\"0\"]')?.focus()\n return\n }\n\n if (e.key === 'Tab' || e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n const focusable = Array.from(popup.querySelectorAll<HTMLElement>(TABBABLE_SELECTOR))\n if (focusable.length === 0) {\n return\n }\n\n e.preventDefault()\n\n const currentIndex = focusable.findIndex((el) => el === document.activeElement)\n const goBackward = e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)\n\n let nextIndex: number\n if (currentIndex === -1) {\n nextIndex = goBackward ? focusable.length - 1 : 0\n } else if (goBackward) {\n nextIndex = currentIndex === 0 ? focusable.length - 1 : currentIndex - 1\n } else {\n nextIndex = currentIndex === focusable.length - 1 ? 0 : currentIndex + 1\n }\n\n focusable[nextIndex].focus()\n }\n })\n\n // /////////////////////////////////////\n // Click Handler for Actionable Elements\n // Closes popup when buttons/links inside are clicked (includes Enter/Space activation).\n // /////////////////////////////////////\n\n const handleActionableClick = useEffectEvent((e: MouseEvent) => {\n const target = e.target as HTMLElement\n\n // Allow opting out with data-popup-prevent-close attribute on element or ancestor\n if (target.closest('[data-popup-prevent-close]')) {\n return\n }\n\n // Check if the clicked element or any ancestor is an actionable element\n const actionable = target.closest('button, a[href], [role=\"button\"], [role=\"menuitem\"]')\n if (actionable && popupRef.current?.contains(actionable)) {\n // Don't close if clicking a nested popup's trigger — it will manage its own open state\n if (actionable.closest(`.${baseClass}__trigger-wrap`)) {\n return\n }\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Effect: Setup/Teardown position and focus management\n // /////////////////////////////////////\n\n useEffect(() => {\n if (!active) {\n const popup = popupRef.current\n if (popup) {\n // Clear inline position styles so the CSS `top: -9999px` rule on\n // `.popup__hidden-content` takes effect. Without this, the inline\n // styles set during positioning would win over the CSS rule, keeping\n // portaled children (e.g. a ReactSelect menu) visually on-screen.\n popup.style.position = ''\n popup.style.top = ''\n popup.style.left = ''\n }\n return\n }\n\n const popup = popupRef.current\n if (!popup) {\n return\n }\n\n // /////////////////////////////////////\n // Initial Position\n // Calculate and apply popup position.\n // getBoundingClientRect() forces synchronous layout.\n //\n // We call updatePosition() twice: once synchronously (so the popup\n // snaps to roughly the right place immediately rather than flashing\n // from -9999px) and once in a requestAnimationFrame, which fires\n // after the browser has finished laying out the newly-visible popup\n // content. The rAF call is the authoritative one — it catches cases\n // where the popup height wasn't stable yet during the first call\n // (e.g. ColumnSelection popup content rendering after hidden → visible\n // class switch), which was causing incorrect flip-to-top decisions.\n // /////////////////////////////////////\n\n // Decide the positioning strategy once per open.\n isFixedRef.current = hasFixedAncestor(triggerRef.current)\n\n updatePosition()\n const rafId = requestAnimationFrame(() => {\n updatePosition()\n })\n\n // /////////////////////////////////////\n // Focus Management\n // When opened via keyboard, autofocus the first focusable button.\n // When opened via mouse, skip autofocus to avoid unwanted highlights.\n // /////////////////////////////////////\n\n if (openedViaKeyboardRef.current) {\n // Use requestAnimationFrame to ensure DOM is ready.\n requestAnimationFrame(() => {\n const firstFocusable = popup.querySelector<HTMLElement>(TABBABLE_SELECTOR)\n firstFocusable?.focus()\n })\n }\n\n // /////////////////////////////////////\n // Event Listeners\n // - resize/scroll: recalculate position (only applies styles if changed)\n // - mousedown: detect clicks outside to close\n // - keydown: handle keyboard navigation\n // /////////////////////////////////////\n\n window.addEventListener('resize', updatePosition)\n window.addEventListener('scroll', updatePosition, { capture: true, passive: true })\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleKeyDown)\n popup.addEventListener('click', handleActionableClick)\n\n return () => {\n cancelAnimationFrame(rafId)\n window.removeEventListener('resize', updatePosition)\n window.removeEventListener('scroll', updatePosition, { capture: true })\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleKeyDown)\n popup.removeEventListener('click', handleActionableClick)\n }\n }, [active])\n\n useEffect(() => {\n if (forceOpen !== undefined) {\n setActive(forceOpen)\n }\n }, [forceOpen, setActive])\n\n const Trigger = (\n <PopupTrigger\n active={active}\n button={button}\n buttonAriaLabel={buttonAriaLabel}\n buttonType={buttonType}\n className={buttonClassName}\n disabled={disabled}\n noBackground={noBackground}\n renderButton={renderButton}\n setActive={setActive}\n size={buttonSize}\n />\n )\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')} id={id}>\n <div className={`${baseClass}__trigger-wrap`} ref={triggerRef}>\n {showOnHover ? (\n <div\n className={`${baseClass}__on-hover-watch`}\n onMouseEnter={() => setActive(true)}\n onMouseLeave={() => setActive(false)}\n role=\"button\"\n tabIndex={0}\n >\n {Trigger}\n </div>\n ) : (\n Trigger\n )}\n </div>\n\n {mounted\n ? // We need to make sure the popup is part of the DOM (although invisible), even if it's not active.\n // This ensures that components within the popup, like modals, do not unmount when the popup closes.\n // Otherwise, modals opened from the popup will close unexpectedly when clicking within the modal, since\n // that closes the popup due to the click outside handler.\n createPortal(\n <PopupContext value={{ popupRef }}>\n <div\n className={\n active\n ? [\n `${baseClass}__content`,\n `${baseClass}--size-${size}`,\n side\n ? `${baseClass}--side-${side}`\n : isOnTop\n ? `${baseClass}--v-top`\n : `${baseClass}--v-bottom`,\n portalClassName,\n ]\n .filter(Boolean)\n .join(' ')\n : // Do not share any class names between active and disabled popups, to make sure\n // tests do not accidentally target inactive popups.\n `${baseClass}__hidden-content`\n }\n data-popup-id={id || undefined}\n data-theme={theme === 'auto' ? undefined : theme}\n ref={popupRef}\n >\n <div\n className={`${baseClass}__scroll-container${showScrollbar ? ` ${baseClass}__scroll-container--show-scrollbar` : ''}`}\n >\n {theme === 'auto' ? (\n <>\n {render?.({ close: () => setActive(false) })}\n {children}\n </>\n ) : (\n <ThemeProvider theme={theme}>\n {render?.({ close: () => setActive(false) })}\n {children}\n </ThemeProvider>\n )}\n </div>\n {caret && !side && <div className={`${baseClass}__caret`} />}\n </div>\n </PopupContext>,\n document.body,\n )\n : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,SAAS,MAAM;AAE3B,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AACpF,SAASC,YAAY,QAAQ;AAE7B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,OAAO;AACP,SAASC,YAAY,QAA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AA2B;QAEpC,iBAAeiB,EAAA,IAAMgH,SAAA;QACrB,cAAYzF,KAAA,KAAU,SAASyF,SAAA,GAAYzF,KAAA;QAC3C+F,GAAA,EAAK7F,QAAA;gCAELyF,IAAA,CAAC;UACC1G,SAAA,EAAW,GAAGzB,SAAA,qBAA8BqC,aAAA,GAAgB,IAAIrC,SAAA,oCAA6C,GAAG,IAAI;oBAEnHwC,KAAA,KAAU,sBACT4F,KAAA,CAAAS,SAAA;uBACG3G,MAAA,GAAS;cAAE4G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC7B,QAAA;4BAGH4G,KAAA,CAACtI,aAAA;YAAc0C,KAAA,EAAOA,KAAA;uBACnBN,MAAA,GAAS;cAAE4G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC7B,QAAA;;YAIND,KAAA,IAAS,CAACe,IAAA,iBAAQ6F,IAAA,CAAC;UAAI1G,SAAA,EAAW,GAAGzB,SAAA;;;QAG1CU,QAAA,CAASC,IAAI,IAEf;;AAGV","ignoreList":[]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
@layer payload-default {
|
|
2
|
+
.preview-sizes {
|
|
3
|
+
margin: var(--spacer-6) calc(var(--gutter-h) * -1) 0 calc(var(--gutter-h) * -1);
|
|
4
|
+
border-top: var(--stroke-width-small) solid var(--theme-elevation-150);
|
|
5
|
+
max-height: calc(100vh - var(--spacer-6) * 3);
|
|
6
|
+
height: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.preview-sizes__imageWrap {
|
|
12
|
+
min-width: 60%;
|
|
13
|
+
border-right: var(--stroke-width-small) solid var(--theme-elevation-150);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.preview-sizes__preview {
|
|
17
|
+
max-height: calc(100% - var(--spacer-6) * 3);
|
|
18
|
+
padding: var(--spacer-5) var(--spacer-5) var(--spacer-5) var(--gutter-h);
|
|
19
|
+
object-fit: contain;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.preview-sizes__meta {
|
|
23
|
+
border-bottom: var(--stroke-width-small) solid var(--theme-elevation-150);
|
|
24
|
+
padding: var(--spacer-3) var(--gutter-h);
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-wrap: wrap;
|
|
27
|
+
column-gap: var(--spacer-3);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.preview-sizes__meta .file-meta {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
column-gap: var(--spacer-3);
|
|
34
|
+
text-wrap: wrap;
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.preview-sizes__meta .file-meta__url {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.preview-sizes__sizeName,
|
|
43
|
+
.preview-sizes .file-meta__size-type {
|
|
44
|
+
color: var(--theme-elevation-600);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.preview-sizes__listWrap {
|
|
48
|
+
padding-right: var(--gutter-h);
|
|
49
|
+
overflow-y: scroll;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.preview-sizes__listWrap::-webkit-scrollbar {
|
|
53
|
+
width: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.preview-sizes__listWrap::after {
|
|
57
|
+
content: '';
|
|
58
|
+
display: block;
|
|
59
|
+
position: sticky;
|
|
60
|
+
bottom: 0;
|
|
61
|
+
left: 0;
|
|
62
|
+
height: calc(var(--spacer-6) * 2);
|
|
63
|
+
width: 100%;
|
|
64
|
+
background: linear-gradient(180deg, transparent 0, var(--theme-bg) 100%);
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.preview-sizes__list {
|
|
69
|
+
list-style: none;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
gap: var(--spacer-2);
|
|
73
|
+
margin: 0;
|
|
74
|
+
padding: var(--spacer-5) 0 var(--spacer-5) var(--spacer-5);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.preview-sizes__sizeOption {
|
|
78
|
+
padding: var(--spacer-2);
|
|
79
|
+
display: flex;
|
|
80
|
+
gap: var(--spacer-3);
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
transition: background-color 0.2s ease-in-out;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.preview-sizes__sizeOption:hover {
|
|
86
|
+
background-color: var(--theme-elevation-100);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.preview-sizes--selected {
|
|
90
|
+
background-color: var(--theme-elevation-100);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.preview-sizes__image {
|
|
94
|
+
display: flex;
|
|
95
|
+
width: 30%;
|
|
96
|
+
min-width: 30%;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.preview-sizes__sizeMeta {
|
|
102
|
+
padding: var(--spacer-2) 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.preview-sizes__sizeName,
|
|
106
|
+
.preview-sizes__sizeMeta {
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
text-overflow: ellipsis;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@media (max-width: 1024px) {
|
|
112
|
+
.preview-sizes {
|
|
113
|
+
margin-top: var(--spacer-3);
|
|
114
|
+
max-height: calc(100vh - var(--spacer-6) * 2);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@media (max-width: 768px) {
|
|
119
|
+
.preview-sizes {
|
|
120
|
+
margin-top: 0;
|
|
121
|
+
max-height: calc(100vh - var(--spacer-6) * 1.75);
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
justify-content: space-between;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.preview-sizes__imageWrap {
|
|
127
|
+
height: 60%;
|
|
128
|
+
border: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.preview-sizes__list,
|
|
132
|
+
.preview-sizes__preview {
|
|
133
|
+
padding: calc(var(--gutter-h) * 2) var(--gutter-h);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.preview-sizes__preview {
|
|
137
|
+
max-height: calc(100% - var(--spacer-6) * 2);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.preview-sizes__sizeOption {
|
|
141
|
+
padding: var(--spacer-1);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.preview-sizes__listWrap {
|
|
145
|
+
border-top: var(--stroke-width-small) solid var(--theme-elevation-150);
|
|
146
|
+
height: 40%;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Data, FileSize, SanitizedCollectionConfig } from 'payload';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import './index.
|
|
3
|
+
import './index.css';
|
|
4
4
|
type FileInfo = {
|
|
5
5
|
url: string;
|
|
6
6
|
} & FileSize;
|
|
@@ -11,7 +11,7 @@ export type PreviewSizesProps = {
|
|
|
11
11
|
doc: {
|
|
12
12
|
sizes?: FilesSizesWithUrl;
|
|
13
13
|
} & Data;
|
|
14
|
-
imageCacheTag?: string;
|
|
14
|
+
imageCacheTag?: false | string;
|
|
15
15
|
uploadConfig: SanitizedCollectionConfig['upload'];
|
|
16
16
|
};
|
|
17
17
|
export declare const PreviewSizes: React.FC<PreviewSizesProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/PreviewSizes/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,yBAAyB,EAAyB,MAAM,SAAS,CAAA;AAE/F,OAAO,KAAuC,MAAM,OAAO,CAAA;AAI3D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/PreviewSizes/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,yBAAyB,EAAyB,MAAM,SAAS,CAAA;AAE/F,OAAO,KAAuC,MAAM,OAAO,CAAA;AAI3D,OAAO,aAAa,CAAA;AAIpB,KAAK,QAAQ,GAAG;IACd,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,QAAQ,CAAA;AACZ,KAAK,iBAAiB,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CACxB,CAAA;AA8DD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE;QACH,KAAK,CAAC,EAAE,iBAAiB,CAAA;KAC1B,GAAG,IAAI,CAAA;IACR,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IAC9B,YAAY,EAAE,yBAAyB,CAAC,QAAQ,CAAC,CAAA;CAClD,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoFpD,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
5
5
|
import { appendCacheTag } from '../../utilities/appendCacheTag.js';
|
|
6
6
|
import { FileMeta } from '../FileDetails/FileMeta/index.js';
|
|
7
|
-
import './index.
|
|
7
|
+
import './index.css';
|
|
8
8
|
const baseClass = 'preview-sizes';
|
|
9
9
|
const sortSizes = (sizes, imageSizes) => {
|
|
10
10
|
if (!imageSizes || imageSizes.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useEffect","useMemo","useState","appendCacheTag","FileMeta","baseClass","sortSizes","sizes","imageSizes","length","orderedSizes","forEach","name","PreviewSizeCard","active","alt","meta","onClick","previewSrc","_jsxs","className","filter","Boolean","join","undefined","onKeyDown","e","key","role","tabIndex","_jsx","src","PreviewSizes","doc","imageCacheTag","uploadConfig","filename","setOrderedSizes","selectedSize","setSelectedSize","generateImageUrl","url","mainPreviewSrc","originalImage","filesize","height","mimeType","width","originalFilename","Object","entries","map","val","selected"],"sources":["../../../src/elements/PreviewSizes/index.tsx"],"sourcesContent":["'use client'\nimport type { Data, FileSize, SanitizedCollectionConfig, SanitizedUploadConfig } from 'payload'\n\nimport React, { useEffect, useMemo, useState } from 'react'\n\nimport { appendCacheTag } from '../../utilities/appendCacheTag.js'\nimport { FileMeta } from '../FileDetails/FileMeta/index.js'\nimport './index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useEffect","useMemo","useState","appendCacheTag","FileMeta","baseClass","sortSizes","sizes","imageSizes","length","orderedSizes","forEach","name","PreviewSizeCard","active","alt","meta","onClick","previewSrc","_jsxs","className","filter","Boolean","join","undefined","onKeyDown","e","key","role","tabIndex","_jsx","src","PreviewSizes","doc","imageCacheTag","uploadConfig","filename","setOrderedSizes","selectedSize","setSelectedSize","generateImageUrl","url","mainPreviewSrc","originalImage","filesize","height","mimeType","width","originalFilename","Object","entries","map","val","selected"],"sources":["../../../src/elements/PreviewSizes/index.tsx"],"sourcesContent":["'use client'\nimport type { Data, FileSize, SanitizedCollectionConfig, SanitizedUploadConfig } from 'payload'\n\nimport React, { useEffect, useMemo, useState } from 'react'\n\nimport { appendCacheTag } from '../../utilities/appendCacheTag.js'\nimport { FileMeta } from '../FileDetails/FileMeta/index.js'\nimport './index.css'\n\nconst baseClass = 'preview-sizes'\n\ntype FileInfo = {\n url: string\n} & FileSize\ntype FilesSizesWithUrl = {\n [key: string]: FileInfo\n}\n\nconst sortSizes = (sizes: FilesSizesWithUrl, imageSizes: SanitizedUploadConfig['imageSizes']) => {\n if (!imageSizes || imageSizes.length === 0) {\n return sizes\n }\n\n const orderedSizes: FilesSizesWithUrl = {}\n\n imageSizes.forEach(({ name }) => {\n if (sizes[name]) {\n orderedSizes[name] = sizes[name]\n }\n })\n\n return orderedSizes\n}\n\ntype PreviewSizeCardProps = {\n active: boolean\n alt: string\n meta: FileInfo\n name: string\n onClick?: () => void\n previewSrc: string\n}\nconst PreviewSizeCard: React.FC<PreviewSizeCardProps> = ({\n name,\n active,\n alt,\n meta,\n onClick,\n previewSrc,\n}) => {\n return (\n <div\n className={[`${baseClass}__sizeOption`, active && `${baseClass}--selected`]\n .filter(Boolean)\n .join(' ')}\n onClick={typeof onClick === 'function' ? onClick : undefined}\n onKeyDown={(e) => {\n if (typeof onClick !== 'function') {\n return\n }\n if (e.key === 'Enter') {\n onClick()\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n <div className={`${baseClass}__image`}>\n <img alt={alt} src={previewSrc} />\n </div>\n <div className={`${baseClass}__sizeMeta`}>\n <div className={`${baseClass}__sizeName`}>{name}</div>\n <FileMeta {...meta} />\n </div>\n </div>\n )\n}\n\nexport type PreviewSizesProps = {\n doc: {\n sizes?: FilesSizesWithUrl\n } & Data\n imageCacheTag?: false | string\n uploadConfig: SanitizedCollectionConfig['upload']\n}\n\nexport const PreviewSizes: React.FC<PreviewSizesProps> = ({ doc, imageCacheTag, uploadConfig }) => {\n const { imageSizes } = uploadConfig\n const { sizes } = doc\n\n const alt = (doc as { alt?: string })?.alt || doc.filename || ''\n\n const [orderedSizes, setOrderedSizes] = useState<FilesSizesWithUrl>(() =>\n sortSizes(sizes, imageSizes),\n )\n const [selectedSize, setSelectedSize] = useState<null | string>(null)\n\n const generateImageUrl = (doc) => {\n if (!doc.filename) {\n return null\n }\n if (doc.url) {\n return appendCacheTag(doc.url, imageCacheTag)\n }\n }\n useEffect(() => {\n setOrderedSizes(sortSizes(sizes, imageSizes))\n }, [sizes, imageSizes, imageCacheTag])\n\n const mainPreviewSrc = selectedSize\n ? generateImageUrl(doc.sizes[selectedSize])\n : generateImageUrl(doc)\n\n const originalImage = useMemo(\n (): FileInfo => ({\n filename: doc.filename,\n filesize: doc.filesize,\n height: doc.height,\n mimeType: doc.mimeType,\n url: doc.url,\n width: doc.width,\n }),\n [doc],\n )\n const originalFilename = 'Original'\n\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__imageWrap`}>\n <div className={`${baseClass}__meta`}>\n <div className={`${baseClass}__sizeName`}>{selectedSize || originalFilename}</div>\n <FileMeta {...(selectedSize ? orderedSizes[selectedSize] : originalImage)} />\n </div>\n <img alt={alt} className={`${baseClass}__preview`} src={mainPreviewSrc} />\n </div>\n <div className={`${baseClass}__listWrap`}>\n <div className={`${baseClass}__list`}>\n <PreviewSizeCard\n active={!selectedSize}\n alt={alt}\n meta={originalImage}\n name={originalFilename}\n onClick={() => setSelectedSize(null)}\n previewSrc={generateImageUrl(doc)}\n />\n\n {Object.entries(orderedSizes).map(([key, val]) => {\n const selected = selectedSize === key\n const previewSrc = generateImageUrl(val)\n\n if (previewSrc) {\n return (\n <PreviewSizeCard\n active={selected}\n alt={alt}\n key={key}\n meta={val}\n name={key}\n onClick={() => setSelectedSize(key)}\n previewSrc={previewSrc}\n />\n )\n }\n\n return null\n })}\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,OAAOA,KAAA,IAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAEpD,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,OAAO;AAEP,MAAMC,SAAA,GAAY;AASlB,MAAMC,SAAA,GAAYA,CAACC,KAAA,EAA0BC,UAAA;EAC3C,IAAI,CAACA,UAAA,IAAcA,UAAA,CAAWC,MAAM,KAAK,GAAG;IAC1C,OAAOF,KAAA;EACT;EAEA,MAAMG,YAAA,GAAkC,CAAC;EAEzCF,UAAA,CAAWG,OAAO,CAAC,CAAC;IAAEC;EAAI,CAAE;IAC1B,IAAIL,KAAK,CAACK,IAAA,CAAK,EAAE;MACfF,YAAY,CAACE,IAAA,CAAK,GAAGL,KAAK,CAACK,IAAA,CA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AAA,CAAa,GAAGK,aAAa;;uBAE1Eb,IAAA,CAAC;QAAIf,GAAA,EAAKA,GAAA;QAAKK,SAAA,EAAW,GAAGf,SAAA,WAAoB;QAAE0B,GAAA,EAAKW;;qBAE1DZ,IAAA,CAAC;MAAIV,SAAA,EAAW,GAAGf,SAAA,YAAqB;gBACtC,aAAAc,KAAA,CAAC;QAAIC,SAAA,EAAW,GAAGf,SAAA,QAAiB;gCAClCyB,IAAA,CAACjB,eAAA;UACCC,MAAA,EAAQ,CAACwB,YAAA;UACTvB,GAAA,EAAKA,GAAA;UACLC,IAAA,EAAM2B,aAAA;UACN/B,IAAA,EAAMoC,gBAAA;UACN/B,OAAA,EAASA,CAAA,KAAMsB,eAAA,CAAgB;UAC/BrB,UAAA,EAAYsB,gBAAA,CAAiBP,GAAA;YAG9BgB,MAAA,CAAOC,OAAO,CAACxC,YAAA,EAAcyC,GAAG,CAAC,CAAC,CAACxB,GAAA,EAAKyB,GAAA,CAAI;UAC3C,MAAMC,QAAA,GAAWf,YAAA,KAAiBX,GAAA;UAClC,MAAMT,UAAA,GAAasB,gBAAA,CAAiBY,GAAA;UAEpC,IAAIlC,UAAA,EAAY;YACd,oBACEY,IAAA,CAACjB,eAAA;cACCC,MAAA,EAAQuC,QAAA;cACRtC,GAAA,EAAKA,GAAA;cAELC,IAAA,EAAMoC,GAAA;cACNxC,IAAA,EAAMe,GAAA;cACNV,OAAA,EAASA,CAAA,KAAMsB,eAAA,CAAgBZ,GAAA;cAC/BT,UAAA,EAAYA;eAJPS,GAAA;UAOX;UAEA,OAAO;QACT;;;;AAKV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/QueryPresets/cells/ColumnsCell/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAG1E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/QueryPresets/cells/ColumnsCell/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAG1E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAqBvE,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { toWords, transformColumnsToSearchParams } from 'payload/shared';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Pill } from '../../../Pill/index.js';
|
|
5
|
-
import './index.
|
|
5
|
+
import './index.css';
|
|
6
6
|
const baseClass = 'query-preset-columns-cell';
|
|
7
7
|
export const QueryPresetsColumnsCell = ({
|
|
8
8
|
cellData
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["toWords","transformColumnsToSearchParams","React","Pill","baseClass","QueryPresetsColumnsCell","cellData","_jsx","className","map","column","i","isColumnActive","startsWith","pillStyle","size"],"sources":["../../../../../src/elements/QueryPresets/cells/ColumnsCell/index.tsx"],"sourcesContent":["import type { ColumnPreference, DefaultCellComponentProps } from 'payload'\n\nimport { toWords, transformColumnsToSearchParams } from 'payload/shared'\nimport React from 'react'\n\nimport { Pill } from '../../../Pill/index.js'\nimport './index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["toWords","transformColumnsToSearchParams","React","Pill","baseClass","QueryPresetsColumnsCell","cellData","_jsx","className","map","column","i","isColumnActive","startsWith","pillStyle","size"],"sources":["../../../../../src/elements/QueryPresets/cells/ColumnsCell/index.tsx"],"sourcesContent":["import type { ColumnPreference, DefaultCellComponentProps } from 'payload'\n\nimport { toWords, transformColumnsToSearchParams } from 'payload/shared'\nimport React from 'react'\n\nimport { Pill } from '../../../Pill/index.js'\nimport './index.css'\n\nconst baseClass = 'query-preset-columns-cell'\n\nexport const QueryPresetsColumnsCell: React.FC<DefaultCellComponentProps> = ({ cellData }) => {\n return (\n <div className={baseClass}>\n {cellData\n ? transformColumnsToSearchParams(cellData as ColumnPreference[]).map((column, i) => {\n const isColumnActive = !column.startsWith('-')\n\n // to void very lengthy cells, only display the active columns\n if (!isColumnActive) {\n return null\n }\n\n return (\n <Pill key={i} pillStyle={isColumnActive ? 'always-white' : 'light'} size=\"small\">\n {toWords(column)}\n </Pill>\n )\n })\n : 'No columns selected'}\n </div>\n )\n}\n"],"mappings":";AAEA,SAASA,OAAO,EAAEC,8BAA8B,QAAQ;AACxD,OAAOC,KAAA,MAAW;AAElB,SAASC,IAAI,QAAQ;AACrB,OAAO;AAEP,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,uBAAA,GAA+DA,CAAC;EAAEC;AAAQ,CAAE;EACvF,oBACEC,IAAA,CAAC;IAAIC,SAAA,EAAWJ,SAAA;cACbE,QAAA,GACGL,8BAAA,CAA+BK,QAAA,EAAgCG,GAAG,CAAC,CAACC,MAAA,EAAQC,CAAA;MAC1E,MAAMC,cAAA,GAAiB,CAACF,MAAA,CAAOG,UAAU,CAAC;MAE1C;MACA,IAAI,CAACD,cAAA,EAAgB;QACnB,OAAO;MACT;MAEA,oBACEL,IAAA,CAACJ,IAAA;QAAaW,SAAA,EAAWF,cAAA,GAAiB,iBAAiB;QAASG,IAAA,EAAK;kBACtEf,OAAA,CAAQU,MAAA;SADAC,CAAA;IAIf,KACA;;AAGV","ignoreList":[]}
|