@leaflink/stash 53.4.9 → 53.4.10

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/Table.js CHANGED
@@ -1,20 +1,20 @@
1
- import { defineComponent as K, useCssModule as Q, inject as R, computed as l, useTemplateRef as O, ref as Y, provide as Z, watchEffect as ee, createElementBlock as v, openBlock as d, createElementVNode as u, createCommentVNode as _, normalizeStyle as S, normalizeClass as n, unref as b, renderSlot as k, createBlock as H, withCtx as f, createVNode as r, Fragment as I } from "vue";
2
- import { d as te, e as N, f as le } from "./index-t9tXBnql.js";
3
- import A from "./Button.js";
1
+ import { defineComponent as te, useCssModule as le, inject as $, computed as l, useTemplateRef as O, ref as x, provide as ae, watchEffect as se, createElementBlock as p, openBlock as u, createElementVNode as f, createCommentVNode as E, normalizeStyle as r, normalizeClass as i, unref as b, renderSlot as C, createBlock as I, withCtx as h, createVNode as n, Fragment as N } from "vue";
2
+ import { d as oe, e as A, f as re } from "./index-t9tXBnql.js";
3
+ import z from "./Button.js";
4
4
  import "lodash-es/cloneDeep";
5
5
  import { M as D } from "./Module.keys-DcqBbvvT.js";
6
6
  import "lodash-es/get";
7
- import z from "./Icon.js";
8
- import { D as $ } from "./DataView.keys-aSOnA4AD.js";
9
- import ae from "./EmptyState.js";
10
- import se from "./Loading.js";
11
- import M from "./TableCell.js";
7
+ import M from "./Icon.js";
8
+ import { D as P } from "./DataView.keys-aSOnA4AD.js";
9
+ import ne from "./EmptyState.js";
10
+ import ie from "./Loading.js";
11
+ import j from "./TableCell.js";
12
12
  import J from "./TableRow.js";
