@sparklingopinions/sparkling-ui 0.5.0 → 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.
Files changed (90) hide show
  1. package/README.md +1 -1
  2. package/dist/aliases.d.ts +176 -26
  3. package/dist/components/Avatar/Avatar.js.map +1 -1
  4. package/dist/components/Avatar/Avatar.vue.d.ts +3 -2
  5. package/dist/components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js +20 -14
  6. package/dist/components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/components/Button/Button.js.map +1 -1
  8. package/dist/components/Button/Button.vue.d.ts +1 -1
  9. package/dist/components/Button/Button.vue_vue_type_script_setup_true_lang.js +4 -2
  10. package/dist/components/Button/Button.vue_vue_type_script_setup_true_lang.js.map +1 -1
  11. package/dist/components/ContextMenu/ContextMenu.js +7 -0
  12. package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
  13. package/dist/components/ContextMenu/ContextMenu.vue.d.ts +44 -0
  14. package/dist/components/ContextMenu/ContextMenu.vue_vue_type_script_setup_true_lang.js +84 -0
  15. package/dist/components/ContextMenu/ContextMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  16. package/dist/components/ContextMenu/index.d.ts +2 -0
  17. package/dist/components/DataList/DataList.js.map +1 -1
  18. package/dist/components/DataList/DataList.vue.d.ts +8 -0
  19. package/dist/components/DataList/DataList.vue_vue_type_script_setup_true_lang.js +71 -52
  20. package/dist/components/DataList/DataList.vue_vue_type_script_setup_true_lang.js.map +1 -1
  21. package/dist/components/DataList/types.d.ts +5 -1
  22. package/dist/components/Dialog/Dialog.js.map +1 -1
  23. package/dist/components/Dialog/Dialog.vue.d.ts +22 -6
  24. package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js +174 -72
  25. package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/dist/components/Dialog/useSheetDrag.d.ts +16 -0
  27. package/dist/components/Dialog/useSheetDrag.js +37 -0
  28. package/dist/components/Dialog/useSheetDrag.js.map +1 -0
  29. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  30. package/dist/components/DropdownMenu/DropdownMenu.vue.d.ts +6 -30
  31. package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js +54 -74
  32. package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  33. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  34. package/dist/components/EmptyState/EmptyState.vue.d.ts +9 -3
  35. package/dist/components/EmptyState/EmptyState.vue_vue_type_script_setup_true_lang.js +35 -7
  36. package/dist/components/EmptyState/EmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
  37. package/dist/components/Filters/FilterMenu.js.map +1 -1
  38. package/dist/components/Filters/FilterMenu.vue.d.ts +20 -1
  39. package/dist/components/Filters/FilterMenu.vue_vue_type_script_setup_true_lang.js +78 -56
  40. package/dist/components/Filters/FilterMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  41. package/dist/components/Filters/SortMenu.js.map +1 -1
  42. package/dist/components/Filters/SortMenu.vue.d.ts +21 -1
  43. package/dist/components/Filters/SortMenu.vue_vue_type_script_setup_true_lang.js +90 -67
  44. package/dist/components/Filters/SortMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  45. package/dist/components/Filters/index.d.ts +1 -0
  46. package/dist/components/Filters/trigger.d.ts +17 -0
  47. package/dist/components/Filters/trigger.js +33 -0
  48. package/dist/components/Filters/trigger.js.map +1 -0
  49. package/dist/components/FormField/FormField.js.map +1 -1
  50. package/dist/components/FormField/FormField.vue.d.ts +10 -0
  51. package/dist/components/FormField/FormField.vue_vue_type_script_setup_true_lang.js +31 -20
  52. package/dist/components/FormField/FormField.vue_vue_type_script_setup_true_lang.js.map +1 -1
  53. package/dist/components/Icon/iconSet.js +9 -1
  54. package/dist/components/Icon/iconSet.js.map +1 -1
  55. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  56. package/dist/components/SegmentedControl/SegmentedControl.vue.d.ts +6 -3
  57. package/dist/components/SegmentedControl/SegmentedControl.vue_vue_type_script_setup_true_lang.js +20 -17
  58. package/dist/components/SegmentedControl/SegmentedControl.vue_vue_type_script_setup_true_lang.js.map +1 -1
  59. package/dist/components/SegmentedControl/index.d.ts +1 -1
  60. package/dist/components/Table/Table.js.map +1 -1
  61. package/dist/components/Table/Table.vue.d.ts +4 -0
  62. package/dist/components/Table/Table.vue_vue_type_script_setup_true_lang.js +65 -56
  63. package/dist/components/Table/Table.vue_vue_type_script_setup_true_lang.js.map +1 -1
  64. package/dist/components/Tag/Tag.js.map +1 -1
  65. package/dist/components/Tag/Tag.vue.d.ts +16 -3
  66. package/dist/components/Tag/Tag.vue_vue_type_script_setup_true_lang.js +42 -19
  67. package/dist/components/Tag/Tag.vue_vue_type_script_setup_true_lang.js.map +1 -1
  68. package/dist/components/Toast/ToastMessage.js.map +1 -1
  69. package/dist/components/Toast/ToastMessage.vue.d.ts +13 -1
  70. package/dist/components/Toast/ToastMessage.vue_vue_type_script_setup_true_lang.js +58 -23
  71. package/dist/components/Toast/ToastMessage.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/components/Toast/Toaster.js.map +1 -1
  73. package/dist/components/Toast/Toaster.vue.d.ts +7 -3
  74. package/dist/components/Toast/Toaster.vue_vue_type_script_setup_true_lang.js +50 -21
  75. package/dist/components/Toast/Toaster.vue_vue_type_script_setup_true_lang.js.map +1 -1
  76. package/dist/components/internal/MenuItemContent.js +7 -0
  77. package/dist/components/internal/MenuItemContent.js.map +1 -0
  78. package/dist/components/internal/MenuItemContent.vue.d.ts +7 -0
  79. package/dist/components/internal/MenuItemContent.vue_vue_type_script_setup_true_lang.js +26 -0
  80. package/dist/components/internal/MenuItemContent.vue_vue_type_script_setup_true_lang.js.map +1 -0
  81. package/dist/components/internal/menu.d.ts +46 -0
  82. package/dist/components/internal/menu.js +33 -0
  83. package/dist/components/internal/menu.js.map +1 -0
  84. package/dist/composables/toast.d.ts +20 -5
  85. package/dist/composables/toast.js +28 -20
  86. package/dist/composables/toast.js.map +1 -1
  87. package/dist/index.d.ts +2 -1
  88. package/dist/index.js +34 -33
  89. package/package.json +1 -1
  90. package/src/styles/tailwind.css +29 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ToastMessage.js","names":["_sfc_main","ToastMessage_vue_vue_type_script_setup_true_lang_default","ToastMessage_default"],"sources":["../../../src/components/Toast/ToastMessage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ToastSeverity } from '../../composables/toast'\n\nexport interface ToastMessageProps {\n summary: string\n detail?: string\n severity?: ToastSeverity\n closable?: boolean\n closeLabel?: string\n}\n\nwithDefaults(defineProps<ToastMessageProps>(), {\n detail: undefined,\n severity: 'info',\n closable: true,\n closeLabel: 'Close'\n})\n\ndefineEmits<{ close: [] }>()\n\n// Info has no dot; the others lead with one of their colour.\nconst dots: Record<ToastSeverity, string> = { info: '', success: 'bg-sui-success-mid', error: 'bg-sui-danger-solid' }\n</script>\n\n<!-- One toast as drawn: the Toaster shows these, live or as a preview. -->\n<template>\n <div\n class=\"mb-2 flex w-full items-center gap-2.5 rounded-lg bg-sui-inverse py-2.5 pr-2.5 pl-3 text-sui-on-inverse shadow-md backdrop-blur-[10px]\"\n >\n <span v-if=\"dots[severity]\" class=\"h-2 w-2 shrink-0 rounded-full\" :class=\"dots[severity]\" />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5 text-sm leading-5\">\n <span class=\"font-medium\">{{ summary }}</span>\n <span v-if=\"detail\" class=\"text-13 text-sui-on-inverse/80\">{{ detail }}</span>\n </div>\n <button\n v-if=\"closable\"\n :aria-label=\"closeLabel\"\n class=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-transparent transition duration-200 hover:bg-sui-on-inverse/[0.16] focus-visible:sui-ring-inverse\"\n type=\"button\"\n @click=\"$emit('close')\"\n >\n <svg aria-hidden=\"true\" class=\"h-3 w-3\" fill=\"none\" viewBox=\"0 0 14 14\">\n <path\n d=\"M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ToastMessage.js","names":["_sfc_main","ToastMessage_vue_vue_type_script_setup_true_lang_default","ToastMessage_default"],"sources":["../../../src/components/Toast/ToastMessage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ToastAction, ToastSeverity } from '../../composables/toast'\nimport Button from '../Button/Button.vue'\n\nexport interface ToastMessageProps {\n summary: string\n detail?: string\n severity?: ToastSeverity\n closable?: boolean\n closeLabel?: string\n /** At most two, after the message. */\n actions?: ToastAction[]\n /** With actions, a bar at the bottom counts this many ms down. */\n life?: number\n /** Holds the countdown bar, in step with the toast's timer. */\n paused?: boolean\n}\n\nwithDefaults(defineProps<ToastMessageProps>(), {\n detail: undefined,\n severity: 'info',\n closable: true,\n closeLabel: 'Close',\n actions: () => [],\n life: 0\n})\n\ndefineEmits<{ close: []; action: [action: ToastAction]; expire: [] }>()\n\n// Info has no dot; the others lead with one of their colour.\nconst dots: Record<ToastSeverity, string> = {\n info: '',\n success: 'bg-sui-success-mid',\n warning: 'bg-sui-warning-mid',\n error: 'bg-sui-danger-solid'\n}\n</script>\n\n<!-- One toast as drawn: the Toaster shows these, live or as a preview. -->\n<template>\n <div\n class=\"group/toast relative mb-2 flex w-full items-center gap-2.5 rounded-lg bg-sui-inverse pr-2.5 pl-3 text-sui-on-inverse shadow-md backdrop-blur-[10px]\"\n :class=\"actions.length ? 'overflow-hidden py-1.5' : 'py-2.5'\"\n >\n <span v-if=\"dots[severity]\" class=\"h-2 w-2 shrink-0 rounded-full\" :class=\"dots[severity]\" />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5 text-sm leading-5\">\n <span class=\"font-medium\" :class=\"actions.length ? 'truncate' : ''\">{{ summary }}</span>\n <span v-if=\"detail\" class=\"text-13 text-sui-on-inverse/80\" :class=\"actions.length ? 'truncate' : ''\">{{\n detail\n }}</span>\n </div>\n <div v-if=\"actions.length\" class=\"-mr-0.5 flex shrink-0 items-center gap-0.5 [&>button]:px-2\">\n <Button\n v-for=\"action in actions\"\n :key=\"action.label\"\n size=\"sm\"\n type=\"button\"\n variant=\"ghost-inverse\"\n @click=\"$emit('action', action)\"\n >\n {{ action.label }}\n </Button>\n </div>\n <span v-if=\"closable && actions.length\" aria-hidden=\"true\" class=\"h-4 w-px shrink-0 bg-sui-on-inverse/20\" />\n <button\n v-if=\"closable\"\n :aria-label=\"closeLabel\"\n class=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-transparent transition duration-200 hover:bg-sui-on-inverse/[0.16] focus-visible:sui-ring-inverse\"\n type=\"button\"\n @click=\"$emit('close')\"\n >\n <svg aria-hidden=\"true\" class=\"h-3 w-3\" fill=\"none\" viewBox=\"0 0 14 14\">\n <path\n d=\"M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n <span\n v-if=\"actions.length && life > 0\"\n aria-hidden=\"true\"\n class=\"absolute inset-x-0 bottom-0 h-0.5 origin-left animate-sui-toast-timer bg-sui-on-inverse/[0.32] group-focus-within/toast:[animation-play-state:paused] group-hover/toast:[animation-play-state:paused]\"\n :class=\"paused && '[animation-play-state:paused]'\"\n data-sui-toast-timer\n :style=\"{ animationDuration: `${life}ms` }\"\n @animationend=\"$emit('expire')\"\n />\n </div>\n</template>\n"],"mappings":""}
