@sewadah/selaras 0.2.0 → 0.3.1
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 +36 -7
- package/dist/module.json +1 -1
- package/dist/module.mjs +31 -15
- package/dist/runtime/components/Autocomplete.vue +3 -1
- package/dist/runtime/components/Badge.d.vue.ts +1 -1
- package/dist/runtime/components/Badge.vue.d.ts +1 -1
- 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/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/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/ContentToc.vue +14 -7
- package/dist/runtime/components/ContextMenu.d.vue.ts +8 -1
- package/dist/runtime/components/ContextMenu.vue +16 -4
- 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/Dropdown.d.vue.ts +33 -6
- package/dist/runtime/components/Dropdown.vue +143 -11
- 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/FileUpload.vue +1 -1
- 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/NavigationMenu.d.vue.ts +10 -10
- package/dist/runtime/components/NavigationMenu.vue +13 -7
- 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/PinInput.vue +1 -1
- package/dist/runtime/components/Popover.d.vue.ts +8 -2
- package/dist/runtime/components/Popover.vue +9 -4
- package/dist/runtime/components/Popover.vue.d.ts +8 -2
- package/dist/runtime/components/ProsePre.d.vue.ts +6 -2
- package/dist/runtime/components/ProsePre.vue +11 -4
- package/dist/runtime/components/ProsePre.vue.d.ts +6 -2
- package/dist/runtime/components/Select.vue +3 -1
- 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 +9 -4
- package/dist/runtime/components/Tooltip.vue.d.ts +8 -2
- 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/default-colors.css +1 -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 +29 -25
- package/dist/runtime/internal/ComboboxSelectBase.vue +104 -20
- package/dist/runtime/internal/ComboboxSelectBase.vue.d.ts +29 -25
- package/dist/runtime/internal/ComboboxSelectBody.d.vue.ts +16 -11
- package/dist/runtime/internal/ComboboxSelectBody.vue +49 -10
- package/dist/runtime/internal/ComboboxSelectBody.vue.d.ts +16 -11
- 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.js +2 -1
- package/dist/runtime/internal/programmatic-services.d.ts +2 -0
- package/dist/runtime/internal/programmatic-services.js +8 -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/avatar.js +7 -7
- package/dist/runtime/theme/badge.js +2 -2
- 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/checkbox.js +1 -1
- 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/date-picker.js +1 -1
- 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/file-upload.js +2 -2
- package/dist/runtime/theme/form-field.d.ts +18 -0
- package/dist/runtime/theme/form-field.js +6 -1
- package/dist/runtime/theme/icon.js +1 -1
- package/dist/runtime/theme/input-number.js +1 -1
- package/dist/runtime/theme/input.js +1 -1
- package/dist/runtime/theme/modal.js +1 -1
- package/dist/runtime/theme/pin-input.js +1 -1
- package/dist/runtime/theme/progress.js +2 -2
- package/dist/runtime/theme/prose.d.ts +6 -0
- package/dist/runtime/theme/prose.js +2 -0
- package/dist/runtime/theme/radio-group.js +4 -4
- package/dist/runtime/theme/rating.js +1 -1
- package/dist/runtime/theme/select.js +2 -2
- package/dist/runtime/theme/separator.js +1 -1
- package/dist/runtime/theme/slideover.js +1 -1
- package/dist/runtime/theme/slider.js +2 -2
- package/dist/runtime/theme/splitter-resize-handle.js +1 -1
- package/dist/runtime/theme/switch.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/textarea.js +1 -1
- 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 +12 -1
- package/dist/runtime/types/index.d.ts +6 -1
- package/dist/runtime/utils/arrow.d.ts +21 -0
- package/dist/runtime/utils/arrow.js +10 -0
- package/dist/runtime/utils/color-registry.d.ts +3 -1
- package/dist/runtime/utils/color-registry.js +4 -0
- package/dist/runtime/utils/file-icons.d.ts +8 -0
- package/dist/runtime/utils/file-icons.js +133 -0
- package/dist/runtime/utils/functional-tokens.d.ts +1 -1
- package/dist/runtime/utils/functional-tokens.js +1 -1
- package/dist/runtime/utils/icons.d.ts +2 -0
- package/dist/runtime/utils/icons.js +2 -0
- package/dist/runtime/utils/messages.d.ts +6 -0
- package/dist/runtime/utils/messages.js +6 -0
- package/dist/runtime/utils/navigation-menu.d.ts +10 -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/seed-colors.d.ts +2 -1
- package/dist/runtime/utils/seed-colors.js +24 -16
- package/dist/runtime/utils/select-contracts.d.ts +7 -1
- 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/tokens/default-colors.tokens.json +100 -100
- package/package.json +21 -9
|
@@ -14,10 +14,13 @@ const props = defineProps({
|
|
|
14
14
|
required: { type: Boolean, required: false },
|
|
15
15
|
size: { type: null, required: false },
|
|
16
16
|
orientation: { type: null, required: false, default: "vertical" },
|
|
17
|
+
labelMode: { type: null, required: false, default: "static" },
|
|
18
|
+
filled: { type: Boolean, required: false },
|
|
17
19
|
ui: { type: Object, required: false }
|
|
18
20
|
});
|
|
19
21
|
const id = props.id ?? useId();
|
|
20
22
|
const invalid = computed(() => !!props.error);
|
|
23
|
+
const floatingLabel = computed(() => props.labelMode === "floating");
|
|
21
24
|
const errorMessage = computed(() => typeof props.error === "string" ? props.error : void 0);
|
|
22
25
|
const describedBy = computed(() => {
|
|
23
26
|
const ids = [
|
|
@@ -32,11 +35,16 @@ provideFormField({
|
|
|
32
35
|
labelId: props.label ? `${id}-label` : void 0,
|
|
33
36
|
name: props.name,
|
|
34
37
|
size: props.size,
|
|
38
|
+
floatingLabel,
|
|
35
39
|
invalid,
|
|
36
40
|
describedBy
|
|
37
41
|
});
|
|
38
42
|
const theme = useComponentTheme("formField", formFieldTheme);
|
|
39
|
-
const ui = computed(() => theme.value({
|
|
43
|
+
const ui = computed(() => theme.value({
|
|
44
|
+
size: props.size,
|
|
45
|
+
orientation: floatingLabel.value ? "vertical" : props.orientation,
|
|
46
|
+
labelMode: props.labelMode
|
|
47
|
+
}));
|
|
40
48
|
const rootProps = useRootProps(() => ui.value.root, () => props.ui?.root);
|
|
41
49
|
const bodyProps = computed(() => resolveSlot(ui.value.body, props.ui?.body));
|
|
42
50
|
const headerProps = computed(() => resolveSlot(ui.value.header, props.ui?.header));
|
|
@@ -49,10 +57,10 @@ const errorProps = computed(() => resolveSlot(ui.value.error, props.ui?.error));
|
|
|
49
57
|
</script>
|
|
50
58
|
|
|
51
59
|
<template>
|
|
52
|
-
<div v-bind="rootProps">
|
|
60
|
+
<div :data-selaras-label-mode="labelMode" :data-filled="filled || void 0" :data-invalid="invalid || void 0" v-bind="rootProps">
|
|
53
61
|
<div v-bind="bodyProps">
|
|
54
|
-
<div v-bind="headerProps">
|
|
55
|
-
<label v-if="label" :id="`${id}-label`" :for="id" v-bind="labelProps">
|
|
62
|
+
<div v-if="description || label && !floatingLabel" v-bind="headerProps">
|
|
63
|
+
<label v-if="label && !floatingLabel" :id="`${id}-label`" :for="id" v-bind="labelProps">
|
|
56
64
|
{{ label }}<span v-if="required" v-bind="requiredProps">*</span>
|
|
57
65
|
</label>
|
|
58
66
|
<p v-if="description" :id="`${id}-description`" v-bind="descriptionProps">
|
|
@@ -62,6 +70,9 @@ const errorProps = computed(() => resolveSlot(ui.value.error, props.ui?.error));
|
|
|
62
70
|
</p>
|
|
63
71
|
</div>
|
|
64
72
|
<div v-bind="containerProps">
|
|
73
|
+
<label v-if="label && floatingLabel" :id="`${id}-label`" :for="id" data-selaras-floating-label v-bind="labelProps">
|
|
74
|
+
{{ label }}<span v-if="required" v-bind="requiredProps">*</span>
|
|
75
|
+
</label>
|
|
65
76
|
<slot :id="id" :invalid="invalid" :described-by="describedBy" />
|
|
66
77
|
</div>
|
|
67
78
|
</div>
|
|
@@ -73,3 +84,7 @@ const errorProps = computed(() => resolveSlot(ui.value.error, props.ui?.error));
|
|
|
73
84
|
</p>
|
|
74
85
|
</div>
|
|
75
86
|
</template>
|
|
87
|
+
|
|
88
|
+
<style scoped>
|
|
89
|
+
[data-selaras-label-mode=floating] [data-selaras-floating-label]{background:var(--selaras-resolved-surface-default);color:var(--selaras-resolved-text-muted);inset-inline-start:.75rem;line-height:1.2;max-width:calc(100% - 1.5rem);overflow:hidden;padding-inline:.25rem;pointer-events:none;position:absolute;text-overflow:ellipsis;top:50%;transform:translateY(-50%);transition:top .15s ease,color .15s ease,font-size .15s ease;white-space:nowrap;z-index:11}[data-selaras-label-mode=floating]:has(textarea) [data-selaras-floating-label]{top:1.1rem}[data-selaras-label-mode=floating]:has(:deep([data-selaras-field-leading])) [data-selaras-floating-label]{inset-inline-start:2.25rem;max-width:calc(100% - 3rem)}[data-selaras-label-mode=floating]:is(:focus-within,[data-filled],:has([data-selaras-field-segmented],[data-selaras-field-filled],[data-selaras-field-active],[data-ui-group-item]:is(input,textarea):not(:-moz-placeholder))) [data-selaras-floating-label]{color:var(--selaras-resolved-text-default);font-size:.75rem;top:0}[data-selaras-label-mode=floating]:is(:focus-within,[data-filled],:has([data-selaras-field-segmented],[data-selaras-field-filled],[data-selaras-field-active],[data-ui-group-item]:is(input,textarea):not(:placeholder-shown))) [data-selaras-floating-label]{color:var(--selaras-resolved-text-default);font-size:.75rem;top:0}[data-selaras-label-mode=floating][data-invalid] [data-selaras-floating-label]{color:var(--selaras-resolved-color-danger-text)}[data-selaras-label-mode=floating] :deep(:is(input,textarea)::-moz-placeholder){color:transparent}[data-selaras-label-mode=floating] :deep(:is(input,textarea)::placeholder){color:transparent}[data-selaras-label-mode=floating] :deep(:is(input,textarea):focus::-moz-placeholder){color:var(--selaras-resolved-text-muted)}[data-selaras-label-mode=floating] :deep(:is(input,textarea):focus::placeholder){color:var(--selaras-resolved-text-muted)}[data-selaras-label-mode=floating]:not(:has([data-selaras-field-segmented])) :deep([data-placeholder]){visibility:hidden}[data-selaras-label-mode=floating]:focus-within :deep([data-placeholder]){visibility:visible}@media (prefers-reduced-motion:reduce){[data-selaras-label-mode=floating] [data-selaras-floating-label]{transition:none}}
|
|
90
|
+
</style>
|
|
@@ -16,6 +16,10 @@ export interface FormFieldProps {
|
|
|
16
16
|
size?: FormFieldVariants['size'];
|
|
17
17
|
/** 'vertical' (default) stacks the label above the control; 'horizontal' places the label beside it, with the control filling the remaining row width. */
|
|
18
18
|
orientation?: FormFieldVariants['orientation'];
|
|
19
|
+
/** 'floating' overlays the label on an empty control and lifts it on focus, open, or once filled. */
|
|
20
|
+
labelMode?: FormFieldVariants['labelMode'];
|
|
21
|
+
/** Explicit filled state for a custom or third-party control. */
|
|
22
|
+
filled?: boolean;
|
|
19
23
|
ui?: UiProp<FormFieldThemeSlots>;
|
|
20
24
|
}
|
|
21
25
|
declare var __VLS_1: {}, __VLS_3: {
|
|
@@ -27,6 +27,7 @@ const props = defineProps({
|
|
|
27
27
|
});
|
|
28
28
|
const emit = defineEmits(["update:modelValue"]);
|
|
29
29
|
const field = useFormField();
|
|
30
|
+
const effectivePlaceholder = computed(() => props.placeholder || (field?.floatingLabel.value ? " " : void 0));
|
|
30
31
|
const inputId = computed(() => props.id ?? field?.id);
|
|
31
32
|
const inputInvalid = computed(() => props.invalid || (field?.invalid.value ?? false));
|
|
32
33
|
const describedBy = computed(() => field?.describedBy.value);
|
|
@@ -57,7 +58,7 @@ const inputProps = computed(() => mergeProps(baseProps.value, nativeInputAttrs.v
|
|
|
57
58
|
</script>
|
|
58
59
|
|
|
59
60
|
<template>
|
|
60
|
-
<div :data-selaras-color="inputInvalid ? 'danger' : effectiveColor" v-bind="rootProps">
|
|
61
|
+
<div :data-selaras-color="inputInvalid ? 'danger' : effectiveColor" :data-selaras-field-leading="icon ? '' : void 0" v-bind="rootProps">
|
|
61
62
|
<Icon v-if="icon" :name="icon" v-bind="resolveSlot(ui.leadingIcon, props.ui?.leadingIcon)" />
|
|
62
63
|
<input
|
|
63
64
|
:id="inputId"
|
|
@@ -65,7 +66,7 @@ const inputProps = computed(() => mergeProps(baseProps.value, nativeInputAttrs.v
|
|
|
65
66
|
:value="modelValue"
|
|
66
67
|
:type="type"
|
|
67
68
|
:name="name ?? field?.name"
|
|
68
|
-
:placeholder="
|
|
69
|
+
:placeholder="effectivePlaceholder"
|
|
69
70
|
:disabled="disabled"
|
|
70
71
|
:aria-invalid="inputInvalid || void 0"
|
|
71
72
|
:aria-describedby="describedBy"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, onMounted, ref } from "vue";
|
|
3
3
|
import { kbdTheme } from "../theme/kbd";
|
|
4
4
|
import { useComponentTheme, useRootProps } from "../utils/ui";
|
|
5
5
|
defineOptions({ inheritAttrs: false });
|
|
@@ -8,6 +8,10 @@ const props = defineProps({
|
|
|
8
8
|
size: { type: null, required: false },
|
|
9
9
|
ui: { type: Object, required: false }
|
|
10
10
|
});
|
|
11
|
+
const isMacPlatform = ref(false);
|
|
12
|
+
onMounted(() => {
|
|
13
|
+
isMacPlatform.value = /mac|iphone|ipad|ipod/i.test(navigator.platform || "");
|
|
14
|
+
});
|
|
11
15
|
const KEY_SYMBOLS = {
|
|
12
16
|
meta: "\u2318",
|
|
13
17
|
command: "\u2318",
|
|
@@ -31,7 +35,13 @@ const KEY_SYMBOLS = {
|
|
|
31
35
|
right: "\u2192",
|
|
32
36
|
space: "Space"
|
|
33
37
|
};
|
|
34
|
-
const resolvedValue = computed(() =>
|
|
38
|
+
const resolvedValue = computed(() => {
|
|
39
|
+
if (!props.value)
|
|
40
|
+
return void 0;
|
|
41
|
+
if (props.value.toLowerCase() === "mod")
|
|
42
|
+
return isMacPlatform.value ? KEY_SYMBOLS.meta : KEY_SYMBOLS.ctrl;
|
|
43
|
+
return KEY_SYMBOLS[props.value.toLowerCase()] ?? props.value;
|
|
44
|
+
});
|
|
35
45
|
const theme = useComponentTheme("kbd", kbdTheme);
|
|
36
46
|
const ui = computed(() => theme.value({ size: props.size }));
|
|
37
47
|
const rootProps = useRootProps(() => ui.value.base, () => props.ui?.base);
|
|
@@ -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>;
|
|
@@ -12,8 +12,10 @@ import { computed, ref, useSlots } from "vue";
|
|
|
12
12
|
import { NuxtLink } from "#components";
|
|
13
13
|
import { useRoute } from "#imports";
|
|
14
14
|
import { useIcons } from "../composables/use-icons";
|
|
15
|
+
import { vHotkey } from "../directives/hotkey";
|
|
16
|
+
import ShortcutHint from "../internal/ShortcutHint.vue";
|
|
15
17
|
import { navigationMenuTheme } from "../theme/navigation-menu";
|
|
16
|
-
import { isNavigationMenuItemActive } from "../utils/navigation-menu";
|
|
18
|
+
import { isNavigationMenuItemActive, navigationMenuHotkey } from "../utils/navigation-menu";
|
|
17
19
|
import { resolveRegisteredColorRole } from "../utils/registered-colors";
|
|
18
20
|
import { resolveSlot, useComponentTheme } from "../utils/ui";
|
|
19
21
|
import Icon from "./Icon.vue";
|
|
@@ -120,9 +122,10 @@ function onSelect(item, event) {
|
|
|
120
122
|
<li v-for="child in item.children" :key="child.label" v-bind="resolveSlot(ui.childItem, props.ui?.childItem)">
|
|
121
123
|
<NavigationMenuLink as-child :active="isActive(child)">
|
|
122
124
|
<component
|
|
123
|
-
:is="child.to ? NuxtLink : 'button'"
|
|
124
|
-
:
|
|
125
|
-
|
|
125
|
+
:is="child.to ? NuxtLink : 'button'" v-hotkey="navigationMenuHotkey(child)" :to="child.to"
|
|
126
|
+
:type="child.to ? void 0 : 'button'" :disabled="child.to ? void 0 : child.disabled"
|
|
127
|
+
v-bind="childLinkProps(child)" :target="child.target" :rel="child.rel"
|
|
128
|
+
:aria-label="child.ariaLabel" :aria-disabled="child.to && child.disabled ? 'true' : void 0" @click="onSelect(child, $event)"
|
|
126
129
|
>
|
|
127
130
|
<slot :name="slotName(child, '')" :item="child" :active="isActive(child)">
|
|
128
131
|
<slot :name="slotName(child, '-leading')" :item="child" :active="isActive(child)">
|
|
@@ -132,6 +135,7 @@ function onSelect(item, event) {
|
|
|
132
135
|
<span v-bind="resolveSlot(ui.childLinkLabel, props.ui?.childLinkLabel)">{{ child.label }}</span>
|
|
133
136
|
</slot>
|
|
134
137
|
<slot :name="slotName(child, '-trailing')" :item="child" :active="isActive(child)" />
|
|
138
|
+
<ShortcutHint :shortcut="child.shortcut" />
|
|
135
139
|
</slot>
|
|
136
140
|
</component>
|
|
137
141
|
</NavigationMenuLink>
|
|
@@ -142,9 +146,10 @@ function onSelect(item, event) {
|
|
|
142
146
|
</template>
|
|
143
147
|
<NavigationMenuLink v-else as-child :active="isActive(item)">
|
|
144
148
|
<component
|
|
145
|
-
:is="item.to ? NuxtLink : 'button'"
|
|
146
|
-
:
|
|
147
|
-
|
|
149
|
+
:is="item.to ? NuxtLink : 'button'" v-hotkey="navigationMenuHotkey(item)" :to="item.to"
|
|
150
|
+
:type="item.to ? void 0 : 'button'" :disabled="item.to ? void 0 : item.disabled"
|
|
151
|
+
v-bind="linkProps(item)" :target="item.target" :rel="item.rel"
|
|
152
|
+
:aria-label="item.ariaLabel" :aria-disabled="item.to && item.disabled ? 'true' : void 0" @click="onSelect(item, $event)"
|
|
148
153
|
>
|
|
149
154
|
<slot :name="slotName(item, '')" :item="item" :active="isActive(item)">
|
|
150
155
|
<slot :name="slotName(item, '-leading')" :item="item" :active="isActive(item)">
|
|
@@ -155,6 +160,7 @@ function onSelect(item, event) {
|
|
|
155
160
|
<span v-bind="resolveSlot(ui.linkLabel, props.ui?.linkLabel)">{{ item.label }}</span>
|
|
156
161
|
</slot>
|
|
157
162
|
<slot :name="slotName(item, '-trailing')" :item="item" :active="isActive(item)" />
|
|
163
|
+
<ShortcutHint :shortcut="collapsed ? void 0 : item.shortcut" />
|
|
158
164
|
</slot>
|
|
159
165
|
</component>
|
|
160
166
|
</NavigationMenuLink>
|
|
@@ -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>
|
|
@@ -60,7 +60,7 @@ const inputProps = computed(() => mergeProps(resolveSlot(ui.value.input, props.u
|
|
|
60
60
|
:aria-invalid="pinInputInvalid || void 0"
|
|
61
61
|
:aria-describedby="describedBy"
|
|
62
62
|
:aria-labelledby="labelledBy"
|
|
63
|
-
:data-selaras-color="effectiveColor"
|
|
63
|
+
:data-selaras-color="pinInputInvalid ? 'danger' : effectiveColor"
|
|
64
64
|
v-bind="rootProps"
|
|
65
65
|
@update:model-value="(value) => emit('update:modelValue', value)"
|
|
66
66
|
@complete="(value) => emit('complete', value)"
|
|
@@ -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,20 @@
|
|
|
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 { arrowContentProps, arrowElementProps } from "../utils/arrow";
|
|
6
|
+
import { overlayPortalProps } from "../utils/overlay";
|
|
5
7
|
import { resolveSlot, useComponentTheme, useThemeBindings } from "../utils/ui";
|
|
6
8
|
const props = defineProps({
|
|
7
9
|
open: { type: Boolean, required: false, default: void 0 },
|
|
8
10
|
defaultOpen: { type: Boolean, required: false },
|
|
9
11
|
side: { type: String, required: false, default: "bottom" },
|
|
10
12
|
align: { type: String, required: false, default: "center" },
|
|
13
|
+
positioning: { type: Object, required: false },
|
|
14
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: void 0 },
|
|
11
15
|
modal: { type: Boolean, required: false, default: false },
|
|
12
16
|
dismissible: { type: Boolean, required: false, default: true },
|
|
13
17
|
returnFocusOnClose: { type: Boolean, required: false, default: true },
|
|
14
|
-
arrow: { type: Boolean, required: false, default: false },
|
|
18
|
+
arrow: { type: [Boolean, Object], required: false, default: false },
|
|
15
19
|
ui: { type: Object, required: false }
|
|
16
20
|
});
|
|
17
21
|
const emit = defineEmits(["update:open", "escapeKeyDown", "pointerDownOutside", "focusOutside", "openAutoFocus"]);
|
|
@@ -41,8 +45,9 @@ function onOpenAutoFocus(event) {
|
|
|
41
45
|
const theme = useComponentTheme("popover", popoverTheme);
|
|
42
46
|
const themeBindings = useThemeBindings();
|
|
43
47
|
const ui = computed(() => theme.value());
|
|
44
|
-
const contentProps = computed(() => resolveSlot(ui.value.content, props.ui?.content));
|
|
45
|
-
const
|
|
48
|
+
const contentProps = computed(() => ({ ...resolveSlot(ui.value.content, props.ui?.content), ...arrowContentProps(props.arrow), ...props.positioning }));
|
|
49
|
+
const portalProps = computed(() => overlayPortalProps(props.portal));
|
|
50
|
+
const arrowProps = computed(() => ({ ...resolveSlot(ui.value.arrow, props.ui?.arrow), ...arrowElementProps(props.arrow) }));
|
|
46
51
|
const isControlled = Object.hasOwn(getCurrentInstance()?.vnode.props ?? {}, "open");
|
|
47
52
|
const internalOpen = ref(props.open ?? props.defaultOpen ?? false);
|
|
48
53
|
watch(() => props.open, (value) => {
|
|
@@ -61,7 +66,7 @@ function onUpdateOpen(value) {
|
|
|
61
66
|
<PopoverTrigger v-if="$slots.default" as-child>
|
|
62
67
|
<slot />
|
|
63
68
|
</PopoverTrigger>
|
|
64
|
-
<PopoverPortal>
|
|
69
|
+
<PopoverPortal v-bind="portalProps">
|
|
65
70
|
<PopoverContent
|
|
66
71
|
:data-selaras-theme="themeBindings['data-selaras-theme']"
|
|
67
72
|
: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 {
|
|
@@ -2,12 +2,16 @@ export interface ProsePreProps {
|
|
|
2
2
|
code?: string;
|
|
3
3
|
language?: string;
|
|
4
4
|
filename?: string;
|
|
5
|
+
/** Overrides the file-type icon resolved from `filename`/`language`. */
|
|
6
|
+
icon?: string;
|
|
7
|
+
/** Renders the metadata and copy row above the code. @default true */
|
|
8
|
+
showHeader?: boolean;
|
|
5
9
|
highlights?: number[];
|
|
6
10
|
meta?: string;
|
|
7
11
|
}
|
|
8
|
-
declare var
|
|
12
|
+
declare var __VLS_18: {};
|
|
9
13
|
type __VLS_Slots = {} & {
|
|
10
|
-
default?: (props: typeof
|
|
14
|
+
default?: (props: typeof __VLS_18) => any;
|
|
11
15
|
};
|
|
12
16
|
declare const __VLS_base: import("vue").DefineComponent<ProsePreProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProsePreProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
17
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -2,18 +2,23 @@
|
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
3
|
import { useIcons } from "../composables/use-icons";
|
|
4
4
|
import { proseTheme } from "../theme/prose";
|
|
5
|
+
import { resolveFileIcon } from "../utils/file-icons";
|
|
5
6
|
import { resolveSlot, useComponentTheme, useRootProps } from "../utils/ui";
|
|
6
7
|
import Badge from "./Badge.vue";
|
|
7
8
|
import Button from "./Button.vue";
|
|
9
|
+
import Icon from "./Icon.vue";
|
|
8
10
|
defineOptions({ inheritAttrs: false });
|
|
9
11
|
const props = defineProps({
|
|
10
12
|
code: { type: String, required: false },
|
|
11
13
|
language: { type: String, required: false },
|
|
12
14
|
filename: { type: String, required: false },
|
|
15
|
+
icon: { type: String, required: false },
|
|
16
|
+
showHeader: { type: Boolean, required: false, default: true },
|
|
13
17
|
highlights: { type: Array, required: false },
|
|
14
18
|
meta: { type: String, required: false }
|
|
15
19
|
});
|
|
16
20
|
const icons = useIcons();
|
|
21
|
+
const fileIcon = computed(() => props.icon ?? resolveFileIcon(props.language, props.filename));
|
|
17
22
|
const theme = useComponentTheme("prose", proseTheme);
|
|
18
23
|
const ui = computed(() => theme.value());
|
|
19
24
|
const preProps = useRootProps(() => ui.value.pre, () => void 0);
|
|
@@ -31,10 +36,12 @@ async function copy() {
|
|
|
31
36
|
|
|
32
37
|
<template>
|
|
33
38
|
<div v-bind="resolveSlot(ui.preWrapper, void 0)">
|
|
34
|
-
<div v-if="filename || language || code" v-bind="resolveSlot(ui.preHeader, void 0)">
|
|
35
|
-
<span v-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
<div v-if="showHeader && (filename || language || code)" v-bind="resolveSlot(ui.preHeader, void 0)">
|
|
40
|
+
<span v-bind="resolveSlot(ui.preLabel, void 0)">
|
|
41
|
+
<Icon v-if="fileIcon" :name="fileIcon" v-bind="resolveSlot(ui.preIcon, void 0)" />
|
|
42
|
+
<span v-if="filename" v-bind="resolveSlot(ui.preFilename, void 0)">{{ filename }}</span>
|
|
43
|
+
<Badge v-else-if="language" :label="language" size="sm" variant="outline" />
|
|
44
|
+
</span>
|
|
38
45
|
<Button
|
|
39
46
|
v-if="code"
|
|
40
47
|
v-bind="resolveSlot(ui.preCopyButton, void 0)"
|
|
@@ -2,12 +2,16 @@ export interface ProsePreProps {
|
|
|
2
2
|
code?: string;
|
|
3
3
|
language?: string;
|
|
4
4
|
filename?: string;
|
|
5
|
+
/** Overrides the file-type icon resolved from `filename`/`language`. */
|
|
6
|
+
icon?: string;
|
|
7
|
+
/** Renders the metadata and copy row above the code. @default true */
|
|
8
|
+
showHeader?: boolean;
|
|
5
9
|
highlights?: number[];
|
|
6
10
|
meta?: string;
|
|
7
11
|
}
|
|
8
|
-
declare var
|
|
12
|
+
declare var __VLS_18: {};
|
|
9
13
|
type __VLS_Slots = {} & {
|
|
10
|
-
default?: (props: typeof
|
|
14
|
+
default?: (props: typeof __VLS_18) => any;
|
|
11
15
|
};
|
|
12
16
|
declare const __VLS_base: import("vue").DefineComponent<ProsePreProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProsePreProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
17
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -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
|
});
|
|
@@ -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;
|