@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.
Files changed (131) hide show
  1. package/ai/skills/bridge-ui-components/SKILL.md +2 -1
  2. package/dist/Adapters/Examples/date-moment.js +31 -31
  3. package/dist/Adapters/Examples/i18n-dictionary.js +14 -0
  4. package/dist/Adapters/Examples/icon-fontawesome.js +53 -40
  5. package/dist/Adapters/Examples/icon-heroicons.js +46 -33
  6. package/dist/Adapters/Examples/icon-lucide.js +47 -34
  7. package/dist/Adapters/Examples/icon-phosphor.js +48 -35
  8. package/dist/Adapters/Examples/icon-tabler.js +45 -32
  9. package/dist/Adapters/Examples/rich-text-tiptap.d.ts +5 -0
  10. package/dist/Adapters/Examples/rich-text-tiptap.js +138 -0
  11. package/dist/Adapters/RichText/index.d.ts +1 -0
  12. package/dist/Adapters/RichText/index.js +2 -0
  13. package/dist/Adapters/RichText/mockRichTextAdapter.d.ts +5 -0
  14. package/dist/Adapters/RichText/useRichTextAdapter.d.ts +12 -0
  15. package/dist/Adapters/RichText/useRichTextAdapter.js +13 -0
  16. package/dist/Adapters/index.d.ts +1 -0
  17. package/dist/Adapters/index.js +2 -1
  18. package/dist/Components/ActionFooter/composables/useActionFooter.d.ts +6 -6
  19. package/dist/Components/Autocomplete/composables/useAutocomplete.js +2 -2
  20. package/dist/Components/BaseField/composables/useBaseField.d.ts +3 -3
  21. package/dist/Components/BaseField/composables/useBaseField.js +7 -7
  22. package/dist/Components/Breadcrumb/Breadcrumb.vue.d.ts +17 -10
  23. package/dist/Components/Breadcrumb/Breadcrumb.vue_vue_type_script_setup_true_lang.js +7 -2
  24. package/dist/Components/Breadcrumb/breadcrumb.types.d.ts +22 -4
  25. package/dist/Components/Breadcrumb/breadcrumbInjectionKey.d.ts +5 -1
  26. package/dist/Components/Breadcrumb/composables/useBreadcrumb.d.ts +6 -5
  27. package/dist/Components/Breadcrumb/composables/useBreadcrumb.js +2 -0
  28. package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue.d.ts +17 -11
  29. package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue_vue_type_script_setup_true_lang.js +2 -0
  30. package/dist/Components/BreadcrumbItem/breadcrumbItem.types.d.ts +21 -3
  31. package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.d.ts +10 -6
  32. package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.js +65 -59
  33. package/dist/Components/Button/Button.vue.d.ts +17 -8
  34. package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +10 -10
  35. package/dist/Components/Button/button.types.d.ts +22 -5
  36. package/dist/Components/Button/composables/useButton.d.ts +198 -8
  37. package/dist/Components/Button/composables/useButton.js +101 -86
  38. package/dist/Components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +8 -8
  39. package/dist/Components/Carousel/Carousel.js +5 -0
  40. package/dist/Components/Carousel/Carousel.vue.d.ts +22 -0
  41. package/dist/Components/Carousel/Carousel.vue_vue_type_script_setup_true_lang.js +49 -0
  42. package/dist/Components/Carousel/carousel.types.d.ts +236 -0
  43. package/dist/Components/Carousel/carouselInjectionKey.d.ts +48 -0
  44. package/dist/Components/Carousel/carouselInjectionKey.js +4 -0
  45. package/dist/Components/Carousel/composables/useCarousel.d.ts +91 -0
  46. package/dist/Components/Carousel/composables/useCarousel.js +331 -0
  47. package/dist/Components/Carousel/index.d.ts +4 -0
  48. package/dist/Components/Carousel/index.js +4 -0
  49. package/dist/Components/CarouselSlide/CarouselSlide.js +5 -0
  50. package/dist/Components/CarouselSlide/CarouselSlide.vue.d.ts +11 -0
  51. package/dist/Components/CarouselSlide/CarouselSlide.vue_vue_type_script_setup_true_lang.js +17 -0
  52. package/dist/Components/CarouselSlide/carouselSlide.types.d.ts +40 -0
  53. package/dist/Components/CarouselSlide/composables/useCarouselSlide.d.ts +205 -0
  54. package/dist/Components/CarouselSlide/composables/useCarouselSlide.js +79 -0
  55. package/dist/Components/CarouselSlide/index.d.ts +3 -0
  56. package/dist/Components/CarouselSlide/index.js +3 -0
  57. package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
  58. package/dist/Components/DataTable/DataTable.vue.d.ts +1 -1
  59. package/dist/Components/DataTable/composables/useDataTable.d.ts +1 -1
  60. package/dist/Components/DataTable/composables/useDataTable.js +288 -282
  61. package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -1
  62. package/dist/Components/Drawer/composables/useDrawer.js +2 -2
  63. package/dist/Components/FileUpload/FileUpload.js +5 -0
  64. package/dist/Components/FileUpload/FileUpload.vue.d.ts +26 -0
  65. package/dist/Components/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js +141 -0
  66. package/dist/Components/FileUpload/composables/useFileUpload.d.ts +120 -0
  67. package/dist/Components/FileUpload/composables/useFileUpload.js +235 -0
  68. package/dist/Components/FileUpload/fileUpload.types.d.ts +396 -0
  69. package/dist/Components/FileUpload/fileUploadInjectionKey.d.ts +61 -0
  70. package/dist/Components/FileUpload/fileUploadInjectionKey.js +4 -0
  71. package/dist/Components/FileUpload/index.d.ts +3 -0
  72. package/dist/Components/FileUpload/index.js +3 -0
  73. package/dist/Components/FileUploadItem/FileUploadItem.js +5 -0
  74. package/dist/Components/FileUploadItem/FileUploadItem.vue.d.ts +12 -0
  75. package/dist/Components/FileUploadItem/FileUploadItem.vue_vue_type_script_setup_true_lang.js +83 -0
  76. package/dist/Components/FileUploadItem/composables/useFileUploadItem.d.ts +1153 -0
  77. package/dist/Components/FileUploadItem/composables/useFileUploadItem.js +94 -0
  78. package/dist/Components/FileUploadItem/fileUploadItem.types.d.ts +20 -0
  79. package/dist/Components/FileUploadItem/index.d.ts +3 -0
  80. package/dist/Components/FileUploadItem/index.js +3 -0
  81. package/dist/Components/FormField/composables/useFormField.d.ts +1 -1
  82. package/dist/Components/Link/Link.vue.d.ts +17 -8
  83. package/dist/Components/Link/Link.vue_vue_type_script_setup_true_lang.js +30 -25
  84. package/dist/Components/Link/composables/useLink.d.ts +8 -6
  85. package/dist/Components/Link/composables/useLink.js +52 -45
  86. package/dist/Components/Link/link.types.d.ts +21 -4
  87. package/dist/Components/ListItem/ListItem.vue.d.ts +17 -15
  88. package/dist/Components/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +2 -0
  89. package/dist/Components/ListItem/composables/useListItem.d.ts +7 -6
  90. package/dist/Components/ListItem/composables/useListItem.js +108 -105
  91. package/dist/Components/ListItem/listItem.types.d.ts +19 -3
  92. package/dist/Components/Listbox/composables/useListbox.d.ts +2 -2
  93. package/dist/Components/Menu/composables/useMenu.js +6 -6
  94. package/dist/Components/Modal/composables/useModal.d.ts +1 -1
  95. package/dist/Components/Modal/composables/useModal.js +2 -2
  96. package/dist/Components/Pagination/composables/usePagination.d.ts +1 -1
  97. package/dist/Components/RichTextEditor/RichTextEditor.js +5 -0
  98. package/dist/Components/RichTextEditor/RichTextEditor.vue.d.ts +23 -0
  99. package/dist/Components/RichTextEditor/RichTextEditor.vue_vue_type_script_setup_true_lang.js +104 -0
  100. package/dist/Components/RichTextEditor/composables/useRichTextEditor.d.ts +488 -0
  101. package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +226 -0
  102. package/dist/Components/RichTextEditor/index.d.ts +3 -0
  103. package/dist/Components/RichTextEditor/index.js +3 -0
  104. package/dist/Components/RichTextEditor/richTextEditor.types.d.ts +103 -0
  105. package/dist/Components/Select/composables/useSelect.js +2 -2
  106. package/dist/Components/Sidebar/SidebarListItem.vue.d.ts +17 -9
  107. package/dist/Components/Sidebar/SidebarListItem.vue_vue_type_script_setup_true_lang.js +2 -0
  108. package/dist/Components/Sidebar/composables/useSidebarListItem.js +1 -1
  109. package/dist/Components/Sidebar/composables/useSidebarTrigger.d.ts +1 -1
  110. package/dist/Components/Sidebar/sidebar.types.d.ts +2 -1
  111. package/dist/Components/Snackbar/composables/useSnackbar.js +1 -1
  112. package/dist/Components/Textarea/composables/useTextarea.js +1 -1
  113. package/dist/Components/Tooltip/composables/useTooltip.js +3 -3
  114. package/dist/Utils/linkAs.d.ts +29 -0
  115. package/dist/Utils/linkAs.js +18 -0
  116. package/dist/augments.d.ts +19 -0
  117. package/dist/index.d.ts +11 -0
  118. package/dist/index.js +181 -170
  119. package/dist/theme.css +3 -0
  120. package/docs/README.md +4 -0
  121. package/docs/components/Breadcrumb.md +16 -0
  122. package/docs/components/BridgeUIProvider.md +18 -1
  123. package/docs/components/Button.md +31 -19
  124. package/docs/components/Carousel.md +113 -0
  125. package/docs/components/DataTable.md +1 -1
  126. package/docs/components/FileUpload.md +197 -0
  127. package/docs/components/Link.md +28 -12
  128. package/docs/components/List.md +21 -19
  129. package/docs/components/RichTextEditor.md +88 -0
  130. package/docs/components/Sidebar.md +1 -1
  131. 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>;
