@bridge-ui/vue 0.11.0 → 0.12.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 (94) hide show
  1. package/dist/Adapters/Examples/icon-fontawesome.js +52 -40
  2. package/dist/Adapters/Examples/icon-heroicons.js +43 -31
  3. package/dist/Adapters/Examples/icon-lucide.js +46 -34
  4. package/dist/Adapters/Examples/icon-phosphor.js +36 -24
  5. package/dist/Adapters/Examples/icon-tabler.js +44 -32
  6. package/dist/Adapters/Examples/rich-text-tiptap.d.ts +5 -0
  7. package/dist/Adapters/Examples/rich-text-tiptap.js +138 -0
  8. package/dist/Adapters/RichText/index.d.ts +1 -0
  9. package/dist/Adapters/RichText/index.js +2 -0
  10. package/dist/Adapters/RichText/mockRichTextAdapter.d.ts +5 -0
  11. package/dist/Adapters/RichText/useRichTextAdapter.d.ts +12 -0
  12. package/dist/Adapters/RichText/useRichTextAdapter.js +13 -0
  13. package/dist/Adapters/index.d.ts +1 -0
  14. package/dist/Adapters/index.js +2 -1
  15. package/dist/Components/ActionFooter/composables/useActionFooter.d.ts +6 -6
  16. package/dist/Components/Autocomplete/composables/useAutocomplete.js +2 -2
  17. package/dist/Components/Breadcrumb/Breadcrumb.vue.d.ts +17 -10
  18. package/dist/Components/Breadcrumb/Breadcrumb.vue_vue_type_script_setup_true_lang.js +7 -2
  19. package/dist/Components/Breadcrumb/breadcrumb.types.d.ts +22 -4
  20. package/dist/Components/Breadcrumb/breadcrumbInjectionKey.d.ts +5 -1
  21. package/dist/Components/Breadcrumb/composables/useBreadcrumb.d.ts +6 -5
  22. package/dist/Components/Breadcrumb/composables/useBreadcrumb.js +2 -0
  23. package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue.d.ts +17 -11
  24. package/dist/Components/BreadcrumbItem/BreadcrumbItem.vue_vue_type_script_setup_true_lang.js +2 -0
  25. package/dist/Components/BreadcrumbItem/breadcrumbItem.types.d.ts +21 -3
  26. package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.d.ts +10 -6
  27. package/dist/Components/BreadcrumbItem/composables/useBreadcrumbItem.js +65 -59
  28. package/dist/Components/Button/Button.vue.d.ts +17 -8
  29. package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +10 -10
  30. package/dist/Components/Button/button.types.d.ts +22 -5
  31. package/dist/Components/Button/composables/useButton.d.ts +198 -8
  32. package/dist/Components/Button/composables/useButton.js +101 -86
  33. package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
  34. package/dist/Components/DataTable/DataTable.vue.d.ts +1 -1
  35. package/dist/Components/DataTable/composables/useDataTable.d.ts +1 -1
  36. package/dist/Components/DataTable/composables/useDataTable.js +288 -282
  37. package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -1
  38. package/dist/Components/Drawer/composables/useDrawer.js +2 -2
  39. package/dist/Components/FileUpload/FileUpload.js +5 -0
  40. package/dist/Components/FileUpload/FileUpload.vue.d.ts +28 -0
  41. package/dist/Components/FileUpload/FileUpload.vue_vue_type_script_setup_true_lang.js +132 -0
  42. package/dist/Components/FileUpload/composables/useFileUpload.d.ts +70 -0
  43. package/dist/Components/FileUpload/composables/useFileUpload.js +210 -0
  44. package/dist/Components/FileUpload/fileUpload.types.d.ts +306 -0
  45. package/dist/Components/FileUpload/index.d.ts +3 -0
  46. package/dist/Components/FileUpload/index.js +3 -0
  47. package/dist/Components/FormField/composables/useFormField.d.ts +1 -1
  48. package/dist/Components/Link/Link.vue.d.ts +17 -8
  49. package/dist/Components/Link/Link.vue_vue_type_script_setup_true_lang.js +30 -25
  50. package/dist/Components/Link/composables/useLink.d.ts +8 -6
  51. package/dist/Components/Link/composables/useLink.js +52 -45
  52. package/dist/Components/Link/link.types.d.ts +21 -4
  53. package/dist/Components/ListItem/ListItem.vue.d.ts +17 -15
  54. package/dist/Components/ListItem/ListItem.vue_vue_type_script_setup_true_lang.js +2 -0
  55. package/dist/Components/ListItem/composables/useListItem.d.ts +7 -6
  56. package/dist/Components/ListItem/composables/useListItem.js +108 -105
  57. package/dist/Components/ListItem/listItem.types.d.ts +19 -3
  58. package/dist/Components/Listbox/composables/useListbox.d.ts +2 -2
  59. package/dist/Components/Menu/composables/useMenu.js +6 -6
  60. package/dist/Components/Modal/composables/useModal.d.ts +1 -1
  61. package/dist/Components/Modal/composables/useModal.js +2 -2
  62. package/dist/Components/RichTextEditor/RichTextEditor.js +5 -0
  63. package/dist/Components/RichTextEditor/RichTextEditor.vue.d.ts +23 -0
  64. package/dist/Components/RichTextEditor/RichTextEditor.vue_vue_type_script_setup_true_lang.js +104 -0
  65. package/dist/Components/RichTextEditor/composables/useRichTextEditor.d.ts +488 -0
  66. package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +226 -0
  67. package/dist/Components/RichTextEditor/index.d.ts +3 -0
  68. package/dist/Components/RichTextEditor/index.js +3 -0
  69. package/dist/Components/RichTextEditor/richTextEditor.types.d.ts +103 -0
  70. package/dist/Components/Select/composables/useSelect.js +2 -2
  71. package/dist/Components/Sidebar/SidebarListItem.vue.d.ts +17 -9
  72. package/dist/Components/Sidebar/SidebarListItem.vue_vue_type_script_setup_true_lang.js +2 -0
  73. package/dist/Components/Sidebar/composables/useSidebarListItem.js +1 -1
  74. package/dist/Components/Sidebar/sidebar.types.d.ts +2 -1
  75. package/dist/Components/Snackbar/composables/useSnackbar.js +1 -1
  76. package/dist/Components/Textarea/composables/useTextarea.js +1 -1
  77. package/dist/Components/Tooltip/composables/useTooltip.js +3 -3
  78. package/dist/Utils/linkAs.d.ts +29 -0
  79. package/dist/Utils/linkAs.js +18 -0
  80. package/dist/augments.d.ts +10 -0
  81. package/dist/index.d.ts +5 -0
  82. package/dist/index.js +175 -170
  83. package/dist/theme.css +3 -0
  84. package/docs/README.md +3 -0
  85. package/docs/components/Breadcrumb.md +16 -0
  86. package/docs/components/BridgeUIProvider.md +18 -1
  87. package/docs/components/Button.md +31 -19
  88. package/docs/components/DataTable.md +1 -1
  89. package/docs/components/FileUpload.md +122 -0
  90. package/docs/components/Link.md +28 -12
  91. package/docs/components/List.md +21 -19
  92. package/docs/components/RichTextEditor.md +88 -0
  93. package/docs/components/Sidebar.md +1 -1
  94. package/package.json +54 -18
