@leaflink/stash 44.0.0-beta.6 → 44.0.0-beta.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.
- package/README.md +107 -39
- package/dist/ActionsDropdown.js +2 -2
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/AddressSelect.js +2 -2
- package/dist/AppNavigationItem.js +1 -1
- package/dist/AppSidebar.js +13 -13
- package/dist/AppSidebar.js.map +1 -1
- package/dist/Badge.vue.d.ts +1 -1
- package/dist/Button.js +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js +17 -0
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js.map +1 -0
- package/dist/ButtonGroup.js +19 -19
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/Carousel.js +258 -246
- package/dist/Carousel.js.map +1 -1
- package/dist/Checkbox.js +57 -46
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.vue.d.ts +2 -0
- package/dist/Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js +9 -0
- package/dist/Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js.map +1 -0
- package/dist/ChevronToggle.js +1 -1
- package/dist/Copy.js +1 -1
- package/dist/CurrencyInput.js +2 -2
- package/dist/DataView.js +1 -1
- package/dist/DataViewFilters.js +4 -4
- package/dist/DataViewSortButton.js +47 -38
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewToolbar.js +2 -2
- package/dist/DatePicker.js +9 -9
- package/dist/DatePicker.js.map +1 -1
- package/dist/DescriptionListTerm.js +1 -1
- package/dist/DescriptionListTerm.js.map +1 -1
- package/dist/Dialog.js +33 -33
- package/dist/Dialog.js.map +1 -1
- package/dist/Divider.js +4 -4
- package/dist/Divider.js.map +1 -1
- package/dist/Expand.js +1 -1
- package/dist/{Expand.vue_vue_type_script_setup_true_lang-5fe03d51.js → Expand.vue_vue_type_script_setup_true_lang-1751f4a6.js} +14 -15
- package/dist/Expand.vue_vue_type_script_setup_true_lang-1751f4a6.js.map +1 -0
- package/dist/Field.js +2 -2
- package/dist/Field.vue.d.ts +1 -1
- package/dist/{Field.vue_vue_type_script_setup_true_lang-4483019d.js → Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js} +2 -2
- package/dist/Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js.map +1 -0
- package/dist/FileUpload.js +7 -7
- package/dist/FileUpload.js.map +1 -1
- package/dist/FilterChip.js +30 -30
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterDropdown.js +2 -2
- package/dist/FilterSelect.js +27 -27
- package/dist/FilterSelect.js.map +1 -1
- package/dist/Filters.js +39 -39
- package/dist/Filters.js.map +1 -1
- package/dist/HttpError.js +6 -6
- package/dist/IconLabel.js +6 -6
- package/dist/IconLabel.js.map +1 -1
- package/dist/IconLabel.vue.d.ts +1 -1
- package/dist/Illustration.js +10 -60
- package/dist/Illustration.js.map +1 -1
- package/dist/Illustration.vue_vue_type_script_setup_true_lang-d6a94e17.js +56 -0
- package/dist/Illustration.vue_vue_type_script_setup_true_lang-d6a94e17.js.map +1 -0
- package/dist/Image.js +67 -72
- package/dist/Image.js.map +1 -1
- package/dist/InlineEdit.js +2 -2
- package/dist/Input.js +53 -53
- package/dist/Input.js.map +1 -1
- package/dist/InputOptions.js +2 -2
- package/dist/Label.js +1 -1
- package/dist/Label.vue.d.ts +13 -2
- package/dist/{Label.vue_vue_type_script_setup_true_lang-2de35913.js → Label.vue_vue_type_script_setup_true_lang-4b02087f.js} +12 -11
- package/dist/Label.vue_vue_type_script_setup_true_lang-4b02087f.js.map +1 -0
- package/dist/ListItem.js +11 -11
- package/dist/ListItem.js.map +1 -1
- package/dist/ListItemCell.js +9 -9
- package/dist/ListItemCell.js.map +1 -1
- package/dist/ListView.js +55 -52
- package/dist/ListView.js.map +1 -1
- package/dist/Loading.js +17 -10
- package/dist/Loading.js.map +1 -1
- package/dist/Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js +8 -0
- package/dist/Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js.map +1 -0
- package/dist/MenuItem.js +20 -14
- package/dist/MenuItem.js.map +1 -1
- package/dist/Modal.js +2 -2
- package/dist/Modal.js.map +1 -1
- package/dist/ObfuscateText.js +30 -32
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/ObfuscateText.vue.d.ts +1 -1
- package/dist/PageContent.js +9 -9
- package/dist/PageContent.js.map +1 -1
- package/dist/PageHeader.js +22 -22
- package/dist/PageHeader.js.map +1 -1
- package/dist/PageNavigation.js +3 -3
- package/dist/PageNavigation.js.map +1 -1
- package/dist/Paginate.js +1 -1
- package/dist/Paginate.js.map +1 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js +11 -0
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js.map +1 -0
- package/dist/QuickAction.js +22 -19
- package/dist/QuickAction.js.map +1 -1
- package/dist/Radio.js +30 -15
- package/dist/Radio.js.map +1 -1
- package/dist/RadioGroup.js +135 -106
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioNew.js +118 -91
- package/dist/RadioNew.js.map +1 -1
- package/dist/SearchBar.js +32 -32
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +7 -7
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +2 -2
- package/dist/Switch.js +41 -34
- package/dist/Switch.js.map +1 -1
- package/dist/Tab.js +2 -2
- package/dist/{Tab.vue_vue_type_script_setup_true_lang-4a40f015.js → Tab.vue_vue_type_script_setup_true_lang-69d1b046.js} +2 -2
- package/dist/{Tab.vue_vue_type_script_setup_true_lang-4a40f015.js.map → Tab.vue_vue_type_script_setup_true_lang-69d1b046.js.map} +1 -1
- package/dist/Table.js +6 -6
- package/dist/Table.keys-cf93df19.js +27 -0
- package/dist/{Table.keys-1ebe4ecb.js.map → Table.keys-cf93df19.js.map} +1 -1
- package/dist/TableCell.js +5 -5
- package/dist/TableCell.js.map +1 -1
- package/dist/TableHeaderCell.js +32 -32
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableHeaderRow.js +10 -10
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableRow.js +42 -41
- package/dist/TableRow.js.map +1 -1
- package/dist/Tabs.js +2 -2
- package/dist/{Tabs.vue_used_vue_type_style_index_0_lang.module-0af1e1cf.js → Tabs.vue_used_vue_type_style_index_0_lang.module-2a131332.js} +25 -25
- package/dist/Tabs.vue_used_vue_type_style_index_0_lang.module-2a131332.js.map +1 -0
- package/dist/Textarea.js +49 -41
- package/dist/Textarea.js.map +1 -1
- package/dist/Toast.js +23 -23
- package/dist/Toast.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/constants.d.ts +26 -19
- package/dist/constants.js +41 -26
- package/dist/constants.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/tailwind-base.d.ts +16 -16
- package/dist/tailwind-base.js +16 -6
- package/dist/tailwind-base.js.map +1 -1
- package/package.json +2 -2
- package/styles/backwards-compat.css +41 -104
- package/styles/base.css +258 -112
- package/tailwind-base.ts +6 -1
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js +0 -17
- package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js.map +0 -1
- package/dist/Checkbox.vue_vue_type_style_index_0_scoped_dbd26d7f_lang-4ed993c7.js +0 -2
- package/dist/Checkbox.vue_vue_type_style_index_0_scoped_dbd26d7f_lang-4ed993c7.js.map +0 -1
- package/dist/Expand.vue_vue_type_script_setup_true_lang-5fe03d51.js.map +0 -1
- package/dist/Field.vue_vue_type_script_setup_true_lang-4483019d.js.map +0 -1
- package/dist/Label.vue_vue_type_script_setup_true_lang-2de35913.js.map +0 -1
- package/dist/Loading.vue_vue_type_style_index_0_scoped_bb8d5f15_lang-4ed993c7.js +0 -2
- package/dist/Loading.vue_vue_type_style_index_0_scoped_bb8d5f15_lang-4ed993c7.js.map +0 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-1a2084f9.js +0 -11
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-1a2084f9.js.map +0 -1
- package/dist/Table.keys-1ebe4ecb.js +0 -27
- package/dist/Tabs.vue_used_vue_type_style_index_0_lang.module-0af1e1cf.js.map +0 -1
- package/styles/_base.scss +0 -493
- package/styles/elements/_links.scss +0 -32
- package/styles/elements/_lists.scss +0 -31
- package/styles/elements/_misc.scss +0 -16
- package/styles/main.scss +0 -38
package/dist/SelectStatus.js
CHANGED
|
@@ -22,8 +22,8 @@ import "./clickoutside.js";
|
|
|
22
22
|
import "./MenusPlugin-5e93f0a5.js";
|
|
23
23
|
import "./Chip.js";
|
|
24
24
|
import "./utils/colorScheme.js";
|
|
25
|
-
import "./Field.vue_vue_type_script_setup_true_lang-
|
|
26
|
-
import "./Label.vue_vue_type_script_setup_true_lang-
|
|
25
|
+
import "./Field.vue_vue_type_script_setup_true_lang-42ba3c5a.js";
|
|
26
|
+
import "./Label.vue_vue_type_script_setup_true_lang-4b02087f.js";
|
|
27
27
|
import "./locale.js";
|
|
28
28
|
const j = { class: "tw-mr-6 tw-truncate" }, E = {
|
|
29
29
|
key: 1,
|
package/dist/Switch.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as k, useAttrs as v, useSlots as y, useCssModule as g, computed as n, openBlock as i, createElementBlock as d, normalizeClass as s, unref as a, createElementVNode as l, mergeProps as C, withDirectives as S, vModelCheckbox as A, toDisplayString as u, createCommentVNode as p, renderSlot as V, createTextVNode as B } from "vue";
|
|
2
|
+
import M from "@leaflink/snitch";
|
|
3
3
|
import T from "lodash-es/uniqueId";
|
|
4
|
-
import { _ as
|
|
5
|
-
const
|
|
4
|
+
import { _ as j } from "./_plugin-vue_export-helper-dad06003.js";
|
|
5
|
+
const E = ["data-test"], N = ["for"], D = ["id", "disabled", "name", "value"], I = /* @__PURE__ */ k({
|
|
6
6
|
name: "ll-switch",
|
|
7
7
|
inheritAttrs: !1,
|
|
8
8
|
__name: "Switch",
|
|
@@ -16,74 +16,81 @@ const N = (s) => (C("data-v-148dbe3f"), s = s(), V(), s), D = ["data-test"], q =
|
|
|
16
16
|
value: { default: "" }
|
|
17
17
|
},
|
|
18
18
|
emits: ["update:checked"],
|
|
19
|
-
setup(
|
|
20
|
-
const t =
|
|
21
|
-
if (typeof t.value == "boolean" &&
|
|
19
|
+
setup(f, { emit: b }) {
|
|
20
|
+
const t = f, o = v(), m = y(), c = g();
|
|
21
|
+
if (typeof t.value == "boolean" && M.warn("Switch: use `checked` to toggle the state; `value` is what will be set if `checked` is true"), o.onChange)
|
|
22
22
|
throw new Error("ll-switch: use the @update:checked event instead of @change.");
|
|
23
|
-
const
|
|
23
|
+
const _ = n(() => {
|
|
24
24
|
const e = { ...o };
|
|
25
25
|
return delete e["data-test"], delete e.class, e;
|
|
26
|
-
}), r =
|
|
26
|
+
}), r = n({
|
|
27
27
|
get() {
|
|
28
28
|
return t.checked;
|
|
29
29
|
},
|
|
30
30
|
set(e) {
|
|
31
31
|
b("update:checked", e);
|
|
32
32
|
}
|
|
33
|
-
}), w =
|
|
34
|
-
return (e, h) => (
|
|
35
|
-
class:
|
|
36
|
-
"data-test":
|
|
33
|
+
}), w = n(() => t.id || T("switch-"));
|
|
34
|
+
return (e, h) => (i(), d("div", {
|
|
35
|
+
class: s(["stash-switch", a(o).class]),
|
|
36
|
+
"data-test": a(o)["data-test"] || "stash-switch"
|
|
37
37
|
}, [
|
|
38
|
-
l("label",
|
|
38
|
+
l("label", C({
|
|
39
39
|
for: w.value,
|
|
40
40
|
class: [{ "tw-pointer-events-none": t.disabled }, "tw-flex tw-cursor-pointer"],
|
|
41
41
|
"data-test": "stash-switch|label"
|
|
42
|
-
},
|
|
42
|
+
}, _.value), [
|
|
43
43
|
l("span", {
|
|
44
|
-
class:
|
|
44
|
+
class: s(["tw-relative tw-inline-block tw-h-5 tw-w-[34px] tw-min-w-[34px]", { [a(c).active]: t.checked }])
|
|
45
45
|
}, [
|
|
46
46
|
l("span", {
|
|
47
|
-
class:
|
|
47
|
+
class: s(["stash-switch__track tw-absolute tw-top-0.5 tw-h-4 tw-w-full tw-rounded-[10px]", [a(c).track, t.disabled ? "tw-bg-ice-500" : "tw-bg-ice-700"]])
|
|
48
48
|
}, null, 2),
|
|
49
|
-
|
|
49
|
+
l("span", {
|
|
50
|
+
class: s(["stash-switch__control tw-absolute tw-left-0 tw-h-5 tw-w-5 tw-rounded-[10px] tw-border tw-border-solid tw-border-ice-500 tw-bg-white tw-shadow", a(c).control])
|
|
51
|
+
}, null, 2)
|
|
50
52
|
], 2),
|
|
51
|
-
|
|
53
|
+
S(l("input", {
|
|
52
54
|
id: w.value,
|
|
53
|
-
"onUpdate:modelValue": h[0] || (h[0] = (
|
|
55
|
+
"onUpdate:modelValue": h[0] || (h[0] = (x) => r.value = x),
|
|
54
56
|
type: "checkbox",
|
|
55
57
|
disabled: t.disabled,
|
|
56
58
|
name: t.name,
|
|
57
59
|
tabindex: "0",
|
|
58
60
|
value: e.value,
|
|
59
61
|
class: "tw-sr-only"
|
|
60
|
-
}, null, 8,
|
|
61
|
-
[
|
|
62
|
+
}, null, 8, D), [
|
|
63
|
+
[A, r.value]
|
|
62
64
|
]),
|
|
63
|
-
t.label ? (
|
|
65
|
+
t.label ? (i(), d("span", {
|
|
64
66
|
key: 0,
|
|
65
|
-
class:
|
|
67
|
+
class: s([{
|
|
66
68
|
"tw-text-ice-700": !t.checked && !t.disabled,
|
|
67
69
|
"tw-text-ice-900": t.checked,
|
|
68
70
|
"tw-text-ice-500": t.disabled
|
|
69
71
|
}, "tw-relative tw-top-px tw-ml-1.5"]),
|
|
70
72
|
"data-test": "stash-switch|label-text"
|
|
71
73
|
}, u(t.label), 3)) : p("", !0)
|
|
72
|
-
], 16,
|
|
73
|
-
t.hintText ||
|
|
74
|
+
], 16, N),
|
|
75
|
+
t.hintText || a(m).hint ? (i(), d("span", {
|
|
74
76
|
key: 0,
|
|
75
|
-
class:
|
|
77
|
+
class: s(["tw-ml-[40px] tw-mt-1.5 tw-block tw-whitespace-pre-line tw-text-xs", { "tw-text-ice-500": t.disabled }]),
|
|
76
78
|
"data-test": "stash-switch|hint"
|
|
77
79
|
}, [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
]
|
|
80
|
+
V(e.$slots, "hint", {}, () => [
|
|
81
|
+
B(u(t.hintText), 1)
|
|
82
|
+
])
|
|
81
83
|
], 2)) : p("", !0)
|
|
82
|
-
], 10,
|
|
84
|
+
], 10, E));
|
|
83
85
|
}
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
+
}), $ = "_active_yfjx8_2", q = "_track_yfjx8_2", z = "_control_yfjx8_6", P = {
|
|
87
|
+
active: $,
|
|
88
|
+
track: q,
|
|
89
|
+
control: z
|
|
90
|
+
}, U = {
|
|
91
|
+
$style: P
|
|
92
|
+
}, K = /* @__PURE__ */ j(I, [["__cssModules", U]]);
|
|
86
93
|
export {
|
|
87
|
-
|
|
94
|
+
K as default
|
|
88
95
|
};
|
|
89
96
|
//# sourceMappingURL=Switch.js.map
|
package/dist/Switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../src/components/Switch/Switch.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useSlots } from 'vue';\n\n export interface SwitchProps {\n /**\n * The current checked value, can be a boolean or an array of values\n */\n checked?: boolean | Array<string | number>;\n /**\n * Prevent the user from changing the switch state.\n */\n disabled?: boolean;\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n /**\n * Unique ID for the switch, required for accessibility purposes\n */\n id?: string;\n /**\n * Label text to display with switch\n */\n label?: string;\n /**\n * HTML name property\n */\n name?: string;\n /**\n * Value associated with switch when it is `checked`. This value is\n * used to compare against `checked` property when passed as an array.\n */\n value?: string | number;\n }\n\n defineOptions({\n name: 'll-switch',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<SwitchProps>(), {\n checked: false,\n disabled: false,\n hintText: '',\n id: undefined,\n label: '',\n name: '',\n value: '',\n });\n\n const attrs = useAttrs();\n const slots = useSlots();\n\n const emit =\n defineEmits<{\n (e: 'update:checked', value: SwitchProps['checked']): void;\n }>();\n\n if (typeof props.value === 'boolean') {\n logger.warn('Switch: use `checked` to toggle the state; `value` is what will be set if `checked` is true');\n }\n\n if (attrs.onChange) {\n throw new Error('ll-switch: use the @update:checked event instead of @change.');\n }\n\n const switchAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs['data-test'];\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const internalValue = computed({\n get() {\n return props.checked;\n },\n set(value) {\n emit('update:checked', value);\n },\n });\n\n const switchId = computed(() => props.id || uniqueId('switch-'));\n</script>\n\n<template>\n <div class=\"stash-switch\" :class=\"attrs['class']\" :data-test=\"attrs['data-test'] || 'stash-switch'\">\n <label\n :for=\"switchId\"\n :class=\"{ 'tw-pointer-events-none': props.disabled }\"\n class=\"tw-flex tw-cursor-pointer\"\n data-test=\"stash-switch|label\"\n v-bind=\"switchAttrs\"\n >\n <span\n class=\"tw-relative tw-inline-block tw-h-5 tw-w-[34px] tw-min-w-[34px]\"\n :class=\"{
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../src/components/Switch/Switch.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useCssModule, useSlots } from 'vue';\n\n export interface SwitchProps {\n /**\n * The current checked value, can be a boolean or an array of values\n */\n checked?: boolean | Array<string | number>;\n /**\n * Prevent the user from changing the switch state.\n */\n disabled?: boolean;\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n /**\n * Unique ID for the switch, required for accessibility purposes\n */\n id?: string;\n /**\n * Label text to display with switch\n */\n label?: string;\n /**\n * HTML name property\n */\n name?: string;\n /**\n * Value associated with switch when it is `checked`. This value is\n * used to compare against `checked` property when passed as an array.\n */\n value?: string | number;\n }\n\n defineOptions({\n name: 'll-switch',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<SwitchProps>(), {\n checked: false,\n disabled: false,\n hintText: '',\n id: undefined,\n label: '',\n name: '',\n value: '',\n });\n\n const attrs = useAttrs();\n const slots = useSlots();\n const classes = useCssModule();\n\n const emit =\n defineEmits<{\n (e: 'update:checked', value: SwitchProps['checked']): void;\n }>();\n\n if (typeof props.value === 'boolean') {\n logger.warn('Switch: use `checked` to toggle the state; `value` is what will be set if `checked` is true');\n }\n\n if (attrs.onChange) {\n throw new Error('ll-switch: use the @update:checked event instead of @change.');\n }\n\n const switchAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs['data-test'];\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const internalValue = computed({\n get() {\n return props.checked;\n },\n set(value) {\n emit('update:checked', value);\n },\n });\n\n const switchId = computed(() => props.id || uniqueId('switch-'));\n</script>\n\n<template>\n <div class=\"stash-switch\" :class=\"attrs['class']\" :data-test=\"attrs['data-test'] || 'stash-switch'\">\n <label\n :for=\"switchId\"\n :class=\"{ 'tw-pointer-events-none': props.disabled }\"\n class=\"tw-flex tw-cursor-pointer\"\n data-test=\"stash-switch|label\"\n v-bind=\"switchAttrs\"\n >\n <span\n class=\"tw-relative tw-inline-block tw-h-5 tw-w-[34px] tw-min-w-[34px]\"\n :class=\"{ [classes.active]: props.checked }\"\n >\n <span\n class=\"stash-switch__track tw-absolute tw-top-0.5 tw-h-4 tw-w-full tw-rounded-[10px]\"\n :class=\"[classes.track, props.disabled ? 'tw-bg-ice-500' : 'tw-bg-ice-700']\"\n ></span>\n <span\n class=\"\n stash-switch__control\n tw-absolute\n tw-left-0\n tw-h-5\n tw-w-5\n tw-rounded-[10px]\n tw-border\n tw-border-solid\n tw-border-ice-500\n tw-bg-white\n tw-shadow\n \"\n :class=\"classes.control\"\n ></span>\n </span>\n <input\n :id=\"switchId\"\n v-model=\"internalValue\"\n type=\"checkbox\"\n :disabled=\"props.disabled\"\n :name=\"props.name\"\n tabindex=\"0\"\n :value=\"value\"\n class=\"tw-sr-only\"\n />\n <span\n v-if=\"props.label\"\n :class=\"{\n 'tw-text-ice-700': !props.checked && !props.disabled,\n 'tw-text-ice-900': props.checked,\n 'tw-text-ice-500': props.disabled,\n }\"\n class=\"tw-relative tw-top-px tw-ml-1.5\"\n data-test=\"stash-switch|label-text\"\n >{{ props.label }}</span\n >\n </label>\n <span\n v-if=\"props.hintText || slots.hint\"\n class=\"tw-ml-[40px] tw-mt-1.5 tw-block tw-whitespace-pre-line tw-text-xs\"\n :class=\"{ 'tw-text-ice-500': props.disabled }\"\n data-test=\"stash-switch|hint\"\n >\n <!-- @slot for displaying hint text -->\n <slot name=\"hint\">{{ props.hintText }}</slot>\n </span>\n </div>\n</template>\n\n<style module>\n .active .track {\n @apply tw-bg-blue-500;\n }\n\n .control {\n transition: left 0.2s ease-in-out;\n\n .active & {\n @apply tw-left-3.5; /* track width - switch width */\n }\n }\n</style>\n"],"names":["attrs","useAttrs","slots","useSlots","classes","useCssModule","props","logger","switchAttrs","computed","tempAttrs","internalValue","value","emit","switchId","uniqueId"],"mappings":";;;;;;;;;;;;;;;;;;;iBAoDQA,IAAQC,KACRC,IAAQC,KACRC,IAAUC;AAWhB,QAJI,OAAOC,EAAM,SAAU,aACzBC,EAAO,KAAK,6FAA6F,GAGvGP,EAAM;AACF,YAAA,IAAI,MAAM,8DAA8D;AAG1E,UAAAQ,IAAcC,EAAS,MAAM;AAC3B,YAAAC,IAAY,EAAE,GAAGV;AAEvB,oBAAOU,EAAU,WAAW,GAC5B,OAAOA,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAgBF,EAAS;AAAA,MAC7B,MAAM;AACJ,eAAOH,EAAM;AAAA,MACf;AAAA,MACA,IAAIM,GAAO;AACT,QAAAC,EAAK,kBAAkBD,CAAK;AAAA,MAC9B;AAAA,IAAA,CACD,GAEKE,IAAWL,EAAS,MAAMH,EAAM,MAAMS,EAAS,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Tab.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as o } from "./Tab.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _ as o } from "./Tab.vue_vue_type_script_setup_true_lang-69d1b046.js";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "@leaflink/snitch";
|
|
4
4
|
import "./Badge.js";
|
|
5
5
|
import "./_plugin-vue_export-helper-dad06003.js";
|
|
6
|
-
import "./Tabs.vue_used_vue_type_style_index_0_lang.module-
|
|
6
|
+
import "./Tabs.vue_used_vue_type_style_index_0_lang.module-2a131332.js";
|
|
7
7
|
import "lodash-es/debounce";
|
|
8
8
|
import "lodash-es/uniqueId";
|
|
9
9
|
import "./constants.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as x, inject as T, computed as o, onMounted as k, nextTick as g, toRefs as u, openBlock as c, createElementBlock as y, normalizeClass as _, unref as n, withKeys as C, createBlock as P, resolveDynamicComponent as B, mergeProps as E, withCtx as b, createElementVNode as $, createVNode as N, renderSlot as A } from "vue";
|
|
2
2
|
import I from "@leaflink/snitch";
|
|
3
3
|
import j from "./Badge.js";
|
|
4
|
-
import { T as D } from "./Tabs.vue_used_vue_type_style_index_0_lang.module-
|
|
4
|
+
import { T as D } from "./Tabs.vue_used_vue_type_style_index_0_lang.module-2a131332.js";
|
|
5
5
|
const L = ["id", "aria-selected", "aria-controls", "aria-disabled"], V = { class: "tw-mt-0.5" }, J = /* @__PURE__ */ x({
|
|
6
6
|
__name: "Tab",
|
|
7
7
|
props: {
|
|
@@ -88,4 +88,4 @@ const L = ["id", "aria-selected", "aria-controls", "aria-disabled"], V = { class
|
|
|
88
88
|
export {
|
|
89
89
|
J as _
|
|
90
90
|
};
|
|
91
|
-
//# sourceMappingURL=Tab.vue_vue_type_script_setup_true_lang-
|
|
91
|
+
//# sourceMappingURL=Tab.vue_vue_type_script_setup_true_lang-69d1b046.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
{"version":3,"file":"Tab.vue_vue_type_script_setup_true_lang-69d1b046.js","sources":["../src/components/Tab/Tab.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import { computed, inject, nextTick, onMounted, toRefs } from 'vue';\n import { type RouteLocationRaw, type RouterLinkProps } from 'vue-router';\n\n import Badge from '../Badge/Badge.vue';\n import { TABS_INJECTION } from '../Tabs/Tabs.vue';\n\n /**\n * Allowed attributes for the `<a>` element when the `href` prop is used.\n */\n type AnchorAttrs = HTMLAnchorElement['download'] | HTMLAnchorElement['hreflang'] | HTMLAnchorElement['ping'] | HTMLAnchorElement['referrerPolicy'] | HTMLAnchorElement['rel'] | HTMLAnchorElement['target'] | HTMLAnchorElement['type'];\n\n export interface TabProps {\n /**\n * The tab identifier\n */\n value: string;\n\n /**\n * Router link `to` prop\n */\n to?: RouteLocationRaw;\n\n /**\n * Anchor tag href. Used for navigating to non-vue pages, such as Django pages in marketplace.\n */\n href?: string;\n\n /**\n * The badge's content\n */\n badge?: string | number;\n\n /**\n * Will render a plain text item if true.\n */\n disabled?: boolean\n\n /**\n * Props for the `<a>` element when the `href` prop is used\n */\n anchorProps?: Record<AnchorAttrs, string>;\n\n /**\n * Props for the `<RouterLink>` element when the `to` prop is used\n */\n routerLinkProps?: Omit<RouterLinkProps, 'to'>;\n }\n\n const props = defineProps<TabProps>();\n\n const tabsInjection = inject(TABS_INJECTION.key);\n\n if (!tabsInjection) {\n throw Error('The Tab component must be a child of the Tabs component.');\n }\n\n const { setActiveTab, activeTab, variant } = tabsInjection;\n\n const isTabActive = computed(() => {\n return props.value === activeTab.value;\n });\n\n const is = computed(() => {\n if (props.to) {\n return 'router-link';\n }\n\n if (props.href) {\n return 'a';\n }\n\n return 'button';\n });\n\n /**\n * Note: this click handler gets ignored when the `href` prop is used; `preventDefault()` is intentionally omitted in order to enable the `href` prop to work correctly. The `href` prop is used for navigation to non-vue pages, such as Django pages in marketplace.\n */\n function onClick(tabValue: string) {\n if (props.disabled) {\n return;\n }\n\n setActiveTab(tabValue);\n }\n\n const panelId = computed(() => `tabpanel-${props.value}`);\n\n onMounted(async () => {\n await nextTick();\n\n if (process.env.NODE_ENV !== 'test' && isTabActive.value && !document.getElementById(panelId.value)) {\n // The following warning ensures optimal accessibility is maintained when using the Tabs component. See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role#example\n logger.warn(`The <Tab> with value \"${props.value}\" is active, but its corresponding tab panel cannot be found. Please ensure that the corresponding tab panel has an \"id\" attribute with value \"${panelId.value}\" and a \"role\" attribute with value \"tabpanel\".`);\n }\n });\n\n const dynamicComponentAttrs = computed(() => {\n if (props.to && props.routerLinkProps) {\n return toRefs(props.routerLinkProps);\n }\n\n if (props.href && props.anchorProps) {\n return toRefs(props.anchorProps);\n }\n\n return {};\n });\n</script>\n\n<template>\n <li\n :id=\"`tab-${props.value}`\"\n role=\"tab\"\n :aria-selected=\"isTabActive\"\n :aria-controls=\"panelId\"\n :aria-disabled=\"props.disabled\"\n class=\"stash-tab\"\n :class=\"[\n {\n 'stash-tab--active is-active': isTabActive,\n 'stash-tab--disabled': props.disabled,\n 'stash-tab--variant-line': variant === 'line',\n 'stash-tab--variant-enclosed': variant === 'enclosed',\n },\n ]\"\n @click=\"onClick(props.value)\"\n @keypress.enter=\"onClick(props.value)\"\n >\n <component\n v-bind=\"dynamicComponentAttrs\"\n :is=\"is\"\n :to=\"props.to\"\n :href=\"props.href\"\n class=\"\n tw-flex\n tw-cursor-pointer\n tw-items-center\n tw-justify-center\n tw-whitespace-nowrap\n tw-border-solid\n tw-py-1.5\n tw-text-sm\n tw-font-medium\n hover:tw-no-underline\n \"\n :class=\"[\n {\n 'tw-border-b-2': variant === 'line',\n 'tw-border-t-4 tw-px-6': variant === 'enclosed',\n 'tw-rounded-t tw-bg-white': isTabActive && variant === 'enclosed',\n 'focus:tw-no-underline': props.href,\n 'tw-pointer-events-none tw-text-ice-500': props.disabled,\n 'tw-text-ice-700': !props.disabled && !isTabActive,\n },\n [\n isTabActive\n ? 'tw-border-blue-500 tw-text-blue-500'\n : 'tw-border-transparent hover:tw-text-blue-500 focus:tw-text-blue-500',\n ],\n ]\"\n :tabindex=\"props.disabled ? -1 : 0\"\n >\n <!-- The margin-top on the <div> below is necessary to fix the vertical alignment of text in the default slot since our Sofia font has extra space under the baseline -->\n <div class=\"tw-mt-0.5\">\n <Badge :content=\"props.badge\" position=\"inline\" color=\"red\" :is-disabled=\"props.disabled\">\n <slot :is-active=\"isTabActive\" :is-disabled=\"props.disabled\" :variant=\"variant\"></slot>\n </Badge>\n </div>\n </component>\n </li>\n</template>\n"],"names":["tabsInjection","inject","TABS_INJECTION","setActiveTab","activeTab","variant","isTabActive","computed","props","is","onClick","tabValue","panelId","onMounted","nextTick","logger","dynamicComponentAttrs","toRefs"],"mappings":";;;;;;;;;;;;;;;;iBAoDQA,IAAgBC,EAAOC,EAAe,GAAG;AAE/C,QAAI,CAACF;AACH,YAAM,MAAM,0DAA0D;AAGxE,UAAM,EAAE,cAAAG,GAAc,WAAAC,GAAW,SAAAC,EAAA,IAAYL,GAEvCM,IAAcC,EAAS,MACpBC,EAAM,UAAUJ,EAAU,KAClC,GAEKK,IAAKF,EAAS,MACdC,EAAM,KACD,gBAGLA,EAAM,OACD,MAGF,QACR;AAKD,aAASE,EAAQC,GAAkB;AACjC,MAAIH,EAAM,YAIVL,EAAaQ,CAAQ;AAAA,IACvB;AAEA,UAAMC,IAAUL,EAAS,MAAM,YAAYC,EAAM,KAAK,EAAE;AAExD,IAAAK,EAAU,YAAY;AACpB,YAAMC,EAAS,GAEX,QAAQ,IAAI,aAAa,UAAUR,EAAY,SAAS,CAAC,SAAS,eAAeM,EAAQ,KAAK,KAEhGG,EAAO,KAAK,yBAAyBP,EAAM,KAAK,kJAAkJI,EAAQ,KAAK,iDAAiD;AAAA,IAClQ,CACD;AAEK,UAAAI,IAAwBT,EAAS,MACjCC,EAAM,MAAMA,EAAM,kBACbS,EAAOT,EAAM,eAAe,IAGjCA,EAAM,QAAQA,EAAM,cACfS,EAAOT,EAAM,WAAW,IAG1B,EACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Table.js
CHANGED
|
@@ -3,28 +3,28 @@ import "lodash-es/cloneDeep";
|
|
|
3
3
|
import { M as v } from "./Module.keys-2cc7d830.js";
|
|
4
4
|
import "lodash-es/uniqueId";
|
|
5
5
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
6
|
-
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-
|
|
6
|
+
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js";
|
|
7
7
|
import { D as g } from "./DataView.vue_used_vue_type_style_index_0_lang.module-d878ca9a.js";
|
|
8
8
|
import N from "./EmptyState.js";
|
|
9
9
|
import D from "./Loading.js";
|
|
10
10
|
import h from "./TableCell.js";
|
|
11
11
|
import E from "./TableRow.js";
|
|
12
|
-
import { T as I } from "./Table.keys-
|
|
12
|
+
import { T as I } from "./Table.keys-cf93df19.js";
|
|
13
13
|
import { S as V } from "./misc-d0eec261.js";
|
|
14
14
|
import "./locale.js";
|
|
15
15
|
import "lodash-es/get";
|
|
16
16
|
import "./EmptyState.vue_used_vue_type_style_index_0_lang.module-f5d89366.js";
|
|
17
17
|
import "./_plugin-vue_export-helper-dad06003.js";
|
|
18
|
-
import "./Loading.
|
|
18
|
+
import "./Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js";
|
|
19
19
|
import "@leaflink/snitch";
|
|
20
|
-
import "./Checkbox.
|
|
21
|
-
import "./Button.vue_used_vue_type_style_index_0_lang.module-
|
|
20
|
+
import "./Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js";
|
|
21
|
+
import "./Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js";
|
|
22
22
|
import "./Checkbox.js";
|
|
23
23
|
import "./ChevronToggle.vue_vue_type_script_setup_true_lang-1591294c.js";
|
|
24
24
|
import "./Button.js";
|
|
25
25
|
import "./Icon.js";
|
|
26
26
|
import "./index-79ce320f.js";
|
|
27
|
-
import "./Expand.vue_vue_type_script_setup_true_lang-
|
|
27
|
+
import "./Expand.vue_vue_type_script_setup_true_lang-1751f4a6.js";
|
|
28
28
|
var A = /* @__PURE__ */ ((e) => (e.Scroll = "scroll", e.Stack = "stack", e))(A || {}), O = /* @__PURE__ */ ((e) => (e.None = "none", e.Rounded = "rounded", e.RoundedBottom = "rounded-bottom", e))(O || {});
|
|
29
29
|
const J = { class: "tw-relative tw-min-w-full tw-max-w-initial tw-border-separate" }, ut = /* @__PURE__ */ T({
|
|
30
30
|
__name: "Table",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const o = "_root_9c99g_2", t = {
|
|
2
|
+
root: o,
|
|
3
|
+
"layout--scroll": "_layout--scroll_9c99g_6",
|
|
4
|
+
"has-actions": "_has-actions_9c99g_12",
|
|
5
|
+
"layout--stack": "_layout--stack_9c99g_16",
|
|
6
|
+
"is-control": "_is-control_9c99g_28",
|
|
7
|
+
"root--density-comfortable": "_root--density-comfortable_9c99g_52"
|
|
8
|
+
}, _ = "_root_ngiw1_2", n = {
|
|
9
|
+
root: _,
|
|
10
|
+
"is-expandable": "_is-expandable_ngiw1_9",
|
|
11
|
+
"root--hidden-divider": "_root--hidden-divider_ngiw1_14",
|
|
12
|
+
"is-expanded": "_is-expanded_ngiw1_14",
|
|
13
|
+
"layout--scroll": "_layout--scroll_ngiw1_22",
|
|
14
|
+
"layout--stack": "_layout--stack_ngiw1_36",
|
|
15
|
+
"row-selection-checkbox": "_row-selection-checkbox_ngiw1_56",
|
|
16
|
+
"row-control-cell": "_row-control-cell_ngiw1_62",
|
|
17
|
+
"row-expansion-content": "_row-expansion-content_ngiw1_73",
|
|
18
|
+
"row-expansion": "_row-expansion_ngiw1_73"
|
|
19
|
+
}, c = Object.freeze({
|
|
20
|
+
key: Symbol("TABLE_INJECTION_KEY")
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
c as T,
|
|
24
|
+
n as a,
|
|
25
|
+
t as s
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=Table.keys-cf93df19.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.keys-
|
|
1
|
+
{"version":3,"file":"Table.keys-cf93df19.js","sources":["../src/components/Table/Table.keys.ts"],"sourcesContent":["import { Injection } from '../../../types/utils';\nimport { TableInjection } from './Table.types';\n\nexport const TABLE_INJECTION: Injection<TableInjection> = Object.freeze({\n key: Symbol('TABLE_INJECTION_KEY'),\n});\n"],"names":["TABLE_INJECTION"],"mappings":";;;;;;;;;;;;;;;;;;GAGaA,IAA6C,OAAO,OAAO;AAAA,EACtE,KAAK,OAAO,qBAAqB;AACnC,CAAC;"}
|
package/dist/TableCell.js
CHANGED
|
@@ -2,15 +2,15 @@ import { defineComponent as p, useCssModule as d, inject as u, openBlock as a, c
|
|
|
2
2
|
import "lodash-es/cloneDeep";
|
|
3
3
|
import "lodash-es/uniqueId";
|
|
4
4
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
5
|
-
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-
|
|
5
|
+
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js";
|
|
6
6
|
import "./DataView.vue_used_vue_type_style_index_0_lang.module-d878ca9a.js";
|
|
7
7
|
import "lodash-es/get";
|
|
8
8
|
import "./EmptyState.vue_used_vue_type_style_index_0_lang.module-f5d89366.js";
|
|
9
|
-
import "./Loading.
|
|
10
|
-
import { T as y, s as C } from "./Table.keys-
|
|
9
|
+
import "./Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js";
|
|
10
|
+
import { T as y, s as C } from "./Table.keys-cf93df19.js";
|
|
11
11
|
import "@leaflink/snitch";
|
|
12
|
-
import "./Checkbox.
|
|
13
|
-
import "./Button.vue_used_vue_type_style_index_0_lang.module-
|
|
12
|
+
import "./Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js";
|
|
13
|
+
import "./Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js";
|
|
14
14
|
import { _ as h } from "./_plugin-vue_export-helper-dad06003.js";
|
|
15
15
|
const T = {
|
|
16
16
|
key: 0,
|
package/dist/TableCell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.js","sources":["../src/components/TableCell/TableCell.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { TABLE_INJECTION } from '../Table/Table.vue';\n\n export interface TableCellProps {\n /**\n * If true, displays the cell as a control (vs data) cell without a background color on mobile when Table is in the stacked layout\n */\n isControl?: boolean;\n /**\n * If true, displays the header inside the cell on mobile and tablet screens when Table is in the stacked layout\n */\n mobileHeader?: string;\n }\n\n const props = withDefaults(defineProps<TableCellProps>(), {\n isControl: false,\n mobileHeader: '',\n });\n const classes = useCssModule();\n\n const tableInjection = inject(TABLE_INJECTION.key);\n if (!tableInjection) {\n throw new Error('TableCell must be used within a Table component');\n }\n\n const { density, hasActions, layout } = tableInjection;\n</script>\n\n<template>\n <td\n class=\"stash-table-cell\"\n data-test=\"stash-table-cell\"\n :class=\"[\n classes.root,\n classes[`layout--${layout}`],\n {\n [classes['root--density-compact']]: density === 'compact',\n [classes['root--density-comfortable']]: density === 'comfortable',\n [classes['has-actions']]: hasActions,\n 'tw-p-3': layout === 'scroll',\n 'tw-p-1.5': layout === 'stack',\n 'lg:tw-p-3': density === 'compact',\n 'lg:tw-px-3 lg:tw-py-6': density === 'comfortable',\n [classes['is-control']]: props.isControl,\n },\n ]\"\n >\n <div v-if=\"props.mobileHeader && layout === 'stack'\" class=\"tw-text-xs tw-font-medium tw-text-ice-900 lg:tw-hidden\">\n {{ props.mobileHeader }}\n </div>\n <!-- @slot default -->\n <slot></slot>\n </td>\n</template>\n\n<style module>\n .root {\n border: 0;\n }\n\n .layout--scroll {\n background-color: var(--color-white);\n border: none;\n border-bottom: 1px solid var(--color-ice-200);\n }\n\n .layout--scroll.has-actions:last-of-type {\n text-align: center;\n }\n\n .layout--stack {\n background-color: var(--color-ice-100);\n border-radius:
|
|
1
|
+
{"version":3,"file":"TableCell.js","sources":["../src/components/TableCell/TableCell.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { TABLE_INJECTION } from '../Table/Table.vue';\n\n export interface TableCellProps {\n /**\n * If true, displays the cell as a control (vs data) cell without a background color on mobile when Table is in the stacked layout\n */\n isControl?: boolean;\n /**\n * If true, displays the header inside the cell on mobile and tablet screens when Table is in the stacked layout\n */\n mobileHeader?: string;\n }\n\n const props = withDefaults(defineProps<TableCellProps>(), {\n isControl: false,\n mobileHeader: '',\n });\n const classes = useCssModule();\n\n const tableInjection = inject(TABLE_INJECTION.key);\n if (!tableInjection) {\n throw new Error('TableCell must be used within a Table component');\n }\n\n const { density, hasActions, layout } = tableInjection;\n</script>\n\n<template>\n <td\n class=\"stash-table-cell\"\n data-test=\"stash-table-cell\"\n :class=\"[\n classes.root,\n classes[`layout--${layout}`],\n {\n [classes['root--density-compact']]: density === 'compact',\n [classes['root--density-comfortable']]: density === 'comfortable',\n [classes['has-actions']]: hasActions,\n 'tw-p-3': layout === 'scroll',\n 'tw-p-1.5': layout === 'stack',\n 'lg:tw-p-3': density === 'compact',\n 'lg:tw-px-3 lg:tw-py-6': density === 'comfortable',\n [classes['is-control']]: props.isControl,\n },\n ]\"\n >\n <div v-if=\"props.mobileHeader && layout === 'stack'\" class=\"tw-text-xs tw-font-medium tw-text-ice-900 lg:tw-hidden\">\n {{ props.mobileHeader }}\n </div>\n <!-- @slot default -->\n <slot></slot>\n </td>\n</template>\n\n<style module>\n .root {\n border: 0;\n }\n\n .layout--scroll {\n background-color: var(--color-white);\n border: none;\n border-bottom: 1px solid var(--color-ice-200);\n }\n\n .layout--scroll.has-actions:last-of-type {\n text-align: center;\n }\n\n .layout--stack {\n background-color: var(--color-ice-100);\n border-radius: theme('borderRadius.DEFAULT');\n }\n\n .layout--stack.has-actions:last-of-type {\n background-color: transparent;\n position: absolute;\n right: 0;\n top: 0;\n }\n\n .layout--stack.is-control {\n background-color: transparent;\n }\n\n /* On large screens, layout--stack should match layout--scroll */\n @media screen('lg') {\n .layout--stack {\n background-color: var(--color-white);\n border-bottom: 1px solid var(--color-ice-200);\n border-radius: initial;\n }\n\n .layout--stack.has-actions:last-of-type {\n background-color: var(--color-white);\n position: initial;\n right: initial;\n text-align: center;\n top: initial;\n }\n\n .layout--stack.is-control {\n background-color: var(--color-white);\n }\n\n .root--density-comfortable:last-of-type:not(.has-actions) {\n padding-right: 24px;\n }\n\n .root--density-comfortable:first-of-type:not(:global(.stash-table-header-row__selection-cell), :global(.stash-table-row__selection-cell), :global(.stash-table-row__toggle-expansion-cell)) {\n padding-left: 24px;\n }\n }\n</style>\n"],"names":["classes","useCssModule","tableInjection","inject","TABLE_INJECTION","density","hasActions","layout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;iBAoBQA,IAAUC,KAEVC,IAAiBC,EAAOC,EAAgB,GAAG;AACjD,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,iDAAiD;AAGnE,UAAM,EAAE,SAAAG,GAAS,YAAAC,GAAY,QAAAC,EAAA,IAAWL;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/TableHeaderCell.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { defineComponent as k, useCssModule as T, inject as
|
|
1
|
+
import { defineComponent as k, useCssModule as T, inject as u, computed as p, openBlock as r, createElementBlock as _, normalizeClass as s, unref as t, createElementVNode as x, renderSlot as E, createBlock as w, createCommentVNode as n } from "vue";
|
|
2
2
|
import "lodash-es/cloneDeep";
|
|
3
3
|
import f from "./Icon.js";
|
|
4
|
-
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-
|
|
4
|
+
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js";
|
|
5
5
|
import { D as b } from "./DataView.vue_used_vue_type_style_index_0_lang.module-d878ca9a.js";
|
|
6
6
|
import "lodash-es/get";
|
|
7
7
|
import "./EmptyState.vue_used_vue_type_style_index_0_lang.module-f5d89366.js";
|
|
8
|
-
import "./Loading.
|
|
9
|
-
import { T as
|
|
8
|
+
import "./Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js";
|
|
9
|
+
import { T as N } from "./Table.keys-cf93df19.js";
|
|
10
10
|
import "lodash-es/uniqueId";
|
|
11
11
|
import "@leaflink/snitch";
|
|
12
|
-
import "./Checkbox.
|
|
13
|
-
import "./Button.vue_used_vue_type_style_index_0_lang.module-
|
|
14
|
-
import { _ as
|
|
12
|
+
import "./Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js";
|
|
13
|
+
import "./Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js";
|
|
14
|
+
import { _ as S } from "./_plugin-vue_export-helper-dad06003.js";
|
|
15
15
|
import "./index-79ce320f.js";
|
|
16
16
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
17
|
-
const
|
|
17
|
+
const A = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "tw-relative tw-h-4 tw-w-3"
|
|
20
|
-
},
|
|
20
|
+
}, B = /* @__PURE__ */ k({
|
|
21
21
|
__name: "TableHeaderCell",
|
|
22
22
|
props: {
|
|
23
23
|
sortId: { default: "" }
|
|
24
24
|
},
|
|
25
25
|
setup(h) {
|
|
26
|
-
const a = h, e = T(),
|
|
27
|
-
if (!
|
|
26
|
+
const a = h, e = T(), l = u(N.key);
|
|
27
|
+
if (!l)
|
|
28
28
|
throw new Error("TableHeaderCell must be used within a Table component");
|
|
29
|
-
const { density: i, hasActions: y } =
|
|
29
|
+
const { density: i, hasActions: y } = l, { currentSortId: v, currentSortOrder: d, updateCurrentSort: m } = u(
|
|
30
30
|
b.key,
|
|
31
31
|
b.defaults
|
|
32
|
-
), c =
|
|
32
|
+
), c = p(() => !!a.sortId), o = p(() => v.value === a.sortId);
|
|
33
33
|
function C() {
|
|
34
|
-
c.value && typeof
|
|
34
|
+
c.value && typeof m == "function" && m(a.sortId, { shouldEmit: !0 });
|
|
35
35
|
}
|
|
36
|
-
return (I,
|
|
36
|
+
return (I, O) => (r(), _("th", {
|
|
37
37
|
class: s(["stash-table-header-cell tw-border-b tw-border-r tw-border-ice-200 tw-p-3 tw-text-xs tw-font-medium tw-text-ice-900", [
|
|
38
38
|
t(e).root,
|
|
39
39
|
{
|
|
@@ -52,36 +52,36 @@ const S = {
|
|
|
52
52
|
class: s(["tw-flex tw-justify-between", t(e)["content-wrapper"]])
|
|
53
53
|
}, [
|
|
54
54
|
E(I.$slots, "default"),
|
|
55
|
-
c.value ? (r(), _("div",
|
|
56
|
-
!o.value || t(
|
|
55
|
+
c.value ? (r(), _("div", A, [
|
|
56
|
+
!o.value || t(d) === "asc" ? (r(), w(f, {
|
|
57
57
|
key: 0,
|
|
58
58
|
class: s(["tw-absolute tw-text-ice-700", [t(e).caret, t(e)["caret-up"]]]),
|
|
59
59
|
"data-test": "icon|caret-up",
|
|
60
60
|
name: "caret-up",
|
|
61
61
|
size: "dense"
|
|
62
|
-
}, null, 8, ["class"])) :
|
|
63
|
-
!o.value || t(
|
|
62
|
+
}, null, 8, ["class"])) : n("", !0),
|
|
63
|
+
!o.value || t(d) === "desc" ? (r(), w(f, {
|
|
64
64
|
key: 1,
|
|
65
65
|
class: s(["tw-absolute tw-text-ice-700", [t(e).caret, t(e)["caret-down"]]]),
|
|
66
66
|
"data-test": "icon|caret-down",
|
|
67
67
|
name: "caret-down",
|
|
68
68
|
size: "dense"
|
|
69
|
-
}, null, 8, ["class"])) :
|
|
70
|
-
])) :
|
|
69
|
+
}, null, 8, ["class"])) : n("", !0)
|
|
70
|
+
])) : n("", !0)
|
|
71
71
|
], 2)
|
|
72
72
|
], 2));
|
|
73
73
|
}
|
|
74
|
-
}),
|
|
75
|
-
root:
|
|
76
|
-
"has-actions": "_has-
|
|
77
|
-
"content-wrapper": "_content-
|
|
78
|
-
"caret-up": "_caret-
|
|
79
|
-
"caret-down": "_caret-
|
|
80
|
-
caret:
|
|
81
|
-
"root--density-comfortable": "_root--density-
|
|
82
|
-
},
|
|
83
|
-
$style:
|
|
84
|
-
}, Y = /* @__PURE__ */
|
|
74
|
+
}), j = "_root_rrm9i_2", z = "_caret_rrm9i_18", H = {
|
|
75
|
+
root: j,
|
|
76
|
+
"has-actions": "_has-actions_rrm9i_14",
|
|
77
|
+
"content-wrapper": "_content-wrapper_rrm9i_14",
|
|
78
|
+
"caret-up": "_caret-up_rrm9i_18",
|
|
79
|
+
"caret-down": "_caret-down_rrm9i_22",
|
|
80
|
+
caret: z,
|
|
81
|
+
"root--density-comfortable": "_root--density-comfortable_rrm9i_31"
|
|
82
|
+
}, M = {
|
|
83
|
+
$style: H
|
|
84
|
+
}, Y = /* @__PURE__ */ S(B, [["__cssModules", M]]);
|
|
85
85
|
export {
|
|
86
86
|
Y as default
|
|
87
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeaderCell.js","sources":["../src/components/TableHeaderCell/TableHeaderCell.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, inject, useCssModule } from 'vue';\n\n import { DATA_VIEW_INJECTION, SortValueDeserialized } from '../DataView/DataView.vue';\n import Icon from '../Icon/Icon.vue';\n import { TABLE_INJECTION } from '../Table/Table.vue';\n\n export interface TableHeaderCellProps {\n /**\n * A unique value correlated to the data in this header's column (without a leading hyphen/dash).\n * For example: `'product_name'` (with no leading dash/hyphen).\n */\n sortId?: SortValueDeserialized['id'];\n }\n\n const props = withDefaults(defineProps<TableHeaderCellProps>(), {\n sortId: '',\n });\n const classes = useCssModule();\n\n const tableInjection = inject(TABLE_INJECTION.key);\n if (!tableInjection) {\n throw new Error('TableHeaderCell must be used within a Table component');\n }\n\n const { density, hasActions } = tableInjection;\n\n // #region sorting\n const { currentSortId, currentSortOrder, updateCurrentSort } = inject(\n DATA_VIEW_INJECTION.key,\n DATA_VIEW_INJECTION.defaults,\n );\n const isSortable = computed(() => !!props.sortId);\n const isActiveSort = computed(() => currentSortId.value === props.sortId);\n\n function onRootClick() {\n if (isSortable.value && typeof updateCurrentSort === 'function') {\n updateCurrentSort(props.sortId, { shouldEmit: true });\n }\n }\n // #endregion sorting\n</script>\n\n<template>\n <th\n class=\"\n stash-table-header-cell\n tw-border-b tw-border-r tw-border-ice-200 tw-p-3 tw-text-xs tw-font-medium tw-text-ice-900\n \"\n :class=\"[\n classes.root,\n {\n 'tw-bg-white': !isActiveSort,\n 'stash-table-header-cell--sorted tw-bg-blue-100': isActiveSort,\n [classes['root--density-compact']]: density === 'compact',\n [classes['root--density-comfortable']]: density === 'comfortable',\n [classes['has-actions']]: hasActions,\n 'tw-cursor-pointer': isSortable,\n },\n ]\"\n data-test=\"stash-table-header-cell\"\n @click=\"onRootClick\"\n >\n <div class=\"tw-flex tw-justify-between\" :class=\"classes['content-wrapper']\">\n <!-- @slot default -->\n <slot></slot>\n <div v-if=\"isSortable\" class=\"tw-relative tw-h-4 tw-w-3\">\n <Icon\n v-if=\"!isActiveSort || currentSortOrder === 'asc'\"\n class=\"tw-absolute tw-text-ice-700\"\n :class=\"[classes.caret, classes['caret-up']]\"\n data-test=\"icon|caret-up\"\n name=\"caret-up\"\n size=\"dense\"\n />\n <Icon\n v-if=\"!isActiveSort || currentSortOrder === 'desc'\"\n class=\"tw-absolute tw-text-ice-700\"\n :class=\"[classes.caret, classes['caret-down']]\"\n data-test=\"icon|caret-down\"\n name=\"caret-down\"\n size=\"dense\"\n />\n </div>\n </div>\n </th>\n</template>\n\n<style module>\n .root {\n border-left: none;\n border-top: none;\n position: sticky;\n top: 0;\n z-index: 1;\n }\n\n .root:last-of-type {\n border-right: 0;\n }\n\n .has-actions:last-of-type .content-wrapper {\n justify-content: flex-end !important;\n }\n\n .caret-up {\n top: -5px;\n }\n\n .caret-down {\n top: 2px;\n }\n\n :global(.stash-table-header-cell--sorted) .caret {\n top: -2px; /* vertically center the caret icon */\n }\n\n @media screen
|
|
1
|
+
{"version":3,"file":"TableHeaderCell.js","sources":["../src/components/TableHeaderCell/TableHeaderCell.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, inject, useCssModule } from 'vue';\n\n import { DATA_VIEW_INJECTION, SortValueDeserialized } from '../DataView/DataView.vue';\n import Icon from '../Icon/Icon.vue';\n import { TABLE_INJECTION } from '../Table/Table.vue';\n\n export interface TableHeaderCellProps {\n /**\n * A unique value correlated to the data in this header's column (without a leading hyphen/dash).\n * For example: `'product_name'` (with no leading dash/hyphen).\n */\n sortId?: SortValueDeserialized['id'];\n }\n\n const props = withDefaults(defineProps<TableHeaderCellProps>(), {\n sortId: '',\n });\n const classes = useCssModule();\n\n const tableInjection = inject(TABLE_INJECTION.key);\n if (!tableInjection) {\n throw new Error('TableHeaderCell must be used within a Table component');\n }\n\n const { density, hasActions } = tableInjection;\n\n // #region sorting\n const { currentSortId, currentSortOrder, updateCurrentSort } = inject(\n DATA_VIEW_INJECTION.key,\n DATA_VIEW_INJECTION.defaults,\n );\n const isSortable = computed(() => !!props.sortId);\n const isActiveSort = computed(() => currentSortId.value === props.sortId);\n\n function onRootClick() {\n if (isSortable.value && typeof updateCurrentSort === 'function') {\n updateCurrentSort(props.sortId, { shouldEmit: true });\n }\n }\n // #endregion sorting\n</script>\n\n<template>\n <th\n class=\"\n stash-table-header-cell\n tw-border-b tw-border-r tw-border-ice-200 tw-p-3 tw-text-xs tw-font-medium tw-text-ice-900\n \"\n :class=\"[\n classes.root,\n {\n 'tw-bg-white': !isActiveSort,\n 'stash-table-header-cell--sorted tw-bg-blue-100': isActiveSort,\n [classes['root--density-compact']]: density === 'compact',\n [classes['root--density-comfortable']]: density === 'comfortable',\n [classes['has-actions']]: hasActions,\n 'tw-cursor-pointer': isSortable,\n },\n ]\"\n data-test=\"stash-table-header-cell\"\n @click=\"onRootClick\"\n >\n <div class=\"tw-flex tw-justify-between\" :class=\"classes['content-wrapper']\">\n <!-- @slot default -->\n <slot></slot>\n <div v-if=\"isSortable\" class=\"tw-relative tw-h-4 tw-w-3\">\n <Icon\n v-if=\"!isActiveSort || currentSortOrder === 'asc'\"\n class=\"tw-absolute tw-text-ice-700\"\n :class=\"[classes.caret, classes['caret-up']]\"\n data-test=\"icon|caret-up\"\n name=\"caret-up\"\n size=\"dense\"\n />\n <Icon\n v-if=\"!isActiveSort || currentSortOrder === 'desc'\"\n class=\"tw-absolute tw-text-ice-700\"\n :class=\"[classes.caret, classes['caret-down']]\"\n data-test=\"icon|caret-down\"\n name=\"caret-down\"\n size=\"dense\"\n />\n </div>\n </div>\n </th>\n</template>\n\n<style module>\n .root {\n border-left: none;\n border-top: none;\n position: sticky;\n top: 0;\n z-index: 1;\n }\n\n .root:last-of-type {\n border-right: 0;\n }\n\n .has-actions:last-of-type .content-wrapper {\n justify-content: flex-end !important;\n }\n\n .caret-up {\n top: -5px;\n }\n\n .caret-down {\n top: 2px;\n }\n\n :global(.stash-table-header-cell--sorted) .caret {\n top: -2px; /* vertically center the caret icon */\n }\n\n @media screen('lg') {\n .root--density-comfortable:last-of-type {\n padding-right: 24px;\n }\n\n .root--density-comfortable:first-of-type:not(:global(.stash-table-header-row__selection-cell), :global(.stash-table-row__selection-cell)) {\n padding-left: 24px;\n }\n }\n</style>\n"],"names":["classes","useCssModule","tableInjection","inject","TABLE_INJECTION","density","hasActions","currentSortId","currentSortOrder","updateCurrentSort","DATA_VIEW_INJECTION","isSortable","computed","props","isActiveSort","onRootClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;iBAkBQA,IAAUC,KAEVC,IAAiBC,EAAOC,EAAgB,GAAG;AACjD,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,uDAAuD;AAGnE,UAAA,EAAE,SAAAG,GAAS,YAAAC,EAAe,IAAAJ,GAG1B,EAAE,eAAAK,GAAe,kBAAAC,GAAkB,mBAAAC,EAAsB,IAAAN;AAAA,MAC7DO,EAAoB;AAAA,MACpBA,EAAoB;AAAA,IAAA,GAEhBC,IAAaC,EAAS,MAAM,CAAC,CAACC,EAAM,MAAM,GAC1CC,IAAeF,EAAS,MAAML,EAAc,UAAUM,EAAM,MAAM;AAExE,aAASE,IAAc;AACrB,MAAIJ,EAAW,SAAS,OAAOF,KAAsB,cACnDA,EAAkBI,EAAM,QAAQ,EAAE,YAAY,GAAM,CAAA;AAAA,IAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/TableHeaderRow.js
CHANGED
|
@@ -4,17 +4,17 @@ import C from "./Checkbox.js";
|
|
|
4
4
|
import "lodash-es/cloneDeep";
|
|
5
5
|
import "lodash-es/uniqueId";
|
|
6
6
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
7
|
-
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-
|
|
7
|
+
import "./Paginate.vue_used_vue_type_style_index_0_lang.module-18343da7.js";
|
|
8
8
|
import "./DataView.vue_used_vue_type_style_index_0_lang.module-d878ca9a.js";
|
|
9
9
|
import "./EmptyState.vue_used_vue_type_style_index_0_lang.module-f5d89366.js";
|
|
10
|
-
import "./Loading.
|
|
11
|
-
import { T as R } from "./Table.keys-
|
|
12
|
-
import "./Button.vue_used_vue_type_style_index_0_lang.module-
|
|
10
|
+
import "./Loading.vue_used_vue_type_style_index_0_lang.module-ef5a3bc6.js";
|
|
11
|
+
import { T as R } from "./Table.keys-cf93df19.js";
|
|
12
|
+
import "./Button.vue_used_vue_type_style_index_0_lang.module-63d31dc0.js";
|
|
13
13
|
import m from "./TableHeaderCell.js";
|
|
14
14
|
import { _ as S } from "./_plugin-vue_export-helper-dad06003.js";
|
|
15
15
|
import "lodash-es/get";
|
|
16
16
|
import "@leaflink/snitch";
|
|
17
|
-
import "./Checkbox.
|
|
17
|
+
import "./Checkbox.vue_used_vue_type_style_index_0_lang.module-fa8d9c06.js";
|
|
18
18
|
import "./Icon.js";
|
|
19
19
|
import "./index-79ce320f.js";
|
|
20
20
|
const B = {
|
|
@@ -27,13 +27,13 @@ const B = {
|
|
|
27
27
|
someRowsSelected: { type: Boolean, default: !1 }
|
|
28
28
|
},
|
|
29
29
|
emits: ["select"],
|
|
30
|
-
setup(
|
|
31
|
-
const l =
|
|
30
|
+
setup(d, { emit: p }) {
|
|
31
|
+
const l = d, a = _(R.key);
|
|
32
32
|
if (!a)
|
|
33
33
|
throw new Error("TableHeaderRow must be used within a Table component");
|
|
34
34
|
const { hasCustomExpandToggle: w, isExpandable: h, isSelectable: u } = a, c = b(0);
|
|
35
35
|
function n() {
|
|
36
|
-
|
|
36
|
+
p("select"), c.value++;
|
|
37
37
|
}
|
|
38
38
|
return (e, I) => (t(), k("tr", B, [
|
|
39
39
|
o(u) ? (t(), s(m, {
|
|
@@ -62,8 +62,8 @@ const B = {
|
|
|
62
62
|
]));
|
|
63
63
|
}
|
|
64
64
|
}), $ = {
|
|
65
|
-
"row-selection-checkbox": "_row-selection-
|
|
66
|
-
"row-control-cell": "_row-control-
|
|
65
|
+
"row-selection-checkbox": "_row-selection-checkbox_1eq6o_2",
|
|
66
|
+
"row-control-cell": "_row-control-cell_1eq6o_8"
|
|
67
67
|
}, H = {
|
|
68
68
|
$style: $
|
|
69
69
|
}, W = /* @__PURE__ */ S(E, [["__cssModules", H]]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeaderRow.js","sources":["../src/components/TableHeaderRow/TableHeaderRow.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, ref } from 'vue';\n\n import { t } from '../../locale';\n import Checkbox from '../Checkbox/Checkbox.vue';\n import { TABLE_INJECTION } from '../Table/Table.vue';\n import TableHeaderCell from '../TableHeaderCell/TableHeaderCell.vue';\n\n export interface TableHeaderRowProps {\n allRowsSelected?: boolean;\n someRowsSelected?: boolean;\n }\n\n const props = withDefaults(defineProps<TableHeaderRowProps>(), {\n allRowsSelected: false,\n someRowsSelected: false,\n });\n\n const emit =\n defineEmits<{\n (e: 'select'): void;\n }>();\n\n const tableInjection = inject(TABLE_INJECTION.key);\n\n if (!tableInjection) {\n throw new Error('TableHeaderRow must be used within a Table component');\n }\n\n const { hasCustomExpandToggle, isExpandable, isSelectable } = tableInjection;\n\n const checkboxKey = ref(0);\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</script>\n\n<template>\n <tr class=\"stash-table-header-row\" data-test=\"stash-table-header-row\">\n <TableHeaderCell\n v-if=\"isSelectable\"\n class=\"stash-table-header-row__selection-cell tw-min-w-[48px]\"\n :class=\"$style['row-control-cell']\"\n >\n <Checkbox\n :key=\"checkboxKey\"\n :class=\"$style['row-selection-checkbox']\"\n :checked=\"props.allRowsSelected\"\n :indeterminate=\"props.someRowsSelected && !props.allRowsSelected\"\n :title=\"t('ll.selectAll')\"\n @update:indeterminate=\"onSelect\"\n @update:checked=\"onSelect\"\n />\n </TableHeaderCell>\n <TableHeaderCell\n v-if=\"isExpandable && !hasCustomExpandToggle\"\n :class=\"$style['row-control-cell']\"\n data-test=\"table-row-header-expansion-cell\"\n />\n <!-- @slot default -->\n <slot></slot>\n </tr>\n</template>\n\n<style module>\n .row-selection-checkbox label {\n padding: 0;\n min-height:
|
|
1
|
+
{"version":3,"file":"TableHeaderRow.js","sources":["../src/components/TableHeaderRow/TableHeaderRow.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, ref } from 'vue';\n\n import { t } from '../../locale';\n import Checkbox from '../Checkbox/Checkbox.vue';\n import { TABLE_INJECTION } from '../Table/Table.vue';\n import TableHeaderCell from '../TableHeaderCell/TableHeaderCell.vue';\n\n export interface TableHeaderRowProps {\n allRowsSelected?: boolean;\n someRowsSelected?: boolean;\n }\n\n const props = withDefaults(defineProps<TableHeaderRowProps>(), {\n allRowsSelected: false,\n someRowsSelected: false,\n });\n\n const emit =\n defineEmits<{\n (e: 'select'): void;\n }>();\n\n const tableInjection = inject(TABLE_INJECTION.key);\n\n if (!tableInjection) {\n throw new Error('TableHeaderRow must be used within a Table component');\n }\n\n const { hasCustomExpandToggle, isExpandable, isSelectable } = tableInjection;\n\n const checkboxKey = ref(0);\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</script>\n\n<template>\n <tr class=\"stash-table-header-row\" data-test=\"stash-table-header-row\">\n <TableHeaderCell\n v-if=\"isSelectable\"\n class=\"stash-table-header-row__selection-cell tw-min-w-[48px]\"\n :class=\"$style['row-control-cell']\"\n >\n <Checkbox\n :key=\"checkboxKey\"\n :class=\"$style['row-selection-checkbox']\"\n :checked=\"props.allRowsSelected\"\n :indeterminate=\"props.someRowsSelected && !props.allRowsSelected\"\n :title=\"t('ll.selectAll')\"\n @update:indeterminate=\"onSelect\"\n @update:checked=\"onSelect\"\n />\n </TableHeaderCell>\n <TableHeaderCell\n v-if=\"isExpandable && !hasCustomExpandToggle\"\n :class=\"$style['row-control-cell']\"\n data-test=\"table-row-header-expansion-cell\"\n />\n <!-- @slot default -->\n <slot></slot>\n </tr>\n</template>\n\n<style module>\n .row-selection-checkbox label {\n padding: 0;\n min-height: theme('spacing.6');\n vertical-align: middle;\n }\n\n .row-control-cell {\n border-right: 0;\n }\n</style>\n"],"names":["tableInjection","inject","TABLE_INJECTION","hasCustomExpandToggle","isExpandable","isSelectable","checkboxKey","ref","onSelect","emit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBQA,IAAiBC,EAAOC,EAAgB,GAAG;AAEjD,QAAI,CAACF;AACG,YAAA,IAAI,MAAM,sDAAsD;AAGxE,UAAM,EAAE,uBAAAG,GAAuB,cAAAC,GAAc,cAAAC,EAAA,IAAiBL,GAExDM,IAAcC,EAAI,CAAC;AAEzB,aAASC,IAAW;AAClB,MAAAC,EAAK,QAAQ,GAODH,EAAA;AAAA,IACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|