13
- import { T as oe } from "./Table.keys-LHQf6FEH.js";
14
- import { S as re } from "./misc-CHQs-G03.js";
15
- import { _ as ne } from "./_plugin-vue_export-helper-CHgC5LLL.js";
16
- var ie = /* @__PURE__ */ ((o) => (o.Scroll = "scroll", o.Stack = "stack", o))(ie || {}), ce = /* @__PURE__ */ ((o) => (o.None = "none", o.Rounded = "rounded", o.RoundedBottom = "rounded-bottom", o))(ce || {});
17
- const de = { class: "stash-table-wrapper relative" }, ue = ["aria-busy"], fe = /* @__PURE__ */ K({
13
+ import { T as de } from "./Table.keys-LHQf6FEH.js";
14
+ import { S as ce } from "./misc-CHQs-G03.js";
15
+ import { _ as ue } from "./_plugin-vue_export-helper-CHgC5LLL.js";
16
+ var fe = /* @__PURE__ */ ((o) => (o.Scroll = "scroll", o.Stack = "stack", o))(fe || {}), he = /* @__PURE__ */ ((o) => (o.None = "none", o.Rounded = "rounded", o.RoundedBottom = "rounded-bottom", o))(he || {});
17
+ const be = { class: "stash-table-wrapper relative" }, ve = ["aria-busy"], pe = /* @__PURE__ */ te({
18
18
  __name: "Table",
19
19
  props: {
20
20
  density: { default: void 0 },
@@ -28,110 +28,118 @@ const de = { class: "stash-table-wrapper relative" }, ue = ["aria-busy"], fe = /
28
28
  isSelectable: { type: Boolean, default: !1 },
29
29
  layout: { default: "scroll" },
30
30
  radius: { default: "rounded" },
31
- stickyHeader: { default: void 0 }
31
+ stickyHeader: { default: void 0 },
32
+ pinnedLeftWidth: { default: 0 },
33
+ pinnedRightWidth: { default: 0 },
34
+ tableMinWidth: { default: void 0 }
32
35
  },
33
36
  setup(o) {
34
- const e = o, m = Q(), {
35
- density: P,
36
- variant: p,
37
- isEmpty: h,
38
- isLoading: i,
39
- isSelectable: E
40
- } = R($.key, $.defaults), { variant: y } = R(D.key, D.defaults), C = l(() => (y == null ? void 0 : y.value) === "table" || p.value === "table" ? "rounded-bottom" : e.radius), s = l(() => e.stickyHeader ? "scroll" : e.layout), V = l(() => s.value === "scroll" && p.value === "table"), W = l(() => {
37
+ const e = o, m = le(), {
38
+ density: V,
39
+ variant: y,
40
+ isEmpty: v,
41
+ isLoading: d,
42
+ isSelectable: L
43
+ } = $(P.key, P.defaults), { variant: g } = $(D.key, D.defaults), R = l(() => (g == null ? void 0 : g.value) === "table" || y.value === "table" ? "rounded-bottom" : e.radius), s = l(() => e.stickyHeader ? "scroll" : e.layout), X = l(() => s.value === "scroll" && y.value === "table"), F = l(() => {
41
44
  var t, a;
42
45
  return !!((t = e.stickyHeader) != null && t.maxHeight && ((a = e.stickyHeader) == null ? void 0 : a.listLength) > 3);
43
- }), X = l(() => {
46
+ }), U = l(() => {
44
47
  var t;
45
48
  return {
46
- maxHeight: W.value ? (t = e.stickyHeader) == null ? void 0 : t.maxHeight : ""
49
+ maxHeight: F.value ? (t = e.stickyHeader) == null ? void 0 : t.maxHeight : ""
47
50
  };
48
- }), w = l(() => !!(e.isLoading || i != null && i.value)), c = O("scrollContainerRef"), x = O("tableRef"), T = Y(!1), { arrivedState: B, measure: j } = te(c, { behavior: "smooth" });
49
- function g() {
51
+ }), w = l(() => !!(e.isLoading || d != null && d.value)), c = O("scrollContainerRef"), T = O("tableRef"), W = x(!1), _ = x(0), S = x(0), { arrivedState: B, measure: q } = oe(c, { behavior: "smooth" });
52
+ function k() {
50
53
  const t = c.value;
51
- !t || s.value !== "scroll" || (T.value = t.scrollWidth > t.clientWidth, j());
54
+ !t || s.value !== "scroll" || (W.value = t.scrollWidth > t.clientWidth, _.value = t.offsetWidth - t.clientWidth, S.value = t.offsetHeight - t.clientHeight, q());
52
55
  }
53
- N(c, g), N(x, g), le(
56
+ A(c, k), A(T, k), re(
54
57
  c,
55
58
  (t) => {
56
59
  var a;
57
- (a = t[0]) != null && a.isIntersecting && g();
60
+ (a = t[0]) != null && a.isIntersecting && k();
58
61
  },
59
62
  { threshold: 0.01 }
60
63
  );
61
- const F = l(() => !B.left), U = l(() => !B.right), q = l(() => s.value === "scroll" && T.value);
62
- function L(t) {
64
+ const G = l(() => !B.left), K = l(() => !B.right), Q = l(() => s.value === "scroll" && W.value);
65
+ function H(t) {
63
66
  var a;
64
67
  (a = c.value) == null || a.scrollBy({ left: t, behavior: "smooth" });
65
68
  }
66
- return Z(oe.key, {
67
- density: l(() => e.density || P.value || re.Comfortable),
69
+ const Y = l(() => (e.pinnedLeftWidth ?? 0) > 0 || (e.pinnedRightWidth ?? 0) > 0), Z = l(() => {
70
+ const t = {};
71
+ return e.tableMinWidth != null && (t.minWidth = `${e.tableMinWidth}px`), Y.value && (t.borderSpacing = "0"), Object.keys(t).length ? t : void 0;
72
+ });
73
+ return ae(de.key, {
74
+ density: l(() => e.density || V.value || ce.Comfortable),
68
75
  hasCustomExpandToggle: l(() => e.hasCustomExpandToggle),
69
76
  hasActions: l(() => e.hasActions),
70
77
  isSchemaDriven: l(() => e.isSchemaDriven),
71
78
  isExpandable: l(() => e.isExpandable),
72
79
  isSelectable: l(
73
- () => e.isSelectable && !e.isLoading && !(i != null && i.value) && !e.isEmpty && !(h != null && h.value)
80
+ () => e.isSelectable && !e.isLoading && !(d != null && d.value) && !e.isEmpty && !(v != null && v.value)
74
81
  ),
75
82
  isLoading: w,
76
83
  layout: s
77
- }), ee(() => {
78
- E && (E.value = e.isSelectable);
79
- }), (t, a) => (d(), v("div", de, [
80
- u("div", {
84
+ }), se(() => {
85
+ L && (L.value = e.isSelectable);
86
+ }), (t, a) => (u(), p("div", be, [
87
+ f("div", {
81
88
  ref_key: "scrollContainerRef",
82
89
  ref: c,
83
- class: n(["stash-table relative", [
84
- { rounded: C.value === "rounded" },
85
- { "rounded-b": C.value === "rounded-bottom" },
86
- { "border-t border-ice-200": b(p) === "table" },
90
+ class: i(["stash-table relative", [
91
+ { rounded: R.value === "rounded" },
92
+ { "rounded-b": R.value === "rounded-bottom" },
93
+ { "border-t border-ice-200": b(y) === "table" },
87
94
  { "overflow-auto scroll-smooth": s.value === "scroll" },
88
- { shadow: V.value },
95
+ { shadow: X.value },
89
96
  {
90
97
  "overflow-visible lg:overflow-auto lg:shadow": s.value === "stack"
91
98
  }
92
99
  ]]),
93
100
  "data-test": "stash-table",
94
101
  "aria-busy": w.value,
95
- style: S(X.value)
102
+ style: r(U.value)
96
103
  }, [
97
- u("table", {
104
+ f("table", {
98
105
  ref_key: "tableRef",
99
- ref: x,
100
- class: "relative w-full border-separate"
106
+ ref: T,
107
+ class: "relative w-full border-separate",
108
+ style: r(Z.value)
101
109
  }, [
102
- u("thead", {
103
- class: n(["border-b border-ice-200", { "hidden lg:table-header-group": s.value === "stack" }])
110
+ f("thead", {
111
+ class: i(["border-b border-ice-200", { "hidden lg:table-header-group": s.value === "stack" }])
104
112
  }, [
105
- k(t.$slots, "head")
113
+ C(t.$slots, "head")
106
114
  ], 2),
107
- u("tbody", null, [
108
- w.value ? (d(), H(J, { key: 0 }, {
109
- default: f(() => [
110
- r(M, {
115
+ f("tbody", null, [
116
+ w.value ? (u(), I(J, { key: 0 }, {
117
+ default: h(() => [
118
+ n(j, {
111
119
  colspan: "100%",
112
- class: n({ "relative! col-span-12": s.value === "stack" })
120
+ class: i({ "relative! col-span-12": s.value === "stack" })
113
121
  }, {
114
- default: f(() => [
115
- r(se, {
116
- style: S([s.value === "scroll" ? { "max-width": "100vw" } : {}])
122
+ default: h(() => [
123
+ n(ie, {
124
+ style: r([s.value === "scroll" ? { "max-width": "100vw" } : {}])
117
125
  }, null, 8, ["style"])
118
126
  ]),
119
127
  _: 1
120
128
  }, 8, ["class"])
121
129
  ]),
122
130
  _: 1
123
- })) : e.isEmpty || b(h) ? (d(), H(J, { key: 1 }, {
124
- default: f(() => [
125
- r(M, {
131
+ })) : e.isEmpty || b(v) ? (u(), I(J, { key: 1 }, {
132
+ default: h(() => [
133
+ n(j, {
126
134
  colspan: "100%",
127
- class: n({ "relative! col-span-12": s.value === "stack" })
135
+ class: i({ "relative! col-span-12": s.value === "stack" })
128
136
  }, {
129
- default: f(() => [
130
- k(t.$slots, "empty", {}, () => [
131
- r(ae, {
137
+ default: h(() => [
138
+ C(t.$slots, "empty", {}, () => [
139
+ n(ne, {
132
140
  class: "w-full bg-white",
133
141
  text: e.emptyStateText,
134
- style: S([s.value === "scroll" ? { "max-width": "100vw" } : {}])
142
+ style: r([s.value === "scroll" ? { "max-width": "100vw" } : {}])
135
143
  }, null, 8, ["text", "style"])
136
144
  ])
137
145
  ]),
@@ -139,69 +147,76 @@ const de = { class: "stash-table-wrapper relative" }, ue = ["aria-busy"], fe = /
139
147
  }, 8, ["class"])
140
148
  ]),
141
149
  _: 3
142
- })) : k(t.$slots, "body", { key: 2 })
150
+ })) : C(t.$slots, "body", { key: 2 })
143
151
  ])
144
- ], 512)
145
- ], 14, ue),
146
- q.value ? (d(), v("div", {
152
+ ], 4)
153
+ ], 14, ve),
154
+ Q.value ? (u(), p("div", {
147
155
  key: 0,
148
- class: n([b(m)["stash-table-scroll-overlay"], "pointer-events-none absolute inset-0 flex items-center justify-between z-2"])
156
+ class: i([b(m)["stash-table-scroll-overlay"], "pointer-events-none absolute inset-0 flex items-center justify-between z-2"])
149
157
  }, [
150
- F.value ? (d(), v(I, { key: 0 }, [
151
- u("div", {
152
- class: n([b(m)["stash-table-scroll-shadow-left"], "stash-table-scroll-shadow border-l border-ice-100 absolute left-0 top-0 bottom-0 w-4"]),
158
+ G.value ? (u(), p(N, { key: 0 }, [
159
+ f("div", {
160
+ class: i([b(m)["stash-table-scroll-shadow-left"], "stash-table-scroll-shadow border-l border-ice-100 absolute top-0 w-4"]),
161
+ style: r({ left: `${e.pinnedLeftWidth}px`, bottom: `${S.value}px` }),
153
162
  "data-test": "stash-table|scroll-shadow-left"
154
- }, null, 2),
155
- r(A, {
156
- class: "pointer-events-auto absolute left-3 top-[7px] border border-ice-100 bg-white rounded-full shadow size-6 p-0 min-w-auto",
163
+ }, null, 6),
164
+ n(z, {
165
+ class: "pointer-events-auto absolute top-[7px] border border-ice-100 bg-white rounded-full shadow size-6 p-0 min-w-auto",
166
+ style: r({ left: `${(e.pinnedLeftWidth ?? 0) + 12}px` }),
157
167
  secondary: "",
158
168
  icon: "",
159
169
  "aria-label": "Scroll table left",
160
170
  "data-test": "stash-table|scroll-left",
161
- onClick: a[0] || (a[0] = (G) => L(-200))
171
+ onClick: a[0] || (a[0] = (ee) => H(-200))
162
172
  }, {
163
- default: f(() => [
164
- r(z, { name: "chevron-left" })
173
+ default: h(() => [
174
+ n(M, { name: "chevron-left" })
165
175
  ]),
166
176
  _: 1
167
- })
168
- ], 64)) : _("", !0),
169
- U.value ? (d(), v(I, { key: 1 }, [
170
- u("div", {
171
- class: n([b(m)["stash-table-scroll-shadow-right"], "stash-table-scroll-shadow border-r border-ice-100 absolute right-0 top-0 bottom-0 w-4"]),
177
+ }, 8, ["style"])
178
+ ], 64)) : E("", !0),
179
+ K.value ? (u(), p(N, { key: 1 }, [
180
+ f("div", {
181
+ class: i([b(m)["stash-table-scroll-shadow-right"], "stash-table-scroll-shadow border-r border-ice-100 absolute top-0 w-4"]),
182
+ style: r({
183
+ right: `${_.value + (e.pinnedRightWidth ?? 0)}px`,
184
+ bottom: `${S.value}px`
185
+ }),
172
186
  "data-test": "stash-table|scroll-shadow-right"
173
- }, null, 2),
174
- r(A, {
175
- class: "pointer-events-auto absolute right-3 top-[7px] border border-ice-100 bg-white rounded-full shadow size-6 p-0 min-w-auto",
187
+ }, null, 6),
188
+ n(z, {
189
+ class: "pointer-events-auto absolute top-[7px] border border-ice-100 bg-white rounded-full shadow size-6 p-0 min-w-auto",
190
+ style: r({ right: `${_.value + (e.pinnedRightWidth ?? 0) + 12}px` }),
176
191
  secondary: "",
177
192
  icon: "",
178
193
  "aria-label": "Scroll table right",
179
194
  "data-test": "stash-table|scroll-right",
180
- onClick: a[1] || (a[1] = (G) => L(200))
195
+ onClick: a[1] || (a[1] = (ee) => H(200))
181
196
  }, {
182
- default: f(() => [
183
- r(z, {
197
+ default: h(() => [
198
+ n(M, {
184
199
  name: "chevron-right",
185
200
  class: "text-ice-900"
186
201
  })
187
202
  ]),
188
203
  _: 1
189
- })
190
- ], 64)) : _("", !0)
191
- ], 2)) : _("", !0)
204
+ }, 8, ["style"])
205
+ ], 64)) : E("", !0)
206
+ ], 2)) : E("", !0)
192
207
  ]));
193
208
  }
194
- }), be = {
209
+ }), me = {
195
210
  "stash-table-scroll-shadow-left": "_stash-table-scroll-shadow-left_cuovy_2",
196
211
  "stash-table-scroll-shadow-right": "_stash-table-scroll-shadow-right_cuovy_6",
197
212
  "stash-table-scroll-overlay": "_stash-table-scroll-overlay_cuovy_11"
198
- }, he = {
199
- $style: be
200
- }, Oe = /* @__PURE__ */ ne(fe, [["__cssModules", he]]);
213
+ }, ye = {
214
+ $style: me
215
+ }, Ie = /* @__PURE__ */ ue(pe, [["__cssModules", ye]]);
201
216
  export {
202
- ie as Layout,
203
- oe as TABLE_INJECTION,
204
- ce as TableRadius,
205
- Oe as default
217
+ fe as Layout,
218
+ de as TABLE_INJECTION,
219
+ he as TableRadius,
220
+ Ie as default
206
221
  };
207
222
  //# sourceMappingURL=Table.js.map
package/dist/Table.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sources":["../src/components/Table/Table.types.ts","../src/components/Table/Table.vue"],"sourcesContent":["import type { ComputedRef } from 'vue';\n\nimport { SpacingDensities } from '../../../types/misc';\n\nexport enum Layout {\n Scroll = 'scroll',\n Stack = 'stack',\n}\n\nexport type Layouts = `${Layout}`;\n\nexport enum TableRadius {\n None = 'none',\n Rounded = 'rounded',\n RoundedBottom = 'rounded-bottom',\n}\n\nexport type TableRadiuses = `${TableRadius}`;\n\n/**\n * Properties and utilities provided to children of a Table instance\n */\nexport interface TableInjection {\n /**\n * Controls the Table's padding; the default value is \"comfortable\". On small screens, the density will always be \"compact\".\n */\n density: ComputedRef<SpacingDensities>;\n\n /**\n * Styles the last column for \"row actions\"\n */\n hasActions: ComputedRef<boolean>;\n\n /**\n * If true, hides the default expansion toggle column\n */\n hasCustomExpandToggle: ComputedRef<boolean>;\n\n /**\n * When true, the table is schema-driven (e.g. DataTable); selection column is rendered from the schema, not by TableRow/TableHeaderRow.\n */\n isSchemaDriven?: ComputedRef<boolean>;\n\n /**\n * Adds a toggle column for row expansion. This is primarily needed for ensuring the corresponding empty TableHeaderRow is included.\n */\n isExpandable: ComputedRef<boolean>;\n\n /**\n * Adds a checkbox column for selecting rows; intended for use with the `useSelection` composable.\n */\n isSelectable: ComputedRef<boolean>;\n\n /**\n * Sets the table layout; the default value is \"scroll\".\n */\n layout: ComputedRef<Layouts>;\n\n /**\n * Sets the table loading state.\n */\n isLoading: ComputedRef<boolean>;\n}\n","<script lang=\"ts\">\n import { SpacingDensities, SpacingDensity } from '../../../types/misc';\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import { Layouts, TableRadiuses } from './Table.types';\n\n export * from './Table.keys';\n export * from './Table.types';\n\n export interface TableProps {\n /**\n * Controls the Table's padding; the default value is \"comfortable\". On small screens, \"compact\" density is applied regardless of this prop's value.\n */\n density?: SpacingDensities;\n\n /**\n * Sets the text for the empty state; the default value is \"No Results\".\n */\n emptyStateText?: string;\n\n /**\n * Styles the last column for \"row actions\"\n */\n hasActions?: boolean;\n\n /**\n * If true, hides the default expansion toggle column\n */\n hasCustomExpandToggle?: boolean;\n\n /**\n * Shows the empty state\n */\n isEmpty?: boolean;\n\n /**\n * When true, indicates the table is being composed by DataTable (schema-driven mode).\n * TableRow/TableHeaderRow use this to suppress their built-in selection cells.\n */\n isSchemaDriven?: boolean;\n\n /**\n * Shows the loading state\n */\n isLoading?: boolean;\n\n /**\n * Adds a toggle column for row expansion. This is primarily needed for ensuring the corresponding empty TableHeaderRow is included.\n */\n isExpandable?: boolean;\n\n /**\n * Adds a checkbox column for selecting rows; intended for use with the `useSelection` composable.\n */\n isSelectable?: boolean;\n\n /**\n * Sets the table layout; the default value is \"scroll\".\n */\n layout?: Layouts;\n\n /**\n * Controls the corners of the table with the \"border-radius\" CSS property. The default value is \"rounded\".\n */\n radius?: TableRadiuses;\n\n /**\n * Allows the table head to be sticky when scrolling inside the table body\n */\n stickyHeader?: {\n listLength: number;\n maxHeight: string;\n };\n }\n</script>\n\n<script setup lang=\"ts\">\n import { useIntersectionObserver, useResizeObserver, useScroll } from '@vueuse/core';\n import { computed, inject, provide, ref, useCssModule, useTemplateRef, watchEffect } from 'vue';\n\n import Button from '../Button/Button.vue';\n import { DATA_VIEW_INJECTION } from '../DataView/DataView.vue';\n import EmptyState from '../EmptyState/EmptyState.vue';\n import Icon from '../Icon/Icon.vue';\n import Loading from '../Loading/Loading.vue';\n import TableCell from '../TableCell/TableCell.vue';\n import TableRow from '../TableRow/TableRow.vue';\n import { TABLE_INJECTION } from './Table.keys';\n\n const SCROLL_DELTA_PX = 200;\n\n const props = withDefaults(defineProps<TableProps>(), {\n density: undefined,\n emptyStateText: '',\n hasActions: false,\n hasCustomExpandToggle: false,\n isEmpty: false,\n isSchemaDriven: false,\n isLoading: false,\n isExpandable: false,\n isSelectable: false,\n layout: 'scroll',\n radius: 'rounded',\n stickyHeader: undefined,\n });\n\n const classes = useCssModule();\n\n const {\n density: dataViewDensity,\n variant: dataViewVariant,\n isEmpty: isDataViewEmpty,\n isLoading: isDataViewLoading,\n isSelectable: isDataViewSelectable,\n } = inject(DATA_VIEW_INJECTION.key, DATA_VIEW_INJECTION.defaults);\n\n const { variant: moduleVariant } = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n\n const computedRadius = computed<TableRadiuses>(() => {\n // Will work for tables when rendered inside of a Module with OR without a DataView.\n if (moduleVariant?.value === 'table') {\n return 'rounded-bottom';\n }\n\n if (dataViewVariant.value === 'table') {\n return 'rounded-bottom';\n }\n\n return props.radius;\n });\n\n const computedLayout = computed<Layouts>(() => {\n if (props.stickyHeader) {\n return 'scroll';\n }\n\n return props.layout;\n });\n\n const isShadowEnabled = computed<boolean>(() => {\n return computedLayout.value === 'scroll' && dataViewVariant.value === 'table';\n });\n\n const isStickyHeaderEnabled = computed<boolean>(() => {\n return !!(\n (props.stickyHeader?.maxHeight && props.stickyHeader?.listLength > 3) // table can't scroll without a max height; sticky headers only needed for a scrollable table\n // scrollable table and sticky headers not needed when list is small\n );\n });\n\n const rootStyle = computed(() => ({\n maxHeight: isStickyHeaderEnabled.value ? props.stickyHeader?.maxHeight : '',\n }));\n\n const isTableLoading = computed(() => Boolean(props.isLoading || isDataViewLoading?.value));\n\n const scrollContainerRef = useTemplateRef<HTMLElement>('scrollContainerRef');\n const tableRef = useTemplateRef<HTMLTableElement>('tableRef');\n const hasHorizontalOverflow = ref(false);\n\n const { arrivedState, measure } = useScroll(scrollContainerRef, { behavior: 'smooth' });\n\n function updateOverflow() {\n const el = scrollContainerRef.value;\n if (!el || computedLayout.value !== 'scroll') return;\n hasHorizontalOverflow.value = el.scrollWidth > el.clientWidth;\n measure();\n }\n\n useResizeObserver(scrollContainerRef, updateOverflow);\n useResizeObserver(tableRef, updateOverflow);\n\n useIntersectionObserver(\n scrollContainerRef,\n (entries) => {\n if (entries[0]?.isIntersecting) updateOverflow();\n },\n { threshold: 0.01 },\n );\n\n const canScrollLeft = computed(() => !arrivedState.left);\n const canScrollRight = computed(() => !arrivedState.right);\n const showScrollButtons = computed(() => computedLayout.value === 'scroll' && hasHorizontalOverflow.value);\n\n function scrollBy(delta: number) {\n scrollContainerRef.value?.scrollBy({ left: delta, behavior: 'smooth' });\n }\n\n provide(TABLE_INJECTION.key, {\n density: computed(() => props.density || dataViewDensity.value || SpacingDensity.Comfortable),\n hasCustomExpandToggle: computed(() => props.hasCustomExpandToggle),\n hasActions: computed(() => props.hasActions),\n isSchemaDriven: computed(() => props.isSchemaDriven),\n isExpandable: computed(() => props.isExpandable),\n isSelectable: computed(\n () =>\n props.isSelectable &&\n !props.isLoading &&\n !isDataViewLoading?.value &&\n !props.isEmpty &&\n !isDataViewEmpty?.value,\n ),\n isLoading: isTableLoading,\n layout: computedLayout,\n });\n\n watchEffect(() => {\n // Table can be both casted within a DataView or standalone. useSelection is still possible to be used on both cases,\n // making it important to have Table to control selection props.\n // To avoid breaking changes and developer experience, a DataView injection is passed down and updated whenever it exists,\n // and move the information up into DataView, that sometimes aren't used.\n if (isDataViewSelectable) {\n isDataViewSelectable.value = props.isSelectable;\n }\n });\n</script>\n\n<template>\n <div class=\"stash-table-wrapper relative\">\n <div\n ref=\"scrollContainerRef\"\n class=\"stash-table relative\"\n :class=\"[\n { rounded: computedRadius === 'rounded' },\n { 'rounded-b': computedRadius === 'rounded-bottom' },\n { 'border-t border-ice-200': dataViewVariant === 'table' },\n { 'overflow-auto scroll-smooth': computedLayout === 'scroll' },\n { shadow: isShadowEnabled },\n {\n 'overflow-visible lg:overflow-auto lg:shadow': computedLayout === 'stack',\n },\n ]\"\n data-test=\"stash-table\"\n :aria-busy=\"isTableLoading\"\n :style=\"rootStyle\"\n >\n <table ref=\"tableRef\" class=\"relative w-full border-separate\">\n <thead class=\"border-b border-ice-200\" :class=\"{ 'hidden lg:table-header-group': computedLayout === 'stack' }\">\n <!-- @slot head -->\n <slot name=\"head\"> </slot>\n </thead>\n <tbody>\n <!--\n col-span-12 makes the td span all columns only when layout === 'stack' and the viewport is below lg (when table elements are using display: grid ).\n The colspan attr does the same in all other cases when the table elements are using their native table styles.\n relative prevents the loading/empty state from overflowing the table whenever the table has actions and the table cell applies position absolute.\n \"max-width: '100vw'\" prevents the loading/empty state from overflowing the table whenever the table is in the scroll layout.\n These are necessary in order to properly horizontally center Loading, and EmptyState\n -->\n <TableRow v-if=\"isTableLoading\">\n <TableCell colspan=\"100%\" :class=\"{ 'relative! col-span-12': computedLayout === 'stack' }\">\n <Loading :style=\"[computedLayout === 'scroll' ? { 'max-width': '100vw' } : {}]\" />\n </TableCell>\n </TableRow>\n <!-- @slot empty -->\n <template v-else-if=\"props.isEmpty || isDataViewEmpty\">\n <TableRow>\n <TableCell colspan=\"100%\" :class=\"{ 'relative! col-span-12': computedLayout === 'stack' }\">\n <slot name=\"empty\">\n <EmptyState\n class=\"w-full bg-white\"\n :text=\"props.emptyStateText\"\n :style=\"[computedLayout === 'scroll' ? { 'max-width': '100vw' } : {}]\"\n />\n </slot>\n </TableCell>\n </TableRow>\n </template>\n <!-- @slot body -->\n <slot v-else name=\"body\"></slot>\n </tbody>\n </table>\n </div>\n <div\n v-if=\"showScrollButtons\"\n :class=\"classes['stash-table-scroll-overlay']\"\n class=\"pointer-events-none absolute inset-0 flex items-center justify-between z-2\"\n >\n <template v-if=\"canScrollLeft\">\n <div\n :class=\"classes['stash-table-scroll-shadow-left']\"\n class=\"stash-table-scroll-shadow border-l border-ice-100 absolute left-0 top-0 bottom-0 w-4\"\n data-test=\"stash-table|scroll-shadow-left\"\n />\n <Button\n class=\"pointer-events-auto absolute left-3 top-[7px] border border-ice-100 bg-white rounded-full shadow size-6 p-0 min-w-auto\"\n secondary\n icon\n :aria-label=\"'Scroll table left'\"\n data-test=\"stash-table|scroll-left\"\n @click=\"scrollBy(-SCROLL_DELTA_PX)\"\n >\n <Icon name=\"chevron-left\" />\n </Button>\n </template>\n <template v-if=\"canScrollRight\">\n <div\n :class=\"classes['stash-table-scroll-shadow-right']\"\n class=\"stash-table-scroll-shadow border-r border-ice-100 absolute right-0 top-0 bottom-0 w-4\"\n data-test=\"stash-table|scroll-shadow-right\"\n />\n\n <Button\n class=\"pointer-events-auto absolute right-3 top-[7px] border border-ice-100 bg-white rounded-full shadow size-6 p-0 min-w-auto\"\n secondary\n icon\n :aria-label=\"'Scroll table right'\"\n data-test=\"stash-table|scroll-right\"\n @click=\"scrollBy(SCROLL_DELTA_PX)\"\n >\n <Icon name=\"chevron-right\" class=\"text-ice-900\" />\n </Button>\n </template>\n </div>\n </div>\n</template>\n\n<style module>\n .stash-table-scroll-shadow-left {\n background: linear-gradient(90deg, rgb(38 38 38 / 10%) 0%, rgb(38 38 38 / 0%) 32.65%);\n }\n\n .stash-table-scroll-shadow-right {\n background: linear-gradient(270deg, rgb(38 38 38 / 10%) 0%, rgb(38 38 38 / 0%) 32.65%);\n }\n\n @media print {\n .stash-table-scroll-overlay {\n display: none !important;\n }\n }\n</style>\n"],"names":["Layout","TableRadius","props","__props","classes","useCssModule","dataViewDensity","dataViewVariant","isDataViewEmpty","isDataViewLoading","isDataViewSelectable","inject","DATA_VIEW_INJECTION","moduleVariant","MODULE_INJECTION","computedRadius","computed","computedLayout","isShadowEnabled","isStickyHeaderEnabled","_a","_b","rootStyle","isTableLoading","scrollContainerRef","useTemplateRef","tableRef","hasHorizontalOverflow","ref","arrivedState","measure","useScroll","updateOverflow","el","useResizeObserver","useIntersectionObserver","entries","canScrollLeft","canScrollRight","showScrollButtons","scrollBy","delta","provide","TABLE_INJECTION","SpacingDensity","watchEffect","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_unref","_normalizeClass","_renderSlot","_ctx","_createBlock","TableRow","_createVNode","TableCell","Loading","EmptyState","_Fragment","Button","_cache","$event","Icon"],"mappings":";;;;;;;;;;;;;;;AAIO,IAAKA,uBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,QAAQ,SAFEA,IAAAA,MAAA,CAAA,CAAA,GAOAC,uBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,UAAU,WACVA,EAAA,gBAAgB,kBAHNA,IAAAA,MAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;AC+EV,UAAMC,IAAQC,GAeRC,IAAUC,EAAA,GAEV;AAAA,MACJ,SAASC;AAAA,MACT,SAASC;AAAA,MACT,SAASC;AAAA,MACT,WAAWC;AAAA,MACX,cAAcC;AAAA,IAAA,IACZC,EAAOC,EAAoB,KAAKA,EAAoB,QAAQ,GAE1D,EAAE,SAASC,MAAkBF,EAAOG,EAAiB,KAAKA,EAAiB,QAAQ,GAEnFC,IAAiBC,EAAwB,OAEzCH,KAAA,gBAAAA,EAAe,WAAU,WAIzBN,EAAgB,UAAU,UACrB,mBAGFL,EAAM,MACd,GAEKe,IAAiBD,EAAkB,MACnCd,EAAM,eACD,WAGFA,EAAM,MACd,GAEKgB,IAAkBF,EAAkB,MACjCC,EAAe,UAAU,YAAYV,EAAgB,UAAU,OACvE,GAEKY,IAAwBH,EAAkB,MAAM;;AACpD,aAAO,CAAC,GACLI,IAAAlB,EAAM,iBAAN,QAAAkB,EAAoB,eAAaC,IAAAnB,EAAM,iBAAN,gBAAAmB,EAAoB,cAAa;AAAA,IAGvE,CAAC,GAEKC,IAAYN,EAAS,MAAA;;AAAO;AAAA,QAChC,WAAWG,EAAsB,SAAQ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b1B,EAAA,cAAhBS,EAiBWa,GAAA,EAAA,KAAA,KAAA;AAAA,UAhBTX,EAIE,OAAA;AAAA,YAHC,OAAKE,EAAA,CAAED,EAAA9C,CAAA,EAAO,iCAAA,GACT,uFAAuF,CAAA;AAAA,YAC7F,aAAU;AAAA,UAAA;UAGZoD,EASSK,GAAA;AAAA,YARP,OAAM;AAAA,YACN,WAAA;AAAA,YACA,MAAA;AAAA,YACC,cAAY;AAAA,YACb,aAAU;AAAA,YACT,SAAKC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEvB,EAAS,GAAe;AAAA,UAAA;uBAEhC,MAAkD;AAAA,cAAlDgB,EAAkDQ,GAAA;AAAA,gBAA5C,MAAK;AAAA,gBAAgB,OAAM;AAAA,cAAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Table.js","sources":["../src/components/Table/Table.types.ts","../src/components/Table/Table.vue"],"sourcesContent":["import type { ComputedRef } from 'vue';\n\nimport { SpacingDensities } from '../../../types/misc';\n\nexport enum Layout {\n Scroll = 'scroll',\n Stack = 'stack',\n}\n\nexport type Layouts = `${Layout}`;\n\nexport enum TableRadius {\n None = 'none',\n Rounded = 'rounded',\n RoundedBottom = 'rounded-bottom',\n}\n\nexport type TableRadiuses = `${TableRadius}`;\n\n/**\n * Properties and utilities provided to children of a Table instance\n */\nexport interface TableInjection {\n /**\n * Controls the Table's padding; the default value is \"comfortable\". On small screens, the density will always be \"compact\".\n */\n density: ComputedRef<SpacingDensities>;\n\n /**\n * Styles the last column for \"row actions\"\n */\n hasActions: ComputedRef<boolean>;\n\n /**\n * If true, hides the default expansion toggle column\n */\n hasCustomExpandToggle: ComputedRef<boolean>;\n\n /**\n * When true, the table is schema-driven (e.g. DataTable); selection column is rendered from the schema, not by TableRow/TableHeaderRow.\n */\n isSchemaDriven?: ComputedRef<boolean>;\n\n /**\n * Adds a toggle column for row expansion. This is primarily needed for ensuring the corresponding empty TableHeaderRow is included.\n */\n isExpandable: ComputedRef<boolean>;\n\n /**\n * Adds a checkbox column for selecting rows; intended for use with the `useSelection` composable.\n */\n isSelectable: ComputedRef<boolean>;\n\n /**\n * Sets the table layout; the default value is \"scroll\".\n */\n layout: ComputedRef<Layouts>;\n\n /**\n * Sets the table loading state.\n */\n isLoading: ComputedRef<boolean>;\n}\n","<script lang=\"ts\">\n import { SpacingDensities, SpacingDensity } from '../../../types/misc';\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import { Layouts, TableRadiuses } from './Table.types';\n\n export * from './Table.keys';\n export * from './Table.types';\n\n export interface TableProps {\n /**\n * Controls the Table's padding; the default value is \"comfortable\". On small screens, \"compact\" density is applied regardless of this prop's value.\n */\n density?: SpacingDensities;\n\n /**\n * Sets the text for the empty state; the default value is \"No Results\".\n */\n emptyStateText?: string;\n\n /**\n * Styles the last column for \"row actions\"\n */\n hasActions?: boolean;\n\n /**\n * If true, hides the default expansion toggle column\n */\n hasCustomExpandToggle?: boolean;\n\n /**\n * Shows the empty state\n */\n isEmpty?: boolean;\n\n /**\n * When true, indicates the table is being composed by DataTable (schema-driven mode).\n * TableRow/TableHeaderRow use this to suppress their built-in selection cells.\n */\n isSchemaDriven?: boolean;\n\n /**\n * Shows the loading state\n */\n isLoading?: boolean;\n\n /**\n * Adds a toggle column for row expansion. This is primarily needed for ensuring the corresponding empty TableHeaderRow is included.\n */\n isExpandable?: boolean;\n\n /**\n * Adds a checkbox column for selecting rows; intended for use with the `useSelection` composable.\n */\n isSelectable?: boolean;\n\n /**\n * Sets the table layout; the default value is \"scroll\".\n */\n layout?: Layouts;\n\n /**\n * Controls the corners of the table with the \"border-radius\" CSS property. The default value is \"rounded\".\n */\n radius?: TableRadiuses;\n\n /**\n * Allows the table head to be sticky when scrolling inside the table body\n */\n stickyHeader?: {\n listLength: number;\n maxHeight: string;\n };\n\n /**\n * Total width (px) of left-pinned columns. Used to offset scroll overlay elements.\n */\n pinnedLeftWidth?: number;\n\n /**\n * Total width (px) of right-pinned columns. Used to offset scroll overlay elements.\n */\n pinnedRightWidth?: number;\n\n /**\n * When set, applied as min-width on the <table> element so columns don't collapse below their TanStack sizes.\n */\n tableMinWidth?: number;\n }\n</script>\n\n<script setup lang=\"ts\">\n import { useIntersectionObserver, useResizeObserver, useScroll } from '@vueuse/core';\n import { computed, inject, provide, ref, useCssModule, useTemplateRef, watchEffect } from 'vue';\n\n import Button from '../Button/Button.vue';\n import { DATA_VIEW_INJECTION } from '../DataView/DataView.vue';\n import EmptyState from '../EmptyState/EmptyState.vue';\n import Icon from '../Icon/Icon.vue';\n import Loading from '../Loading/Loading.vue';\n import TableCell from '../TableCell/TableCell.vue';\n import TableRow from '../TableRow/TableRow.vue';\n import { TABLE_INJECTION } from './Table.keys';\n\n const SCROLL_DELTA_PX = 200;\n\n const props = withDefaults(defineProps<TableProps>(), {\n density: undefined,\n emptyStateText: '',\n hasActions: false,\n hasCustomExpandToggle: false,\n isEmpty: false,\n isSchemaDriven: false,\n isLoading: false,\n isExpandable: false,\n isSelectable: false,\n layout: 'scroll',\n radius: 'rounded',\n stickyHeader: undefined,\n pinnedLeftWidth: 0,\n pinnedRightWidth: 0,\n tableMinWidth: undefined,\n });\n\n const classes = useCssModule();\n\n const {\n density: dataViewDensity,\n variant: dataViewVariant,\n isEmpty: isDataViewEmpty,\n isLoading: isDataViewLoading,\n isSelectable: isDataViewSelectable,\n } = inject(DATA_VIEW_INJECTION.key, DATA_VIEW_INJECTION.defaults);\n\n const { variant: moduleVariant } = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n\n const computedRadius = computed<TableRadiuses>(() => {\n // Will work for tables when rendered inside of a Module with OR without a DataView.\n if (moduleVariant?.value === 'table') {\n return 'rounded-bottom';\n }\n\n if (dataViewVariant.value === 'table') {\n return 'rounded-bottom';\n }\n\n return props.radius;\n });\n\n const computedLayout = computed<Layouts>(() => {\n if (props.stickyHeader) {\n return 'scroll';\n }\n\n return props.layout;\n });\n\n const isShadowEnabled = computed<boolean>(() => {\n return computedLayout.value === 'scroll' && dataViewVariant.value === 'table';\n });\n\n const isStickyHeaderEnabled = computed<boolean>(() => {\n return !!(\n (props.stickyHeader?.maxHeight && props.stickyHeader?.listLength > 3) // table can't scroll without a max height; sticky headers only needed for a scrollable table\n // scrollable table and sticky headers not needed when list is small\n );\n });\n\n const rootStyle = computed(() => ({\n maxHeight: isStickyHeaderEnabled.value ? props.stickyHeader?.maxHeight : '',\n }));\n\n const isTableLoading = computed(() => Boolean(props.isLoading || isDataViewLoading?.value));\n\n const scrollContainerRef = useTemplateRef<HTMLElement>('scrollContainerRef');\n const tableRef = useTemplateRef<HTMLTableElement>('tableRef');\n const hasHorizontalOverflow = ref(false);\n const scrollbarWidth = ref(0);\n const horizontalScrollbarHeight = ref(0);\n\n const { arrivedState, measure } = useScroll(scrollContainerRef, { behavior: 'smooth' });\n\n function updateOverflow() {\n const el = scrollContainerRef.value;\n if (!el || computedLayout.value !== 'scroll') return;\n hasHorizontalOverflow.value = el.scrollWidth > el.clientWidth;\n scrollbarWidth.value = el.offsetWidth - el.clientWidth;\n horizontalScrollbarHeight.value = el.offsetHeight - el.clientHeight;\n measure();\n }\n\n useResizeObserver(scrollContainerRef, updateOverflow);\n useResizeObserver(tableRef, updateOverflow);\n\n useIntersectionObserver(\n scrollContainerRef,\n (entries) => {\n if (entries[0]?.isIntersecting) updateOverflow();\n },\n { threshold: 0.01 },\n );\n\n const canScrollLeft = computed(() => !arrivedState.left);\n const canScrollRight = computed(() => !arrivedState.right);\n const showScrollButtons = computed(() => computedLayout.value === 'scroll' && hasHorizontalOverflow.value);\n\n function scrollBy(delta: number) {\n scrollContainerRef.value?.scrollBy({ left: delta, behavior: 'smooth' });\n }\n\n const hasPinnedColumns = computed(() => (props.pinnedLeftWidth ?? 0) > 0 || (props.pinnedRightWidth ?? 0) > 0);\n\n const tableStyle = computed(() => {\n const style: Record<string, string> = {};\n if (props.tableMinWidth != null) style.minWidth = `${props.tableMinWidth}px`;\n if (hasPinnedColumns.value) style.borderSpacing = '0';\n return Object.keys(style).length ? style : undefined;\n });\n\n provide(TABLE_INJECTION.key, {\n density: computed(() => props.density || dataViewDensity.value || SpacingDensity.Comfortable),\n hasCustomExpandToggle: computed(() => props.hasCustomExpandToggle),\n hasActions: computed(() => props.hasActions),\n isSchemaDriven: computed(() => props.isSchemaDriven),\n isExpandable: computed(() => props.isExpandable),\n isSelectable: computed(\n () =>\n props.isSelectable &&\n !props.isLoading &&\n !isDataViewLoading?.value &&\n !props.isEmpty &&\n !isDataViewEmpty?.value,\n ),\n isLoading: isTableLoading,\n layout: computedLayout,\n });\n\n watchEffect(() => {\n // Table can be both casted within a DataView or standalone. useSelection is still possible to be used on both cases,\n // making it important to have Table to control selection props.\n // To avoid breaking changes and developer experience, a DataView injection is passed down and updated whenever it exists,\n // and move the information up into DataView, that sometimes aren't used.\n if (isDataViewSelectable) {\n isDataViewSelectable.value = props.isSelectable;\n }\n });\n</script>\n\n<template>\n <div class=\"stash-table-wrapper relative\">\n <div\n ref=\"scrollContainerRef\"\n class=\"stash-table relative\"\n :class=\"[\n { rounded: computedRadius === 'rounded' },\n { 'rounded-b': computedRadius === 'rounded-bottom' },\n { 'border-t border-ice-200': dataViewVariant === 'table' },\n { 'overflow-auto scroll-smooth': computedLayout === 'scroll' },\n { shadow: isShadowEnabled },\n {\n 'overflow-visible lg:overflow-auto lg:shadow': computedLayout === 'stack',\n },\n ]\"\n data-test=\"stash-table\"\n :aria-busy=\"isTableLoading\"\n :style=\"rootStyle\"\n >\n <table ref=\"tableRef\" class=\"relative w-full border-separate\" :style=\"tableStyle\">\n <thead class=\"border-b border-ice-200\" :class=\"{ 'hidden lg:table-header-group': computedLayout === 'stack' }\">\n <!-- @slot head -->\n <slot name=\"head\"> </slot>\n </thead>\n <tbody>\n <!--\n col-span-12 makes the td span all columns only when layout === 'stack' and the viewport is below lg (when table elements are using display: grid ).\n The colspan attr does the same in all other cases when the table elements are using their native table styles.\n relative prevents the loading/empty state from overflowing the table whenever the table has actions and the table cell applies position absolute.\n \"max-width: '100vw'\" prevents the loading/empty state from overflowing the table whenever the table is in the scroll layout.\n These are necessary in order to properly horizontally center Loading, and EmptyState\n -->\n <TableRow v-if=\"isTableLoading\">\n <TableCell colspan=\"100%\" :class=\"{ 'relative! col-span-12': computedLayout === 'stack' }\">\n <Loading :style=\"[computedLayout === 'scroll' ? { 'max-width': '100vw' } : {}]\" />\n </TableCell>\n </TableRow>\n <!-- @slot empty -->\n <template v-else-if=\"props.isEmpty || isDataViewEmpty\">\n <TableRow>\n <TableCell colspan=\"100%\" :class=\"{ 'relative! col-span-12': computedLayout === 'stack' }\">\n <slot name=\"empty\">\n <EmptyState\n class=\"w-full bg-white\"\n :text=\"props.emptyStateText\"\n :style=\"[computedLayout === 'scroll' ? { 'max-width': '100vw' } : {}]\"\n />\n </slot>\n </TableCell>\n </TableRow>\n </template>\n <!-- @slot body -->\n <slot v-else name=\"body\"></slot>\n </tbody>\n </table>\n </div>\n <div\n v-if=\"showScrollButtons\"\n :class=\"classes['stash-table-scroll-overlay']\"\n class=\"pointer-events-none absolute inset-0 flex items-center justify-between z-2\"\n >\n <template v-if=\"canScrollLeft\">\n <div\n :class=\"classes['stash-table-scroll-shadow-left']\"\n class=\"stash-table-scroll-shadow border-l border-ice-100 absolute top-0 w-4\"\n :style=\"{ left: `${props.pinnedLeftWidth}px`, bottom: `${horizontalScrollbarHeight}px` }\"\n data-test=\"stash-table|scroll-shadow-left\"\n />\n <Button\n class=\"pointer-events-auto absolute top-[7px] border border-ice-100 bg-white rounded-full shadow size-6 p-0 min-w-auto\"\n :style=\"{ left: `${(props.pinnedLeftWidth ?? 0) + 12}px` }\"\n secondary\n icon\n :aria-label=\"'Scroll table left'\"\n data-test=\"stash-table|scroll-left\"\n @click=\"scrollBy(-SCROLL_DELTA_PX)\"\n >\n <Icon name=\"chevron-left\" />\n </Button>\n </template>\n <template v-if=\"canScrollRight\">\n <div\n :class=\"classes['stash-table-scroll-shadow-right']\"\n class=\"stash-table-scroll-shadow border-r border-ice-100 absolute top-0 w-4\"\n :style=\"{\n right: `${scrollbarWidth + (props.pinnedRightWidth ?? 0)}px`,\n bottom: `${horizontalScrollbarHeight}px`,\n }\"\n data-test=\"stash-table|scroll-shadow-right\"\n />\n\n <Button\n class=\"pointer-events-auto absolute top-[7px] border border-ice-100 bg-white rounded-full shadow size-6 p-0 min-w-auto\"\n :style=\"{ right: `${scrollbarWidth + (props.pinnedRightWidth ?? 0) + 12}px` }\"\n secondary\n icon\n :aria-label=\"'Scroll table right'\"\n data-test=\"stash-table|scroll-right\"\n @click=\"scrollBy(SCROLL_DELTA_PX)\"\n >\n <Icon name=\"chevron-right\" class=\"text-ice-900\" />\n </Button>\n </template>\n </div>\n </div>\n</template>\n\n<style module>\n .stash-table-scroll-shadow-left {\n background: linear-gradient(90deg, rgb(38 38 38 / 10%) 0%, rgb(38 38 38 / 0%) 32.65%);\n }\n\n .stash-table-scroll-shadow-right {\n background: linear-gradient(270deg, rgb(38 38 38 / 10%) 0%, rgb(38 38 38 / 0%) 32.65%);\n }\n\n @media print {\n .stash-table-scroll-overlay {\n display: none !important;\n }\n }\n</style>\n"],"names":["Layout","TableRadius","props","__props","classes","useCssModule","dataViewDensity","dataViewVariant","isDataViewEmpty","isDataViewLoading","isDataViewSelectable","inject","DATA_VIEW_INJECTION","moduleVariant","MODULE_INJECTION","computedRadius","computed","computedLayout","isShadowEnabled","isStickyHeaderEnabled","_a","_b","rootStyle","isTableLoading","scrollContainerRef","useTemplateRef","tableRef","hasHorizontalOverflow","ref","scrollbarWidth","horizontalScrollbarHeight","arrivedState","measure","useScroll","updateOverflow","el","useResizeObserver","useIntersectionObserver","entries","canScrollLeft","canScrollRight","showScrollButtons","scrollBy","delta","hasPinnedColumns","tableStyle","style","provide","TABLE_INJECTION","SpacingDensity","watchEffect","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_unref","_normalizeClass","_renderSlot","_ctx","_createBlock","TableRow","_createVNode","TableCell","Loading","EmptyState","_Fragment","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edLeftWidth: number;
51
+ pinnedRightWidth: number;
52
+ tableMinWidth: undefined;
50
53
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<TableProps>, {
51
54
  density: undefined;
52
55
  emptyStateText: string;
@@ -60,6 +63,9 @@ isSelectable: boolean;
60
63
  layout: string;
61
64
  radius: string;
62
65
  stickyHeader: undefined;
66
+ pinnedLeftWidth: number;
67
+ pinnedRightWidth: number;
68
+ tableMinWidth: undefined;
63
69
  }>>> & Readonly<{}>, {
64
70
  isLoading: boolean;
65
71
  radius: "none" | "rounded" | "rounded-bottom";
@@ -76,6 +82,9 @@ stickyHeader: {
76
82
  listLength: number;
77
83
  maxHeight: string;
78
84
  };
85
+ pinnedLeftWidth: number;
86
+ pinnedRightWidth: number;
87
+ tableMinWidth: number;
79
88
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
80
89
  head?(_: {}): any;
81
90
  empty?(_: {}): any;
@@ -197,6 +206,18 @@ export declare interface TableProps {
197
206
  listLength: number;
198
207
  maxHeight: string;
199
208
  };
209
+ /**
210
+ * Total width (px) of left-pinned columns. Used to offset scroll overlay elements.
211
+ */
212
+ pinnedLeftWidth?: number;
213
+ /**
214
+ * Total width (px) of right-pinned columns. Used to offset scroll overlay elements.
215
+ */
216
+ pinnedRightWidth?: number;
217
+ /**
218
+ * When set, applied as min-width on the <table> element so columns don't collapse below their TanStack sizes.
219
+ */
220
+ tableMinWidth?: number;
200
221
  }
201
222
 
202
223
  export declare enum TableRadius {
@@ -1,69 +1,72 @@
1
- import { defineComponent as k, useCssModule as D, inject as h, computed as s, createElementBlock as b, openBlock as c, normalizeClass as n, unref as e, createElementVNode as T, renderSlot as g, createCommentVNode as d, createBlock as x } from "vue";
1
+ import { defineComponent as g, useCssModule as T, inject as h, computed as s, createElementBlock as b, openBlock as n, normalizeClass as c, unref as e, createElementVNode as x, renderSlot as E, createCommentVNode as d, createBlock as y } from "vue";
2
2
  import "lodash-es/cloneDeep";
3
3
  import "./Module.keys-DcqBbvvT.js";
4
4
  import "lodash-es/get";
5
- import w from "./Icon.js";
6
- import { D as y } from "./DataView.keys-aSOnA4AD.js";
5
+ import I from "./Icon.js";
6
+ import { D as w } from "./DataView.keys-aSOnA4AD.js";
7
7
  import "./Illustration.vue_vue_type_script_setup_true_lang-C1bPkWZZ.js";
8
8
  import "lodash-es/uniqueId";
9
9
  import "@leaflink/snitch";
10
- import { T as E } from "./Table.keys-LHQf6FEH.js";
11
- import { _ as N } from "./_plugin-vue_export-helper-CHgC5LLL.js";
12
- const A = {
10
+ import { T as N } from "./Table.keys-LHQf6FEH.js";
11
+ import { _ as A } from "./_plugin-vue_export-helper-CHgC5LLL.js";
12
+ const B = {
13
13
  key: 0,
14
14
  class: "relative h-4 w-3"
15
- }, B = /* @__PURE__ */ k({
15
+ }, j = /* @__PURE__ */ g({
16
16
  __name: "TableHeaderCell",
17
17
  props: {
18
18
  sortId: { default: "" },
19
19
  schemaDrivenHeader: { default: void 0 }
20
20
  },
21
- setup(I) {
22
- const r = I, t = D(), m = h(E.key);
21
+ setup(k) {
22
+ const r = k, t = T(), m = h(N.key);
23
23
  if (!m)
24
24
  throw new Error("TableHeaderCell must be used within a Table component");
25
- const { density: p, hasActions: C } = m, a = s(() => !!r.schemaDrivenHeader), { currentSortId: H, currentSortOrder: v, updateCurrentSort: _ } = h(
26
- y.key,
27
- y.defaults
28
- ), l = s(() => a.value ? r.schemaDrivenHeader.column.getCanSort() : !!r.sortId), o = s(() => a.value ? !!r.schemaDrivenHeader.column.getIsSorted() : H.value === r.sortId), f = s(() => a.value ? r.schemaDrivenHeader.column.getIsSorted() : o.value && v.value ? v.value : !1);
25
+ const { density: p, hasActions: C } = m, o = s(() => !!r.schemaDrivenHeader), H = s(
26
+ () => o.value && !!r.schemaDrivenHeader.column.getIsPinned()
27
+ ), { currentSortId: D, currentSortOrder: f, updateCurrentSort: v } = h(
28
+ w.key,
29
+ w.defaults
30
+ ), l = s(() => o.value ? r.schemaDrivenHeader.column.getCanSort() : !!r.sortId), a = s(() => o.value ? !!r.schemaDrivenHeader.column.getIsSorted() : D.value === r.sortId), _ = s(() => o.value ? r.schemaDrivenHeader.column.getIsSorted() : a.value && f.value ? f.value : !1);
29
31
  function S(i) {
30
32
  var u;
31
- if (a.value) {
33
+ if (o.value) {
32
34
  (u = r.schemaDrivenHeader.column.getToggleSortingHandler()) == null || u(i);
33
35
  return;
34
36
  }
35
- l.value && typeof _ == "function" && _(r.sortId, { shouldEmit: !0 });
37
+ l.value && typeof v == "function" && v(r.sortId, { shouldEmit: !0 });
36
38
  }
37
- return (i, u) => (c(), b("th", {
38
- class: n(["stash-table-header-cell border-b border-r border-ice-200 p-3 text-xs font-medium text-ice-900", [
39
+ return (i, u) => (n(), b("th", {
40
+ class: c(["stash-table-header-cell border-b border-r border-ice-200 p-3 text-xs font-medium text-ice-900", [
39
41
  e(t).root,
40
42
  {
41
- "bg-white": !o.value,
42
- "stash-table-header-cell--sorted bg-blue-100": o.value,
43
+ "bg-white": !a.value,
44
+ "stash-table-header-cell--sorted bg-blue-100": a.value,
43
45
  [e(t)["root--density-compact"]]: e(p) === "compact",
44
46
  [e(t)["root--density-comfortable"]]: e(p) === "comfortable",
45
47
  [e(t)["has-actions"]]: e(C),
48
+ [e(t)["pinned-sticky"]]: H.value,
46
49
  "cursor-pointer": l.value
47
50
  }
48
51
  ]]),
49
52
  "data-test": "stash-table-header-cell",
50
53
  onClick: S
51
54
  }, [
52
- T("div", {
53
- class: n(["flex justify-between", e(t)["content-wrapper"]])
55
+ x("div", {
56
+ class: c(["flex justify-between", e(t)["content-wrapper"]])
54
57
  }, [
55
- g(i.$slots, "default"),
56
- l.value ? (c(), b("div", A, [
57
- !o.value || f.value === "asc" ? (c(), x(w, {
58
+ E(i.$slots, "default"),
59
+ l.value ? (n(), b("div", B, [
60
+ !a.value || _.value === "asc" ? (n(), y(I, {
58
61
  key: 0,
59
- class: n(["absolute text-ice-700", [e(t).caret, e(t)["caret-up"]]]),
62
+ class: c(["absolute text-ice-700", [e(t).caret, e(t)["caret-up"]]]),
60
63
  "data-test": "icon|caret-up",
61
64
  name: "caret-up",
62
65
  size: "dense"
63
66
  }, null, 8, ["class"])) : d("", !0),
64
- !o.value || f.value === "desc" ? (c(), x(w, {
67
+ !a.value || _.value === "desc" ? (n(), y(I, {
65
68
  key: 1,
66
- class: n(["absolute text-ice-700", [e(t).caret, e(t)["caret-down"]]]),
69
+ class: c(["absolute text-ice-700", [e(t).caret, e(t)["caret-down"]]]),
67
70
  "data-test": "icon|caret-down",
68
71
  name: "caret-down",
69
72
  size: "dense"
@@ -72,18 +75,19 @@ const A = {
72
75
  ], 2)
73
76
  ], 2));
74
77
  }
75
- }), j = "_root_1xv85_5", z = "_caret_1xv85_21", M = {
76
- root: j,
77
- "has-actions": "_has-actions_1xv85_17",
78
- "content-wrapper": "_content-wrapper_1xv85_17",
79
- "caret-up": "_caret-up_1xv85_21",
80
- "caret-down": "_caret-down_1xv85_25",
81
- caret: z,
82
- "root--density-comfortable": "_root--density-comfortable_1xv85_34"
83
- }, O = {
84
- $style: M
85
- }, Q = /* @__PURE__ */ N(B, [["__cssModules", O]]);
78
+ }), z = "_root_flohv_5", M = "_caret_flohv_25", O = {
79
+ root: z,
80
+ "pinned-sticky": "_pinned-sticky_flohv_17",
81
+ "has-actions": "_has-actions_flohv_21",
82
+ "content-wrapper": "_content-wrapper_flohv_21",
83
+ "caret-up": "_caret-up_flohv_25",
84
+ "caret-down": "_caret-down_flohv_29",
85
+ caret: M,
86
+ "root--density-comfortable": "_root--density-comfortable_flohv_38"
87
+ }, V = {
88
+ $style: O
89
+ }, U = /* @__PURE__ */ A(j, [["__cssModules", V]]);
86
90
  export {
87
- Q as default
91
+ U as default
88
92
  };
89
93
  //# sourceMappingURL=TableHeaderCell.js.map