@leaflink/stash 51.12.7 → 51.12.9
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/DataViewToolbar.js +182 -82
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DataViewToolbar.vue.d.ts +10 -0
- package/dist/MenuItem.js +27 -15
- package/dist/MenuItem.js.map +1 -1
- package/dist/MenuItem.vue.d.ts +38 -1
- package/dist/MoreActions.js +324 -346
- package/dist/MoreActions.js.map +1 -1
- package/dist/MoreActions.vue.d.ts +12 -37
- package/dist/PageNavigation.js +73 -40
- package/dist/PageNavigation.js.map +1 -1
- package/dist/Tab.js +1 -1
- package/dist/Tabs.js +3 -9
- package/dist/Tabs.js.map +1 -1
- package/dist/Tabs.vue.d.ts +1 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3Irnlcd.js +130 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3Irnlcd.js.map +1 -0
- package/dist/TextEditor.js +657 -654
- package/dist/TextEditor.js.map +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/components.css +1 -1
- package/dist/{index-DA_ft08e.js → index-C14LhAwV.js} +6 -6
- package/dist/{index-DA_ft08e.js.map → index-C14LhAwV.js.map} +1 -1
- package/dist/useSortable.js +1 -1
- package/package.json +1 -1
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js +0 -159
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js.map +0 -1
package/dist/DataViewToolbar.js
CHANGED
|
@@ -1,125 +1,225 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as
|
|
3
|
-
import { t as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { ref as J, onMounted as H, nextTick as k, onBeforeUnmount as Q, watch as D, defineComponent as X, useTemplateRef as M, inject as Y, useCssModule as Z, computed as ee, onBeforeMount as te, createElementBlock as w, openBlock as l, normalizeClass as P, unref as e, createElementVNode as oe, createCommentVNode as x, createBlock as L, withCtx as r, renderSlot as R, createVNode as b, createTextVNode as ae, toDisplayString as F, Fragment as se } from "vue";
|
|
2
|
+
import { u as le } from "./usePaginationStats-d_q39naC.js";
|
|
3
|
+
import { t as y } from "./locale.js";
|
|
4
|
+
import O from "./Button.js";
|
|
5
|
+
import ne from "./Checkbox.js";
|
|
6
6
|
import "lodash-es/cloneDeep";
|
|
7
|
-
import
|
|
8
|
-
import { D as
|
|
9
|
-
import
|
|
10
|
-
|
|
7
|
+
import U from "./Icon.js";
|
|
8
|
+
import { D as j } from "./DataView.keys-aSOnA4AD.js";
|
|
9
|
+
import ie from "./IconLabel.js";
|
|
10
|
+
import re from "./MoreActions.js";
|
|
11
|
+
import { _ as de } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
12
|
+
function ce(z) {
|
|
13
|
+
const { toolbarEl: n, paginationEl: t, checkboxEl: _, isPaginationEnabled: d, isSelectable: c, isEmpty: u } = z, p = J(null);
|
|
14
|
+
let s = null, o = null;
|
|
15
|
+
const a = () => {
|
|
16
|
+
var h;
|
|
17
|
+
if (!n.value) return;
|
|
18
|
+
const i = n.value.getBoundingClientRect().width;
|
|
19
|
+
let v = 0, g = 0;
|
|
20
|
+
d != null && d.value && t.value && (v = t.value.getBoundingClientRect().width), c != null && c.value && !(u != null && u.value) && ((h = _.value) != null && h.$el) && (g = _.value.$el.getBoundingClientRect().width);
|
|
21
|
+
const S = window.getComputedStyle(n.value), E = parseFloat(S.paddingLeft) || 0, $ = parseFloat(S.paddingRight) || 0, T = Math.max(0, i - v - g - E - $);
|
|
22
|
+
p.value = `${T}px`;
|
|
23
|
+
}, C = () => {
|
|
24
|
+
n.value && (s = new ResizeObserver(() => {
|
|
25
|
+
k(() => {
|
|
26
|
+
a();
|
|
27
|
+
});
|
|
28
|
+
}), s.observe(n.value), t.value && (o = new ResizeObserver(() => {
|
|
29
|
+
k(() => {
|
|
30
|
+
a();
|
|
31
|
+
});
|
|
32
|
+
}), o.observe(t.value)));
|
|
33
|
+
}, B = () => {
|
|
34
|
+
s && (s.disconnect(), s = null), o && (o.disconnect(), o = null);
|
|
35
|
+
};
|
|
36
|
+
return H(() => {
|
|
37
|
+
k(() => {
|
|
38
|
+
a(), C();
|
|
39
|
+
});
|
|
40
|
+
}), Q(() => {
|
|
41
|
+
B();
|
|
42
|
+
}), D([d, c, u], () => {
|
|
43
|
+
k(() => {
|
|
44
|
+
a();
|
|
45
|
+
});
|
|
46
|
+
}), D(t, (i) => {
|
|
47
|
+
o && (o.disconnect(), o = null), i && (o = new ResizeObserver(() => {
|
|
48
|
+
k(() => {
|
|
49
|
+
a();
|
|
50
|
+
});
|
|
51
|
+
}), o.observe(i));
|
|
52
|
+
}), {
|
|
53
|
+
actionsWidth: p,
|
|
54
|
+
updateActionsWidth: a
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const ue = { class: "tw-flex tw-place-items-center" }, pe = {
|
|
11
58
|
key: 0,
|
|
12
|
-
|
|
13
|
-
|
|
59
|
+
ref: "paginationEl",
|
|
60
|
+
class: "stash-data-view-toolbar__pagination tw-flex tw-shrink-0 tw-items-center"
|
|
61
|
+
}, me = {
|
|
14
62
|
key: 0,
|
|
15
|
-
class: "tw-
|
|
16
|
-
},
|
|
63
|
+
class: "tw-mx-1.5"
|
|
64
|
+
}, fe = {
|
|
65
|
+
key: 0,
|
|
66
|
+
class: "tw-mx-1.5 tw-hidden md:tw-block"
|
|
67
|
+
}, we = /* @__PURE__ */ X({
|
|
17
68
|
__name: "DataViewToolbar",
|
|
18
69
|
props: {
|
|
19
70
|
allRowsSelected: { type: Boolean, default: !1 },
|
|
20
71
|
hidePageStats: { type: Boolean, default: !1 },
|
|
21
72
|
radius: { default: void 0 },
|
|
22
73
|
someRowsSelected: { type: Boolean, default: !1 },
|
|
74
|
+
selectedItemsCount: { default: void 0 },
|
|
23
75
|
hasTabsAbove: { type: Boolean, default: !1 }
|
|
24
76
|
},
|
|
25
77
|
emits: ["select"],
|
|
26
|
-
setup(
|
|
27
|
-
const t =
|
|
28
|
-
isWithinModule:
|
|
29
|
-
variant:
|
|
30
|
-
density:
|
|
31
|
-
currentPage:
|
|
32
|
-
hasToolbar:
|
|
33
|
-
isPaginateNextDisabled:
|
|
34
|
-
isPaginationEnabled:
|
|
35
|
-
isSelectable:
|
|
36
|
-
pageCount:
|
|
37
|
-
pageSize:
|
|
38
|
-
totalDataCount:
|
|
39
|
-
goPrevPage:
|
|
40
|
-
goNextPage:
|
|
41
|
-
isEmpty:
|
|
42
|
-
isLoading:
|
|
43
|
-
} =
|
|
44
|
-
|
|
45
|
-
|
|
78
|
+
setup(z, { emit: n }) {
|
|
79
|
+
const t = z, _ = n, d = M("toolbarEl"), c = M("paginationEl"), u = M("checkboxEl"), {
|
|
80
|
+
isWithinModule: p,
|
|
81
|
+
variant: s,
|
|
82
|
+
density: o,
|
|
83
|
+
currentPage: a,
|
|
84
|
+
hasToolbar: C,
|
|
85
|
+
isPaginateNextDisabled: B,
|
|
86
|
+
isPaginationEnabled: i,
|
|
87
|
+
isSelectable: v,
|
|
88
|
+
pageCount: g,
|
|
89
|
+
pageSize: S,
|
|
90
|
+
totalDataCount: E,
|
|
91
|
+
goPrevPage: $,
|
|
92
|
+
goNextPage: T,
|
|
93
|
+
isEmpty: h,
|
|
94
|
+
isLoading: V
|
|
95
|
+
} = Y(j.key, j.defaults), A = J(0), K = Z(), { actionsWidth: q } = ce({
|
|
96
|
+
toolbarEl: d,
|
|
97
|
+
paginationEl: c,
|
|
98
|
+
checkboxEl: u,
|
|
99
|
+
isPaginationEnabled: i,
|
|
100
|
+
isSelectable: v,
|
|
101
|
+
isEmpty: h
|
|
102
|
+
}), W = ee(() => t.radius ? t.radius : p.value ? "none" : s.value === "table" ? t.hasTabsAbove ? "rounded-top-right" : "rounded-top" : "rounded"), G = le({ currentPage: a, pageSize: S, totalItems: E });
|
|
103
|
+
function N() {
|
|
104
|
+
_("select"), A.value++;
|
|
46
105
|
}
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
}), (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"tw-
|
|
53
|
-
"tw-rounded":
|
|
54
|
-
"tw-rounded
|
|
55
|
-
"tw-
|
|
56
|
-
"tw-
|
|
57
|
-
"tw-px-3
|
|
106
|
+
return te(() => {
|
|
107
|
+
C && (C.value = !0);
|
|
108
|
+
}), (m, f) => (l(), w("div", {
|
|
109
|
+
ref: "toolbarEl",
|
|
110
|
+
class: P(["stash-data-view-toolbar tw-flex tw-min-h-15 tw-items-center tw-justify-between tw-bg-white tw-py-1.5 tw-shadow", {
|
|
111
|
+
"tw-border-t tw-border-ice-200": e(p),
|
|
112
|
+
"tw-rounded-tr": W.value === "rounded-top-right",
|
|
113
|
+
"tw-rounded": W.value === "rounded",
|
|
114
|
+
"tw-rounded-t": W.value === "rounded-top",
|
|
115
|
+
"tw-mb-3": e(s) !== "table" && !e(p),
|
|
116
|
+
"tw-px-3": e(o) === "compact",
|
|
117
|
+
"tw-px-3 lg:tw-px-6": e(o) === "comfortable"
|
|
58
118
|
}]),
|
|
59
119
|
"data-test": "stash-data-view-toolbar"
|
|
60
120
|
}, [
|
|
61
|
-
|
|
62
|
-
e(
|
|
63
|
-
|
|
64
|
-
|
|
121
|
+
oe("div", ue, [
|
|
122
|
+
e(v) && !e(h) ? (l(), L(ne, {
|
|
123
|
+
ref: "checkboxEl",
|
|
124
|
+
key: A.value,
|
|
65
125
|
checked: t.allRowsSelected,
|
|
66
126
|
indeterminate: t.someRowsSelected && !t.allRowsSelected,
|
|
67
|
-
title: e(
|
|
68
|
-
disabled: e(
|
|
69
|
-
"onUpdate:indeterminate":
|
|
70
|
-
"onUpdate:checked":
|
|
71
|
-
}, null, 8, ["checked", "indeterminate", "title", "disabled"])) :
|
|
72
|
-
|
|
73
|
-
|
|
127
|
+
title: e(y)("ll.selectAll"),
|
|
128
|
+
disabled: e(V),
|
|
129
|
+
"onUpdate:indeterminate": N,
|
|
130
|
+
"onUpdate:checked": N
|
|
131
|
+
}, null, 8, ["checked", "indeterminate", "title", "disabled"])) : x("", !0),
|
|
132
|
+
m.$slots["more-actions"] ? (l(), L(re, {
|
|
133
|
+
key: 1,
|
|
134
|
+
"more-button-align": "together",
|
|
135
|
+
width: e(q) || void 0,
|
|
136
|
+
"actions-container-class": "tw-flex tw-items-center tw-gap-x-2 lg:tw-mr-6 lg:tw-gap-x-6"
|
|
137
|
+
}, {
|
|
138
|
+
toggle: r(({ toggle: I }) => [
|
|
139
|
+
b(O, {
|
|
140
|
+
"icon-label": "",
|
|
141
|
+
class: "tw-text-blue-500",
|
|
142
|
+
"data-test": "stash-data-view-sort-button|sort-menu-button",
|
|
143
|
+
onClick: I
|
|
144
|
+
}, {
|
|
145
|
+
default: r(() => [
|
|
146
|
+
b(ie, {
|
|
147
|
+
icon: "ellipsis",
|
|
148
|
+
stacked: ""
|
|
149
|
+
}, {
|
|
150
|
+
default: r(() => f[2] || (f[2] = [
|
|
151
|
+
ae(" More ")
|
|
152
|
+
])),
|
|
153
|
+
_: 1
|
|
154
|
+
})
|
|
155
|
+
]),
|
|
156
|
+
_: 2
|
|
157
|
+
}, 1032, ["onClick"])
|
|
158
|
+
]),
|
|
159
|
+
"more-actions": r(() => [
|
|
160
|
+
R(m.$slots, "more-actions")
|
|
161
|
+
]),
|
|
162
|
+
default: r(() => [
|
|
163
|
+
R(m.$slots, "default")
|
|
164
|
+
]),
|
|
165
|
+
_: 3
|
|
166
|
+
}, 8, ["width"])) : (l(), w("div", {
|
|
167
|
+
key: 2,
|
|
168
|
+
class: P([e(K).actions, "stash-data-view-toolbar__actions tw-flex tw-items-center tw-gap-x-2 lg:tw-gap-x-4"])
|
|
74
169
|
}, [
|
|
75
|
-
|
|
76
|
-
], 2)
|
|
170
|
+
R(m.$slots, "default")
|
|
171
|
+
], 2))
|
|
77
172
|
]),
|
|
78
|
-
e(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
173
|
+
e(i) ? (l(), w("div", pe, [
|
|
174
|
+
R(m.$slots, "selected-stats", {}, () => [
|
|
175
|
+
t.someRowsSelected && t.selectedItemsCount !== void 0 ? (l(), w("span", me, F(e(y)("ll.listView.numberOfTotalSelected", { num: t.selectedItemsCount, total: e(E) })), 1)) : x("", !0)
|
|
176
|
+
]),
|
|
177
|
+
R(m.$slots, "page-stats", {}, () => [
|
|
178
|
+
t.hidePageStats ? x("", !0) : (l(), w("span", fe, F(e(y)("ll.pageStats", e(G))), 1))
|
|
179
|
+
]),
|
|
180
|
+
e(g) > 1 ? (l(), w(se, { key: 0 }, [
|
|
181
|
+
b(O, {
|
|
82
182
|
icon: "",
|
|
83
|
-
"aria-label": e(
|
|
84
|
-
class: "tw-
|
|
183
|
+
"aria-label": e(y)("ll.previous"),
|
|
184
|
+
class: "tw-size-9 tw-p-1.5",
|
|
85
185
|
"data-test": "button|prev-page",
|
|
86
|
-
disabled: e(
|
|
87
|
-
onClick:
|
|
186
|
+
disabled: e(V) || e(a) === 1,
|
|
187
|
+
onClick: f[0] || (f[0] = (I) => e($)({ shouldEmit: !0 }))
|
|
88
188
|
}, {
|
|
89
|
-
default:
|
|
90
|
-
|
|
189
|
+
default: r(() => [
|
|
190
|
+
b(U, {
|
|
91
191
|
name: "chevron-left",
|
|
92
192
|
size: "dense"
|
|
93
193
|
})
|
|
94
194
|
]),
|
|
95
195
|
_: 1
|
|
96
196
|
}, 8, ["aria-label", "disabled"]),
|
|
97
|
-
|
|
197
|
+
b(O, {
|
|
98
198
|
icon: "",
|
|
99
|
-
"aria-label": e(
|
|
100
|
-
class: "
|
|
199
|
+
"aria-label": e(y)("ll.next"),
|
|
200
|
+
class: "tw-size-9 tw-p-1.5",
|
|
101
201
|
"data-test": "button|next-page",
|
|
102
|
-
disabled: e(
|
|
103
|
-
onClick:
|
|
202
|
+
disabled: e(V) || e(B) || e(a) === e(g),
|
|
203
|
+
onClick: f[1] || (f[1] = (I) => e(T)({ shouldEmit: !0 }))
|
|
104
204
|
}, {
|
|
105
|
-
default:
|
|
106
|
-
|
|
205
|
+
default: r(() => [
|
|
206
|
+
b(U, {
|
|
107
207
|
name: "chevron-right",
|
|
108
208
|
size: "dense"
|
|
109
209
|
})
|
|
110
210
|
]),
|
|
111
211
|
_: 1
|
|
112
212
|
}, 8, ["aria-label", "disabled"])
|
|
113
|
-
], 64)) :
|
|
114
|
-
])) :
|
|
213
|
+
], 64)) : x("", !0)
|
|
214
|
+
], 512)) : x("", !0)
|
|
115
215
|
], 2));
|
|
116
216
|
}
|
|
117
|
-
}),
|
|
118
|
-
actions:
|
|
119
|
-
},
|
|
120
|
-
$style:
|
|
121
|
-
},
|
|
217
|
+
}), be = "_actions_k8z80_2", ve = {
|
|
218
|
+
actions: be
|
|
219
|
+
}, ge = {
|
|
220
|
+
$style: ve
|
|
221
|
+
}, $e = /* @__PURE__ */ de(we, [["__cssModules", ge]]);
|
|
122
222
|
export {
|
|
123
|
-
|
|
223
|
+
$e as default
|
|
124
224
|
};
|
|
125
225
|
//# sourceMappingURL=DataViewToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataViewToolbar.js","sources":["../src/components/DataViewToolbar/DataViewToolbar.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, ref, useCssModule } from 'vue';\n\n import usePaginationStats from '../../composables/usePaginationStats/usePaginationStats';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Checkbox from '../Checkbox/Checkbox.vue';\n import { DATA_VIEW_INJECTION } from '../DataView/DataView.vue';\n import Icon from '../Icon/Icon.vue';\n import { ToolbarRadiuses } from './DataViewToolbar.types';\n\n export interface DataViewToolbarProps {\n /**\n * When DataView has `variant=\"table\"` and Table has `is-selectable` enabled, it provides a way to flag\n * a checkbox whenever all rows are selected, just like the standalone version on TableHeaderRow.\n */\n allRowsSelected?: boolean;\n\n /**\n * Hides the page statistics (ex: \"1 - 12 of 20\") in the toolbar\n */\n hidePageStats?: boolean;\n\n /**\n * Controls the corners of DataViewToolbar with the \"border-radius\" CSS property. The default value is \"rounded\".\n */\n radius?: ToolbarRadiuses;\n\n /**\n * When DataView has variant=\"table\" and Table has `is-selectable` enabled, it provides a way to flag\n * a checkbox whenever one or more, but not all rows are selected, just like the standalone\n * version on TableHeaderRow.\n */\n someRowsSelected?: boolean;\n\n /**\n * When DataView has tabs above it, we need to remove the top left rounded corner\n */\n hasTabsAbove?: boolean;\n }\n\n const props = withDefaults(defineProps<DataViewToolbarProps>(), {\n allRowsSelected: false,\n hidePageStats: false,\n radius: undefined,\n someRowsSelected: false,\n hasTabsAbove: false,\n });\n const classes = useCssModule();\n\n const emit = defineEmits<{\n (e: 'select'): void;\n }>();\n\n const {\n isWithinModule,\n variant: dataViewVariant,\n density,\n currentPage,\n hasToolbar,\n isPaginateNextDisabled,\n isPaginationEnabled,\n isSelectable,\n pageCount,\n pageSize,\n totalDataCount,\n goPrevPage,\n goNextPage,\n isEmpty,\n isLoading,\n } = inject(DATA_VIEW_INJECTION.key, DATA_VIEW_INJECTION.defaults);\n\n const checkboxKey = ref(0);\n\n const computedRadius = computed<ToolbarRadiuses>(() => {\n if (props.radius) {\n return props.radius;\n }\n\n if (isWithinModule.value) {\n return 'none';\n }\n\n if (dataViewVariant.value === 'table') {\n if (props.hasTabsAbove) {\n return 'rounded-top-right';\n }\n\n return 'rounded-top';\n }\n\n return 'rounded';\n });\n\n const pageStats = usePaginationStats({ currentPage, pageSize, totalItems: totalDataCount });\n\n function onSelect() {\n emit('select');\n\n /**\n * In Vue (as of this writing), if a user checks a native checkbox but the v-model is `false` and does not change from `false`, then the checkbox will display as checked even though the v-model is still `false`.\n * Forcing a re-render with a `key` change allows the checkbox to stay unchecked if its v-model is still `false` and its v-model not been changed.\n * To verify that this is necessary, test the \"select all\" checkbox in the SelectionWithSomeDisabled story in Table.story.ts with and without the `key` attribute.\n */\n checkboxKey.value++;\n }\n\n onBeforeMount(() => {\n if (hasToolbar) {\n hasToolbar.value = true;\n }\n });\n</script>\n\n<template>\n <div\n class=\"stash-data-view-toolbar tw-flex tw-min-h-15 tw-items-center tw-justify-between tw-bg-white tw-py-1.5 tw-shadow\"\n :class=\"{\n 'tw-border-t tw-border-ice-200': isWithinModule,\n 'tw-rounded-tr': computedRadius === 'rounded-top-right',\n 'tw-rounded': computedRadius === 'rounded',\n 'tw-rounded-t': computedRadius === 'rounded-top',\n 'tw-mb-3': dataViewVariant !== 'table' && !isWithinModule,\n 'tw-px-3': density === 'compact',\n 'tw-px-3 lg:tw-px-6': density === 'comfortable',\n }\"\n data-test=\"stash-data-view-toolbar\"\n >\n <div class=\"tw-flex tw-place-items-center\">\n <Checkbox\n v-if=\"isSelectable && !isEmpty\"\n :key=\"checkboxKey\"\n class=\"tw-mr-2\"\n :checked=\"props.allRowsSelected\"\n :indeterminate=\"props.someRowsSelected && !props.allRowsSelected\"\n :title=\"t('ll.selectAll')\"\n :disabled=\"isLoading\"\n @update:indeterminate=\"onSelect\"\n @update:checked=\"onSelect\"\n />\n <div\n :class=\"classes.actions\"\n class=\"stash-data-view-toolbar__actions tw-flex tw-items-center tw-gap-x-2 lg:tw-gap-x-4\"\n >\n <!-- @slot default -->\n <slot></slot>\n </div>\n </div>\n\n <!-- Pagination -->\n <div v-if=\"isPaginationEnabled\" class=\"stash-data-view-toolbar__pagination tw-flex tw-items-center\">\n <span v-if=\"!props.hidePageStats\" class=\"tw-mr-1.5\">\n {{ t('ll.pageStats', pageStats) }}\n </span>\n <template v-if=\"pageCount > 1\">\n <Button\n icon\n :aria-label=\"t('ll.previous')\"\n class=\"tw-ml-1.5 tw-w-auto tw-min-w-auto tw-px-1.5\"\n data-test=\"button|prev-page\"\n :disabled=\"isLoading || currentPage === 1\"\n @click=\"goPrevPage({ shouldEmit: true })\"\n >\n <Icon name=\"chevron-left\" size=\"dense\" />\n </Button>\n <Button\n icon\n :aria-label=\"t('ll.next')\"\n class=\"-tw-mr-4 tw-w-auto tw-min-w-auto tw-p-1.5\"\n data-test=\"button|next-page\"\n :disabled=\"isLoading || isPaginateNextDisabled || currentPage === pageCount\"\n @click=\"goNextPage({ shouldEmit: true })\"\n >\n <Icon name=\"chevron-right\" size=\"dense\" />\n </Button>\n </template>\n </div>\n </div>\n</template>\n\n<style module>\n .actions :global(.stash-button) {\n min-width: auto;\n padding: 0 0.5rem;\n\n &:first-child {\n margin-left: -0.5rem;\n }\n }\n</style>\n"],"names":["props","__props","classes","useCssModule","emit","__emit","isWithinModule","dataViewVariant","density","currentPage","hasToolbar","isPaginateNextDisabled","isPaginationEnabled","isSelectable","pageCount","pageSize","totalDataCount","goPrevPage","goNextPage","isEmpty","isLoading","inject","DATA_VIEW_INJECTION","checkboxKey","ref","computedRadius","computed","pageStats","usePaginationStats","onSelect","onBeforeMount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyCE,UAAMA,IAAQC,GAORC,IAAUC,EAAA,GAEVC,IAAOC,GAIP;AAAA,MACJ,gBAAAC;AAAA,MACA,SAASC;AAAA,MACT,SAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,SAAAC;AAAA,MACA,WAAAC;AAAA,IAAA,IACEC,EAAOC,EAAoB,KAAKA,EAAoB,QAAQ,GAE1DC,IAAcC,EAAI,CAAC,GAEnBC,IAAiBC,EAA0B,MAC3C1B,EAAM,SACDA,EAAM,SAGXM,EAAe,QACV,SAGLC,EAAgB,UAAU,UACxBP,EAAM,eACD,sBAGF,gBAGF,SACR,GAEK2B,IAAYC,EAAmB,EAAE,aAAAnB,GAAa,UAAAM,GAAU,YAAYC,GAAgB;AAE1F,aAASa,IAAW;AAClB,MAAAzB,EAAK,QAAQ,GAObmB,EAAY;AAAA,IACd;AAEA,WAAAO,EAAc,MAAM;AAClB,MAAIpB,MACFA,EAAW,QAAQ;AAAA,IAEvB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"DataViewToolbar.js","sources":["../src/components/DataViewToolbar/useActionsWidth.ts","../src/components/DataViewToolbar/DataViewToolbar.vue"],"sourcesContent":["import { ComputedRef, nextTick, onBeforeUnmount, onMounted, Ref, ref, ShallowRef, watch } from 'vue';\n\nexport interface UseActionsWidthOptions {\n toolbarEl: ShallowRef<HTMLElement | null>;\n paginationEl: ShallowRef<HTMLElement | null>;\n checkboxEl: ShallowRef<{ $el: HTMLElement } | null>;\n isPaginationEnabled: ComputedRef<boolean> | undefined;\n isSelectable: Ref<boolean> | undefined;\n isEmpty: ComputedRef<boolean> | undefined;\n}\n\nexport function useActionsWidth(options: UseActionsWidthOptions) {\n const { toolbarEl, paginationEl, checkboxEl, isPaginationEnabled, isSelectable, isEmpty } = options;\n\n const actionsWidth = ref<string | null>(null);\n let toolbarResizeObserver: ResizeObserver | null = null;\n let paginationResizeObserver: ResizeObserver | null = null;\n\n const updateActionsWidth = () => {\n if (!toolbarEl.value) return;\n\n const toolbarWidth = toolbarEl.value.getBoundingClientRect().width;\n let paginationWidth = 0;\n let checkboxWidth = 0;\n\n // Calculate pagination width if pagination is enabled\n if (isPaginationEnabled?.value && paginationEl.value) {\n paginationWidth = paginationEl.value.getBoundingClientRect().width;\n }\n\n // Calculate checkbox width if selectable and not empty\n if (isSelectable?.value && !isEmpty?.value && checkboxEl.value?.$el) {\n checkboxWidth = checkboxEl.value.$el.getBoundingClientRect().width;\n }\n\n // Get computed styles to calculate padding\n const computedStyle = window.getComputedStyle(toolbarEl.value);\n const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;\n const paddingRight = parseFloat(computedStyle.paddingRight) || 0;\n\n const availableWidth = Math.max(0, toolbarWidth - paginationWidth - checkboxWidth - paddingLeft - paddingRight);\n actionsWidth.value = `${availableWidth}px`;\n };\n\n const setupResizeObserver = () => {\n if (!toolbarEl.value) return;\n\n // Observe toolbar element\n toolbarResizeObserver = new ResizeObserver(() => {\n nextTick(() => {\n updateActionsWidth();\n });\n });\n toolbarResizeObserver.observe(toolbarEl.value);\n\n // Observe pagination element if it exists\n if (paginationEl.value) {\n paginationResizeObserver = new ResizeObserver(() => {\n nextTick(() => {\n updateActionsWidth();\n });\n });\n paginationResizeObserver.observe(paginationEl.value);\n }\n };\n\n const cleanupResizeObserver = () => {\n if (toolbarResizeObserver) {\n toolbarResizeObserver.disconnect();\n toolbarResizeObserver = null;\n }\n if (paginationResizeObserver) {\n paginationResizeObserver.disconnect();\n paginationResizeObserver = null;\n }\n };\n\n onMounted(() => {\n nextTick(() => {\n updateActionsWidth();\n setupResizeObserver();\n });\n });\n\n onBeforeUnmount(() => {\n cleanupResizeObserver();\n });\n\n // Watch for changes in conditions that affect element visibility\n watch([isPaginationEnabled, isSelectable, isEmpty], () => {\n nextTick(() => {\n updateActionsWidth();\n });\n });\n\n // Watch for pagination element changes to setup/cleanup observer\n watch(paginationEl, (newPaginationEl) => {\n // Cleanup old observer if it exists\n if (paginationResizeObserver) {\n paginationResizeObserver.disconnect();\n paginationResizeObserver = null;\n }\n\n // Setup new observer if pagination element exists\n if (newPaginationEl) {\n paginationResizeObserver = new ResizeObserver(() => {\n nextTick(() => {\n updateActionsWidth();\n });\n });\n paginationResizeObserver.observe(newPaginationEl);\n }\n });\n\n return {\n actionsWidth,\n updateActionsWidth,\n };\n}\n","<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, ref, useCssModule, useTemplateRef } from 'vue';\n\n import usePaginationStats from '../../composables/usePaginationStats/usePaginationStats';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Checkbox from '../Checkbox/Checkbox.vue';\n import { DATA_VIEW_INJECTION } from '../DataView/DataView.vue';\n import Icon from '../Icon/Icon.vue';\n import IconLabel from '../IconLabel/IconLabel.vue';\n import MoreActions from '../MoreActions/MoreActions.vue';\n import { ToolbarRadiuses } from './DataViewToolbar.types';\n import { useActionsWidth } from './useActionsWidth';\n\n export interface DataViewToolbarProps {\n /**\n * When DataView has `variant=\"table\"` and Table has `is-selectable` enabled, it provides a way to flag\n * a checkbox whenever all rows are selected, just like the standalone version on TableHeaderRow.\n */\n allRowsSelected?: boolean;\n\n /**\n * Hides the page statistics (ex: \"1 - 12 of 20\") in the toolbar\n */\n hidePageStats?: boolean;\n\n /**\n * Controls the corners of DataViewToolbar with the \"border-radius\" CSS property. The default value is \"rounded\".\n */\n radius?: ToolbarRadiuses;\n\n /**\n * When DataView has variant=\"table\" and Table has `is-selectable` enabled, it provides a way to flag\n * a checkbox whenever one or more, but not all rows are selected, just like the standalone\n * version on TableHeaderRow.\n */\n someRowsSelected?: boolean;\n\n /**\n * The number of selected items. Used to display selected items count in the toolbar.\n */\n selectedItemsCount?: number;\n\n /**\n * When DataView has tabs above it, we need to remove the top left rounded corner\n */\n hasTabsAbove?: boolean;\n }\n\n const props = withDefaults(defineProps<DataViewToolbarProps>(), {\n allRowsSelected: false,\n hidePageStats: false,\n radius: undefined,\n someRowsSelected: false,\n selectedItemsCount: undefined,\n hasTabsAbove: false,\n });\n\n const emit = defineEmits<{\n (e: 'select'): void;\n }>();\n\n // Refs for width calculation\n const toolbarRef = useTemplateRef('toolbarEl');\n const paginationRef = useTemplateRef('paginationEl');\n const checkboxRef = useTemplateRef('checkboxEl');\n\n const {\n isWithinModule,\n variant: dataViewVariant,\n density,\n currentPage,\n hasToolbar,\n isPaginateNextDisabled,\n isPaginationEnabled,\n isSelectable,\n pageCount,\n pageSize,\n totalDataCount,\n goPrevPage,\n goNextPage,\n isEmpty,\n isLoading,\n } = inject(DATA_VIEW_INJECTION.key, DATA_VIEW_INJECTION.defaults);\n\n const checkboxKey = ref(0);\n const classes = useCssModule();\n\n const { actionsWidth } = useActionsWidth({\n toolbarEl: toolbarRef,\n paginationEl: paginationRef,\n checkboxEl: checkboxRef,\n isPaginationEnabled,\n isSelectable,\n isEmpty,\n });\n\n const computedRadius = computed<ToolbarRadiuses>(() => {\n if (props.radius) {\n return props.radius;\n }\n\n if (isWithinModule.value) {\n return 'none';\n }\n\n if (dataViewVariant.value === 'table') {\n if (props.hasTabsAbove) {\n return 'rounded-top-right';\n }\n\n return 'rounded-top';\n }\n\n return 'rounded';\n });\n\n const pageStats = usePaginationStats({ currentPage, pageSize, totalItems: totalDataCount });\n\n function onSelect() {\n emit('select');\n\n /**\n * In Vue (as of this writing), if a user checks a native checkbox but the v-model is `false` and does not change from `false`, then the checkbox will display as checked even though the v-model is still `false`.\n * Forcing a re-render with a `key` change allows the checkbox to stay unchecked if its v-model is still `false` and its v-model not been changed.\n * To verify that this is necessary, test the \"select all\" checkbox in the SelectionWithSomeDisabled story in Table.story.ts with and without the `key` attribute.\n */\n checkboxKey.value++;\n }\n\n onBeforeMount(() => {\n if (hasToolbar) {\n hasToolbar.value = true;\n }\n });\n</script>\n\n<template>\n <div\n ref=\"toolbarEl\"\n class=\"stash-data-view-toolbar tw-flex tw-min-h-15 tw-items-center tw-justify-between tw-bg-white tw-py-1.5 tw-shadow\"\n :class=\"{\n 'tw-border-t tw-border-ice-200': isWithinModule,\n 'tw-rounded-tr': computedRadius === 'rounded-top-right',\n 'tw-rounded': computedRadius === 'rounded',\n 'tw-rounded-t': computedRadius === 'rounded-top',\n 'tw-mb-3': dataViewVariant !== 'table' && !isWithinModule,\n 'tw-px-3': density === 'compact',\n 'tw-px-3 lg:tw-px-6': density === 'comfortable',\n }\"\n data-test=\"stash-data-view-toolbar\"\n >\n <div class=\"tw-flex tw-place-items-center\">\n <Checkbox\n v-if=\"isSelectable && !isEmpty\"\n ref=\"checkboxEl\"\n :key=\"checkboxKey\"\n :checked=\"props.allRowsSelected\"\n :indeterminate=\"props.someRowsSelected && !props.allRowsSelected\"\n :title=\"t('ll.selectAll')\"\n :disabled=\"isLoading\"\n @update:indeterminate=\"onSelect\"\n @update:checked=\"onSelect\"\n />\n <template v-if=\"$slots['more-actions']\">\n <MoreActions\n more-button-align=\"together\"\n :width=\"actionsWidth || undefined\"\n actions-container-class=\"tw-flex tw-items-center tw-gap-x-2 lg:tw-mr-6 lg:tw-gap-x-6\"\n >\n <template #toggle=\"{ toggle }\">\n <Button\n icon-label\n class=\"tw-text-blue-500\"\n data-test=\"stash-data-view-sort-button|sort-menu-button\"\n @click=\"toggle\"\n >\n <IconLabel icon=\"ellipsis\" stacked> More </IconLabel>\n </Button>\n </template>\n <slot></slot>\n <template #more-actions>\n <slot name=\"more-actions\"></slot>\n </template>\n </MoreActions>\n </template>\n <template v-else>\n <div\n :class=\"classes.actions\"\n class=\"stash-data-view-toolbar__actions tw-flex tw-items-center tw-gap-x-2 lg:tw-gap-x-4\"\n >\n <slot></slot>\n </div>\n </template>\n </div>\n\n <!-- Pagination -->\n <div\n v-if=\"isPaginationEnabled\"\n ref=\"paginationEl\"\n class=\"stash-data-view-toolbar__pagination tw-flex tw-shrink-0 tw-items-center\"\n >\n <slot name=\"selected-stats\">\n <span v-if=\"props.someRowsSelected && props.selectedItemsCount !== undefined\" class=\"tw-mx-1.5\">\n {{ t('ll.listView.numberOfTotalSelected', { num: props.selectedItemsCount, total: totalDataCount }) }}\n </span>\n </slot>\n <slot name=\"page-stats\">\n <span v-if=\"!props.hidePageStats\" class=\"tw-mx-1.5 tw-hidden md:tw-block\">\n {{ t('ll.pageStats', pageStats) }}\n </span>\n </slot>\n <template v-if=\"pageCount > 1\">\n <Button\n icon\n :aria-label=\"t('ll.previous')\"\n class=\"tw-size-9 tw-p-1.5\"\n data-test=\"button|prev-page\"\n :disabled=\"isLoading || currentPage === 1\"\n @click=\"goPrevPage({ shouldEmit: true })\"\n >\n <Icon name=\"chevron-left\" size=\"dense\" />\n </Button>\n <Button\n icon\n :aria-label=\"t('ll.next')\"\n class=\"tw-size-9 tw-p-1.5\"\n data-test=\"button|next-page\"\n :disabled=\"isLoading || isPaginateNextDisabled || currentPage === pageCount\"\n @click=\"goNextPage({ shouldEmit: true })\"\n >\n <Icon name=\"chevron-right\" size=\"dense\" />\n </Button>\n </template>\n </div>\n </div>\n</template>\n\n<style module>\n .actions :global(.stash-button) {\n min-width: auto;\n padding: 0 0.5rem;\n\n &:first-child {\n margin-left: -0.5rem;\n }\n }\n</style>\n"],"names":["useActionsWidth","options","toolbarEl","paginationEl","checkboxEl","isPaginationEnabled","isSelectable","isEmpty","actionsWidth","ref","toolbarResizeObserver","paginationResizeObserver","updateActionsWidth","toolbarWidth","paginationWidth","checkboxWidth","_a","computedStyle","paddingLeft","paddingRight","availableWidth","setupResizeObserver","nextTick","cleanupResizeObserver","onMounted","onBeforeUnmount","watch","newPaginationEl","props","__props","emit","__emit","toolbarRef","useTemplateRef","paginationRef","checkboxRef","isWithinModule","dataViewVariant","density","currentPage","hasToolbar","isPaginateNextDisabled","pageCount","pageSize","totalDataCount","goPrevPage","goNextPage","isLoading","inject","DATA_VIEW_INJECTION","checkboxKey","classes","useCssModule","computedRadius","computed","pageStats","usePaginationStats","onSelect","onBeforeMount"],"mappings":"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"}
|
|
@@ -52,6 +52,10 @@ export declare interface DataViewToolbarProps {
|
|
|
52
52
|
* version on TableHeaderRow.
|
|
53
53
|
*/
|
|
54
54
|
someRowsSelected?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The number of selected items. Used to display selected items count in the toolbar.
|
|
57
|
+
*/
|
|
58
|
+
selectedItemsCount?: number;
|
|
55
59
|
/**
|
|
56
60
|
* When DataView has tabs above it, we need to remove the top left rounded corner
|
|
57
61
|
*/
|
|
@@ -63,6 +67,7 @@ allRowsSelected: boolean;
|
|
|
63
67
|
hidePageStats: boolean;
|
|
64
68
|
radius: undefined;
|
|
65
69
|
someRowsSelected: boolean;
|
|
70
|
+
selectedItemsCount: undefined;
|
|
66
71
|
hasTabsAbove: boolean;
|
|
67
72
|
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
68
73
|
select: () => void;
|
|
@@ -71,6 +76,7 @@ allRowsSelected: boolean;
|
|
|
71
76
|
hidePageStats: boolean;
|
|
72
77
|
radius: undefined;
|
|
73
78
|
someRowsSelected: boolean;
|
|
79
|
+
selectedItemsCount: undefined;
|
|
74
80
|
hasTabsAbove: boolean;
|
|
75
81
|
}>>> & Readonly<{
|
|
76
82
|
onSelect?: (() => any) | undefined;
|
|
@@ -79,9 +85,13 @@ radius: "none" | "rounded" | "rounded-top" | "rounded-top-right";
|
|
|
79
85
|
allRowsSelected: boolean;
|
|
80
86
|
hidePageStats: boolean;
|
|
81
87
|
someRowsSelected: boolean;
|
|
88
|
+
selectedItemsCount: number;
|
|
82
89
|
hasTabsAbove: boolean;
|
|
83
90
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
84
91
|
default?(_: {}): any;
|
|
92
|
+
"more-actions"?(_: {}): any;
|
|
93
|
+
"selected-stats"?(_: {}): any;
|
|
94
|
+
"page-stats"?(_: {}): any;
|
|
85
95
|
}>;
|
|
86
96
|
export default _default;
|
|
87
97
|
|
package/dist/MenuItem.js
CHANGED
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as n, useCssModule as r, computed as t, createElementBlock as d, openBlock as u, normalizeClass as m, unref as c, renderSlot as p } from "vue";
|
|
2
|
+
import { _ } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
3
|
+
const f = ["aria-selected", "aria-disabled"], b = /* @__PURE__ */ n({
|
|
4
4
|
__name: "MenuItem",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
props: {
|
|
6
|
+
isSelected: { type: Boolean, default: void 0 },
|
|
7
|
+
isDisabled: { type: Boolean, default: void 0 }
|
|
8
|
+
},
|
|
9
|
+
setup(s) {
|
|
10
|
+
const o = r(), e = s, a = t(() => {
|
|
11
|
+
if (e.isSelected !== void 0)
|
|
12
|
+
return e.isSelected ? "true" : "false";
|
|
13
|
+
}), i = t(() => {
|
|
14
|
+
if (e.isDisabled !== void 0)
|
|
15
|
+
return e.isDisabled ? "true" : void 0;
|
|
16
|
+
});
|
|
17
|
+
return (l, h) => (u(), d("li", {
|
|
8
18
|
"data-test": "stash-menu-item",
|
|
9
19
|
role: "menuitem",
|
|
10
|
-
class:
|
|
20
|
+
class: m(["stash-menu-item tw-mb-1.5 first:tw-mt-0 last:tw-mb-0", c(o).menuitem]),
|
|
21
|
+
"aria-selected": a.value,
|
|
22
|
+
"aria-disabled": i.value
|
|
11
23
|
}, [
|
|
12
|
-
|
|
13
|
-
],
|
|
24
|
+
p(l.$slots, "default")
|
|
25
|
+
], 10, f));
|
|
14
26
|
}
|
|
15
|
-
}),
|
|
16
|
-
menuitem:
|
|
17
|
-
},
|
|
18
|
-
$style:
|
|
19
|
-
},
|
|
27
|
+
}), v = "_menuitem_3ppdb_3", M = {
|
|
28
|
+
menuitem: v
|
|
29
|
+
}, S = {
|
|
30
|
+
$style: M
|
|
31
|
+
}, D = /* @__PURE__ */ _(b, [["__cssModules", S]]);
|
|
20
32
|
export {
|
|
21
|
-
|
|
33
|
+
D as default
|
|
22
34
|
};
|
|
23
35
|
//# sourceMappingURL=MenuItem.js.map
|
package/dist/MenuItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.js","sources":["../src/components/MenuItem/MenuItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n const classes = useCssModule();\n</script>\n\n<template>\n <li\n data-test=\"stash-menu-item\"\n role=\"menuitem\"\n class=\"stash-menu-item tw-mb-1.5 first:tw-mt-0 last:tw-mb-0\"\n :class=\"classes.menuitem\"\n >\n <slot></slot>\n </li>\n</template>\n\n<style module>\n /* apply styling that allows the li or a child <a> or <button> tag to be displayed the same */\n .menuitem:not(:has(> a, > button)),\n .menuitem > :where(a, button) {\n @apply tw-w-full\n tw-rounded\n tw-text-ice-700\n hover:tw-bg-ice-200\n hover:tw-text-ice-700\n tw-no-underline\n hover:tw-no-underline\n disabled:tw-text-ice-500\n disabled:tw-cursor-default\n tw-transition-all\n tw-duration-fast\n tw-ease-swing\n tw-cursor-pointer\n tw-text-left\n tw-py-[10px]\n tw-px-1.5;\n }\n\n .menuitem > :where(a, button) {\n display: block;\n border: 0;\n }\n</style>\n"],"names":["classes","useCssModule"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MenuItem.js","sources":["../src/components/MenuItem/MenuItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, useCssModule } from 'vue';\n\n const classes = useCssModule();\n\n interface MenuItemProps {\n isSelected?: boolean;\n isDisabled?: boolean;\n }\n\n const props = withDefaults(defineProps<MenuItemProps>(), {\n isSelected: undefined,\n isDisabled: undefined,\n });\n\n const ariaSelected = computed(() => {\n if (props.isSelected === undefined) {\n return undefined;\n }\n return props.isSelected ? 'true' : 'false';\n });\n\n const ariaDisabled = computed(() => {\n if (props.isDisabled === undefined) {\n return undefined;\n }\n return props.isDisabled ? 'true' : undefined;\n });\n</script>\n\n<template>\n <li\n data-test=\"stash-menu-item\"\n role=\"menuitem\"\n class=\"stash-menu-item tw-mb-1.5 first:tw-mt-0 last:tw-mb-0\"\n :class=\"classes.menuitem\"\n :aria-selected=\"ariaSelected\"\n :aria-disabled=\"ariaDisabled\"\n >\n <slot></slot>\n </li>\n</template>\n\n<style module>\n /* apply styling that allows the li or a child <a> or <button> tag to be displayed the same */\n .menuitem:not(:has(> a, > button)),\n .menuitem > :where(a, button) {\n @apply tw-w-full\n tw-rounded\n tw-text-ice-700\n hover:tw-bg-ice-200\n hover:tw-text-ice-700\n tw-no-underline\n hover:tw-no-underline\n disabled:tw-text-ice-500\n disabled:tw-cursor-default\n tw-transition-all\n tw-duration-fast\n tw-ease-swing\n tw-cursor-pointer\n tw-text-left\n tw-py-[10px]\n tw-px-1.5;\n }\n\n .menuitem > :where(a, button) {\n display: block;\n border: 0;\n }\n\n .menuitem {\n @apply aria-disabled:tw-text-ice-500\n aria-disabled:tw-pointer-events-none\n aria-disabled:hover:tw-text-ice-500\n aria-disabled:hover:tw-bg-inherit\n aria-disabled:hover:tw-cursor-default\n aria-selected:tw-bg-blue-100;\n }\n\n .menuitem[aria-selected='true']:not(:global(.tw-hidden)) {\n display: flex;\n justify-content: space-between;\n\n &::after {\n content: '';\n display: block;\n width: theme('spacing.5');\n height: theme('spacing.5');\n margin-left: theme('spacing.3');\n flex-shrink: 0;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%233b82f6'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E\");\n background-size: contain;\n background-repeat: no-repeat;\n }\n }\n</style>\n"],"names":["classes","useCssModule","props","__props","ariaSelected","computed","ariaDisabled"],"mappings":";;;;;;;;;AAGE,UAAMA,IAAUC,EAAA,GAOVC,IAAQC,GAKRC,IAAeC,EAAS,MAAM;AAClC,UAAIH,EAAM,eAAe;AAGzB,eAAOA,EAAM,aAAa,SAAS;AAAA,IACrC,CAAC,GAEKI,IAAeD,EAAS,MAAM;AAClC,UAAIH,EAAM,eAAe;AAGzB,eAAOA,EAAM,aAAa,SAAS;AAAA,IACrC,CAAC;;;;;;;;;;;;;;;;"}
|
package/dist/MenuItem.vue.d.ts
CHANGED
|
@@ -1,17 +1,54 @@
|
|
|
1
1
|
import { ComponentOptionsMixin } from 'vue';
|
|
2
2
|
import { ComponentProvideOptions } from 'vue';
|
|
3
3
|
import { DefineComponent } from 'vue';
|
|
4
|
+
import { ExtractPropTypes } from 'vue';
|
|
5
|
+
import { PropType } from 'vue';
|
|
4
6
|
import { PublicProps } from 'vue';
|
|
5
7
|
|
|
8
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
9
|
+
|
|
10
|
+
declare type __VLS_Prettify<T> = {
|
|
11
|
+
[K in keyof T]: T[K];
|
|
12
|
+
} & {};
|
|
13
|
+
|
|
14
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
+
} : {
|
|
18
|
+
type: PropType<T[K]>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
declare type __VLS_WithDefaults<P, D> = {
|
|
24
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
25
|
+
default: D[K];
|
|
26
|
+
}> : P[K];
|
|
27
|
+
};
|
|
28
|
+
|
|
6
29
|
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
7
30
|
new (): {
|
|
8
31
|
$slots: S;
|
|
9
32
|
};
|
|
10
33
|
};
|
|
11
34
|
|
|
12
|
-
declare const _default: __VLS_WithTemplateSlots<DefineComponent<
|
|
35
|
+
declare const _default: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<MenuItemProps>, {
|
|
36
|
+
isSelected: undefined;
|
|
37
|
+
isDisabled: undefined;
|
|
38
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<MenuItemProps>, {
|
|
39
|
+
isSelected: undefined;
|
|
40
|
+
isDisabled: undefined;
|
|
41
|
+
}>>> & Readonly<{}>, {
|
|
42
|
+
isDisabled: boolean;
|
|
43
|
+
isSelected: boolean;
|
|
44
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
13
45
|
default?(_: {}): any;
|
|
14
46
|
}>;
|
|
15
47
|
export default _default;
|
|
16
48
|
|
|
49
|
+
declare interface MenuItemProps {
|
|
50
|
+
isSelected?: boolean;
|
|
51
|
+
isDisabled?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
17
54
|
export { }
|