frappe-ui 1.0.0-beta.2 → 1.0.0-beta.21
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/experimental/FloatingWindow/FloatingWindow.cy.ts +328 -0
- package/experimental/FloatingWindow/FloatingWindow.vue +303 -0
- package/experimental/FloatingWindow/index.ts +8 -0
- package/experimental/FloatingWindow/types.ts +31 -0
- package/experimental/FloatingWindow/useFloatingWindow.ts +236 -0
- package/experimental/MultiEmailInput/MultiEmailInput.cy.ts +155 -0
- package/experimental/MultiEmailInput/MultiEmailInput.vue +472 -0
- package/experimental/MultiEmailInput/index.ts +17 -0
- package/experimental/MultiEmailInput/stories/AsyncSuggestions.vue +54 -0
- package/experimental/MultiEmailInput/stories/Basic.vue +18 -0
- package/experimental/MultiEmailInput/stories/CustomChip.vue +39 -0
- package/experimental/MultiEmailInput/stories/Labeling.vue +28 -0
- package/experimental/MultiEmailInput/types.ts +138 -0
- package/experimental/MultiEmailInput/utils.ts +60 -0
- package/experimental.ts +12 -0
- package/frappe/Billing/SignupBanner.vue +1 -1
- package/frappe/Billing/TrialBanner.vue +1 -1
- package/frappe/DataImport/DataImport.vue +1 -1
- package/frappe/DataImport/DataImportList.vue +1 -1
- package/frappe/DataImport/ImportSteps.vue +6 -6
- package/frappe/DataImport/MappingStep.vue +1 -1
- package/frappe/DataImport/PreviewStep.vue +9 -9
- package/frappe/DataImport/TemplateModal.vue +1 -1
- package/frappe/DataImport/UploadStep.vue +5 -5
- package/frappe/Filter/Filter.vue +1 -1
- package/frappe/Help/HelpModal.vue +1 -1
- package/frappe/Link/stories/Suffix.vue +2 -2
- package/frappe/Onboarding/GettingStartedBanner.vue +1 -1
- package/frappe/drive/components/AppSwitcher.vue +1 -1
- package/frappe/drive/components/InfoDialog.vue +3 -3
- package/frappe/drive/components/MoveDialog.vue +2 -2
- package/frappe/drive/components/Select/Select.vue +2 -2
- package/frappe/drive/components/ShareDialog.vue +1 -1
- package/frappe/telemetry/index.ts +88 -14
- package/frappe/telemetry/pulse.ts +78 -164
- package/frappe/telemetry/telemetry.test.ts +13 -79
- package/icons/IconPicker.vue +1 -1
- package/package.json +104 -34
- package/src/components/Alert/Alert.md +4 -0
- package/src/components/Alert/Alert.vue +4 -4
- package/src/components/Autocomplete/Autocomplete.vue +6 -6
- package/src/components/Avatar/Avatar.md +4 -0
- package/src/components/Avatar/Avatar.vue +23 -4
- package/src/components/Badge/Badge.api.md +1 -1
- package/src/components/Badge/Badge.cy.ts +34 -16
- package/src/components/Badge/Badge.md +20 -4
- package/src/components/Badge/Badge.vue +60 -45
- package/src/components/Badge/stories/CallMeta.vue +35 -0
- package/src/components/Badge/stories/EventStatus.vue +16 -0
- package/src/components/Badge/stories/ListStatus.vue +91 -0
- package/src/components/Badge/stories/Reactions.vue +33 -0
- package/src/components/Badge/stories/RowTags.vue +39 -0
- package/src/components/Badge/types.ts +1 -2
- package/src/components/BottomSheet/BottomSheet.api.md +57 -0
- package/src/components/BottomSheet/BottomSheet.vue +232 -0
- package/src/components/BottomSheet/index.ts +6 -0
- package/src/components/BottomSheet/types.ts +23 -0
- package/src/components/Breadcrumbs/Breadcrumbs.md +4 -0
- package/src/components/Breadcrumbs/Breadcrumbs.vue +3 -3
- package/src/components/Button/Button.api.md +37 -32
- package/src/components/Button/Button.cy.ts +18 -2
- package/src/components/Button/Button.md +20 -8
- package/src/components/Button/Button.vue +304 -284
- package/src/components/Button/stories/InlineActions.vue +10 -0
- package/src/components/Button/stories/LiveClassCard.vue +34 -0
- package/src/components/Button/stories/SectionAction.vue +17 -0
- package/src/components/Button/stories/SectionControls.vue +28 -0
- package/src/components/Button/stories/SelectionToolbar.vue +20 -0
- package/src/components/Button/stories/StackedActions.vue +10 -0
- package/src/components/Button/types.ts +38 -32
- package/src/components/Calendar/Calendar.api.md +16 -16
- package/src/components/Calendar/Calendar.vue +100 -73
- package/src/components/Calendar/CalendarDaily.vue +21 -20
- package/src/components/Calendar/CalendarMonthEvent.vue +30 -9
- package/src/components/Calendar/CalendarMonthly.vue +60 -39
- package/src/components/Calendar/CalendarTimeMarker.vue +9 -8
- package/src/components/Calendar/CalendarWeekDayEvent.vue +98 -42
- package/src/components/Calendar/CalendarWeekly.vue +77 -41
- package/src/components/Calendar/EventModalContent.vue +32 -16
- package/src/components/Calendar/NewEventModal.vue +19 -16
- package/src/components/Calendar/ShowMoreCalendarEvent.vue +11 -17
- package/src/components/Calendar/{calendarUtils.js → calendarUtils.ts} +76 -52
- package/src/components/Calendar/composables/{useCalendarData.js → useCalendarData.ts} +23 -11
- package/src/components/Calendar/composables/{useEventModal.js → useEventModal.ts} +16 -12
- package/src/components/Calendar/index.ts +12 -2
- package/src/components/Calendar/stories/CustomHeader.vue +1 -1
- package/src/components/Calendar/types.ts +106 -0
- package/src/components/Calendar/{useEventBase.js → useEventBase.ts} +40 -26
- package/src/components/Card.vue +2 -2
- package/src/components/Charts/ECharts.vue +1 -1
- package/src/components/Charts/NumberChart.vue +7 -7
- package/src/components/Charts/eChartOptions.ts +28 -13
- package/src/components/Checkbox/Checkbox.api.md +6 -0
- package/src/components/Checkbox/Checkbox.cy.ts +10 -2
- package/src/components/Checkbox/Checkbox.md +28 -0
- package/src/components/Checkbox/Checkbox.vue +9 -22
- package/src/components/Checkbox/stories/Group.vue +27 -0
- package/src/components/Checkbox/stories/HorizontalGroup.vue +24 -0
- package/src/components/Checkbox/stories/SettingRow.vue +23 -0
- package/src/components/Checkbox/stories/WithDescription.vue +27 -0
- package/src/components/Checkbox/types.ts +7 -0
- package/src/components/CodeEditor/CodeEditor.api.md +139 -0
- package/src/components/CodeEditor/CodeEditor.cy.ts +160 -0
- package/src/components/CodeEditor/CodeEditor.md +104 -0
- package/src/components/CodeEditor/CodeEditor.vue +556 -0
- package/src/components/CodeEditor/CodePreview.test.ts +49 -0
- package/src/components/CodeEditor/CodePreview.vue +45 -0
- package/src/components/CodeEditor/index.ts +17 -0
- package/src/components/CodeEditor/languages.ts +63 -0
- package/src/components/CodeEditor/stories/Default.vue +16 -0
- package/src/components/CodeEditor/stories/Labeling.vue +25 -0
- package/src/components/CodeEditor/stories/MaxHeight.vue +24 -0
- package/src/components/CodeEditor/stories/Preview.vue +36 -0
- package/src/components/CodeEditor/stories/Sizes.vue +15 -0
- package/src/components/CodeEditor/stories/Variants.vue +13 -0
- package/src/components/CodeEditor/theme.ts +272 -0
- package/src/components/CodeEditor/types.ts +69 -0
- package/src/components/Combobox/Combobox.api.md +19 -20
- package/src/components/Combobox/Combobox.cy.ts +54 -14
- package/src/components/Combobox/Combobox.md +4 -0
- package/src/components/Combobox/Combobox.vue +233 -247
- package/src/components/Combobox/ComboboxResults.vue +1 -1
- package/src/components/Combobox/stories/Clearable.vue +2 -2
- package/src/components/Combobox/stories/CreateNew.vue +1 -1
- package/src/components/Combobox/stories/Footer.vue +10 -2
- package/src/components/Combobox/stories/InDialog.vue +1 -1
- package/src/components/Combobox/types.ts +8 -29
- package/src/components/CommandPalette/CommandPaletteItem.vue +1 -1
- package/src/components/ContextMenu/ContextMenu.api.md +52 -0
- package/src/components/ContextMenu/ContextMenu.cy.ts +191 -0
- package/src/components/ContextMenu/ContextMenu.md +25 -0
- package/src/components/ContextMenu/ContextMenu.vue +106 -0
- package/src/components/ContextMenu/index.ts +2 -0
- package/src/components/ContextMenu/stories/FileList.vue +105 -0
- package/src/components/ContextMenu/stories/Groups.vue +95 -0
- package/src/components/ContextMenu/stories/Simple.vue +72 -0
- package/src/components/ContextMenu/types.ts +39 -0
- package/src/components/DatePicker/CalendarPanel.vue +128 -86
- package/src/components/DatePicker/DatePicker.vue +3 -9
- package/src/components/DatePicker/DateRangePicker.vue +4 -8
- package/src/components/DatePicker/DateTimePicker.cy.ts +4 -2
- package/src/components/DatePicker/DateTimePicker.vue +3 -9
- package/src/components/DatePicker/composables.ts +15 -37
- package/src/components/DatePicker/stories/Range.vue +1 -1
- package/src/components/DatePicker/types.ts +1 -1
- package/src/components/DesktopShell/DesktopShell.api.md +40 -0
- package/src/components/DesktopShell/DesktopShell.cy.ts +39 -0
- package/src/components/DesktopShell/DesktopShell.md +31 -0
- package/src/components/DesktopShell/DesktopShell.vue +81 -0
- package/src/components/DesktopShell/index.ts +3 -0
- package/src/components/DesktopShell/stories/Default.vue +97 -0
- package/src/components/DesktopShell/types.ts +2 -0
- package/src/components/Dialog/Dialog.api.md +7 -8
- package/src/components/Dialog/Dialog.md +4 -0
- package/src/components/Dialog/Dialog.vue +8 -7
- package/src/components/Dialog/stories/CommandPalette.vue +1 -1
- package/src/components/Dialog/stories/Wizard.vue +1 -1
- package/src/components/Dialogs.vue +11 -9
- package/src/components/Divider/Divider.api.md +1 -1
- package/src/components/Divider/Divider.md +4 -0
- package/src/components/Dropdown/Dropdown.api.md +10 -35
- package/src/components/Dropdown/Dropdown.md +10 -6
- package/src/components/Dropdown/Dropdown.vue +33 -47
- package/src/components/Dropdown/stories/{05_KebabMenu.vue → KebabMenu.vue} +3 -1
- package/src/components/Dropdown/stories/{06_UserMenu.vue → UserMenu.vue} +1 -1
- package/src/components/Dropdown/types.ts +25 -189
- package/src/components/Duration/Duration.api.md +92 -0
- package/src/components/Duration/Duration.cy.ts +183 -0
- package/src/components/Duration/Duration.md +98 -0
- package/src/components/Duration/Duration.vue +114 -0
- package/src/components/Duration/duration.ts +185 -0
- package/src/components/Duration/index.ts +8 -0
- package/src/components/Duration/stories/Default.vue +10 -0
- package/src/components/Duration/stories/Formats.vue +16 -0
- package/src/components/Duration/stories/RealWorld.vue +50 -0
- package/src/components/Duration/stories/Sizes.vue +15 -0
- package/src/components/Duration/stories/States.vue +21 -0
- package/src/components/Duration/types.ts +52 -0
- package/src/components/ErrorMessage/ErrorMessage.cy.ts +1 -1
- package/src/components/ErrorMessage/ErrorMessage.md +4 -0
- package/src/components/ErrorMessage/ErrorMessage.vue +1 -1
- package/src/components/FileUploader/FileUploader.api.md +36 -11
- package/src/components/FileUploader/FileUploader.cy.ts +66 -0
- package/src/components/FileUploader/FileUploader.md +4 -1
- package/src/components/FileUploader/FileUploader.vue +147 -106
- package/src/components/FileUploader/index.ts +6 -0
- package/src/components/FileUploader/types.ts +43 -0
- package/src/components/FormControl/FormControl.api.md +3 -4
- package/src/components/FormControl/FormControl.md +4 -0
- package/src/components/FormControl/stories/RealForm.vue +3 -3
- package/src/components/FormLabel.vue +5 -8
- package/src/components/HoverCard/HoverCard.api.md +100 -0
- package/src/components/HoverCard/HoverCard.cy.ts +103 -0
- package/src/components/HoverCard/HoverCard.md +52 -0
- package/src/components/HoverCard/HoverCard.vue +91 -0
- package/src/components/HoverCard/index.ts +2 -0
- package/src/components/HoverCard/stories/Arrow.vue +28 -0
- package/src/components/HoverCard/stories/Delays.vue +16 -0
- package/src/components/HoverCard/stories/Example.vue +28 -0
- package/src/components/HoverCard/types.ts +47 -0
- package/src/components/Icon/Icon.cy.ts +78 -0
- package/src/components/Icon/Icon.vue +50 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/InputLabeling/InputDescription.vue +1 -1
- package/src/components/InputLabeling/InputError.vue +1 -1
- package/src/components/InputLabeling/InputLabel.vue +21 -7
- package/src/components/InputLabeling/RequiredIndicator.vue +1 -1
- package/src/components/ItemListRow/ItemListRow.vue +1 -1
- package/src/components/ItemListRow/stories/RowStates.vue +1 -1
- package/src/components/KeyboardShortcut.vue +4 -8
- package/src/components/KeyboardShortcutsModal/KeyboardShortcutsModal.api.md +22 -14
- package/src/components/KeyboardShortcutsModal/KeyboardShortcutsModal.vue +2 -2
- package/src/components/ListFilter/ListFilter.api.md +5 -6
- package/src/components/ListFilter/ListFilter.vue +161 -57
- package/src/components/ListFilter/NestedPopover.vue +17 -10
- package/src/components/ListFilter/SearchComplete.vue +31 -38
- package/src/components/ListItem.vue +1 -1
- package/src/components/ListView/ListEmptyState.vue +1 -1
- package/src/components/ListView/ListGroupHeader.vue +2 -2
- package/src/components/ListView/ListRow.vue +1 -1
- package/src/components/ListView/ListSelectBanner.vue +1 -1
- package/src/components/ListView/ListView.api.md +322 -6
- package/src/components/ListView/index.ts +25 -0
- package/src/components/ListView/stories/CustomList.vue +1 -1
- package/src/components/ListView/stories/GroupedRows.vue +1 -1
- package/src/components/LoadingIndicator.vue +13 -22
- package/src/components/LoadingText.vue +3 -13
- package/src/components/{Dropdown/DropdownMenuList.vue → Menu/Menu.vue} +110 -75
- package/src/components/{Dropdown/DropdownMenuItemContent.vue → Menu/MenuItemContent.vue} +23 -33
- package/src/components/{Dropdown/DropdownRenderContent.vue → Menu/MenuRenderContent.vue} +1 -1
- package/src/components/Menu/types.ts +225 -0
- package/src/components/{Dropdown → Menu}/utils.ts +36 -40
- package/src/components/MobileNav/MobileNav.api.md +70 -0
- package/src/components/MobileNav/MobileNav.cy.ts +89 -0
- package/src/components/MobileNav/MobileNav.md +34 -0
- package/src/components/MobileNav/MobileNav.vue +15 -0
- package/src/components/MobileNav/MobileNavItem.vue +125 -0
- package/src/components/MobileNav/index.ts +4 -0
- package/src/components/MobileNav/stories/Default.vue +40 -0
- package/src/components/MobileNav/types.ts +33 -0
- package/src/components/MobileShell/MobileShell.api.md +23 -0
- package/src/components/MobileShell/MobileShell.cy.ts +25 -0
- package/src/components/MobileShell/MobileShell.md +24 -0
- package/src/components/MobileShell/MobileShell.vue +41 -0
- package/src/components/MobileShell/index.ts +3 -0
- package/src/components/MobileShell/stories/Default.vue +75 -0
- package/src/components/MobileShell/types.ts +7 -0
- package/src/components/MonthPicker/MonthPicker.cy.ts +16 -0
- package/src/components/MonthPicker/MonthPicker.vue +19 -8
- package/src/components/MultiSelect/MultiSelect.api.md +3 -4
- package/src/components/MultiSelect/MultiSelect.md +42 -10
- package/src/components/MultiSelect/MultiSelect.vue +199 -227
- package/src/components/MultiSelect/MultiSelectResults.vue +1 -1
- package/src/components/MultiSelect/stories/Members.vue +1 -1
- package/src/components/MultiSelect/stories/TagsTrigger.vue +3 -3
- package/src/components/MultiSelect/types.ts +3 -3
- package/src/components/PageHeader/PageHeader.api.md +112 -0
- package/src/components/PageHeader/PageHeader.cy.ts +68 -0
- package/src/components/PageHeader/PageHeader.md +25 -0
- package/src/components/PageHeader/PageHeader.vue +13 -0
- package/src/components/PageHeader/PageHeaderBackButton.vue +29 -0
- package/src/components/PageHeader/PageHeaderBase.vue +51 -0
- package/src/components/PageHeader/PageHeaderMobile.vue +68 -0
- package/src/components/PageHeader/PageHeaderMobileTitle.vue +16 -0
- package/src/components/PageHeader/PageHeaderTarget.vue +13 -0
- package/src/components/PageHeader/PageHeaderTitle.vue +12 -0
- package/src/components/PageHeader/index.ts +7 -0
- package/src/components/PageHeader/stories/Default.vue +19 -0
- package/src/components/PageHeader/stories/Mobile.vue +24 -0
- package/src/components/PageHeader/target.ts +19 -0
- package/src/components/PageHeader/types.ts +19 -0
- package/src/components/Password/Password.md +4 -0
- package/src/components/Password/Password.vue +2 -2
- package/src/components/Popover/Popover.api.md +126 -42
- package/src/components/Popover/Popover.cy.ts +425 -41
- package/src/components/Popover/Popover.md +99 -4
- package/src/components/Popover/Popover.vue +288 -215
- package/src/components/Popover/index.ts +8 -1
- package/src/components/Popover/stories/Arrow.vue +16 -0
- package/src/components/Popover/stories/Bare.vue +20 -0
- package/src/components/Popover/stories/Click.vue +7 -4
- package/src/components/Popover/stories/Controlled.vue +22 -0
- package/src/components/Popover/stories/Dismissible.vue +19 -0
- package/src/components/Popover/stories/MatchTriggerWidth.vue +16 -0
- package/src/components/Popover/stories/SideAlign.vue +17 -0
- package/src/components/Popover/types.ts +101 -23
- package/src/components/Progress/Progress.cy.ts +2 -2
- package/src/components/Progress/Progress.md +4 -0
- package/src/components/Progress/Progress.vue +4 -4
- package/src/components/Rail/Rail.api.md +91 -0
- package/src/components/Rail/Rail.cy.ts +84 -0
- package/src/components/Rail/Rail.md +30 -0
- package/src/components/Rail/Rail.vue +16 -0
- package/src/components/Rail/RailItem.vue +134 -0
- package/src/components/Rail/RailItemBadge.vue +64 -0
- package/src/components/Rail/index.ts +2 -0
- package/src/components/Rail/stories/Default.vue +44 -0
- package/src/components/Rail/types.ts +37 -0
- package/src/components/Rating/Rating.md +4 -0
- package/src/components/Rating/Rating.vue +5 -8
- package/src/components/Rating/stories/CustomSlot.vue +2 -2
- package/src/components/ScrollArea/ScrollArea.api.md +59 -0
- package/src/components/ScrollArea/ScrollArea.vue +46 -0
- package/src/components/ScrollArea/ScrollBar.vue +101 -0
- package/src/components/ScrollArea/index.ts +2 -0
- package/src/components/Select/Select.cy.ts +16 -15
- package/src/components/Select/Select.md +4 -0
- package/src/components/Select/Select.vue +217 -203
- package/src/components/Select/stories/Example.vue +4 -3
- package/src/components/Select/stories/States.vue +1 -1
- package/src/components/Select/stories/TriggerSlots.vue +2 -2
- package/src/components/Select/utils.ts +4 -3
- package/src/components/SettingsDialog/SettingsBody.vue +23 -0
- package/src/components/SettingsDialog/SettingsContent.vue +7 -0
- package/src/components/SettingsDialog/SettingsDialog.api.md +273 -0
- package/src/components/SettingsDialog/SettingsDialog.cy.ts +126 -0
- package/src/components/SettingsDialog/SettingsDialog.md +43 -0
- package/src/components/SettingsDialog/SettingsDialog.vue +76 -0
- package/src/components/SettingsDialog/SettingsHeader.vue +36 -0
- package/src/components/SettingsDialog/SettingsNavGroup.vue +20 -0
- package/src/components/SettingsDialog/SettingsNavItem.vue +33 -0
- package/src/components/SettingsDialog/SettingsPanel.cy.ts +77 -0
- package/src/components/SettingsDialog/SettingsPanel.vue +26 -0
- package/src/components/SettingsDialog/SettingsRow.vue +52 -0
- package/src/components/SettingsDialog/SettingsSidebar.vue +16 -0
- package/src/components/SettingsDialog/index.ts +10 -0
- package/src/components/SettingsDialog/stories/Default.vue +99 -0
- package/src/components/SettingsDialog/stories/PanelBasic.vue +52 -0
- package/src/components/SettingsDialog/stories/panels/NotificationsPanel.vue +57 -0
- package/src/components/SettingsDialog/stories/panels/PreferencesPanel.vue +57 -0
- package/src/components/SettingsDialog/stories/panels/ProfilePanel.vue +38 -0
- package/src/components/SettingsDialog/stories/panels/UsersPanel.vue +83 -0
- package/src/components/SettingsDialog/types.ts +21 -0
- package/src/components/Sidebar/Sidebar.api.md +124 -65
- package/src/components/Sidebar/Sidebar.cy.ts +127 -76
- package/src/components/Sidebar/Sidebar.md +47 -3
- package/src/components/Sidebar/Sidebar.vue +64 -56
- package/src/components/Sidebar/SidebarCollapseToggle.vue +23 -0
- package/src/components/Sidebar/SidebarHeader.vue +76 -52
- package/src/components/Sidebar/SidebarItem.vue +159 -95
- package/src/components/Sidebar/SidebarItemIcon.vue +25 -0
- package/src/components/Sidebar/SidebarLabel.vue +34 -0
- package/src/components/Sidebar/SidebarSection.vue +29 -14
- package/src/components/Sidebar/index.ts +13 -2
- package/src/components/Sidebar/stories/Collapsed.vue +40 -0
- package/src/components/Sidebar/stories/Default.vue +153 -0
- package/src/components/Sidebar/stories/Legacy.vue +36 -0
- package/src/components/Sidebar/types.ts +105 -20
- package/src/components/Skeleton/Skeleton.cy.ts +21 -0
- package/src/components/Skeleton/Skeleton.md +21 -0
- package/src/components/Skeleton/Skeleton.vue +6 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Skeleton/stories/Card.vue +12 -0
- package/src/components/Skeleton/stories/List.vue +15 -0
- package/src/components/Skeleton/stories/Text.vue +11 -0
- package/src/components/Slider/Slider.api.md +1 -1
- package/src/components/Slider/Slider.cy.ts +29 -0
- package/src/components/Slider/Slider.md +10 -0
- package/src/components/Slider/Slider.vue +37 -9
- package/src/components/Slider/stories/NegativeValues.vue +12 -0
- package/src/components/Slider/types.ts +1 -1
- package/src/components/Spinner/Spinner.api.md +32 -0
- package/src/components/Spinner/Spinner.cy.ts +87 -0
- package/src/components/Spinner/Spinner.md +21 -0
- package/src/components/Spinner/Spinner.vue +168 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Spinner/stories/InContext.vue +49 -0
- package/src/components/Spinner/stories/Sizes.vue +12 -0
- package/src/components/Spinner/stories/Themes.vue +10 -0
- package/src/components/Spinner/stories/Track.vue +12 -0
- package/src/components/Spinner/types.ts +14 -0
- package/src/components/Switch/Switch.md +4 -0
- package/src/components/Switch/Switch.vue +6 -23
- package/src/components/TabButtons/Pill.vue +161 -0
- package/src/components/TabButtons/TabButtons.api.md +52 -2
- package/src/components/TabButtons/TabButtons.cy.ts +18 -5
- package/src/components/TabButtons/TabButtons.md +49 -0
- package/src/components/TabButtons/TabButtons.vue +207 -109
- package/src/components/TabButtons/index.ts +11 -1
- package/src/components/TabButtons/pillTypes.ts +43 -0
- package/src/components/TabButtons/stories/PrefixSuffix.vue +65 -0
- package/src/components/TabButtons/stories/Sizes.vue +26 -0
- package/src/components/TabButtons/stories/Variants.vue +40 -0
- package/src/components/TabButtons/stories/Vertical.vue +64 -0
- package/src/components/TabButtons/types.ts +49 -0
- package/src/components/Tabs/Tabs.md +4 -0
- package/src/components/Tabs/Tabs.vue +1 -1
- package/src/components/TextEditor/TextEditor.cy.ts +1 -1
- package/src/components/TextEditor/TextEditor.md +3 -0
- package/src/components/TextEditor/TextEditor.vue +7 -4
- package/src/components/TextEditor/components/CodeBlockComponent.vue +4 -194
- package/src/components/TextEditor/components/FontColor.vue +1 -1
- package/src/components/TextEditor/components/LinkPopup.vue +1 -1
- package/src/components/TextEditor/components/MediaNodeView.vue +17 -17
- package/src/components/TextEditor/components/MentionList.vue +1 -1
- package/src/components/TextEditor/components/TextEditorBubbleMenu.vue +14 -5
- package/src/components/TextEditor/components/TextEditorFixedMenu.vue +3 -3
- package/src/components/TextEditor/components/{Menu.vue → TextEditorMenu.vue} +3 -3
- package/src/components/TextEditor/extensions/iframe/InsertIframe.vue +2 -2
- package/src/components/TextEditor/extensions/iframe/iframe-extension.ts +62 -19
- package/src/components/TextEditor/extensions/image-group/ImageGroupNodeView.vue +1 -1
- package/src/components/TextEditor/extensions/image-group/ImageGroupUploadDialog.vue +4 -4
- package/src/components/TextEditor/extensions/suggestion/SuggestionList.vue +1 -1
- package/src/components/TextEditor/extensions/toc-node/TocNodeView.vue +1 -1
- package/src/components/TextEditor/hljs-github.css +197 -0
- package/src/components/TextEditor/index.ts +13 -0
- package/src/components/TextInput/TextInput.cy.ts +8 -3
- package/src/components/TextInput/TextInput.md +4 -0
- package/src/components/TextInput/TextInput.vue +11 -15
- package/src/components/TextInput/stories/Slots.vue +1 -1
- package/src/components/Textarea/Textarea.cy.ts +1 -1
- package/src/components/Textarea/Textarea.md +4 -0
- package/src/components/Textarea/Textarea.vue +11 -15
- package/src/components/ThemeSwitcher/ThemePreview.vue +74 -0
- package/src/components/ThemeSwitcher/ThemeSwitcher.api.md +82 -0
- package/src/components/ThemeSwitcher/ThemeSwitcher.cy.ts +101 -0
- package/src/components/ThemeSwitcher/ThemeSwitcher.md +70 -0
- package/src/components/ThemeSwitcher/ThemeSwitcher.vue +145 -0
- package/src/components/ThemeSwitcher/index.ts +2 -0
- package/src/components/ThemeSwitcher/previews/PreviewWindow.vue +74 -0
- package/src/components/ThemeSwitcher/stories/Branded.vue +12 -0
- package/src/components/ThemeSwitcher/stories/Default.vue +7 -0
- package/src/components/ThemeSwitcher/stories/Menu.vue +53 -0
- package/src/components/ThemeSwitcher/stories/Toggle.vue +25 -0
- package/src/components/ThemeSwitcher/types.ts +35 -0
- package/src/components/TimePicker/TimePicker.api.md +67 -15
- package/src/components/TimePicker/TimePicker.cy.ts +130 -14
- package/src/components/TimePicker/TimePicker.md +6 -0
- package/src/components/TimePicker/TimePicker.vue +74 -19
- package/src/components/TimePicker/stories/Labeling.vue +21 -0
- package/src/components/TimePicker/stories/Range.vue +1 -1
- package/src/components/TimePicker/stories/SizesAndVariants.vue +23 -0
- package/src/components/TimePicker/stories/TwentyFour.vue +1 -1
- package/src/components/TimePicker/types.ts +15 -3
- package/src/components/TimePicker/utils.ts +82 -21
- package/src/components/Toast/Toast.md +1 -1
- package/src/components/Toast/Toast.sanitize.test.ts +50 -0
- package/src/components/Toast/Toast.test.ts +5 -0
- package/src/components/Toast/Toast.vue +7 -7
- package/src/components/Toast/ToastProvider.vue +18 -9
- package/src/components/Toast/stories/CustomIcon.vue +1 -1
- package/src/components/Toast/toast.ts +32 -8
- package/src/components/Tooltip/Tooltip.api.md +43 -5
- package/src/components/Tooltip/Tooltip.cy.ts +48 -0
- package/src/components/Tooltip/Tooltip.md +10 -0
- package/src/components/Tooltip/Tooltip.vue +20 -5
- package/src/components/Tooltip/TooltipBubble.vue +2 -2
- package/src/components/Tooltip/TooltipProvider.vue +53 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Tooltip/stories/Group.vue +22 -0
- package/src/components/Tooltip/stories/Slots.vue +2 -2
- package/src/components/Tooltip/types.ts +1 -1
- package/src/components/Tree/Tree.api.md +76 -18
- package/src/components/Tree/Tree.md +144 -2
- package/src/components/Tree/Tree.vue +276 -97
- package/src/components/Tree/TreeItem.vue +263 -0
- package/src/components/Tree/index.ts +9 -1
- package/src/components/Tree/stories/DragDrop.vue +94 -0
- package/src/components/Tree/stories/Example.vue +11 -34
- package/src/components/Tree/stories/ExpandAll.vue +48 -0
- package/src/components/Tree/stories/Guides.vue +49 -0
- package/src/components/Tree/stories/ListView.vue +74 -0
- package/src/components/Tree/tree.cy.ts +218 -90
- package/src/components/Tree/types.ts +114 -24
- package/src/components/Tree/useTreeDragDrop.ts +203 -0
- package/src/components/Tree/useTreeKeyboard.ts +109 -0
- package/src/components/VueGridLayout/Layout.vue +1 -1
- package/src/components/shared/picker/PickerShell.vue +20 -15
- package/src/components/shared/popover/PopoverPanel.vue +67 -0
- package/src/components/shared/popover/popoverPanel.css +102 -0
- package/src/components/shared/selection/utils.ts +6 -6
- package/src/composables/useAutofocusOnOpen.ts +2 -0
- package/src/composables/useScreenSize.ts +46 -0
- package/src/composables/useScrollContainer.ts +108 -0
- package/src/composables/useShortcut.ts +3 -0
- package/src/data-fetching/docStore.test.ts +74 -0
- package/src/data-fetching/docStore.ts +18 -7
- package/src/data-fetching/useCall/types.ts +1 -0
- package/src/data-fetching/useCall/useCall.test.ts +43 -0
- package/src/data-fetching/useCall/useCall.ts +17 -4
- package/src/data-fetching/useDoc/useDoc.test.ts +61 -2
- package/src/data-fetching/useDoc/useDoc.ts +35 -15
- package/src/data-fetching/useDoctype/useDoctype.ts +6 -5
- package/src/data-fetching/useFrappeFetch.ts +17 -4
- package/src/data-fetching/useList/types.ts +1 -0
- package/src/data-fetching/useList/useList.test.ts +40 -0
- package/src/data-fetching/useList/useList.ts +20 -13
- package/src/data-fetching/useNewDoc/useNewDoc.ts +9 -5
- package/src/directives/focus.ts +3 -3
- package/src/index.ts +105 -74
- package/src/mocks/handlers.ts +8 -0
- package/src/molecules/editor/Editor.cy.ts +6 -1
- package/src/molecules/editor/EditorBubbleMenu.vue +1 -1
- package/src/molecules/editor/EditorContent.vue +50 -9
- package/src/molecules/editor/EditorFixedMenu.vue +2 -1
- package/src/molecules/editor/EditorFloatingMenu.vue +1 -1
- package/src/molecules/editor/EditorTableMenu.vue +303 -0
- package/src/molecules/editor/MenuItems.vue +81 -69
- package/src/molecules/editor/commands.ts +10 -2
- package/src/molecules/editor/components/AttachmentNodeView.vue +115 -0
- package/src/molecules/editor/components/EditorDropZone.vue +105 -0
- package/src/molecules/editor/components/EditorPopover.vue +89 -0
- package/src/molecules/editor/components/MediaNodeView.vue +156 -49
- package/src/molecules/editor/components/MediaResizeHandles.vue +38 -0
- package/src/molecules/editor/components/MediaToolbar.vue +108 -54
- package/src/molecules/editor/components/TableContextMenu.vue +144 -0
- package/src/molecules/editor/components/UploadProgressIndicator.vue +33 -0
- package/src/molecules/editor/components/VideoControls.vue +208 -0
- package/src/molecules/editor/components/font-color/ColorSwatchGrid.vue +3 -5
- package/src/molecules/editor/components/font-color/fontColorController.ts +28 -23
- package/src/molecules/editor/components/font-color/swatches.ts +1 -1
- package/src/molecules/editor/components/media-node-view-controller.ts +4 -4
- package/src/molecules/editor/components/media-node-view-utils.test.ts +0 -13
- package/src/molecules/editor/components/media-node-view-utils.ts +0 -10
- package/src/molecules/editor/components/table-color/tableCellColorController.ts +80 -0
- package/src/molecules/editor/components/table-size-picker/TableSizePicker.vue +92 -0
- package/src/molecules/editor/components/table-size-picker/tableSizePickerController.ts +40 -0
- package/src/molecules/editor/composables/useEditorFileDrop.ts +117 -0
- package/src/molecules/editor/composables/useFloatingPopup.ts +46 -2
- package/src/molecules/editor/composables/useNodeViewResize.test.ts +60 -11
- package/src/molecules/editor/composables/useNodeViewResize.ts +80 -21
- package/src/molecules/editor/composables/useTableCellColorState.ts +78 -0
- package/src/molecules/editor/composables/useWindowFileDragging.ts +68 -0
- package/src/molecules/editor/extensions/attachment/attachment-engine.ts +250 -0
- package/src/molecules/editor/extensions/attachment/attachment-extension.ts +248 -0
- package/src/molecules/editor/extensions/attachment/attachment.flow.test.ts +80 -0
- package/src/molecules/editor/extensions/attachment/attachment.roundtrip.test.ts +50 -0
- package/src/molecules/editor/extensions/attachment/index.ts +5 -0
- package/src/molecules/editor/extensions/code-block/CodeBlockComponent.css +16 -26
- package/src/molecules/editor/extensions/code-block/CodeBlockComponent.vue +107 -22
- package/src/molecules/editor/extensions/content-paste/content-paste-extension.ts +5 -3
- package/src/molecules/editor/extensions/iframe/IframeInsertDialog.vue +34 -7
- package/src/molecules/editor/extensions/iframe/IframeNodeView.vue +54 -48
- package/src/molecules/editor/extensions/iframe/iframe-allowlist.ts +33 -4
- package/src/molecules/editor/extensions/iframe/iframe-commands.ts +49 -5
- package/src/molecules/editor/extensions/iframe/iframe-embed-utils.ts +30 -0
- package/src/molecules/editor/extensions/iframe/iframe-extension.ts +4 -4
- package/src/molecules/editor/extensions/iframe/iframeInsertDialogController.ts +12 -1
- package/src/molecules/editor/extensions/iframe/index.ts +4 -4
- package/src/molecules/editor/extensions/iframe/useIframeDialog.ts +25 -13
- package/src/molecules/editor/extensions/image/image-extension.ts +29 -11
- package/src/molecules/editor/extensions/image-group/ImageGroupGrid.vue +27 -11
- package/src/molecules/editor/extensions/image-group/ImageGroupGridCell.vue +55 -11
- package/src/molecules/editor/extensions/image-group/ImageGroupNodeView.vue +64 -31
- package/src/molecules/editor/extensions/image-group/ImageGroupUploadDialog.vue +84 -40
- package/src/molecules/editor/extensions/image-group/image-group-extension.ts +4 -3
- package/src/molecules/editor/extensions/image-group/useImageGroupDialog.ts +116 -17
- package/src/molecules/editor/extensions/link/LinkEditorPopup.vue +214 -71
- package/src/molecules/editor/extensions/link/link-click-plugin.ts +10 -15
- package/src/molecules/editor/extensions/link/link-commands.ts +24 -3
- package/src/molecules/editor/extensions/link/link-extension.ts +11 -2
- package/src/molecules/editor/extensions/link/link-popup-controller.test.ts +49 -0
- package/src/molecules/editor/extensions/link/link-popup-controller.ts +67 -2
- package/src/molecules/editor/extensions/link/link-shortcut-plugin.ts +7 -2
- package/src/molecules/editor/extensions/media-drop/media-drop-extension.ts +177 -0
- package/src/molecules/editor/extensions/shared/media-dimensions.ts +36 -3
- package/src/molecules/editor/extensions/shared/media-node-ops.ts +17 -0
- package/src/molecules/editor/extensions/shared/media-plugin.test.ts +60 -0
- package/src/molecules/editor/extensions/shared/media-plugin.ts +7 -37
- package/src/molecules/editor/extensions/shared/media-upload-engine.test.ts +39 -2
- package/src/molecules/editor/extensions/shared/media-upload-engine.ts +104 -10
- package/src/molecules/editor/extensions/shared/media-upload-state.ts +55 -0
- package/src/molecules/editor/extensions/shared/media-upload-types.ts +52 -1
- package/src/molecules/editor/extensions/shared/suggestion-helpers.ts +20 -0
- package/src/molecules/editor/extensions/shared/suggestion-types.ts +7 -0
- package/src/molecules/editor/extensions/shared/upload-types.ts +1 -0
- package/src/molecules/editor/extensions/slash-commands/slash-commands-extension.test.ts +38 -0
- package/src/molecules/editor/extensions/slash-commands/slash-commands-extension.ts +119 -55
- package/src/molecules/editor/extensions/suggestion/SuggestionList.vue +62 -22
- package/src/molecules/editor/extensions/suggestion/SuggestionListItem.vue +1 -1
- package/src/molecules/editor/extensions/suggestion/createSuggestionExtension.ts +4 -0
- package/src/molecules/editor/extensions/table/drag-scroll.ts +154 -0
- package/src/molecules/editor/extensions/table/table-cell-color.ts +188 -0
- package/src/molecules/editor/extensions/table/table-navigation.ts +560 -0
- package/src/molecules/editor/extensions/table/table-selection-overlay.ts +137 -0
- package/src/molecules/editor/extensions/toc-node/TocNodeView.vue +1 -1
- package/src/molecules/editor/extensions/toc-node/toc-render.ts +7 -3
- package/src/molecules/editor/extensions/video/video-extension.ts +72 -5
- package/src/molecules/editor/extensions.ts +176 -8
- package/src/molecules/editor/index.ts +9 -4
- package/src/molecules/editor/kits.test.ts +21 -1
- package/src/molecules/editor/kits.ts +56 -33
- package/src/molecules/editor/menu.test.ts +3 -1
- package/src/molecules/editor/menu.ts +180 -18
- package/src/molecules/editor/stories/Comment.vue +4 -4
- package/src/molecules/editor/stories/Inline.vue +1 -1
- package/src/molecules/editor/stories/Primitives.vue +1 -1
- package/src/molecules/editor/stories/RichText.vue +1 -1
- package/src/molecules/editor/style.css +80 -3
- package/src/molecules/editor/useEditor.test.ts +4 -0
- package/src/molecules/editor/useEditor.ts +7 -3
- package/src/molecules/list/List.cy.ts +626 -0
- package/src/molecules/list/List.vue +93 -0
- package/src/molecules/list/ListCell.vue +15 -0
- package/src/molecules/list/ListGroup.vue +40 -0
- package/src/molecules/list/ListHeader.vue +62 -0
- package/src/molecules/list/ListHeaderCell.vue +26 -0
- package/src/molecules/list/ListHeaderCellSort.vue +106 -0
- package/src/molecules/list/ListRow.vue +55 -0
- package/src/molecules/list/ListRowBase.vue +103 -0
- package/src/molecules/list/ListRows.vue +120 -0
- package/src/molecules/list/index.ts +24 -0
- package/src/molecules/list/list-context.ts +44 -0
- package/src/molecules/list/list.api.md +276 -0
- package/src/molecules/list/list.md +119 -0
- package/src/molecules/list/stories/Columns.vue +103 -0
- package/src/molecules/list/stories/Feed.vue +105 -0
- package/src/molecules/list/stories/Virtual.vue +31 -0
- package/src/molecules/list/style.css +173 -0
- package/src/molecules/list/types.ts +82 -0
- package/src/molecules/list/useVirtualRows.ts +80 -0
- package/src/resources/documentResource.d.ts +28 -0
- package/src/resources/documentResource.js +32 -4
- package/src/resources/documentResource.test.ts +111 -0
- package/src/resources/listResource.d.ts +33 -0
- package/src/resources/plugin.d.ts +7 -0
- package/src/resources/resources.d.ts +35 -0
- package/src/utils/{call.js → call.ts} +50 -9
- package/src/utils/config.ts +16 -1
- package/src/utils/confirmDialog.d.ts +17 -0
- package/src/utils/debounce.ts +6 -7
- package/src/utils/dialog.cy.ts +9 -9
- package/src/utils/fileSize.ts +36 -0
- package/src/utils/fileUploadHandler.ts +46 -6
- package/src/utils/frappeRequest.test.ts +79 -0
- package/src/utils/{frappeRequest.js → frappeRequest.ts} +76 -13
- package/src/utils/pageMeta.ts +1 -1
- package/src/utils/plugin.ts +58 -0
- package/src/utils/{request.js → request.ts} +28 -3
- package/src/utils/{socketio.js → socketio.ts} +11 -1
- package/src/utils/theme.ts +48 -57
- package/src/utils/useFileUpload.ts +80 -23
- package/tailwind/audit-token-drift.cjs +176 -0
- package/tailwind/colorPalette.js +69 -8
- package/tailwind/colors.json +1115 -397
- package/tailwind/figma-tokens-to-theme.js +364 -0
- package/tailwind/generated/colors.json +1217 -0
- package/tailwind/generated/effects.json +41 -0
- package/tailwind/generated/radius.json +20 -0
- package/tailwind/generated/typography.json +479 -0
- package/tailwind/migrate-tokens-v2.js +453 -0
- package/tailwind/migrate-tokens-v2.test.js +55 -0
- package/tailwind/plugin.js +220 -15
- package/tailwind/preset.js +15 -0
- package/tailwind/tokens.js +35 -37
- package/tsconfig.base.json +2 -2
- package/vitepress/components/Docs/CommandPalette.vue +214 -0
- package/vitepress/components/Docs/Demo.vue +60 -0
- package/vitepress/components/Docs/EmitsTable.vue +99 -0
- package/vitepress/components/Docs/MobileNavSheet.vue +148 -0
- package/vitepress/components/Docs/OnThisPage.vue +74 -0
- package/vitepress/components/Docs/PrevNextBtns.vue +58 -0
- package/vitepress/components/Docs/PropsTable.vue +185 -0
- package/vitepress/components/Docs/Search.vue +34 -0
- package/vitepress/components/Docs/Sidebar.vue +91 -0
- package/vitepress/components/Docs/SlotsTable.vue +99 -0
- package/vitepress/components/Docs/index.ts +13 -0
- package/vitepress/components/Docs/sidebarList.ts +33 -0
- package/vitepress/components/Layout.vue +58 -0
- package/vitepress/components/Navbar.vue +126 -0
- package/vitepress/components/index.ts +3 -0
- package/vitepress/composables/index.ts +3 -0
- package/vitepress/composables/useTheme.ts +39 -0
- package/vitepress/css/fonts/Inter-Italic.var.woff2 +0 -0
- package/vitepress/css/fonts/Inter.var.woff2 +0 -0
- package/vitepress/css/style.css +198 -0
- package/vitepress/index.d.ts +23 -0
- package/vitepress/index.node.ts +175 -0
- package/vitepress/index.ts +17 -0
- package/vitepress/plugins/colocatedComponentDocs.ts +164 -0
- package/vitepress/plugins/componentTransformer.ts +286 -0
- package/vitepress/plugins/index.ts +12 -0
- package/vitepress/state.ts +10 -0
- package/vitepress/theme/index.ts +21 -0
- package/frappe/telemetry/utils.ts +0 -15
- package/src/components/Badge/stories/Themes.vue +0 -10
- package/src/components/Badge/stories/Variants.vue +0 -10
- package/src/components/Button/stories/Icons.vue +0 -27
- package/src/components/Button/stories/Sizes.vue +0 -11
- package/src/components/Button/stories/Themes.vue +0 -10
- package/src/components/Button/stories/Variants.vue +0 -10
- package/src/components/Popover/stories/Hover.vue +0 -14
- package/src/components/Resource.vue +0 -21
- package/src/components/Sidebar/stories/Example.vue +0 -76
- package/src/components/Spinner.vue +0 -3
- package/src/components/TabButtons/TabButtons.story.vue +0 -22
- package/src/utils/plugin.js +0 -24
- /package/src/components/Dropdown/stories/{02_Shortcuts.vue → Shortcuts.vue} +0 -0
- /package/src/components/Dropdown/stories/{01_Simple.vue → Simple.vue} +0 -0
- /package/src/components/Dropdown/stories/{03_Submenus.vue → Submenus.vue} +0 -0
- /package/src/components/Dropdown/stories/{04_Switches.vue → Switches.vue} +0 -0
- /package/src/components/{Dropdown/DropdownRenderContentAsChild.vue → Menu/MenuRenderContentAsChild.vue} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { ContextMenu, type ContextMenuOptions } from 'frappe-ui'
|
|
4
|
+
|
|
5
|
+
const text = 'Ship it tomorrow?'
|
|
6
|
+
const deleted = ref(false)
|
|
7
|
+
const lastAction = ref('')
|
|
8
|
+
|
|
9
|
+
const messageActions: ContextMenuOptions = [
|
|
10
|
+
{
|
|
11
|
+
label: 'Reply',
|
|
12
|
+
icon: 'lucide-reply',
|
|
13
|
+
onClick: () => (lastAction.value = 'Replying to Alex'),
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: 'Copy text',
|
|
17
|
+
icon: 'lucide-copy',
|
|
18
|
+
onClick: () => (lastAction.value = `Copied “${text}”`),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: 'Edit',
|
|
22
|
+
icon: 'lucide-pen',
|
|
23
|
+
onClick: () => (lastAction.value = 'Editing message'),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Delete',
|
|
27
|
+
icon: 'lucide-trash-2',
|
|
28
|
+
theme: 'red',
|
|
29
|
+
onClick: () => {
|
|
30
|
+
deleted.value = true
|
|
31
|
+
lastAction.value = 'Message deleted'
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
function restore() {
|
|
37
|
+
deleted.value = false
|
|
38
|
+
lastAction.value = ''
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div class="grid gap-3 justify-items-center">
|
|
44
|
+
<ContextMenu :options="messageActions">
|
|
45
|
+
<div class="flex flex-col gap-1.5">
|
|
46
|
+
<div class="flex items-baseline gap-2">
|
|
47
|
+
<span class="text-sm-medium text-ink-gray-8">Alex</span>
|
|
48
|
+
<span class="text-xs text-ink-gray-4">9:41 AM</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div
|
|
51
|
+
v-if="!deleted"
|
|
52
|
+
class="w-fit cursor-default select-none rounded-2xl rounded-tl-sm bg-surface-gray-3 px-3.5 py-2 text-sm text-ink-gray-8"
|
|
53
|
+
>
|
|
54
|
+
{{ text }}
|
|
55
|
+
</div>
|
|
56
|
+
<div v-else class="flex items-center gap-2 text-sm text-ink-gray-4">
|
|
57
|
+
<span class="italic">Message deleted</span>
|
|
58
|
+
<button
|
|
59
|
+
class="font-medium text-ink-gray-6 underline underline-offset-2"
|
|
60
|
+
@click="restore"
|
|
61
|
+
>
|
|
62
|
+
Undo
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</ContextMenu>
|
|
67
|
+
|
|
68
|
+
<div class="text-sm text-ink-gray-5">
|
|
69
|
+
{{ lastAction || 'Right-click the message' }}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MenuOptions, MenuSlots } from '../Menu/types'
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
MenuTheme as ContextMenuTheme,
|
|
5
|
+
MenuSlotFn as ContextMenuSlotFn,
|
|
6
|
+
MenuItemSlots as ContextMenuItemSlots,
|
|
7
|
+
MenuBaseOption as ContextMenuBaseOption,
|
|
8
|
+
MenuActionOption as ContextMenuActionOption,
|
|
9
|
+
MenuSwitchOption as ContextMenuSwitchOption,
|
|
10
|
+
MenuSubmenuOption as ContextMenuSubmenuOption,
|
|
11
|
+
MenuComponentOption as ContextMenuComponentOption,
|
|
12
|
+
MenuGroupOption as ContextMenuGroupOption,
|
|
13
|
+
MenuOption as ContextMenuOption,
|
|
14
|
+
MenuItem as ContextMenuItem,
|
|
15
|
+
MenuOptions as ContextMenuOptions,
|
|
16
|
+
MenuSlotProps as ContextMenuSlotProps,
|
|
17
|
+
MenuItemSlotProps as ContextMenuItemSlotProps,
|
|
18
|
+
MenuGroupSlotProps as ContextMenuGroupSlotProps,
|
|
19
|
+
} from '../Menu/types'
|
|
20
|
+
|
|
21
|
+
export interface ContextMenuTriggerSlotProps {
|
|
22
|
+
/** Whether the context menu is currently open. */
|
|
23
|
+
open: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ContextMenuProps {
|
|
27
|
+
/** Array of context menu options or grouped options. */
|
|
28
|
+
options?: MenuOptions
|
|
29
|
+
|
|
30
|
+
/** Controls the visibility of the context menu. */
|
|
31
|
+
open?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ContextMenuSlots = Omit<MenuSlots, 'default' | 'trigger'> & {
|
|
35
|
+
/** The right-clickable region that opens the menu. */
|
|
36
|
+
default?: (props: ContextMenuTriggerSlotProps) => any
|
|
37
|
+
/** Explicit trigger slot; same as default. */
|
|
38
|
+
trigger?: (props: ContextMenuTriggerSlotProps) => any
|
|
39
|
+
}
|
|
@@ -11,12 +11,8 @@
|
|
|
11
11
|
icon="lucide-chevron-left"
|
|
12
12
|
@click="emit('prev')"
|
|
13
13
|
/>
|
|
14
|
-
<span class="text-sm
|
|
15
|
-
|
|
16
|
-
{{ months[currentMonth] }} {{ currentYear }}
|
|
17
|
-
</span>
|
|
18
|
-
<span v-else-if="view === 'month'">{{ currentYear }}</span>
|
|
19
|
-
<span v-else>{{ yearRangeStart }} - {{ yearRangeStart + 11 }}</span>
|
|
14
|
+
<span class="text-sm-medium text-ink-gray-7">
|
|
15
|
+
{{ months[currentMonth] }} {{ currentYear }}
|
|
20
16
|
</span>
|
|
21
17
|
<Button
|
|
22
18
|
:class="{ invisible: hideNext }"
|
|
@@ -30,17 +26,13 @@
|
|
|
30
26
|
<Button
|
|
31
27
|
variant="ghost"
|
|
32
28
|
size="sm"
|
|
33
|
-
class="text-sm
|
|
29
|
+
class="text-sm-medium text-ink-gray-7"
|
|
34
30
|
label="cycle-calendar-view"
|
|
35
31
|
@click="emit('cycleView')"
|
|
36
32
|
>
|
|
37
|
-
|
|
38
|
-
{{ months[currentMonth] }} {{ currentYear }}
|
|
39
|
-
</span>
|
|
40
|
-
<span v-else-if="view === 'month'">{{ currentYear }}</span>
|
|
41
|
-
<span v-else>{{ yearRangeStart }} - {{ yearRangeStart + 11 }}</span>
|
|
33
|
+
{{ months[currentMonth] }} {{ currentYear }}
|
|
42
34
|
</Button>
|
|
43
|
-
<div class="flex items-center">
|
|
35
|
+
<div v-if="view === 'date'" class="flex items-center">
|
|
44
36
|
<Button
|
|
45
37
|
v-if="!hidePrev"
|
|
46
38
|
label="previous"
|
|
@@ -73,7 +65,7 @@
|
|
|
73
65
|
@mouseleave="emit('hoverCell', null)"
|
|
74
66
|
>
|
|
75
67
|
<div
|
|
76
|
-
class="flex items-center text-xs
|
|
68
|
+
class="flex items-center text-xs-medium uppercase text-ink-gray-4 mb-1 gap-0.5"
|
|
77
69
|
>
|
|
78
70
|
<div
|
|
79
71
|
v-for="(d, di) in WEEKDAYS"
|
|
@@ -99,7 +91,7 @@
|
|
|
99
91
|
<button
|
|
100
92
|
v-else
|
|
101
93
|
type="button"
|
|
102
|
-
class="flex size-7 items-center justify-center text-sm transition-colors duration-100
|
|
94
|
+
class="flex size-7 items-center justify-center text-sm transition-colors duration-100"
|
|
103
95
|
:class="cellClass(cell)"
|
|
104
96
|
role="gridcell"
|
|
105
97
|
:aria-selected="ariaSelected(cell)"
|
|
@@ -112,9 +104,13 @@
|
|
|
112
104
|
:tabindex="isFocusedCell(cell) ? 0 : -1"
|
|
113
105
|
@mouseenter="emit('hoverCell', cell.date)"
|
|
114
106
|
@click="!cell.isUnavailable && emit('selectDate', cell.date)"
|
|
115
|
-
@keydown.left.prevent="
|
|
107
|
+
@keydown.left.prevent="
|
|
108
|
+
shiftFocus(cell.date.subtract(1, 'day'), -1)
|
|
109
|
+
"
|
|
116
110
|
@keydown.right.prevent="shiftFocus(cell.date.add(1, 'day'), 1)"
|
|
117
|
-
@keydown.up.prevent="
|
|
111
|
+
@keydown.up.prevent="
|
|
112
|
+
shiftFocus(cell.date.subtract(7, 'day'), -1)
|
|
113
|
+
"
|
|
118
114
|
@keydown.down.prevent="shiftFocus(cell.date.add(7, 'day'), 1)"
|
|
119
115
|
@keydown.home.prevent="
|
|
120
116
|
shiftFocus(cell.date.subtract(cell.date.day(), 'day'), -1)
|
|
@@ -151,54 +147,60 @@
|
|
|
151
147
|
</div>
|
|
152
148
|
</div>
|
|
153
149
|
</div>
|
|
154
|
-
<div
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<button
|
|
161
|
-
v-for="(m, i) in months"
|
|
162
|
-
type="button"
|
|
163
|
-
:key="m"
|
|
164
|
-
class="py-2 text-sm rounded cursor-pointer text-center hover:bg-surface-gray-2 focus:outline-none focus:ring-2 focus:ring-brand-6"
|
|
165
|
-
:class="{
|
|
166
|
-
'bg-surface-gray-6 text-ink-white hover:bg-surface-gray-6':
|
|
167
|
-
i === currentMonth,
|
|
168
|
-
}"
|
|
169
|
-
:aria-selected="i === currentMonth ? 'true' : 'false'"
|
|
170
|
-
@click="emit('selectMonth', i)"
|
|
150
|
+
<div v-else class="flex h-52 w-52" aria-label="Select month and year">
|
|
151
|
+
<div
|
|
152
|
+
ref="yearListRef"
|
|
153
|
+
class="relative flex w-1/2 flex-col gap-0.5 overflow-y-auto"
|
|
154
|
+
role="listbox"
|
|
155
|
+
aria-label="Select year"
|
|
171
156
|
>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
157
|
+
<button
|
|
158
|
+
v-for="y in years"
|
|
159
|
+
type="button"
|
|
160
|
+
:key="y"
|
|
161
|
+
class="w-full text-ink-gray-8 h-7 shrink-0 rounded py-1 text-sm text-center cursor-pointer transition-colors duration-100"
|
|
162
|
+
:class="
|
|
163
|
+
y === currentYear
|
|
164
|
+
? 'bg-surface-gray-2 hover:bg-surface-gray-3'
|
|
165
|
+
: ' hover:bg-surface-gray-1'
|
|
166
|
+
"
|
|
167
|
+
:data-selected="y === currentYear ? '' : undefined"
|
|
168
|
+
:aria-selected="y === currentYear ? 'true' : 'false'"
|
|
169
|
+
@click="emit('selectYear', y)"
|
|
170
|
+
>
|
|
171
|
+
{{ y }}
|
|
172
|
+
</button>
|
|
173
|
+
</div>
|
|
174
|
+
<div
|
|
175
|
+
ref="monthListRef"
|
|
176
|
+
class="relative flex w-1/2 flex-col gap-0.5 overflow-y-auto pl-1.5"
|
|
177
|
+
role="listbox"
|
|
178
|
+
aria-label="Select month"
|
|
192
179
|
>
|
|
193
|
-
|
|
194
|
-
|
|
180
|
+
<button
|
|
181
|
+
v-for="(m, i) in months"
|
|
182
|
+
type="button"
|
|
183
|
+
:key="m"
|
|
184
|
+
class="w-full text-ink-gray-8 shrink-0 h-7 rounded py-1 text-sm text-center cursor-pointer transition-colors duration-100"
|
|
185
|
+
:class="
|
|
186
|
+
i === currentMonth
|
|
187
|
+
? 'bg-surface-gray-2 hover:bg-surface-gray-3'
|
|
188
|
+
: ' hover:bg-surface-gray-1'
|
|
189
|
+
"
|
|
190
|
+
:data-selected="i === currentMonth ? '' : undefined"
|
|
191
|
+
:aria-selected="i === currentMonth ? 'true' : 'false'"
|
|
192
|
+
@click="emit('selectMonth', i)"
|
|
193
|
+
>
|
|
194
|
+
{{ m }}
|
|
195
|
+
</button>
|
|
196
|
+
</div>
|
|
195
197
|
</div>
|
|
196
198
|
</div>
|
|
197
199
|
</div>
|
|
198
200
|
</template>
|
|
199
201
|
|
|
200
202
|
<script setup lang="ts">
|
|
201
|
-
import { nextTick, ref, watch } from 'vue'
|
|
203
|
+
import { computed, nextTick, ref, watch } from 'vue'
|
|
202
204
|
import type { Dayjs } from 'dayjs/esm'
|
|
203
205
|
import { Button } from '../Button'
|
|
204
206
|
import { months } from './utils'
|
|
@@ -220,8 +222,6 @@ interface Props {
|
|
|
220
222
|
view: ViewMode
|
|
221
223
|
currentYear: number
|
|
222
224
|
currentMonth: number
|
|
223
|
-
yearRangeStart: number
|
|
224
|
-
yearRange: number[]
|
|
225
225
|
weeks: CalendarPanelCell[][]
|
|
226
226
|
/** Label for the optional Today/Now action button between prev/next. Empty/undefined hides it. */
|
|
227
227
|
todayLabel?: string
|
|
@@ -281,6 +281,44 @@ const emit = defineEmits<{
|
|
|
281
281
|
(e: 'update:focusedDate', d: Dayjs): void
|
|
282
282
|
}>()
|
|
283
283
|
|
|
284
|
+
// ── Month-year split view ────────────────────────────────────────────────────
|
|
285
|
+
// The year column is a scrollable list. We bound it to [min, max] when provided
|
|
286
|
+
// (so unreachable years aren't offered) and otherwise fall back to a wide window
|
|
287
|
+
// around the current year. The current year is always included.
|
|
288
|
+
const years = computed<number[]>(() => {
|
|
289
|
+
const current = props.currentYear
|
|
290
|
+
const minY = props.min ? Number(props.min.slice(0, 4)) : current - 100
|
|
291
|
+
const maxY = props.max ? Number(props.max.slice(0, 4)) : current + 10
|
|
292
|
+
const start = Math.min(minY, current)
|
|
293
|
+
const end = Math.max(maxY, current)
|
|
294
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i)
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
const yearListRef = ref<HTMLElement | null>(null)
|
|
298
|
+
const monthListRef = ref<HTMLElement | null>(null)
|
|
299
|
+
|
|
300
|
+
// Center the active year/month when the split view opens. Manual scrollTop (vs
|
|
301
|
+
// scrollIntoView) keeps the scroll contained to each list and never nudges the
|
|
302
|
+
// popover or page. Relies on the list containers being `relative` so the
|
|
303
|
+
// buttons' `offsetTop` is measured against them.
|
|
304
|
+
function centerSelected(container: HTMLElement | null) {
|
|
305
|
+
const el = container?.querySelector<HTMLElement>('[data-selected]')
|
|
306
|
+
if (!container || !el) return
|
|
307
|
+
container.scrollTop =
|
|
308
|
+
el.offsetTop - container.clientHeight / 2 + el.clientHeight / 2
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
watch(
|
|
312
|
+
() => props.view,
|
|
313
|
+
(view) => {
|
|
314
|
+
if (view !== 'monthYear') return
|
|
315
|
+
nextTick(() => {
|
|
316
|
+
centerSelected(yearListRef.value)
|
|
317
|
+
centerSelected(monthListRef.value)
|
|
318
|
+
})
|
|
319
|
+
},
|
|
320
|
+
)
|
|
321
|
+
|
|
284
322
|
// ── Roving tabindex (Reka Calendar pattern) ──────────────────────────────────
|
|
285
323
|
// The focused date is *controlled* — the parent owns the value and feeds it
|
|
286
324
|
// in via `props.focusedDate`. Arrow keys compute a target, emit
|
|
@@ -295,9 +333,7 @@ function isFocusedCell(cell: CalendarPanelCell): boolean {
|
|
|
295
333
|
return !!props.focusedDate && cell.date.isSame(props.focusedDate, 'day')
|
|
296
334
|
}
|
|
297
335
|
|
|
298
|
-
function pickInitialFocusDate(
|
|
299
|
-
weeks: CalendarPanelCell[][],
|
|
300
|
-
): Dayjs | null {
|
|
336
|
+
function pickInitialFocusDate(weeks: CalendarPanelCell[][]): Dayjs | null {
|
|
301
337
|
const flat = weeks.flat()
|
|
302
338
|
const selected = flat.find(
|
|
303
339
|
(c) =>
|
|
@@ -343,12 +379,7 @@ watch(
|
|
|
343
379
|
// for an unbounded run of dates would otherwise spin forever.
|
|
344
380
|
const MAX_SKIP_DISABLED_STEPS = 366
|
|
345
381
|
|
|
346
|
-
function shiftFocus(
|
|
347
|
-
target: Dayjs,
|
|
348
|
-
dir: 1 | -1,
|
|
349
|
-
retried = false,
|
|
350
|
-
steps = 0,
|
|
351
|
-
) {
|
|
382
|
+
function shiftFocus(target: Dayjs, dir: 1 | -1, retried = false, steps = 0) {
|
|
352
383
|
// Bounds check first — if the target is outside [min, max], the arrow
|
|
353
384
|
// press is a no-op rather than trying to navigate into nothing. Matches
|
|
354
385
|
// Reka's CalendarCellTrigger behavior.
|
|
@@ -417,37 +448,48 @@ function ariaLabel(cell: CalendarPanelCell): string {
|
|
|
417
448
|
}
|
|
418
449
|
|
|
419
450
|
function cellClass(cell: CalendarPanelCell): Array<string | false> {
|
|
420
|
-
|
|
421
|
-
|
|
451
|
+
// "Today" stays bold whether or not it's selected; its gray text color is kept
|
|
452
|
+
// separate so it can be dropped on selected cells.
|
|
453
|
+
const todayFont = cell.isToday ? 'font-semibold' : ''
|
|
454
|
+
// Resting text color for non-selected cells. Omitted on selected/range cells:
|
|
455
|
+
// both are `text-*` utilities, so leaving them in would win the CSS source-order
|
|
456
|
+
// tie against `text-ink-base` and the selected date would render gray.
|
|
457
|
+
const restingText = [
|
|
458
|
+
cell.inMonth ? 'text-ink-gray-8' : 'text-ink-gray-3',
|
|
459
|
+
cell.isToday ? 'text-ink-gray-9' : '',
|
|
460
|
+
]
|
|
422
461
|
|
|
423
462
|
if (cell.isUnavailable) {
|
|
424
|
-
return [inMonthCls, todayCls, 'rounded opacity-30 cursor-not-allowed']
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
if (cell.isRangeStart || cell.isRangeEnd) {
|
|
428
463
|
return [
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
464
|
+
'rounded',
|
|
465
|
+
...restingText,
|
|
466
|
+
todayFont,
|
|
467
|
+
'opacity-30 cursor-not-allowed',
|
|
432
468
|
]
|
|
433
469
|
}
|
|
434
470
|
|
|
435
|
-
if (cell.
|
|
471
|
+
if (cell.isRangeStart || cell.isRangeEnd || cell.isSelected) {
|
|
436
472
|
return [
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
'
|
|
473
|
+
'rounded',
|
|
474
|
+
todayFont,
|
|
475
|
+
'bg-surface-gray-9 text-ink-base hover:bg-surface-gray-9 cursor-pointer',
|
|
440
476
|
]
|
|
441
477
|
}
|
|
442
478
|
|
|
443
|
-
if (cell.
|
|
479
|
+
if (cell.inRange) {
|
|
444
480
|
return [
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
481
|
+
'rounded',
|
|
482
|
+
...restingText,
|
|
483
|
+
todayFont,
|
|
484
|
+
'bg-surface-gray-3 hover:bg-surface-gray-3 cursor-pointer',
|
|
448
485
|
]
|
|
449
486
|
}
|
|
450
487
|
|
|
451
|
-
return [
|
|
488
|
+
return [
|
|
489
|
+
'rounded',
|
|
490
|
+
...restingText,
|
|
491
|
+
todayFont,
|
|
492
|
+
'hover:bg-surface-gray-2 cursor-pointer',
|
|
493
|
+
]
|
|
452
494
|
}
|
|
453
495
|
</script>
|
|
@@ -59,8 +59,6 @@
|
|
|
59
59
|
:view="view"
|
|
60
60
|
:current-year="currentYear"
|
|
61
61
|
:current-month="currentMonth"
|
|
62
|
-
:year-range-start="yearRangeStart"
|
|
63
|
-
:year-range="yearRange"
|
|
64
62
|
:weeks="weeks"
|
|
65
63
|
today-label="Today"
|
|
66
64
|
:min="props.min"
|
|
@@ -122,11 +120,9 @@ const emit = defineEmits<DatePickerEmits>()
|
|
|
122
120
|
|
|
123
121
|
const slots = defineSlots<DatePickerSlots>()
|
|
124
122
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const contentClass = computed(() =>
|
|
128
|
-
slots.actions ? `w-fit ${POPOVER_CLASSES}` : `w-56 ${POPOVER_CLASSES}`,
|
|
129
|
-
)
|
|
123
|
+
// Layout only — the elevated shell (rounded/bg/shadow/ring) is owned by
|
|
124
|
+
// PopoverPanel inside PickerShell.
|
|
125
|
+
const contentClass = computed(() => (slots.actions ? 'w-fit' : 'w-56'))
|
|
130
126
|
|
|
131
127
|
// Cast strips @deprecated markers so internal back-compat reads don't trigger TS6385.
|
|
132
128
|
const dp = props as unknown as LegacyDatePickerProps
|
|
@@ -223,8 +219,6 @@ const {
|
|
|
223
219
|
view,
|
|
224
220
|
currentYear,
|
|
225
221
|
currentMonth,
|
|
226
|
-
yearRangeStart,
|
|
227
|
-
yearRange,
|
|
228
222
|
prev,
|
|
229
223
|
next,
|
|
230
224
|
cycleView,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:readonly="inputReadonly"
|
|
22
22
|
:input-class="dp.inputClass"
|
|
23
23
|
:display-label="displayLabel"
|
|
24
|
-
content-class="w-fit
|
|
24
|
+
content-class="w-fit"
|
|
25
25
|
@blur="commitInput()"
|
|
26
26
|
@enter="commitInput(true)"
|
|
27
27
|
@open="onShellOpen"
|
|
@@ -65,8 +65,6 @@
|
|
|
65
65
|
:view="view"
|
|
66
66
|
:current-year="currentYear"
|
|
67
67
|
:current-month="currentMonth"
|
|
68
|
-
:year-range-start="yearRangeStart"
|
|
69
|
-
:year-range="yearRange"
|
|
70
68
|
:weeks="weeks"
|
|
71
69
|
:today-label="isDualPaneActive ? '' : 'Today'"
|
|
72
70
|
:hide-next="isDualPaneActive"
|
|
@@ -91,8 +89,6 @@
|
|
|
91
89
|
:view="view"
|
|
92
90
|
:current-year="rightYear"
|
|
93
91
|
:current-month="rightMonth"
|
|
94
|
-
:year-range-start="yearRangeStart"
|
|
95
|
-
:year-range="yearRange"
|
|
96
92
|
:weeks="rightWeeks"
|
|
97
93
|
hide-prev
|
|
98
94
|
hide-today
|
|
@@ -138,7 +134,9 @@ import type {
|
|
|
138
134
|
} from './types'
|
|
139
135
|
|
|
140
136
|
const props = withDefaults(defineProps<DateRangePickerProps>(), {
|
|
141
|
-
|
|
137
|
+
// No default for the deprecated `value`: `[]` is truthy, which would make the
|
|
138
|
+
// deprecation guard (`useDeprecationWarnings`) fire for every v-model consumer.
|
|
139
|
+
// `pickIncoming()` already guards on `.length`, so `undefined` is safe.
|
|
142
140
|
modelValue: () => [],
|
|
143
141
|
variant: 'subtle',
|
|
144
142
|
placeholder: 'Select range',
|
|
@@ -286,8 +284,6 @@ const {
|
|
|
286
284
|
view,
|
|
287
285
|
currentYear,
|
|
288
286
|
currentMonth,
|
|
289
|
-
yearRangeStart,
|
|
290
|
-
yearRange,
|
|
291
287
|
prev,
|
|
292
288
|
next,
|
|
293
289
|
cycleView,
|
|
@@ -184,10 +184,12 @@ describe('DateTimePicker', () => {
|
|
|
184
184
|
})
|
|
185
185
|
})
|
|
186
186
|
|
|
187
|
-
it('cycle-calendar-view button
|
|
187
|
+
it('cycle-calendar-view button opens the month-year split view', () => {
|
|
188
188
|
cy.mount(DateTimePicker)
|
|
189
189
|
cy.get('input').first().dblclick()
|
|
190
190
|
cy.get('[aria-label=cycle-calendar-view]').click()
|
|
191
|
-
|
|
191
|
+
// Split view: scrollable year list beside a scrollable month list.
|
|
192
|
+
cy.get('[role=listbox][aria-label="Select year"]').should('exist')
|
|
193
|
+
cy.get('[role=listbox][aria-label="Select month"]').should('exist')
|
|
192
194
|
})
|
|
193
195
|
})
|
|
@@ -61,8 +61,6 @@
|
|
|
61
61
|
:view="view"
|
|
62
62
|
:current-year="currentYear"
|
|
63
63
|
:current-month="currentMonth"
|
|
64
|
-
:year-range-start="yearRangeStart"
|
|
65
|
-
:year-range="yearRange"
|
|
66
64
|
:weeks="weeks"
|
|
67
65
|
today-label="Now"
|
|
68
66
|
:min="resolvedMin"
|
|
@@ -139,11 +137,9 @@ const emit = defineEmits<DateTimePickerEmits>()
|
|
|
139
137
|
|
|
140
138
|
const slots = defineSlots<DateTimePickerSlots>()
|
|
141
139
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const contentClass = computed(() =>
|
|
145
|
-
slots.actions ? `w-fit ${POPOVER_CLASSES}` : `w-56 ${POPOVER_CLASSES}`,
|
|
146
|
-
)
|
|
140
|
+
// Layout only — the elevated shell (rounded/bg/shadow/ring) is owned by
|
|
141
|
+
// PopoverPanel inside PickerShell.
|
|
142
|
+
const contentClass = computed(() => (slots.actions ? 'w-fit' : 'w-56'))
|
|
147
143
|
|
|
148
144
|
const dp = props as unknown as LegacyDatePickerProps
|
|
149
145
|
|
|
@@ -232,8 +228,6 @@ const {
|
|
|
232
228
|
view,
|
|
233
229
|
currentYear,
|
|
234
230
|
currentMonth,
|
|
235
|
-
yearRangeStart,
|
|
236
|
-
yearRange,
|
|
237
231
|
prev,
|
|
238
232
|
next,
|
|
239
233
|
cycleView,
|
|
@@ -16,57 +16,37 @@ export function useCalendarView() {
|
|
|
16
16
|
const currentYear = ref<number>(dayjs().year())
|
|
17
17
|
const currentMonth = ref<number>(dayjs().month())
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
const yearRange = computed<number[]>(() =>
|
|
23
|
-
Array.from({ length: 12 }, (_, i) => yearRangeStart.value + i),
|
|
24
|
-
)
|
|
25
|
-
|
|
19
|
+
// Prev/next only navigate months in the day grid. The month-year split view
|
|
20
|
+
// scrolls instead of paging, so it has no prev/next controls.
|
|
26
21
|
function prev(): void {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
currentMonth.value = m.month()
|
|
34
|
-
} else if (view.value === 'month') {
|
|
35
|
-
currentYear.value -= 1
|
|
36
|
-
} else {
|
|
37
|
-
currentYear.value -= 12
|
|
38
|
-
}
|
|
22
|
+
const m = monthStart(currentYear.value, currentMonth.value).subtract(
|
|
23
|
+
1,
|
|
24
|
+
'month',
|
|
25
|
+
)
|
|
26
|
+
currentYear.value = m.year()
|
|
27
|
+
currentMonth.value = m.month()
|
|
39
28
|
}
|
|
40
29
|
|
|
41
30
|
function next(): void {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
'month',
|
|
46
|
-
)
|
|
47
|
-
currentYear.value = m.year()
|
|
48
|
-
currentMonth.value = m.month()
|
|
49
|
-
} else if (view.value === 'month') {
|
|
50
|
-
currentYear.value += 1
|
|
51
|
-
} else {
|
|
52
|
-
currentYear.value += 12
|
|
53
|
-
}
|
|
31
|
+
const m = monthStart(currentYear.value, currentMonth.value).add(1, 'month')
|
|
32
|
+
currentYear.value = m.year()
|
|
33
|
+
currentMonth.value = m.month()
|
|
54
34
|
}
|
|
55
35
|
|
|
36
|
+
// Toggle between the day grid and the month-year split view.
|
|
56
37
|
function cycleView(): void {
|
|
57
|
-
|
|
58
|
-
else if (view.value === 'month') view.value = 'year'
|
|
59
|
-
else view.value = 'date'
|
|
38
|
+
view.value = view.value === 'date' ? 'monthYear' : 'date'
|
|
60
39
|
}
|
|
61
40
|
|
|
41
|
+
// Picking a month commits the choice and returns to the day grid.
|
|
62
42
|
function selectMonth(i: number): void {
|
|
63
43
|
currentMonth.value = i
|
|
64
44
|
view.value = 'date'
|
|
65
45
|
}
|
|
66
46
|
|
|
47
|
+
// Picking a year stays in the split view so the user can then pick a month.
|
|
67
48
|
function selectYear(y: number): void {
|
|
68
49
|
currentYear.value = y
|
|
69
|
-
view.value = 'month'
|
|
70
50
|
}
|
|
71
51
|
|
|
72
52
|
function focusOn(d: Dayjs): void {
|
|
@@ -82,8 +62,6 @@ export function useCalendarView() {
|
|
|
82
62
|
view,
|
|
83
63
|
currentYear,
|
|
84
64
|
currentMonth,
|
|
85
|
-
yearRangeStart,
|
|
86
|
-
yearRange,
|
|
87
65
|
prev,
|
|
88
66
|
next,
|
|
89
67
|
cycleView,
|
|
@@ -232,7 +232,7 @@ const ret = computed(() =>
|
|
|
232
232
|
<DateRangePicker v-model="flight" dual-pane :min="today">
|
|
233
233
|
<template #trigger="{ togglePopover, isOpen }">
|
|
234
234
|
<div
|
|
235
|
-
class="grid grid-cols-2 divide-x divide-outline-gray-2 rounded border bg-surface-
|
|
235
|
+
class="grid grid-cols-2 divide-x divide-outline-gray-2 rounded border bg-surface-base text-sm transition-colors"
|
|
236
236
|
:class="
|
|
237
237
|
isOpen
|
|
238
238
|
? 'border-outline-gray-4 ring-2 ring-outline-gray-2'
|
|
@@ -303,7 +303,7 @@ export interface DateTimePickerSlots {
|
|
|
303
303
|
actions?: (props: DateTimePickerActionsSlotProps) => any
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
export type DatePickerViewMode = 'date' | '
|
|
306
|
+
export type DatePickerViewMode = 'date' | 'monthYear'
|
|
307
307
|
|
|
308
308
|
export interface DatePickerDateObj {
|
|
309
309
|
date: Dayjs
|