@sparklingopinions/sparkling-ui 0.4.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/aliases.d.ts +176 -26
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/Avatar.vue.d.ts +3 -2
- package/dist/components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js +20 -14
- package/dist/components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Board/Board.js.map +1 -1
- package/dist/components/Board/Board.vue.d.ts +6 -2
- package/dist/components/Board/Board.vue_vue_type_script_setup_true_lang.js +142 -74
- package/dist/components/Board/Board.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/components/Button/Button.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +7 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/components/ContextMenu/ContextMenu.vue.d.ts +44 -0
- package/dist/components/ContextMenu/ContextMenu.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/components/ContextMenu/ContextMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/DataList/DataList.js.map +1 -1
- package/dist/components/DataList/DataList.vue.d.ts +8 -0
- package/dist/components/DataList/DataList.vue_vue_type_script_setup_true_lang.js +71 -52
- package/dist/components/DataList/DataList.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/DataList/types.d.ts +5 -1
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/Dialog.vue.d.ts +22 -6
- package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js +174 -72
- package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Dialog/useSheetDrag.d.ts +16 -0
- package/dist/components/Dialog/useSheetDrag.js +37 -0
- package/dist/components/Dialog/useSheetDrag.js.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.vue.d.ts +6 -30
- package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js +54 -74
- package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.vue.d.ts +9 -3
- package/dist/components/EmptyState/EmptyState.vue_vue_type_script_setup_true_lang.js +35 -7
- package/dist/components/EmptyState/EmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/FilterChip.js.map +1 -1
- package/dist/components/Filters/FilterChip.vue.d.ts +4 -1
- package/dist/components/Filters/FilterChip.vue_vue_type_script_setup_true_lang.js +29 -24
- package/dist/components/Filters/FilterChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/FilterMenu.js.map +1 -1
- package/dist/components/Filters/FilterMenu.vue.d.ts +20 -1
- package/dist/components/Filters/FilterMenu.vue_vue_type_script_setup_true_lang.js +78 -56
- package/dist/components/Filters/FilterMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/SortMenu.js.map +1 -1
- package/dist/components/Filters/SortMenu.vue.d.ts +21 -1
- package/dist/components/Filters/SortMenu.vue_vue_type_script_setup_true_lang.js +90 -66
- package/dist/components/Filters/SortMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/index.d.ts +2 -1
- package/dist/components/Filters/trigger.d.ts +17 -0
- package/dist/components/Filters/trigger.js +33 -0
- package/dist/components/Filters/trigger.js.map +1 -0
- package/dist/components/Filters/types.d.ts +8 -0
- package/dist/components/FormField/FormField.js.map +1 -1
- package/dist/components/FormField/FormField.vue.d.ts +10 -0
- package/dist/components/FormField/FormField.vue_vue_type_script_setup_true_lang.js +31 -20
- package/dist/components/FormField/FormField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Icon/iconSet.js +9 -1
- package/dist/components/Icon/iconSet.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.vue.d.ts +6 -3
- package/dist/components/SegmentedControl/SegmentedControl.vue_vue_type_script_setup_true_lang.js +20 -17
- package/dist/components/SegmentedControl/SegmentedControl.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts +1 -1
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.vue.d.ts +4 -0
- package/dist/components/Table/Table.vue_vue_type_script_setup_true_lang.js +66 -56
- package/dist/components/Table/Table.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Table/types.d.ts +2 -0
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Tag/Tag.vue.d.ts +16 -3
- package/dist/components/Tag/Tag.vue_vue_type_script_setup_true_lang.js +42 -19
- package/dist/components/Tag/Tag.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Toast/ToastMessage.js.map +1 -1
- package/dist/components/Toast/ToastMessage.vue.d.ts +13 -1
- package/dist/components/Toast/ToastMessage.vue_vue_type_script_setup_true_lang.js +58 -23
- package/dist/components/Toast/ToastMessage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Toast/Toaster.js.map +1 -1
- package/dist/components/Toast/Toaster.vue.d.ts +7 -3
- package/dist/components/Toast/Toaster.vue_vue_type_script_setup_true_lang.js +50 -21
- package/dist/components/Toast/Toaster.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/internal/MenuItemContent.js +7 -0
- package/dist/components/internal/MenuItemContent.js.map +1 -0
- package/dist/components/internal/MenuItemContent.vue.d.ts +7 -0
- package/dist/components/internal/MenuItemContent.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/components/internal/MenuItemContent.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/internal/menu.d.ts +46 -0
- package/dist/components/internal/menu.js +33 -0
- package/dist/components/internal/menu.js.map +1 -0
- package/dist/composables/toast.d.ts +20 -5
- package/dist/composables/toast.js +28 -20
- package/dist/composables/toast.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +34 -33
- package/package.json +1 -1
- package/src/styles/tailwind.css +29 -0
|
@@ -1,110 +1,90 @@
|
|
|
1
1
|
import e from "../Button/Button.js";
|
|
2
2
|
import t from "../Icon/Icon.js";
|
|
3
3
|
import n from "../Tooltip/Tooltip.js";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import r from "../internal/MenuItemContent.js";
|
|
5
|
+
import { menuConfirmDefaults as i, menuContentClass as a, menuItemClass as o, menuSeparatorClass as s, useMenuSelect as c } from "../internal/menu.js";
|
|
6
|
+
import { Fragment as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createVNode as p, defineComponent as m, mergeDefaults as h, normalizeClass as g, openBlock as _, ref as v, renderList as y, renderSlot as b, toDisplayString as x, unref as S, withCtx as C, withModifiers as w } from "vue";
|
|
7
|
+
import { DropdownMenuContent as T, DropdownMenuItem as E, DropdownMenuPortal as D, DropdownMenuRoot as O, DropdownMenuSeparator as k, DropdownMenuTrigger as A } from "reka-ui";
|
|
7
8
|
//#region src/components/DropdownMenu/DropdownMenu.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var
|
|
9
|
-
key: 1,
|
|
10
|
-
class: "text-11 text-sui-ink-muted"
|
|
11
|
-
}, k = /*@__PURE__*/ u({
|
|
9
|
+
var j = { key: 0 }, M = /*@__PURE__*/ m({
|
|
12
10
|
__name: "DropdownMenu",
|
|
13
|
-
props: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
confirmTitle: {
|
|
21
|
-
confirmMessage: {
|
|
22
|
-
confirmLabel: {
|
|
23
|
-
deleteLabel: {
|
|
24
|
-
cancelLabel: {
|
|
25
|
-
},
|
|
11
|
+
props: /*@__PURE__*/ h({
|
|
12
|
+
items: {},
|
|
13
|
+
buttonIcon: {},
|
|
14
|
+
buttonLabel: {},
|
|
15
|
+
tooltip: {},
|
|
16
|
+
align: {},
|
|
17
|
+
id: {},
|
|
18
|
+
confirmTitle: {},
|
|
19
|
+
confirmMessage: {},
|
|
20
|
+
confirmLabel: {},
|
|
21
|
+
deleteLabel: {},
|
|
22
|
+
cancelLabel: {}
|
|
23
|
+
}, {
|
|
24
|
+
...i,
|
|
25
|
+
items: () => [],
|
|
26
|
+
buttonIcon: "more-vertical",
|
|
27
|
+
buttonLabel: void 0,
|
|
28
|
+
tooltip: "More actions",
|
|
29
|
+
align: "start"
|
|
30
|
+
}),
|
|
26
31
|
emits: [
|
|
27
32
|
"click-item",
|
|
28
33
|
"show",
|
|
29
34
|
"hide"
|
|
30
35
|
],
|
|
31
|
-
setup(
|
|
32
|
-
let
|
|
33
|
-
async function P(e) {
|
|
34
|
-
if (e.confirm || e.confirmed) {
|
|
35
|
-
let t = e.variant === "danger" || e.action === "delete";
|
|
36
|
-
if (!await N({
|
|
37
|
-
title: e.confirm?.title ?? A.confirmTitle,
|
|
38
|
-
message: e.confirm?.message ?? A.confirmMessage,
|
|
39
|
-
cancelLabel: A.cancelLabel,
|
|
40
|
-
confirmLabel: e.confirm?.acceptLabel ?? (e.action === "delete" ? A.deleteLabel : A.confirmLabel),
|
|
41
|
-
confirmVariant: t ? "danger" : "primary"
|
|
42
|
-
})) return;
|
|
43
|
-
}
|
|
44
|
-
j("click-item", {
|
|
45
|
-
id: A.id,
|
|
46
|
-
...e
|
|
47
|
-
});
|
|
48
|
-
}
|
|
36
|
+
setup(i, { emit: m }) {
|
|
37
|
+
let h = i, M = m, N = v(!1), P = c(h, (e) => M("click-item", e));
|
|
49
38
|
function F(e) {
|
|
50
|
-
|
|
39
|
+
N.value = e, M(e ? "show" : "hide");
|
|
51
40
|
}
|
|
52
|
-
return (
|
|
41
|
+
return (c, m) => (_(), f("div", null, [p(S(O), {
|
|
53
42
|
modal: !1,
|
|
54
|
-
open:
|
|
43
|
+
open: N.value,
|
|
55
44
|
"onUpdate:open": F
|
|
56
45
|
}, {
|
|
57
|
-
default:
|
|
58
|
-
default:
|
|
59
|
-
disabled: !
|
|
60
|
-
text:
|
|
46
|
+
default: C(() => [p(S(A), { "as-child": "" }, {
|
|
47
|
+
default: C(() => [p(n, {
|
|
48
|
+
disabled: !i.tooltip || N.value,
|
|
49
|
+
text: i.tooltip ?? void 0
|
|
61
50
|
}, {
|
|
62
|
-
default:
|
|
63
|
-
"aria-label":
|
|
64
|
-
"icon-only": !
|
|
51
|
+
default: C(() => [b(c.$slots, "trigger", { open: N.value }, () => [p(e, {
|
|
52
|
+
"aria-label": i.buttonLabel ? void 0 : i.tooltip ?? void 0,
|
|
53
|
+
"icon-only": !i.buttonLabel,
|
|
65
54
|
size: "sm",
|
|
66
55
|
type: "button",
|
|
67
56
|
variant: "ghost",
|
|
68
|
-
onClick:
|
|
57
|
+
onClick: m[0] ||= w(() => {}, ["stop"])
|
|
69
58
|
}, {
|
|
70
|
-
default:
|
|
59
|
+
default: C(() => [i.buttonLabel ? (_(), f("span", j, x(i.buttonLabel), 1)) : d("", !0), i.buttonIcon ? (_(), u(t, {
|
|
71
60
|
key: 1,
|
|
72
61
|
color: "ink-subtle",
|
|
73
|
-
name:
|
|
74
|
-
}, null, 8, ["name"])) :
|
|
62
|
+
name: i.buttonIcon
|
|
63
|
+
}, null, 8, ["name"])) : d("", !0)]),
|
|
75
64
|
_: 1
|
|
76
65
|
}, 8, ["aria-label", "icon-only"])])]),
|
|
77
66
|
_: 3
|
|
78
67
|
}, 8, ["disabled", "text"])]),
|
|
79
68
|
_: 3
|
|
80
|
-
}),
|
|
81
|
-
default:
|
|
82
|
-
align:
|
|
83
|
-
class:
|
|
69
|
+
}), p(S(D), null, {
|
|
70
|
+
default: C(() => [p(S(T), {
|
|
71
|
+
align: i.align,
|
|
72
|
+
class: g([S(a), "min-w-[max(12rem,var(--reka-dropdown-menu-trigger-width))]"]),
|
|
84
73
|
side: "bottom"
|
|
85
74
|
}, {
|
|
86
|
-
default:
|
|
75
|
+
default: C(() => [(_(!0), f(l, null, y(i.items, (e, t) => (_(), f(l, { key: t }, [e.type === "separator" ? (_(), u(S(k), {
|
|
87
76
|
key: 0,
|
|
88
|
-
class:
|
|
89
|
-
})) : (
|
|
77
|
+
class: g(S(s))
|
|
78
|
+
}, null, 8, ["class"])) : (_(), u(S(E), {
|
|
90
79
|
key: 1,
|
|
91
|
-
class:
|
|
92
|
-
onSelect: (t) => P(e)
|
|
80
|
+
class: g(S(o)),
|
|
81
|
+
onSelect: (t) => S(P)(e)
|
|
93
82
|
}, {
|
|
94
|
-
default:
|
|
95
|
-
e.icon ? (f(), a(t, {
|
|
96
|
-
key: 0,
|
|
97
|
-
class: "h-4 w-4 shrink-0",
|
|
98
|
-
color: e.variant === "danger" ? "danger" : "ink-muted",
|
|
99
|
-
name: e.icon
|
|
100
|
-
}, null, 8, ["color", "name"])) : o("", !0),
|
|
101
|
-
c("span", D, g(e.label), 1),
|
|
102
|
-
e.shortcut ? (f(), s("span", O, g(e.shortcut), 1)) : o("", !0)
|
|
103
|
-
], 2)]),
|
|
83
|
+
default: C(() => [p(r, { item: e }, null, 8, ["item"])]),
|
|
104
84
|
_: 2
|
|
105
|
-
}, 1032, ["onSelect"]))], 64))), 128))]),
|
|
85
|
+
}, 1032, ["class", "onSelect"]))], 64))), 128))]),
|
|
106
86
|
_: 1
|
|
107
|
-
}, 8, ["align"])]),
|
|
87
|
+
}, 8, ["align", "class"])]),
|
|
108
88
|
_: 1
|
|
109
89
|
})]),
|
|
110
90
|
_: 3
|
|
@@ -112,6 +92,6 @@ var E = { key: 0 }, D = { class: "flex-1 text-13" }, O = {
|
|
|
112
92
|
}
|
|
113
93
|
});
|
|
114
94
|
//#endregion
|
|
115
|
-
export {
|
|
95
|
+
export { M as default };
|
|
116
96
|
|
|
117
97
|
//# sourceMappingURL=DropdownMenu.vue_vue_type_script_setup_true_lang.js.map
|
package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createVNode","_unref","_withCtx","Tooltip","_renderSlot","Button","_withModifiers","_toDisplayString","_createCommentVNode","_createBlock","Icon","
|
|
1
|
+
{"version":3,"file":"DropdownMenu.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createVNode","_unref","_withCtx","Tooltip","_renderSlot","Button","_withModifiers","_toDisplayString","_createCommentVNode","_createBlock","Icon","_normalizeClass","_Fragment","_renderList","MenuItemContent","Button_default","Icon_default","Tooltip_default","MenuItemContent_default","_hoisted_1","DropdownMenu_vue_vue_type_script_setup_true_lang_default","menuConfirmDefaults","__emit","props","__props","emit","open","ref","select","useMenuSelect","item","onOpenChange","value","openBlock","createElementBlock","createVNode","unref","DropdownMenuRoot","withCtx","DropdownMenuTrigger","renderSlot","_ctx","_cache","withModifiers","toDisplayString","createCommentVNode","createBlock","DropdownMenuPortal","DropdownMenuContent","normalizeClass","menuContentClass","Fragment","renderList","index","DropdownMenuSeparator","menuSeparatorClass","DropdownMenuItem","menuItemClass"],"sources":["../../../src/components/DropdownMenu/DropdownMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref } from 'vue'\n\nimport {\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuPortal,\n DropdownMenuRoot,\n DropdownMenuSeparator,\n DropdownMenuTrigger\n} from 'reka-ui'\n\nimport Button from '../Button/Button.vue'\nimport Icon from '../Icon/Icon.vue'\nimport Tooltip from '../Tooltip/Tooltip.vue'\nimport MenuItemContent from '../internal/MenuItemContent.vue'\nimport {\n type DropdownMenuAction,\n type DropdownMenuEntry,\n type MenuConfirmLabels,\n menuConfirmDefaults,\n menuContentClass,\n menuItemClass,\n menuSeparatorClass,\n useMenuSelect\n} from '../internal/menu'\n\nexport type { DropdownMenuAction, DropdownMenuEntry }\n\nexport interface DropdownMenuProps extends MenuConfirmLabels {\n items?: DropdownMenuEntry[]\n buttonIcon?: string\n /** A label beside the icon; without one the button is icon-only, named by the tooltip. */\n buttonLabel?: string\n /** The trigger's tooltip and name; null for none. */\n tooltip?: string | null\n /** Lines the menu up with the trigger's start or end edge. */\n align?: 'start' | 'end'\n}\n\nconst props = withDefaults(defineProps<DropdownMenuProps>(), {\n ...menuConfirmDefaults,\n items: () => [],\n buttonIcon: 'more-vertical',\n buttonLabel: undefined,\n tooltip: 'More actions',\n align: 'start'\n})\n\nconst emit = defineEmits<{ 'click-item': [item: DropdownMenuAction & { id?: string }]; show: []; hide: [] }>()\n\nconst open = ref(false)\nconst select = useMenuSelect(props, (item) => emit('click-item', item))\n\nfunction onOpenChange(value: boolean) {\n open.value = value\n if (value) emit('show')\n else emit('hide')\n}\n</script>\n\n<template>\n <div>\n <!-- Not modal: the page stays live (hover, scroll) while it's open. -->\n <DropdownMenuRoot :modal=\"false\" :open=\"open\" @update:open=\"onOpenChange\">\n <!-- The tooltip inside the menu's trigger: Reka's anchors attach to the nearest popper, which must be the menu's. -->\n <DropdownMenuTrigger as-child>\n <Tooltip :disabled=\"!tooltip || open\" :text=\"tooltip ?? undefined\">\n <slot name=\"trigger\" :open=\"open\">\n <Button\n :aria-label=\"buttonLabel ? undefined : (tooltip ?? undefined)\"\n :icon-only=\"!buttonLabel\"\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n @click.stop\n >\n <span v-if=\"buttonLabel\">{{ buttonLabel }}</span>\n <Icon v-if=\"buttonIcon\" color=\"ink-subtle\" :name=\"buttonIcon\" />\n </Button>\n </slot>\n </Tooltip>\n </DropdownMenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuContent\n :align=\"align\"\n :class=\"[menuContentClass, 'min-w-[max(12rem,var(--reka-dropdown-menu-trigger-width))]']\"\n side=\"bottom\"\n >\n <template v-for=\"(item, index) in items\" :key=\"index\">\n <DropdownMenuSeparator v-if=\"item.type === 'separator'\" :class=\"menuSeparatorClass\" />\n <DropdownMenuItem v-else :class=\"menuItemClass\" @select=\"select(item)\">\n <MenuItemContent :item=\"item\" />\n </DropdownMenuItem>\n </template>\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCA,IAAMyB,IAAQC,GASRC,IAAOH,GAEPI,IAAOC,EAAI,EAAK,GAChBC,IAASC,EAAcN,IAAQ,MAASE,EAAK,cAAcK,CAAI,CAAC;EAEtE,SAASC,EAAa,GAAgB;GAEpC,AADA,EAAK,QAAQC,GACFP,EAAPO,IAAY,SACN,MAAM;EAClB;E,kBAIElC,EAAA,GAAAC,EAoCM,OAAA,MAAA,CAlCJC,EAiCmBC,EAAAoC,CAAA,GAAA;GAjCA,OAAO;GAAQ,MAAMX,EAAA;GAAO,iBAAaK;;GAE1D,SAAA7B,QAgBsB,CAhBtBF,EAgBsBC,EAAAsC,CAAA,GAAA,EAhBD,YAAA,GAAQ,GAAA;IAC3B,SAAArC,QAcU,CAdVF,EAcUG,GAAA;KAdA,UAAQ,CAAGqB,EAAA,WAAWE,EAAA;KAAO,MAAMF,EAAA,WAAW,KAAA;;KACtD,SAAAtB,QAYO,CAZPE,EAYOqC,EAAA,QAAA,WAAA,EAZe,MAAMf,EAAA,MAAI,SAYzB,CAXL1B,EAUSK,GAAA;MATN,cAAYmB,EAAA,cAAc,KAAA,IAAaA,EAAA,WAAW,KAAA;MAClD,aAAS,CAAGA,EAAA;MACb,MAAK;MACL,MAAK;MACL,SAAQ;MACP,SAAK,AAAAkB,EAAA,OAAApC,QAAN,CAAA,GAAW,CAAA,MAAA,CAAA;;MAEX,SAAAJ,QAAiD,CAArCsB,EAAA,eAAZ1B,EAAA,GAAAC,EAAiD,QAAAoB,GAAAZ,EAArBiB,EAAA,WAAW,GAAA,CAAA,K,WAC3BA,EAAA,cAAZ1B,EAAA,GAAAW,EAAgEC,GAAA;;OAAxC,OAAM;OAAc,MAAMc,EAAA;;;;;;;G,IAK1DxB,EAaqBC,EAAA8C,CAAA,GAAA,MAAA;IAZnB,SAAA7C,QAWsB,CAXtBF,EAWsBC,EAAA+C,CAAA,GAAA;KAVnB,OAAOxB,EAAA;KACP,OAAKb,EAAA,CAAGV,EAAAiD,CAAA,GAAgB,4DAAA,CAAA;KACzB,MAAK;;KAEK,SAAAhD,QAA8B,EAAxCJ,EAAA,EAAA,GAAAC,EAKWa,GAAA,MAAAC,EALuBW,EAAA,QAAhB,GAAM,OAAuB1B,EAAA,GAAAC,EAAAa,GAAA,EAAA,KAAAyC,EAAK,GAAA,CACrBvB,EAAK,SAAI,eAAtChC,EAAA,GAAAW,EAAsFR,EAAAqD,CAAA,GAAA;;MAA7B,OAAK3C,EAAEV,EAAAsD,CAAA,CAAkB;K,2BAClFzD,EAAA,GAAAW,EAEmBR,EAAAuD,CAAA,GAAA;;MAFO,OAAK7C,EAAEV,EAAAwD,CAAA,CAAa;MAAG,WAAM,MAAExD,EAAA2B,CAAA,CAAM,CAACE,CAAI;;MAClE,SAAA5B,QAAgC,CAAhCF,EAAgCc,GAAA,EAAR,QAAI,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.js","names":["_sfc_main","EmptyState_vue_vue_type_script_setup_true_lang_default","EmptyState_default"],"sources":["../../../src/components/EmptyState/EmptyState.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport Button from '../Button/Button.vue'\nimport Icon from '../Icon/Icon.vue'\n\nexport interface EmptyStateProps {\n title: string\n /** Plain text; for anything richer, use the `description` slot. */\n description?: string\n /** What the list holds, as an icon name (users, inbox, search for no matches), in a tile above the title. Decorative. */\n icon?: string\n /** `accent` for a list waiting to be filled; `neutral` for no matches or a filtered view. */\n tone?: 'accent' | 'neutral'\n /** Shows a primary button with this label, which emits `action`. Or put your own in the `action` slot. */\n actionLabel?: string\n actionIcon?: string\n /** The title's heading level, to fit the page's outline. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6\n}\n\nwithDefaults(defineProps<EmptyStateProps>(), {\n description: undefined,\n icon: undefined,\n tone: 'accent',\n actionLabel: undefined,\n actionIcon: 'plus',\n headingLevel: 2\n})\n\ndefineEmits<{ action: [] }>()\n</script>\n\n<template>\n <div class=\"flex flex-col items-center justify-center px-6 py-16 text-center\">\n <div\n v-if=\"icon\"\n aria-hidden=\"true\"\n class=\"mb-4 flex size-12 items-center justify-center rounded-xl ring-1 ring-inset\"\n :class=\"tone === 'accent' ? 'bg-sui-accent-wash ring-sui-accent-line' : 'bg-sui-sunken ring-sui-line-subtle'\"\n >\n <Icon class=\"size-6\" :color=\"tone === 'accent' ? 'accent' : 'ink-muted'\" :name=\"icon\" />\n </div>\n <component :is=\"`h${headingLevel}`\" class=\"m-0 mb-1.5 text-base font-semibold text-sui-ink\">{{ title }}</component>\n <div class=\"max-w-xs text-sm leading-relaxed text-sui-ink-muted\">\n <slot name=\"description\">{{ description }}</slot>\n </div>\n <slot name=\"action\">\n <Button v-if=\"actionLabel\" class=\"mt-4\" variant=\"primary\" @click=\"$emit('action')\">\n <Icon v-if=\"actionIcon\" :name=\"actionIcon\" />\n {{ actionLabel }}\n </Button>\n </slot>\n </div>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"EmptyState.js","names":["_sfc_main","EmptyState_vue_vue_type_script_setup_true_lang_default","EmptyState_default"],"sources":["../../../src/components/EmptyState/EmptyState.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport Button from '../Button/Button.vue'\nimport Icon from '../Icon/Icon.vue'\n\nexport interface EmptyStateProps {\n title: string\n /** Plain text; for anything richer, use the `description` slot. */\n description?: string\n /** What the list holds, as an icon name (users, inbox, search for no matches), in a tile above the title. Decorative. */\n icon?: string\n /** `accent` for a list waiting to be filled; `neutral` for no matches or a filtered view. */\n tone?: 'accent' | 'neutral'\n /** Shows a primary button with this label, which emits `action`. Or put your own in the `action` slot. */\n actionLabel?: string\n actionIcon?: string\n /** The title's heading level, to fit the page's outline. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6\n /** sm, for an empty card in settings or a tray: an optional 16px icon, the title as one muted line of text (not a\n * heading), a small secondary action. No description. */\n size?: 'md' | 'sm'\n}\n\nwithDefaults(defineProps<EmptyStateProps>(), {\n description: undefined,\n icon: undefined,\n tone: 'accent',\n actionLabel: undefined,\n actionIcon: 'plus',\n headingLevel: 2,\n size: 'md'\n})\n\ndefineEmits<{ action: [] }>()\n</script>\n\n<template>\n <div v-if=\"size === 'sm'\" class=\"flex flex-col items-center justify-center gap-2 px-4 py-5 text-center\">\n <Icon v-if=\"icon\" class=\"size-4\" color=\"ink-muted\" :name=\"icon\" />\n <p class=\"m-0 max-w-full text-13 leading-5 text-sui-ink-muted\">{{ title }}</p>\n <slot name=\"action\">\n <Button v-if=\"actionLabel\" class=\"mt-1\" size=\"sm\" variant=\"secondary\" @click=\"$emit('action')\">\n <Icon v-if=\"actionIcon\" :name=\"actionIcon\" />\n {{ actionLabel }}\n </Button>\n </slot>\n </div>\n <div v-else class=\"flex flex-col items-center justify-center px-6 py-16 text-center\">\n <div\n v-if=\"icon\"\n aria-hidden=\"true\"\n class=\"mb-4 flex size-12 items-center justify-center rounded-xl ring-1 ring-inset\"\n :class=\"tone === 'accent' ? 'bg-sui-accent-wash ring-sui-accent-line' : 'bg-sui-sunken ring-sui-line-subtle'\"\n >\n <Icon class=\"size-6\" :color=\"tone === 'accent' ? 'accent' : 'ink-muted'\" :name=\"icon\" />\n </div>\n <component :is=\"`h${headingLevel}`\" class=\"m-0 mb-1.5 text-base font-semibold text-sui-ink\">{{ title }}</component>\n <div class=\"max-w-xs text-sm leading-relaxed text-sui-ink-muted\">\n <slot name=\"description\">{{ description }}</slot>\n </div>\n <slot name=\"action\">\n <Button v-if=\"actionLabel\" class=\"mt-4\" variant=\"primary\" @click=\"$emit('action')\">\n <Icon v-if=\"actionIcon\" :name=\"actionIcon\" />\n {{ actionLabel }}\n </Button>\n </slot>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -11,18 +11,24 @@ export interface EmptyStateProps {
|
|
|
11
11
|
actionIcon?: string;
|
|
12
12
|
/** The title's heading level, to fit the page's outline. */
|
|
13
13
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
14
|
+
/** sm, for an empty card in settings or a tray: an optional 16px icon, the title as one muted line of text (not a
|
|
15
|
+
* heading), a small secondary action. No description. */
|
|
16
|
+
size?: 'md' | 'sm';
|
|
14
17
|
}
|
|
15
|
-
declare var
|
|
18
|
+
declare var __VLS_6: {}, __VLS_32: {}, __VLS_34: {};
|
|
16
19
|
type __VLS_Slots = {} & {
|
|
17
|
-
|
|
20
|
+
action?: (props: typeof __VLS_6) => any;
|
|
18
21
|
} & {
|
|
19
|
-
|
|
22
|
+
description?: (props: typeof __VLS_32) => any;
|
|
23
|
+
} & {
|
|
24
|
+
action?: (props: typeof __VLS_34) => any;
|
|
20
25
|
};
|
|
21
26
|
declare const __VLS_base: import("vue").DefineComponent<EmptyStateProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
27
|
action: () => any;
|
|
23
28
|
}, string, import("vue").PublicProps, Readonly<EmptyStateProps> & Readonly<{
|
|
24
29
|
onAction?: (() => any) | undefined;
|
|
25
30
|
}>, {
|
|
31
|
+
size: "sm" | "md";
|
|
26
32
|
icon: string;
|
|
27
33
|
tone: "accent" | "neutral";
|
|
28
34
|
headingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
@@ -2,7 +2,13 @@ import e from "../Button/Button.js";
|
|
|
2
2
|
import t from "../Icon/Icon.js";
|
|
3
3
|
import { createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, openBlock as u, renderSlot as d, resolveDynamicComponent as f, toDisplayString as p, withCtx as m } from "vue";
|
|
4
4
|
//#region src/components/EmptyState/EmptyState.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var h = {
|
|
5
|
+
var h = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "flex flex-col items-center justify-center gap-2 px-4 py-5 text-center"
|
|
8
|
+
}, g = { class: "m-0 max-w-full text-13 leading-5 text-sui-ink-muted" }, _ = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "flex flex-col items-center justify-center px-6 py-16 text-center"
|
|
11
|
+
}, v = { class: "max-w-xs text-sm leading-relaxed text-sui-ink-muted" }, y = /*@__PURE__*/ c({
|
|
6
12
|
__name: "EmptyState",
|
|
7
13
|
props: {
|
|
8
14
|
title: {},
|
|
@@ -11,11 +17,33 @@ var h = { class: "flex flex-col items-center justify-center px-6 py-16 text-cent
|
|
|
11
17
|
tone: { default: "accent" },
|
|
12
18
|
actionLabel: { default: void 0 },
|
|
13
19
|
actionIcon: { default: "plus" },
|
|
14
|
-
headingLevel: { default: 2 }
|
|
20
|
+
headingLevel: { default: 2 },
|
|
21
|
+
size: { default: "md" }
|
|
15
22
|
},
|
|
16
23
|
emits: ["action"],
|
|
17
24
|
setup(c) {
|
|
18
|
-
return (
|
|
25
|
+
return (y, b) => c.size === "sm" ? (u(), i("div", h, [
|
|
26
|
+
c.icon ? (u(), n(t, {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "size-4",
|
|
29
|
+
color: "ink-muted",
|
|
30
|
+
name: c.icon
|
|
31
|
+
}, null, 8, ["name"])) : r("", !0),
|
|
32
|
+
a("p", g, p(c.title), 1),
|
|
33
|
+
d(y.$slots, "action", {}, () => [c.actionLabel ? (u(), n(e, {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "mt-1",
|
|
36
|
+
size: "sm",
|
|
37
|
+
variant: "secondary",
|
|
38
|
+
onClick: b[0] ||= (e) => y.$emit("action")
|
|
39
|
+
}, {
|
|
40
|
+
default: m(() => [c.actionIcon ? (u(), n(t, {
|
|
41
|
+
key: 0,
|
|
42
|
+
name: c.actionIcon
|
|
43
|
+
}, null, 8, ["name"])) : r("", !0), o(" " + p(c.actionLabel), 1)]),
|
|
44
|
+
_: 1
|
|
45
|
+
})) : r("", !0)])
|
|
46
|
+
])) : (u(), i("div", _, [
|
|
19
47
|
c.icon ? (u(), i("div", {
|
|
20
48
|
key: 0,
|
|
21
49
|
"aria-hidden": "true",
|
|
@@ -29,12 +57,12 @@ var h = { class: "flex flex-col items-center justify-center px-6 py-16 text-cent
|
|
|
29
57
|
default: m(() => [o(p(c.title), 1)]),
|
|
30
58
|
_: 1
|
|
31
59
|
})),
|
|
32
|
-
a("div",
|
|
33
|
-
d(
|
|
60
|
+
a("div", v, [d(y.$slots, "description", {}, () => [o(p(c.description), 1)])]),
|
|
61
|
+
d(y.$slots, "action", {}, () => [c.actionLabel ? (u(), n(e, {
|
|
34
62
|
key: 0,
|
|
35
63
|
class: "mt-4",
|
|
36
64
|
variant: "primary",
|
|
37
|
-
onClick:
|
|
65
|
+
onClick: b[1] ||= (e) => y.$emit("action")
|
|
38
66
|
}, {
|
|
39
67
|
default: m(() => [c.actionIcon ? (u(), n(t, {
|
|
40
68
|
key: 0,
|
|
@@ -46,6 +74,6 @@ var h = { class: "flex flex-col items-center justify-center px-6 py-16 text-cent
|
|
|
46
74
|
}
|
|
47
75
|
});
|
|
48
76
|
//#endregion
|
|
49
|
-
export {
|
|
77
|
+
export { y as default };
|
|
50
78
|
|
|
51
79
|
//# sourceMappingURL=EmptyState.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.vue_vue_type_script_setup_true_lang.js","names":["$emit","_openBlock","_createElementBlock","
|
|
1
|
+
{"version":3,"file":"EmptyState.vue_vue_type_script_setup_true_lang.js","names":["$emit","_openBlock","_createElementBlock","_createBlock","Icon","_createCommentVNode","_createElementVNode","_toDisplayString","_renderSlot","Button","_withCtx","_createTextVNode","_normalizeClass","_createVNode","_resolveDynamicComponent","Button_default","Icon_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","EmptyState_vue_vue_type_script_setup_true_lang_default","__props","openBlock","createElementBlock","createBlock","createCommentVNode","createElementVNode","toDisplayString","renderSlot","_ctx","_cache","withCtx","createTextVNode","normalizeClass","createVNode","resolveDynamicComponent"],"sources":["../../../src/components/EmptyState/EmptyState.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport Button from '../Button/Button.vue'\nimport Icon from '../Icon/Icon.vue'\n\nexport interface EmptyStateProps {\n title: string\n /** Plain text; for anything richer, use the `description` slot. */\n description?: string\n /** What the list holds, as an icon name (users, inbox, search for no matches), in a tile above the title. Decorative. */\n icon?: string\n /** `accent` for a list waiting to be filled; `neutral` for no matches or a filtered view. */\n tone?: 'accent' | 'neutral'\n /** Shows a primary button with this label, which emits `action`. Or put your own in the `action` slot. */\n actionLabel?: string\n actionIcon?: string\n /** The title's heading level, to fit the page's outline. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6\n /** sm, for an empty card in settings or a tray: an optional 16px icon, the title as one muted line of text (not a\n * heading), a small secondary action. No description. */\n size?: 'md' | 'sm'\n}\n\nwithDefaults(defineProps<EmptyStateProps>(), {\n description: undefined,\n icon: undefined,\n tone: 'accent',\n actionLabel: undefined,\n actionIcon: 'plus',\n headingLevel: 2,\n size: 'md'\n})\n\ndefineEmits<{ action: [] }>()\n</script>\n\n<template>\n <div v-if=\"size === 'sm'\" class=\"flex flex-col items-center justify-center gap-2 px-4 py-5 text-center\">\n <Icon v-if=\"icon\" class=\"size-4\" color=\"ink-muted\" :name=\"icon\" />\n <p class=\"m-0 max-w-full text-13 leading-5 text-sui-ink-muted\">{{ title }}</p>\n <slot name=\"action\">\n <Button v-if=\"actionLabel\" class=\"mt-1\" size=\"sm\" variant=\"secondary\" @click=\"$emit('action')\">\n <Icon v-if=\"actionIcon\" :name=\"actionIcon\" />\n {{ actionLabel }}\n </Button>\n </slot>\n </div>\n <div v-else class=\"flex flex-col items-center justify-center px-6 py-16 text-center\">\n <div\n v-if=\"icon\"\n aria-hidden=\"true\"\n class=\"mb-4 flex size-12 items-center justify-center rounded-xl ring-1 ring-inset\"\n :class=\"tone === 'accent' ? 'bg-sui-accent-wash ring-sui-accent-line' : 'bg-sui-sunken ring-sui-line-subtle'\"\n >\n <Icon class=\"size-6\" :color=\"tone === 'accent' ? 'accent' : 'ink-muted'\" :name=\"icon\" />\n </div>\n <component :is=\"`h${headingLevel}`\" class=\"m-0 mb-1.5 text-base font-semibold text-sui-ink\">{{ title }}</component>\n <div class=\"max-w-xs text-sm leading-relaxed text-sui-ink-muted\">\n <slot name=\"description\">{{ description }}</slot>\n </div>\n <slot name=\"action\">\n <Button v-if=\"actionLabel\" class=\"mt-4\" variant=\"primary\" @click=\"$emit('action')\">\n <Icon v-if=\"actionIcon\" :name=\"actionIcon\" />\n {{ actionLabel }}\n </Button>\n </slot>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;E,iBAoCasB,EAAA,SAAI,QAAfrB,EAAA,GAAAC,EASM,OATNe,GASM;GARQK,EAAA,QAAZrB,EAAA,GAAAE,EAAkEC,GAAA;;IAAhD,OAAM;IAAS,OAAM;IAAa,MAAMkB,EAAA;;GAC1DhB,EAA8E,KAA9EY,GAA8EX,EAAZe,EAAA,KAAK,GAAA,CAAA;GACvEd,EAKOsB,EAAA,QAAA,UAAA,CAAA,SAAA,CAJSR,EAAA,eAAdrB,EAAA,GAAAE,EAGSM,GAAA;;IAHkB,OAAM;IAAO,MAAK;IAAK,SAAQ;IAAa,SAAK,AAAAsB,EAAA,QAAA,MAAE/B,EAAAA,MAAK,QAAA;;IACjF,SAAAU,QAA6C,CAAjCY,EAAA,cAAZrB,EAAA,GAAAE,EAA6CC,GAAA;;KAApB,MAAMkB,EAAA;I,oCAAcX,EAAA,MAC7CJ,EAAGe,EAAA,WAAW,GAAA,CAAA,C;;;E,OAIpBrB,EAAA,GAAAC,EAmBM,OAnBNiB,GAmBM;GAjBIG,EAAA,QADRrB,EAAA,GAAAC,EAOM,OAAA;;IALJ,eAAY;IACZ,OAAKU,EAAA,CAAC,8EACEU,EAAA,SAAI,WAAA,4CAAA,oCAAA,CAAA;G,IAEZT,EAAwFT,GAAA;IAAlF,OAAM;IAAU,OAAOkB,EAAA,SAAI,WAAA,WAAA;IAAyC,MAAMA,EAAA;;IAElFrB,EAAA,GAAAE,EAAmHW,EAAA,IAA/FQ,EAAA,cAAY,GAAA,EAAI,OAAM,kDAAiD,GAAA;IAAC,SAAAZ,QAAW,CAARC,EAAAJ,EAAAe,EAAA,KAAK,GAAA,CAAA,C;;;GACpGhB,EAEM,OAFNc,GAEM,CADJZ,EAAiDsB,EAAA,QAAA,eAAA,CAAA,SAAA,CAArBnB,EAAAJ,EAAAe,EAAA,WAAW,GAAA,CAAA,C;GAEzCd,EAKOsB,EAAA,QAAA,UAAA,CAAA,SAAA,CAJSR,EAAA,eAAdrB,EAAA,GAAAE,EAGSM,GAAA;;IAHkB,OAAM;IAAO,SAAQ;IAAW,SAAK,AAAAsB,EAAA,QAAA,MAAE/B,EAAAA,MAAK,QAAA;;IACrE,SAAAU,QAA6C,CAAjCY,EAAA,cAAZrB,EAAA,GAAAE,EAA6CC,GAAA;;KAApB,MAAMkB,EAAA;I,oCAAcX,EAAA,MAC7CJ,EAAGe,EAAA,WAAW,GAAA,CAAA,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterChip.js","names":["_sfc_main","FilterChip_vue_vue_type_script_setup_true_lang_default","FilterChip_default"],"sources":["../../../src/components/Filters/FilterChip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, useAttrs } from 'vue'\n\nimport {\n DropdownMenuContent,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuRoot,\n DropdownMenuTrigger,\n PopoverContent,\n PopoverPortal,\n PopoverRoot,\n PopoverTrigger,\n RadioGroupItem,\n RadioGroupRoot\n} from 'reka-ui'\n\nimport Checkbox from '../Checkbox/Checkbox.vue'\nimport Icon from '../Icon/Icon.vue'\nimport Input from '../Input/Input.vue'\nimport SegmentedControl from '../SegmentedControl/SegmentedControl.vue'\nimport CheckIcon from '../internal/CheckIcon.vue'\nimport FilterFrame from './FilterFrame.vue'\nimport FilterGlyph from './FilterGlyph.vue'\nimport { datePresets as defaultDatePresets, describeFilter, filterOperators } from './defaults'\nimport type { FilterFieldType, FilterOperator, FilterOption, FilterValue } from './types'\n\nexport interface FilterChipProps {\n /** A filter, read as a sentence; `add` is the quiet \"+ Filter\" that starts one (FilterMenu includes it). */\n kind?: 'filter' | 'add'\n field?: string\n /** Picks the editor: a checklist for enum, person and company, an input for text and number, presets for date, Yes / No for boolean. */\n type?: FilterFieldType\n /** An app icon for the field, instead of the type's glyph. */\n icon?: string\n /** The operators offered; English ones by type by default. */\n operators?: FilterOperator[]\n /** The choices for enum, person and company. */\n options?: FilterOption[]\n /** The live result count in the panel's footer, e.g. \"120 people\". */\n status?: string\n /** The plural noun once more than two values are picked: \"3 stages\". */\n valueLabel?: string\n datePresets?: string[]\n /** Adds a Remove action to the panel (`@remove`). */\n onRemove?: () => void\n removeLabel?: string\n addLabel?: string\n operatorLabel?: string\n searchPlaceholder?: string\n valuePlaceholder?: string\n doneLabel?: string\n closeLabel?: string\n yesLabel?: string\n noLabel?: string\n}\n\n// Attributes and listeners go to the chip itself; the root is a renderless popover.\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<FilterChipProps>(), {\n kind: 'filter',\n field: undefined,\n type: 'enum',\n icon: undefined,\n operators: undefined,\n options: () => [],\n status: undefined,\n valueLabel: 'values',\n datePresets: () => defaultDatePresets,\n onRemove: undefined,\n removeLabel: 'Remove',\n addLabel: 'Filter',\n operatorLabel: 'Operator',\n searchPlaceholder: 'Search…',\n valuePlaceholder: 'Type a value',\n doneLabel: 'Done',\n closeLabel: 'Close',\n yesLabel: 'Yes',\n noLabel: 'No'\n})\n\nconst op = defineModel<string>('op')\nconst value = defineModel<FilterValue>({ default: null })\nconst open = defineModel<boolean>('open', { default: false })\n\ndefineSlots<{\n /** Your own editor, in place of the type's. */\n default?: () => unknown\n}>()\n\nconst attrs = useAttrs()\n\nconst ops = computed(() => props.operators ?? filterOperators[props.type])\nconst current = computed(() => ops.value.find((o) => o.value === op.value))\nconst needsValue = computed(() => !current.value?.noValue)\nconst text = computed(() =>\n needsValue.value\n ? describeFilter(value.value, props.options, {\n valueLabel: props.valueLabel,\n yesLabel: props.yesLabel,\n noLabel: props.noLabel\n })\n : ''\n)\nconst isChecklist = computed(() => ['enum', 'person', 'company'].includes(props.type))\n\nconst query = ref('')\nconst listed = computed(() => {\n const q = query.value.trim().toLowerCase()\n return q ? props.options.filter((o) => o.label.toLowerCase().includes(q)) : props.options\n})\n\nconst picked = computed(() => (Array.isArray(value.value) ? value.value : []))\n\nfunction toggle(choice: string | number) {\n value.value = picked.value.includes(choice) ? picked.value.filter((v) => v !== choice) : [...picked.value, choice]\n}\n\nfunction remove() {\n open.value = false\n props.onRemove?.()\n}\n\nconst chip =\n 'inline-flex h-7.5 items-center gap-1.5 rounded-lg border text-13 whitespace-nowrap outline-hidden transition-[border-color,box-shadow] duration-150 focus-visible:sui-ring'\nconst row =\n 'flex min-h-8 w-full cursor-pointer items-center gap-2.5 rounded-lg px-2 py-1 text-left text-13.5 outline-hidden transition-colors duration-100 focus-visible:sui-ring-inset'\nconst rowOn = 'bg-sui-accent-wash font-semibold text-sui-accent'\nconst rowOff = 'text-sui-ink hover:bg-sui-sunken'\nconst hueDots: Record<string, string> = {\n blue: 'bg-sui-hue-blue-ink',\n green: 'bg-sui-hue-green-ink',\n orange: 'bg-sui-hue-orange-ink',\n pink: 'bg-sui-hue-pink-ink',\n purple: 'bg-sui-hue-purple-ink',\n slate: 'bg-sui-hue-slate-ink',\n red: 'bg-sui-hue-red-ink',\n amber: 'bg-sui-hue-amber-ink'\n}\n</script>\n\n<!-- A view's filter as a sentence chip (\"Stage is any of Lead, Customer\"), whose panel changes it as you go. -->\n<template>\n <button\n v-if=\"kind === 'add'\"\n v-bind=\"attrs\"\n class=\"border-dashed border-sui-line-strong px-2 font-medium text-sui-ink-muted hover:border-sui-ink-muted hover:text-sui-ink-body\"\n :class=\"chip\"\n type=\"button\"\n >\n <FilterGlyph name=\"plus\" />\n {{ addLabel }}\n </button>\n <PopoverRoot v-else v-model:open=\"open\">\n <PopoverTrigger\n v-bind=\"attrs\"\n class=\"border-sui-accent-line bg-sui-accent-wash pr-1.5 pl-2 text-sui-accent hover:border-sui-accent-bright data-[state=open]:border-sui-accent-solid data-[state=open]:shadow-[0_0_0_3px_rgb(var(--sui-focus-ring))]\"\n :class=\"chip\"\n >\n <Icon v-if=\"icon\" class=\"size-3.5 opacity-80\" color=\"accent\" :name=\"icon\" />\n <FilterGlyph v-else class=\"opacity-80\" :name=\"type\" />\n <!-- Real spaces between the words, so the chip's name reads as a sentence. -->\n <span\n ><span class=\"font-medium\">{{ field }}</span\n ><template v-if=\"current\">{{ ' ' }}{{ current.label }}</template\n ><template v-if=\"text\"\n >{{ ' ' }}<span class=\"font-semibold\">{{ text }}</span></template\n ></span\n >\n <svg\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 fill-none stroke-current opacity-70\"\n stroke-linecap=\"round\"\n stroke-width=\"2.2\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M6 9l6 6 6-6\" />\n </svg>\n </PopoverTrigger>\n <PopoverPortal>\n <PopoverContent\n align=\"start\"\n class=\"z-[1100] w-85 max-w-[calc(100vw-2rem)] origin-(--reka-popover-content-transform-origin) rounded-xl border border-sui-line bg-sui-surface text-sui-ink shadow-lg data-[state=open]:animate-sui-overlay-in\"\n :side-offset=\"8\"\n >\n <FilterFrame :close-label=\"closeLabel\" :enter-label=\"doneLabel\" :status=\"status\" @enter=\"open = false\">\n <div class=\"flex h-11 items-center gap-1.5 pr-1.5 pl-3.5 text-sui-ink-muted\">\n <Icon v-if=\"icon\" color=\"ink-muted\" :name=\"icon\" />\n <FilterGlyph v-else class=\"size-4\" :name=\"type\" />\n <span class=\"text-sm font-semibold text-sui-ink\">{{ field }}</span>\n <DropdownMenuRoot v-if=\"ops.length > 1\">\n <DropdownMenuTrigger\n :aria-label=\"`${operatorLabel}: ${current?.label ?? ''}`\"\n class=\"inline-flex h-7 items-center gap-0.5 rounded-md pr-1 pl-1.5 text-13.5 font-medium text-sui-accent outline-hidden transition-colors duration-150 hover:bg-sui-accent-wash focus-visible:sui-ring-inset data-[state=open]:bg-sui-accent-wash\"\n >\n {{ current?.label }}\n <svg\n aria-hidden=\"true\"\n class=\"size-3.5 fill-none stroke-current\"\n stroke-linecap=\"round\"\n stroke-width=\"2.2\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M6 9l6 6 6-6\" />\n </svg>\n </DropdownMenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuContent\n align=\"start\"\n class=\"z-[1100] w-44 rounded-lg border border-sui-line bg-sui-surface p-1 shadow-lg data-[state=open]:animate-sui-menu-in\"\n :side-offset=\"4\"\n >\n <DropdownMenuRadioGroup v-model=\"op\">\n <DropdownMenuRadioItem\n v-for=\"operator in ops\"\n :key=\"operator.value\"\n class=\"flex h-8 cursor-pointer items-center justify-between rounded-md px-2.5 text-13.5 text-sui-ink-body outline-hidden select-none data-highlighted:bg-sui-sunken data-[state=checked]:font-semibold data-[state=checked]:text-sui-ink\"\n :value=\"operator.value\"\n >\n {{ operator.label }}\n <CheckIcon v-if=\"operator.value === op\" />\n </DropdownMenuRadioItem>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n <span v-else class=\"text-13.5 text-sui-ink-muted\">{{ current?.label }}</span>\n <button\n v-if=\"onRemove\"\n class=\"ml-auto inline-flex h-7 items-center gap-1.5 rounded-lg px-2 text-12.5 font-medium text-sui-ink-muted outline-hidden transition-colors duration-150 hover:bg-sui-danger-soft hover:text-sui-danger focus-visible:sui-ring-inset\"\n type=\"button\"\n @click=\"remove\"\n >\n <FilterGlyph name=\"trash\" />\n {{ removeLabel }}\n </button>\n </div>\n\n <slot v-if=\"$slots.default\" />\n <template v-else-if=\"needsValue\">\n <template v-if=\"isChecklist\">\n <div\n v-if=\"options.length > 6\"\n class=\"mx-2 mb-1 flex h-9 items-center gap-2 rounded-lg border border-sui-line-subtle px-2.5 text-sui-ink-muted\"\n >\n <FilterGlyph class=\"size-4\" name=\"search\" />\n <!-- focus: classes too: an app's forms plugin rings focused text fields, and outranks plain utilities. -->\n <input\n v-model=\"query\"\n :aria-label=\"searchPlaceholder\"\n autofocus\n class=\"h-full min-w-0 flex-1 border-none bg-transparent p-0 text-sm text-sui-ink shadow-none outline-hidden placeholder:text-sui-ink-faint focus:border-none focus:shadow-none focus:ring-0 focus:outline-hidden\"\n :placeholder=\"searchPlaceholder\"\n />\n </div>\n <div class=\"max-h-64 overflow-auto px-1.5 pt-1 pb-1.5\">\n <label\n v-for=\"option in listed\"\n :key=\"option.value\"\n :class=\"[row, picked.includes(option.value) ? rowOn : rowOff]\"\n >\n <Checkbox :model-value=\"picked.includes(option.value)\" @update:model-value=\"toggle(option.value)\" />\n <span v-if=\"option.color\" class=\"size-1.5 shrink-0 rounded-full\" :class=\"hueDots[option.color]\" />\n <span class=\"min-w-0 flex-1 truncate\">{{ option.label }}</span>\n <span v-if=\"option.count != null\" class=\"text-xs font-normal text-sui-ink-muted tabular-nums\">{{\n option.count\n }}</span>\n </label>\n </div>\n </template>\n <div v-else-if=\"type === 'text' || type === 'number'\" class=\"px-2 pt-1 pb-2\">\n <Input\n :aria-label=\"field\"\n autofocus\n :model-value=\"value == null ? '' : String(value)\"\n :placeholder=\"valuePlaceholder\"\n :type=\"type === 'number' ? 'number' : 'text'\"\n @update:model-value=\"value = $event ?? null\"\n />\n </div>\n <RadioGroupRoot\n v-else-if=\"type === 'date'\"\n :aria-label=\"field\"\n class=\"max-h-64 overflow-auto px-1.5 pt-1 pb-1.5\"\n :model-value=\"typeof value === 'string' ? value : undefined\"\n @update:model-value=\"value = String($event)\"\n >\n <RadioGroupItem\n v-for=\"preset in datePresets\"\n :key=\"preset\"\n :class=\"[row, preset === value ? rowOn : rowOff]\"\n :value=\"preset\"\n >\n <FilterGlyph\n class=\"size-4\"\n :class=\"preset === value ? 'text-sui-accent' : 'text-sui-ink-muted'\"\n name=\"date\"\n />\n <span class=\"min-w-0 flex-1 truncate\">{{ preset }}</span>\n <CheckIcon v-if=\"preset === value\" />\n </RadioGroupItem>\n </RadioGroupRoot>\n <div v-else-if=\"type === 'boolean'\" class=\"px-2.5 pt-1 pb-2.5\">\n <SegmentedControl\n :aria-label=\"field\"\n :model-value=\"value ? 'yes' : 'no'\"\n :options=\"[\n { value: 'yes', label: yesLabel },\n { value: 'no', label: noLabel }\n ]\"\n @update:model-value=\"value = $event === 'yes'\"\n />\n </div>\n </template>\n </FilterFrame>\n </PopoverContent>\n </PopoverPortal>\n </PopoverRoot>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"FilterChip.js","names":["_sfc_main","FilterChip_vue_vue_type_script_setup_true_lang_default","FilterChip_default"],"sources":["../../../src/components/Filters/FilterChip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, useAttrs } from 'vue'\n\nimport {\n DropdownMenuContent,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuRoot,\n DropdownMenuTrigger,\n PopoverContent,\n PopoverPortal,\n PopoverRoot,\n PopoverTrigger,\n RadioGroupItem,\n RadioGroupRoot\n} from 'reka-ui'\n\nimport Checkbox from '../Checkbox/Checkbox.vue'\nimport Icon from '../Icon/Icon.vue'\nimport Input from '../Input/Input.vue'\nimport SegmentedControl from '../SegmentedControl/SegmentedControl.vue'\nimport CheckIcon from '../internal/CheckIcon.vue'\nimport FilterFrame from './FilterFrame.vue'\nimport FilterGlyph from './FilterGlyph.vue'\nimport { datePresets as defaultDatePresets, describeFilter, filterOperators } from './defaults'\nimport type { FilterFieldType, FilterOperator, FilterOption, FilterSummary, FilterValue } from './types'\n\nexport interface FilterChipProps {\n /** A filter, read as a sentence; `add` is the quiet \"+ Filter\" that starts one (FilterMenu includes it). */\n kind?: 'filter' | 'add'\n field?: string\n /** Picks the editor: a checklist for enum, person and company, an input for text and number, presets for date, Yes / No for boolean. */\n type?: FilterFieldType\n /** An app icon for the field, instead of the type's glyph. */\n icon?: string\n /** The operators offered; English ones by type by default. */\n operators?: FilterOperator[]\n /** The choices for enum, person and company. */\n options?: FilterOption[]\n /** Your own wording for the chip, in place of field, operator and value: \"Not archived\", \"Created in the last 7 days\". */\n summary?: FilterSummary\n /** The live result count in the panel's footer, e.g. \"120 people\". */\n status?: string\n /** The plural noun once more than two values are picked: \"3 stages\". */\n valueLabel?: string\n datePresets?: string[]\n /** Adds a Remove action to the panel (`@remove`). */\n onRemove?: () => void\n removeLabel?: string\n addLabel?: string\n operatorLabel?: string\n searchPlaceholder?: string\n valuePlaceholder?: string\n doneLabel?: string\n closeLabel?: string\n yesLabel?: string\n noLabel?: string\n}\n\n// Attributes and listeners go to the chip itself; the root is a renderless popover.\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<FilterChipProps>(), {\n kind: 'filter',\n field: undefined,\n type: 'enum',\n icon: undefined,\n operators: undefined,\n options: () => [],\n summary: undefined,\n status: undefined,\n valueLabel: 'values',\n datePresets: () => defaultDatePresets,\n onRemove: undefined,\n removeLabel: 'Remove',\n addLabel: 'Filter',\n operatorLabel: 'Operator',\n searchPlaceholder: 'Search…',\n valuePlaceholder: 'Type a value',\n doneLabel: 'Done',\n closeLabel: 'Close',\n yesLabel: 'Yes',\n noLabel: 'No'\n})\n\nconst op = defineModel<string>('op')\nconst value = defineModel<FilterValue>({ default: null })\nconst open = defineModel<boolean>('open', { default: false })\n\ndefineSlots<{\n /** Your own editor, in place of the type's. */\n default?: () => unknown\n}>()\n\nconst attrs = useAttrs()\n\nconst ops = computed(() => props.operators ?? filterOperators[props.type])\nconst current = computed(() => ops.value.find((o) => o.value === op.value))\nconst needsValue = computed(() => !current.value?.noValue)\nconst text = computed(() =>\n needsValue.value\n ? describeFilter(value.value, props.options, {\n valueLabel: props.valueLabel,\n yesLabel: props.yesLabel,\n noLabel: props.noLabel\n })\n : ''\n)\nconst words = computed(() => ({\n field: props.summary?.field ?? props.field,\n op: props.summary ? props.summary.op : current.value?.label,\n value: props.summary ? props.summary.value : text.value\n}))\nconst isChecklist = computed(() => ['enum', 'person', 'company'].includes(props.type))\n\nconst query = ref('')\nconst listed = computed(() => {\n const q = query.value.trim().toLowerCase()\n return q ? props.options.filter((o) => o.label.toLowerCase().includes(q)) : props.options\n})\n\nconst picked = computed(() => (Array.isArray(value.value) ? value.value : []))\n\nfunction toggle(choice: string | number) {\n value.value = picked.value.includes(choice) ? picked.value.filter((v) => v !== choice) : [...picked.value, choice]\n}\n\nfunction remove() {\n open.value = false\n props.onRemove?.()\n}\n\nconst chip =\n 'inline-flex h-7.5 items-center gap-1.5 rounded-lg border text-13 whitespace-nowrap outline-hidden transition-[border-color,box-shadow] duration-150 focus-visible:sui-ring'\nconst row =\n 'flex min-h-8 w-full cursor-pointer items-center gap-2.5 rounded-lg px-2 py-1 text-left text-13.5 outline-hidden transition-colors duration-100 focus-visible:sui-ring-inset'\nconst rowOn = 'bg-sui-accent-wash font-semibold text-sui-accent'\nconst rowOff = 'text-sui-ink hover:bg-sui-sunken'\nconst hueDots: Record<string, string> = {\n blue: 'bg-sui-hue-blue-ink',\n green: 'bg-sui-hue-green-ink',\n orange: 'bg-sui-hue-orange-ink',\n pink: 'bg-sui-hue-pink-ink',\n purple: 'bg-sui-hue-purple-ink',\n slate: 'bg-sui-hue-slate-ink',\n red: 'bg-sui-hue-red-ink',\n amber: 'bg-sui-hue-amber-ink'\n}\n</script>\n\n<!-- A view's filter as a sentence chip (\"Stage is any of Lead, Customer\"), whose panel changes it as you go. -->\n<template>\n <button\n v-if=\"kind === 'add'\"\n v-bind=\"attrs\"\n class=\"border-dashed border-sui-line-strong px-2 font-medium text-sui-ink-muted hover:border-sui-ink-muted hover:text-sui-ink-body\"\n :class=\"chip\"\n type=\"button\"\n >\n <FilterGlyph name=\"plus\" />\n {{ addLabel }}\n </button>\n <PopoverRoot v-else v-model:open=\"open\">\n <PopoverTrigger\n v-bind=\"attrs\"\n class=\"border-sui-accent-line bg-sui-accent-wash pr-1.5 pl-2 text-sui-accent hover:border-sui-accent-bright data-[state=open]:border-sui-accent-solid data-[state=open]:shadow-[0_0_0_3px_rgb(var(--sui-focus-ring))]\"\n :class=\"chip\"\n >\n <Icon v-if=\"icon\" class=\"size-3.5 opacity-80\" color=\"accent\" :name=\"icon\" />\n <FilterGlyph v-else class=\"opacity-80\" :name=\"type\" />\n <!-- Real spaces between the words, so the chip's name reads as a sentence. -->\n <span\n ><span class=\"font-medium\">{{ words.field }}</span\n ><template v-if=\"words.op\">{{ ' ' }}{{ words.op }}</template\n ><template v-if=\"words.value\"\n >{{ ' ' }}<span class=\"font-semibold\">{{ words.value }}</span></template\n ></span\n >\n <svg\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 fill-none stroke-current opacity-70\"\n stroke-linecap=\"round\"\n stroke-width=\"2.2\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M6 9l6 6 6-6\" />\n </svg>\n </PopoverTrigger>\n <PopoverPortal>\n <PopoverContent\n align=\"start\"\n class=\"z-[1100] w-85 max-w-[calc(100vw-2rem)] origin-(--reka-popover-content-transform-origin) rounded-xl border border-sui-line bg-sui-surface text-sui-ink shadow-lg data-[state=open]:animate-sui-overlay-in\"\n :side-offset=\"8\"\n >\n <FilterFrame :close-label=\"closeLabel\" :enter-label=\"doneLabel\" :status=\"status\" @enter=\"open = false\">\n <div class=\"flex h-11 items-center gap-1.5 pr-1.5 pl-3.5 text-sui-ink-muted\">\n <Icon v-if=\"icon\" color=\"ink-muted\" :name=\"icon\" />\n <FilterGlyph v-else class=\"size-4\" :name=\"type\" />\n <span class=\"text-sm font-semibold text-sui-ink\">{{ field }}</span>\n <DropdownMenuRoot v-if=\"ops.length > 1\">\n <DropdownMenuTrigger\n :aria-label=\"`${operatorLabel}: ${current?.label ?? ''}`\"\n class=\"inline-flex h-7 items-center gap-0.5 rounded-md pr-1 pl-1.5 text-13.5 font-medium text-sui-accent outline-hidden transition-colors duration-150 hover:bg-sui-accent-wash focus-visible:sui-ring-inset data-[state=open]:bg-sui-accent-wash\"\n >\n {{ current?.label }}\n <svg\n aria-hidden=\"true\"\n class=\"size-3.5 fill-none stroke-current\"\n stroke-linecap=\"round\"\n stroke-width=\"2.2\"\n viewBox=\"0 0 24 24\"\n >\n <path d=\"M6 9l6 6 6-6\" />\n </svg>\n </DropdownMenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuContent\n align=\"start\"\n class=\"z-[1100] w-44 rounded-lg border border-sui-line bg-sui-surface p-1 shadow-lg data-[state=open]:animate-sui-menu-in\"\n :side-offset=\"4\"\n >\n <DropdownMenuRadioGroup v-model=\"op\">\n <DropdownMenuRadioItem\n v-for=\"operator in ops\"\n :key=\"operator.value\"\n class=\"flex h-8 cursor-pointer items-center justify-between rounded-md px-2.5 text-13.5 text-sui-ink-body outline-hidden select-none data-highlighted:bg-sui-sunken data-[state=checked]:font-semibold data-[state=checked]:text-sui-ink\"\n :value=\"operator.value\"\n >\n {{ operator.label }}\n <CheckIcon v-if=\"operator.value === op\" />\n </DropdownMenuRadioItem>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n <span v-else class=\"text-13.5 text-sui-ink-muted\">{{ current?.label }}</span>\n <button\n v-if=\"onRemove\"\n class=\"ml-auto inline-flex h-7 items-center gap-1.5 rounded-lg px-2 text-12.5 font-medium text-sui-ink-muted outline-hidden transition-colors duration-150 hover:bg-sui-danger-soft hover:text-sui-danger focus-visible:sui-ring-inset\"\n type=\"button\"\n @click=\"remove\"\n >\n <FilterGlyph name=\"trash\" />\n {{ removeLabel }}\n </button>\n </div>\n\n <slot v-if=\"$slots.default\" />\n <template v-else-if=\"needsValue\">\n <template v-if=\"isChecklist\">\n <div\n v-if=\"options.length > 6\"\n class=\"mx-2 mb-1 flex h-9 items-center gap-2 rounded-lg border border-sui-line-subtle px-2.5 text-sui-ink-muted\"\n >\n <FilterGlyph class=\"size-4\" name=\"search\" />\n <!-- focus: classes too: an app's forms plugin rings focused text fields, and outranks plain utilities. -->\n <input\n v-model=\"query\"\n :aria-label=\"searchPlaceholder\"\n autofocus\n class=\"h-full min-w-0 flex-1 border-none bg-transparent p-0 text-sm text-sui-ink shadow-none outline-hidden placeholder:text-sui-ink-faint focus:border-none focus:shadow-none focus:ring-0 focus:outline-hidden\"\n :placeholder=\"searchPlaceholder\"\n />\n </div>\n <div class=\"max-h-64 overflow-auto px-1.5 pt-1 pb-1.5\">\n <label\n v-for=\"option in listed\"\n :key=\"option.value\"\n :class=\"[row, picked.includes(option.value) ? rowOn : rowOff]\"\n >\n <Checkbox :model-value=\"picked.includes(option.value)\" @update:model-value=\"toggle(option.value)\" />\n <span v-if=\"option.color\" class=\"size-1.5 shrink-0 rounded-full\" :class=\"hueDots[option.color]\" />\n <span class=\"min-w-0 flex-1 truncate\">{{ option.label }}</span>\n <span v-if=\"option.count != null\" class=\"text-xs font-normal text-sui-ink-muted tabular-nums\">{{\n option.count\n }}</span>\n </label>\n </div>\n </template>\n <div v-else-if=\"type === 'text' || type === 'number'\" class=\"px-2 pt-1 pb-2\">\n <Input\n :aria-label=\"field\"\n autofocus\n :model-value=\"value == null ? '' : String(value)\"\n :placeholder=\"valuePlaceholder\"\n :type=\"type === 'number' ? 'number' : 'text'\"\n @update:model-value=\"value = $event ?? null\"\n />\n </div>\n <RadioGroupRoot\n v-else-if=\"type === 'date'\"\n :aria-label=\"field\"\n class=\"max-h-64 overflow-auto px-1.5 pt-1 pb-1.5\"\n :model-value=\"typeof value === 'string' ? value : undefined\"\n @update:model-value=\"value = String($event)\"\n >\n <RadioGroupItem\n v-for=\"preset in datePresets\"\n :key=\"preset\"\n :class=\"[row, preset === value ? rowOn : rowOff]\"\n :value=\"preset\"\n >\n <FilterGlyph\n class=\"size-4\"\n :class=\"preset === value ? 'text-sui-accent' : 'text-sui-ink-muted'\"\n name=\"date\"\n />\n <span class=\"min-w-0 flex-1 truncate\">{{ preset }}</span>\n <CheckIcon v-if=\"preset === value\" />\n </RadioGroupItem>\n </RadioGroupRoot>\n <div v-else-if=\"type === 'boolean'\" class=\"px-2.5 pt-1 pb-2.5\">\n <SegmentedControl\n :aria-label=\"field\"\n :model-value=\"value === null ? '' : value ? 'yes' : 'no'\"\n :options=\"[\n { value: 'yes', label: yesLabel },\n { value: 'no', label: noLabel }\n ]\"\n @update:model-value=\"value = $event === 'yes'\"\n />\n </div>\n </template>\n </FilterFrame>\n </PopoverContent>\n </PopoverPortal>\n </PopoverRoot>\n</template>\n"],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FilterFieldType, FilterOperator, FilterOption, FilterValue } from './types';
|
|
1
|
+
import type { FilterFieldType, FilterOperator, FilterOption, FilterSummary, FilterValue } from './types';
|
|
2
2
|
export interface FilterChipProps {
|
|
3
3
|
/** A filter, read as a sentence; `add` is the quiet "+ Filter" that starts one (FilterMenu includes it). */
|
|
4
4
|
kind?: 'filter' | 'add';
|
|
@@ -11,6 +11,8 @@ export interface FilterChipProps {
|
|
|
11
11
|
operators?: FilterOperator[];
|
|
12
12
|
/** The choices for enum, person and company. */
|
|
13
13
|
options?: FilterOption[];
|
|
14
|
+
/** Your own wording for the chip, in place of field, operator and value: "Not archived", "Created in the last 7 days". */
|
|
15
|
+
summary?: FilterSummary;
|
|
14
16
|
/** The live result count in the panel's footer, e.g. "120 people". */
|
|
15
17
|
status?: string;
|
|
16
18
|
/** The plural noun once more than two values are picked: "3 stages". */
|
|
@@ -49,6 +51,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
|
|
|
49
51
|
"onUpdate:op"?: ((value: string | undefined) => any) | undefined;
|
|
50
52
|
}>, {
|
|
51
53
|
type: FilterFieldType;
|
|
54
|
+
summary: FilterSummary;
|
|
52
55
|
icon: string;
|
|
53
56
|
closeLabel: string;
|
|
54
57
|
status: string;
|