@leaflink/stash 53.4.6 → 53.4.8

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 (58) hide show
  1. package/dist/AppSidebar.js +56 -52
  2. package/dist/AppSidebar.js.map +1 -1
  3. package/dist/AppTopbar.js +1 -1
  4. package/dist/Copy.js +1 -1
  5. package/dist/DataViewFilters.js +1 -1
  6. package/dist/DataViewFilters.js.map +1 -1
  7. package/dist/DataViewToolbar.js +139 -125
  8. package/dist/DataViewToolbar.js.map +1 -1
  9. package/dist/DatePicker.js +1114 -1113
  10. package/dist/DatePicker.js.map +1 -1
  11. package/dist/Modal.js +105 -89
  12. package/dist/Modal.js.map +1 -1
  13. package/dist/Modals.js +30 -26
  14. package/dist/Modals.js.map +1 -1
  15. package/dist/MoreActions.js +294 -288
  16. package/dist/MoreActions.js.map +1 -1
  17. package/dist/PageNavigation.js +1 -1
  18. package/dist/RadioGroup.js +69 -62
  19. package/dist/RadioGroup.js.map +1 -1
  20. package/dist/SearchBar.js +27 -25
  21. package/dist/SearchBar.js.map +1 -1
  22. package/dist/Select.js +103 -101
  23. package/dist/Select.js.map +1 -1
  24. package/dist/Stepper.js +1 -1
  25. package/dist/Tab.js +1 -1
  26. package/dist/Table.js +1 -1
  27. package/dist/Tabs.js +2 -2
  28. package/dist/Tabs.vue_vue_type_script_setup_true_lang-DEopbeSY.js +131 -0
  29. package/dist/Tabs.vue_vue_type_script_setup_true_lang-DEopbeSY.js.map +1 -0
  30. package/dist/Thumbnail.js +42 -42
  31. package/dist/Thumbnail.js.map +1 -1
  32. package/dist/ThumbnailGroup.js +24 -22
  33. package/dist/ThumbnailGroup.js.map +1 -1
  34. package/dist/Timeline.js +15 -13
  35. package/dist/Timeline.js.map +1 -1
  36. package/dist/Toast.vue.d.ts +1 -1
  37. package/dist/Tooltip.js +1 -1
  38. package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-CFpM7Ldj.js → Tooltip.vue_vue_type_script_setup_true_lang-UUjw5O1x.js} +2 -2
  39. package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-CFpM7Ldj.js.map → Tooltip.vue_vue_type_script_setup_true_lang-UUjw5O1x.js.map} +1 -1
  40. package/dist/components.css +1 -1
  41. package/dist/getContrastingTextColor.d.ts +8 -0
  42. package/dist/index-t9tXBnql.js +469 -0
  43. package/dist/{index-DA70nQCT.js.map → index-t9tXBnql.js.map} +1 -1
  44. package/dist/templateRefNarrowing-CeANDylX.js +22 -0
  45. package/dist/templateRefNarrowing-CeANDylX.js.map +1 -0
  46. package/dist/useMediaQuery.d.ts +12 -10
  47. package/dist/useMediaQuery.js +7 -29
  48. package/dist/useMediaQuery.js.map +1 -1
  49. package/dist/useSortable.js +1 -1
  50. package/dist/useValidation.d.ts +11 -1
  51. package/dist/useValidation.js +240 -198
  52. package/dist/useValidation.js.map +1 -1
  53. package/dist/utils/getContrastingTextColor.js +36 -24
  54. package/dist/utils/getContrastingTextColor.js.map +1 -1
  55. package/package.json +1 -2
  56. package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3FBaVP5.js +0 -130
  57. package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3FBaVP5.js.map +0 -1
  58. package/dist/index-DA70nQCT.js +0 -424
