@flux-ui/components 3.0.0-next.34 → 3.0.0-next.38
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/component/FluxActionBar.vue.d.ts +17 -17
- package/dist/component/FluxActionPane.vue.d.ts +7 -7
- package/dist/component/{FluxActions.vue.d.ts → FluxActionStack.vue.d.ts} +11 -15
- package/dist/component/{FluxAutoGrid.vue.d.ts → FluxAdaptiveGroup.vue.d.ts} +6 -3
- package/dist/component/FluxAdaptiveSlot.vue.d.ts +35 -0
- package/dist/component/FluxAspectRatio.vue.d.ts +3 -3
- package/dist/component/FluxBadgeStack.vue.d.ts +3 -3
- package/dist/component/FluxButtonGroup.vue.d.ts +3 -3
- package/dist/component/FluxButtonStack.vue.d.ts +3 -3
- package/dist/component/FluxCalendar.vue.d.ts +3 -3
- package/dist/component/FluxCalendarEvent.vue.d.ts +3 -3
- package/dist/component/FluxCheckbox.vue.d.ts +2 -1
- package/dist/component/FluxClickablePane.vue.d.ts +5 -5
- package/dist/component/FluxColorSelect.vue.d.ts +1 -0
- package/dist/component/{FluxPaneDeck.vue.d.ts → FluxColumn.vue.d.ts} +5 -5
- package/dist/component/FluxCommandPalette.vue.d.ts +52 -0
- package/dist/component/FluxCommandPaletteGroup.vue.d.ts +8 -0
- package/dist/component/FluxCommandPaletteItem.vue.d.ts +18 -0
- package/dist/component/FluxComment.vue.d.ts +3 -3
- package/dist/component/FluxContainer.vue.d.ts +3 -3
- package/dist/component/FluxDivider.vue.d.ts +5 -3
- package/dist/component/FluxDropZone.vue.d.ts +8 -7
- package/dist/component/FluxExpandableGroup.vue.d.ts +3 -3
- package/dist/component/FluxFader.vue.d.ts +3 -3
- package/dist/component/FluxFaderItem.vue.d.ts +3 -3
- package/dist/component/FluxFilter.vue.d.ts +3 -3
- package/dist/component/FluxFilterBar.vue.d.ts +3 -3
- package/dist/component/FluxFilterBase.vue.d.ts +4 -4
- package/dist/component/FluxFilterWindow.vue.d.ts +13 -17
- package/dist/component/FluxFlyout.vue.d.ts +19 -21
- package/dist/component/FluxForm.vue.d.ts +3 -3
- package/dist/component/FluxFormColumn.vue.d.ts +3 -3
- package/dist/component/FluxFormDateInput.vue.d.ts +18 -24
- package/dist/component/FluxFormDateRangeInput.vue.d.ts +18 -21
- package/dist/component/FluxFormDateTimeInput.vue.d.ts +18 -24
- package/dist/component/FluxFormField.vue.d.ts +7 -7
- package/dist/component/FluxFormGrid.vue.d.ts +3 -3
- package/dist/component/FluxFormInput.vue.d.ts +2 -9
- package/dist/component/FluxFormInputAddition.vue.d.ts +3 -3
- package/dist/component/FluxFormInputGroup.vue.d.ts +3 -3
- package/dist/component/FluxFormPinInput.vue.d.ts +2 -4
- package/dist/component/FluxFormRangeSlider.vue.d.ts +18 -2
- package/dist/component/FluxFormRow.vue.d.ts +3 -3
- package/dist/component/FluxFormSection.vue.d.ts +3 -3
- package/dist/component/FluxFormSelect.vue.d.ts +2 -4
- package/dist/component/FluxFormSelectAsync.vue.d.ts +2 -4
- package/dist/component/FluxFormSlider.vue.d.ts +11 -2
- package/dist/component/FluxFormTextArea.vue.d.ts +2 -6
- package/dist/component/FluxFormTimeZonePicker.vue.d.ts +2 -4
- package/dist/component/FluxFormTreeViewSelect.vue.d.ts +15 -37
- package/dist/component/FluxGallery.vue.d.ts +3 -3
- package/dist/component/FluxGrid.vue.d.ts +3 -3
- package/dist/component/FluxGridColumn.vue.d.ts +3 -3
- package/dist/component/FluxIcon.vue.d.ts +1 -0
- package/dist/component/FluxInfo.vue.d.ts +3 -3
- package/dist/component/FluxInfoStack.vue.d.ts +3 -3
- package/dist/component/FluxLayerPane.vue.d.ts +20 -0
- package/dist/component/FluxLayerPaneSecondary.vue.d.ts +20 -0
- package/dist/component/FluxMenu.vue.d.ts +3 -3
- package/dist/component/FluxMenuCollapsible.vue.d.ts +47 -0
- package/dist/component/FluxMenuGroup.vue.d.ts +3 -3
- package/dist/component/FluxMenuItem.vue.d.ts +5 -3
- package/dist/component/FluxMenuOptions.vue.d.ts +3 -3
- package/dist/component/FluxNotice.vue.d.ts +5 -5
- package/dist/component/FluxNoticeStack.vue.d.ts +3 -3
- package/dist/component/FluxOverflowBar.vue.d.ts +4 -4
- package/dist/component/FluxPane.vue.d.ts +5 -5
- package/dist/component/FluxPaneBody.vue.d.ts +3 -3
- package/dist/component/FluxPaneFooter.vue.d.ts +3 -3
- package/dist/component/FluxPaneGroup.vue.d.ts +3 -3
- package/dist/component/FluxPaneHeader.vue.d.ts +6 -6
- package/dist/component/FluxPaneIllustration.vue.d.ts +5 -5
- package/dist/component/FluxPressable.vue.d.ts +3 -3
- package/dist/component/FluxPrompt.vue.d.ts +3 -17
- package/dist/component/FluxRoot.vue.d.ts +3 -3
- package/dist/component/FluxRow.vue.d.ts +23 -0
- package/dist/component/FluxSegmentedControl.vue.d.ts +3 -2
- package/dist/component/FluxSplitButton.vue.d.ts +5 -5
- package/dist/component/FluxStack.vue.d.ts +3 -3
- package/dist/component/FluxStepper.vue.d.ts +6 -6
- package/dist/component/FluxStepperStep.vue.d.ts +3 -3
- package/dist/component/FluxTab.vue.d.ts +3 -3
- package/dist/component/FluxTabBar.vue.d.ts +3 -3
- package/dist/component/FluxTabBarItem.vue.d.ts +5 -7
- package/dist/component/FluxTableActions.vue.d.ts +3 -3
- package/dist/component/FluxTableBar.vue.d.ts +3 -3
- package/dist/component/FluxTableCell.vue.d.ts +5 -5
- package/dist/component/FluxTableHeader.vue.d.ts +3 -3
- package/dist/component/FluxTableRow.vue.d.ts +3 -3
- package/dist/component/FluxTabs.vue.d.ts +6 -6
- package/dist/component/FluxTag.vue.d.ts +1 -0
- package/dist/component/FluxTagStack.vue.d.ts +3 -3
- package/dist/component/FluxTimeline.vue.d.ts +3 -3
- package/dist/component/FluxTimelineItem.vue.d.ts +3 -3
- package/dist/component/FluxToggle.vue.d.ts +2 -3
- package/dist/component/FluxToolbar.vue.d.ts +3 -3
- package/dist/component/FluxToolbarGroup.vue.d.ts +3 -3
- package/dist/component/FluxWindow.vue.d.ts +3 -3
- package/dist/component/index.d.ts +11 -3
- package/dist/component/primitive/Anchor.vue.d.ts +3 -3
- package/dist/component/primitive/AnchorPopup.vue.d.ts +3 -3
- package/dist/component/primitive/CoordinatePicker.vue.d.ts +1 -0
- package/dist/component/primitive/DialogLayout.vue.d.ts +28 -0
- package/dist/component/primitive/FilterOptionBase.vue.d.ts +2 -2
- package/dist/component/primitive/SelectBase.vue.d.ts +19 -37
- package/dist/component/primitive/SliderThumb.vue.d.ts +4 -0
- package/dist/component/primitive/TreeNodeRenderer.vue.d.ts +30 -0
- package/dist/component/primitive/index.d.ts +2 -0
- package/dist/composable/index.d.ts +1 -0
- package/dist/composable/private/index.d.ts +8 -0
- package/dist/composable/private/useAsyncFilterOptions.d.ts +14 -0
- package/dist/composable/private/useCommandPalette.d.ts +38 -0
- package/dist/composable/private/useDateFlyout.d.ts +10 -0
- package/dist/composable/private/useDropdownPopup.d.ts +27 -0
- package/dist/composable/private/useFilterOption.d.ts +12 -0
- package/dist/composable/useAdaptiveGroupInjection.d.ts +2 -0
- package/dist/data/di.d.ts +11 -0
- package/dist/data/filter.d.ts +4 -17
- package/dist/data/i18n.d.ts +17 -0
- package/dist/data/timeZones.d.ts +3 -0
- package/dist/index.css +710 -349
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6936 -5537
- package/dist/index.js.map +1 -1
- package/dist/transition/FluxAutoHeightTransition.vue.d.ts +5 -3
- package/dist/transition/FluxAutoWidthTransition.vue.d.ts +5 -3
- package/dist/transition/FluxBreakthroughTransition.vue.d.ts +5 -3
- package/dist/transition/FluxFadeTransition.vue.d.ts +5 -3
- package/dist/transition/FluxOverlayTransition.vue.d.ts +5 -3
- package/dist/transition/FluxRouteTransition.vue.d.ts +5 -3
- package/dist/transition/FluxSlideOverTransition.vue.d.ts +5 -3
- package/dist/transition/FluxTooltipTransition.vue.d.ts +5 -3
- package/dist/transition/FluxVerticalWindowTransition.vue.d.ts +5 -3
- package/dist/transition/FluxWindowTransition.vue.d.ts +5 -3
- package/package.json +19 -23
- package/src/component/FluxActionBar.vue +9 -8
- package/src/component/FluxActionPane.vue +4 -3
- package/src/component/{FluxActions.vue → FluxActionStack.vue} +2 -2
- package/src/component/FluxAdaptiveGroup.vue +112 -0
- package/src/component/FluxAdaptiveSlot.vue +159 -0
- package/src/component/FluxAlert.vue +8 -17
- package/src/component/FluxAnimatedColors.vue +1 -1
- package/src/component/FluxAspectRatio.vue +2 -1
- package/src/component/FluxBadge.vue +5 -1
- package/src/component/FluxBadgeStack.vue +2 -1
- package/src/component/FluxButtonGroup.vue +2 -1
- package/src/component/FluxButtonStack.vue +2 -1
- package/src/component/FluxCalendar.vue +8 -1
- package/src/component/FluxCalendarEvent.vue +2 -1
- package/src/component/FluxCheckbox.vue +33 -6
- package/src/component/FluxChip.vue +1 -0
- package/src/component/FluxClickablePane.vue +3 -2
- package/src/component/FluxColorPicker.vue +8 -1
- package/src/component/FluxColorSelect.vue +25 -4
- package/src/component/{FluxAutoGrid.vue → FluxColumn.vue} +5 -8
- package/src/component/FluxCommandPalette.vue +290 -0
- package/src/component/FluxCommandPaletteGroup.vue +23 -0
- package/src/component/FluxCommandPaletteItem.vue +60 -0
- package/src/component/FluxComment.vue +2 -2
- package/src/component/FluxConfirm.vue +8 -17
- package/src/component/FluxContainer.vue +3 -2
- package/src/component/FluxDataTable.vue +3 -1
- package/src/component/FluxDivider.vue +7 -3
- package/src/component/FluxDropZone.vue +22 -8
- package/src/component/FluxExpandable.vue +3 -2
- package/src/component/FluxExpandableGroup.vue +2 -2
- package/src/component/FluxFader.vue +2 -2
- package/src/component/FluxFaderItem.vue +2 -1
- package/src/component/FluxFilter.vue +2 -1
- package/src/component/FluxFilterBar.vue +3 -2
- package/src/component/FluxFilterBase.vue +17 -9
- package/src/component/FluxFilterOption.vue +3 -14
- package/src/component/FluxFilterOptionAsync.vue +17 -60
- package/src/component/FluxFilterOptions.vue +3 -25
- package/src/component/FluxFilterOptionsAsync.vue +9 -73
- package/src/component/FluxFilterWindow.vue +1 -1
- package/src/component/FluxFlyout.vue +13 -11
- package/src/component/FluxForm.vue +2 -1
- package/src/component/FluxFormColumn.vue +2 -1
- package/src/component/FluxFormDateInput.vue +9 -22
- package/src/component/FluxFormDateRangeInput.vue +20 -15
- package/src/component/FluxFormDateTimeInput.vue +17 -20
- package/src/component/FluxFormField.vue +4 -4
- package/src/component/FluxFormGrid.vue +2 -1
- package/src/component/FluxFormInput.vue +11 -10
- package/src/component/FluxFormInputAddition.vue +2 -1
- package/src/component/FluxFormInputGroup.vue +3 -2
- package/src/component/FluxFormPinInput.vue +14 -6
- package/src/component/FluxFormRangeSlider.vue +12 -2
- package/src/component/FluxFormRow.vue +2 -1
- package/src/component/FluxFormSection.vue +4 -3
- package/src/component/FluxFormSelect.vue +11 -4
- package/src/component/FluxFormSelectAsync.vue +14 -8
- package/src/component/FluxFormSlider.vue +8 -2
- package/src/component/FluxFormTextArea.vue +12 -7
- package/src/component/FluxFormTimeZonePicker.vue +13 -626
- package/src/component/FluxFormTreeViewSelect.vue +51 -79
- package/src/component/FluxGallery.vue +2 -1
- package/src/component/FluxGrid.vue +3 -2
- package/src/component/FluxGridColumn.vue +2 -1
- package/src/component/FluxIcon.vue +4 -2
- package/src/component/FluxInfo.vue +2 -1
- package/src/component/FluxInfoStack.vue +3 -2
- package/src/component/FluxLayerPane.vue +16 -0
- package/src/component/FluxLayerPaneSecondary.vue +16 -0
- package/src/component/FluxLegend.vue +9 -9
- package/src/component/FluxMenu.vue +2 -2
- package/src/component/FluxMenuCollapsible.vue +187 -0
- package/src/component/FluxMenuGroup.vue +2 -1
- package/src/component/FluxMenuItem.vue +9 -1
- package/src/component/FluxMenuOptions.vue +1 -1
- package/src/component/FluxNotice.vue +7 -2
- package/src/component/FluxNoticeStack.vue +2 -1
- package/src/component/FluxOverflowBar.vue +3 -3
- package/src/component/FluxPagination.vue +1 -0
- package/src/component/FluxPane.vue +3 -2
- package/src/component/FluxPaneBody.vue +2 -1
- package/src/component/FluxPaneFooter.vue +2 -1
- package/src/component/FluxPaneGroup.vue +2 -1
- package/src/component/FluxPaneHeader.vue +7 -6
- package/src/component/FluxPaneIllustration.vue +3 -3
- package/src/component/FluxPaneMedia.vue +1 -1
- package/src/component/FluxPercentageBar.vue +3 -1
- package/src/component/FluxPressable.vue +2 -1
- package/src/component/FluxProgressBar.vue +2 -1
- package/src/component/FluxPrompt.vue +16 -27
- package/src/component/FluxRemove.vue +4 -0
- package/src/component/FluxRoot.vue +2 -2
- package/src/component/FluxRow.vue +24 -0
- package/src/component/FluxSegmentedControl.vue +51 -4
- package/src/component/FluxSnackbar.vue +36 -12
- package/src/component/FluxSplitButton.vue +3 -2
- package/src/component/FluxStack.vue +4 -3
- package/src/component/FluxStepper.vue +3 -3
- package/src/component/FluxStepperStep.vue +2 -1
- package/src/component/FluxTab.vue +2 -1
- package/src/component/FluxTabBar.vue +3 -3
- package/src/component/FluxTableActions.vue +5 -4
- package/src/component/FluxTableBar.vue +2 -1
- package/src/component/FluxTableCell.vue +4 -3
- package/src/component/FluxTableHeader.vue +4 -2
- package/src/component/FluxTableRow.vue +2 -1
- package/src/component/FluxTabs.vue +15 -6
- package/src/component/FluxTag.vue +8 -2
- package/src/component/FluxTagStack.vue +2 -1
- package/src/component/FluxTimeline.vue +2 -1
- package/src/component/FluxTimelineItem.vue +2 -1
- package/src/component/FluxToggle.vue +20 -5
- package/src/component/FluxToolbar.vue +2 -1
- package/src/component/FluxToolbarGroup.vue +2 -1
- package/src/component/FluxTooltip.vue +1 -1
- package/src/component/FluxTreeView.vue +9 -35
- package/src/component/FluxWindow.vue +2 -2
- package/src/component/index.ts +11 -3
- package/src/component/primitive/Anchor.vue +3 -1
- package/src/component/primitive/AnchorPopup.vue +3 -3
- package/src/component/primitive/CoordinatePicker.vue +2 -1
- package/src/component/primitive/CoordinatePickerThumb.vue +2 -0
- package/src/component/primitive/DialogLayout.vue +44 -0
- package/src/component/primitive/SelectBase.vue +22 -28
- package/src/component/primitive/SliderBase.vue +0 -1
- package/src/component/primitive/SliderThumb.vue +9 -0
- package/src/component/primitive/TreeNodeRenderer.vue +77 -0
- package/src/component/primitive/index.ts +2 -0
- package/src/composable/index.ts +1 -0
- package/src/composable/private/index.ts +8 -0
- package/src/composable/private/useAsyncFilterOptions.ts +70 -0
- package/src/composable/private/useCommandPalette.ts +405 -0
- package/src/composable/private/useDateFlyout.ts +34 -0
- package/src/composable/private/useDropdownPopup.ts +99 -0
- package/src/composable/private/useFilterOption.ts +59 -0
- package/src/composable/useAdaptiveGroupInjection.ts +6 -0
- package/src/css/component/Action.module.scss +2 -2
- package/src/css/component/AdaptiveSlot.module.scss +25 -0
- package/src/css/component/Avatar.module.scss +10 -11
- package/src/css/component/Badge.module.scss +11 -4
- package/src/css/component/Button.module.scss +4 -16
- package/src/css/component/Calendar.module.scss +4 -4
- package/src/css/component/Chip.module.scss +6 -10
- package/src/css/component/Color.module.scss +1 -1
- package/src/css/component/CommandPalette.module.scss +332 -0
- package/src/css/component/DatePicker.module.scss +1 -1
- package/src/css/component/Expandable.module.scss +5 -5
- package/src/css/component/Fader.module.scss +2 -1
- package/src/css/component/Flyout.module.scss +1 -1
- package/src/css/component/FocalPoint.module.scss +1 -1
- package/src/css/component/Form.module.scss +56 -10
- package/src/css/component/Item.module.scss +4 -4
- package/src/css/component/LayerPane.module.scss +40 -0
- package/src/css/component/Layout.module.scss +11 -4
- package/src/css/component/Legend.module.scss +2 -2
- package/src/css/component/Menu.module.scss +59 -11
- package/src/css/component/Notice.module.scss +7 -7
- package/src/css/component/Overlay.module.scss +2 -2
- package/src/css/component/Pane.module.scss +10 -23
- package/src/css/component/PercentageBar.module.scss +1 -1
- package/src/css/component/Remove.module.scss +1 -1
- package/src/css/component/SegmentedControl.module.scss +1 -0
- package/src/css/component/Snackbar.module.scss +1 -1
- package/src/css/component/Statistic.module.scss +2 -2
- package/src/css/component/Stepper.module.scss +1 -1
- package/src/css/component/Tab.module.scss +11 -15
- package/src/css/component/Table.module.scss +13 -13
- package/src/css/component/Timeline.module.scss +2 -2
- package/src/css/component/Toolbar.module.scss +3 -3
- package/src/css/component/Tooltip.module.scss +3 -4
- package/src/css/component/Transition.module.scss +1 -1
- package/src/css/component/TreeView.module.scss +2 -15
- package/src/css/component/TreeViewSelect.module.scss +1 -15
- package/src/css/component/base/Button.module.scss +6 -7
- package/src/css/component/base/Effect.module.scss +2 -1
- package/src/css/component/primitive/Slider.module.scss +6 -7
- package/src/css/component/primitive/TreeNode.module.scss +19 -0
- package/src/css/mixin/button-active.scss +6 -0
- package/src/css/mixin/focus-ring.scss +1 -1
- package/src/css/mixin/index.scss +1 -0
- package/src/css/typography.scss +3 -2
- package/src/css/variables.scss +7 -2
- package/src/data/di.ts +13 -0
- package/src/data/filter.ts +24 -28
- package/src/data/i18n.ts +17 -0
- package/src/data/store.ts +46 -11
- package/src/data/timeZones.ts +619 -0
- package/src/index.ts +2 -0
- package/src/transition/FluxAutoHeightTransition.vue +5 -0
- package/src/transition/FluxAutoWidthTransition.vue +5 -0
- package/src/transition/FluxBreakthroughTransition.vue +5 -0
- package/src/transition/FluxFadeTransition.vue +5 -0
- package/src/transition/FluxOverlayTransition.vue +5 -0
- package/src/transition/FluxRouteTransition.vue +5 -0
- package/src/transition/FluxSlideOverTransition.vue +5 -0
- package/src/transition/FluxTooltipTransition.vue +5 -0
- package/src/transition/FluxVerticalWindowTransition.vue +5 -0
- package/src/transition/FluxWindowTransition.vue +5 -0
- package/dist/0db98648.svg +0 -3
- package/src/component/FluxPaneDeck.vue +0 -24
- package/src/css/component/base/Grid.module.scss +0 -8
- package/src/image/avatar-mask.svg +0 -3
- package/tsconfig.json +0 -7
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import type { FluxCommandSource, FluxCommandSourceItem, FluxCommandSubAction } from '@flux-ui/types';
|
|
2
|
+
import { useDebouncedRef } from '@basmilius/common';
|
|
3
|
+
import { computed, nextTick, type Ref, ref, unref, watch } from 'vue';
|
|
4
|
+
|
|
5
|
+
export type CommandPaletteResultItem = {
|
|
6
|
+
readonly globalIndex: number;
|
|
7
|
+
readonly sourceKey: string;
|
|
8
|
+
readonly sourceLabel: string;
|
|
9
|
+
readonly item: FluxCommandSourceItem;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type CommandPaletteGroup = {
|
|
13
|
+
readonly sourceKey: string;
|
|
14
|
+
readonly sourceLabel: string;
|
|
15
|
+
readonly startIndex: number;
|
|
16
|
+
readonly items: CommandPaletteResultItem[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function useCommandPalette(params: {
|
|
20
|
+
readonly sources: Ref<FluxCommandSource[]>;
|
|
21
|
+
readonly itemRefs: Readonly<Ref<Array<{ readonly $el: HTMLElement; }> | null | undefined>>;
|
|
22
|
+
}): {
|
|
23
|
+
readonly search: Ref<string>;
|
|
24
|
+
readonly activeTab: Ref<string | null>;
|
|
25
|
+
readonly highlightedIndex: Ref<number>;
|
|
26
|
+
readonly isLoading: Ref<boolean>;
|
|
27
|
+
readonly isTransitioningBack: Ref<boolean>;
|
|
28
|
+
readonly subActionTarget: Ref<FluxCommandSourceItem | null>;
|
|
29
|
+
readonly filteredItems: Ref<CommandPaletteResultItem[]>;
|
|
30
|
+
readonly groupedItems: Ref<CommandPaletteGroup[]>;
|
|
31
|
+
readonly subActions: Ref<FluxCommandSubAction[]>;
|
|
32
|
+
readonly activeTabSource: Ref<FluxCommandSource | null>;
|
|
33
|
+
readonly tabs: Ref<FluxCommandSource[]>;
|
|
34
|
+
readonly totalItems: Ref<number>;
|
|
35
|
+
setSearch: (value: string) => void;
|
|
36
|
+
setActiveTab: (key: string | null) => void;
|
|
37
|
+
enterSubActions: (item: FluxCommandSourceItem) => void;
|
|
38
|
+
onKeyNavigate: (evt: KeyboardEvent, onClose: () => void, onActivate: (item: FluxCommandSourceItem) => void) => void;
|
|
39
|
+
reset: () => void;
|
|
40
|
+
} {
|
|
41
|
+
const search = ref('');
|
|
42
|
+
const activeTab = ref<string | null>(null);
|
|
43
|
+
const highlightedIndex = ref(-1);
|
|
44
|
+
const subActionTarget = ref<FluxCommandSourceItem | null>(null);
|
|
45
|
+
const isKeyboardNav = ref(false);
|
|
46
|
+
const isLoading = ref(false);
|
|
47
|
+
const isTransitioningBack = ref(false);
|
|
48
|
+
const savedState = ref<{ readonly search: string; readonly highlightedIndex: number; } | null>(null);
|
|
49
|
+
const asyncResults = ref<Map<string, FluxCommandSourceItem[]>>(new Map());
|
|
50
|
+
const debouncedSearch = useDebouncedRef(search, 300) as unknown as Ref<string>;
|
|
51
|
+
let fetchGeneration = 0;
|
|
52
|
+
|
|
53
|
+
const filteredItems = computed<CommandPaletteResultItem[]>(() => {
|
|
54
|
+
const query = unref(search).toLowerCase().trim();
|
|
55
|
+
const tab = unref(activeTab);
|
|
56
|
+
const sources = unref(params.sources);
|
|
57
|
+
const asyncMap = unref(asyncResults);
|
|
58
|
+
const results: CommandPaletteResultItem[] = [];
|
|
59
|
+
|
|
60
|
+
for (const source of sources) {
|
|
61
|
+
if (tab && source.key !== tab) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (source.fetchSearch) {
|
|
66
|
+
const items = query ? asyncMap.get(source.key) : source.items;
|
|
67
|
+
|
|
68
|
+
if (items) {
|
|
69
|
+
for (const item of items) {
|
|
70
|
+
results.push({
|
|
71
|
+
globalIndex: results.length,
|
|
72
|
+
sourceKey: source.key,
|
|
73
|
+
sourceLabel: source.label,
|
|
74
|
+
item
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (const item of source.items) {
|
|
83
|
+
if (query && !item.label.toLowerCase().includes(query) && !(item.subLabel?.toLowerCase().includes(query) ?? false)) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
results.push({
|
|
88
|
+
globalIndex: results.length,
|
|
89
|
+
sourceKey: source.key,
|
|
90
|
+
sourceLabel: source.label,
|
|
91
|
+
item
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return results;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const groupedItems = computed<CommandPaletteGroup[]>(() => {
|
|
100
|
+
const items = unref(filteredItems);
|
|
101
|
+
const groups = new Map<string, CommandPaletteGroup>();
|
|
102
|
+
|
|
103
|
+
for (const result of items) {
|
|
104
|
+
if (!groups.has(result.sourceKey)) {
|
|
105
|
+
groups.set(result.sourceKey, {
|
|
106
|
+
sourceKey: result.sourceKey,
|
|
107
|
+
sourceLabel: result.sourceLabel,
|
|
108
|
+
startIndex: result.globalIndex,
|
|
109
|
+
items: []
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
(groups.get(result.sourceKey)!.items as CommandPaletteResultItem[]).push(result);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return Array.from(groups.values());
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const tabs = computed(() => unref(params.sources).filter(source => source.tab));
|
|
120
|
+
|
|
121
|
+
const activeTabSource = computed<FluxCommandSource | null>(() => {
|
|
122
|
+
const tab = unref(activeTab);
|
|
123
|
+
|
|
124
|
+
if (!tab) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return unref(tabs).find(source => source.key === tab) ?? null;
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const subActions = computed(() => {
|
|
132
|
+
const actions = unref(subActionTarget)?.subActions ?? [];
|
|
133
|
+
const query = unref(search).toLowerCase().trim();
|
|
134
|
+
|
|
135
|
+
if (!query) {
|
|
136
|
+
return actions;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return actions.filter(action => action.label.toLowerCase().includes(query));
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const totalItems = computed(() => {
|
|
143
|
+
if (unref(subActionTarget)) {
|
|
144
|
+
return unref(subActions).length;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return unref(filteredItems).length;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
function setSearch(value: string): void {
|
|
151
|
+
search.value = value;
|
|
152
|
+
highlightedIndex.value = value.trim() ? 0 : -1;
|
|
153
|
+
|
|
154
|
+
if (value.trim() && !unref(subActionTarget) && unref(params.sources).some(s => s.fetchSearch)) {
|
|
155
|
+
isLoading.value = true;
|
|
156
|
+
} else {
|
|
157
|
+
isLoading.value = false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function setActiveTab(key: string | null): void {
|
|
162
|
+
const allTabs = unref(tabs);
|
|
163
|
+
const tabKeys: (string | null)[] = [null, ...allTabs.map(t => t.key)];
|
|
164
|
+
|
|
165
|
+
isTransitioningBack.value = tabKeys.indexOf(key) < tabKeys.indexOf(unref(activeTab));
|
|
166
|
+
activeTab.value = key;
|
|
167
|
+
search.value = '';
|
|
168
|
+
highlightedIndex.value = -1;
|
|
169
|
+
subActionTarget.value = null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function selectHighlighted(onClose: () => void, onActivate: (item: FluxCommandSourceItem) => void): void {
|
|
173
|
+
const index = unref(highlightedIndex);
|
|
174
|
+
const target = unref(subActionTarget);
|
|
175
|
+
|
|
176
|
+
if (target) {
|
|
177
|
+
const action = unref(subActions)[index];
|
|
178
|
+
|
|
179
|
+
if (action) {
|
|
180
|
+
action.onActivate();
|
|
181
|
+
onClose();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const result = unref(filteredItems)[index];
|
|
188
|
+
|
|
189
|
+
if (!result) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (result.item.subActions?.length) {
|
|
194
|
+
enterSubActions(result.item);
|
|
195
|
+
} else {
|
|
196
|
+
result.item.onActivate();
|
|
197
|
+
onActivate(result.item);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function enterSubActions(item: FluxCommandSourceItem): void {
|
|
202
|
+
savedState.value = {search: unref(search), highlightedIndex: unref(highlightedIndex)};
|
|
203
|
+
subActionTarget.value = item;
|
|
204
|
+
search.value = '';
|
|
205
|
+
highlightedIndex.value = 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function navigateTab(direction: number): void {
|
|
209
|
+
const allTabs = unref(tabs);
|
|
210
|
+
|
|
211
|
+
if (allTabs.length === 0) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const tabKeys: (string | null)[] = [null, ...allTabs.map(tab => tab.key)];
|
|
216
|
+
const currentIndex = tabKeys.indexOf(unref(activeTab));
|
|
217
|
+
const nextIndex = (currentIndex + direction + tabKeys.length) % tabKeys.length;
|
|
218
|
+
|
|
219
|
+
setActiveTab(tabKeys[nextIndex]);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function restoreState(): void {
|
|
223
|
+
subActionTarget.value = null;
|
|
224
|
+
const state = unref(savedState);
|
|
225
|
+
|
|
226
|
+
if (state) {
|
|
227
|
+
search.value = state.search;
|
|
228
|
+
isKeyboardNav.value = true;
|
|
229
|
+
highlightedIndex.value = state.highlightedIndex;
|
|
230
|
+
savedState.value = null;
|
|
231
|
+
} else {
|
|
232
|
+
highlightedIndex.value = -1;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function onKeyNavigate(evt: KeyboardEvent, onClose: () => void, onActivate: (item: FluxCommandSourceItem) => void): void {
|
|
237
|
+
const total = unref(totalItems);
|
|
238
|
+
const current = unref(highlightedIndex);
|
|
239
|
+
|
|
240
|
+
switch (evt.key) {
|
|
241
|
+
case 'ArrowDown':
|
|
242
|
+
evt.preventDefault();
|
|
243
|
+
isKeyboardNav.value = true;
|
|
244
|
+
highlightedIndex.value = Math.min(total - 1, current + 1);
|
|
245
|
+
break;
|
|
246
|
+
|
|
247
|
+
case 'ArrowUp':
|
|
248
|
+
evt.preventDefault();
|
|
249
|
+
isKeyboardNav.value = true;
|
|
250
|
+
highlightedIndex.value = total === 0 ? -1 : Math.max(0, current - 1);
|
|
251
|
+
break;
|
|
252
|
+
|
|
253
|
+
case 'ArrowLeft':
|
|
254
|
+
if (!unref(search) && !unref(subActionTarget)) {
|
|
255
|
+
evt.preventDefault();
|
|
256
|
+
navigateTab(-1);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
break;
|
|
260
|
+
|
|
261
|
+
case 'ArrowRight':
|
|
262
|
+
if (!unref(search) && !unref(subActionTarget)) {
|
|
263
|
+
evt.preventDefault();
|
|
264
|
+
navigateTab(1);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
break;
|
|
268
|
+
|
|
269
|
+
case 'Enter':
|
|
270
|
+
evt.preventDefault();
|
|
271
|
+
selectHighlighted(onClose, onActivate);
|
|
272
|
+
break;
|
|
273
|
+
|
|
274
|
+
case 'Escape':
|
|
275
|
+
evt.preventDefault();
|
|
276
|
+
|
|
277
|
+
if (unref(subActionTarget)) {
|
|
278
|
+
restoreState();
|
|
279
|
+
} else {
|
|
280
|
+
onClose();
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
break;
|
|
284
|
+
|
|
285
|
+
case 'Backspace':
|
|
286
|
+
if (!unref(search)) {
|
|
287
|
+
if (unref(subActionTarget)) {
|
|
288
|
+
evt.preventDefault();
|
|
289
|
+
restoreState();
|
|
290
|
+
} else if (unref(activeTab)) {
|
|
291
|
+
evt.preventDefault();
|
|
292
|
+
activeTab.value = null;
|
|
293
|
+
highlightedIndex.value = -1;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function reset(): void {
|
|
302
|
+
search.value = '';
|
|
303
|
+
activeTab.value = null;
|
|
304
|
+
highlightedIndex.value = -1;
|
|
305
|
+
subActionTarget.value = null;
|
|
306
|
+
asyncResults.value = new Map();
|
|
307
|
+
isLoading.value = false;
|
|
308
|
+
fetchGeneration++;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
watch(debouncedSearch, async (query) => {
|
|
312
|
+
if (unref(subActionTarget)) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const trimmed = query.trim();
|
|
317
|
+
|
|
318
|
+
if (!trimmed) {
|
|
319
|
+
asyncResults.value = new Map();
|
|
320
|
+
isLoading.value = false;
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const tab = unref(activeTab);
|
|
325
|
+
const sources = unref(params.sources);
|
|
326
|
+
const asyncSources = sources.filter(s => {
|
|
327
|
+
if (!s.fetchSearch) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return !tab || s.key === tab;
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
if (asyncSources.length === 0) {
|
|
335
|
+
isLoading.value = false;
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const generation = ++fetchGeneration;
|
|
340
|
+
isLoading.value = true;
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
const fetched = await Promise.all(
|
|
344
|
+
asyncSources.map(async (source) => ({
|
|
345
|
+
key: source.key,
|
|
346
|
+
items: await source.fetchSearch!(trimmed)
|
|
347
|
+
}))
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
if (generation !== fetchGeneration) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const map = new Map<string, FluxCommandSourceItem[]>();
|
|
355
|
+
|
|
356
|
+
for (const {key, items} of fetched) {
|
|
357
|
+
map.set(key, items);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
asyncResults.value = map;
|
|
361
|
+
} finally {
|
|
362
|
+
if (generation === fetchGeneration) {
|
|
363
|
+
isLoading.value = false;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
watch(highlightedIndex, (index) => {
|
|
369
|
+
if (index < 0 || !unref(isKeyboardNav)) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
isKeyboardNav.value = false;
|
|
374
|
+
|
|
375
|
+
nextTick(() => unref(params.itemRefs)?.[index]?.$el?.scrollIntoView({block: 'nearest'}));
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
watch(totalItems, (total) => {
|
|
379
|
+
const current = unref(highlightedIndex);
|
|
380
|
+
|
|
381
|
+
if (current >= total) {
|
|
382
|
+
highlightedIndex.value = Math.max(-1, total - 1);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
return {
|
|
387
|
+
search,
|
|
388
|
+
activeTab,
|
|
389
|
+
activeTabSource,
|
|
390
|
+
highlightedIndex,
|
|
391
|
+
isLoading,
|
|
392
|
+
isTransitioningBack,
|
|
393
|
+
subActionTarget,
|
|
394
|
+
filteredItems,
|
|
395
|
+
groupedItems,
|
|
396
|
+
subActions,
|
|
397
|
+
tabs,
|
|
398
|
+
totalItems,
|
|
399
|
+
setSearch,
|
|
400
|
+
setActiveTab,
|
|
401
|
+
enterSubActions,
|
|
402
|
+
onKeyNavigate,
|
|
403
|
+
reset
|
|
404
|
+
};
|
|
405
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ModelRef, type Ref, ref, unref, watch } from 'vue';
|
|
2
|
+
|
|
3
|
+
type FlyoutLike = {
|
|
4
|
+
close(): void;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
type UseDateFlyoutOptions<T> = {
|
|
8
|
+
compareKey?(value: T | null): string | number | null | undefined;
|
|
9
|
+
transformIn?(value: T | null): T | null;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function <T>(
|
|
13
|
+
modelValue: ModelRef<T | null>,
|
|
14
|
+
flyoutRef: Readonly<Ref<FlyoutLike | null>>,
|
|
15
|
+
options: UseDateFlyoutOptions<T> = {}
|
|
16
|
+
): Ref<T | null> {
|
|
17
|
+
const localValue = ref<T | null>(null) as Ref<T | null>;
|
|
18
|
+
|
|
19
|
+
watch(modelValue, value => {
|
|
20
|
+
localValue.value = options.transformIn ? options.transformIn(value) : value;
|
|
21
|
+
}, {immediate: true});
|
|
22
|
+
|
|
23
|
+
watch(localValue, value => {
|
|
24
|
+
unref(flyoutRef)?.close();
|
|
25
|
+
|
|
26
|
+
if (options.compareKey && options.compareKey(modelValue.value) === options.compareKey(value)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
modelValue.value = value;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return localValue;
|
|
34
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useClickOutside } from '@basmilius/common';
|
|
2
|
+
import { unrefTemplateElement } from '@flux-ui/internals';
|
|
3
|
+
import { type ComponentPublicInstance, nextTick, ref, type Ref, unref, watch } from 'vue';
|
|
4
|
+
|
|
5
|
+
export type UseDropdownPopupOptions = {
|
|
6
|
+
readonly anchorRef: Readonly<Ref<ComponentPublicInstance | null | undefined>>;
|
|
7
|
+
readonly popupRef: Readonly<Ref<ComponentPublicInstance | null | undefined>>;
|
|
8
|
+
readonly focusElement: Readonly<Ref<HTMLElement | null | undefined>>;
|
|
9
|
+
readonly disabled?: Readonly<Ref<boolean>>;
|
|
10
|
+
readonly readonly?: Readonly<Ref<boolean>>;
|
|
11
|
+
readonly onOpen?: () => void;
|
|
12
|
+
readonly onClose?: () => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type UseDropdownPopupReturn = {
|
|
16
|
+
readonly isOpen: Ref<boolean>;
|
|
17
|
+
readonly open: () => void;
|
|
18
|
+
readonly close: () => void;
|
|
19
|
+
readonly toggle: () => void;
|
|
20
|
+
readonly focusAnchor: () => void;
|
|
21
|
+
readonly onKeyDownBase: (evt: KeyboardEvent) => boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Shared dropdown-popup infrastructure for select-like components. Manages:
|
|
26
|
+
* - open/close state
|
|
27
|
+
* - click-outside (close when clicking outside popup + anchor)
|
|
28
|
+
* - focus-back-to-anchor on close
|
|
29
|
+
* - focus-the-inner-focus-element on open
|
|
30
|
+
* - Escape/Tab keyboard handling
|
|
31
|
+
*/
|
|
32
|
+
export default function useDropdownPopup(options: UseDropdownPopupOptions): UseDropdownPopupReturn {
|
|
33
|
+
const isOpen = ref(false);
|
|
34
|
+
|
|
35
|
+
function open(): void {
|
|
36
|
+
if (unref(options.disabled) || unref(options.readonly)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
isOpen.value = true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function close(): void {
|
|
44
|
+
isOpen.value = false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function toggle(): void {
|
|
48
|
+
if (unref(options.disabled) || unref(options.readonly)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
isOpen.value = !unref(isOpen);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function focusAnchor(): void {
|
|
56
|
+
nextTick(() => unrefTemplateElement(options.anchorRef)?.focus());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function onKeyDownBase(evt: KeyboardEvent): boolean {
|
|
60
|
+
if (evt.key === 'Escape' && unref(isOpen)) {
|
|
61
|
+
evt.preventDefault();
|
|
62
|
+
isOpen.value = false;
|
|
63
|
+
focusAnchor();
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (evt.key === 'Tab' && unref(isOpen)) {
|
|
68
|
+
isOpen.value = false;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (typeof window !== 'undefined') {
|
|
76
|
+
useClickOutside([options.anchorRef, options.popupRef], isOpen, () => isOpen.value = false);
|
|
77
|
+
useClickOutside(options.anchorRef, isOpen, () => unref(options.focusElement)?.focus());
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
watch(isOpen, opened => {
|
|
81
|
+
if (!opened) {
|
|
82
|
+
options.onClose?.();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
nextTick(() => unref(options.focusElement)?.focus());
|
|
87
|
+
|
|
88
|
+
options.onOpen?.();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
isOpen,
|
|
93
|
+
open,
|
|
94
|
+
close,
|
|
95
|
+
toggle,
|
|
96
|
+
focusAnchor,
|
|
97
|
+
onKeyDownBase
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { FluxFilterValue, FluxFilterValueSingle } from '@flux-ui/types';
|
|
2
|
+
import { type ComputedRef, computed, unref } from 'vue';
|
|
3
|
+
import { useFilterInjection } from '$flux/composable';
|
|
4
|
+
|
|
5
|
+
export type FilterOptionSingle = {
|
|
6
|
+
readonly currentValue: ComputedRef<FluxFilterValueSingle>;
|
|
7
|
+
onSelect(value: FluxFilterValue): void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type FilterOptionMulti = {
|
|
11
|
+
readonly currentValue: ComputedRef<FluxFilterValueSingle[]>;
|
|
12
|
+
onSelect(value: FluxFilterValueSingle): void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function useFilterOptionSingle(name: string): FilterOptionSingle {
|
|
16
|
+
const {back, state, setValue} = useFilterInjection();
|
|
17
|
+
|
|
18
|
+
const currentValue = computed(() => unref(state)[name] as FluxFilterValueSingle);
|
|
19
|
+
|
|
20
|
+
function onSelect(value: FluxFilterValue): void {
|
|
21
|
+
if (unref(currentValue) === value) {
|
|
22
|
+
setValue(name, null);
|
|
23
|
+
} else {
|
|
24
|
+
setValue(name, value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
back();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {currentValue, onSelect};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function useFilterOptionMulti(name: string): FilterOptionMulti {
|
|
34
|
+
const {state, setValue} = useFilterInjection();
|
|
35
|
+
|
|
36
|
+
const currentValue = computed<FluxFilterValueSingle[]>(() => {
|
|
37
|
+
const value = unref(state)[name];
|
|
38
|
+
|
|
39
|
+
if (Array.isArray(value)) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return [];
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
function onSelect(value: FluxFilterValueSingle): void {
|
|
47
|
+
let values = Array.from(unref(currentValue));
|
|
48
|
+
|
|
49
|
+
if (values.includes(value)) {
|
|
50
|
+
values = values.filter(v => v !== value);
|
|
51
|
+
} else {
|
|
52
|
+
values.push(value);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setValue(name, values);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {currentValue, onSelect};
|
|
59
|
+
}
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
.basePaneStructure > .actionBar {
|
|
60
|
-
padding:
|
|
60
|
+
padding: 12px 18px;
|
|
61
61
|
background: var(--gray-50);
|
|
62
62
|
border: 1px solid var(--gray-100);
|
|
63
63
|
border-left: 0;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.paneHeader + .actionBar {
|
|
80
|
-
margin-top:
|
|
80
|
+
margin-top: 18px;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
.actionPane {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.adaptiveGroup {
|
|
2
|
+
display: flex;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
flex-flow: row nowrap;
|
|
5
|
+
gap: var(--gap, 9px);
|
|
6
|
+
min-width: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.adaptiveSlot {
|
|
10
|
+
display: flex;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
flex-flow: row nowrap;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.adaptiveSlotMeasurer {
|
|
17
|
+
position: absolute;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
display: flex;
|
|
21
|
+
visibility: hidden;
|
|
22
|
+
flex-flow: row nowrap;
|
|
23
|
+
width: max-content;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
height: 1em;
|
|
7
7
|
width: 1em;
|
|
8
8
|
flex: 0 0 1em;
|
|
9
|
-
border-radius: .
|
|
9
|
+
border-radius: .3em;
|
|
10
10
|
user-select: none;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -68,19 +68,18 @@
|
|
|
68
68
|
backdrop-filter: blur(3px) saturate(180%);
|
|
69
69
|
|
|
70
70
|
:local(.spinner) {
|
|
71
|
-
--track: rgb(
|
|
71
|
+
--track: rgb(from var(--gray-950) r g b / .12);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.avatarStatus {
|
|
76
76
|
position: absolute;
|
|
77
77
|
display: block;
|
|
78
|
-
right:
|
|
79
|
-
bottom:
|
|
80
|
-
height:
|
|
81
|
-
width:
|
|
82
|
-
|
|
83
|
-
border-radius: 99px;
|
|
78
|
+
right: .021em;
|
|
79
|
+
bottom: .021em;
|
|
80
|
+
height: .27em;
|
|
81
|
+
width: .27em;
|
|
82
|
+
border-radius: var(--radius-full);
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
.avatarStatusGray {
|
|
@@ -134,8 +133,8 @@
|
|
|
134
133
|
|
|
135
134
|
.statusAvatar .avatarFallback,
|
|
136
135
|
.statusAvatar .avatarImage {
|
|
137
|
-
mask:
|
|
138
|
-
-webkit-mask:
|
|
136
|
+
mask: radial-gradient(circle .18em at calc(100% - 0.16em) calc(100% - 0.16em), transparent 100%, #000 100%);
|
|
137
|
+
-webkit-mask: radial-gradient(circle .18em at calc(100% - 0.16em) calc(100% - 0.16em), transparent 100%, #000 100%);
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
.persona {
|
|
@@ -148,7 +147,7 @@
|
|
|
148
147
|
border-radius: var(--radius);
|
|
149
148
|
cursor: pointer;
|
|
150
149
|
text-align: left;
|
|
151
|
-
transition:
|
|
150
|
+
transition: var(--transition-default);
|
|
152
151
|
transition-property: background, mixin.focus-ring-transition-properties();
|
|
153
152
|
|
|
154
153
|
@include mixin.focus-ring(2px);
|