@sewadah/selaras 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +21 -6
- package/dist/runtime/components/AlertDialog.d.vue.ts +5 -3
- package/dist/runtime/components/AlertDialog.vue +17 -9
- package/dist/runtime/components/AlertDialog.vue.d.ts +5 -3
- package/dist/runtime/components/App.vue +2 -0
- package/dist/runtime/components/Autocomplete.d.vue.ts +2 -2
- package/dist/runtime/components/Autocomplete.vue +4 -2
- package/dist/runtime/components/Autocomplete.vue.d.ts +2 -2
- package/dist/runtime/components/Button.d.vue.ts +7 -5
- package/dist/runtime/components/Button.vue +14 -3
- package/dist/runtime/components/Button.vue.d.ts +7 -5
- package/dist/runtime/components/Calendar.d.vue.ts +69 -0
- package/dist/runtime/components/Calendar.vue +163 -0
- package/dist/runtime/components/Calendar.vue.d.ts +69 -0
- package/dist/runtime/components/Callout.vue +12 -1
- package/dist/runtime/components/CodeGroup.vue +13 -3
- package/dist/runtime/components/CodeTree.d.vue.ts +2 -0
- package/dist/runtime/components/CodeTree.vue +52 -1
- package/dist/runtime/components/CodeTree.vue.d.ts +2 -0
- package/dist/runtime/components/ColorModeSwitch.d.vue.ts +18 -0
- package/dist/runtime/components/ColorModeSwitch.vue +59 -0
- package/dist/runtime/components/ColorModeSwitch.vue.d.ts +18 -0
- package/dist/runtime/components/ColorPicker.d.vue.ts +8 -0
- package/dist/runtime/components/ColorPicker.vue +66 -45
- package/dist/runtime/components/ColorPicker.vue.d.ts +8 -0
- package/dist/runtime/components/Column.js +1 -1
- package/dist/runtime/components/CommandPalette.d.vue.ts +3 -1
- package/dist/runtime/components/CommandPalette.vue +5 -0
- package/dist/runtime/components/CommandPalette.vue.d.ts +3 -1
- package/dist/runtime/components/ConfirmRenderer.d.vue.ts +3 -0
- package/dist/runtime/components/ConfirmRenderer.vue +39 -0
- package/dist/runtime/components/ConfirmRenderer.vue.d.ts +3 -0
- package/dist/runtime/components/ContentNavigation.d.vue.ts +8 -1
- package/dist/runtime/components/ContentNavigation.vue +9 -2
- package/dist/runtime/components/ContentNavigation.vue.d.ts +8 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +8 -1
- package/dist/runtime/components/ContextMenu.vue +20 -6
- package/dist/runtime/components/ContextMenu.vue.d.ts +8 -1
- package/dist/runtime/components/DatePicker.d.vue.ts +10 -3
- package/dist/runtime/components/DatePicker.vue +24 -16
- package/dist/runtime/components/DatePicker.vue.d.ts +10 -3
- package/dist/runtime/components/Drawer.vue +3 -2
- package/dist/runtime/components/Dropdown.d.vue.ts +33 -6
- package/dist/runtime/components/Dropdown.vue +146 -12
- package/dist/runtime/components/Dropdown.vue.d.ts +33 -6
- package/dist/runtime/components/FileTree.d.vue.ts +2 -0
- package/dist/runtime/components/FileTree.vue +8 -4
- package/dist/runtime/components/FileTree.vue.d.ts +2 -0
- package/dist/runtime/components/FormField.d.vue.ts +4 -0
- package/dist/runtime/components/FormField.vue +19 -4
- package/dist/runtime/components/FormField.vue.d.ts +4 -0
- package/dist/runtime/components/Input.vue +3 -2
- package/dist/runtime/components/Kbd.vue +12 -2
- package/dist/runtime/components/Modal.vue +3 -2
- package/dist/runtime/components/NavigationMenu.d.vue.ts +10 -10
- package/dist/runtime/components/NavigationMenu.vue +13 -9
- package/dist/runtime/components/NavigationMenu.vue.d.ts +10 -10
- package/dist/runtime/components/NavigationMenuAccordionItem.vue +5 -1
- package/dist/runtime/components/NavigationMenuFlyoutList.vue +7 -4
- package/dist/runtime/components/Popover.d.vue.ts +8 -2
- package/dist/runtime/components/Popover.vue +13 -6
- package/dist/runtime/components/Popover.vue.d.ts +8 -2
- package/dist/runtime/components/ProsePre.d.vue.ts +2 -0
- package/dist/runtime/components/ProsePre.vue +2 -1
- package/dist/runtime/components/ProsePre.vue.d.ts +2 -0
- package/dist/runtime/components/Select.d.vue.ts +8 -4
- package/dist/runtime/components/Select.vue +4 -2
- package/dist/runtime/components/Select.vue.d.ts +8 -4
- package/dist/runtime/components/Slideover.vue +3 -2
- package/dist/runtime/components/SplitterPanel.d.vue.ts +2 -2
- package/dist/runtime/components/SplitterPanel.vue.d.ts +2 -2
- package/dist/runtime/components/Table.vue +95 -26
- package/dist/runtime/components/Tabs.d.vue.ts +44 -4
- package/dist/runtime/components/Tabs.vue +171 -18
- package/dist/runtime/components/Tabs.vue.d.ts +44 -4
- package/dist/runtime/components/Textarea.vue +3 -2
- package/dist/runtime/components/Timeline.d.vue.ts +19 -0
- package/dist/runtime/components/Timeline.vue +99 -0
- package/dist/runtime/components/Timeline.vue.d.ts +19 -0
- package/dist/runtime/components/Toast.d.vue.ts +10 -1
- package/dist/runtime/components/Toast.vue +94 -8
- package/dist/runtime/components/Toast.vue.d.ts +10 -1
- package/dist/runtime/components/Tooltip.d.vue.ts +8 -2
- package/dist/runtime/components/Tooltip.vue +13 -6
- package/dist/runtime/components/Tooltip.vue.d.ts +8 -2
- package/dist/runtime/composables/use-confirm.d.ts +14 -0
- package/dist/runtime/composables/use-confirm.js +28 -0
- package/dist/runtime/composables/use-form-field.d.ts +1 -0
- package/dist/runtime/composables/use-table.d.ts +3 -0
- package/dist/runtime/composables/use-table.js +10 -4
- package/dist/runtime/composables/use-toast.js +5 -1
- package/dist/runtime/directives/hotkey.d.ts +13 -0
- package/dist/runtime/directives/hotkey.js +107 -0
- package/dist/runtime/directives/index.d.ts +2 -0
- package/dist/runtime/directives/index.js +2 -0
- package/dist/runtime/directives/mask.d.ts +30 -0
- package/dist/runtime/directives/mask.js +165 -0
- package/dist/runtime/internal/ComboboxSelectBase.d.vue.ts +41 -36
- package/dist/runtime/internal/ComboboxSelectBase.vue +119 -26
- package/dist/runtime/internal/ComboboxSelectBase.vue.d.ts +41 -36
- package/dist/runtime/internal/ComboboxSelectBody.d.vue.ts +23 -17
- package/dist/runtime/internal/ComboboxSelectBody.vue +50 -11
- package/dist/runtime/internal/ComboboxSelectBody.vue.d.ts +23 -17
- package/dist/runtime/internal/DatePickerCalendarBody.vue +1 -1
- package/dist/runtime/internal/DatePickerRangeCalendarBody.vue +1 -1
- package/dist/runtime/internal/ShortcutHint.d.vue.ts +6 -0
- package/dist/runtime/internal/ShortcutHint.vue +13 -0
- package/dist/runtime/internal/ShortcutHint.vue.d.ts +6 -0
- package/dist/runtime/internal/ToastItemRenderer.d.vue.ts +9 -1
- package/dist/runtime/internal/ToastItemRenderer.vue +55 -8
- package/dist/runtime/internal/ToastItemRenderer.vue.d.ts +9 -1
- package/dist/runtime/internal/combobox-select.d.ts +19 -18
- package/dist/runtime/internal/combobox-select.js +38 -15
- package/dist/runtime/internal/programmatic-services.d.ts +13 -0
- package/dist/runtime/internal/programmatic-services.js +9 -0
- package/dist/runtime/internal/toast-stack.d.ts +36 -0
- package/dist/runtime/internal/toast-stack.js +36 -0
- package/dist/runtime/structural.css +1 -1
- package/dist/runtime/table.d.ts +1 -1
- package/dist/runtime/theme/alert-dialog.js +1 -1
- package/dist/runtime/theme/badge.d.ts +9 -0
- package/dist/runtime/theme/badge.js +2 -1
- package/dist/runtime/theme/button.d.ts +18 -0
- package/dist/runtime/theme/button.js +4 -1
- package/dist/runtime/theme/calendar.d.ts +86 -0
- package/dist/runtime/theme/calendar.js +19 -0
- package/dist/runtime/theme/callout.d.ts +0 -12
- package/dist/runtime/theme/callout.js +8 -8
- package/dist/runtime/theme/code-tree.js +1 -1
- package/dist/runtime/theme/command-palette.js +1 -1
- package/dist/runtime/theme/content-navigation.d.ts +3 -0
- package/dist/runtime/theme/content-navigation.js +1 -0
- package/dist/runtime/theme/drawer.js +1 -1
- package/dist/runtime/theme/dropdown.d.ts +21 -0
- package/dist/runtime/theme/dropdown.js +15 -2
- package/dist/runtime/theme/file-tree.js +1 -1
- package/dist/runtime/theme/form-field.d.ts +18 -0
- package/dist/runtime/theme/form-field.js +6 -1
- package/dist/runtime/theme/modal.js +1 -1
- package/dist/runtime/theme/slideover.js +1 -1
- package/dist/runtime/theme/table.d.ts +27 -0
- package/dist/runtime/theme/table.js +11 -2
- package/dist/runtime/theme/tabs.d.ts +87 -3
- package/dist/runtime/theme/tabs.js +46 -22
- package/dist/runtime/theme/timeline.d.ts +251 -0
- package/dist/runtime/theme/timeline.js +84 -0
- package/dist/runtime/theme/toast.d.ts +92 -0
- package/dist/runtime/theme/toast.js +29 -7
- package/dist/runtime/theme-config.d.ts +13 -2
- package/dist/runtime/types/index.d.ts +10 -2
- package/dist/runtime/utils/arrow.d.ts +21 -0
- package/dist/runtime/utils/arrow.js +10 -0
- package/dist/runtime/utils/autocomplete-contracts.d.ts +4 -4
- package/dist/runtime/utils/file-icons.js +3 -0
- package/dist/runtime/utils/icons.d.ts +2 -0
- package/dist/runtime/utils/icons.js +2 -0
- package/dist/runtime/utils/messages.d.ts +7 -0
- package/dist/runtime/utils/messages.js +7 -0
- package/dist/runtime/utils/navigation-menu.d.ts +7 -0
- package/dist/runtime/utils/navigation-menu.js +3 -0
- package/dist/runtime/utils/overlay.d.ts +17 -0
- package/dist/runtime/utils/overlay.js +7 -0
- package/dist/runtime/utils/select-contracts.d.ts +25 -11
- package/dist/runtime/utils/table-columns.js +1 -1
- package/dist/runtime/utils/table-contracts.d.ts +9 -1
- package/dist/runtime/utils/timeline-contracts.d.ts +42 -0
- package/dist/runtime/utils/timeline-contracts.js +0 -0
- package/dist/runtime/utils/ui.d.ts +11 -0
- package/dist/runtime/utils/ui.js +54 -1
- package/package.json +6 -5
|
@@ -45,19 +45,19 @@ declare var __VLS_8: {}, __VLS_17: string, __VLS_18: {
|
|
|
45
45
|
}, __VLS_124: string, __VLS_125: {
|
|
46
46
|
item: NavigationMenuItem;
|
|
47
47
|
active: boolean;
|
|
48
|
-
},
|
|
48
|
+
}, __VLS_147: string, __VLS_148: {
|
|
49
49
|
item: NavigationMenuItem;
|
|
50
50
|
active: boolean;
|
|
51
|
-
},
|
|
51
|
+
}, __VLS_151: string, __VLS_152: {
|
|
52
52
|
item: NavigationMenuItem;
|
|
53
53
|
active: boolean;
|
|
54
|
-
},
|
|
54
|
+
}, __VLS_160: string, __VLS_161: {
|
|
55
55
|
item: NavigationMenuItem;
|
|
56
56
|
active: boolean;
|
|
57
|
-
},
|
|
57
|
+
}, __VLS_164: string, __VLS_165: {
|
|
58
58
|
item: NavigationMenuItem;
|
|
59
59
|
active: boolean;
|
|
60
|
-
},
|
|
60
|
+
}, __VLS_172: {};
|
|
61
61
|
type __VLS_Slots = {} & {
|
|
62
62
|
[K in NonNullable<typeof __VLS_17>]?: (props: typeof __VLS_18) => any;
|
|
63
63
|
} & {
|
|
@@ -83,17 +83,17 @@ type __VLS_Slots = {} & {
|
|
|
83
83
|
} & {
|
|
84
84
|
[K in NonNullable<typeof __VLS_124>]?: (props: typeof __VLS_125) => any;
|
|
85
85
|
} & {
|
|
86
|
-
[K in NonNullable<typeof
|
|
86
|
+
[K in NonNullable<typeof __VLS_147>]?: (props: typeof __VLS_148) => any;
|
|
87
87
|
} & {
|
|
88
|
-
[K in NonNullable<typeof
|
|
88
|
+
[K in NonNullable<typeof __VLS_151>]?: (props: typeof __VLS_152) => any;
|
|
89
89
|
} & {
|
|
90
|
-
[K in NonNullable<typeof
|
|
90
|
+
[K in NonNullable<typeof __VLS_160>]?: (props: typeof __VLS_161) => any;
|
|
91
91
|
} & {
|
|
92
|
-
[K in NonNullable<typeof
|
|
92
|
+
[K in NonNullable<typeof __VLS_164>]?: (props: typeof __VLS_165) => any;
|
|
93
93
|
} & {
|
|
94
94
|
'list-leading'?: (props: typeof __VLS_8) => any;
|
|
95
95
|
} & {
|
|
96
|
-
'list-trailing'?: (props: typeof
|
|
96
|
+
'list-trailing'?: (props: typeof __VLS_172) => any;
|
|
97
97
|
};
|
|
98
98
|
declare const __VLS_base: import("vue").DefineComponent<NavigationMenuProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NavigationMenuProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
99
99
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import { computed, useId, useSlots } from "vue";
|
|
3
3
|
import { NuxtLink } from "#components";
|
|
4
4
|
import { useRoute } from "#imports";
|
|
5
|
+
import { vHotkey } from "../directives/hotkey";
|
|
6
|
+
import ShortcutHint from "../internal/ShortcutHint.vue";
|
|
5
7
|
import { navigationMenuTheme } from "../theme/navigation-menu";
|
|
6
|
-
import { isNavigationMenuItemActive } from "../utils/navigation-menu";
|
|
8
|
+
import { isNavigationMenuItemActive, navigationMenuHotkey } from "../utils/navigation-menu";
|
|
7
9
|
import { resolveRegisteredColorRole } from "../utils/registered-colors";
|
|
8
10
|
import { resolveSlot, useComponentTheme } from "../utils/ui";
|
|
9
11
|
import Accordion from "./Accordion.vue";
|
|
@@ -83,6 +85,7 @@ function onSelect(item, event) {
|
|
|
83
85
|
<component
|
|
84
86
|
:is="child.to ? NuxtLink : 'button'"
|
|
85
87
|
v-else
|
|
88
|
+
v-hotkey="navigationMenuHotkey(child)"
|
|
86
89
|
:to="child.to"
|
|
87
90
|
:type="child.to ? void 0 : 'button'"
|
|
88
91
|
:disabled="child.to ? void 0 : child.disabled"
|
|
@@ -98,6 +101,7 @@ function onSelect(item, event) {
|
|
|
98
101
|
<span v-bind="resolveSlot(ui.linkLabel, props.ui?.linkLabel)">{{ child.label }}</span>
|
|
99
102
|
</slot>
|
|
100
103
|
<slot :name="slotName(child, '-trailing')" :item="child" :active="isActive(child)" />
|
|
104
|
+
<ShortcutHint :shortcut="child.shortcut" />
|
|
101
105
|
</slot>
|
|
102
106
|
</component>
|
|
103
107
|
</li>
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { NuxtLink } from "#components";
|
|
4
4
|
import { useRoute } from "#imports";
|
|
5
|
+
import { vHotkey } from "../directives/hotkey";
|
|
6
|
+
import ShortcutHint from "../internal/ShortcutHint.vue";
|
|
5
7
|
import { navigationMenuTheme } from "../theme/navigation-menu";
|
|
6
|
-
import { isNavigationMenuItemActive } from "../utils/navigation-menu";
|
|
8
|
+
import { isNavigationMenuItemActive, navigationMenuHotkey } from "../utils/navigation-menu";
|
|
7
9
|
import { resolveRegisteredColorRole } from "../utils/registered-colors";
|
|
8
10
|
import { resolveSlot, useComponentTheme, useThemeBindings } from "../utils/ui";
|
|
9
11
|
import Icon from "./Icon.vue";
|
|
@@ -35,12 +37,13 @@ function linkProps(item) {
|
|
|
35
37
|
<li v-for="item in items" :key="item.label" v-bind="resolveSlot(ui.childItem, props.ui?.childItem)">
|
|
36
38
|
<NavigationMenuAccordionItem v-if="item.children?.length" :item="item" :color="color" :variant="variant" :highlight="highlight" :ui="props.ui" />
|
|
37
39
|
<component
|
|
38
|
-
:is="item.to ? NuxtLink : 'button'" v-else
|
|
39
|
-
:
|
|
40
|
-
:aria-disabled="item.to && item.disabled ? 'true' : void 0" @click="onSelect(item, $event)"
|
|
40
|
+
:is="item.to ? NuxtLink : 'button'" v-else v-hotkey="navigationMenuHotkey(item)" :to="item.to"
|
|
41
|
+
:type="item.to ? void 0 : 'button'" :disabled="item.to ? void 0 : item.disabled"
|
|
42
|
+
v-bind="linkProps(item)" :aria-disabled="item.to && item.disabled ? 'true' : void 0" @click="onSelect(item, $event)"
|
|
41
43
|
>
|
|
42
44
|
<Icon v-if="item.icon" :name="item.icon" v-bind="resolveSlot(ui.linkIcon, props.ui?.linkIcon)" />
|
|
43
45
|
<span v-bind="resolveSlot(ui.linkLabel, props.ui?.linkLabel)">{{ item.label }}</span>
|
|
46
|
+
<ShortcutHint :shortcut="item.shortcut" />
|
|
44
47
|
</component>
|
|
45
48
|
</li>
|
|
46
49
|
</ul>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { PopoverThemeSlots } from '../theme/popover.js';
|
|
2
|
+
import type { RoundedArrowConfig } from '../utils/arrow.js';
|
|
3
|
+
import type { OverlayPortal, OverlayPositioning } from '../utils/overlay.js';
|
|
2
4
|
import type { UiProp } from '../utils/ui.js';
|
|
3
5
|
export interface PopoverProps {
|
|
4
6
|
open?: boolean;
|
|
@@ -6,14 +8,18 @@ export interface PopoverProps {
|
|
|
6
8
|
defaultOpen?: boolean;
|
|
7
9
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
8
10
|
align?: 'start' | 'center' | 'end';
|
|
11
|
+
/** Anchored panel positioning. Overrides `side` and `align` when supplied. */
|
|
12
|
+
positioning?: OverlayPositioning;
|
|
13
|
+
/** Teleport target, or `false` to render the panel inline. Defaults to `body`. */
|
|
14
|
+
portal?: OverlayPortal;
|
|
9
15
|
/** Forwarded to Reka UI's own PopoverRoot `modal` prop - `true` traps focus and blocks interaction with the rest of the page, like a lightweight modal dialog. */
|
|
10
16
|
modal?: boolean;
|
|
11
17
|
/** When `false`, Escape and an outside click (or, since a popover is non-modal by default, an outside element merely receiving focus) no longer close the popover - the `escapeKeyDown`/`pointerDownOutside`/`focusOutside` events still fire, so a consumer can still react, but none of them close it on their own anymore. */
|
|
12
18
|
dismissible?: boolean;
|
|
13
19
|
/** When `false`, closing the popover no longer returns keyboard focus to its trigger. Reka does this by default regardless of *why* the popover closed, including a purely programmatic `open` change - which matters for a popover that can open via hover rather than a deliberate click/keypress: focus landing back on a trigger nobody meant to focus can itself count as focus moving "outside" whatever *other* popover the pointer has since moved on to, closing that one too. Defaults to `true`, matching Reka's own out-of-the-box behavior. */
|
|
14
20
|
returnFocusOnClose?: boolean;
|
|
15
|
-
/** Shows the
|
|
16
|
-
arrow?: boolean;
|
|
21
|
+
/** Shows the pointer; an object configures its size, rounding, and edge clearance. */
|
|
22
|
+
arrow?: boolean | RoundedArrowConfig;
|
|
17
23
|
ui?: UiProp<PopoverThemeSlots>;
|
|
18
24
|
}
|
|
19
25
|
export interface PopoverEmits {
|
|
@@ -2,16 +2,21 @@
|
|
|
2
2
|
import { PopoverArrow, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger } from "reka-ui";
|
|
3
3
|
import { computed, getCurrentInstance, ref, watch } from "vue";
|
|
4
4
|
import { popoverTheme } from "../theme/popover";
|
|
5
|
-
import {
|
|
5
|
+
import { arrowContentProps, arrowElementProps } from "../utils/arrow";
|
|
6
|
+
import { overlayPortalProps } from "../utils/overlay";
|
|
7
|
+
import { resolveSlot, useComponentTheme, useFallthroughProps, useThemeBindings } from "../utils/ui";
|
|
8
|
+
defineOptions({ inheritAttrs: false });
|
|
6
9
|
const props = defineProps({
|
|
7
10
|
open: { type: Boolean, required: false, default: void 0 },
|
|
8
11
|
defaultOpen: { type: Boolean, required: false },
|
|
9
12
|
side: { type: String, required: false, default: "bottom" },
|
|
10
13
|
align: { type: String, required: false, default: "center" },
|
|
14
|
+
positioning: { type: Object, required: false },
|
|
15
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: void 0 },
|
|
11
16
|
modal: { type: Boolean, required: false, default: false },
|
|
12
17
|
dismissible: { type: Boolean, required: false, default: true },
|
|
13
18
|
returnFocusOnClose: { type: Boolean, required: false, default: true },
|
|
14
|
-
arrow: { type: Boolean, required: false, default: false },
|
|
19
|
+
arrow: { type: [Boolean, Object], required: false, default: false },
|
|
15
20
|
ui: { type: Object, required: false }
|
|
16
21
|
});
|
|
17
22
|
const emit = defineEmits(["update:open", "escapeKeyDown", "pointerDownOutside", "focusOutside", "openAutoFocus"]);
|
|
@@ -41,8 +46,10 @@ function onOpenAutoFocus(event) {
|
|
|
41
46
|
const theme = useComponentTheme("popover", popoverTheme);
|
|
42
47
|
const themeBindings = useThemeBindings();
|
|
43
48
|
const ui = computed(() => theme.value());
|
|
44
|
-
const
|
|
45
|
-
const
|
|
49
|
+
const triggerProps = useFallthroughProps();
|
|
50
|
+
const contentProps = computed(() => ({ ...resolveSlot(ui.value.content, props.ui?.content), ...arrowContentProps(props.arrow), ...props.positioning }));
|
|
51
|
+
const portalProps = computed(() => overlayPortalProps(props.portal));
|
|
52
|
+
const arrowProps = computed(() => ({ ...resolveSlot(ui.value.arrow, props.ui?.arrow), ...arrowElementProps(props.arrow) }));
|
|
46
53
|
const isControlled = Object.hasOwn(getCurrentInstance()?.vnode.props ?? {}, "open");
|
|
47
54
|
const internalOpen = ref(props.open ?? props.defaultOpen ?? false);
|
|
48
55
|
watch(() => props.open, (value) => {
|
|
@@ -58,10 +65,10 @@ function onUpdateOpen(value) {
|
|
|
58
65
|
|
|
59
66
|
<template>
|
|
60
67
|
<PopoverRoot :open="internalOpen" :modal="modal" @update:open="onUpdateOpen">
|
|
61
|
-
<PopoverTrigger v-if="$slots.default" as-child>
|
|
68
|
+
<PopoverTrigger v-if="$slots.default" as-child v-bind="triggerProps">
|
|
62
69
|
<slot />
|
|
63
70
|
</PopoverTrigger>
|
|
64
|
-
<PopoverPortal>
|
|
71
|
+
<PopoverPortal v-bind="portalProps">
|
|
65
72
|
<PopoverContent
|
|
66
73
|
:data-selaras-theme="themeBindings['data-selaras-theme']"
|
|
67
74
|
:data-selaras-mode="themeBindings['data-selaras-mode']"
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { PopoverThemeSlots } from '../theme/popover.js';
|
|
2
|
+
import type { RoundedArrowConfig } from '../utils/arrow.js';
|
|
3
|
+
import type { OverlayPortal, OverlayPositioning } from '../utils/overlay.js';
|
|
2
4
|
import type { UiProp } from '../utils/ui.js';
|
|
3
5
|
export interface PopoverProps {
|
|
4
6
|
open?: boolean;
|
|
@@ -6,14 +8,18 @@ export interface PopoverProps {
|
|
|
6
8
|
defaultOpen?: boolean;
|
|
7
9
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
8
10
|
align?: 'start' | 'center' | 'end';
|
|
11
|
+
/** Anchored panel positioning. Overrides `side` and `align` when supplied. */
|
|
12
|
+
positioning?: OverlayPositioning;
|
|
13
|
+
/** Teleport target, or `false` to render the panel inline. Defaults to `body`. */
|
|
14
|
+
portal?: OverlayPortal;
|
|
9
15
|
/** Forwarded to Reka UI's own PopoverRoot `modal` prop - `true` traps focus and blocks interaction with the rest of the page, like a lightweight modal dialog. */
|
|
10
16
|
modal?: boolean;
|
|
11
17
|
/** When `false`, Escape and an outside click (or, since a popover is non-modal by default, an outside element merely receiving focus) no longer close the popover - the `escapeKeyDown`/`pointerDownOutside`/`focusOutside` events still fire, so a consumer can still react, but none of them close it on their own anymore. */
|
|
12
18
|
dismissible?: boolean;
|
|
13
19
|
/** When `false`, closing the popover no longer returns keyboard focus to its trigger. Reka does this by default regardless of *why* the popover closed, including a purely programmatic `open` change - which matters for a popover that can open via hover rather than a deliberate click/keypress: focus landing back on a trigger nobody meant to focus can itself count as focus moving "outside" whatever *other* popover the pointer has since moved on to, closing that one too. Defaults to `true`, matching Reka's own out-of-the-box behavior. */
|
|
14
20
|
returnFocusOnClose?: boolean;
|
|
15
|
-
/** Shows the
|
|
16
|
-
arrow?: boolean;
|
|
21
|
+
/** Shows the pointer; an object configures its size, rounding, and edge clearance. */
|
|
22
|
+
arrow?: boolean | RoundedArrowConfig;
|
|
17
23
|
ui?: UiProp<PopoverThemeSlots>;
|
|
18
24
|
}
|
|
19
25
|
export interface PopoverEmits {
|
|
@@ -4,6 +4,8 @@ export interface ProsePreProps {
|
|
|
4
4
|
filename?: string;
|
|
5
5
|
/** Overrides the file-type icon resolved from `filename`/`language`. */
|
|
6
6
|
icon?: string;
|
|
7
|
+
/** Renders the metadata and copy row above the code. @default true */
|
|
8
|
+
showHeader?: boolean;
|
|
7
9
|
highlights?: number[];
|
|
8
10
|
meta?: string;
|
|
9
11
|
}
|
|
@@ -13,6 +13,7 @@ const props = defineProps({
|
|
|
13
13
|
language: { type: String, required: false },
|
|
14
14
|
filename: { type: String, required: false },
|
|
15
15
|
icon: { type: String, required: false },
|
|
16
|
+
showHeader: { type: Boolean, required: false, default: true },
|
|
16
17
|
highlights: { type: Array, required: false },
|
|
17
18
|
meta: { type: String, required: false }
|
|
18
19
|
});
|
|
@@ -35,7 +36,7 @@ async function copy() {
|
|
|
35
36
|
|
|
36
37
|
<template>
|
|
37
38
|
<div v-bind="resolveSlot(ui.preWrapper, void 0)">
|
|
38
|
-
<div v-if="filename || language || code" v-bind="resolveSlot(ui.preHeader, void 0)">
|
|
39
|
+
<div v-if="showHeader && (filename || language || code)" v-bind="resolveSlot(ui.preHeader, void 0)">
|
|
39
40
|
<span v-bind="resolveSlot(ui.preLabel, void 0)">
|
|
40
41
|
<Icon v-if="fileIcon" :name="fileIcon" v-bind="resolveSlot(ui.preIcon, void 0)" />
|
|
41
42
|
<span v-if="filename" v-bind="resolveSlot(ui.preFilename, void 0)">{{ filename }}</span>
|
|
@@ -4,6 +4,8 @@ export interface ProsePreProps {
|
|
|
4
4
|
filename?: string;
|
|
5
5
|
/** Overrides the file-type icon resolved from `filename`/`language`. */
|
|
6
6
|
icon?: string;
|
|
7
|
+
/** Renders the metadata and copy row above the code. @default true */
|
|
8
|
+
showHeader?: boolean;
|
|
7
9
|
highlights?: number[];
|
|
8
10
|
meta?: string;
|
|
9
11
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SelectEntry, SelectEntryItem, SelectModel, SelectProps, SelectSlots } from '../utils/select-contracts.js';
|
|
2
2
|
export type { SelectEmits, SelectProps, SelectSlots } from '../utils/select-contracts.js';
|
|
3
|
-
declare const __VLS_export: <Entry extends
|
|
3
|
+
declare const __VLS_export: <Entry extends SelectEntry, Key extends string = "value", Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<SelectProps<Entry, Key, Multiple> & {
|
|
5
|
-
"onUpdate:modelValue"?: ((value: SelectModel<
|
|
5
|
+
"onUpdate:modelValue"?: ((value: SelectModel<SelectEntryItem<Entry> extends infer T ? T extends SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
6
|
+
value: infer Value;
|
|
7
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never, Multiple>) => any) | undefined;
|
|
6
8
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
7
9
|
"onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
8
10
|
}> & (typeof globalThis extends {
|
|
@@ -11,7 +13,9 @@ declare const __VLS_export: <Entry extends object, Key extends string = "value",
|
|
|
11
13
|
expose: (exposed: {}) => void;
|
|
12
14
|
attrs: any;
|
|
13
15
|
slots: SelectSlots<Entry, Key>;
|
|
14
|
-
emit: ((evt: "update:modelValue", value: SelectModel<
|
|
16
|
+
emit: ((evt: "update:modelValue", value: SelectModel<SelectEntryItem<Entry> extends infer T ? T extends SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
17
|
+
value: infer Value;
|
|
18
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never, Multiple>) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:searchTerm", value: string) => void);
|
|
15
19
|
}>) => import("vue").VNode & {
|
|
16
20
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
17
21
|
};
|
|
@@ -7,7 +7,7 @@ const props = defineProps({
|
|
|
7
7
|
name: { type: String, required: false },
|
|
8
8
|
form: { type: String, required: false },
|
|
9
9
|
items: { type: Array, required: true },
|
|
10
|
-
valueKey: { type:
|
|
10
|
+
valueKey: { type: void 0, required: false },
|
|
11
11
|
labelKey: { type: String, required: false },
|
|
12
12
|
open: { type: Boolean, required: false },
|
|
13
13
|
defaultOpen: { type: Boolean, required: false },
|
|
@@ -29,7 +29,9 @@ const props = defineProps({
|
|
|
29
29
|
searchTerm: { type: String, required: false },
|
|
30
30
|
resetSearchTermOnBlur: { type: Boolean, required: false },
|
|
31
31
|
resetSearchTermOnSelect: { type: Boolean, required: false },
|
|
32
|
-
arrow: { type: Boolean, required: false },
|
|
32
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
33
|
+
positioning: { type: Object, required: false },
|
|
34
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: void 0 },
|
|
33
35
|
adaptive: { type: Boolean, required: false },
|
|
34
36
|
ui: { type: Object, required: false }
|
|
35
37
|
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SelectEntry, SelectEntryItem, SelectModel, SelectProps, SelectSlots } from '../utils/select-contracts.js';
|
|
2
2
|
export type { SelectEmits, SelectProps, SelectSlots } from '../utils/select-contracts.js';
|
|
3
|
-
declare const __VLS_export: <Entry extends
|
|
3
|
+
declare const __VLS_export: <Entry extends SelectEntry, Key extends string = "value", Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<SelectProps<Entry, Key, Multiple> & {
|
|
5
|
-
"onUpdate:modelValue"?: ((value: SelectModel<
|
|
5
|
+
"onUpdate:modelValue"?: ((value: SelectModel<SelectEntryItem<Entry> extends infer T ? T extends SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
6
|
+
value: infer Value;
|
|
7
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never, Multiple>) => any) | undefined;
|
|
6
8
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
7
9
|
"onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
8
10
|
}> & (typeof globalThis extends {
|
|
@@ -11,7 +13,9 @@ declare const __VLS_export: <Entry extends object, Key extends string = "value",
|
|
|
11
13
|
expose: (exposed: {}) => void;
|
|
12
14
|
attrs: any;
|
|
13
15
|
slots: SelectSlots<Entry, Key>;
|
|
14
|
-
emit: ((evt: "update:modelValue", value: SelectModel<
|
|
16
|
+
emit: ((evt: "update:modelValue", value: SelectModel<SelectEntryItem<Entry> extends infer T ? T extends SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
17
|
+
value: infer Value;
|
|
18
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never, Multiple>) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:searchTerm", value: string) => void);
|
|
15
19
|
}>) => import("vue").VNode & {
|
|
16
20
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
17
21
|
};
|
|
@@ -4,9 +4,10 @@ import { computed, getCurrentInstance, ref, useSlots, watch, watchEffect } from
|
|
|
4
4
|
import { useIcons } from "../composables/use-icons";
|
|
5
5
|
import { useMessages } from "../composables/use-messages";
|
|
6
6
|
import { slideoverTheme } from "../theme/slideover";
|
|
7
|
-
import { resolveSlot, useComponentTheme, useThemeBindings } from "../utils/ui";
|
|
7
|
+
import { resolveSlot, useComponentTheme, useRootProps, useThemeBindings } from "../utils/ui";
|
|
8
8
|
import Button from "./Button.vue";
|
|
9
9
|
import Icon from "./Icon.vue";
|
|
10
|
+
defineOptions({ inheritAttrs: false });
|
|
10
11
|
const props = defineProps({
|
|
11
12
|
open: { type: Boolean, required: false, default: void 0 },
|
|
12
13
|
defaultOpen: { type: Boolean, required: false },
|
|
@@ -70,8 +71,8 @@ const messages = useMessages();
|
|
|
70
71
|
const theme = useComponentTheme("slideover", slideoverTheme);
|
|
71
72
|
const themeBindings = useThemeBindings();
|
|
72
73
|
const ui = computed(() => theme.value({ side: props.side, inset: props.inset, transition: props.transition }));
|
|
74
|
+
const contentProps = useRootProps(() => ui.value.content, () => props.ui?.content);
|
|
73
75
|
const overlayProps = computed(() => resolveSlot(ui.value.overlay, props.ui?.overlay));
|
|
74
|
-
const contentProps = computed(() => resolveSlot(ui.value.content, props.ui?.content));
|
|
75
76
|
const headerProps = computed(() => resolveSlot(ui.value.header, props.ui?.header));
|
|
76
77
|
const titleProps = computed(() => resolveSlot(ui.value.title, props.ui?.title));
|
|
77
78
|
const descriptionProps = computed(() => resolveSlot(ui.value.description, props.ui?.description));
|
|
@@ -37,13 +37,13 @@ declare const __VLS_base: import("vue").DefineComponent<SplitterPanelProps, {
|
|
|
37
37
|
isCollapsed: import("vue").ComputedRef<boolean>;
|
|
38
38
|
isExpanded: import("vue").ComputedRef<boolean>;
|
|
39
39
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
40
|
+
expand: () => any;
|
|
40
41
|
resize: (size: number) => any;
|
|
41
42
|
collapse: () => any;
|
|
42
|
-
expand: () => any;
|
|
43
43
|
}, string, import("vue").PublicProps, Readonly<SplitterPanelProps> & Readonly<{
|
|
44
|
+
onExpand?: (() => any) | undefined;
|
|
44
45
|
onResize?: ((size: number) => any) | undefined;
|
|
45
46
|
onCollapse?: (() => any) | undefined;
|
|
46
|
-
onExpand?: (() => any) | undefined;
|
|
47
47
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
48
48
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
49
49
|
declare const _default: typeof __VLS_export;
|
|
@@ -37,13 +37,13 @@ declare const __VLS_base: import("vue").DefineComponent<SplitterPanelProps, {
|
|
|
37
37
|
isCollapsed: import("vue").ComputedRef<boolean>;
|
|
38
38
|
isExpanded: import("vue").ComputedRef<boolean>;
|
|
39
39
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
40
|
+
expand: () => any;
|
|
40
41
|
resize: (size: number) => any;
|
|
41
42
|
collapse: () => any;
|
|
42
|
-
expand: () => any;
|
|
43
43
|
}, string, import("vue").PublicProps, Readonly<SplitterPanelProps> & Readonly<{
|
|
44
|
+
onExpand?: (() => any) | undefined;
|
|
44
45
|
onResize?: ((size: number) => any) | undefined;
|
|
45
46
|
onCollapse?: (() => any) | undefined;
|
|
46
|
-
onExpand?: (() => any) | undefined;
|
|
47
47
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
48
48
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
49
49
|
declare const _default: typeof __VLS_export;
|
|
@@ -15,11 +15,14 @@ import Checkbox from "./Checkbox.vue";
|
|
|
15
15
|
import Icon from "./Icon.vue";
|
|
16
16
|
import Input from "./Input.vue";
|
|
17
17
|
import Pagination from "./Pagination.vue";
|
|
18
|
+
import Popover from "./Popover.vue";
|
|
18
19
|
defineOptions({ inheritAttrs: false });
|
|
19
20
|
const props = defineProps({
|
|
20
21
|
data: { type: Array, required: true },
|
|
21
22
|
columns: { type: Array, required: false },
|
|
22
23
|
selectable: { type: Boolean, required: false },
|
|
24
|
+
rowHover: { type: Boolean, required: false },
|
|
25
|
+
selectOnRowClick: { type: Boolean, required: false },
|
|
23
26
|
pageSize: { type: Number, required: false },
|
|
24
27
|
loading: { type: Boolean, required: false },
|
|
25
28
|
sorting: { type: null, required: false },
|
|
@@ -32,6 +35,8 @@ const props = defineProps({
|
|
|
32
35
|
gridlines: { type: Boolean, required: false },
|
|
33
36
|
striped: { type: Boolean, required: false },
|
|
34
37
|
expandable: { type: Boolean, required: false },
|
|
38
|
+
tree: { type: Boolean, required: false },
|
|
39
|
+
getSubRows: { type: Function, required: false },
|
|
35
40
|
expanded: { type: null, required: false },
|
|
36
41
|
columnVisibility: { type: null, required: false },
|
|
37
42
|
columnToggle: { type: Boolean, required: false },
|
|
@@ -56,7 +61,8 @@ const ui = computed(() => theme.value({
|
|
|
56
61
|
color: effectiveColor.value,
|
|
57
62
|
gridlines: props.gridlines,
|
|
58
63
|
striped: props.striped,
|
|
59
|
-
scrollable: !!props.scrollHeight
|
|
64
|
+
scrollable: !!props.scrollHeight,
|
|
65
|
+
rowHover: props.rowHover
|
|
60
66
|
}));
|
|
61
67
|
const selectColumn = {
|
|
62
68
|
id: "__select__",
|
|
@@ -88,7 +94,7 @@ const expandColumn = {
|
|
|
88
94
|
};
|
|
89
95
|
const columns = computed(() => {
|
|
90
96
|
const base = props.columns ?? convertChildrenToColumns(slots.default?.());
|
|
91
|
-
const withExpand = props.expandable ? [expandColumn, ...base] : base;
|
|
97
|
+
const withExpand = props.expandable && !props.tree ? [expandColumn, ...base] : base;
|
|
92
98
|
return props.selectable ? [selectColumn, ...withExpand] : withExpand;
|
|
93
99
|
});
|
|
94
100
|
const columnPinning = computed(() => collectColumnPinning(columns.value));
|
|
@@ -111,7 +117,7 @@ const theadProps = computed(() => resolveSlot(ui.value.thead, props.ui?.thead));
|
|
|
111
117
|
const trProps = computed(() => resolveSlot(ui.value.tr, props.ui?.tr));
|
|
112
118
|
const instance = getCurrentInstance();
|
|
113
119
|
function isRowClickable() {
|
|
114
|
-
return !!instance?.vnode.props?.onRowClick;
|
|
120
|
+
return !!props.selectable && props.selectOnRowClick || !!instance?.vnode.props?.onRowClick;
|
|
115
121
|
}
|
|
116
122
|
function bodyRowProps(rowOriginal) {
|
|
117
123
|
const extraClass = [
|
|
@@ -122,7 +128,13 @@ function bodyRowProps(rowOriginal) {
|
|
|
122
128
|
const rowStyle = props.rowStyle?.(rowOriginal);
|
|
123
129
|
return rowStyle ? { ...base, style: { ...base.style, ...rowStyle } } : base;
|
|
124
130
|
}
|
|
125
|
-
function onRowClick(rowOriginal, event) {
|
|
131
|
+
function onRowClick(rowOriginal, event, toggleSelection) {
|
|
132
|
+
const target = event.target;
|
|
133
|
+
const clickedControl = target instanceof Element && target.closest(
|
|
134
|
+
'a, button, input, select, textarea, [role="button"], [role="checkbox"], [role="radio"], [role="link"], [contenteditable="true"], [data-row-click-ignore]'
|
|
135
|
+
);
|
|
136
|
+
if (props.selectable && props.selectOnRowClick && !clickedControl)
|
|
137
|
+
toggleSelection?.();
|
|
126
138
|
emit("rowClick", rowOriginal, event);
|
|
127
139
|
}
|
|
128
140
|
function onRowContextmenu(rowOriginal, event) {
|
|
@@ -135,6 +147,9 @@ const tdProps = computed(() => resolveSlot(ui.value.td, props.ui?.td));
|
|
|
135
147
|
const tfootProps = computed(() => resolveSlot(ui.value.tfoot, props.ui?.tfoot));
|
|
136
148
|
const emptyStateProps = computed(() => resolveSlot(ui.value.emptyState, props.ui?.emptyState));
|
|
137
149
|
const filterInputProps = computed(() => resolveSlot(ui.value.filterInput, props.ui?.filterInput));
|
|
150
|
+
const filterButtonProps = computed(() => resolveSlot(ui.value.filterButton, props.ui?.filterButton));
|
|
151
|
+
const filterIconProps = computed(() => resolveSlot(ui.value.filterIcon, props.ui?.filterIcon));
|
|
152
|
+
const filterPopoverProps = computed(() => resolveSlot(ui.value.filterPopover, props.ui?.filterPopover));
|
|
138
153
|
const paginationWrapperProps = computed(() => resolveSlot(ui.value.paginationWrapper, props.ui?.paginationWrapper));
|
|
139
154
|
const paginationInfoProps = computed(() => resolveSlot(ui.value.paginationInfo, props.ui?.paginationInfo));
|
|
140
155
|
const paginationButtonsProps = computed(() => resolveSlot(ui.value.paginationButtons, props.ui?.paginationButtons));
|
|
@@ -148,6 +163,8 @@ const columnToggleItemProps = computed(() => resolveSlot(ui.value.columnToggleIt
|
|
|
148
163
|
const hasFooter = computed(
|
|
149
164
|
() => table.getFooterGroups().some((group) => group.headers.some((header) => header.column.columnDef.footer))
|
|
150
165
|
);
|
|
166
|
+
const treeColumnId = computed(() => table.getVisibleLeafColumns().find((column) => !column.id.startsWith("__"))?.id);
|
|
167
|
+
const treeCellProps = computed(() => resolveSlot(ui.value.treeCell, props.ui?.treeCell));
|
|
151
168
|
const headerRefs = /* @__PURE__ */ new Map();
|
|
152
169
|
function setHeaderRef(id, el) {
|
|
153
170
|
if (el)
|
|
@@ -255,26 +272,56 @@ defineExpose({
|
|
|
255
272
|
@keydown.space.prevent="header.column.getToggleSortingHandler()?.($event)"
|
|
256
273
|
>
|
|
257
274
|
<template v-if="!header.isPlaceholder || header.rowSpan > 1">
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
v-else-if="header.column.getIsSorted() === 'desc'"
|
|
266
|
-
:name="icons.sortDescending"
|
|
267
|
-
v-bind="sortIconProps"
|
|
268
|
-
/>
|
|
269
|
-
<div v-if="header.column.getCanFilter()">
|
|
270
|
-
<Input
|
|
271
|
-
size="sm"
|
|
272
|
-
:model-value="header.column.getFilterValue() ?? ''"
|
|
273
|
-
:placeholder="messages.filterPlaceholder"
|
|
274
|
-
v-bind="filterInputProps"
|
|
275
|
-
@click.stop
|
|
276
|
-
@update:model-value="(value) => header.column.setFilterValue(value)"
|
|
275
|
+
<div :class="applyClassPrefix('inline-flex items-center gap-1')">
|
|
276
|
+
<FlexRender :header="header" />
|
|
277
|
+
<Icon
|
|
278
|
+
v-if="header.column.getCanSort()"
|
|
279
|
+
:name="header.column.getIsSorted() === 'asc' ? icons.sortAscending : header.column.getIsSorted() === 'desc' ? icons.sortDescending : icons.sortUnsorted"
|
|
280
|
+
:data-sort-state="header.column.getIsSorted() || 'none'"
|
|
281
|
+
v-bind="sortIconProps"
|
|
277
282
|
/>
|
|
283
|
+
<Popover v-if="header.column.getCanFilter()" side="bottom" align="start" :ui="{ content: filterPopoverProps }">
|
|
284
|
+
<Button
|
|
285
|
+
v-bind="filterButtonProps"
|
|
286
|
+
variant="ghost"
|
|
287
|
+
:color="header.column.getIsFiltered() ? 'primary' : 'neutral'"
|
|
288
|
+
size="sm"
|
|
289
|
+
square
|
|
290
|
+
:aria-label="messages.filterColumn(typeof header.column.columnDef.header === 'string' ? header.column.columnDef.header : header.column.id)"
|
|
291
|
+
:aria-pressed="header.column.getIsFiltered()"
|
|
292
|
+
@click.stop
|
|
293
|
+
@keydown.stop
|
|
294
|
+
>
|
|
295
|
+
<Icon :name="icons.filter" v-bind="filterIconProps" />
|
|
296
|
+
</Button>
|
|
297
|
+
<template #content>
|
|
298
|
+
<div :class="applyClassPrefix('flex flex-col gap-2')">
|
|
299
|
+
<div :class="applyClassPrefix('flex items-center justify-between gap-2')">
|
|
300
|
+
<span :class="applyClassPrefix('text-sm font-medium text-[var(--selaras-resolved-text-default)]')">
|
|
301
|
+
{{ messages.filterColumn(typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : header.column.id) }}
|
|
302
|
+
</span>
|
|
303
|
+
<Button
|
|
304
|
+
variant="text"
|
|
305
|
+
color="neutral"
|
|
306
|
+
size="sm"
|
|
307
|
+
:disabled="!header.column.getIsFiltered()"
|
|
308
|
+
@click.stop="header.column.setFilterValue(void 0)"
|
|
309
|
+
>
|
|
310
|
+
{{ messages.clear }}
|
|
311
|
+
</Button>
|
|
312
|
+
</div>
|
|
313
|
+
<Input
|
|
314
|
+
size="sm"
|
|
315
|
+
:model-value="header.column.getFilterValue() ?? ''"
|
|
316
|
+
:placeholder="messages.filterPlaceholder"
|
|
317
|
+
:aria-label="messages.filterColumn(typeof header.column.columnDef.header === 'string' ? header.column.columnDef.header : header.column.id)"
|
|
318
|
+
v-bind="filterInputProps"
|
|
319
|
+
@click.stop
|
|
320
|
+
@update:model-value="(value) => header.column.setFilterValue(value)"
|
|
321
|
+
/>
|
|
322
|
+
</div>
|
|
323
|
+
</template>
|
|
324
|
+
</Popover>
|
|
278
325
|
</div>
|
|
279
326
|
</template>
|
|
280
327
|
</th>
|
|
@@ -289,7 +336,7 @@ defineExpose({
|
|
|
289
336
|
<template v-for="row in visibleRows" :key="row.id">
|
|
290
337
|
<tr
|
|
291
338
|
v-bind="bodyRowProps(row.original)"
|
|
292
|
-
@click="onRowClick(row.original, $event)"
|
|
339
|
+
@click="onRowClick(row.original, $event, row.getCanSelect() ? () => row.toggleSelected() : void 0)"
|
|
293
340
|
@contextmenu="onRowContextmenu(row.original, $event)"
|
|
294
341
|
>
|
|
295
342
|
<td
|
|
@@ -299,10 +346,32 @@ defineExpose({
|
|
|
299
346
|
:data-pinned="cell.column.getIsPinned() || void 0"
|
|
300
347
|
:style="pinnedStyle(cell)"
|
|
301
348
|
>
|
|
302
|
-
<
|
|
349
|
+
<div
|
|
350
|
+
v-if="tree && cell.column.id === treeColumnId"
|
|
351
|
+
v-bind="treeCellProps"
|
|
352
|
+
:style="{ paddingInlineStart: `${row.depth * 1.25}rem` }"
|
|
353
|
+
>
|
|
354
|
+
<button
|
|
355
|
+
v-if="row.getCanExpand()"
|
|
356
|
+
type="button"
|
|
357
|
+
v-bind="resolveSlot(ui.expandButton, props.ui?.expandButton)"
|
|
358
|
+
:aria-label="row.getIsExpanded() ? messages.collapseRow : messages.expandRow"
|
|
359
|
+
:aria-expanded="row.getIsExpanded()"
|
|
360
|
+
@click.stop="row.toggleExpanded()"
|
|
361
|
+
>
|
|
362
|
+
<Icon
|
|
363
|
+
:name="icons.chevronRight"
|
|
364
|
+
v-bind="resolveSlot(ui.expandChevron, props.ui?.expandChevron)"
|
|
365
|
+
:data-expanded="row.getIsExpanded() || void 0"
|
|
366
|
+
/>
|
|
367
|
+
</button>
|
|
368
|
+
<span v-else :class="resolveSlot(ui.expandButton, props.ui?.expandButton).class" aria-hidden="true" />
|
|
369
|
+
<FlexRender :cell="cell" />
|
|
370
|
+
</div>
|
|
371
|
+
<FlexRender v-else :cell="cell" />
|
|
303
372
|
</td>
|
|
304
373
|
</tr>
|
|
305
|
-
<tr v-if="row.getIsExpanded()" v-bind="expandedRowProps">
|
|
374
|
+
<tr v-if="row.getIsExpanded() && !tree" v-bind="expandedRowProps">
|
|
306
375
|
<td :colspan="row.getVisibleCells().length" v-bind="expandedCellProps">
|
|
307
376
|
<slot name="expanded" :row="row.original" />
|
|
308
377
|
</td>
|