@@ -1,71 +1,85 @@
1
- import { ref as J, onMounted as H, nextTick as w, 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 b, 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 v, 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";
1
+ import { ref as K, onMounted as Q, nextTick as w, onBeforeUnmount as X, watch as D, defineComponent as Y, useTemplateRef as O, inject as Z, useCssModule as ee, computed as te, onBeforeMount as oe, createElementBlock as g, openBlock as r, normalizeClass as L, unref as e, createElementVNode as ae, createCommentVNode as x, createBlock as F, withCtx as d, renderSlot as E, createVNode as h, createTextVNode as se, toDisplayString as U, Fragment as le } from "vue";
2
+ import { u as ne } from "./usePaginationStats-d_q39naC.js";
3
+ import { t as R } from "./locale.js";
4
+ import A from "./Button.js";
5
+ import ie from "./Checkbox.js";
6
6
  import "lodash-es/cloneDeep";
7
7
  import "./Module.keys-DcqBbvvT.js";
8
- import U from "./Icon.js";
9
- import { D as j } from "./DataView.keys-aSOnA4AD.js";
10
- import ie from "./IconLabel.js";
11
- import re from "./MoreActions.js";
12
- import { _ as de } from "./_plugin-vue_export-helper-CHgC5LLL.js";
13
- function ce(z) {
14
- const { toolbarEl: n, paginationEl: t, checkboxEl: _, isPaginationEnabled: d, isSelectable: c, isEmpty: u } = z, p = J(null);
15
- let s = null, o = null;
16
- const a = () => {
17
- var k;
18
- if (!n.value) return;
19
- const i = n.value.getBoundingClientRect().width;
20
- let g = 0, h = 0;
21
- d != null && d.value && t.value && (g = t.value.getBoundingClientRect().width), c != null && c.value && !(u != null && u.value) && ((k = _.value) != null && k.$el) && (h = _.value.$el.getBoundingClientRect().width);
22
- const S = window.getComputedStyle(n.value), E = parseFloat(S.paddingLeft) || 0, $ = parseFloat(S.paddingRight) || 0, T = Math.max(0, i - g - h - E - $);
23
- p.value = `${T}px`;
24
- }, C = () => {
25
- n.value && (s = new ResizeObserver(() => {
8
+ import j from "./Icon.js";
9
+ import { D as J } from "./DataView.keys-aSOnA4AD.js";
10
+ import re from "./IconLabel.js";
11
+ import de from "./MoreActions.js";
12
+ import { t as y, a as ce } from "./templateRefNarrowing-CeANDylX.js";
13
+ import { _ as ue } from "./_plugin-vue_export-helper-CHgC5LLL.js";
14
+ function pe(z) {
15
+ const { toolbarEl: C, paginationEl: t, checkboxEl: B, isPaginationEnabled: c, isSelectable: u, isEmpty: p } = z, m = K(null);
16
+ let i = null, o = null;
17
+ const s = () => {
18
+ const a = y(C.value);
19
+ if (!a) return;
20
+ const l = a.getBoundingClientRect().width;
21
+ let v = 0, S = 0;
22
+ if (c != null && c.value) {
23
+ const n = y(t.value);
24
+ n && (v = n.getBoundingClientRect().width);
25
+ }
26
+ if (u != null && u.value && !(p != null && p.value)) {
27
+ const n = ce(B.value);
28
+ n && (S = n.getBoundingClientRect().width);
29
+ }
30
+ const k = window.getComputedStyle(a), W = parseFloat(k.paddingLeft) || 0, $ = parseFloat(k.paddingRight) || 0, V = Math.max(0, l - v - S - W - $);
31
+ m.value = `${V}px`;
32
+ }, _ = () => {
33
+ const a = y(C.value);
34
+ if (!a) return;
35
+ i = new ResizeObserver(() => {
26
36
  w(() => {
27
- a();
37
+ s();
28
38
  });
29
- }), s.observe(n.value), t.value && (o = new ResizeObserver(() => {
39
+ }), i.observe(a);
40
+ const l = y(t.value);
41
+ l && (o = new ResizeObserver(() => {
30
42
  w(() => {
31
- a();
43
+ s();
32
44
  });
33
- }), o.observe(t.value)));
34
- }, B = () => {
35
- s && (s.disconnect(), s = null), o && (o.disconnect(), o = null);
45
+ }), o.observe(l));
46
+ }, T = () => {
47
+ i && (i.disconnect(), i = null), o && (o.disconnect(), o = null);
36
48
  };
37
- return H(() => {
49
+ return Q(() => {
38
50
  w(() => {
39
- a(), C();
51
+ s(), _();
40
52
  });
41
- }), Q(() => {
42
- B();
43
- }), D([d, c, u], () => {
53
+ }), X(() => {
54
+ T();
55
+ }), D([c, u, p], () => {
44
56
  w(() => {
45
- a();
57
+ s();
46
58
  });
47
- }), D(t, (i) => {
48
- o && (o.disconnect(), o = null), i && (o = new ResizeObserver(() => {
59
+ }), D(t, (a) => {
60
+ o && (o.disconnect(), o = null);
61
+ const l = y(a);
62
+ l && (o = new ResizeObserver(() => {
49
63
  w(() => {
50
- a();
64
+ s();
51
65
  });
52
- }), o.observe(i));
66
+ }), o.observe(l));
53
67
  }), {
54
- actionsWidth: p,
55
- updateActionsWidth: a
68
+ actionsWidth: m,
69
+ updateActionsWidth: s
56
70
  };
57
71
  }
58
- const ue = { class: "flex place-items-center" }, pe = {
72
+ const me = { class: "flex place-items-center" }, fe = {
59
73
  key: 0,
60
74
  ref: "paginationEl",
61
75
  class: "stash-data-view-toolbar__pagination flex shrink-0 items-center"
62
- }, me = {
76
+ }, be = {
63
77
  key: 0,
64
78
  class: "mx-1.5"
65
- }, fe = {
79
+ }, ge = {
66
80
  key: 0,
67
81
  class: "mx-1.5 hidden md:block"
68
- }, be = /* @__PURE__ */ X({
82
+ }, he = /* @__PURE__ */ Y({
69
83
  __name: "DataViewToolbar",
70
84
  props: {
71
85
  allRowsSelected: { type: Boolean, default: !1 },
@@ -76,80 +90,80 @@ const ue = { class: "flex place-items-center" }, pe = {
76
90
  hasTabsAbove: { type: Boolean, default: !1 }
77
91
  },
78
92
  emits: ["select"],
79
- setup(z, { emit: n }) {
80
- const t = z, _ = n, d = M("toolbarEl"), c = M("paginationEl"), u = M("checkboxEl"), {
81
- isWithinModule: p,
82
- variant: s,
93
+ setup(z, { emit: C }) {
94
+ const t = z, B = C, c = O("toolbarEl"), u = O("paginationEl"), p = O("checkboxEl"), {
95
+ isWithinModule: m,
96
+ variant: i,
83
97
  density: o,
84
- currentPage: a,
85
- hasToolbar: C,
86
- isPaginateNextDisabled: B,
87
- isPaginationEnabled: i,
88
- isSelectable: g,
89
- pageCount: h,
98
+ currentPage: s,
99
+ hasToolbar: _,
100
+ isPaginateNextDisabled: T,
101
+ isPaginationEnabled: a,
102
+ isSelectable: l,
103
+ pageCount: v,
90
104
  pageSize: S,
91
- totalDataCount: E,
92
- goPrevPage: $,
93
- goNextPage: T,
94
- isEmpty: k,
95
- isLoading: V
96
- } = Y(j.key, j.defaults), A = J(0), K = Z(), { actionsWidth: q } = ce({
97
- toolbarEl: d,
98
- paginationEl: c,
99
- checkboxEl: u,
100
- isPaginationEnabled: i,
101
- isSelectable: g,
102
- isEmpty: k
103
- }), 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 });
104
- function N() {
105
- _("select"), A.value++;
105
+ totalDataCount: k,
106
+ goPrevPage: W,
107
+ goNextPage: $,
108
+ isEmpty: V,
109
+ isLoading: n
110
+ } = Z(J.key, J.defaults), N = K(0), q = ee(), { actionsWidth: G } = pe({
111
+ toolbarEl: c,
112
+ paginationEl: u,
113
+ checkboxEl: p,
114
+ isPaginationEnabled: a,
115
+ isSelectable: l,
116
+ isEmpty: V
117
+ }), I = te(() => t.radius ? t.radius : m.value ? "none" : i.value === "table" ? t.hasTabsAbove ? "rounded-top-right" : "rounded-top" : "rounded"), H = ne({ currentPage: s, pageSize: S, totalItems: k });
118
+ function P() {
119
+ B("select"), N.value++;
106
120
  }
107
- return te(() => {
108
- C && (C.value = !0);
109
- }), (m, f) => (l(), b("div", {
121
+ return oe(() => {
122
+ _ && (_.value = !0);
123
+ }), (f, b) => (r(), g("div", {
110
124
  ref: "toolbarEl",
111
- class: P(["stash-data-view-toolbar flex min-h-15 items-center justify-between bg-white py-1.5 shadow", {
112
- "border-t border-ice-200": e(p),
113
- "rounded-tr": W.value === "rounded-top-right",
114
- rounded: W.value === "rounded",
115
- "rounded-t": W.value === "rounded-top",
116
- "mb-3": e(s) !== "table" && !e(p),
125
+ class: L(["stash-data-view-toolbar flex min-h-15 items-center justify-between bg-white py-1.5 shadow", {
126
+ "border-t border-ice-200": e(m),
127
+ "rounded-tr": I.value === "rounded-top-right",
128
+ rounded: I.value === "rounded",
129
+ "rounded-t": I.value === "rounded-top",
130
+ "mb-3": e(i) !== "table" && !e(m),
117
131
  "px-3": e(o) === "compact",
118
132
  "px-3 lg:px-6": e(o) === "comfortable"
119
133
  }]),
120
134
  "data-test": "stash-data-view-toolbar"
121
135
  }, [
122
- oe("div", ue, [
123
- e(g) && !e(k) ? (l(), L(ne, {
136
+ ae("div", me, [
137
+ e(l) && !e(V) ? (r(), F(ie, {
124
138
  ref: "checkboxEl",
125
- key: A.value,
139
+ key: N.value,
126
140
  checked: t.allRowsSelected,
127
141
  indeterminate: t.someRowsSelected && !t.allRowsSelected,
128
- title: e(y)("ll.selectAll"),
129
- disabled: e(V),
130
- "onUpdate:indeterminate": N,
131
- "onUpdate:checked": N
142
+ title: e(R)("ll.selectAll"),
143
+ disabled: e(n),
144
+ "onUpdate:indeterminate": P,
145
+ "onUpdate:checked": P
132
146
  }, null, 8, ["checked", "indeterminate", "title", "disabled"])) : x("", !0),
133
- m.$slots["more-actions"] ? (l(), L(re, {
147
+ f.$slots["more-actions"] ? (r(), F(de, {
134
148
  key: 1,
135
149
  "more-button-align": "together",
136
- width: e(q) || void 0,
150
+ width: e(G) || void 0,
137
151
  "actions-container-class": "flex items-center gap-x-2 lg:mr-6 lg:gap-x-6"
138
152
  }, {
139
- toggle: r(({ toggle: I }) => [
140
- v(O, {
153
+ toggle: d(({ toggle: M }) => [
154
+ h(A, {
141
155
  "icon-label": "",
142
156
  class: "text-blue-500",
143
157
  "data-test": "stash-data-view-sort-button|sort-menu-button",
144
- onClick: I
158
+ onClick: M
145
159
  }, {
146
- default: r(() => [
147
- v(ie, {
160
+ default: d(() => [
161
+ h(re, {
148
162
  icon: "ellipsis",
149
163
  stacked: ""
150
164
  }, {
151
- default: r(() => [...f[2] || (f[2] = [
152
- ae(" More ", -1)
165
+ default: d(() => [...b[2] || (b[2] = [
166
+ se(" More ", -1)
153
167
  ])]),
154
168
  _: 1
155
169
  })
@@ -157,54 +171,54 @@ const ue = { class: "flex place-items-center" }, pe = {
157
171
  _: 1
158
172
  }, 8, ["onClick"])
159
173
  ]),
160
- "more-actions": r(() => [
161
- R(m.$slots, "more-actions")
174
+ "more-actions": d(() => [
175
+ E(f.$slots, "more-actions")
162
176
  ]),
163
- default: r(() => [
164
- R(m.$slots, "default")
177
+ default: d(() => [
178
+ E(f.$slots, "default")
165
179
  ]),
166
180
  _: 3
167
- }, 8, ["width"])) : (l(), b("div", {
181
+ }, 8, ["width"])) : (r(), g("div", {
168
182
  key: 2,
169
- class: P([e(K).actions, "stash-data-view-toolbar__actions flex items-center gap-x-2 lg:gap-x-4"])
183
+ class: L([e(q).actions, "stash-data-view-toolbar__actions flex items-center gap-x-2 lg:gap-x-4"])
170
184
  }, [
171
- R(m.$slots, "default")
185
+ E(f.$slots, "default")
172
186
  ], 2))
173
187
  ]),
174
- e(i) ? (l(), b("div", pe, [
175
- R(m.$slots, "selected-stats", {}, () => [
176
- t.someRowsSelected && t.selectedItemsCount !== void 0 ? (l(), b("span", me, F(e(y)("ll.listView.numberOfTotalSelected", { num: t.selectedItemsCount, total: e(E) })), 1)) : x("", !0)
188
+ e(a) ? (r(), g("div", fe, [
189
+ E(f.$slots, "selected-stats", {}, () => [
190
+ t.someRowsSelected && t.selectedItemsCount !== void 0 ? (r(), g("span", be, U(e(R)("ll.listView.numberOfTotalSelected", { num: t.selectedItemsCount, total: e(k) })), 1)) : x("", !0)
177
191
  ]),
178
- R(m.$slots, "page-stats", {}, () => [
179
- t.hidePageStats ? x("", !0) : (l(), b("span", fe, F(e(y)("ll.pageStats", e(G))), 1))
192
+ E(f.$slots, "page-stats", {}, () => [
193
+ t.hidePageStats ? x("", !0) : (r(), g("span", ge, U(e(R)("ll.pageStats", e(H))), 1))
180
194
  ]),
181
- e(h) > 1 ? (l(), b(se, { key: 0 }, [
182
- v(O, {
195
+ e(v) > 1 ? (r(), g(le, { key: 0 }, [
196
+ h(A, {
183
197
  icon: "",
184
- "aria-label": e(y)("ll.previous"),
198
+ "aria-label": e(R)("ll.previous"),
185
199
  class: "size-9 p-1.5",
186
200
  "data-test": "button|prev-page",
187
- disabled: e(V) || e(a) === 1,
188
- onClick: f[0] || (f[0] = (I) => e($)({ shouldEmit: !0 }))
201
+ disabled: e(n) || e(s) === 1,
202
+ onClick: b[0] || (b[0] = (M) => e(W)({ shouldEmit: !0 }))
189
203
  }, {
190
- default: r(() => [
191
- v(U, {
204
+ default: d(() => [
205
+ h(j, {
192
206
  name: "chevron-left",
193
207
  size: "dense"
194
208
  })
195
209
  ]),
196
210
  _: 1
197
211
  }, 8, ["aria-label", "disabled"]),
198
- v(O, {
212
+ h(A, {
199
213
  icon: "",
200
- "aria-label": e(y)("ll.next"),
214
+ "aria-label": e(R)("ll.next"),
201
215
  class: "size-9 p-1.5",
202
216
  "data-test": "button|next-page",
203
- disabled: e(V) || e(B) || e(a) === e(h),
204
- onClick: f[1] || (f[1] = (I) => e(T)({ shouldEmit: !0 }))
217
+ disabled: e(n) || e(T) || e(s) === e(v),
218
+ onClick: b[1] || (b[1] = (M) => e($)({ shouldEmit: !0 }))
205
219
  }, {
206
- default: r(() => [
207
- v(U, {
220
+ default: d(() => [
221
+ h(j, {
208
222
  name: "chevron-right",
209
223
  size: "dense"
210
224
  })
@@ -215,12 +229,12 @@ const ue = { class: "flex place-items-center" }, pe = {
215
229
  ], 512)) : x("", !0)
216
230
  ], 2));
217
231
  }
218
- }), ve = "_actions_1i7a8_3", ge = {
232
+ }), ve = "_actions_1i7a8_3", ke = {
219
233
  actions: ve
220
- }, he = {
221
- $style: ge
222
- }, Te = /* @__PURE__ */ de(be, [["__cssModules", he]]);
234
+ }, we = {
235
+ $style: ke
236
+ }, Ie = /* @__PURE__ */ ue(he, [["__cssModules", we]]);
223
237
  export {
224
- Te as default
238
+ Ie as default
225
239
  };
226
240
  //# sourceMappingURL=DataViewToolbar.js.map
@@ -1 +1 @@
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 flex min-h-15 items-center justify-between bg-white py-1.5 shadow\"\n :class=\"{\n 'border-t border-ice-200': isWithinModule,\n 'rounded-tr': computedRadius === 'rounded-top-right',\n rounded: computedRadius === 'rounded',\n 'rounded-t': computedRadius === 'rounded-top',\n 'mb-3': dataViewVariant !== 'table' && !isWithinModule,\n 'px-3': density === 'compact',\n 'px-3 lg:px-6': density === 'comfortable',\n }\"\n data-test=\"stash-data-view-toolbar\"\n >\n <div class=\"flex 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=\"flex items-center gap-x-2 lg:mr-6 lg:gap-x-6\"\n >\n <template #toggle=\"{ toggle }\">\n <Button\n icon-label\n class=\"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 :class=\"classes.actions\" class=\"stash-data-view-toolbar__actions flex items-center gap-x-2 lg:gap-x-4\">\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 flex shrink-0 items-center\"\n >\n <slot name=\"selected-stats\">\n <span v-if=\"props.someRowsSelected && props.selectedItemsCount !== undefined\" class=\"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=\"mx-1.5 hidden md: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=\"size-9 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=\"size-9 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 @layer utilities {\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 }\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","_createElementBlock","_unref","_createElementVNode","_hoisted_1","_createBlock","Checkbox","t","$slots","MoreActions","_withCtx","toggle","_createVNode","Button","IconLabel","_cache","_renderSlot","_ctx","_normalizeClass","_openBlock","_hoisted_2","_hoisted_3","_toDisplayString","_hoisted_4","_Fragment","Icon"],"mappings":";;;;;;;;;;;;AAWO,SAASA,GAAgBC,GAAiC;AAC/D,QAAM,EAAE,WAAAC,GAAW,cAAAC,GAAc,YAAAC,GAAY,qBAAAC,GAAqB,cAAAC,GAAc,SAAAC,MAAYN,GAEtFO,IAAeC,EAAmB,IAAI;AAC5C,MAAIC,IAA+C,MAC/CC,IAAkD;AAEtD,QAAMC,IAAqB,MAAM;;AAC/B,QAAI,CAACV,EAAU,MAAO;AAEtB,UAAMW,IAAeX,EAAU,MAAM,sBAAA,EAAwB;AAC7D,QAAIY,IAAkB,GAClBC,IAAgB;AAGpB,IAAIV,KAAA,QAAAA,EAAqB,SAASF,EAAa,UAC7CW,IAAkBX,EAAa,MAAM,sBAAA,EAAwB,QAI3DG,KAAA,QAAAA,EAAc,SAAS,EAACC,KAAA,QAAAA,EAAS,YAASS,IAAAZ,EAAW,UAAX,QAAAY,EAAkB,SAC9DD,IAAgBX,EAAW,MAAM,IAAI,sBAAA,EAAwB;AAI/D,UAAMa,IAAgB,OAAO,iBAAiBf,EAAU,KAAK,GACvDgB,IAAc,WAAWD,EAAc,WAAW,KAAK,GACvDE,IAAe,WAAWF,EAAc,YAAY,KAAK,GAEzDG,IAAiB,KAAK,IAAI,GAAGP,IAAeC,IAAkBC,IAAgBG,IAAcC,CAAY;AAC9G,IAAAX,EAAa,QAAQ,GAAGY,CAAc;AAAA,EACxC,GAEMC,IAAsB,MAAM;AAChC,IAAKnB,EAAU,UAGfQ,IAAwB,IAAI,eAAe,MAAM;AAC/C,MAAAY,EAAS,MAAM;AACb,QAAAV,EAAA;AAAA,MACF,CAAC;AAAA,IACH,CAAC,GACDF,E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oBAAkB,OAASgC,EAAAhB,CAAA,EAAA,CAAc,CAAA,GAAA,CAAA;;QAGpG8B,EAIOC,4BAJP,MAIO;AAAA,UAHQ/C,EAAM,6BAAnBiD,EAAA,GAAAlB,EAEO,QAFPsB,IAEOD,EADFpB,EAAAK,CAAA,kBAAkBL,EAAAL,CAAA,CAAS,CAAA,GAAA,CAAA;AAAA;QAGlBK,EAAAlB,CAAA,IAAS,UAAzBiB,EAqBWuB,IAAA,EAAA,KAAA,KAAA;AAAA,UApBTZ,EASSC,GAAA;AAAA,YARP,MAAA;AAAA,YACC,cAAYX,EAAAK,CAAA,EAAC,aAAA;AAAA,YACd,OAAM;AAAA,YACN,aAAU;AAAA,YACT,UAAUL,EAAAb,CAAA,KAAaa,EAAArB,CAAA,MAAW;AAAA,YAClC,gCAAOqB,EAAAf,CAAA,EAAU,EAAA,YAAA,IAAA;AAAA,UAAA;uBAElB,MAAyC;AAAA,cAAzCyB,EAAyCa,GAAA;AAAA,gBAAnC,MAAK;AAAA,gBAAe,MAAK;AAAA,cAAA;;;;UAEjCb,EASSC,GAAA;AAAA,YARP,MAAA;AAAA,YACC,cAAYX,EAAAK,CAAA,EAAC,SAAA;AAAA,YACd,OAAM;AAAA,YACN,aAAU;AAAA,YACT,UAAUL,EAAAb,CAAA,KAAaa,QAA0BA,EAAArB,CAAA,MAAgBqB,EAAAlB,CAAA;AAAA,YACjE,gCAAOkB,EAAAd,CAAA,EAAU,EAAA,YAAA,IAAA;AAAA,UAAA;uBAElB,MAA0C;AAAA,cAA1CwB,EAA0Ca,GAAA;AAAA,gBAApC,MAAK;AAAA,gBAAgB,MAAK;AAAA,cAAA;;;;;;;;;;;;;"}
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\nimport { toComponentEl, toElement } from '../../utils/templateRefNarrowing';\n\nexport interface UseActionsWidthOptions {\n toolbarEl: ShallowRef<unknown>;\n paginationEl: ShallowRef<unknown>;\n checkboxEl: ShallowRef<unknown>;\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 const toolbarElVal = toElement(toolbarEl.value);\n if (!toolbarElVal) return;\n\n const toolbarWidth = toolbarElVal.getBoundingClientRect().width;\n let paginationWidth = 0;\n let checkboxWidth = 0;\n\n // Calculate pagination width if pagination is enabled\n if (isPaginationEnabled?.value) {\n const paginationElVal = toElement(paginationEl.value);\n if (paginationElVal) paginationWidth = paginationElVal.getBoundingClientRect().width;\n }\n\n // Calculate checkbox width if selectable and not empty\n if (isSelectable?.value && !isEmpty?.value) {\n const checkboxElVal = toComponentEl(checkboxEl.value);\n if (checkboxElVal) checkboxWidth = checkboxElVal.getBoundingClientRect().width;\n }\n\n // Get computed styles to calculate padding\n const computedStyle = window.getComputedStyle(toolbarElVal);\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 const toolbarElVal = toElement(toolbarEl.value);\n if (!toolbarElVal) return;\n\n // Observe toolbar element\n toolbarResizeObserver = new ResizeObserver(() => {\n nextTick(() => {\n updateActionsWidth();\n });\n });\n toolbarResizeObserver.observe(toolbarElVal);\n\n // Observe pagination element if it exists\n const paginationElVal = toElement(paginationEl.value);\n if (paginationElVal) {\n paginationResizeObserver = new ResizeObserver(() => {\n nextTick(() => {\n updateActionsWidth();\n });\n });\n paginationResizeObserver.observe(paginationElVal);\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 const el = toElement(newPaginationEl);\n if (el) {\n paginationResizeObserver = new ResizeObserver(() => {\n nextTick(() => {\n updateActionsWidth();\n });\n });\n paginationResizeObserver.observe(el);\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 flex min-h-15 items-center justify-between bg-white py-1.5 shadow\"\n :class=\"{\n 'border-t border-ice-200': isWithinModule,\n 'rounded-tr': computedRadius === 'rounded-top-right',\n rounded: computedRadius === 'rounded',\n 'rounded-t': computedRadius === 'rounded-top',\n 'mb-3': dataViewVariant !== 'table' && !isWithinModule,\n 'px-3': density === 'compact',\n 'px-3 lg:px-6': density === 'comfortable',\n }\"\n data-test=\"stash-data-view-toolbar\"\n >\n <div class=\"flex 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=\"flex items-center gap-x-2 lg:mr-6 lg:gap-x-6\"\n >\n <template #toggle=\"{ toggle }\">\n <Button\n icon-label\n class=\"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 :class=\"classes.actions\" class=\"stash-data-view-toolbar__actions flex items-center gap-x-2 lg:gap-x-4\">\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 flex shrink-0 items-center\"\n >\n <slot name=\"selected-stats\">\n <span v-if=\"props.someRowsSelected && props.selectedItemsCount !== undefined\" class=\"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=\"mx-1.5 hidden md: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=\"size-9 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=\"size-9 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 @layer utilities {\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 }\n</style>\n"],"names":["useActionsWidth","options","toolbarEl","paginationEl","checkboxEl","isPaginationEnabled","isSelectable","isEmpty","actionsWidth","ref","toolbarResizeObserver","paginationResizeObserver","updateActionsWidth","toolbarElVal","toElement","toolbarWidth","paginationWidth","checkboxWidth","paginationElVal","checkboxElVal","toComponentEl","computedStyle","paddingLeft","paddingRight","availableWidth","setupResizeObserver","nextTick","cleanupResizeObserver","onMounted","onBeforeUnmount","watch","newPaginationEl","el","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","_createElementBlock","_unref","_createElementVNode","_hoisted_1","_createBlock","Checkbox","t","$slots","MoreActions","_withCtx","toggle","_createVNode","Button","IconLabel","_cache","_renderSlot","_ctx","_normalizeClass","_openBlock","_hoisted_2","_hoisted_3","_toDisplayString","_hoisted_4","_Fragment","Icon"],"mappings":";;;;;;;;;;;;;AAaO,SAASA,GAAgBC,GAAiC;AAC/D,QAAM,EAAE,WAAAC,GAAW,cAAAC,GAAc,YAAAC,GAAY,qBAAAC,GAAqB,cAAAC,GAAc,SAAAC,MAAYN,GAEtFO,IAAeC,EAAmB,IAAI;AAC5C,MAAIC,IAA+C,MAC/CC,IAAkD;AAEtD,QAAMC,IAAqB,MAAM;AAC/B,UAAMC,IAAeC,EAAUZ,EAAU,KAAK;AAC9C,QAAI,CAACW,EAAc;AAEnB,UAAME,IAAeF,EAAa,sBAAA,EAAwB;AAC1D,QAAIG,IAAkB,GAClBC,IAAgB;AAGpB,QAAIZ,KAAA,QAAAA,EAAqB,OAAO;AAC9B,YAAMa,IAAkBJ,EAAUX,EAAa,KAAK;AACpD,MAAIe,MAAiBF,IAAkBE,EAAgB,sBAAA,EAAwB;AAAA,IACjF;AAGA,QAAIZ,KAAA,QAAAA,EAAc,SAAS,EAACC,KAAA,QAAAA,EAAS,QAAO;AAC1C,YAAMY,IAAgBC,GAAchB,EAAW,KAAK;AACpD,MAAIe,MAAeF,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