@@ -1,19 +1,31 @@
1
- import type { ToastSeverity } from '../../composables/toast';
1
+ import type { ToastAction, ToastSeverity } from '../../composables/toast';
2
2
  export interface ToastMessageProps {
3
3
  summary: string;
4
4
  detail?: string;
5
5
  severity?: ToastSeverity;
6
6
  closable?: boolean;
7
7
  closeLabel?: string;
8
+ /** At most two, after the message. */
9
+ actions?: ToastAction[];
10
+ /** With actions, a bar at the bottom counts this many ms down. */
11
+ life?: number;
12
+ /** Holds the countdown bar, in step with the toast's timer. */
13
+ paused?: boolean;
8
14
  }
9
15
  declare const __VLS_export: import("vue").DefineComponent<ToastMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
16
  close: () => any;
17
+ action: (action: ToastAction) => any;
18
+ expire: () => any;
11
19
  }, string, import("vue").PublicProps, Readonly<ToastMessageProps> & Readonly<{
12
20
  onClose?: (() => any) | undefined;
21
+ onAction?: ((action: ToastAction) => any) | undefined;
22
+ onExpire?: (() => any) | undefined;
13
23
  }>, {
24
+ actions: ToastAction[];
14
25
  detail: string;
15
26
  closable: boolean;
16
27
  closeLabel: string;
28
+ life: number;
17
29
  severity: ToastSeverity;
18
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
31
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,14 @@
1
- import { createCommentVNode as e, createElementBlock as t, createElementVNode as n, defineComponent as r, normalizeClass as i, openBlock as a, toDisplayString as o } from "vue";
1
+ import e from "../Button/Button.js";
2
+ import { Fragment as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, normalizeClass as c, normalizeStyle as l, openBlock as u, renderList as d, toDisplayString as f, withCtx as p } from "vue";
2
3
  //#region src/components/Toast/ToastMessage.vue?vue&type=script&setup=true&lang.ts
3
- var s = { class: "mb-2 flex w-full items-center gap-2.5 rounded-lg bg-sui-inverse py-2.5 pr-2.5 pl-3 text-sui-on-inverse shadow-md backdrop-blur-[10px]" }, c = { class: "flex min-w-0 flex-1 flex-col gap-0.5 text-sm leading-5" }, l = { class: "font-medium" }, u = {
4
- key: 0,
5
- class: "text-13 text-sui-on-inverse/80"
6
- }, d = ["aria-label"], f = /*@__PURE__*/ r({
4
+ var m = { class: "flex min-w-0 flex-1 flex-col gap-0.5 text-sm leading-5" }, h = {
5
+ key: 1,
6
+ class: "-mr-0.5 flex shrink-0 items-center gap-0.5 [&>button]:px-2"
7
+ }, g = {
8
+ key: 2,
9
+ "aria-hidden": "true",
10
+ class: "h-4 w-px shrink-0 bg-sui-on-inverse/20"
11
+ }, _ = ["aria-label"], v = /*@__PURE__*/ s({
7
12
  __name: "ToastMessage",
8
13
  props: {
9
14
  summary: {},
@@ -13,40 +18,70 @@ var s = { class: "mb-2 flex w-full items-center gap-2.5 rounded-lg bg-sui-invers
13
18
  type: Boolean,
14
19
  default: !0
15
20
  },
16
- closeLabel: { default: "Close" }
21
+ closeLabel: { default: "Close" },
22
+ actions: { default: () => [] },
23
+ life: { default: 0 },
24
+ paused: { type: Boolean }
17
25
  },
18
- emits: ["close"],
19
- setup(r) {
20
- let f = {
26
+ emits: [
27
+ "close",
28
+ "action",
29
+ "expire"
30
+ ],
31
+ setup(s) {
32
+ let v = {
21
33
  info: "",
22
34
  success: "bg-sui-success-mid",
35
+ warning: "bg-sui-warning-mid",
23
36
  error: "bg-sui-danger-solid"
24
37
  };
25
- return (p, m) => (a(), t("div", s, [
26
- f[r.severity] ? (a(), t("span", {
38
+ return (y, b) => (u(), i("div", { class: c(["group/toast relative mb-2 flex w-full items-center gap-2.5 rounded-lg bg-sui-inverse pr-2.5 pl-3 text-sui-on-inverse shadow-md backdrop-blur-[10px]", s.actions.length ? "overflow-hidden py-1.5" : "py-2.5"]) }, [
39
+ v[s.severity] ? (u(), i("span", {
27
40
  key: 0,
28
- class: i(["h-2 w-2 shrink-0 rounded-full", f[r.severity]])
29
- }, null, 2)) : e("", !0),
30
- n("div", c, [n("span", l, o(r.summary), 1), r.detail ? (a(), t("span", u, o(r.detail), 1)) : e("", !0)]),
31
- r.closable ? (a(), t("button", {
32
- key: 1,
33
- "aria-label": r.closeLabel,
41
+ class: c(["h-2 w-2 shrink-0 rounded-full", v[s.severity]])
42
+ }, null, 2)) : r("", !0),
43
+ a("div", m, [a("span", { class: c(["font-medium", s.actions.length ? "truncate" : ""]) }, f(s.summary), 3), s.detail ? (u(), i("span", {
44
+ key: 0,
45
+ class: c(["text-13 text-sui-on-inverse/80", s.actions.length ? "truncate" : ""])
46
+ }, f(s.detail), 3)) : r("", !0)]),
47
+ s.actions.length ? (u(), i("div", h, [(u(!0), i(t, null, d(s.actions, (t) => (u(), n(e, {
48
+ key: t.label,
49
+ size: "sm",
50
+ type: "button",
51
+ variant: "ghost-inverse",
52
+ onClick: (e) => y.$emit("action", t)
53
+ }, {
54
+ default: p(() => [o(f(t.label), 1)]),
55
+ _: 2
56
+ }, 1032, ["onClick"]))), 128))])) : r("", !0),
57
+ s.closable && s.actions.length ? (u(), i("span", g)) : r("", !0),
58
+ s.closable ? (u(), i("button", {
59
+ key: 3,
60
+ "aria-label": s.closeLabel,
34
61
  class: "flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-transparent transition duration-200 hover:bg-sui-on-inverse/[0.16] focus-visible:sui-ring-inverse",
35
62
  type: "button",
36
- onClick: m[0] ||= (e) => p.$emit("close")
37
- }, [...m[1] ||= [n("svg", {
63
+ onClick: b[0] ||= (e) => y.$emit("close")
64
+ }, [...b[2] ||= [a("svg", {
38
65
  "aria-hidden": "true",
39
66
  class: "h-3 w-3",
40
67
  fill: "none",
41
68
  viewBox: "0 0 14 14"
42
- }, [n("path", {
69
+ }, [a("path", {
43
70
  d: "M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z",
44
71
  fill: "currentColor"
45
- })], -1)]], 8, d)) : e("", !0)
46
- ]));
72
+ })], -1)]], 8, _)) : r("", !0),
73
+ s.actions.length && s.life > 0 ? (u(), i("span", {
74
+ key: 4,
75
+ "aria-hidden": "true",
76
+ class: c(["absolute inset-x-0 bottom-0 h-0.5 origin-left animate-sui-toast-timer bg-sui-on-inverse/[0.32] group-focus-within/toast:[animation-play-state:paused] group-hover/toast:[animation-play-state:paused]", s.paused && "[animation-play-state:paused]"]),
77
+ "data-sui-toast-timer": "",
78
+ style: l({ animationDuration: `${s.life}ms` }),
79
+ onAnimationend: b[1] ||= (e) => y.$emit("expire")
80
+ }, null, 38)) : r("", !0)
81
+ ], 2));
47
82
  }
48
83
  });
49
84
  //#endregion
50
- export { f as default };
85
+ export { v as default };
51
86
 
52
87
  //# sourceMappingURL=ToastMessage.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToastMessage.vue_vue_type_script_setup_true_lang.js","names":["$emit","_openBlock","_createElementBlock","_normalizeClass","_createCommentVNode","_createElementVNode","_toDisplayString","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","ToastMessage_vue_vue_type_script_setup_true_lang_default","dots","openBlock","createElementBlock","__props","normalizeClass","createCommentVNode","createElementVNode","toDisplayString","_cache","_ctx"],"sources":["../../../src/components/Toast/ToastMessage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ToastSeverity } from '../../composables/toast'\n\nexport interface ToastMessageProps {\n summary: string\n detail?: string\n severity?: ToastSeverity\n closable?: boolean\n closeLabel?: string\n}\n\nwithDefaults(defineProps<ToastMessageProps>(), {\n detail: undefined,\n severity: 'info',\n closable: true,\n closeLabel: 'Close'\n})\n\ndefineEmits<{ close: [] }>()\n\n// Info has no dot; the others lead with one of their colour.\nconst dots: Record<ToastSeverity, string> = { info: '', success: 'bg-sui-success-mid', error: 'bg-sui-danger-solid' }\n</script>\n\n<!-- One toast as drawn: the Toaster shows these, live or as a preview. -->\n<template>\n <div\n class=\"mb-2 flex w-full items-center gap-2.5 rounded-lg bg-sui-inverse py-2.5 pr-2.5 pl-3 text-sui-on-inverse shadow-md backdrop-blur-[10px]\"\n >\n <span v-if=\"dots[severity]\" class=\"h-2 w-2 shrink-0 rounded-full\" :class=\"dots[severity]\" />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5 text-sm leading-5\">\n <span class=\"font-medium\">{{ summary }}</span>\n <span v-if=\"detail\" class=\"text-13 text-sui-on-inverse/80\">{{ detail }}</span>\n </div>\n <button\n v-if=\"closable\"\n :aria-label=\"closeLabel\"\n class=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-transparent transition duration-200 hover:bg-sui-on-inverse/[0.16] focus-visible:sui-ring-inverse\"\n type=\"button\"\n @click=\"$emit('close')\"\n >\n <svg aria-hidden=\"true\" class=\"h-3 w-3\" fill=\"none\" viewBox=\"0 0 14 14\">\n <path\n d=\"M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAqBA,IAAMa,IAAsC;GAAE,MAAM;GAAI,SAAS;GAAsB,OAAO;EAAsB;E,kBAKlHZ,EAAA,GAAAC,EAsBM,OAtBNK,GAsBM;GAnBQM,EAAKG,EAAA,aAAjBf,EAAA,GAAAC,EAA4F,QAAA;;IAAhE,OAAKC,EAAA,CAAC,iCAAwCU,EAAKG,EAAA,SAAQ,CAAA;;GACvFX,EAGM,OAHNG,GAGM,CAFJH,EAA8C,QAA9CI,GAA8CH,EAAjBU,EAAA,OAAO,GAAA,CAAA,GACxBA,EAAA,UAAZf,EAAA,GAAAC,EAA8E,QAA9EQ,GAA8EJ,EAAhBU,EAAA,MAAM,GAAA,CAAA,K;GAG9DA,EAAA,YADRf,EAAA,GAAAC,EAaS,UAAA;;IAXN,cAAYc,EAAA;IACb,OAAM;IACN,MAAK;IACJ,SAAK,AAAAK,EAAA,QAAA,MAAErB,EAAAA,MAAK,OAAA;G,iBAEbK,EAKM,OAAA;IALD,eAAY;IAAO,OAAM;IAAU,MAAK;IAAO,SAAQ;G,IAC1DA,EAGE,QAAA;IAFA,GAAE;IACF,MAAK"}
1
+ {"version":3,"file":"ToastMessage.vue_vue_type_script_setup_true_lang.js","names":["$emit","_openBlock","_createElementBlock","_normalizeClass","_createCommentVNode","_createElementVNode","_toDisplayString","_Fragment","_renderList","_createBlock","Button","_withCtx","_createTextVNode","_normalizeStyle","Button_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","ToastMessage_vue_vue_type_script_setup_true_lang_default","dots","openBlock","createElementBlock","normalizeClass","__props","createCommentVNode","createElementVNode","toDisplayString","Fragment","renderList","createBlock","action","_ctx","withCtx","createTextVNode","_cache","normalizeStyle"],"sources":["../../../src/components/Toast/ToastMessage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ToastAction, ToastSeverity } from '../../composables/toast'\nimport Button from '../Button/Button.vue'\n\nexport interface ToastMessageProps {\n summary: string\n detail?: string\n severity?: ToastSeverity\n closable?: boolean\n closeLabel?: string\n /** At most two, after the message. */\n actions?: ToastAction[]\n /** With actions, a bar at the bottom counts this many ms down. */\n life?: number\n /** Holds the countdown bar, in step with the toast's timer. */\n paused?: boolean\n}\n\nwithDefaults(defineProps<ToastMessageProps>(), {\n detail: undefined,\n severity: 'info',\n closable: true,\n closeLabel: 'Close',\n actions: () => [],\n life: 0\n})\n\ndefineEmits<{ close: []; action: [action: ToastAction]; expire: [] }>()\n\n// Info has no dot; the others lead with one of their colour.\nconst dots: Record<ToastSeverity, string> = {\n info: '',\n success: 'bg-sui-success-mid',\n warning: 'bg-sui-warning-mid',\n error: 'bg-sui-danger-solid'\n}\n</script>\n\n<!-- One toast as drawn: the Toaster shows these, live or as a preview. -->\n<template>\n <div\n class=\"group/toast relative mb-2 flex w-full items-center gap-2.5 rounded-lg bg-sui-inverse pr-2.5 pl-3 text-sui-on-inverse shadow-md backdrop-blur-[10px]\"\n :class=\"actions.length ? 'overflow-hidden py-1.5' : 'py-2.5'\"\n >\n <span v-if=\"dots[severity]\" class=\"h-2 w-2 shrink-0 rounded-full\" :class=\"dots[severity]\" />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5 text-sm leading-5\">\n <span class=\"font-medium\" :class=\"actions.length ? 'truncate' : ''\">{{ summary }}</span>\n <span v-if=\"detail\" class=\"text-13 text-sui-on-inverse/80\" :class=\"actions.length ? 'truncate' : ''\">{{\n detail\n }}</span>\n </div>\n <div v-if=\"actions.length\" class=\"-mr-0.5 flex shrink-0 items-center gap-0.5 [&>button]:px-2\">\n <Button\n v-for=\"action in actions\"\n :key=\"action.label\"\n size=\"sm\"\n type=\"button\"\n variant=\"ghost-inverse\"\n @click=\"$emit('action', action)\"\n >\n {{ action.label }}\n </Button>\n </div>\n <span v-if=\"closable && actions.length\" aria-hidden=\"true\" class=\"h-4 w-px shrink-0 bg-sui-on-inverse/20\" />\n <button\n v-if=\"closable\"\n :aria-label=\"closeLabel\"\n class=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-transparent transition duration-200 hover:bg-sui-on-inverse/[0.16] focus-visible:sui-ring-inverse\"\n type=\"button\"\n @click=\"$emit('close')\"\n >\n <svg aria-hidden=\"true\" class=\"h-3 w-3\" fill=\"none\" viewBox=\"0 0 14 14\">\n <path\n d=\"M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z\"\n fill=\"currentColor\"\n />\n </svg>\n </button>\n <span\n v-if=\"actions.length && life > 0\"\n aria-hidden=\"true\"\n class=\"absolute inset-x-0 bottom-0 h-0.5 origin-left animate-sui-toast-timer bg-sui-on-inverse/[0.32] group-focus-within/toast:[animation-play-state:paused] group-hover/toast:[animation-play-state:paused]\"\n :class=\"paused && '[animation-play-state:paused]'\"\n data-sui-toast-timer\n :style=\"{ animationDuration: `${life}ms` }\"\n @animationend=\"$emit('expire')\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BA,IAAMoB,IAAsC;GAC1C,MAAM;GACN,SAAS;GACT,SAAS;GACT,OAAO;EACT;E,kBAKEnB,EAAA,GAAAC,EA+CM,OAAA,EA9CJ,OAAKC,EAAA,CAAC,uJACEqB,EAAA,QAAQ,SAAM,2BAAA,QAAA,CAAA,E;GAEVJ,EAAKI,EAAA,aAAjBvB,EAAA,GAAAC,EAA4F,QAAA;;IAAhE,OAAKC,EAAA,CAAC,iCAAwCiB,EAAKI,EAAA,SAAQ,CAAA;;GACvFnB,EAKM,OALNU,GAKM,CAJJV,EAAwF,QAAA,EAAlF,OAAKF,EAAA,CAAC,eAAsBqB,EAAA,QAAQ,SAAM,aAAA,EAAA,CAAA,EAAuB,GAAAlB,EAAAkB,EAAA,OAAO,GAAA,CAAA,GAClEA,EAAA,UAAZvB,EAAA,GAAAC,EAES,QAAA;;IAFW,OAAKC,EAAA,CAAC,kCAAyCqB,EAAA,QAAQ,SAAM,aAAA,EAAA,CAAA;GAC/E,GAAAlB,EAAAkB,EAAA,MAAM,GAAA,CAAA,K;GAGCA,EAAA,QAAQ,UAAnBvB,EAAA,GAAAC,EAWM,OAXNc,GAWM,EAVJf,EAAA,EAAA,GAAAC,EASSK,GAAA,MAAAC,EARUgB,EAAA,UAAV,OADTvB,EAAA,GAAAQ,EASSC,GAAA;IAPN,KAAKqB,EAAO;IACb,MAAK;IACL,MAAK;IACL,SAAQ;IACP,UAAK,MAAE/B,EAAAA,MAAK,UAAW+B,CAAM;;IAE9B,SAAApB,QAAkB,CAAfC,EAAAN,EAAAyB,EAAO,KAAK,GAAA,CAAA,C;;;GAGPP,EAAA,YAAYA,EAAA,QAAQ,UAAhCvB,EAAA,GAAAC,EAA4G,QAA5Ge,CAA4G,K;GAEpGO,EAAA,YADRvB,EAAA,GAAAC,EAaS,UAAA;;IAXN,cAAYsB,EAAA;IACb,OAAM;IACN,MAAK;IACJ,SAAK,AAAAW,EAAA,QAAA,MAAEnC,EAAAA,MAAK,OAAA;G,iBAEbK,EAKM,OAAA;IALD,eAAY;IAAO,OAAM;IAAU,MAAK;IAAO,SAAQ;G,IAC1DA,EAGE,QAAA;IAFA,GAAE;IACF,MAAK;;GAKHmB,EAAA,QAAQ,UAAUA,EAAA,OAAI,KAD9BvB,EAAA,GAAAC,EAQE,QAAA;;IANA,eAAY;IACZ,OAAKC,EAAA,CAAC,yMACEqB,EAAA,UAAM,+BAAA,CAAA;IACd,wBAAA;IACC,OAAKX,EAAA,EAAA,mBAAA,GAA0BW,EAAA,KAAI,IAAA,CAAA;IACnC,gBAAY,AAAAW,EAAA,QAAA,MAAEnC,EAAAA,MAAK,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.js","names":["_sfc_main","Toaster_vue_vue_type_script_setup_true_lang_default","Toaster_default"],"sources":["../../../src/components/Toast/Toaster.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToastProvider, ToastRoot, ToastViewport } from 'reka-ui'\n\nimport { type ToastSeverity, removeToast, toasts } from '../../composables/toast'\nimport ToastMessage from './ToastMessage.vue'\n\nexport interface ToastPreview {\n /** Keeps its place as the list changes, so toasts animate in and out like live ones. Defaults to its index. */\n id?: string | number\n summary: string\n detail?: string\n severity?: ToastSeverity\n closable?: boolean\n}\n\nexport interface ToasterProps {\n /** The toast region's name for assistive tech; `{hotkey}` is F8, which focuses it. */\n label?: string\n closeLabel?: string\n /**\n * Toasts drawn in place, for docs, designs and demos, instead of the live ones fixed to the viewport. The list is\n * yours: add and remove items, and handle `close`.\n */\n preview?: ToastPreview[]\n}\n\nwithDefaults(defineProps<ToasterProps>(), {\n label: 'Notifications ({hotkey})',\n closeLabel: 'Close',\n preview: undefined\n})\n\ndefineEmits<{\n /** A preview toast's close button, with its `id` (or index). */\n close: [id: string | number]\n}>()\n</script>\n\n<!-- Mount once near the app root; `toast.info(...)` and friends show here. Swiping is off. -->\n<template>\n <TransitionGroup\n v-if=\"preview\"\n class=\"flex w-full max-w-96 flex-col\"\n enter-active-class=\"animate-sui-toast-in\"\n leave-active-class=\"animate-sui-toast-out overflow-hidden\"\n tag=\"div\"\n >\n <ToastMessage\n v-for=\"(item, index) in preview\"\n :key=\"item.id ?? index\"\n :closable=\"item.closable\"\n :close-label=\"closeLabel\"\n :detail=\"item.detail\"\n :severity=\"item.severity\"\n :summary=\"item.summary\"\n @close=\"$emit('close', item.id ?? index)\"\n />\n </TransitionGroup>\n <ToastProvider v-else :swipe-threshold=\"Number.POSITIVE_INFINITY\">\n <ToastRoot\n v-for=\"item in toasts\"\n :key=\"item.id\"\n as-child\n :duration=\"item.life || Number.POSITIVE_INFINITY\"\n :open=\"item.open\"\n :type=\"item.severity === 'error' ? 'foreground' : 'background'\"\n @update:open=\"(open) => !open && removeToast(item.id)\"\n >\n <ToastMessage\n class=\"pointer-events-auto data-[state=closed]:animate-sui-toast-out data-[state=closed]:overflow-hidden data-[state=open]:animate-sui-toast-in\"\n :closable=\"item.closable\"\n :close-label=\"closeLabel\"\n :detail=\"item.detail\"\n :severity=\"item.severity\"\n :summary=\"item.summary\"\n @close=\"removeToast(item.id)\"\n />\n </ToastRoot>\n <!-- A div, not Reka's default ol: the toasts are divs, so a page can draw one alone. -->\n <ToastViewport\n as=\"div\"\n class=\"pointer-events-none fixed bottom-5 left-1/2 z-[1200] flex w-96 max-w-[calc(100vw-2.5rem)] -translate-x-1/2 flex-col rounded-md outline-hidden\"\n data-sui-toasts\n :label=\"label\"\n />\n </ToastProvider>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"Toaster.js","names":["_sfc_main","Toaster_vue_vue_type_script_setup_true_lang_default","Toaster_default"],"sources":["../../../src/components/Toast/Toaster.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { reactive } from 'vue'\n\nimport { ToastProvider, ToastRoot, ToastViewport } from 'reka-ui'\n\nimport {\n type ToastAction,\n type ToastDismissReason,\n type ToastSeverity,\n removeToast,\n toastActions,\n toasts\n} from '../../composables/toast'\nimport ToastMessage from './ToastMessage.vue'\n\nexport interface ToastPreview {\n /** Keeps its place as the list changes, so toasts animate in and out like live ones. Defaults to its index. */\n id?: string | number\n summary: string\n detail?: string\n severity?: ToastSeverity\n closable?: boolean\n action?: ToastAction\n actions?: ToastAction[]\n /** With actions, the countdown bar's length in ms; it emits `close` with `timeout` when it runs out. */\n life?: number\n}\n\nexport interface ToasterProps {\n /** The toast region's name for assistive tech; `{hotkey}` is F8, which focuses it. */\n label?: string\n closeLabel?: string\n /**\n * Toasts drawn in place, for docs, designs and demos, instead of the live ones fixed to the viewport. The list is\n * yours: add and remove items, and handle `close`.\n */\n preview?: ToastPreview[]\n}\n\nwithDefaults(defineProps<ToasterProps>(), {\n label: 'Notifications ({hotkey})',\n closeLabel: 'Close',\n preview: undefined\n})\n\nconst emit = defineEmits<{\n /** A preview toast left, with its `id` (or index): its close button, one of its actions, or its countdown. */\n close: [id: string | number, reason: ToastDismissReason]\n}>()\n\n// Reka pauses every toast's timer while the region is hovered or focused, or the window is in the background; the\n// countdown bars follow it.\nconst paused = reactive(new Set<number>())\n\nfunction runLive(id: number, action: ToastAction) {\n action.onClick()\n removeToast(id, 'action')\n}\n\nfunction runPreview(id: string | number, action: ToastAction) {\n action.onClick()\n emit('close', id, 'action')\n}\n</script>\n\n<!-- Mount once near the app root; `toast.info(...)` and friends show here. Swiping is off. -->\n<template>\n <TransitionGroup\n v-if=\"preview\"\n class=\"flex w-full max-w-96 flex-col\"\n enter-active-class=\"animate-sui-toast-in\"\n leave-active-class=\"animate-sui-toast-out overflow-hidden\"\n tag=\"div\"\n >\n <ToastMessage\n v-for=\"(item, index) in preview\"\n :key=\"item.id ?? index\"\n :actions=\"toastActions(item)\"\n :closable=\"item.closable\"\n :close-label=\"closeLabel\"\n :detail=\"item.detail\"\n :life=\"item.life\"\n :severity=\"item.severity\"\n :summary=\"item.summary\"\n @action=\"runPreview(item.id ?? index, $event)\"\n @close=\"emit('close', item.id ?? index, 'close')\"\n @expire=\"emit('close', item.id ?? index, 'timeout')\"\n />\n </TransitionGroup>\n <ToastProvider v-else :swipe-threshold=\"Number.POSITIVE_INFINITY\">\n <ToastRoot\n v-for=\"item in toasts\"\n :key=\"item.id\"\n as-child\n :duration=\"item.life || Number.POSITIVE_INFINITY\"\n :open=\"item.open\"\n :type=\"item.severity === 'error' ? 'foreground' : 'background'\"\n @escape-key-down=\"removeToast(item.id, 'close')\"\n @pause=\"paused.add(item.id)\"\n @resume=\"paused.delete(item.id)\"\n @update:open=\"(open) => !open && removeToast(item.id, 'timeout')\"\n >\n <ToastMessage\n :actions=\"item.actions\"\n class=\"pointer-events-auto data-[state=closed]:animate-sui-toast-out data-[state=closed]:overflow-hidden data-[state=open]:animate-sui-toast-in\"\n :closable=\"item.closable\"\n :close-label=\"closeLabel\"\n :detail=\"item.detail\"\n :life=\"item.life\"\n :paused=\"paused.has(item.id)\"\n :severity=\"item.severity\"\n :summary=\"item.summary\"\n @action=\"runLive(item.id, $event)\"\n @close=\"removeToast(item.id, 'close')\"\n />\n </ToastRoot>\n <!-- A div, not Reka's default ol: the toasts are divs, so a page can draw one alone. -->\n <ToastViewport\n as=\"div\"\n class=\"pointer-events-none fixed bottom-5 left-1/2 z-[1200] flex w-96 max-w-[calc(100vw-2.5rem)] -translate-x-1/2 flex-col rounded-md outline-hidden\"\n data-sui-toasts\n :label=\"label\"\n />\n </ToastProvider>\n</template>\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { type ToastSeverity } from '../../composables/toast';
1
+ import { type ToastAction, type ToastDismissReason, type ToastSeverity } from '../../composables/toast';
2
2
  export interface ToastPreview {
3
3
  /** Keeps its place as the list changes, so toasts animate in and out like live ones. Defaults to its index. */
4
4
  id?: string | number;
@@ -6,6 +6,10 @@ export interface ToastPreview {
6
6
  detail?: string;
7
7
  severity?: ToastSeverity;
8
8
  closable?: boolean;
9
+ action?: ToastAction;
10
+ actions?: ToastAction[];
11
+ /** With actions, the countdown bar's length in ms; it emits `close` with `timeout` when it runs out. */
12
+ life?: number;
9
13
  }
10
14
  export interface ToasterProps {
11
15
  /** The toast region's name for assistive tech; `{hotkey}` is F8, which focuses it. */
@@ -18,9 +22,9 @@ export interface ToasterProps {
18
22
  preview?: ToastPreview[];
19
23
  }
20
24
  declare const __VLS_export: import("vue").DefineComponent<ToasterProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
- close: (id: string | number) => any;
25
+ close: (id: string | number, reason: ToastDismissReason) => any;
22
26
  }, string, import("vue").PublicProps, Readonly<ToasterProps> & Readonly<{
23
- onClose?: ((id: string | number) => any) | undefined;
27
+ onClose?: ((id: string | number, reason: ToastDismissReason) => any) | undefined;
24
28
  }>, {
25
29
  label: string;
26
30
  closeLabel: string;
@@ -1,9 +1,9 @@
1
- import { removeToast as e, toasts as t } from "../../composables/toast.js";
2
- import n from "./ToastMessage.js";
3
- import { Fragment as r, TransitionGroup as i, createBlock as a, createElementBlock as o, createVNode as s, defineComponent as c, openBlock as l, renderList as u, unref as d, withCtx as f } from "vue";
4
- import { ToastProvider as p, ToastRoot as m, ToastViewport as h } from "reka-ui";
1
+ import { removeToast as e, toastActions as t, toasts as n } from "../../composables/toast.js";
2
+ import r from "./ToastMessage.js";
3
+ import { Fragment as i, TransitionGroup as a, createBlock as o, createElementBlock as s, createVNode as c, defineComponent as l, openBlock as u, reactive as d, renderList as f, unref as p, withCtx as m } from "vue";
4
+ import { ToastProvider as h, ToastRoot as g, ToastViewport as _ } from "reka-ui";
5
5
  //#region src/components/Toast/Toaster.vue?vue&type=script&setup=true&lang.ts
6
- var g = /*@__PURE__*/ c({
6
+ var v = /*@__PURE__*/ l({
7
7
  __name: "Toaster",
8
8
  props: {
9
9
  label: { default: "Notifications ({hotkey})" },
@@ -11,57 +11,83 @@ var g = /*@__PURE__*/ c({
11
11
  preview: { default: void 0 }
12
12
  },
13
13
  emits: ["close"],
14
- setup(c) {
15
- return (g, _) => c.preview ? (l(), a(i, {
14
+ setup(l, { emit: v }) {
15
+ let y = v, b = d(/* @__PURE__ */ new Set());
16
+ function x(t, n) {
17
+ n.onClick(), e(t, "action");
18
+ }
19
+ function S(e, t) {
20
+ t.onClick(), y("close", e, "action");
21
+ }
22
+ return (d, v) => l.preview ? (u(), o(a, {
16
23
  key: 0,
17
24
  class: "flex w-full max-w-96 flex-col",
18
25
  "enter-active-class": "animate-sui-toast-in",
19
26
  "leave-active-class": "animate-sui-toast-out overflow-hidden",
20
27
  tag: "div"
21
28
  }, {
22
- default: f(() => [(l(!0), o(r, null, u(c.preview, (e, t) => (l(), a(n, {
23
- key: e.id ?? t,
29
+ default: m(() => [(u(!0), s(i, null, f(l.preview, (e, n) => (u(), o(r, {
30
+ key: e.id ?? n,
31
+ actions: p(t)(e),
24
32
  closable: e.closable,
25
- "close-label": c.closeLabel,
33
+ "close-label": l.closeLabel,
26
34
  detail: e.detail,
35
+ life: e.life,
27
36
  severity: e.severity,
28
37
  summary: e.summary,
29
- onClose: (n) => g.$emit("close", e.id ?? t)
38
+ onAction: (t) => S(e.id ?? n, t),
39
+ onClose: (t) => y("close", e.id ?? n, "close"),
40
+ onExpire: (t) => y("close", e.id ?? n, "timeout")
30
41
  }, null, 8, [
42
+ "actions",
31
43
  "closable",
32
44
  "close-label",
33
45
  "detail",
46
+ "life",
34
47
  "severity",
35
48
  "summary",
36
- "onClose"
49
+ "onAction",
50
+ "onClose",
51
+ "onExpire"
37
52
  ]))), 128))]),
38
53
  _: 1
39
- })) : (l(), a(d(p), {
54
+ })) : (u(), o(p(h), {
40
55
  key: 1,
41
56
  "swipe-threshold": Infinity
42
57
  }, {
43
- default: f(() => [(l(!0), o(r, null, u(d(t), (t) => (l(), a(d(m), {
58
+ default: m(() => [(u(!0), s(i, null, f(p(n), (t) => (u(), o(p(g), {
44
59
  key: t.id,
45
60
  "as-child": "",
46
61
  duration: t.life || Infinity,
47
62
  open: t.open,
48
63
  type: t.severity === "error" ? "foreground" : "background",
49
- "onUpdate:open": (n) => !n && d(e)(t.id)
64
+ onEscapeKeyDown: (n) => p(e)(t.id, "close"),
65
+ onPause: (e) => b.add(t.id),
66
+ onResume: (e) => b.delete(t.id),
67
+ "onUpdate:open": (n) => !n && p(e)(t.id, "timeout")
50
68
  }, {
51
- default: f(() => [s(n, {
69
+ default: m(() => [c(r, {
70
+ actions: t.actions,
52
71
  class: "pointer-events-auto data-[state=closed]:animate-sui-toast-out data-[state=closed]:overflow-hidden data-[state=open]:animate-sui-toast-in",
53
72
  closable: t.closable,
54
- "close-label": c.closeLabel,
73
+ "close-label": l.closeLabel,
55
74
  detail: t.detail,
75
+ life: t.life,
76
+ paused: b.has(t.id),
56
77
  severity: t.severity,
57
78
  summary: t.summary,
58
- onClose: (n) => d(e)(t.id)
79
+ onAction: (e) => x(t.id, e),
80
+ onClose: (n) => p(e)(t.id, "close")
59
81
  }, null, 8, [
82
+ "actions",
60
83
  "closable",
61
84
  "close-label",
62
85
  "detail",
86
+ "life",
87
+ "paused",
63
88
  "severity",
64
89
  "summary",
90
+ "onAction",
65
91
  "onClose"
66
92
  ])]),
67
93
  _: 2
@@ -69,18 +95,21 @@ var g = /*@__PURE__*/ c({
69
95
  "duration",
70
96
  "open",
71
97
  "type",
98
+ "onEscapeKeyDown",
99
+ "onPause",
100
+ "onResume",
72
101
  "onUpdate:open"
73
- ]))), 128)), s(d(h), {
102
+ ]))), 128)), c(p(_), {
74
103
  as: "div",
75
104
  class: "pointer-events-none fixed bottom-5 left-1/2 z-[1200] flex w-96 max-w-[calc(100vw-2.5rem)] -translate-x-1/2 flex-col rounded-md outline-hidden",
76
105
  "data-sui-toasts": "",
77
- label: c.label
106
+ label: l.label
78
107
  }, null, 8, ["label"])]),
79
108
  _: 1
80
109
  }, 8, ["swipe-threshold"]));
81
110
  }
82
111
  });
83
112
  //#endregion
84
- export { g as default };
113
+ export { v as default };
85
114
 
86
115
  //# sourceMappingURL=Toaster.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.vue_vue_type_script_setup_true_lang.js","names":["$emit","_openBlock","_createBlock","_TransitionGroup","_withCtx","_createElementBlock","_Fragment","_renderList","ToastMessage","_unref","_createVNode","ToastMessage_default","Toaster_vue_vue_type_script_setup_true_lang_default","__props","openBlock","createBlock","TransitionGroup","withCtx","createElementBlock","Fragment","renderList","item","index","_ctx","unref","ToastProvider","toasts","ToastRoot","open","removeToast","createVNode","ToastViewport"],"sources":["../../../src/components/Toast/Toaster.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ToastProvider, ToastRoot, ToastViewport } from 'reka-ui'\n\nimport { type ToastSeverity, removeToast, toasts } from '../../composables/toast'\nimport ToastMessage from './ToastMessage.vue'\n\nexport interface ToastPreview {\n /** Keeps its place as the list changes, so toasts animate in and out like live ones. Defaults to its index. */\n id?: string | number\n summary: string\n detail?: string\n severity?: ToastSeverity\n closable?: boolean\n}\n\nexport interface ToasterProps {\n /** The toast region's name for assistive tech; `{hotkey}` is F8, which focuses it. */\n label?: string\n closeLabel?: string\n /**\n * Toasts drawn in place, for docs, designs and demos, instead of the live ones fixed to the viewport. The list is\n * yours: add and remove items, and handle `close`.\n */\n preview?: ToastPreview[]\n}\n\nwithDefaults(defineProps<ToasterProps>(), {\n label: 'Notifications ({hotkey})',\n closeLabel: 'Close',\n preview: undefined\n})\n\ndefineEmits<{\n /** A preview toast's close button, with its `id` (or index). */\n close: [id: string | number]\n}>()\n</script>\n\n<!-- Mount once near the app root; `toast.info(...)` and friends show here. Swiping is off. -->\n<template>\n <TransitionGroup\n v-if=\"preview\"\n class=\"flex w-full max-w-96 flex-col\"\n enter-active-class=\"animate-sui-toast-in\"\n leave-active-class=\"animate-sui-toast-out overflow-hidden\"\n tag=\"div\"\n >\n <ToastMessage\n v-for=\"(item, index) in preview\"\n :key=\"item.id ?? index\"\n :closable=\"item.closable\"\n :close-label=\"closeLabel\"\n :detail=\"item.detail\"\n :severity=\"item.severity\"\n :summary=\"item.summary\"\n @close=\"$emit('close', item.id ?? index)\"\n />\n </TransitionGroup>\n <ToastProvider v-else :swipe-threshold=\"Number.POSITIVE_INFINITY\">\n <ToastRoot\n v-for=\"item in toasts\"\n :key=\"item.id\"\n as-child\n :duration=\"item.life || Number.POSITIVE_INFINITY\"\n :open=\"item.open\"\n :type=\"item.severity === 'error' ? 'foreground' : 'background'\"\n @update:open=\"(open) => !open && removeToast(item.id)\"\n >\n <ToastMessage\n class=\"pointer-events-auto data-[state=closed]:animate-sui-toast-out data-[state=closed]:overflow-hidden data-[state=open]:animate-sui-toast-in\"\n :closable=\"item.closable\"\n :close-label=\"closeLabel\"\n :detail=\"item.detail\"\n :severity=\"item.severity\"\n :summary=\"item.summary\"\n @close=\"removeToast(item.id)\"\n />\n </ToastRoot>\n <!-- A div, not Reka's default ol: the toasts are divs, so a page can draw one alone. -->\n <ToastViewport\n as=\"div\"\n class=\"pointer-events-none fixed bottom-5 left-1/2 z-[1200] flex w-96 max-w-[calc(100vw-2.5rem)] -translate-x-1/2 flex-col rounded-md outline-hidden\"\n data-sui-toasts\n :label=\"label\"\n />\n </ToastProvider>\n</template>\n"],"mappings":";;;;;;;;;;;;;;E,iBAyCUa,EAAA,WADRZ,EAAA,GAAAC,EAiBkBC,GAAA;;GAfhB,OAAM;GACN,sBAAmB;GACnB,sBAAmB;GACnB,KAAI;;GAGF,SAAAC,QAAgC,EADlCH,EAAA,EAAA,GAAAI,EASEC,GAAA,MAAAC,EARwBM,EAAA,UAAhB,GAAM,OADhBZ,EAAA,GAAAC,EASEM,GAAA;IAPC,KAAKa,EAAK,MAAMC;IAChB,UAAUD,EAAK;IACf,eAAaR,EAAA;IACb,QAAQQ,EAAK;IACb,UAAUA,EAAK;IACf,SAASA,EAAK;IACd,UAAK,MAAErB,EAAAA,MAAK,SAAUqB,EAAK,MAAMC,CAAK;;;;;;;;;;E,OAG3CrB,EAAA,GAAAC,EA2BgBO,EAAAgB,CAAA,GAAA;;GA3BO,mBAAiB;;GAEpC,SAAArB,QAAsB,EADxBH,EAAA,EAAA,GAAAI,EAkBYC,GAAA,MAAAC,EAjBKE,EAAAiB,CAAA,IAAR,OADTzB,EAAA,GAAAC,EAkBYO,EAAAkB,CAAA,GAAA;IAhBT,KAAKN,EAAK;IACX,YAAA;IACC,UAAUA,EAAK,QAAQ;IACvB,MAAMA,EAAK;IACX,MAAMA,EAAK,aAAQ,UAAA,eAAA;IACnB,kBAAc,MAAI,CAAMO,KAAQnB,EAAAoB,CAAA,CAAW,CAACR,EAAK,EAAE;;IAEpD,SAAAjB,QAQE,CARFM,EAQEF,GAAA;KAPA,OAAM;KACL,UAAUa,EAAK;KACf,eAAaR,EAAA;KACb,QAAQQ,EAAK;KACb,UAAUA,EAAK;KACf,SAASA,EAAK;KACd,UAAK,MAAEZ,EAAAoB,CAAA,CAAW,CAACR,EAAK,EAAE;;;;;;;;;;;;;;;G,aAI/BX,EAKED,EAAAsB,CAAA,GAAA;IAJA,IAAG;IACH,OAAM;IACN,mBAAA;IACC,OAAOlB,EAAA"}
1
+ {"version":3,"file":"Toaster.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_TransitionGroup","_withCtx","_createElementBlock","_Fragment","_renderList","ToastMessage","_unref","_createVNode","ToastMessage_default","Toaster_vue_vue_type_script_setup_true_lang_default","__emit","emit","paused","reactive","runLive","action","removeToast","id","runPreview","__props","openBlock","createBlock","TransitionGroup","withCtx","createElementBlock","Fragment","renderList","item","index","unref","toastActions","$event","ToastProvider","toasts","ToastRoot","open","createVNode","ToastViewport"],"sources":["../../../src/components/Toast/Toaster.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { reactive } from 'vue'\n\nimport { ToastProvider, ToastRoot, ToastViewport } from 'reka-ui'\n\nimport {\n type ToastAction,\n type ToastDismissReason,\n type ToastSeverity,\n removeToast,\n toastActions,\n toasts\n} from '../../composables/toast'\nimport ToastMessage from './ToastMessage.vue'\n\nexport interface ToastPreview {\n /** Keeps its place as the list changes, so toasts animate in and out like live ones. Defaults to its index. */\n id?: string | number\n summary: string\n detail?: string\n severity?: ToastSeverity\n closable?: boolean\n action?: ToastAction\n actions?: ToastAction[]\n /** With actions, the countdown bar's length in ms; it emits `close` with `timeout` when it runs out. */\n life?: number\n}\n\nexport interface ToasterProps {\n /** The toast region's name for assistive tech; `{hotkey}` is F8, which focuses it. */\n label?: string\n closeLabel?: string\n /**\n * Toasts drawn in place, for docs, designs and demos, instead of the live ones fixed to the viewport. The list is\n * yours: add and remove items, and handle `close`.\n */\n preview?: ToastPreview[]\n}\n\nwithDefaults(defineProps<ToasterProps>(), {\n label: 'Notifications ({hotkey})',\n closeLabel: 'Close',\n preview: undefined\n})\n\nconst emit = defineEmits<{\n /** A preview toast left, with its `id` (or index): its close button, one of its actions, or its countdown. */\n close: [id: string | number, reason: ToastDismissReason]\n}>()\n\n// Reka pauses every toast's timer while the region is hovered or focused, or the window is in the background; the\n// countdown bars follow it.\nconst paused = reactive(new Set<number>())\n\nfunction runLive(id: number, action: ToastAction) {\n action.onClick()\n removeToast(id, 'action')\n}\n\nfunction runPreview(id: string | number, action: ToastAction) {\n action.onClick()\n emit('close', id, 'action')\n}\n</script>\n\n<!-- Mount once near the app root; `toast.info(...)` and friends show here. Swiping is off. -->\n<template>\n <TransitionGroup\n v-if=\"preview\"\n class=\"flex w-full max-w-96 flex-col\"\n enter-active-class=\"animate-sui-toast-in\"\n leave-active-class=\"animate-sui-toast-out overflow-hidden\"\n tag=\"div\"\n >\n <ToastMessage\n v-for=\"(item, index) in preview\"\n :key=\"item.id ?? index\"\n :actions=\"toastActions(item)\"\n :closable=\"item.closable\"\n :close-label=\"closeLabel\"\n :detail=\"item.detail\"\n :life=\"item.life\"\n :severity=\"item.severity\"\n :summary=\"item.summary\"\n @action=\"runPreview(item.id ?? index, $event)\"\n @close=\"emit('close', item.id ?? index, 'close')\"\n @expire=\"emit('close', item.id ?? index, 'timeout')\"\n />\n </TransitionGroup>\n <ToastProvider v-else :swipe-threshold=\"Number.POSITIVE_INFINITY\">\n <ToastRoot\n v-for=\"item in toasts\"\n :key=\"item.id\"\n as-child\n :duration=\"item.life || Number.POSITIVE_INFINITY\"\n :open=\"item.open\"\n :type=\"item.severity === 'error' ? 'foreground' : 'background'\"\n @escape-key-down=\"removeToast(item.id, 'close')\"\n @pause=\"paused.add(item.id)\"\n @resume=\"paused.delete(item.id)\"\n @update:open=\"(open) => !open && removeToast(item.id, 'timeout')\"\n >\n <ToastMessage\n :actions=\"item.actions\"\n class=\"pointer-events-auto data-[state=closed]:animate-sui-toast-out data-[state=closed]:overflow-hidden data-[state=open]:animate-sui-toast-in\"\n :closable=\"item.closable\"\n :close-label=\"closeLabel\"\n :detail=\"item.detail\"\n :life=\"item.life\"\n :paused=\"paused.has(item.id)\"\n :severity=\"item.severity\"\n :summary=\"item.summary\"\n @action=\"runLive(item.id, $event)\"\n @close=\"removeToast(item.id, 'close')\"\n />\n </ToastRoot>\n <!-- A div, not Reka's default ol: the toasts are divs, so a page can draw one alone. -->\n <ToastViewport\n as=\"div\"\n class=\"pointer-events-none fixed bottom-5 left-1/2 z-[1200] flex w-96 max-w-[calc(100vw-2.5rem)] -translate-x-1/2 flex-col rounded-md outline-hidden\"\n data-sui-toasts\n :label=\"label\"\n />\n </ToastProvider>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EA6CA,IAAMa,IAAOD,GAOPE,IAASC,kBAAS,IAAI,IAAY,CAAC;EAEzC,SAASC,EAAQ,GAAY,GAAqB;GAEhD,AADAC,EAAO,QAAQ,GACfC,EAAYC,GAAI,QAAQ;EAC1B;EAEA,SAASC,EAAW,GAAqB,GAAqB;GAE5D,AADAH,EAAO,QAAQ,GACfJ,EAAK,SAASM,GAAI,QAAQ;EAC5B;E,iBAMUE,EAAA,WADRrB,EAAA,GAAAC,EAqBkBC,GAAA;;GAnBhB,OAAM;GACN,sBAAmB;GACnB,sBAAmB;GACnB,KAAI;;GAGF,SAAAC,QAAgC,EADlCH,EAAA,EAAA,GAAAI,EAaEC,GAAA,MAAAC,EAZwBe,EAAA,UAAhB,GAAM,OADhBrB,EAAA,GAAAC,EAaEM,GAAA;IAXC,KAAKsB,EAAK,MAAMC;IAChB,SAAStB,EAAAwB,CAAA,CAAY,CAACH,CAAI;IAC1B,UAAUA,EAAK;IACf,eAAaR,EAAA;IACb,QAAQQ,EAAK;IACb,MAAMA,EAAK;IACX,UAAUA,EAAK;IACf,SAASA,EAAK;IACd,WAAM,MAAET,EAAWS,EAAK,MAAMC,GAAOG,CAAM;IAC3C,UAAK,MAAEpB,EAAI,SAAUgB,EAAK,MAAMC,GAAK,OAAA;IACrC,WAAM,MAAEjB,EAAI,SAAUgB,EAAK,MAAMC,GAAK,SAAA;;;;;;;;;;;;;;E,OAG3C9B,EAAA,GAAAC,EAkCgBO,EAAA0B,CAAA,GAAA;;GAlCO,mBAAiB;;GAEpC,SAAA/B,QAAsB,EADxBH,EAAA,EAAA,GAAAI,EAyBYC,GAAA,MAAAC,EAxBKE,EAAA2B,CAAA,IAAR,OADTnC,EAAA,GAAAC,EAyBYO,EAAA4B,CAAA,GAAA;IAvBT,KAAKP,EAAK;IACX,YAAA;IACC,UAAUA,EAAK,QAAQ;IACvB,MAAMA,EAAK;IACX,MAAMA,EAAK,aAAQ,UAAA,eAAA;IACnB,kBAAe,MAAErB,EAAAU,CAAA,CAAW,CAACW,EAAK,IAAE,OAAA;IACpC,UAAK,MAAEf,EAAO,IAAIe,EAAK,EAAE;IACzB,WAAM,MAAEf,EAAO,OAAOe,EAAK,EAAE;IAC7B,kBAAc,MAAI,CAAMQ,KAAQ7B,EAAAU,CAAA,CAAW,CAACW,EAAK,IAAE,SAAA;;IAEpD,SAAA1B,QAYE,CAZFM,EAYEF,GAAA;KAXC,SAASsB,EAAK;KACf,OAAM;KACL,UAAUA,EAAK;KACf,eAAaR,EAAA;KACb,QAAQQ,EAAK;KACb,MAAMA,EAAK;KACX,QAAQf,EAAO,IAAIe,EAAK,EAAE;KAC1B,UAAUA,EAAK;KACf,SAASA,EAAK;KACd,WAAM,MAAEb,EAAQa,EAAK,IAAII,CAAM;KAC/B,UAAK,MAAEzB,EAAAU,CAAA,CAAW,CAACW,EAAK,IAAE,OAAA;;;;;;;;;;;;;;;;;;;;;;G,aAI/BpB,EAKED,EAAA+B,CAAA,GAAA;IAJA,IAAG;IACH,OAAM;IACN,mBAAA;IACC,OAAOlB,EAAA"}
@@ -0,0 +1,7 @@
1
+ import e from "./MenuItemContent.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/internal/MenuItemContent.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=MenuItemContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuItemContent.js","names":["_sfc_main","MenuItemContent_vue_vue_type_script_setup_true_lang_default","MenuItemContent_default"],"sources":["../../../src/components/internal/MenuItemContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport Icon from '../Icon/Icon.vue'\nimport type { DropdownMenuAction } from './menu'\n\ndefineProps<{ item: DropdownMenuAction }>()\n</script>\n\n<!-- One menu item as drawn: an icon, the label and a shortcut. -->\n<template>\n <div\n class=\"flex cursor-pointer items-center gap-2.5 px-2.5 py-1.5\"\n :class=\"item.variant === 'danger' ? 'text-sui-danger' : 'text-sui-ink'\"\n >\n <Icon\n v-if=\"item.icon\"\n class=\"h-4 w-4 shrink-0\"\n :color=\"item.variant === 'danger' ? 'danger' : 'ink-muted'\"\n :name=\"item.icon\"\n />\n <span class=\"flex-1 text-13\">{{ item.label }}</span>\n <span v-if=\"item.shortcut\" class=\"text-11 text-sui-ink-muted\">{{ item.shortcut }}</span>\n </div>\n</template>\n"],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { DropdownMenuAction } from './menu';
2
+ type __VLS_Props = {
3
+ item: DropdownMenuAction;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import e from "../Icon/Icon.js";
2
+ import { createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, normalizeClass as o, openBlock as s, toDisplayString as c } from "vue";
3
+ //#region src/components/internal/MenuItemContent.vue?vue&type=script&setup=true&lang.ts
4
+ var l = { class: "flex-1 text-13" }, u = {
5
+ key: 1,
6
+ class: "text-11 text-sui-ink-muted"
7
+ }, d = /*@__PURE__*/ a({
8
+ __name: "MenuItemContent",
9
+ props: { item: {} },
10
+ setup(a) {
11
+ return (d, f) => (s(), r("div", { class: o(["flex cursor-pointer items-center gap-2.5 px-2.5 py-1.5", a.item.variant === "danger" ? "text-sui-danger" : "text-sui-ink"]) }, [
12
+ a.item.icon ? (s(), t(e, {
13
+ key: 0,
14
+ class: "h-4 w-4 shrink-0",
15
+ color: a.item.variant === "danger" ? "danger" : "ink-muted",
16
+ name: a.item.icon
17
+ }, null, 8, ["color", "name"])) : n("", !0),
18
+ i("span", l, c(a.item.label), 1),
19
+ a.item.shortcut ? (s(), r("span", u, c(a.item.shortcut), 1)) : n("", !0)
20
+ ], 2));
21
+ }
22
+ });
23
+ //#endregion
24
+ export { d as default };
25
+
26
+ //# sourceMappingURL=MenuItemContent.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuItemContent.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_createBlock","Icon","_createCommentVNode","_createElementVNode","_toDisplayString","Icon_default","_hoisted_1","_hoisted_2","MenuItemContent_vue_vue_type_script_setup_true_lang_default","openBlock","createElementBlock","normalizeClass","__props","createBlock","createCommentVNode","createElementVNode","toDisplayString"],"sources":["../../../src/components/internal/MenuItemContent.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport Icon from '../Icon/Icon.vue'\nimport type { DropdownMenuAction } from './menu'\n\ndefineProps<{ item: DropdownMenuAction }>()\n</script>\n\n<!-- One menu item as drawn: an icon, the label and a shortcut. -->\n<template>\n <div\n class=\"flex cursor-pointer items-center gap-2.5 px-2.5 py-1.5\"\n :class=\"item.variant === 'danger' ? 'text-sui-danger' : 'text-sui-ink'\"\n >\n <Icon\n v-if=\"item.icon\"\n class=\"h-4 w-4 shrink-0\"\n :color=\"item.variant === 'danger' ? 'danger' : 'ink-muted'\"\n :name=\"item.icon\"\n />\n <span class=\"flex-1 text-13\">{{ item.label }}</span>\n <span v-if=\"item.shortcut\" class=\"text-11 text-sui-ink-muted\">{{ item.shortcut }}</span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;E,kBASEA,EAAA,GAAAC,EAYM,OAAA,EAXJ,OAAKC,EAAA,CAAC,0DACEa,EAAA,KAAK,YAAO,WAAA,oBAAA,cAAA,CAAA,E;GAGZA,EAAA,KAAK,QADbf,EAAA,GAAAG,EAKEC,GAAA;;IAHA,OAAM;IACL,OAAOW,EAAA,KAAK,YAAO,WAAA,WAAA;IACnB,MAAMA,EAAA,KAAK;;GAEdT,EAAoD,QAApDG,GAAoDF,EAApBQ,EAAA,KAAK,KAAK,GAAA,CAAA;GAC9BA,EAAA,KAAK,YAAjBf,EAAA,GAAAC,EAAwF,QAAxFS,GAAwFH,EAAvBQ,EAAA,KAAK,QAAQ,GAAA,CAAA,K"}
@@ -0,0 +1,46 @@
1
+ export interface DropdownMenuAction {
2
+ type: 'action';
3
+ label: string;
4
+ action?: string;
5
+ icon?: string;
6
+ variant?: 'danger';
7
+ shortcut?: string;
8
+ /** Asks first, with this wording; `confirmed: true` asks with the generic wording. */
9
+ confirm?: {
10
+ message: string;
11
+ title?: string;
12
+ acceptLabel?: string;
13
+ };
14
+ confirmed?: boolean;
15
+ [key: string]: unknown;
16
+ }
17
+ export type DropdownMenuEntry = DropdownMenuAction | {
18
+ type: 'separator';
19
+ };
20
+ /** The confirm step's wording, shared by DropdownMenu and ContextMenu. */
21
+ export interface MenuConfirmLabels {
22
+ /** Passed back with every clicked item, e.g. the record the menu acts on. */
23
+ id?: string;
24
+ confirmTitle?: string;
25
+ confirmMessage?: string;
26
+ confirmLabel?: string;
27
+ deleteLabel?: string;
28
+ cancelLabel?: string;
29
+ }
30
+ export declare const menuConfirmDefaults: {
31
+ id: undefined;
32
+ confirmTitle: string;
33
+ confirmMessage: string;
34
+ confirmLabel: string;
35
+ deleteLabel: string;
36
+ cancelLabel: string;
37
+ };
38
+ export declare const menuContentClass = "z-[1100] rounded-xl border border-sui-line-subtle bg-sui-surface p-1 shadow-lg outline-hidden data-[state=open]:animate-sui-menu-in";
39
+ export declare const menuItemClass = "relative rounded-lg text-sm text-sui-ink transition-colors duration-150 outline-hidden hover:bg-sui-sunken focus-visible:sui-ring-inset data-highlighted:bg-sui-sunken";
40
+ export declare const menuSeparatorClass = "my-1 border-t border-sui-line-subtle";
41
+ /** Runs an item: asks first when it says so, then emits it with the menu's `id`. */
42
+ export declare function useMenuSelect(props: Required<Omit<MenuConfirmLabels, 'id'>> & {
43
+ id?: string;
44
+ }, emit: (item: DropdownMenuAction & {
45
+ id?: string;
46
+ }) => void): (item: DropdownMenuAction) => Promise<void>;
@@ -0,0 +1,33 @@
1
+ import { useConfirm as e } from "../../composables/useConfirm.js";
2
+ //#region src/components/internal/menu.ts
3
+ var t = {
4
+ id: void 0,
5
+ confirmTitle: "Are you sure?",
6
+ confirmMessage: "This can't be undone.",
7
+ confirmLabel: "Confirm",
8
+ deleteLabel: "Delete",
9
+ cancelLabel: "Cancel"
10
+ }, n = "z-[1100] rounded-xl border border-sui-line-subtle bg-sui-surface p-1 shadow-lg outline-hidden data-[state=open]:animate-sui-menu-in", r = "relative rounded-lg text-sm text-sui-ink transition-colors duration-150 outline-hidden hover:bg-sui-sunken focus-visible:sui-ring-inset data-highlighted:bg-sui-sunken", i = "my-1 border-t border-sui-line-subtle";
11
+ function a(t, n) {
12
+ let r = e();
13
+ return async function(e) {
14
+ if (e.confirm || e.confirmed) {
15
+ let n = e.variant === "danger" || e.action === "delete";
16
+ if (!await r({
17
+ title: e.confirm?.title ?? t.confirmTitle,
18
+ message: e.confirm?.message ?? t.confirmMessage,
19
+ cancelLabel: t.cancelLabel,
20
+ confirmLabel: e.confirm?.acceptLabel ?? (e.action === "delete" ? t.deleteLabel : t.confirmLabel),
21
+ confirmVariant: n ? "danger" : "primary"
22
+ })) return;
23
+ }
24
+ n({
25
+ id: t.id,
26
+ ...e
27
+ });
28
+ };
29
+ }
30
+ //#endregion
31
+ export { t as menuConfirmDefaults, n as menuContentClass, r as menuItemClass, i as menuSeparatorClass, a as useMenuSelect };
32
+
33
+ //# sourceMappingURL=menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.js","names":["menuConfirmDefaults","menuContentClass","menuItemClass","menuSeparatorClass","useMenuSelect","confirm","useConfirm","item","destructive","props"],"sources":["../../../src/components/internal/menu.ts"],"sourcesContent":["import { useConfirm } from '../../composables/useConfirm'\n\nexport interface DropdownMenuAction {\n type: 'action'\n label: string\n action?: string\n icon?: string\n variant?: 'danger'\n shortcut?: string\n /** Asks first, with this wording; `confirmed: true` asks with the generic wording. */\n confirm?: { message: string; title?: string; acceptLabel?: string }\n confirmed?: boolean\n [key: string]: unknown\n}\n\nexport type DropdownMenuEntry = DropdownMenuAction | { type: 'separator' }\n\n/** The confirm step's wording, shared by DropdownMenu and ContextMenu. */\nexport interface MenuConfirmLabels {\n /** Passed back with every clicked item, e.g. the record the menu acts on. */\n id?: string\n confirmTitle?: string\n confirmMessage?: string\n confirmLabel?: string\n deleteLabel?: string\n cancelLabel?: string\n}\n\nexport const menuConfirmDefaults = {\n id: undefined,\n confirmTitle: 'Are you sure?',\n confirmMessage: \"This can't be undone.\",\n confirmLabel: 'Confirm',\n deleteLabel: 'Delete',\n cancelLabel: 'Cancel'\n}\n\nexport const menuContentClass =\n 'z-[1100] rounded-xl border border-sui-line-subtle bg-sui-surface p-1 shadow-lg outline-hidden data-[state=open]:animate-sui-menu-in'\nexport const menuItemClass =\n 'relative rounded-lg text-sm text-sui-ink transition-colors duration-150 outline-hidden hover:bg-sui-sunken focus-visible:sui-ring-inset data-highlighted:bg-sui-sunken'\nexport const menuSeparatorClass = 'my-1 border-t border-sui-line-subtle'\n\n/** Runs an item: asks first when it says so, then emits it with the menu's `id`. */\nexport function useMenuSelect(\n props: Required<Omit<MenuConfirmLabels, 'id'>> & { id?: string },\n emit: (item: DropdownMenuAction & { id?: string }) => void\n) {\n const confirm = useConfirm()\n\n return async function select(item: DropdownMenuAction) {\n if (item.confirm || item.confirmed) {\n const destructive = item.variant === 'danger' || item.action === 'delete'\n const confirmed = await confirm({\n title: item.confirm?.title ?? props.confirmTitle,\n message: item.confirm?.message ?? props.confirmMessage,\n cancelLabel: props.cancelLabel,\n confirmLabel: item.confirm?.acceptLabel ?? (item.action === 'delete' ? props.deleteLabel : props.confirmLabel),\n confirmVariant: destructive ? 'danger' : 'primary'\n })\n if (!confirmed) return\n }\n emit({ id: props.id, ...item })\n }\n}\n"],"mappings":";;AA4BA,IAAaA,IAAsB;CACjC,IAAI,KAAA;CACJ,cAAc;CACd,gBAAgB;CAChB,cAAc;CACd,aAAa;CACb,aAAa;AACf,GAEaC,IACX,uIACWC,IACX,0KACWC,IAAqB;AAGlC,SAAgBC,EACd,GACA,GACA;CACA,IAAMC,IAAUC,EAAW;CAE3B,OAAO,eAAsB,GAA0B;EACrD,IAAIC,EAAK,WAAWA,EAAK,WAAW;GAClC,IAAMC,IAAcD,EAAK,YAAY,YAAYA,EAAK,WAAW;GAQjE,IAAI,CAAC,MAPmBF,EAAQ;IAC9B,OAAOE,EAAK,SAAS,SAASE,EAAM;IACpC,SAASF,EAAK,SAAS,WAAWE,EAAM;IACxC,aAAaA,EAAM;IACnB,cAAcF,EAAK,SAAS,gBAAgBA,EAAK,WAAW,WAAWE,EAAM,cAAcA,EAAM;IACjG,gBAAgBD,IAAc,WAAW;GAC3C,CAAC,GACe;EAClB;EACA,EAAK;GAAE,IAAIC,EAAM;GAAI,GAAGF;EAAK,CAAC;CAChC;AACF"}
@@ -1,23 +1,38 @@
1
- export type ToastSeverity = 'info' | 'success' | 'error';
1
+ export type ToastSeverity = 'info' | 'success' | 'warning' | 'error';
2
+ /** A button on the toast: pressing it runs `onClick`, then closes the toast. */
3
+ export interface ToastAction {
4
+ label: string;
5
+ onClick: () => void;
6
+ }
7
+ /** Why a toast left: one of its actions, its close button (or Escape), or its timer running out. */
8
+ export type ToastDismissReason = 'action' | 'close' | 'timeout';
2
9
  export interface ToastOptions {
3
10
  /** A second line under the message. */
4
11
  detail?: string;
5
- /** How long it stays, in ms; 0 keeps it until closed. */
12
+ /** How long it stays, in ms; 0 keeps it until closed. 3000 by default, 6000 with an action. */
6
13
  life?: number;
7
14
  closable?: boolean;
15
+ action?: ToastAction;
16
+ /** One or two; any more are ignored. */
17
+ actions?: ToastAction[];
18
+ onDismiss?: (reason: ToastDismissReason) => void;
8
19
  }
9
- export interface ToastItem extends ToastOptions {
20
+ export interface ToastItem extends Omit<ToastOptions, 'action'> {
10
21
  id: number;
11
22
  severity: ToastSeverity;
12
23
  summary: string;
24
+ actions: ToastAction[];
13
25
  open: boolean;
14
26
  }
27
+ /** A toast's actions, from `action` or `actions`, at most two. */
28
+ export declare function toastActions(options: Pick<ToastOptions, 'action' | 'actions'>): ToastAction[];
15
29
  export declare const toasts: import("vue").ShallowReactive<ToastItem[]>;
16
- /** Removes a toast once its closing animation has had time to play. */
17
- export declare function removeToast(id: number): void;
30
+ /** Closes a toast, then removes it once its closing animation has had time to play. */
31
+ export declare function removeToast(id: number, reason?: ToastDismissReason): void;
18
32
  /** Shows a message in the app's <Toaster />: `toast.info('Saved')`. */
19
33
  export declare const toast: {
20
34
  info: (summary: string, options?: ToastOptions) => void;
21
35
  success: (summary: string, options?: ToastOptions) => void;
36
+ warning: (summary: string, options?: ToastOptions) => void;
22
37
  error: (summary: string, options?: ToastOptions) => void;
23
38
  };