@bridge-ui/vue 0.11.0 → 0.13.0
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/ai/skills/bridge-ui-components/SKILL.md +2 -1
- package/dist/Adapters/Examples/date-moment.js +31 -31
- package/dist/Adapters/Examples/i18n-dictionary.js +14 -0
- package/dist/Adapters/Examples/icon-fontawesome.js +53 -40
- package/dist/Adapters/Examples/icon-heroicons.js +46 -33
- package/dist/Adapters/Examples/icon-lucide.js +47 -34
- package/dist/Adapters/Examples/icon-phosphor.js +48 -35
- package/dist/Adapters/Examples/icon-tabler.js +45 -32
- package/dist/Adapters/Examples/rich-text-tiptap.d.ts +5 -0
- package/dist/Adapters/Examples/rich-text-tiptap.js +138 -0
- package/dist/Adapters/RichText/index.d.ts +1 -0
- package/dist/Adapters/RichText/index.js +2 -0
- package/dist/Adapters/RichText/mockRichTextAdapter.d.ts +5 -0
- package/dist/Adapters/RichText/useRichTextAdapter.d.ts +12 -0
- package/dist/Adapters/RichText/useRichTextAdapter.js +13 -0
- package/dist/Adapters/index.d.ts +1 -0
- package/dist/Adapters/index.js +2 -1
- package/dist/Components/ActionFooter/composables/useActionFooter.d.ts +6 -6
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +2 -2
- package/dist/Components/BaseField/composables/useBaseField.d.ts +3 -3
- package/dist/Components/BaseField/composables/useBaseField.js +7 -7
- package/dist/Components/Breadcrumb/Breadcrumb.vue.d.ts +17 -10
- package/dist/Components/Breadcrumb/Breadcrumb.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/Components/Breadcrumb/breadcrumb.types.d.ts +22 -4
- package/dist/Components/Breadcrumb/breadcrumbInjectionKey.d.ts +5 -1
- package/dist/Components/Breadcrumb/composables/useBreadcrumb.d.ts +6 -5
- package/dist/Components/Breadcrumb/composables/useBreadcrumb.js +2 -0
- package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue.d.ts +17 -11
- package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/BreadcrumbItem/breadcrumbItem.types.d.ts +21 -3
- package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.d.ts +10 -6
- package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.js +65 -59
- package/dist/Components/Button/Button.vue.d.ts +17 -8
- package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +10 -10
- package/dist/Components/Button/button.types.d.ts +22 -5
- package/dist/Components/Button/composables/useButton.d.ts +198 -8
- package/dist/Components/Button/composables/useButton.js +101 -86
- package/dist/Components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/Components/Carousel/Carousel.js +5 -0
- package/dist/Components/Carousel/Carousel.vue.d.ts +22 -0
- package/dist/Components/Carousel/Carousel.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/Components/Carousel/carousel.types.d.ts +236 -0
- package/dist/Components/Carousel/carouselInjectionKey.d.ts +48 -0
- package/dist/Components/Carousel/carouselInjectionKey.js +4 -0
- package/dist/Components/Carousel/composables/useCarousel.d.ts +91 -0
- package/dist/Components/Carousel/composables/useCarousel.js +331 -0
- package/dist/Components/Carousel/index.d.ts +4 -0
- package/dist/Components/Carousel/index.js +4 -0
- package/dist/Components/CarouselSlide/CarouselSlide.js +5 -0
- package/dist/Components/CarouselSlide/CarouselSlide.vue.d.ts +11 -0
- package/dist/Components/CarouselSlide/CarouselSlide.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/Components/CarouselSlide/carouselSlide.types.d.ts +40 -0
- package/dist/Components/CarouselSlide/composables/useCarouselSlide.d.ts +205 -0
- package/dist/Components/CarouselSlide/composables/useCarouselSlide.js +79 -0
- package/dist/Components/CarouselSlide/index.d.ts +3 -0
- package/dist/Components/CarouselSlide/index.js +3 -0
- package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
- package/dist/Components/DataTable/DataTable.vue.d.ts +1 -1
- package/dist/Components/DataTable/composables/useDataTable.d.ts +1 -1
- package/dist/Components/DataTable/composables/useDataTable.js +288 -282
- package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -1
- package/dist/Components/Drawer/composables/useDrawer.js +2 -2
- package/dist/Components/FileUpload/FileUpload.js +5 -0
- package/dist/Components/FileUpload/FileUpload.vue.d.ts +26 -0
- package/dist/Components/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/Components/FileUpload/composables/useFileUpload.d.ts +120 -0
- package/dist/Components/FileUpload/composables/useFileUpload.js +235 -0
- package/dist/Components/FileUpload/fileUpload.types.d.ts +396 -0
- package/dist/Components/FileUpload/fileUploadInjectionKey.d.ts +61 -0
- package/dist/Components/FileUpload/fileUploadInjectionKey.js +4 -0
- package/dist/Components/FileUpload/index.d.ts +3 -0
- package/dist/Components/FileUpload/index.js +3 -0
- package/dist/Components/FileUploadItem/FileUploadItem.js +5 -0
- package/dist/Components/FileUploadItem/FileUploadItem.vue.d.ts +12 -0
- package/dist/Components/FileUploadItem/FileUploadItem.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/Components/FileUploadItem/composables/useFileUploadItem.d.ts +1153 -0
- package/dist/Components/FileUploadItem/composables/useFileUploadItem.js +94 -0
- package/dist/Components/FileUploadItem/fileUploadItem.types.d.ts +20 -0
- package/dist/Components/FileUploadItem/index.d.ts +3 -0
- package/dist/Components/FileUploadItem/index.js +3 -0
- package/dist/Components/FormField/composables/useFormField.d.ts +1 -1
- package/dist/Components/Link/Link.vue.d.ts +17 -8
- package/dist/Components/Link/Link.vue_vue_type_script_setup_true_lang.js +30 -25
- package/dist/Components/Link/composables/useLink.d.ts +8 -6
- package/dist/Components/Link/composables/useLink.js +52 -45
- package/dist/Components/Link/link.types.d.ts +21 -4
- package/dist/Components/ListItem/ListItem.vue.d.ts +17 -15
- package/dist/Components/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/ListItem/composables/useListItem.d.ts +7 -6
- package/dist/Components/ListItem/composables/useListItem.js +108 -105
- package/dist/Components/ListItem/listItem.types.d.ts +19 -3
- package/dist/Components/Listbox/composables/useListbox.d.ts +2 -2
- package/dist/Components/Menu/composables/useMenu.js +6 -6
- package/dist/Components/Modal/composables/useModal.d.ts +1 -1
- package/dist/Components/Modal/composables/useModal.js +2 -2
- package/dist/Components/Pagination/composables/usePagination.d.ts +1 -1
- package/dist/Components/RichTextEditor/RichTextEditor.js +5 -0
- package/dist/Components/RichTextEditor/RichTextEditor.vue.d.ts +23 -0
- package/dist/Components/RichTextEditor/RichTextEditor.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.d.ts +488 -0
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +226 -0
- package/dist/Components/RichTextEditor/index.d.ts +3 -0
- package/dist/Components/RichTextEditor/index.js +3 -0
- package/dist/Components/RichTextEditor/richTextEditor.types.d.ts +103 -0
- package/dist/Components/Select/composables/useSelect.js +2 -2
- package/dist/Components/Sidebar/SidebarListItem.vue.d.ts +17 -9
- package/dist/Components/Sidebar/SidebarListItem.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/Components/Sidebar/composables/useSidebarListItem.js +1 -1
- package/dist/Components/Sidebar/composables/useSidebarTrigger.d.ts +1 -1
- package/dist/Components/Sidebar/sidebar.types.d.ts +2 -1
- package/dist/Components/Snackbar/composables/useSnackbar.js +1 -1
- package/dist/Components/Textarea/composables/useTextarea.js +1 -1
- package/dist/Components/Tooltip/composables/useTooltip.js +3 -3
- package/dist/Utils/linkAs.d.ts +29 -0
- package/dist/Utils/linkAs.js +18 -0
- package/dist/augments.d.ts +19 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +181 -170
- package/dist/theme.css +3 -0
- package/docs/README.md +4 -0
- package/docs/components/Breadcrumb.md +16 -0
- package/docs/components/BridgeUIProvider.md +18 -1
- package/docs/components/Button.md +31 -19
- package/docs/components/Carousel.md +113 -0
- package/docs/components/DataTable.md +1 -1
- package/docs/components/FileUpload.md +197 -0
- package/docs/components/Link.md +28 -12
- package/docs/components/List.md +21 -19
- package/docs/components/RichTextEditor.md +88 -0
- package/docs/components/Sidebar.md +1 -1
- package/package.json +54 -18
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { FILE_UPLOAD_KEY as e } from "../../FileUpload/fileUploadInjectionKey.js";
|
|
2
|
+
import { computed as t, inject as n, useAttrs as r } from "vue";
|
|
3
|
+
import { get as i, isNil as a } from "es-toolkit/compat";
|
|
4
|
+
import { formatFileUploadStatusLabel as o, getFileUploadItemState as s, resolveFileUploadItemMedia as c, shouldShowFileUploadDescription as l } from "@bridge-ui/core/Domain";
|
|
5
|
+
import { cn as u, splitComponentProps as d } from "@bridge-ui/core/Utils";
|
|
6
|
+
//#region src/Components/FileUploadItem/composables/useFileUploadItem.ts
|
|
7
|
+
var f = [
|
|
8
|
+
"index",
|
|
9
|
+
"retry",
|
|
10
|
+
"value",
|
|
11
|
+
"remove",
|
|
12
|
+
"isImage",
|
|
13
|
+
"metaLabel",
|
|
14
|
+
"sizeLabel",
|
|
15
|
+
"previewUrl",
|
|
16
|
+
"description",
|
|
17
|
+
"orientation"
|
|
18
|
+
];
|
|
19
|
+
function p(p) {
|
|
20
|
+
let m = r(), h = n(e);
|
|
21
|
+
if (!h) throw Error("FileUploadItem must be used within FileUpload");
|
|
22
|
+
let g = t(() => d({
|
|
23
|
+
bridgeKeys: f,
|
|
24
|
+
props: {
|
|
25
|
+
...m,
|
|
26
|
+
...p
|
|
27
|
+
}
|
|
28
|
+
})), _ = t(() => g.value.componentProps.orientation ?? h.value.orientation), v = t(() => i(h.value.orientationItems, _.value)), y = t(() => s(g.value.componentProps.value)), b = t(() => {
|
|
29
|
+
let e = y.value;
|
|
30
|
+
return e ? i(h.value.stateItems, e) : void 0;
|
|
31
|
+
}), x = t(() => c(g.value.componentProps.value, g.value.componentProps.previewUrl)), S = t(() => g.value.componentProps.description || o(g.value.componentProps.value)), C = t(() => {
|
|
32
|
+
let e = g.value.componentProps.description;
|
|
33
|
+
return e === null || e === "" ? !1 : e ? !0 : l(g.value.componentProps.value, h.value.size);
|
|
34
|
+
}), w = t(() => y.value === "error" && !a(g.value.componentProps.retry)), T = t(() => {
|
|
35
|
+
let e = h.value.getItemBind(g.value.componentProps.index), t = g.value.inheritedAttrs, n = _.value !== h.value.orientation;
|
|
36
|
+
return {
|
|
37
|
+
...e,
|
|
38
|
+
...t,
|
|
39
|
+
"data-orientation": _.value,
|
|
40
|
+
...y.value ? { "data-state": y.value } : {},
|
|
41
|
+
class: u(e.class, n ? i(v.value, "item") : void 0, t.class)
|
|
42
|
+
};
|
|
43
|
+
}), E = t(() => {
|
|
44
|
+
let e = h.value.mediaBind, t = _.value !== h.value.orientation;
|
|
45
|
+
return {
|
|
46
|
+
...e,
|
|
47
|
+
class: u(e.class, t ? i(v.value, "media") : void 0, b.value ? i(b.value, "media") : void 0)
|
|
48
|
+
};
|
|
49
|
+
}), D = t(() => {
|
|
50
|
+
let e = h.value.contentBind, t = _.value !== h.value.orientation;
|
|
51
|
+
return {
|
|
52
|
+
...e,
|
|
53
|
+
class: u(e.class, t ? i(v.value, "content") : void 0)
|
|
54
|
+
};
|
|
55
|
+
}), O = t(() => {
|
|
56
|
+
let e = h.value.titleBind;
|
|
57
|
+
return {
|
|
58
|
+
...e,
|
|
59
|
+
class: u(e.class, b.value ? i(b.value, "title") : void 0)
|
|
60
|
+
};
|
|
61
|
+
}), k = t(() => {
|
|
62
|
+
let e = h.value.descriptionBind;
|
|
63
|
+
return {
|
|
64
|
+
...e,
|
|
65
|
+
class: u(e.class, b.value ? i(b.value, "description") : void 0)
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
media: x,
|
|
70
|
+
rootBind: T,
|
|
71
|
+
showRetry: w,
|
|
72
|
+
titleBind: O,
|
|
73
|
+
mediaBind: E,
|
|
74
|
+
contentBind: D,
|
|
75
|
+
actionsBind: t(() => {
|
|
76
|
+
let e = h.value.actionsBind, t = _.value !== h.value.orientation;
|
|
77
|
+
return {
|
|
78
|
+
...e,
|
|
79
|
+
class: u(e.class, t ? i(v.value, "actions") : void 0)
|
|
80
|
+
};
|
|
81
|
+
}),
|
|
82
|
+
statusLabel: S,
|
|
83
|
+
descriptionBind: k,
|
|
84
|
+
showDescription: C,
|
|
85
|
+
color: t(() => h.value.color),
|
|
86
|
+
rounded: t(() => h.value.rounded),
|
|
87
|
+
disabled: t(() => h.value.disabled),
|
|
88
|
+
retry: t(() => g.value.componentProps.retry),
|
|
89
|
+
remove: t(() => g.value.componentProps.remove),
|
|
90
|
+
name: t(() => g.value.componentProps.value.name)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { p as useFileUploadItem };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'vue';
|
|
2
|
+
import { FileUploadOrientation } from '@bridge-ui/core/Tokens';
|
|
3
|
+
import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
|
|
4
|
+
import { FileUploadItemSlotProps, FileUploadOrientationOverrides } from '../FileUpload/fileUpload.types';
|
|
5
|
+
export interface FileUploadItemOwnProps extends FileUploadItemSlotProps {
|
|
6
|
+
/**
|
|
7
|
+
* Replaces the meta line, including upload-state copy.
|
|
8
|
+
* `null` or `""` hides the line.
|
|
9
|
+
*
|
|
10
|
+
* @default the attachment `description`, or the type · size / state label
|
|
11
|
+
*/
|
|
12
|
+
description?: null | string;
|
|
13
|
+
/**
|
|
14
|
+
* Card layout. Overrides the `FileUpload` orientation for this card.
|
|
15
|
+
*
|
|
16
|
+
* @default inherited from FileUpload
|
|
17
|
+
*/
|
|
18
|
+
orientation?: MergeProps<FileUploadOrientation, FileUploadOrientationOverrides>;
|
|
19
|
+
}
|
|
20
|
+
export type FileUploadItemProps = MergeHtmlProps<FileUploadItemOwnProps, HTMLAttributes>;
|
|
@@ -9,7 +9,7 @@ export type FormFieldOptions = {
|
|
|
9
9
|
* Defaults to `FormField`; public fields pass their own key so chrome
|
|
10
10
|
* cascades (`FormField` → `TextField`, …).
|
|
11
11
|
*/
|
|
12
|
-
componentName?: "Select" | "Textarea" | "DateField" | "FormField" | "TextField" | "TimeField" | "ColorField" | "NumberField" | "Autocomplete" | "DateTimeField" | "PasswordField" | "DateRangeField" | "TimeRangeField" | "DateTimeRangeField";
|
|
12
|
+
componentName?: "Select" | "Textarea" | "DateField" | "FormField" | "TextField" | "TimeField" | "ColorField" | "NumberField" | "Autocomplete" | "DateTimeField" | "PasswordField" | "DateRangeField" | "RichTextEditor" | "TimeRangeField" | "DateTimeRangeField";
|
|
13
13
|
/**
|
|
14
14
|
* Native control rendered by the field composable (`<input>` vs `<textarea>`).
|
|
15
15
|
*
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { LinkOwnProps, LinkSlots } from './link.types';
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
|
|
2
|
+
import { LinkAsTag } from '../../Utils/linkAs';
|
|
3
|
+
declare const __VLS_export: <T extends LinkAsTag = "a">(__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
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<LinkOwnProps<T>> & (typeof globalThis extends {
|
|
5
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
6
|
+
} ? P : {});
|
|
7
|
+
expose: (exposed: {}) => void;
|
|
8
|
+
attrs: any;
|
|
9
|
+
slots: LinkSlots;
|
|
10
|
+
emit: {};
|
|
11
|
+
}>) => import('vue').VNode & {
|
|
12
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
13
|
+
};
|
|
5
14
|
declare const _default: typeof __VLS_export;
|
|
6
15
|
export default _default;
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
16
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
17
|
+
[K in keyof T]: T[K];
|
|
18
|
+
} : {
|
|
19
|
+
[K in keyof T as K]: T[K];
|
|
20
|
+
}) & {};
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { hasNamedSlot as e } from "../../Utils/slotOrProp.js";
|
|
2
2
|
import t from "../Icon/Icon.js";
|
|
3
3
|
import { useLink as n } from "./composables/useLink.js";
|
|
4
|
-
import { createBlock as r, createCommentVNode as i,
|
|
4
|
+
import { createBlock as r, createCommentVNode as i, defineComponent as a, mergeProps as o, openBlock as s, renderSlot as c, resolveDynamicComponent as l, unref as u, withCtx as d } from "vue";
|
|
5
5
|
//#region src/Components/Link/Link.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
7
|
-
"rel",
|
|
8
|
-
"href",
|
|
9
|
-
"target",
|
|
10
|
-
"aria-disabled"
|
|
11
|
-
], f = /*@__PURE__*/ o({
|
|
6
|
+
var f = /*@__PURE__*/ a({
|
|
12
7
|
inheritAttrs: !1,
|
|
13
8
|
__name: "Link",
|
|
14
9
|
props: {
|
|
@@ -19,33 +14,43 @@ var d = [
|
|
|
19
14
|
external: { type: Boolean },
|
|
20
15
|
href: {},
|
|
21
16
|
leftIcon: {},
|
|
17
|
+
linkAs: {},
|
|
18
|
+
linkProps: {},
|
|
22
19
|
rightIcon: {},
|
|
23
20
|
size: {},
|
|
24
21
|
underline: {}
|
|
25
22
|
},
|
|
26
|
-
setup(
|
|
27
|
-
let { slots: f, merged: p, rootRel: m,
|
|
23
|
+
setup(a) {
|
|
24
|
+
let { slots: f, merged: p, rootRel: m, rootTag: h, rootBind: g, rootHref: _, rootTarget: v, leftIconBind: y, rightIconBind: b, rootAriaDisabled: x } = n(a, {
|
|
28
25
|
size: "md",
|
|
29
26
|
color: "primary",
|
|
30
27
|
underline: "hover"
|
|
31
28
|
});
|
|
32
|
-
return (n,
|
|
29
|
+
return (n, a) => (s(), r(l(u(h)), o({
|
|
33
30
|
rel: u(m),
|
|
34
|
-
href: u(
|
|
35
|
-
}, u(
|
|
36
|
-
target: u(
|
|
37
|
-
"aria-disabled": u(
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
href: u(_)
|
|
32
|
+
}, u(g), {
|
|
33
|
+
target: u(v),
|
|
34
|
+
"aria-disabled": u(x)
|
|
35
|
+
}), {
|
|
36
|
+
default: d(() => [
|
|
37
|
+
u(e)(u(f), "prepend") ? c(n.$slots, "prepend", {}, void 0, void 0, 0) : u(p).leftIcon ? (s(), r(u(t), o({
|
|
38
|
+
key: 1,
|
|
39
|
+
size: u(p).size
|
|
40
|
+
}, u(y), { icon: u(p).leftIcon }), null, 16, ["size", "icon"])) : i("", !0),
|
|
41
|
+
c(n.$slots, "default"),
|
|
42
|
+
u(e)(u(f), "append") ? c(n.$slots, "append", {}, void 0, void 0, 2) : u(p).rightIcon ? (s(), r(u(t), o({
|
|
43
|
+
key: 3,
|
|
44
|
+
size: u(p).size
|
|
45
|
+
}, u(b), { icon: u(p).rightIcon }), null, 16, ["size", "icon"])) : i("", !0)
|
|
46
|
+
]),
|
|
47
|
+
_: 3
|
|
48
|
+
}, 16, [
|
|
49
|
+
"rel",
|
|
50
|
+
"href",
|
|
51
|
+
"target",
|
|
52
|
+
"aria-disabled"
|
|
53
|
+
]));
|
|
49
54
|
}
|
|
50
55
|
});
|
|
51
56
|
//#endregion
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
|
|
2
|
-
import { LinkOwnProps
|
|
2
|
+
import { LinkOwnProps } from '../link.types';
|
|
3
|
+
import { LinkAsTag } from '../../../Utils/linkAs';
|
|
3
4
|
type LinkLibDefaults = LibDefaultsShape<LinkOwnProps, "size" | "color" | "underline">;
|
|
4
|
-
type LinkMerged = MergeLibDefaults<LinkOwnProps
|
|
5
|
-
export declare function useLink(props: LinkOwnProps
|
|
5
|
+
type LinkMerged<T extends LinkAsTag = "a"> = MergeLibDefaults<LinkOwnProps<T>, LinkLibDefaults>;
|
|
6
|
+
export declare function useLink<T extends LinkAsTag = "a">(props: LinkOwnProps<T>, libDefaults: LinkLibDefaults): {
|
|
6
7
|
slots: Readonly<{
|
|
7
8
|
[name: string]: import('vue').Slot<any> | undefined;
|
|
8
9
|
}>;
|
|
9
|
-
merged: import('vue').ComputedRef<LinkMerged
|
|
10
|
+
merged: import('vue').ComputedRef<LinkMerged<T>>;
|
|
10
11
|
rootRel: import('vue').ComputedRef<"noopener noreferrer" | undefined>;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
rootTag: import('vue').ComputedRef<"a" | T>;
|
|
13
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
14
|
+
rootHref: import('vue').ComputedRef<import('../../../Utils/linkAs').LinkHref<T, "a"> | undefined>;
|
|
13
15
|
rootTarget: import('vue').ComputedRef<"_blank" | undefined>;
|
|
14
16
|
leftIconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
15
17
|
rightIconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
@@ -1,75 +1,82 @@
|
|
|
1
1
|
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { resolveLinkAsProps as r } from "../../../Utils/linkAs.js";
|
|
3
|
+
import { computed as i, useAttrs as a, useSlots as o } from "vue";
|
|
4
|
+
import { get as s } from "es-toolkit/compat";
|
|
5
|
+
import { linkColorProps as c, linkSizeProps as l, linkUnderlineProps as u } from "@bridge-ui/core/Tokens";
|
|
6
|
+
import { cn as d, mergeBridgeUILayeredClasses as f, splitComponentProps as p } from "@bridge-ui/core/Utils";
|
|
6
7
|
//#region src/Components/Link/composables/useLink.ts
|
|
7
|
-
var
|
|
8
|
+
var m = [
|
|
8
9
|
"href",
|
|
9
10
|
"size",
|
|
10
11
|
"color",
|
|
12
|
+
"linkAs",
|
|
11
13
|
"classes",
|
|
12
14
|
"disabled",
|
|
13
15
|
"external",
|
|
14
16
|
"leftIcon",
|
|
17
|
+
"linkProps",
|
|
15
18
|
"rightIcon",
|
|
16
19
|
"underline",
|
|
17
20
|
"customProps"
|
|
18
21
|
];
|
|
19
|
-
function
|
|
20
|
-
let
|
|
21
|
-
bridgeKeys:
|
|
22
|
+
function h(h, g) {
|
|
23
|
+
let _ = a(), v = o(), y = i(() => p({
|
|
24
|
+
bridgeKeys: m,
|
|
22
25
|
props: {
|
|
23
|
-
...
|
|
24
|
-
...
|
|
26
|
+
..._,
|
|
27
|
+
...h
|
|
25
28
|
}
|
|
26
|
-
})), { merged:
|
|
27
|
-
libDefaults:
|
|
29
|
+
})), { merged: b, entry: x } = t({
|
|
30
|
+
libDefaults: g,
|
|
28
31
|
componentName: "Link",
|
|
29
|
-
props: () =>
|
|
30
|
-
}),
|
|
31
|
-
entry:
|
|
32
|
-
props: () =>
|
|
33
|
-
}),
|
|
34
|
-
if (
|
|
35
|
-
}),
|
|
36
|
-
if (
|
|
37
|
-
}),
|
|
38
|
-
let e =
|
|
39
|
-
return
|
|
40
|
-
}),
|
|
41
|
-
let e =
|
|
42
|
-
return
|
|
43
|
-
}),
|
|
44
|
-
let e =
|
|
45
|
-
return
|
|
32
|
+
props: () => y.value.componentProps
|
|
33
|
+
}), S = i(() => b.value.customProps), C = n({
|
|
34
|
+
entry: x,
|
|
35
|
+
props: () => y.value.componentProps
|
|
36
|
+
}), w = i(() => !!b.value.disabled), T = i(() => w.value || b.value.linkAs == null ? "a" : b.value.linkAs), E = i(() => w.value ? !0 : void 0), D = i(() => w.value ? void 0 : b.value.href), O = i(() => {
|
|
37
|
+
if (b.value.external && !w.value) return "_blank";
|
|
38
|
+
}), k = i(() => {
|
|
39
|
+
if (b.value.external && !w.value) return "noopener noreferrer";
|
|
40
|
+
}), A = i(() => {
|
|
41
|
+
let e = f(l, x.value?.tokens?.size);
|
|
42
|
+
return s(e, b.value.size);
|
|
43
|
+
}), j = i(() => {
|
|
44
|
+
let e = f(c, x.value?.tokens?.color);
|
|
45
|
+
return s(e, b.value.color);
|
|
46
|
+
}), M = i(() => {
|
|
47
|
+
let e = f(u, x.value?.tokens?.underline);
|
|
48
|
+
return s(e, b.value.underline);
|
|
46
49
|
});
|
|
47
50
|
return {
|
|
48
|
-
slots:
|
|
49
|
-
merged:
|
|
50
|
-
rootRel:
|
|
51
|
-
|
|
51
|
+
slots: v,
|
|
52
|
+
merged: b,
|
|
53
|
+
rootRel: k,
|
|
54
|
+
rootTag: T,
|
|
55
|
+
rootBind: i(() => e(S.value?.root, {
|
|
56
|
+
...y.value.inheritedAttrs,
|
|
57
|
+
...r(b.value.linkAs, b.value.linkProps, T.value)
|
|
58
|
+
}, d({
|
|
52
59
|
"inline-flex items-center gap-x-1 font-medium": !0,
|
|
53
60
|
"transition-colors duration-200": !0,
|
|
54
|
-
[O.value ?? ""]: !0,
|
|
55
61
|
[A.value ?? ""]: !0,
|
|
56
|
-
[
|
|
57
|
-
[
|
|
62
|
+
[M.value ?? ""]: !0,
|
|
63
|
+
[s(j.value, "base") ?? ""]: !0,
|
|
64
|
+
[s(j.value, "hover") ?? ""]: !0,
|
|
58
65
|
"aria-disabled:opacity-80 aria-disabled:cursor-not-allowed aria-disabled:pointer-events-none": !0,
|
|
59
|
-
[
|
|
66
|
+
[C.value.root ?? ""]: !0
|
|
60
67
|
}))),
|
|
61
|
-
rootHref:
|
|
62
|
-
rootTarget:
|
|
63
|
-
leftIconBind:
|
|
68
|
+
rootHref: D,
|
|
69
|
+
rootTarget: O,
|
|
70
|
+
leftIconBind: i(() => e(S.value?.leftIcon, {}, d({
|
|
64
71
|
"shrink-0": !0,
|
|
65
|
-
[
|
|
72
|
+
[C.value.leftIcon ?? ""]: !0
|
|
66
73
|
}))),
|
|
67
|
-
rightIconBind:
|
|
74
|
+
rightIconBind: i(() => e(S.value?.rightIcon, {}, d({
|
|
68
75
|
"shrink-0": !0,
|
|
69
|
-
[
|
|
76
|
+
[C.value.rightIcon ?? ""]: !0
|
|
70
77
|
}))),
|
|
71
|
-
rootAriaDisabled:
|
|
78
|
+
rootAriaDisabled: E
|
|
72
79
|
};
|
|
73
80
|
}
|
|
74
81
|
//#endregion
|
|
75
|
-
export {
|
|
82
|
+
export { h as useLink };
|
|
@@ -3,6 +3,7 @@ import { LinkColor, LinkSize, LinkUnderline } from '@bridge-ui/core/Tokens';
|
|
|
3
3
|
import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
|
|
4
4
|
import { IconSource } from '../../Adapters/Icon';
|
|
5
5
|
import { IconProps } from '../Icon';
|
|
6
|
+
import { LinkAsTag, LinkHref, LinkPropsOf } from '../../Utils/linkAs';
|
|
6
7
|
export interface LinkSizeOverrides {}
|
|
7
8
|
export interface LinkColorOverrides {}
|
|
8
9
|
export interface LinkUnderlineOverrides {}
|
|
@@ -30,11 +31,11 @@ export interface LinkCustomProps {
|
|
|
30
31
|
*/
|
|
31
32
|
rightIcon?: Partial<Omit<IconProps, "icon">>;
|
|
32
33
|
/**
|
|
33
|
-
* Props forwarded to the root
|
|
34
|
+
* Props forwarded to the root element (`a`, or `linkAs` when set).
|
|
34
35
|
*/
|
|
35
36
|
root?: HTMLAttributes;
|
|
36
37
|
}
|
|
37
|
-
export interface LinkOwnProps {
|
|
38
|
+
export interface LinkOwnProps<T extends LinkAsTag = "a"> {
|
|
38
39
|
/**
|
|
39
40
|
* The classes to apply to the link.
|
|
40
41
|
*
|
|
@@ -68,16 +69,32 @@ export interface LinkOwnProps {
|
|
|
68
69
|
external?: boolean;
|
|
69
70
|
/**
|
|
70
71
|
* The URL the link points to.
|
|
72
|
+
* When `linkAs` is set, this also accepts that component's `href`.
|
|
71
73
|
*
|
|
72
74
|
* @default undefined
|
|
73
75
|
*/
|
|
74
|
-
href?:
|
|
76
|
+
href?: LinkHref<T, "a">;
|
|
75
77
|
/**
|
|
76
78
|
* The icon to display before the link text.
|
|
77
79
|
*
|
|
78
80
|
* @default undefined
|
|
79
81
|
*/
|
|
80
82
|
leftIcon?: IconSource;
|
|
83
|
+
/**
|
|
84
|
+
* Component rendered in place of the navigating `<a>`.
|
|
85
|
+
* Receives `href`, `linkProps`, and the same attributes the anchor would.
|
|
86
|
+
* Ignored while disabled.
|
|
87
|
+
*
|
|
88
|
+
* @default undefined
|
|
89
|
+
*/
|
|
90
|
+
linkAs?: T;
|
|
91
|
+
/**
|
|
92
|
+
* Props forwarded to `linkAs` (`method`, `replace`, `prefetch`, and so on).
|
|
93
|
+
* Checked against that component. Ignored while `linkAs` is not rendered.
|
|
94
|
+
*
|
|
95
|
+
* @default undefined
|
|
96
|
+
*/
|
|
97
|
+
linkProps?: LinkPropsOf<T, "a">;
|
|
81
98
|
/**
|
|
82
99
|
* The icon to display after the link text.
|
|
83
100
|
*
|
|
@@ -111,4 +128,4 @@ export interface LinkSlots {
|
|
|
111
128
|
*/
|
|
112
129
|
prepend?: Slot<undefined>;
|
|
113
130
|
}
|
|
114
|
-
export type LinkProps = MergeHtmlProps<LinkOwnProps
|
|
131
|
+
export type LinkProps<T extends LinkAsTag = "a"> = MergeHtmlProps<LinkOwnProps<T>, AnchorHTMLAttributes>;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { ListItemOwnProps, ListItemSlots } from './listItem.types';
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { LinkAsTag } from '../../Utils/linkAs';
|
|
3
|
+
declare const __VLS_export: <T extends LinkAsTag = "a">(__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
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<ListItemOwnProps<T>> & (typeof globalThis extends {
|
|
5
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
6
|
+
} ? P : {});
|
|
7
|
+
expose: (exposed: {}) => void;
|
|
8
|
+
attrs: any;
|
|
9
|
+
slots: ListItemSlots;
|
|
10
|
+
emit: {};
|
|
11
|
+
}>) => import('vue').VNode & {
|
|
12
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
13
|
+
};
|
|
12
14
|
declare const _default: typeof __VLS_export;
|
|
13
15
|
export default _default;
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
16
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
17
|
+
[K in keyof T]: T[K];
|
|
18
|
+
} : {
|
|
19
|
+
[K in keyof T as K]: T[K];
|
|
20
|
+
}) & {};
|
|
@@ -2,16 +2,17 @@ import { useSlots } from 'vue';
|
|
|
2
2
|
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
|
|
3
3
|
import { IconSource } from '../../../Adapters/Icon';
|
|
4
4
|
import { ListItemOwnProps, ListItemProps } from '../listItem.types';
|
|
5
|
+
import { LinkAsTag } from '../../../Utils/linkAs';
|
|
5
6
|
type ListItemLibDefaults = LibDefaultsShape<ListItemOwnProps, "role">;
|
|
6
|
-
type ListItemMerged = MergeLibDefaults<ListItemOwnProps
|
|
7
|
-
export declare function useListItem(props: ListItemOwnProps
|
|
8
|
-
merged: import('vue').ComputedRef<ListItemMerged
|
|
7
|
+
type ListItemMerged<T extends LinkAsTag = "a"> = MergeLibDefaults<ListItemOwnProps<T>, ListItemLibDefaults>;
|
|
8
|
+
export declare function useListItem<T extends LinkAsTag = "a">(props: ListItemOwnProps<T>, libDefaults: ListItemLibDefaults, slots: ReturnType<typeof useSlots>): {
|
|
9
|
+
merged: import('vue').ComputedRef<ListItemMerged<T>>;
|
|
9
10
|
hasEnd: import('vue').ComputedRef<boolean>;
|
|
10
11
|
endBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
11
12
|
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
12
13
|
class: string;
|
|
13
14
|
id: string | undefined;
|
|
14
|
-
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListItemProps
|
|
15
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<ListItemProps<T>, "target" | "role" | "href" | "value" | "classes" | "customProps" | "primary" | "secondary" | "as" | "disabled" | "linkAs" | "linkProps" | "selected" | "rel" | "dense" | "divider" | "interactive" | "selectedIcon">, never>>>;
|
|
15
16
|
rowClass: import('vue').ComputedRef<string>;
|
|
16
17
|
startBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
17
18
|
hasPrimary: import('vue').ComputedRef<boolean>;
|
|
@@ -19,13 +20,13 @@ export declare function useListItem(props: ListItemOwnProps, libDefaults: ListIt
|
|
|
19
20
|
primaryBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
20
21
|
hasSecondary: import('vue').ComputedRef<boolean>;
|
|
21
22
|
secondaryBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
22
|
-
interactiveTag: import('vue').ComputedRef<"a" | "div">;
|
|
23
|
+
interactiveTag: import('vue').ComputedRef<"a" | "div" | T>;
|
|
23
24
|
interactiveBind: import('vue').ComputedRef<({
|
|
24
25
|
"aria-disabled": boolean | undefined;
|
|
25
26
|
rel: string | undefined;
|
|
26
27
|
"data-selected": boolean | undefined;
|
|
27
28
|
"aria-selected": boolean | undefined;
|
|
28
|
-
href:
|
|
29
|
+
href: import('../../../Utils/linkAs').LinkHref<T, "a"> | undefined;
|
|
29
30
|
target: string | undefined;
|
|
30
31
|
role: NonNullable<"button" | "option" | "menuitem" | undefined> | undefined;
|
|
31
32
|
onMousedown: ((event: MouseEvent) => void) | undefined;
|