@@ -1,4 +1,5 @@
1
1
  import { setDateAdapterForTests as e, useDateAdapter as t } from "./Date/useDateAdapter.js";
2
2
  import { setI18nAdapterForTests as n, useI18nAdapter as r, useResolveMessage as i } from "./I18n/useI18nAdapter.js";
3
3
  import { setIconAdapterForTests as a, useIconAdapter as o } from "./Icon/useIconAdapter.js";
4
- export { e as setDateAdapterForTests, n as setI18nAdapterForTests, a as setIconAdapterForTests, t as useDateAdapter, r as useI18nAdapter, o as useIconAdapter, i as useResolveMessage };
4
+ import { setRichTextAdapterForTests as s, useRichTextAdapter as c } from "./RichText/useRichTextAdapter.js";
5
+ export { e as setDateAdapterForTests, n as setI18nAdapterForTests, a as setIconAdapterForTests, s as setRichTextAdapterForTests, t as useDateAdapter, r as useI18nAdapter, o as useIconAdapter, i as useResolveMessage, c as useRichTextAdapter };
@@ -9,22 +9,22 @@ export declare function useActionFooter(props: ActionFooterOwnProps, libDefaults
9
9
  applyLabel: import('vue').ComputedRef<string>;
10
10
  cancelLabel: import('vue').ComputedRef<string>;
11
11
  mergedClasses: import('vue').ComputedRef<Partial<ActionFooterClasses>>;
12
- applyButtonBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", (Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps & {
12
+ applyButtonBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", (Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps<"button"> & {
13
13
  as: "span";
14
- }, import('vue').HTMLAttributes>> | Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps & {
14
+ }, import('vue').HTMLAttributes>> | Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps<"button"> & {
15
15
  as: "a";
16
- }, import('vue').AnchorHTMLAttributes>> | Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps & {
16
+ }, import('vue').AnchorHTMLAttributes>> | Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps<"button"> & {
17
17
  as?: "button";
18
18
  }, import('vue').ButtonHTMLAttributes>>) | undefined, {
19
19
  onClick: () => void;
20
20
  color: NonNullable<keyof import('@bridge-ui/core/Tokens').ButtonColor | undefined>;
21
21
  variant: keyof import('@bridge-ui/core/Tokens').ButtonVariant | undefined;
22
22
  }>>;
