@xds/vue 1.0.1 → 1.2.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/dist/Banner.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/Breadcrumb.js +4 -0
- package/dist/Breadcrumb.vue.d.ts +6 -0
- package/dist/Breadcrumb.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/Button.vue.d.ts +9 -1
- package/dist/Button.vue_vue_type_script_setup_true_lang.js +18 -5
- package/dist/Checkbox.vue.d.ts +13 -10
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang.js +42 -22
- package/dist/Combobox.js +4 -0
- package/dist/Combobox.vue.d.ts +22 -0
- package/dist/Combobox.vue_vue_type_script_setup_true_lang.js +140 -0
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/DateRangePicker.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/Dialog.vue.d.ts +5 -2
- package/dist/Dialog.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/IconButton.vue.d.ts +9 -1
- package/dist/IconButton.vue_vue_type_script_setup_true_lang.js +18 -5
- package/dist/Labels.vue.d.ts +17 -0
- package/dist/Labels.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/Labels2.js +4 -0
- package/dist/Link.js +4 -0
- package/dist/Link.vue.d.ts +27 -0
- package/dist/Link.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/Menu.vue.d.ts +4 -1
- package/dist/Menu.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/Pagination.js +4 -0
- package/dist/Pagination.vue.d.ts +9 -0
- package/dist/Pagination.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/Popover.js +4 -0
- package/dist/Popover.vue.d.ts +26 -0
- package/dist/Popover.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/RadioGroup.vue_vue_type_script_setup_true_lang.js +13 -7
- package/dist/SearchField.vue.d.ts +11 -8
- package/dist/SearchField.vue_vue_type_script_setup_true_lang.js +40 -22
- package/dist/SegmentedControl.vue.d.ts +3 -7
- package/dist/SegmentedControl.vue_vue_type_script_setup_true_lang.js +13 -14
- package/dist/Select.vue.d.ts +3 -1
- package/dist/Select.vue_vue_type_script_setup_true_lang.js +47 -18
- package/dist/Slider.vue.d.ts +3 -8
- package/dist/Slider.vue_vue_type_script_setup_true_lang.js +11 -10
- package/dist/Switch.vue.d.ts +13 -10
- package/dist/Switch.vue_vue_type_script_setup_true_lang.js +33 -21
- package/dist/Table.js +4 -0
- package/dist/Table.vue.d.ts +10 -0
- package/dist/Table.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/Tabs.vue.d.ts +3 -5
- package/dist/Tabs.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/TextField.vue.d.ts +11 -8
- package/dist/TextField.vue_vue_type_script_setup_true_lang.js +26 -13
- package/dist/TimePicker.js +4 -0
- package/dist/TimePicker.vue.d.ts +10 -0
- package/dist/TimePicker.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/Toast.vue_vue_type_script_setup_true_lang.js +5 -11
- package/dist/ToastQueue.js +4 -0
- package/dist/ToastQueue.vue.d.ts +9 -0
- package/dist/ToastQueue.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/TooltipOverlay.vue.d.ts +1 -0
- package/dist/TooltipOverlay.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/base.d.ts +13 -0
- package/dist/base.js +14 -0
- package/dist/controlled.d.ts +46 -0
- package/dist/controlled.js +64 -2
- package/dist/index.d.ts +14 -3
- package/dist/index.js +11 -1
- package/dist/labels.d.ts +9 -0
- package/dist/labels.js +17 -0
- package/dist/preview.d.ts +20 -3
- package/dist/preview.js +37 -7
- package/dist/trigger.d.ts +7 -0
- package/dist/trigger.js +13 -1
- package/eject/files/Accordion.vue +89 -0
- package/eject/files/AccordionPanel.vue +47 -0
- package/eject/files/Avatar.vue +41 -0
- package/eject/files/AvatarStack.vue +46 -0
- package/eject/files/Badge.vue +29 -0
- package/eject/files/Banner.vue +65 -0
- package/eject/files/Breadcrumb.vue +43 -0
- package/eject/files/Button.vue +93 -0
- package/eject/files/Card.vue +85 -0
- package/eject/files/Checkbox.vue +104 -0
- package/eject/files/Chip.vue +32 -0
- package/eject/files/ChipBar.vue +25 -0
- package/eject/files/Combobox.vue +175 -0
- package/eject/files/CountBadge.vue +45 -0
- package/eject/files/DatePicker.vue +223 -0
- package/eject/files/DateRangePicker.vue +317 -0
- package/eject/files/Dialog.vue +105 -0
- package/eject/files/Divider.vue +15 -0
- package/eject/files/EmptyState.vue +28 -0
- package/eject/files/Icon.vue +34 -0
- package/eject/files/IconButton.vue +71 -0
- package/eject/files/Link.vue +48 -0
- package/eject/files/ListRow.vue +33 -0
- package/eject/files/MediaCard.vue +109 -0
- package/eject/files/Menu.vue +181 -0
- package/eject/files/Pagination.vue +88 -0
- package/eject/files/PlaceRow.vue +54 -0
- package/eject/files/Popover.vue +119 -0
- package/eject/files/ProgressBar.vue +34 -0
- package/eject/files/RadioGroup.vue +126 -0
- package/eject/files/SearchField.vue +129 -0
- package/eject/files/SectionHeader.vue +37 -0
- package/eject/files/SegmentedControl.vue +81 -0
- package/eject/files/Select.vue +269 -0
- package/eject/files/Sidebar.vue +101 -0
- package/eject/files/SidebarRailButton.vue +31 -0
- package/eject/files/Skeleton.vue +27 -0
- package/eject/files/Slider.vue +126 -0
- package/eject/files/Spinner.vue +36 -0
- package/eject/files/Switch.vue +88 -0
- package/eject/files/Table.vue +77 -0
- package/eject/files/Tabs.vue +72 -0
- package/eject/files/Text.vue +22 -0
- package/eject/files/TextField.vue +190 -0
- package/eject/files/Thumbnail.vue +62 -0
- package/eject/files/TimePicker.vue +224 -0
- package/eject/files/Toast.vue +83 -0
- package/eject/files/ToastQueue.vue +54 -0
- package/eject/files/Tooltip.vue +28 -0
- package/eject/files/TooltipOverlay.vue +86 -0
- package/eject/files/accordion.css +89 -0
- package/eject/files/accordion.ts +67 -0
- package/eject/files/avatar-stack.ts +57 -0
- package/eject/files/avatar.ts +42 -0
- package/eject/files/badge.ts +30 -0
- package/eject/files/banner.ts +71 -0
- package/eject/files/base.css +38 -0
- package/eject/files/breadcrumb.css +51 -0
- package/eject/files/breadcrumb.ts +42 -0
- package/eject/files/button.css +241 -0
- package/eject/files/button.ts +106 -0
- package/eject/files/card.ts +58 -0
- package/eject/files/checkbox.ts +52 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/combobox.css +269 -0
- package/eject/files/combobox.ts +85 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +375 -0
- package/eject/files/date-picker.ts +280 -0
- package/eject/files/date-range-picker.ts +338 -0
- package/eject/files/dialog.css +139 -0
- package/eject/files/dialog.ts +15 -0
- package/eject/files/divider.ts +5 -0
- package/eject/files/empty-state.ts +22 -0
- package/eject/files/icon.ts +36 -0
- package/eject/files/link.css +64 -0
- package/eject/files/link.ts +63 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +192 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/overlay.css +40 -0
- package/eject/files/pagination.css +106 -0
- package/eject/files/pagination.ts +68 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/popover.css +101 -0
- package/eject/files/popover.ts +37 -0
- package/eject/files/progress-bar.ts +26 -0
- package/eject/files/radio-group.css +184 -0
- package/eject/files/radio-group.ts +30 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +33 -0
- package/eject/files/select.css +347 -0
- package/eject/files/select.ts +77 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +160 -0
- package/eject/files/slider.ts +80 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +45 -0
- package/eject/files/table.css +107 -0
- package/eject/files/table.ts +84 -0
- package/eject/files/tabs.css +120 -0
- package/eject/files/tabs.ts +37 -0
- package/eject/files/text-field.css +225 -0
- package/eject/files/text-field.ts +64 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/time-picker.ts +113 -0
- package/eject/files/toast-queue.ts +64 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +111 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +1122 -0
- package/package.json +11 -4
- package/styles.css +1135 -167
- package/tailwind.css +1295 -218
package/dist/index.js
CHANGED
|
@@ -3,11 +3,13 @@ import Avatar_default from "./Avatar.js";
|
|
|
3
3
|
import AvatarStack_default from "./AvatarStack.js";
|
|
4
4
|
import Badge_default from "./Badge.js";
|
|
5
5
|
import Banner_default from "./Banner.js";
|
|
6
|
+
import Breadcrumb_default from "./Breadcrumb.js";
|
|
6
7
|
import Button_default from "./Button.js";
|
|
7
8
|
import Card_default from "./Card.js";
|
|
8
9
|
import Checkbox_default from "./Checkbox.js";
|
|
9
10
|
import Chip_default from "./Chip.js";
|
|
10
11
|
import ChipBar_default from "./ChipBar.js";
|
|
12
|
+
import Combobox_default from "./Combobox.js";
|
|
11
13
|
import CountBadge_default from "./CountBadge.js";
|
|
12
14
|
import DatePicker_default from "./DatePicker.js";
|
|
13
15
|
import DateRangePicker_default from "./DateRangePicker.js";
|
|
@@ -17,9 +19,13 @@ import Divider_default from "./Divider.js";
|
|
|
17
19
|
import EmptyState_default from "./EmptyState.js";
|
|
18
20
|
import Icon_default from "./Icon.js";
|
|
19
21
|
import IconButton_default from "./IconButton.js";
|
|
22
|
+
import Labels_default from "./Labels2.js";
|
|
23
|
+
import Link_default from "./Link.js";
|
|
20
24
|
import ListRow_default from "./ListRow.js";
|
|
21
25
|
import MediaCard_default from "./MediaCard.js";
|
|
22
26
|
import Menu_default from "./Menu.js";
|
|
27
|
+
import Pagination_default from "./Pagination.js";
|
|
28
|
+
import Popover_default from "./Popover.js";
|
|
23
29
|
import ProgressBar_default from "./ProgressBar.js";
|
|
24
30
|
import RadioGroup_default from "./RadioGroup.js";
|
|
25
31
|
import SearchField_default from "./SearchField.js";
|
|
@@ -31,10 +37,14 @@ import Skeleton_default from "./Skeleton.js";
|
|
|
31
37
|
import Slider_default from "./Slider.js";
|
|
32
38
|
import Spinner_default from "./Spinner.js";
|
|
33
39
|
import Switch_default from "./Switch.js";
|
|
40
|
+
import Table_default from "./Table.js";
|
|
34
41
|
import Tabs_default from "./Tabs.js";
|
|
35
42
|
import Text_default from "./Text.js";
|
|
36
43
|
import TextField_default from "./TextField.js";
|
|
37
44
|
import Thumbnail_default from "./Thumbnail.js";
|
|
45
|
+
import TimePicker_default from "./TimePicker.js";
|
|
38
46
|
import Toast_default from "./Toast.js";
|
|
47
|
+
import ToastQueue_default from "./ToastQueue.js";
|
|
39
48
|
import Tooltip_default from "./Tooltip.js";
|
|
40
|
-
|
|
49
|
+
import { queueToast } from "@xds/core";
|
|
50
|
+
export { Accordion_default as Accordion, Avatar_default as Avatar, AvatarStack_default as AvatarStack, Badge_default as Badge, Banner_default as Banner, Breadcrumb_default as Breadcrumb, Button_default as Button, Card_default as Card, Checkbox_default as Checkbox, Chip_default as Chip, ChipBar_default as ChipBar, Combobox_default as Combobox, CountBadge_default as CountBadge, DatePicker_default as DatePicker, DateRangePicker_default as DateRangePicker, Defaults_default as Defaults, Dialog_default as Dialog, Divider_default as Divider, EmptyState_default as EmptyState, Icon_default as Icon, IconButton_default as IconButton, Labels_default as Labels, Link_default as Link, ListRow_default as ListRow, MediaCard_default as MediaCard, Menu_default as Menu, Pagination_default as Pagination, Popover_default as Popover, ProgressBar_default as ProgressBar, RadioGroup_default as RadioGroup, SearchField_default as SearchField, SectionHeader_default as SectionHeader, SegmentedControl_default as SegmentedControl, Select_default as Select, Sidebar_default as Sidebar, Skeleton_default as Skeleton, Slider_default as Slider, Spinner_default as Spinner, Switch_default as Switch, Table_default as Table, Tabs_default as Tabs, Text_default as Text, TextField_default as TextField, Thumbnail_default as Thumbnail, TimePicker_default as TimePicker, Toast_default as Toast, ToastQueue_default as ToastQueue, Tooltip_default as Tooltip, queueToast };
|
package/dist/labels.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentLabels } from "@xds/core";
|
|
2
|
+
import { type ComputedRef } from "vue";
|
|
3
|
+
/**
|
|
4
|
+
* Gives the components under the caller `value`, over the labels of the providers around it: it
|
|
5
|
+
* replaces only the labels it names. Only for Labels: the index does not export it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function provideLabels(value: () => Partial<ComponentLabels>): void;
|
|
8
|
+
/** The labels the closest Labels gives, or the English ones. */
|
|
9
|
+
export declare function useLabels(): ComputedRef<ComponentLabels>;
|
package/dist/labels.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { computed, inject, provide } from "vue";
|
|
2
|
+
import { DEFAULT_LABELS, mergeLabels } from "@xds/core";
|
|
3
|
+
// packages/ui-vue/src/labels.ts
|
|
4
|
+
var LABELS = Symbol("labels");
|
|
5
|
+
/**
|
|
6
|
+
* Gives the components under the caller `value`, over the labels of the providers around it: it
|
|
7
|
+
* replaces only the labels it names. Only for Labels: the index does not export it.
|
|
8
|
+
*/
|
|
9
|
+
function provideLabels(value) {
|
|
10
|
+
const outer = inject(LABELS, null);
|
|
11
|
+
provide(LABELS, computed(() => mergeLabels(outer?.value, value())));
|
|
12
|
+
}
|
|
13
|
+
/** The labels the closest Labels gives, or the English ones. */
|
|
14
|
+
function useLabels() {
|
|
15
|
+
return inject(LABELS, computed(() => DEFAULT_LABELS), false);
|
|
16
|
+
}
|
|
17
|
+
export { provideLabels, useLabels };
|
package/dist/preview.d.ts
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
import { type Screen } from "@xds/core/preview";
|
|
2
|
-
import { type PropType, type VNodeChild } from "vue";
|
|
1
|
+
import { type ComponentName, type Screen } from "@xds/core/preview";
|
|
2
|
+
import { type Component, type PropType, type VNodeChild } from "vue";
|
|
3
3
|
export { designPreview } from "@xds/core/preview";
|
|
4
|
+
/**
|
|
5
|
+
* Components to draw in place of the library's, by name: an app's ejected copies (`xds eject`),
|
|
6
|
+
* which the design preview then shows as it shows the library's.
|
|
7
|
+
*/
|
|
8
|
+
export type PreviewComponents = {
|
|
9
|
+
[N in ComponentName]?: Component;
|
|
10
|
+
};
|
|
4
11
|
export declare const Preview: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
12
|
screen: {
|
|
6
13
|
type: PropType<Screen>;
|
|
7
14
|
required: true;
|
|
8
15
|
};
|
|
16
|
+
components: {
|
|
17
|
+
type: PropType<PreviewComponents>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
9
20
|
}>, () => VNodeChild, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
21
|
screen: {
|
|
11
22
|
type: PropType<Screen>;
|
|
12
23
|
required: true;
|
|
13
24
|
};
|
|
14
|
-
|
|
25
|
+
components: {
|
|
26
|
+
type: PropType<PreviewComponents>;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
29
|
+
}>> & Readonly<{}>, {
|
|
30
|
+
components: PreviewComponents;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/preview.js
CHANGED
|
@@ -7,10 +7,13 @@ import Spinner_default from "./Spinner.js";
|
|
|
7
7
|
import Button_default from "./Button.js";
|
|
8
8
|
import IconButton_default from "./IconButton.js";
|
|
9
9
|
import Banner_default from "./Banner.js";
|
|
10
|
+
import Link_default from "./Link.js";
|
|
11
|
+
import Breadcrumb_default from "./Breadcrumb.js";
|
|
10
12
|
import Card_default from "./Card.js";
|
|
11
13
|
import Checkbox_default from "./Checkbox.js";
|
|
12
14
|
import Chip_default from "./Chip.js";
|
|
13
15
|
import ChipBar_default from "./ChipBar.js";
|
|
16
|
+
import Combobox_default from "./Combobox.js";
|
|
14
17
|
import CountBadge_default from "./CountBadge.js";
|
|
15
18
|
import DatePicker_default from "./DatePicker.js";
|
|
16
19
|
import DateRangePicker_default from "./DateRangePicker.js";
|
|
@@ -18,10 +21,13 @@ import Defaults_default from "./Defaults2.js";
|
|
|
18
21
|
import Dialog_default from "./Dialog.js";
|
|
19
22
|
import Divider_default from "./Divider.js";
|
|
20
23
|
import EmptyState_default from "./EmptyState.js";
|
|
24
|
+
import Labels_default from "./Labels2.js";
|
|
21
25
|
import ListRow_default from "./ListRow.js";
|
|
22
26
|
import Thumbnail_default from "./Thumbnail.js";
|
|
23
27
|
import MediaCard_default from "./MediaCard.js";
|
|
24
28
|
import Menu_default from "./Menu.js";
|
|
29
|
+
import Pagination_default from "./Pagination.js";
|
|
30
|
+
import Popover_default from "./Popover.js";
|
|
25
31
|
import ProgressBar_default from "./ProgressBar.js";
|
|
26
32
|
import RadioGroup_default from "./RadioGroup.js";
|
|
27
33
|
import SearchField_default from "./SearchField.js";
|
|
@@ -32,10 +38,13 @@ import Sidebar_default from "./Sidebar.js";
|
|
|
32
38
|
import Skeleton_default from "./Skeleton.js";
|
|
33
39
|
import Slider_default from "./Slider.js";
|
|
34
40
|
import Switch_default from "./Switch.js";
|
|
41
|
+
import Table_default from "./Table.js";
|
|
35
42
|
import Tabs_default from "./Tabs.js";
|
|
36
43
|
import Text_default from "./Text.js";
|
|
37
44
|
import TextField_default from "./TextField.js";
|
|
45
|
+
import TimePicker_default from "./TimePicker.js";
|
|
38
46
|
import Toast_default from "./Toast.js";
|
|
47
|
+
import ToastQueue_default from "./ToastQueue.js";
|
|
39
48
|
import Tooltip_default from "./Tooltip.js";
|
|
40
49
|
import "./index.js";
|
|
41
50
|
import { camelize, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, shallowReactive } from "vue";
|
|
@@ -47,11 +56,13 @@ var COMPONENTS = {
|
|
|
47
56
|
AvatarStack: AvatarStack_default,
|
|
48
57
|
Badge: Badge_default,
|
|
49
58
|
Banner: Banner_default,
|
|
59
|
+
Breadcrumb: Breadcrumb_default,
|
|
50
60
|
Button: Button_default,
|
|
51
61
|
Card: Card_default,
|
|
52
62
|
Checkbox: Checkbox_default,
|
|
53
63
|
Chip: Chip_default,
|
|
54
64
|
ChipBar: ChipBar_default,
|
|
65
|
+
Combobox: Combobox_default,
|
|
55
66
|
CountBadge: CountBadge_default,
|
|
56
67
|
DatePicker: DatePicker_default,
|
|
57
68
|
DateRangePicker: DateRangePicker_default,
|
|
@@ -61,9 +72,13 @@ var COMPONENTS = {
|
|
|
61
72
|
EmptyState: EmptyState_default,
|
|
62
73
|
Icon: Icon_default,
|
|
63
74
|
IconButton: IconButton_default,
|
|
75
|
+
Labels: Labels_default,
|
|
76
|
+
Link: Link_default,
|
|
64
77
|
ListRow: ListRow_default,
|
|
65
78
|
MediaCard: MediaCard_default,
|
|
66
79
|
Menu: Menu_default,
|
|
80
|
+
Pagination: Pagination_default,
|
|
81
|
+
Popover: Popover_default,
|
|
67
82
|
ProgressBar: ProgressBar_default,
|
|
68
83
|
RadioGroup: RadioGroup_default,
|
|
69
84
|
SearchField: SearchField_default,
|
|
@@ -75,11 +90,14 @@ var COMPONENTS = {
|
|
|
75
90
|
Slider: Slider_default,
|
|
76
91
|
Spinner: Spinner_default,
|
|
77
92
|
Switch: Switch_default,
|
|
93
|
+
Table: Table_default,
|
|
78
94
|
Tabs: Tabs_default,
|
|
79
95
|
Text: Text_default,
|
|
80
96
|
TextField: TextField_default,
|
|
81
97
|
Thumbnail: Thumbnail_default,
|
|
98
|
+
TimePicker: TimePicker_default,
|
|
82
99
|
Toast: Toast_default,
|
|
100
|
+
ToastQueue: ToastQueue_default,
|
|
83
101
|
Tooltip: Tooltip_default
|
|
84
102
|
};
|
|
85
103
|
var MODELS = [
|
|
@@ -87,7 +105,12 @@ var MODELS = [
|
|
|
87
105
|
"checked",
|
|
88
106
|
"expanded"
|
|
89
107
|
];
|
|
90
|
-
var ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
108
|
+
var ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
109
|
+
"class",
|
|
110
|
+
"style",
|
|
111
|
+
"id"
|
|
112
|
+
]);
|
|
113
|
+
var isAttribute = (key) => ATTRIBUTES.has(key) || key.startsWith("data-");
|
|
91
114
|
var HOST = Symbol("preview host");
|
|
92
115
|
/** One component of the screen, drawn again when a slot that its props read changes. */
|
|
93
116
|
var Part = defineComponent({
|
|
@@ -102,12 +125,19 @@ var Part = defineComponent({
|
|
|
102
125
|
}
|
|
103
126
|
});
|
|
104
127
|
var Preview = defineComponent({
|
|
105
|
-
props: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
128
|
+
props: {
|
|
129
|
+
screen: {
|
|
130
|
+
type: Object,
|
|
131
|
+
required: true
|
|
132
|
+
},
|
|
133
|
+
components: {
|
|
134
|
+
type: Object,
|
|
135
|
+
default: void 0
|
|
136
|
+
}
|
|
137
|
+
},
|
|
109
138
|
setup(props) {
|
|
110
139
|
const screen = props.screen;
|
|
140
|
+
const components = props.components;
|
|
111
141
|
const state = shallowReactive({ ...screen.state });
|
|
112
142
|
const host = {
|
|
113
143
|
state,
|
|
@@ -123,14 +153,14 @@ var Preview = defineComponent({
|
|
|
123
153
|
return h(slot.tag, attributes, slot.children.map(host.draw));
|
|
124
154
|
},
|
|
125
155
|
part: ({ name, props: given, children }) => {
|
|
126
|
-
const type = COMPONENTS[name];
|
|
156
|
+
const type = components?.[name] ?? COMPONENTS[name];
|
|
127
157
|
const declared = new Set(Object.keys(type.props ?? {}));
|
|
128
158
|
const props = {};
|
|
129
159
|
const slots = {};
|
|
130
160
|
for (const [key, value] of Object.entries(given)) if (key === "onChange") {
|
|
131
161
|
const model = MODELS.find((name) => declared.has(name));
|
|
132
162
|
props[model ? `onUpdate:${model}` : key] = resolve(value, key, host);
|
|
133
|
-
} else if (isCallback(key) || declared.has(camelize(key)) ||
|
|
163
|
+
} else if (isCallback(key) || declared.has(camelize(key)) || isAttribute(key)) props[key] = resolve(value, key, host);
|
|
134
164
|
else slots[key] = () => host.draw(value);
|
|
135
165
|
if (children.length > 0) slots.default = () => host.draw(children);
|
|
136
166
|
return h(type, props, slots);
|
package/dist/trigger.d.ts
CHANGED
|
@@ -30,3 +30,10 @@ export declare const TriggerScope: import("vue").DefineComponent<import("vue").E
|
|
|
30
30
|
* none of its events and so do not open. Bind the result on the element.
|
|
31
31
|
*/
|
|
32
32
|
export declare function useTrigger<T extends object>(own: () => T, inert?: () => boolean): ComputedRef<T>;
|
|
33
|
+
/**
|
|
34
|
+
* A trigger's own props with the app's attributes, which a Button or IconButton binds itself
|
|
35
|
+
* rather than letting them fall through, since a fallen-through `id` would replace the one the
|
|
36
|
+
* overlay gives its trigger, which the overlay's other parts refer to. The app's class, style,
|
|
37
|
+
* listeners and `data-*` attributes reach the button as they fall through elsewhere.
|
|
38
|
+
*/
|
|
39
|
+
export declare function withAttributes(own: object, attributes: Record<string, unknown>): TriggerProps;
|
package/dist/trigger.js
CHANGED
|
@@ -34,4 +34,16 @@ function useTrigger(own, inert = () => false) {
|
|
|
34
34
|
return mergeProps$1(overlays, own());
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A trigger's own props with the app's attributes, which a Button or IconButton binds itself
|
|
39
|
+
* rather than letting them fall through, since a fallen-through `id` would replace the one the
|
|
40
|
+
* overlay gives its trigger, which the overlay's other parts refer to. The app's class, style,
|
|
41
|
+
* listeners and `data-*` attributes reach the button as they fall through elsewhere.
|
|
42
|
+
*/
|
|
43
|
+
function withAttributes(own, attributes) {
|
|
44
|
+
const merged = mergeProps$1(own, attributes);
|
|
45
|
+
const overlay = own.id;
|
|
46
|
+
if (overlay !== void 0) merged.id = overlay;
|
|
47
|
+
return merged;
|
|
48
|
+
}
|
|
49
|
+
export { TriggerScope, useTrigger, withAttributes };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Ejected from `@xds/vue` 1.2.0 by `xds eject`. This copy is the app's own: change it
|
|
3
|
+
as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
|
+
-->
|
|
5
|
+
<script setup lang="ts" generic="Value extends string = string">
|
|
6
|
+
import * as accordion from "@zag-js/accordion";
|
|
7
|
+
import { mergeProps, normalizeProps, useMachine } from "@zag-js/vue";
|
|
8
|
+
import { computed, useId } from "vue";
|
|
9
|
+
// Items whose bodies open and close under their titles, separated by hairlines. The chevron
|
|
10
|
+
// turns over when an item is open, so the state does not depend on color. Opening and closing
|
|
11
|
+
// animate the height, and do not for people who ask for less motion.
|
|
12
|
+
//
|
|
13
|
+
// Each title is a heading holding a button that says whether its body is expanded and which
|
|
14
|
+
// body it controls. A closed body is hidden, but the browser's find in page still opens it.
|
|
15
|
+
import {
|
|
16
|
+
ACCORDION_PARTS,
|
|
17
|
+
type AccordionBaseProps,
|
|
18
|
+
type AccordionItemBase,
|
|
19
|
+
focusTitleOnClick,
|
|
20
|
+
} from "./accordion.ts";
|
|
21
|
+
import AccordionPanel from "./AccordionPanel.vue";
|
|
22
|
+
import Icon from "./Icon.vue";
|
|
23
|
+
|
|
24
|
+
export type AccordionItem<Value extends string = string> = AccordionItemBase<Value> & {
|
|
25
|
+
/** The body, shown under the title while the item is open. */
|
|
26
|
+
content: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type AccordionProps<Value extends string = string> = AccordionBaseProps<Value> & {
|
|
30
|
+
items: readonly AccordionItem<Value>[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// `v-model:expanded`, written out rather than with defineModel: it takes a list it does not
|
|
34
|
+
// change, and hands back a new one, which the owner may change.
|
|
35
|
+
const { expanded, items, multiple = false } = defineProps<AccordionProps<Value>>();
|
|
36
|
+
const emit = defineEmits<{ "update:expanded": [expanded: Value[]] }>();
|
|
37
|
+
|
|
38
|
+
const id = useId();
|
|
39
|
+
const service = useMachine(
|
|
40
|
+
accordion.machine,
|
|
41
|
+
computed(() => ({
|
|
42
|
+
id,
|
|
43
|
+
value: [...expanded],
|
|
44
|
+
onValueChange: (details: accordion.ValueChangeDetails) =>
|
|
45
|
+
emit("update:expanded", details.value as Value[]),
|
|
46
|
+
multiple,
|
|
47
|
+
collapsible: true,
|
|
48
|
+
hiddenUntilFound: true,
|
|
49
|
+
})),
|
|
50
|
+
);
|
|
51
|
+
const api = computed(() => accordion.connect(service, normalizeProps));
|
|
52
|
+
const trigger = (value: Value) =>
|
|
53
|
+
// Runs before Zag's handler.
|
|
54
|
+
mergeProps(api.value.getItemTriggerProps({ value }), { onClick: focusTitleOnClick });
|
|
55
|
+
const body = (value: Value) => {
|
|
56
|
+
// The panel hides itself once it has finished closing.
|
|
57
|
+
const { hidden: _hidden, ...attributes } = api.value.getItemContentProps({ value });
|
|
58
|
+
return attributes;
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<div v-bind="api.getRootProps()" class="{{prefix}}-accordion">
|
|
64
|
+
<div
|
|
65
|
+
v-for="item in items"
|
|
66
|
+
:key="item.value"
|
|
67
|
+
v-bind="api.getItemProps({ value: item.value })"
|
|
68
|
+
class="{{prefix}}-accordion__item"
|
|
69
|
+
>
|
|
70
|
+
<h3
|
|
71
|
+
v-bind="api.getItemHeaderProps({ value: item.value })"
|
|
72
|
+
class="{{prefix}}-accordion__heading"
|
|
73
|
+
>
|
|
74
|
+
<button v-bind="trigger(item.value)" class="{{prefix}}-accordion__trigger group">
|
|
75
|
+
<span :class="ACCORDION_PARTS.text">
|
|
76
|
+
<span :class="ACCORDION_PARTS.title">{{ item.title }}</span>
|
|
77
|
+
<span v-if="item.description" :class="ACCORDION_PARTS.description">
|
|
78
|
+
{{ item.description }}
|
|
79
|
+
</span>
|
|
80
|
+
</span>
|
|
81
|
+
<Icon name="chevron-down" size="sm" :class="ACCORDION_PARTS.chevron" />
|
|
82
|
+
</button>
|
|
83
|
+
</h3>
|
|
84
|
+
<AccordionPanel :attributes="body(item.value)" :open="api.value.includes(item.value)">
|
|
85
|
+
{{ item.content }}
|
|
86
|
+
</AccordionPanel>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Ejected from `@xds/vue` 1.2.0 by `xds eject`. This copy is the app's own: change it
|
|
3
|
+
as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
|
+
-->
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { onMounted, useTemplateRef, watch } from "vue";
|
|
7
|
+
// An item's body. Its height moves between zero and the height of what it holds, and it is
|
|
8
|
+
// hidden only once it has finished closing. Only for Accordion: the index does not export it.
|
|
9
|
+
import { setPanelOpen } from "./accordion.ts";
|
|
10
|
+
|
|
11
|
+
// Zag's attributes come first, so that the panel's own role and aria-hidden win.
|
|
12
|
+
const { open, attributes } = defineProps<{ open: boolean; attributes: Record<string, unknown> }>();
|
|
13
|
+
defineSlots<{ default(): unknown }>();
|
|
14
|
+
const panel = useTemplateRef<HTMLDivElement>("panel");
|
|
15
|
+
// A page rendered on the server shows the panel before onMounted can run, so a closed one starts
|
|
16
|
+
// hidden. Read once so setPanelOpen owns `hidden` from then on.
|
|
17
|
+
const closedAtFirst = !open;
|
|
18
|
+
|
|
19
|
+
// Set before the browser paints, so a closed panel never shows for a frame. Only a change
|
|
20
|
+
// animates.
|
|
21
|
+
onMounted(() => panel.value && setPanelOpen(panel.value, open, false));
|
|
22
|
+
watch(
|
|
23
|
+
() => open,
|
|
24
|
+
(isOpen, _, onCleanup) => {
|
|
25
|
+
// The next toggle takes over from this one.
|
|
26
|
+
if (panel.value) onCleanup(setPanelOpen(panel.value, isOpen, true));
|
|
27
|
+
},
|
|
28
|
+
{ flush: "post" },
|
|
29
|
+
);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<!-- A group: a region is a landmark, and a page of accordions would fill the list of
|
|
34
|
+
landmarks. A closed one is left out of the accessibility tree as soon as it starts
|
|
35
|
+
closing; `hidden="until-found"` alone leaves the empty group in it. A group, not a
|
|
36
|
+
fieldset: it is the body of a disclosure, not a set of form fields. -->
|
|
37
|
+
<div
|
|
38
|
+
v-bind="attributes"
|
|
39
|
+
ref="panel"
|
|
40
|
+
:hidden="closedAtFirst || undefined"
|
|
41
|
+
role="group"
|
|
42
|
+
:aria-hidden="open ? undefined : 'true'"
|
|
43
|
+
class="{{prefix}}-accordion__panel"
|
|
44
|
+
>
|
|
45
|
+
<div class="{{prefix}}-accordion__body"><slot /></div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Ejected from `@xds/vue` 1.2.0 by `xds eject`. This copy is the app's own: change it
|
|
3
|
+
as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
|
+
-->
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { useDefaults, usePicture } from "@xds/vue/base";
|
|
7
|
+
// Stands for a person or a team by a picture, or by their initials when there is none.
|
|
8
|
+
// Assistive technology gets the full name either way. The small size has room for one letter.
|
|
9
|
+
import { type AvatarBaseProps, avatarClass, avatarInitials, pictureClass } from "./avatar.ts";
|
|
10
|
+
import { classes, rootPart } from "./parts.ts";
|
|
11
|
+
|
|
12
|
+
export type { AvatarSize } from "./avatar.ts";
|
|
13
|
+
|
|
14
|
+
export type AvatarProps = AvatarBaseProps;
|
|
15
|
+
|
|
16
|
+
const { name, src, size } = defineProps<AvatarProps>();
|
|
17
|
+
const options = useDefaults("Avatar", () => ({ size }));
|
|
18
|
+
// The picture has no name of its own: the name is on the avatar itself, and a second one
|
|
19
|
+
// would be read twice.
|
|
20
|
+
const picture = usePicture(() => src);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<span
|
|
25
|
+
role="img"
|
|
26
|
+
:aria-label="name"
|
|
27
|
+
:class="classes(rootPart('Avatar'), avatarClass(options.size))"
|
|
28
|
+
>
|
|
29
|
+
{{ avatarInitials(name, options.size)
|
|
30
|
+
}}<img
|
|
31
|
+
v-if="picture.loaded.value !== false && src"
|
|
32
|
+
:ref="(el) => picture.sync(el, src)"
|
|
33
|
+
:src="src"
|
|
34
|
+
alt=""
|
|
35
|
+
aria-hidden="true"
|
|
36
|
+
:class="pictureClass(picture.loaded.value === true)"
|
|
37
|
+
@load="picture.onLoad(src)"
|
|
38
|
+
@error="picture.onError(src)"
|
|
39
|
+
/>
|
|
40
|
+
</span>
|
|
41
|
+
</template>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Ejected from `@xds/vue` 1.2.0 by `xds eject`. This copy is the app's own: change it
|
|
3
|
+
as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
|
+
-->
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { useDefaults } from "@xds/vue/base";
|
|
7
|
+
import { computed } from "vue";
|
|
8
|
+
// Several people in the room of one. Assistive technology gets one image named after
|
|
9
|
+
// everyone in it, including those who did not fit.
|
|
10
|
+
import {
|
|
11
|
+
type AvatarStackBaseProps,
|
|
12
|
+
avatarStack,
|
|
13
|
+
avatarStackClass,
|
|
14
|
+
avatarStackItemClass,
|
|
15
|
+
avatarStackRestClass,
|
|
16
|
+
} from "./avatar-stack.ts";
|
|
17
|
+
import Avatar from "./Avatar.vue";
|
|
18
|
+
import { classes, rootPart } from "./parts.ts";
|
|
19
|
+
|
|
20
|
+
export type AvatarStackProps = AvatarStackBaseProps;
|
|
21
|
+
|
|
22
|
+
const { people, max, size, label } = defineProps<AvatarStackProps>();
|
|
23
|
+
const stack = computed(() => avatarStack(people, max, label));
|
|
24
|
+
// A size, always: the avatars are drawn at the stack's, not at an Avatar default around it.
|
|
25
|
+
const options = useDefaults("AvatarStack", () => ({ size }), { size: "md" });
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<span
|
|
30
|
+
role="img"
|
|
31
|
+
:aria-label="stack.name"
|
|
32
|
+
:class="classes(rootPart('AvatarStack'), avatarStackClass)"
|
|
33
|
+
>
|
|
34
|
+
<span
|
|
35
|
+
v-for="(person, index) in stack.shown"
|
|
36
|
+
:key="index"
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
:class="avatarStackItemClass(options.size)"
|
|
39
|
+
>
|
|
40
|
+
<Avatar :name="person.name" :src="person.src" :size="options.size" />
|
|
41
|
+
</span>
|
|
42
|
+
<span v-if="stack.rest > 0" aria-hidden="true" :class="avatarStackRestClass(options.size)"
|
|
43
|
+
>+{{ stack.rest }}</span
|
|
44
|
+
>
|
|
45
|
+
</span>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Ejected from `@xds/vue` 1.2.0 by `xds eject`. This copy is the app's own: change it
|
|
3
|
+
as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
|
+
-->
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { useDefaults } from "@xds/vue/base";
|
|
7
|
+
// A short status or category. The words carry the meaning; the color only reinforces it, so a
|
|
8
|
+
// badge still reads for someone who cannot tell the tones apart. `dot` adds a small mark for
|
|
9
|
+
// live states such as "connected", and `icon` a drawing in front of the words.
|
|
10
|
+
import { type BadgeBaseProps, badgeClass, badgeDotClass } from "./badge.ts";
|
|
11
|
+
import Icon from "./Icon.vue";
|
|
12
|
+
import { classes, rootPart } from "./parts.ts";
|
|
13
|
+
|
|
14
|
+
export type { BadgeTone } from "./badge.ts";
|
|
15
|
+
|
|
16
|
+
export type BadgeProps = BadgeBaseProps;
|
|
17
|
+
|
|
18
|
+
const { tone, dot = false, icon } = defineProps<BadgeProps>();
|
|
19
|
+
defineSlots<{ default(): unknown }>();
|
|
20
|
+
const options = useDefaults("Badge", () => ({ tone }));
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<span :class="classes(rootPart('Badge'), badgeClass(options.tone))">
|
|
25
|
+
<span v-if="dot" aria-hidden="true" :class="badgeDotClass" />
|
|
26
|
+
<Icon v-if="icon" :name="icon" size="xs" />
|
|
27
|
+
<slot />
|
|
28
|
+
</span>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Ejected from `@xds/vue` 1.2.0 by `xds eject`. This copy is the app's own: change it
|
|
3
|
+
as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
|
+
-->
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { useDefaults, useLabels } from "@xds/vue/base";
|
|
7
|
+
// A message about the whole view or a section of it. Each tone has its own icon shape, so the
|
|
8
|
+
// tone does not depend on color. Problems (`warning`, `danger`) interrupt a screen reader;
|
|
9
|
+
// `info` and `success` wait their turn.
|
|
10
|
+
import {
|
|
11
|
+
BANNER_PARTS,
|
|
12
|
+
type BannerBaseProps,
|
|
13
|
+
bannerClass,
|
|
14
|
+
bannerIconClass,
|
|
15
|
+
bannerIconPath,
|
|
16
|
+
bannerRole,
|
|
17
|
+
} from "./banner.ts";
|
|
18
|
+
import Button from "./Button.vue";
|
|
19
|
+
import IconButton from "./IconButton.vue";
|
|
20
|
+
import { classes, rootPart } from "./parts.ts";
|
|
21
|
+
|
|
22
|
+
export type { BannerTone } from "./banner.ts";
|
|
23
|
+
|
|
24
|
+
export type BannerProps = BannerBaseProps & {
|
|
25
|
+
/** What the person can do about the message. Drawn under it as a small secondary button. */
|
|
26
|
+
action?: { label: string; onPress: () => void };
|
|
27
|
+
/**
|
|
28
|
+
* Shows a close control. The banner does not hide itself: the handler decides what happens
|
|
29
|
+
* to it. A prop rather than an event, since whether there is one decides what is drawn.
|
|
30
|
+
*/
|
|
31
|
+
onDismiss?: () => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const { tone, title, dismissLabel, action, onDismiss } = defineProps<BannerProps>();
|
|
35
|
+
defineSlots<{ default(): unknown }>();
|
|
36
|
+
const options = useDefaults("Banner", () => ({ tone }));
|
|
37
|
+
const labels = useLabels();
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div
|
|
42
|
+
:role="bannerRole(options.tone)"
|
|
43
|
+
:class="classes(rootPart('Banner'), bannerClass(options.tone))"
|
|
44
|
+
>
|
|
45
|
+
<svg viewBox="0 0 24 24" aria-hidden="true" :class="bannerIconClass(options.tone)">
|
|
46
|
+
<path fill="currentColor" :d="bannerIconPath(options.tone)" />
|
|
47
|
+
</svg>
|
|
48
|
+
<div :class="BANNER_PARTS.body">
|
|
49
|
+
<p v-if="title" :class="BANNER_PARTS.title">{{ title }}</p>
|
|
50
|
+
<div><slot /></div>
|
|
51
|
+
<div v-if="action" :class="BANNER_PARTS.action">
|
|
52
|
+
<Button variant="secondary" size="sm" @press="action.onPress()">{{ action.label }}</Button>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div v-if="onDismiss" :class="BANNER_PARTS.dismiss">
|
|
56
|
+
<IconButton
|
|
57
|
+
icon="x"
|
|
58
|
+
:label="dismissLabel ?? labels.dismiss"
|
|
59
|
+
variant="ghost"
|
|
60
|
+
size="sm"
|
|
61
|
+
@press="onDismiss()"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Ejected from `@xds/vue` 1.2.0 by `xds eject`. This copy is the app's own: change it
|
|
3
|
+
as you need. `xds eject --list` says which ejected files differ from what was copied.
|
|
4
|
+
-->
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { useLabels } from "@xds/vue/base";
|
|
7
|
+
// Where the current view sits in the app: the places above it, each a link, then the view
|
|
8
|
+
// itself. A navigation landmark; the current place is marked as the page.
|
|
9
|
+
import { BREADCRUMB_PARTS, BREADCRUMB_SEPARATOR, type BreadcrumbBaseProps } from "./breadcrumb.ts";
|
|
10
|
+
import Icon from "./Icon.vue";
|
|
11
|
+
import Link from "./Link.vue";
|
|
12
|
+
import { rootPart } from "./parts.ts";
|
|
13
|
+
|
|
14
|
+
export type { BreadcrumbItem } from "./breadcrumb.ts";
|
|
15
|
+
export type BreadcrumbProps = BreadcrumbBaseProps;
|
|
16
|
+
|
|
17
|
+
const { items, label } = defineProps<BreadcrumbProps>();
|
|
18
|
+
const labels = useLabels();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<nav :class="rootPart('Breadcrumb')" :aria-label="label ?? labels.breadcrumb">
|
|
23
|
+
<ol :class="BREADCRUMB_PARTS.list">
|
|
24
|
+
<!-- Two places of a trail can share a label, so a place is known by where it is. -->
|
|
25
|
+
<li v-for="(item, index) in items" :key="index" :class="BREADCRUMB_PARTS.item">
|
|
26
|
+
<span
|
|
27
|
+
v-if="index === items.length - 1"
|
|
28
|
+
aria-current="page"
|
|
29
|
+
:class="BREADCRUMB_PARTS.current"
|
|
30
|
+
>{{ item.label }}</span
|
|
31
|
+
>
|
|
32
|
+
<template v-else>
|
|
33
|
+
<Link :href="item.href" @press="item.onPress?.()">{{ item.label }}</Link>
|
|
34
|
+
<Icon
|
|
35
|
+
:name="BREADCRUMB_SEPARATOR.name"
|
|
36
|
+
:size="BREADCRUMB_SEPARATOR.size"
|
|
37
|
+
:class="BREADCRUMB_PARTS.separator"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
40
|
+
</li>
|
|
41
|
+
</ol>
|
|
42
|
+
</nav>
|
|
43
|
+
</template>
|