@@ -0,0 +1,3 @@
1
+ export { useFileUploadItem } from './composables/useFileUploadItem';
2
+ export type { FileUploadItemOwnProps, FileUploadItemProps, } from './fileUploadItem.types';
3
+ export { default as FileUploadItem } from './FileUploadItem.vue';
@@ -0,0 +1,3 @@
1
+ import { useFileUploadItem as e } from "./composables/useFileUploadItem.js";
2
+ import t from "./FileUploadItem.js";
3
+ export { t as FileUploadItem, e as useFileUploadItem };
@@ -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
- type __VLS_Slots = LinkSlots;
3
- declare const __VLS_base: import('vue').DefineComponent<LinkOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<LinkOwnProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
4
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
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 __VLS_WithSlots<T, S> = T & {
8
- new (): {
9
- $slots: S;
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, createElementBlock as a, defineComponent as o, mergeProps as s, openBlock as c, renderSlot as l, unref as u } from "vue";
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 d = [
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(o) {
27
- let { slots: f, merged: p, rootRel: m, rootBind: h, rootHref: g, rootTarget: _, leftIconBind: v, rightIconBind: y, rootAriaDisabled: b } = n(o, {
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, o) => (c(), a("a", s({
29
+ return (n, a) => (s(), r(l(u(h)), o({
33
30
  rel: u(m),
34
- href: u(g)
35
- }, u(h), {
36
- target: u(_),
37
- "aria-disabled": u(b)
38
- }), [
39
- u(e)(u(f), "prepend") ? l(n.$slots, "prepend", {}, void 0, void 0, 0) : u(p).leftIcon ? (c(), r(u(t), s({
40
- key: 1,
41
- size: u(p).size
42
- }, u(v), { icon: u(p).leftIcon }), null, 16, ["size", "icon"])) : i("", !0),
43
- l(n.$slots, "default"),
44
- u(e)(u(f), "append") ? l(n.$slots, "append", {}, void 0, void 0, 2) : u(p).rightIcon ? (c(), r(u(t), s({
45
- key: 3,
46
- size: u(p).size
47
- }, u(y), { icon: u(p).rightIcon }), null, 16, ["size", "icon"])) : i("", !0)
48
- ], 16, d));
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, LinkProps } from '../link.types';
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, LinkLibDefaults>;
5
- export declare function useLink(props: LinkOwnProps, libDefaults: LinkLibDefaults): {
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
- rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, Omit<LinkProps, "color" | "href" | "size" | "classes" | "customProps" | "disabled" | "underline" | "external" | "leftIcon" | "rightIcon">>>;
12
- rootHref: import('vue').ComputedRef<string | undefined>;
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 { computed as r, useAttrs as i, useSlots as a } from "vue";
3
- import { get as o } from "es-toolkit/compat";
4
- import { linkColorProps as s, linkSizeProps as c, linkUnderlineProps as l } from "@bridge-ui/core/Tokens";
5
- import { cn as u, mergeBridgeUILayeredClasses as d, splitComponentProps as f } from "@bridge-ui/core/Utils";
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 p = [
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 m(m, h) {
20
- let g = i(), _ = a(), v = r(() => f({
21
- bridgeKeys: p,
22
+ function h(h, g) {
23
+ let _ = a(), v = o(), y = i(() => p({
24
+ bridgeKeys: m,
22
25
  props: {
23
- ...g,
24
- ...m
26
+ ..._,
27
+ ...h
25
28
  }
26
- })), { merged: y, entry: b } = t({
27
- libDefaults: h,
29
+ })), { merged: b, entry: x } = t({
30
+ libDefaults: g,
28
31
  componentName: "Link",
29
- props: () => v.value.componentProps
30
- }), x = r(() => y.value.customProps), S = n({
31
- entry: b,
32
- props: () => v.value.componentProps
33
- }), C = r(() => !!y.value.disabled), w = r(() => C.value ? !0 : void 0), T = r(() => C.value ? void 0 : y.value.href), E = r(() => {
34
- if (y.value.external && !C.value) return "_blank";
35
- }), D = r(() => {
36
- if (y.value.external && !C.value) return "noopener noreferrer";
37
- }), O = r(() => {
38
- let e = d(c, b.value?.tokens?.size);
39
- return o(e, y.value.size);
40
- }), k = r(() => {
41
- let e = d(s, b.value?.tokens?.color);
42
- return o(e, y.value.color);
43
- }), A = r(() => {
44
- let e = d(l, b.value?.tokens?.underline);
45
- return o(e, y.value.underline);
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: y,
50
- rootRel: D,
51
- rootBind: r(() => e(x.value?.root, v.value.inheritedAttrs, u({
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
- [o(k.value, "base") ?? ""]: !0,
57
- [o(k.value, "hover") ?? ""]: !0,
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
- [S.value.root ?? ""]: !0
66
+ [C.value.root ?? ""]: !0
60
67
  }))),
61
- rootHref: T,
62
- rootTarget: E,
63
- leftIconBind: r(() => e(x.value?.leftIcon, {}, u({
68
+ rootHref: D,
69
+ rootTarget: O,
70
+ leftIconBind: i(() => e(S.value?.leftIcon, {}, d({
64
71
  "shrink-0": !0,
65
- [S.value.leftIcon ?? ""]: !0
72
+ [C.value.leftIcon ?? ""]: !0
66
73
  }))),
67
- rightIconBind: r(() => e(x.value?.rightIcon, {}, u({
74
+ rightIconBind: i(() => e(S.value?.rightIcon, {}, d({
68
75
  "shrink-0": !0,
69
- [S.value.rightIcon ?? ""]: !0
76
+ [C.value.rightIcon ?? ""]: !0
70
77
  }))),
71
- rootAriaDisabled: w
78
+ rootAriaDisabled: E
72
79
  };
73
80
  }
74
81
  //#endregion
75
- export { m as useLink };
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 `<a>`.
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?: string;
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, AnchorHTMLAttributes>;
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
- type __VLS_Slots = ListItemSlots;
3
- declare const __VLS_base: import('vue').DefineComponent<ListItemOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ListItemOwnProps> & Readonly<{}>, {
4
- role: "button" | "option" | "menuitem";
5
- as: "li" | "div";
6
- disabled: boolean;
7
- selected: boolean;
8
- divider: boolean;
9
- interactive: boolean;
10
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
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 __VLS_WithSlots<T, S> = T & {
15
- new (): {
16
- $slots: S;
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
+ }) & {};
@@ -24,6 +24,8 @@ var C = /*@__PURE__*/ d({
24
24
  type: Boolean,
25
25
  default: !1
26
26
  },
27
+ linkAs: {},
28
+ linkProps: {},
27
29
  primary: {},
28
30
  rel: {},
29
31
  role: { default: "button" },
@@ -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, ListItemLibDefaults>;
7
- export declare function useListItem(props: ListItemOwnProps, libDefaults: ListItemLibDefaults, slots: ReturnType<typeof useSlots>): {
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, "target" | "role" | "href" | "value" | "classes" | "customProps" | "primary" | "secondary" | "as" | "disabled" | "selected" | "rel" | "dense" | "divider" | "interactive" | "selectedIcon">, never>>>;
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: string | undefined;
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;