23
- cancelButtonBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", (Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps & {
23
+ cancelButtonBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", (Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps<"button"> & {
24
24
  as: "span";
25
- }, import('vue').HTMLAttributes>> | Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps & {
25
+ }, import('vue').HTMLAttributes>> | Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps<"button"> & {
26
26
  as: "a";
27
- }, import('vue').AnchorHTMLAttributes>> | Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps & {
27
+ }, import('vue').AnchorHTMLAttributes>> | Partial<import('@bridge-ui/core/Utils').MergeHtmlProps<import('../../Button').ButtonOwnProps<"button"> & {
28
28
  as?: "button";
29
29
  }, import('vue').ButtonHTMLAttributes>>) | undefined, {
30
30
  onClick: () => void;
@@ -149,7 +149,7 @@ function m(m, h, g, _, Me) {
149
149
  likeInput: () => M.value,
150
150
  control: () => M.value ? "textarea" : "input"
151
151
  }), nt = a(() => V.value && Ke.value && !m.readonly && !q.isDisabled.value), J = (e) => {
152
- !e || !M.value || De(e);
152
+ e && M.value && De(e);
153
153
  };
154
154
  function rt(e) {
155
155
  return Ge.value.some((t) => f(t, e));
@@ -281,7 +281,7 @@ function m(m, h, g, _, Me) {
281
281
  }
282
282
  async function mt() {
283
283
  let e = k.value.asyncData;
284
- !e?.resolve || R.value.length === 0 || (D.value = Se(await e.resolve(R.value), N.value));
284
+ e?.resolve && R.value.length !== 0 && (D.value = Se(await e.resolve(R.value), N.value));
285
285
  }
286
286
  let $ = a(() => {
287
287
  let e = ke(Ee, me(Le.value, [
@@ -1,13 +1,20 @@
1
1
  import { BreadcrumbOwnProps, BreadcrumbSlots } from './breadcrumb.types';
2
- type __VLS_Slots = BreadcrumbSlots;
3
- declare const __VLS_base: import('vue').DefineComponent<BreadcrumbOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BreadcrumbOwnProps> & Readonly<{}>, {
4
- separator: import('../..').IconSource;
5
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
6
- 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<BreadcrumbOwnProps<T>> & (typeof globalThis extends {
5
+ __VLS_PROPS_FALLBACK: infer P;
6
+ } ? P : {});
7
+ expose: (exposed: {}) => void;
8
+ attrs: any;
9
+ slots: BreadcrumbSlots;
10
+ emit: {};
11
+ }>) => import('vue').VNode & {
12
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
13
+ };
7
14
  declare const _default: typeof __VLS_export;
8
15
  export default _default;
9
- type __VLS_WithSlots<T, S> = T & {
10
- new (): {
11
- $slots: S;
12
- };
13
- };
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
+ }) & {};
@@ -9,16 +9,17 @@ var _ = /*@__PURE__*/ c({
9
9
  classes: {},
10
10
  customProps: {},
11
11
  items: {},
12
+ linkAs: {},
12
13
  maxItems: {},
13
14
  separator: { default: "chevronRight" },
14
15
  size: {}
15
16
  },
16
17
  setup(c) {
17
- let { rootBind: _, listBind: v, collapsedItems: y, hasDefaultSlot: b } = e(c, {
18
+ let _ = c, { rootBind: v, listBind: y, collapsedItems: b, hasDefaultSlot: x } = e(_, {
18
19
  size: "md",
19
20
  separator: "chevronRight"
20
21
  });
21
- return (e, c) => (d(), a("nav", u(l(h(_))), [o("ol", u(l(h(v))), [!h(b) && h(y).length > 0 ? (d(!0), a(n, { key: 0 }, f(h(y), (e, i) => (d(), a(n, { key: e.type === "ellipsis" ? `ellipsis-${i}` : e.index }, [e.type === "ellipsis" ? (d(), r(h(t), {
22
+ return (e, c) => (d(), a("nav", u(l(h(v))), [o("ol", u(l(h(y))), [!h(x) && h(b).length > 0 ? (d(!0), a(n, { key: 0 }, f(h(b), (e, i) => (d(), a(n, { key: e.type === "ellipsis" ? `ellipsis-${i}` : e.index }, [e.type === "ellipsis" ? (d(), r(h(t), {
22
23
  key: 0,
23
24
  as: "span"
24
25
  }, {
@@ -28,9 +29,11 @@ var _ = /*@__PURE__*/ c({
28
29
  key: 1,
29
30
  as: e.item.as,
30
31
  href: e.item.href,
32
+ "link-as": _.linkAs,
31
33
  current: e.item.current,
32
34
  "end-icon": e.item.endIcon,
33
35
  disabled: e.item.disabled,
36
+ "link-props": e.item.linkProps,
34
37
  "start-icon": e.item.startIcon
35
38
  }, {
36
39
  default: g(() => [s(m(e.item.label), 1)]),
@@ -38,9 +41,11 @@ var _ = /*@__PURE__*/ c({
38
41
  }, 1032, [
39
42
  "as",
40
43
  "href",
44
+ "link-as",
41
45
  "current",
42
46
  "end-icon",
43
47
  "disabled",
48
+ "link-props",
44
49
  "start-icon"
45
50
  ]))], 64))), 128)) : i("", !0), p(e.$slots, "default")], 16)], 16));
46
51
  }
@@ -4,6 +4,7 @@ import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
4
4
  import { IconSource } from '../../Adapters/Icon';
5
5
  import { BreadcrumbItemOwnProps } from '../BreadcrumbItem/breadcrumbItem.types';
6
6
  import { IconProps } from '../Icon';
7
+ import { LinkAsTag, LinkHref, LinkPropsOf } from '../../Utils/linkAs';
7
8
  export interface BreadcrumbSizeOverrides {}
8
9
  export interface BreadcrumbClasses {
9
10
  /**
@@ -42,11 +43,19 @@ export interface BreadcrumbCustomProps {
42
43
  /**
43
44
  * Data-driven crumb for the `items` API on `Breadcrumb`.
44
45
  */
45
- export type BreadcrumbItemData = Pick<BreadcrumbItemOwnProps, "as" | "href" | "current" | "endIcon" | "disabled" | "startIcon"> & {
46
+ export type BreadcrumbItemData<T extends LinkAsTag = "a"> = Omit<Pick<BreadcrumbItemOwnProps, "as" | "href" | "current" | "endIcon" | "disabled" | "linkProps" | "startIcon">, "href" | "linkProps"> & {
47
+ /**
48
+ * Link target. When `linkAs` is set, this also accepts that component's `href`.
49
+ */
50
+ href?: LinkHref<T, "a">;
46
51
  /**
47
52
  * Accessible / visible crumb label.
48
53
  */
49
54
  label?: string;
55
+ /**
56
+ * Props forwarded to `linkAs`. Checked against the `Breadcrumb` `linkAs`.
57
+ */
58
+ linkProps?: LinkPropsOf<T, "a">;
50
59
  };
51
60
  export interface BreadcrumbSlots {
52
61
  /**
@@ -61,7 +70,7 @@ export interface BreadcrumbSlots {
61
70
  /**
62
71
  * Breadcrumb nav root. Compose with `BreadcrumbItem` or pass `items`.
63
72
  */
64
- export interface BreadcrumbOwnProps {
73
+ export interface BreadcrumbOwnProps<T extends LinkAsTag = "a"> {
65
74
  /**
66
75
  * Classes for breadcrumb parts.
67
76
  *
@@ -79,7 +88,16 @@ export interface BreadcrumbOwnProps {
79
88
  *
80
89
  * @default undefined
81
90
  */
82
- items?: BreadcrumbItemData[];
91
+ items?: BreadcrumbItemData<T>[];
92
+ /**
93
+ * Default component rendered in place of navigating crumb anchors.
94
+ * Applies to crumbs from `items` and to child `BreadcrumbItem`s that omit their own `linkAs`.
95
+ * The item's `linkAs` wins when both are set.
96
+ * `items[].linkProps` is checked against this component.
97
+ *
98
+ * @default undefined
99
+ */
100
+ linkAs?: T;
83
101
  /**
84
102
  * Collapse middle crumbs when the list exceeds this count (`items` API).
85
103
  *
@@ -99,4 +117,4 @@ export interface BreadcrumbOwnProps {
99
117
  */
100
118
  size?: MergeProps<BreadcrumbSize, BreadcrumbSizeOverrides>;
101
119
  }
102
- export type BreadcrumbProps = MergeHtmlProps<BreadcrumbOwnProps, HTMLAttributes>;
120
+ export type BreadcrumbProps<T extends LinkAsTag = "a"> = MergeHtmlProps<BreadcrumbOwnProps<T>, HTMLAttributes>;
@@ -1,10 +1,14 @@
1
- import { ComputedRef, InjectionKey, VNodeChild } from 'vue';
1
+ import { Component, ComputedRef, InjectionKey, VNodeChild } from 'vue';
2
2
  import { IconSource } from '../../Adapters/Icon';
3
3
  import { IconProps } from '../Icon';
4
4
  /**
5
5
  * Shared breadcrumb chrome for `BreadcrumbItem` descendants.
6
6
  */
7
7
  export type BreadcrumbContextValue = {
8
+ /**
9
+ * Default component for navigating crumbs. Item `linkAs` wins.
10
+ */
11
+ linkAs?: string | Component;
8
12
  /**
9
13
  * Separator icon when no custom separator slot is set.
10
14
  */
@@ -1,20 +1,21 @@
1
1
  import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
2
2
  import { BreadcrumbOwnProps, BreadcrumbProps } from '../breadcrumb.types';
3
3
  import { BreadcrumbContextValue } from '../breadcrumbInjectionKey';
4
+ import { LinkAsTag } from '../../../Utils/linkAs';
4
5
  type BreadcrumbLibDefaults = LibDefaultsShape<BreadcrumbOwnProps, "size" | "separator">;
5
- type BreadcrumbMerged = MergeLibDefaults<BreadcrumbOwnProps, BreadcrumbLibDefaults>;
6
- export declare function useBreadcrumb(props: BreadcrumbOwnProps, libDefaults: BreadcrumbLibDefaults): {
7
- merged: import('vue').ComputedRef<BreadcrumbMerged>;
6
+ type BreadcrumbMerged<T extends LinkAsTag = "a"> = MergeLibDefaults<BreadcrumbOwnProps<T>, BreadcrumbLibDefaults>;
7
+ export declare function useBreadcrumb<T extends LinkAsTag = "a">(props: BreadcrumbOwnProps<T>, libDefaults: BreadcrumbLibDefaults): {
8
+ merged: import('vue').ComputedRef<BreadcrumbMerged<T>>;
8
9
  rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
9
10
  "aria-label": string;
10
11
  class: string;
11
- }, "class", import('vue').HTMLAttributes | undefined, Omit<BreadcrumbProps, "size" | "classes" | "customProps" | "separator" | "items" | "maxItems">>>;
12
+ }, "class", import('vue').HTMLAttributes | undefined, Omit<BreadcrumbProps<T>, "size" | "classes" | "customProps" | "linkAs" | "separator" | "items" | "maxItems">>>;
12
13
  listBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
13
14
  role: string;
14
15
  class: string;
15
16
  }, "class", import('vue').OlHTMLAttributes | undefined, {}>>;
16
17
  contextValue: import('vue').ComputedRef<BreadcrumbContextValue>;
17
- collapsedItems: import('vue').ComputedRef<import('@bridge-ui/core/Domain').CollapsedBreadcrumbEntry<import('../breadcrumb.types').BreadcrumbItemData>[]>;
18
+ collapsedItems: import('vue').ComputedRef<import('@bridge-ui/core/Domain').CollapsedBreadcrumbEntry<import('../breadcrumb.types').BreadcrumbItemData<T>>[]>;
18
19
  hasDefaultSlot: import('vue').ComputedRef<boolean>;
19
20
  };
20
21
  export {};
@@ -9,6 +9,7 @@ import { cn as d, mergeBridgeUILayeredClasses as f, splitComponentProps as p } f
9
9
  var m = [
10
10
  "size",
11
11
  "items",
12
+ "linkAs",
12
13
  "classes",
13
14
  "maxItems",
14
15
  "separator",
@@ -29,6 +30,7 @@ function h(h, g) {
29
30
  entry: x,
30
31
  props: () => y.value.componentProps
31
32
  }), T = i(() => f(u, x.value?.tokens?.size)), E = i(() => c(T.value, b.value.size)), D = i(() => ({
33
+ linkAs: b.value.linkAs,
32
34
  separator: b.value.separator,
33
35
  separatorIconProps: S.value?.separator,
34
36
  separatorClass: c(w.value, "separator"),
@@ -1,14 +1,20 @@
1
1
  import { BreadcrumbItemOwnProps, BreadcrumbItemSlots } from './breadcrumbItem.types';
2
- type __VLS_Slots = BreadcrumbItemSlots;
3
- declare const __VLS_base: import('vue').DefineComponent<BreadcrumbItemOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BreadcrumbItemOwnProps> & Readonly<{}>, {
4
- disabled: boolean;
5
- current: boolean;
6
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
7
- 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<BreadcrumbItemOwnProps<T>> & (typeof globalThis extends {
5
+ __VLS_PROPS_FALLBACK: infer P;
6
+ } ? P : {});
7
+ expose: (exposed: {}) => void;
8
+ attrs: any;
9
+ slots: BreadcrumbItemSlots;
10
+ emit: {};
11
+ }>) => import('vue').VNode & {
12
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
13
+ };
8
14
  declare const _default: typeof __VLS_export;
9
15
  export default _default;
10
- type __VLS_WithSlots<T, S> = T & {
11
- new (): {
12
- $slots: S;
13
- };
14
- };
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
+ }) & {};
@@ -20,6 +20,8 @@ var g = /*@__PURE__*/ s({
20
20
  },
21
21
  endIcon: {},
22
22
  href: {},
23
+ linkAs: {},
24
+ linkProps: {},
23
25
  startIcon: {}
24
26
  },
25
27
  setup(s) {
@@ -2,6 +2,7 @@ import { HTMLAttributes, Slot } from 'vue';
2
2
  import { MergeHtmlProps } from '@bridge-ui/core/Utils';
3
3
  import { IconSource } from '../../Adapters/Icon';
4
4
  import { IconProps } from '../Icon';
5
+ import { LinkAsTag, LinkHref, LinkPropsOf } from '../../Utils/linkAs';
5
6
  export interface BreadcrumbItemClasses {
6
7
  /**
7
8
  * Classes merged onto the current-page crumb.
@@ -87,7 +88,7 @@ export interface BreadcrumbItemSlots {
87
88
  /**
88
89
  * One breadcrumb crumb. Must be used inside `Breadcrumb`.
89
90
  */
90
- export interface BreadcrumbItemOwnProps {
91
+ export interface BreadcrumbItemOwnProps<T extends LinkAsTag = "a"> {
91
92
  /**
92
93
  * Element to render for the interactive crumb.
93
94
  *
@@ -126,10 +127,27 @@ export interface BreadcrumbItemOwnProps {
126
127
  endIcon?: IconSource;
127
128
  /**
128
129
  * Link target when rendered as an anchor.
130
+ * When `linkAs` is set, this also accepts that component's `href`.
129
131
  *
130
132
  * @default undefined
131
133
  */
132
- href?: string;
134
+ href?: LinkHref<T, "a">;
135
+ /**
136
+ * Component rendered in place of the navigating crumb `<a>`.
137
+ * Wins over `linkAs` on the parent `Breadcrumb`.
138
+ * Ignored when `current`, `disabled`, `as="button"`, or `as="span"`.
139
+ *
140
+ * @default undefined
141
+ */
142
+ linkAs?: T;
143
+ /**
144
+ * Props forwarded to `linkAs` (`method`, `replace`, `prefetch`, and so on).
145
+ * Checked against that component. Set `linkAs` on this crumb for the check
146
+ * to use this component; a parent `linkAs` still renders when this is omitted.
147
+ *
148
+ * @default undefined
149
+ */
150
+ linkProps?: LinkPropsOf<T, "a">;
133
151
  /**
134
152
  * Icon at the inline start.
135
153
  *
@@ -137,4 +155,4 @@ export interface BreadcrumbItemOwnProps {
137
155
  */
138
156
  startIcon?: IconSource;
139
157
  }
140
- export type BreadcrumbItemProps = MergeHtmlProps<BreadcrumbItemOwnProps, HTMLAttributes>;
158
+ export type BreadcrumbItemProps<T extends LinkAsTag = "a"> = MergeHtmlProps<BreadcrumbItemOwnProps<T>, HTMLAttributes>;
@@ -1,20 +1,24 @@
1
1
  import { IconSize } from '@bridge-ui/core/Tokens';
2
2
  import { BreadcrumbItemOwnProps, BreadcrumbItemProps } from '../breadcrumbItem.types';
3
- export declare function useBreadcrumbItem(props: BreadcrumbItemOwnProps): {
3
+ import { LinkAsTag } from '../../../Utils/linkAs';
4
+ export declare function useBreadcrumbItem<T extends LinkAsTag = "a">(props: BreadcrumbItemOwnProps<T>): {
4
5
  slots: Readonly<{
5
6
  [name: string]: import('vue').Slot<any> | undefined;
6
7
  }>;
7
- merged: import('vue').ComputedRef<BreadcrumbItemOwnProps>;
8
- crumbAs: import('vue').ComputedRef<"a" | "span" | "button">;
8
+ merged: import('vue').ComputedRef<BreadcrumbItemOwnProps<T>>;
9
+ crumbAs: import('vue').ComputedRef<string | import('vue').Component>;
9
10
  rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
10
11
  class: string;
11
- }, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<BreadcrumbItemProps, "href" | "classes" | "customProps" | "as" | "disabled" | "endIcon" | "startIcon" | "current">, "aria-label" | "aria-labelledby">>>;
12
+ }, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<BreadcrumbItemProps<T>, "href" | "classes" | "customProps" | "as" | "disabled" | "endIcon" | "linkAs" | "linkProps" | "startIcon" | "current">, "aria-label" | "aria-labelledby">>>;
12
13
  linkBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
13
14
  "aria-disabled": true | undefined;
14
15
  "aria-current": "page" | undefined;
15
- href: string | undefined;
16
+ href: import('../../../Utils/linkAs').LinkHref<T, "a"> | undefined;
16
17
  class: string;
17
- }, "class", import('vue').HTMLAttributes | undefined, Pick<Omit<BreadcrumbItemProps, "href" | "classes" | "customProps" | "as" | "disabled" | "endIcon" | "startIcon" | "current">, "aria-label" | "aria-labelledby">>>;
18
+ }, "class", import('vue').HTMLAttributes | undefined, {
19
+ 'aria-label'?: string | undefined | undefined;
20
+ 'aria-labelledby'?: string | undefined | undefined;
21
+ }>>;
18
22
  iconSize: import('vue').ComputedRef<keyof IconSize>;
19
23
  endIconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
20
24
  size: keyof IconSize;
@@ -1,87 +1,93 @@
1
1
  import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
2
- import { BREADCRUMB_INJECTION_KEY as r } from "../../Breadcrumb/breadcrumbInjectionKey.js";
3
- import { computed as i, inject as a, useAttrs as o, useSlots as s } from "vue";
4
- import { get as c, omit as l, pick as u } from "es-toolkit/compat";
5
- import { cn as d, splitComponentProps as f } from "@bridge-ui/core/Utils";
2
+ import { resolveLinkAsProps as r } from "../../../Utils/linkAs.js";
3
+ import { BREADCRUMB_INJECTION_KEY as i } from "../../Breadcrumb/breadcrumbInjectionKey.js";
4
+ import { computed as a, inject as o, useAttrs as s, useSlots as c } from "vue";
5
+ import { get as l, omit as u, pick as d } from "es-toolkit/compat";
6
+ import { cn as f, splitComponentProps as p } from "@bridge-ui/core/Utils";
6
7
  //#region src/Components/BreadcrumbItem/composables/useBreadcrumbItem.ts
7
- var p = [
8
+ var m = [
8
9
  "as",
9
10
  "href",
11
+ "linkAs",
10
12
  "classes",
11
13
  "current",
12
14
  "endIcon",
13
15
  "disabled",
16
+ "linkProps",
14
17
  "startIcon",
15
18
  "customProps"
16
19
  ];
17
- function m(m) {
18
- let h = o(), g = s(), _ = a(r, null);
19
- if (!_) throw Error("BreadcrumbItem must be used within a Breadcrumb provider");
20
- let v = _, y = i(() => f({
20
+ function h(h) {
21
+ let g = s(), _ = c(), v = o(i, null);
22
+ if (!v) throw Error("BreadcrumbItem must be used within a Breadcrumb provider");
23
+ let y = v, b = a(() => p({
21
24
  props: {
22
- ...h,
23
- ...m
25
+ ...g,
26
+ ...h
24
27
  },
25
- bridgeKeys: p
26
- })), { merged: b, entry: x } = t({
28
+ bridgeKeys: m
29
+ })), { merged: x, entry: S } = t({
27
30
  componentName: "BreadcrumbItem",
28
- props: () => y.value.componentProps
29
- }), S = i(() => b.value.customProps), C = i(() => b.value.current === !0), w = i(() => b.value.disabled === !0), T = i(() => v.value.tokenClasses.iconSize ?? "md"), E = i(() => C.value || w.value ? "span" : b.value.as ? b.value.as : b.value.href == null ? "span" : "a"), D = n({
30
- entry: x,
31
- props: () => y.value.componentProps
32
- }), O = i(() => u(y.value.inheritedAttrs, ["aria-label", "aria-labelledby"])), k = i(() => l(y.value.inheritedAttrs, ["aria-label", "aria-labelledby"])), A = i(() => e(S.value?.root, k.value, { class: d({
33
- [v.value.tokenClasses.item ?? ""]: !0,
34
- [c(D.value, "root") ?? ""]: !0
35
- }) })), j = i(() => e({}, {}, {
31
+ props: () => b.value.componentProps
32
+ }), C = a(() => x.value.customProps), w = a(() => x.value.current === !0), T = a(() => x.value.disabled === !0), E = a(() => y.value.tokenClasses.iconSize ?? "md"), D = a(() => w.value || T.value ? "span" : x.value.as === "button" || x.value.as === "span" ? x.value.as : x.value.as !== "a" && x.value.href == null ? "span" : x.value.linkAs ?? y.value.linkAs ?? "a"), O = n({
33
+ entry: S,
34
+ props: () => b.value.componentProps
35
+ }), k = a(() => d(b.value.inheritedAttrs, ["aria-label", "aria-labelledby"])), A = a(() => u(b.value.inheritedAttrs, ["aria-label", "aria-labelledby"])), j = a(() => e(C.value?.root, A.value, { class: f({
36
+ [y.value.tokenClasses.item ?? ""]: !0,
37
+ [l(O.value, "root") ?? ""]: !0
38
+ }) })), M = a(() => e({}, {}, {
36
39
  "aria-hidden": !0,
37
40
  "data-slot": "separator",
38
- class: d({
39
- [v.value.tokenClasses.separator ?? ""]: !0,
40
- [v.value.separatorClass ?? ""]: !0,
41
- [c(D.value, "separator") ?? ""]: !0
41
+ class: f({
42
+ [y.value.tokenClasses.separator ?? ""]: !0,
43
+ [y.value.separatorClass ?? ""]: !0,
44
+ [l(O.value, "separator") ?? ""]: !0
42
45
  })
43
- })), M = i(() => e(S.value?.separator ?? v.value.separatorIconProps, {}, {
44
- size: T.value,
45
- class: d({ "shrink-0": !0 })
46
- })), N = i(() => {
47
- let t = C.value, n = t ? S.value?.current : S.value?.link;
48
- return e(n, O.value, {
49
- "aria-disabled": w.value || void 0,
46
+ })), N = a(() => e(C.value?.separator ?? y.value.separatorIconProps, {}, {
47
+ size: E.value,
48
+ class: f({ "shrink-0": !0 })
49
+ })), P = a(() => {
50
+ let t = w.value, n = t ? C.value?.current : C.value?.link;
51
+ return e(n, {
52
+ ...k.value,
53
+ ...r(x.value.linkAs ?? y.value.linkAs, x.value.linkProps, D.value)
54
+ }, {
55
+ "aria-disabled": T.value || void 0,
50
56
  "aria-current": t ? "page" : void 0,
51
- href: !t && !w.value ? b.value.href : void 0,
52
- class: d({
53
- [t ? v.value.tokenClasses.current ?? "" : v.value.tokenClasses.link ?? ""]: !0,
54
- [c(D.value, t ? "current" : "link") ?? ""]: !0,
55
- "pointer-events-none opacity-50": w.value && !t
57
+ href: !t && !T.value ? x.value.href : void 0,
58
+ class: f({
59
+ [t ? y.value.tokenClasses.current ?? "" : y.value.tokenClasses.link ?? ""]: !0,
60
+ [l(O.value, t ? "current" : "link") ?? ""]: !0,
61
+ "pointer-events-none opacity-50": T.value && !t
56
62
  })
57
63
  });
58
- }), P = i(() => e(S.value?.startIcon, {}, {
59
- size: T.value,
60
- class: d({
64
+ }), F = a(() => e(C.value?.startIcon, {}, {
65
+ size: E.value,
66
+ class: f({
61
67
  "shrink-0": !0,
62
- [c(D.value, "startIcon") ?? ""]: !0
68
+ [l(O.value, "startIcon") ?? ""]: !0
63
69
  })
64
- })), F = i(() => e(S.value?.endIcon, {}, {
65
- size: T.value,
66
- class: d({
70
+ })), I = a(() => e(C.value?.endIcon, {}, {
71
+ size: E.value,
72
+ class: f({
67
73
  "shrink-0": !0,
68
- [c(D.value, "endIcon") ?? ""]: !0
74
+ [l(O.value, "endIcon") ?? ""]: !0
69
75
  })
70
- })), I = i(() => g.separator ? g.separator : v.value.separatorSlot);
76
+ })), L = a(() => _.separator ? _.separator : y.value.separatorSlot);
71
77
  return {
72
- slots: g,
73
- merged: b,
74
- crumbAs: E,
75
- rootBind: A,
76
- linkBind: N,
77
- iconSize: T,
78
- endIconBind: F,
79
- startIconBind: P,
80
- separatorBind: j,
81
- separatorIcon: i(() => v.value.separator),
82
- separatorContent: I,
83
- separatorIconBind: M
78
+ slots: _,
79
+ merged: x,
80
+ crumbAs: D,
81
+ rootBind: j,
82
+ linkBind: P,
83
+ iconSize: E,
84
+ endIconBind: I,
85
+ startIconBind: F,
86
+ separatorBind: M,
87
+ separatorIcon: a(() => y.value.separator),
88
+ separatorContent: L,
89
+ separatorIconBind: N
84
90
  };
85
91
  }
86
92
  //#endregion
87
- export { m as useBreadcrumbItem };
93
+ export { h as useBreadcrumbItem };
@@ -1,11 +1,20 @@
1
1
  import { ButtonOwnProps, ButtonSlots } from './button.types';
2
- type __VLS_Slots = ButtonSlots;
3
- declare const __VLS_base: import('vue').DefineComponent<ButtonOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ButtonOwnProps> & 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 = "button">(__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<ButtonOwnProps<T>> & (typeof globalThis extends {
5
+ __VLS_PROPS_FALLBACK: infer P;
6
+ } ? P : {});
7
+ expose: (exposed: {}) => void;
8
+ attrs: any;
9
+ slots: ButtonSlots;
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
+ }) & {};