@wow-two-beta/fe 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/feedback/FeedbackBus.d.ts +154 -29
- package/dist/feedback/FeedbackBus.js +264 -27
- package/dist/feedback/FeedbackBus.js.map +1 -1
- package/dist/feedback/index.d.ts +1 -1
- package/dist/feedback/index.js +3 -1
- package/dist/foundation/dom/enums/ElementTag.d.ts +2 -0
- package/dist/foundation/dom/enums/ElementTag.js +3 -1
- package/dist/foundation/dom/enums/ElementTag.js.map +1 -1
- package/dist/index.js +325 -312
- package/dist/index.js.map +1 -1
- package/dist/presentation/display/index.js +105 -102
- package/dist/presentation/display/index.js.map +1 -1
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.d.ts +18 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.js +120 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton2.vue.js +5 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton2.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.d.ts +11 -6
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js +255 -61
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js.map +1 -1
- package/dist/presentation/display/notificationCenterGroup/{NotificationItem.vue.d.ts → NotificationCenterGroupItem.vue.d.ts} +13 -12
- package/dist/presentation/display/notificationCenterGroup/{NotificationItem.vue.js → NotificationCenterGroupItem.vue.js} +81 -58
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js +5 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/index.d.ts +6 -1
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.d.ts +1 -9
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.js +165 -20
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.js.map +1 -1
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.d.ts +7 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.js +56 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.js.map +1 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton2.vue.js +5 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton2.vue.js.map +1 -0
- package/dist/presentation/feedback/index.js +9 -1
- package/dist/presentation/feedback/index.js.map +1 -1
- package/dist/presentation/feedback/toast/Toast.vue.d.ts +34 -8
- package/dist/presentation/feedback/toast/Toast.vue.js +290 -85
- package/dist/presentation/feedback/toast/Toast.vue.js.map +1 -1
- package/dist/presentation/feedback/toast/ToastContent.vue.d.ts +25 -0
- package/dist/presentation/feedback/toast/ToastContent.vue.js +78 -0
- package/dist/presentation/feedback/toast/ToastContent.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastContent2.vue.js +5 -0
- package/dist/presentation/feedback/toast/ToastContent2.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.d.ts +15 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.js +88 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress2.vue.js +5 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress2.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastSurface.d.ts +8 -0
- package/dist/presentation/feedback/toast/ToastSurface.js +10 -0
- package/dist/presentation/feedback/toast/ToastSurface.js.map +1 -0
- package/dist/presentation/feedback/toast/index.d.ts +1 -0
- package/dist/presentation/feedback/toastHost/ToastContent.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/ToastEntry.d.ts +12 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.d.ts +2 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.js +11 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastGroup.d.ts +8 -0
- package/dist/presentation/feedback/toastHost/ToastGroupLatest.d.ts +10 -0
- package/dist/presentation/feedback/toastHost/ToastHost.vue.d.ts +55 -110
- package/dist/presentation/feedback/toastHost/ToastHost.vue.js +394 -399
- package/dist/presentation/feedback/toastHost/ToastHost.vue.js.map +1 -1
- package/dist/presentation/feedback/toastHost/ToastHost2.vue.js +4 -5
- package/dist/presentation/feedback/toastHost/ToastHostStore.d.ts +37 -0
- package/dist/presentation/feedback/toastHost/ToastHostStore.js +98 -0
- package/dist/presentation/feedback/toastHost/ToastHostStore.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.d.ts +34 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.js +44 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastNode.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/ToastOptions.d.ts +72 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.d.ts +11 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.js +44 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastProgress2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastProgress2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastPromiseOptions.d.ts +12 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.d.ts +14 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.js +65 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastRing2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastRing2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.d.ts +9 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.js +56 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeverity.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.d.ts +27 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.js +34 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.d.ts +14 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.js +106 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.d.ts +34 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.js +128 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.d.ts +44 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.js +134 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.d.ts +26 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.js +23 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.d.ts +4 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.js +17 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.d.ts +11 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.js +52 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.d.ts +43 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.js +173 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.d.ts +10 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.js +14 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.d.ts +20 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.js +66 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.d.ts +26 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.js +35 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.d.ts +27 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.js +96 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.d.ts +19 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.js +173 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.js.map +1 -0
- package/dist/presentation/feedback/toastHost/index.d.ts +8 -1
- package/dist/presentation/feedback/toastHost/index.js +7 -1
- package/dist/presentation/feedback/toastHost/index.js.map +1 -1
- package/dist/presentation/feedback/toastHost/styles.css +14 -2
- package/dist/presentation/layout/grid/Grid.variants.d.ts +7 -0
- package/dist/presentation/layout/grid/Grid.variants.js +4 -0
- package/dist/presentation/layout/grid/Grid.variants.js.map +1 -1
- package/dist/presentation/layout/grid/Grid.vue.d.ts +5 -0
- package/dist/presentation/layout/grid/Grid.vue.js +16 -4
- package/dist/presentation/layout/grid/Grid.vue.js.map +1 -1
- package/dist/presentation/layout/grid/index.d.ts +1 -1
- package/dist/presentation/layout/index.js +3 -1
- package/dist/presentation/layout/navbar/Navbar.vue.js.map +1 -1
- package/dist/presentation/overlays/popover/PopoverContent.vue.js +4 -4
- package/dist/presentation/overlays/popover/PopoverContent.vue.js.map +1 -1
- package/dist/presentation/overlays/tooltip/Tooltip.vue.js +8 -9
- package/dist/presentation/overlays/tooltip/Tooltip.vue.js.map +1 -1
- package/package.json +1 -1
- package/dist/presentation/display/notificationCenterGroup/NotificationItem.vue.js.map +0 -1
- package/dist/presentation/display/notificationCenterGroup/NotificationItem2.vue.js +0 -5
- package/dist/presentation/display/notificationCenterGroup/NotificationItem2.vue.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.vue.js","sources":["../../../../src/presentation/feedback/toast/Toast.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Severity } from '../../../foundation/styles';\n\nexport interface ToastProps {\n /** The semantic severity palette. */\n readonly severity?: Severity;\n /** The optional leading icon. Rich content → the `icon` slot. */\n readonly icon?: string;\n /** The bold heading line. Rich content → the `title` slot. */\n readonly title?: string;\n /** The body text below the title. Rich content → the `description` slot. */\n readonly description?: string;\n /** The action area below the body. Rich content → the `actions` slot. */\n readonly actions?: string;\n /** The accessible label for the close button. Default `\"Dismiss\"`. */\n readonly closeLabel?: string;\n /** The accessible label for removing a retained notice. Default \"Delete notification\". */\n readonly deleteLabel?: string;\n /**\n * Shows the severity's own glyph when no `icon` is given — a distinct shape per severity, so the meaning\n * never rests on colour alone. `neutral` has none. Default `true`.\n */\n readonly showSeverityIcon?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocaleDefaults } from '../../../foundation/i18n';\nimport { computed, getCurrentInstance, useAttrs, useSlots, useTemplateRef } from 'vue';\nimport { Trash2, X } from 'lucide-vue-next';\nimport { cn, Severity as SeverityToken } from '../../../foundation/styles';\nimport { Icon, SeverityIconClasses, SeverityIcons } from '../../../foundation/icons';\nimport ToastSimple from '../toastSimple/ToastSimple.vue';\n\nconst CloseIcon = X;\n\n/**\n * Renders a toast card — icon, title, description, actions, and a close button.\n * Visual only (queue / portal / lifecycle land with `ToastHost` at L5); the atom is `ToastSimple`.\n *\n * Each of React's four `ReactNode` props keeps its string form and gains a\n * same-named slot for rich content; the slot wins when both are supplied.\n */\ndefineOptions({ name: 'Toast', inheritAttrs: false });\n\nconst componentProps = withDefaults(defineProps<ToastProps>(), { showSeverityIcon: true });\nconst props = useLocaleDefaults(componentProps, 'Toast', { closeLabel: 'Dismiss', deleteLabel: 'Delete notification' });\n\n/** Replaces React's `onClose`; omitting `@close` omits the close button. */\nconst emit = defineEmits<{\n /** Fires when the close button is activated. */\n close: [];\n /** Fires when the delete icon is activated; only rendered when bound for retained notices. */\n delete: [];\n}>();\n\ndefineSlots<{\n /** The extra content below the description. */\n default?(): unknown;\n /** The leading icon. Falls back to the `icon` prop. */\n icon?(): unknown;\n /** The heading line. Falls back to the `title` prop. */\n title?(): unknown;\n /** The body text below the title. Falls back to the `description` prop. */\n description?(): unknown;\n /** The action row. Falls back to the `actions` prop. */\n actions?(): unknown;\n /** The adornment beside the close button — a countdown, a timestamp. */\n trailing?(): unknown;\n}>();\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst instance = getCurrentInstance();\nconst inner = useTemplateRef<InstanceType<typeof ToastSimple>>('inner');\n\n/**\n * Mirrors React's `onClose && <button/>` guard — the close button renders only\n * when the consumer bound `@close`. Read through a call, not a cached computed:\n * `instance.vnode` is replaced on every re-render.\n */\nconst hasClose = () => Boolean(instance?.vnode.props?.onClose);\nconst hasDelete = () => Boolean(instance?.vnode.props?.onDelete);\n\n/**\n * The glyph standing in for a missing `icon` — `null` when switched off, or for a neutral toast. An `icon`\n * slot replaces it as the slot's fallback content, so slot presence stays out of this cached value.\n */\nconst severityIcon = computed(() =>\n props.showSeverityIcon && !props.icon ? SeverityIcons[props.severity ?? SeverityToken.Neutral] : null,\n);\nconst severityIconClass = computed(() => SeverityIconClasses[props.severity ?? SeverityToken.Neutral]);\n\n/*\n * Slot presence is read through calls, not cached computeds: `slots` is not reactive, and a host that updates a\n * toast in place (a promise settling, a dedup refresh) adds or drops slots between renders.\n */\nconst hasIcon = () => Boolean(props.icon) || Boolean(slots.icon) || severityIcon.value !== null;\nconst hasTitle = () => Boolean(props.title) || Boolean(slots.title);\nconst hasDescription = () => Boolean(props.description) || Boolean(slots.description);\nconst hasActions = () => Boolean(props.actions) || Boolean(slots.actions);\n\nconst classes = computed(() => cn('flex items-start gap-3', attrs.class as string | undefined));\n\nconst descriptionClasses = () => cn('text-sm', hasTitle() && 'mt-0.5 text-muted-foreground');\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/** Re-exposes the underlying `ToastSimple` root element, matching React's forwarded ref. */\nconst el = computed(() => inner.value?.el ?? null);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <ToastSimple ref=\"inner\" :severity=\"props.severity\" v-bind=\"rest\" :class=\"classes\">\n <span v-if=\"hasIcon()\" data-toast-icon class=\"mt-0.5 shrink-0\">\n <slot name=\"icon\">\n <Icon v-if=\"severityIcon\" :icon=\"severityIcon\" :size=\"16\" :class=\"severityIconClass\" />\n <template v-else>{{ props.icon }}</template>\n </slot>\n </span>\n <div class=\"min-w-0 flex-1\">\n <div v-if=\"hasTitle()\" class=\"font-medium\">\n <slot name=\"title\">{{ props.title }}</slot>\n </div>\n <div v-if=\"hasDescription()\" :class=\"descriptionClasses()\">\n <slot name=\"description\">{{ props.description }}</slot>\n </div>\n <div v-if=\"hasActions()\" class=\"mt-2 flex flex-wrap items-center gap-2\">\n <slot name=\"actions\">{{ props.actions }}</slot>\n </div>\n <slot />\n </div>\n <span v-if=\"slots.trailing\" class=\"flex h-5 shrink-0 items-center\">\n <slot name=\"trailing\" />\n </span>\n <button\n v-if=\"hasDelete()\"\n type=\"button\"\n :aria-label=\"props.deleteLabel\"\n class=\"grid h-6 w-6 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring\"\n @click=\"emit('delete')\"\n >\n <Icon :icon=\"Trash2\" :size=\"14\" />\n </button>\n <button\n v-if=\"hasClose()\"\n type=\"button\"\n :aria-label=\"props.closeLabel\"\n class=\"-mr-1 grid h-6 w-6 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring\"\n @click=\"emit('close')\"\n >\n <Icon :icon=\"CloseIcon\" :size=\"14\" />\n </button>\n </ToastSimple>\n</template>\n"],"names":["SeverityToken","_openBlock","_createBlock","ToastSimple","_mergeProps","_unref","_createElementBlock","_renderSlot","Icon","_Fragment","_createTextVNode","_toDisplayString","_createElementVNode","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,UAAM,YAAY;AAWlB,UAAM,iBAAiB;AACvB,UAAM,QAAQ,kBAAkB,gBAAgB,SAAS,EAAE,YAAY,WAAW,aAAa,uBAAuB;AAGtH,UAAM,OAAO;AAsBb,UAAM,QAAQ,SAAA;AACd,UAAM,QAAQ,SAAA;AACd,UAAM,WAAW,mBAAA;AACjB,UAAM,QAAQ,eAAiD,OAAO;AAOtE,UAAM,WAAW,MAAM,QAAQ,UAAU,MAAM,OAAO,OAAO;AAC7D,UAAM,YAAY,MAAM,QAAQ,UAAU,MAAM,OAAO,QAAQ;AAM/D,UAAM,eAAe;AAAA,MAAS,MAC5B,MAAM,oBAAoB,CAAC,MAAM,OAAO,cAAc,MAAM,YAAYA,SAAc,OAAO,IAAI;AAAA,IAAA;AAEnG,UAAM,oBAAoB,SAAS,MAAM,oBAAoB,MAAM,YAAYA,SAAc,OAAO,CAAC;AAMrG,UAAM,UAAU,MAAM,QAAQ,MAAM,IAAI,KAAK,QAAQ,MAAM,IAAI,KAAK,aAAa,UAAU;AAC3F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AA,EAAM,KAAK,GAAA,CAAA;AAAA,cAAA;;YAExB,iCAAXC,mBAEM,OAAA;AAAA;cAFwB,sBAAO,mBAAA,CAAkB;AAAA,YAAA;cACrDC,WAAuD,gCAAvD,MAAuD;AAAA,gBAA3BG,gBAAAC,gBAAAN,MAAA,KAAA,EAAM,WAAW,GAAA,CAAA;AAAA,cAAA;;YAEpC,gBAAXJ,UAAA,GAAAK,mBAEM,OAFN,YAEM;AAAA,cADJC,WAA+C,4BAA/C,MAA+C;AAAA,gBAAvBG,gBAAAC,gBAAAN,MAAA,KAAA,EAAM,OAAO,GAAA,CAAA;AAAA,cAAA;;YAEvCE,WAAQ,KAAA,QAAA,SAAA;AAAA,UAAA;UAEEF,MAAA,KAAA,EAAM,YAAlBJ,aAAAK,mBAEO,QAFP,YAEO;AAAA,YADLC,WAAwB,KAAA,QAAA,UAAA;AAAA,UAAA;UAGlB,4BADRD,mBAQS,UAAA;AAAA;YANP,MAAK;AAAA,YACJ,cAAYD,MAAA,KAAA,EAAM;AAAA,YACnB,OAAM;AAAA,YACL,+CAAO,KAAI,QAAA;AAAA,UAAA;YAEZQ,YAAkCR,MAAAG,WAAA,GAAA;AAAA,cAA3B,MAAMH,MAAA,MAAA;AAAA,cAAS,MAAM;AAAA,YAAA;;UAGtB,2BADRC,mBAQS,UAAA;AAAA;YANP,MAAK;AAAA,YACJ,cAAYD,MAAA,KAAA,EAAM;AAAA,YACnB,OAAM;AAAA,YACL,+CAAO,KAAI,OAAA;AAAA,UAAA;YAEZQ,YAAqCR,MAAAG,WAAA,GAAA;AAAA,cAA9B,MAAMH,MAAA,SAAA;AAAA,cAAY,MAAM;AAAA,YAAA;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Toast.vue.js","sources":["../../../../src/presentation/feedback/toast/Toast.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { ChevronDown, Pin, Trash2, X } from 'lucide-vue-next';\n\nimport type { NoticeProgress } from '../../../feedback';\nimport { cn, Severity } from '../../../foundation/styles';\nimport { ToastSurface } from './ToastSurface';\n\n/** Defines props for the toast card. */\nexport interface ToastProps {\n /** The semantic severity palette. */\n readonly severity?: Severity;\n\n /** The optional leading icon. Rich content → the `icon` slot. */\n readonly icon?: string;\n\n /** The bold heading line. Rich content → the `title` slot. */\n readonly title?: string;\n\n /** The body text below the title. Rich content → the `description` slot. */\n readonly description?: string;\n\n /** The action area below the body. Rich content → the `actions` slot. */\n readonly actions?: string;\n\n /** The accessible label for the close button. Default `\"Dismiss\"`. */\n readonly closeLabel?: string;\n\n /** The accessible label for removing a retained notice. Default \"Delete notification\". */\n readonly deleteLabel?: string;\n\n /** The pin toggle's pressed state; the toggle renders only when this is supplied. */\n readonly isPinned?: boolean;\n\n /** The accessible label for the pin toggle. Default \"Pin notification\". */\n readonly pinLabel?: string;\n\n /** The tooltip shown on a pinned toggle. Default \"Unpin notification\". */\n readonly unpinLabel?: string;\n\n /** The details disclosure's open state; supplying it makes the disclosure controlled. */\n readonly detailsOpen?: boolean;\n\n /** The compact layout, which places actions alongside the copy and wraps them as space requires. */\n readonly isCompact?: boolean;\n\n /** @internal The grouped layout, which fits the details viewport to at most three complete rows. */\n readonly isGrouped?: boolean;\n\n /** The switch for the severity's own glyph, shown when no `icon` is given; `neutral` has none. Default `true`. */\n readonly showSeverityIcon?: boolean;\n\n /** The card material. Default `ToastSurface.Solid`. */\n readonly surface?: ToastSurface;\n\n /** The running operation's progress, shown under the copy when supplied. */\n readonly progress?: NoticeProgress;\n\n /** Fires when the close button is activated; the button renders only when this is supplied. */\n readonly onClose?: () => void;\n\n /** Fires when the delete button is activated; the button renders only when this is supplied. */\n readonly onDelete?: () => void;\n}\n\n/** @internal The glyph on the close button. */\nconst CloseIcon = X;\n\n/** @internal The glass material's utilities, keyed on `data-toast-surface`. */\nconst GlassClasses = [\n 'data-[toast-surface=glass]:surface-glass-menu',\n 'data-[toast-surface=glass]:[box-shadow:var(--glass-menu-shadow,0_10px_15px_-3px_rgb(0_0_0/0.1),0_4px_6px_-4px_rgb(0_0_0/0.1)),inset_0_1px_0_var(--glass-highlight,transparent)]',\n];\n\n/** @internal The glass hairline, taken only by the neutral card — a severity's own border keeps its accent. */\nconst GlassEdgeClass = 'data-[toast-surface=glass]:border-glass-edge';\n\n/** @internal The classes shared by the card's icon-only controls. */\nconst IconControlClass =\n 'grid size-6 shrink-0 place-items-center rounded-full text-muted-foreground transition-colors ' +\n 'hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 ' +\n 'focus-visible:ring-ring pointer-coarse:size-9';\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, onBeforeUpdate, onUpdated, ref, useAttrs, useId, useSlots, useTemplateRef, watch } from 'vue';\n\nimport { useLocale, useLocaleDefaults } from '../../../foundation/i18n';\nimport { Icon, SeverityIconClasses, SeverityIcons } from '../../../foundation/icons';\nimport { Button } from '../../actions/button';\nimport ToastSimple from '../toastSimple/ToastSimple.vue';\nimport ToastContent from './ToastContent.vue';\nimport ToastRunningProgress from './ToastRunningProgress.vue';\n\n/** Renders a transient toast card — icon, title, description, actions and close. */\ndefineOptions({ name: 'Toast', inheritAttrs: false });\n\nconst componentProps = withDefaults(defineProps<ToastProps>(), {\n showSeverityIcon: true,\n isPinned: undefined,\n detailsOpen: undefined,\n});\nconst props = useLocaleDefaults(componentProps, 'Toast', {\n closeLabel: 'Dismiss',\n deleteLabel: 'Delete notification',\n pinLabel: 'Pin notification',\n unpinLabel: 'Unpin notification',\n});\n\nconst emit = defineEmits<{\n /** Requests a change to the pin toggle's pressed state. */\n togglePin: [];\n /** Requests expanding or collapsing the details panel. */\n 'update:detailsOpen': [value: boolean];\n}>();\n\ndefineSlots<{\n /** The extra content below the description. */\n default?(): unknown;\n /** The leading icon. Falls back to the `icon` prop. */\n icon?(): unknown;\n /** The heading line. Falls back to the `title` prop. */\n title?(): unknown;\n /** The body text below the title. Falls back to the `description` prop. */\n description?(): unknown;\n /** The action row. Falls back to the `actions` prop. */\n actions?(): unknown;\n /** Extra content shown on demand below the summary and its controls. */\n details?(): unknown;\n /** The adornment beside the close button — a countdown, a timestamp. */\n trailing?(): unknown;\n /** The decorative indicator wrapping the close glyph. */\n closeIndicator?(): unknown;\n}>();\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst locale = useLocale();\nconst inner = useTemplateRef<InstanceType<typeof ToastSimple>>('inner');\nconst header = useTemplateRef<HTMLDivElement>('header');\nconst details = useTemplateRef<HTMLDivElement>('details');\nconst detailsId = useId();\nconst titleId = useId();\n\nconst localExpanded = ref(false);\nlet readingAnchor: { row: HTMLElement; offset: number } | undefined;\n\n/** Whether the details disclosure is open — the controlled `detailsOpen`, else the card's own state. */\nconst isDetailsOpen = computed(() => props.detailsOpen ?? localExpanded.value);\n\n/** The glyph standing in for a missing `icon`, or `null` when switched off or for a neutral toast. */\nconst severityIcon = computed(() =>\n props.showSeverityIcon && !props.icon ? SeverityIcons[props.severity ?? Severity.Neutral] : null,\n);\nconst severityIconClass = computed(() => SeverityIconClasses[props.severity ?? Severity.Neutral]);\n\nconst isGlass = computed(() => props.surface === ToastSurface.Glass);\n\nconst classes = computed(() =>\n cn(\n 'min-w-0 [overflow-wrap:anywhere]',\n isGlass.value && GlassClasses,\n isGlass.value && (props.severity ?? Severity.Neutral) === Severity.Neutral && GlassEdgeClass,\n props.isCompact && 'py-2',\n props.isGrouped && 'flex max-h-(--toast-available-height) flex-col overflow-hidden p-0',\n attrs.class as string | undefined,\n ),\n);\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/** The underlying `ToastSimple` root element. */\nconst el = computed(() => inner.value?.el ?? null);\n\ndefineExpose({ el });\n\nwatch(\n [details, isDetailsOpen, () => props.isGrouped],\n ([viewport, open, grouped], _previous, onCleanup) => {\n if (!viewport || !open || !grouped) {\n if (viewport?.style.maxHeight) viewport.style.removeProperty('max-height');\n return;\n }\n fitGroupDetails();\n const observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(fitGroupDetails);\n if (header.value) observer?.observe(header.value);\n if (viewport.firstElementChild) observer?.observe(viewport.firstElementChild);\n window.addEventListener('resize', fitGroupDetails);\n onCleanup(() => {\n observer?.disconnect();\n window.removeEventListener('resize', fitGroupDetails);\n });\n },\n { flush: 'post' },\n);\n\nonBeforeUpdate(() => {\n const viewport = details.value;\n if (!props.isGrouped || !isDetailsOpen.value || !viewport) return;\n if (viewport.scrollTop === 0 && !viewport.contains(document.activeElement)) return;\n const row = Array.from(groupRows(viewport)).find((item) => item.offsetTop + item.offsetHeight > viewport.scrollTop);\n if (row) readingAnchor = { row, offset: row.offsetTop - viewport.scrollTop };\n});\n\nonUpdated(() => {\n fitGroupDetails();\n const viewport = details.value;\n if (viewport && readingAnchor && viewport.contains(readingAnchor.row)) {\n viewport.scrollTop = readingAnchor.row.offsetTop - readingAnchor.offset;\n }\n readingAnchor = undefined;\n});\n\n/** Opens or closes the details panel, announcing the change through `update:detailsOpen`. */\nfunction toggleDetails(): void {\n const next = !isDetailsOpen.value;\n localExpanded.value = next;\n emit('update:detailsOpen', next);\n}\n\n// Slot presence is read through calls, never cached — `slots` is not reactive.\nfunction hasIcon(): boolean {\n return Boolean(props.icon) || Boolean(slots.icon) || severityIcon.value !== null;\n}\n\nfunction hasTitle(): boolean {\n return Boolean(props.title) || Boolean(slots.title);\n}\n\nfunction hasDescription(): boolean {\n return Boolean(props.description) || Boolean(slots.description);\n}\n\nfunction hasActions(): boolean {\n return Boolean(props.actions) || Boolean(slots.actions);\n}\n\n/** Lists the member rows of an expanded group's details viewport. */\nfunction groupRows(viewport: HTMLElement): NodeListOf<HTMLElement> {\n return viewport.querySelectorAll<HTMLElement>(':scope > ul > [data-toast-group-row]');\n}\n\n/** Sums an element's vertical padding and border widths, in px. */\nfunction blockEdges(style: CSSStyleDeclaration): number {\n return [style.paddingTop, style.paddingBottom, style.borderTopWidth, style.borderBottomWidth].reduce(\n (sum, value) => sum + (Number.parseFloat(value) || 0),\n 0,\n );\n}\n\n/** Caps the grouped details viewport at its first three complete rows, within the card's available height. */\nfunction fitGroupDetails(): void {\n if (!props.isGrouped || !isDetailsOpen.value || !details.value || !header.value || !el.value) return;\n const viewport = details.value;\n const rows = groupRows(viewport);\n const first = rows[0];\n if (!first) return;\n\n const surfaceStyle = getComputedStyle(el.value);\n const viewportStyle = getComputedStyle(viewport);\n const boxEdges = blockEdges(viewportStyle);\n const limit = Number.parseFloat(surfaceStyle.maxHeight);\n const chrome =\n header.value.offsetHeight + blockEdges(surfaceStyle) + (Number.parseFloat(viewportStyle.marginTop) || 0);\n const room = Number.isFinite(limit) ? Math.max(0, limit - chrome - boxEdges) : window.innerHeight * 0.55;\n let height = 0;\n for (const row of Array.from(rows).slice(0, 3)) {\n if (height + row.offsetHeight > room) break;\n height += row.offsetHeight;\n }\n // A single long row can scroll when even that row exceeds the viewport.\n const cap = `${boxEdges + (height || Math.min(first.offsetHeight, room))}px`;\n if (viewport.style.maxHeight !== cap) viewport.style.maxHeight = cap;\n}\n</script>\n\n<template>\n <ToastSimple\n ref=\"inner\"\n :severity=\"props.severity\"\n data-toast-card\n :data-toast-surface=\"isGlass ? ToastSurface.Glass : undefined\"\n v-bind=\"rest\"\n :class=\"classes\"\n >\n <div\n ref=\"header\"\n class=\"flex shrink-0 items-start gap-3\"\n :class=\"props.isGrouped && ['px-3', props.isCompact ? 'py-2' : 'py-3']\"\n >\n <span v-if=\"hasIcon()\" data-toast-icon class=\"mt-0.5 shrink-0\">\n <slot name=\"icon\">\n <Icon v-if=\"severityIcon\" :icon=\"severityIcon\" :size=\"16\" :class=\"severityIconClass\" />\n <template v-else>{{ props.icon }}</template>\n </slot>\n </span>\n <ToastContent class=\"min-w-0 flex-1\" :is-compact=\"props.isCompact\" :title-id=\"titleId\">\n <template v-if=\"hasTitle()\" #title>\n <slot name=\"title\">{{ props.title }}</slot>\n </template>\n <template v-if=\"hasDescription()\" #description>\n <slot name=\"description\">{{ props.description }}</slot>\n </template>\n <template v-if=\"props.progress\" #progress>\n <ToastRunningProgress\n :progress=\"props.progress\"\n :severity=\"props.severity\"\n :is-compact=\"props.isCompact\"\n :aria-labelledby=\"hasTitle() ? titleId : undefined\"\n />\n </template>\n <template v-if=\"hasActions() || slots.details\" #actions>\n <slot name=\"actions\">{{ props.actions }}</slot>\n <Button\n v-if=\"slots.details\"\n size=\"xs\"\n variant=\"ghost\"\n :aria-expanded=\"isDetailsOpen\"\n :aria-controls=\"detailsId\"\n @click=\"toggleDetails\"\n >\n <template #trailing\n ><Icon :icon=\"ChevronDown\" :size=\"12\" :class=\"{ 'rotate-180': isDetailsOpen }\"\n /></template>\n {{\n isDetailsOpen\n ? locale.t('Toast.hideDetails', undefined, 'Hide details')\n : locale.t('Toast.showDetails', undefined, 'Show details')\n }}\n </Button>\n </template>\n <template v-if=\"slots.default\" #default><slot /></template>\n </ToastContent>\n <button\n v-if=\"props.isPinned !== undefined\"\n type=\"button\"\n :aria-label=\"props.pinLabel\"\n :aria-pressed=\"props.isPinned\"\n :title=\"props.isPinned ? props.unpinLabel : props.pinLabel\"\n :class=\"cn(IconControlClass, props.isPinned && 'bg-primary-soft text-primary-soft-foreground')\"\n @mousedown.prevent\n @click=\"emit('togglePin')\"\n >\n <Icon :icon=\"Pin\" :size=\"14\" :class=\"props.isPinned ? 'fill-current' : undefined\" />\n </button>\n <button\n v-if=\"props.onDelete\"\n type=\"button\"\n :aria-label=\"props.deleteLabel\"\n :class=\"IconControlClass\"\n @click=\"props.onDelete()\"\n >\n <Icon :icon=\"Trash2\" :size=\"14\" />\n </button>\n <span v-if=\"slots.trailing\" class=\"flex h-5 shrink-0 items-center\">\n <slot name=\"trailing\" />\n </span>\n <button\n v-if=\"props.onClose\"\n type=\"button\"\n :aria-label=\"props.closeLabel\"\n :class=\"cn(IconControlClass, 'relative -mr-1')\"\n @click=\"props.onClose()\"\n >\n <span v-if=\"slots.closeIndicator\" aria-hidden=\"true\" class=\"pointer-events-none absolute inset-0\">\n <slot name=\"closeIndicator\" />\n </span>\n <Icon :icon=\"CloseIcon\" :size=\"14\" />\n </button>\n </div>\n <div\n v-if=\"slots.details\"\n v-show=\"isDetailsOpen\"\n :id=\"detailsId\"\n ref=\"details\"\n data-toast-details\n class=\"relative max-h-[min(18rem,55dvh)] overflow-y-auto overscroll-contain border-t border-border\"\n :class=\"props.isGrouped ? 'scroll-py-1 [overflow-anchor:none]' : 'mt-2 pt-2'\"\n >\n <slot v-if=\"isDetailsOpen\" name=\"details\" />\n </div>\n </ToastSimple>\n</template>\n"],"names":["_openBlock","_createBlock","ToastSimple","_mergeProps","_unref","_createElementVNode","_normalizeClass","_createElementBlock","_renderSlot","Icon","_Fragment","_createTextVNode","_toDisplayString","_createVNode","ToastContent","ToastRunningProgress","Button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,YAAY;AAGlB,MAAM,eAAe;AAAA,EACnB;AAAA,EACA;AACF;AAGA,MAAM,iBAAiB;AAGvB,MAAM,mBACJ;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBF,UAAM,iBAAiB;AAKvB,UAAM,QAAQ,kBAAkB,gBAAgB,SAAS;AAAA,MACvD,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,UAAU;AAAA,MACV,YAAY;AAAA,IAAA,CACb;AAED,UAAM,OAAO;AA0Bb,UAAM,QAAQ,SAAA;AACd,UAAM,QAAQ,SAAA;AACd,UAAM,SAAS,UAAA;AACf,UAAM,QAAQ,eAAiD,OAAO;AACtE,UAAM,SAAS,eAA+B,QAAQ;AACtD,UAAM,UAAU,eAA+B,SAAS;AACxD,UAAM,YAAY,MAAA;AAClB,UAAM,UAAU,MAAA;AAEhB,UAAM,gBAAgB,IAAI,KAAK;AAC/B,QAAI;AAGJ,UAAM,gBAAgB,SAAS,MAAM,MAAM,eAAe,cAAc,KAAK;AAG7E,UAAM,eAAe;AAAA,MAAS,MAC5B,MAAM,oBAAoB,CAAC,MAAM,OAAO,cAAc,MAAM,Y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ACEF,MAAA,KAAA,EAAM,YAAS,uCAAA,WAAA,CAAA;AAAA,UAAA;YAEX,cAAA,QAAZI,WAA4C,KAAA,QAAA,WAAA,IAAA,QAAA,QAAA,CAAA;;oBAPpC,cAAA,KAAa;AAAA,UAAA;;;;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Defines props for the toast card's copy column. */
|
|
2
|
+
export interface ToastContentProps {
|
|
3
|
+
/** The compact layout, which wraps the copy, actions and progress into one row. */
|
|
4
|
+
readonly isCompact?: boolean;
|
|
5
|
+
/** The id given to the title element, so the running progress can name itself after it. */
|
|
6
|
+
readonly titleId?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<ToastContentProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ToastContentProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
9
|
+
/** The heading line. */
|
|
10
|
+
title?(): unknown;
|
|
11
|
+
/** The body text below the title. */
|
|
12
|
+
description?(): unknown;
|
|
13
|
+
/** A running operation's progress — under the copy, above the actions; below the row when compact. */
|
|
14
|
+
progress?(): unknown;
|
|
15
|
+
/** The action row. */
|
|
16
|
+
actions?(): unknown;
|
|
17
|
+
/** The extra content below the actions. */
|
|
18
|
+
default?(): unknown;
|
|
19
|
+
}>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createCommentVNode } from "vue";
|
|
2
|
+
import { dataAttr } from "../../../foundation/dom/DataAttr.js";
|
|
3
|
+
const _hoisted_1 = ["data-toast-compact"];
|
|
4
|
+
const _hoisted_2 = ["id"];
|
|
5
|
+
const _hoisted_3 = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "mt-2"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_4 = {
|
|
10
|
+
key: 3,
|
|
11
|
+
class: "min-w-0 basis-full"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_5 = {
|
|
14
|
+
key: 5,
|
|
15
|
+
class: "min-w-0 basis-full"
|
|
16
|
+
};
|
|
17
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
+
...{ name: "ToastContent" },
|
|
19
|
+
__name: "ToastContent",
|
|
20
|
+
props: {
|
|
21
|
+
isCompact: { type: Boolean },
|
|
22
|
+
titleId: {}
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createElementBlock("div", {
|
|
27
|
+
"data-toast-summary": "",
|
|
28
|
+
"data-toast-compact": unref(dataAttr)(__props.isCompact),
|
|
29
|
+
class: normalizeClass(__props.isCompact && "flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1.5 [overflow-wrap:anywhere]")
|
|
30
|
+
}, [
|
|
31
|
+
_ctx.$slots.title || _ctx.$slots.description ? (openBlock(), createElementBlock("div", {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: normalizeClass(__props.isCompact ? "min-w-0 flex-[1_1_6rem]" : "contents")
|
|
34
|
+
}, [
|
|
35
|
+
_ctx.$slots.title ? (openBlock(), createElementBlock("div", {
|
|
36
|
+
key: 0,
|
|
37
|
+
id: __props.titleId,
|
|
38
|
+
class: "font-medium"
|
|
39
|
+
}, [
|
|
40
|
+
renderSlot(_ctx.$slots, "title")
|
|
41
|
+
], 8, _hoisted_2)) : createCommentVNode("", true),
|
|
42
|
+
_ctx.$slots.description ? (openBlock(), createElementBlock("div", {
|
|
43
|
+
key: 1,
|
|
44
|
+
class: normalizeClass(["text-sm", _ctx.$slots.title && "mt-0.5 text-muted-foreground"])
|
|
45
|
+
}, [
|
|
46
|
+
renderSlot(_ctx.$slots, "description")
|
|
47
|
+
], 2)) : createCommentVNode("", true)
|
|
48
|
+
], 2)) : createCommentVNode("", true),
|
|
49
|
+
_ctx.$slots.progress && !__props.isCompact ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
50
|
+
renderSlot(_ctx.$slots, "progress")
|
|
51
|
+
])) : createCommentVNode("", true),
|
|
52
|
+
_ctx.$slots.actions ? (openBlock(), createElementBlock("div", {
|
|
53
|
+
key: 2,
|
|
54
|
+
class: normalizeClass([
|
|
55
|
+
"flex flex-wrap items-center",
|
|
56
|
+
__props.isCompact ? [
|
|
57
|
+
"min-w-0 max-w-full gap-1.5 [&_a]:max-w-full [&_a]:whitespace-normal",
|
|
58
|
+
"[&_button]:max-w-full [&_button]:whitespace-normal",
|
|
59
|
+
"pointer-coarse:[&_a]:min-h-11 pointer-coarse:[&_button]:min-h-11"
|
|
60
|
+
] : "mt-2 gap-2"
|
|
61
|
+
])
|
|
62
|
+
}, [
|
|
63
|
+
renderSlot(_ctx.$slots, "actions")
|
|
64
|
+
], 2)) : createCommentVNode("", true),
|
|
65
|
+
_ctx.$slots.progress && __props.isCompact ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
66
|
+
renderSlot(_ctx.$slots, "progress")
|
|
67
|
+
])) : createCommentVNode("", true),
|
|
68
|
+
!__props.isCompact ? renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 4) : _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
69
|
+
renderSlot(_ctx.$slots, "default")
|
|
70
|
+
])) : createCommentVNode("", true)
|
|
71
|
+
], 10, _hoisted_1);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
export {
|
|
76
|
+
_sfc_main as default
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=ToastContent.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContent.vue.js","sources":["../../../../src/presentation/feedback/toast/ToastContent.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Defines props for the toast card's copy column. */\nexport interface ToastContentProps {\n /** The compact layout, which wraps the copy, actions and progress into one row. */\n readonly isCompact?: boolean;\n\n /** The id given to the title element, so the running progress can name itself after it. */\n readonly titleId?: string;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { dataAttr } from '../../../foundation/dom';\n\n/** Renders the toast card's copy column — title, description, running progress and actions. */\ndefineOptions({ name: 'ToastContent' });\n\ndefineProps<ToastContentProps>();\n\ndefineSlots<{\n /** The heading line. */\n title?(): unknown;\n /** The body text below the title. */\n description?(): unknown;\n /** A running operation's progress — under the copy, above the actions; below the row when compact. */\n progress?(): unknown;\n /** The action row. */\n actions?(): unknown;\n /** The extra content below the actions. */\n default?(): unknown;\n}>();\n</script>\n\n<template>\n <div\n data-toast-summary\n :data-toast-compact=\"dataAttr(isCompact)\"\n :class=\"isCompact && 'flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1.5 [overflow-wrap:anywhere]'\"\n >\n <div v-if=\"$slots.title || $slots.description\" :class=\"isCompact ? 'min-w-0 flex-[1_1_6rem]' : 'contents'\">\n <div v-if=\"$slots.title\" :id=\"titleId\" class=\"font-medium\"><slot name=\"title\" /></div>\n <div v-if=\"$slots.description\" :class=\"['text-sm', $slots.title && 'mt-0.5 text-muted-foreground']\">\n <slot name=\"description\" />\n </div>\n </div>\n <div v-if=\"$slots.progress && !isCompact\" class=\"mt-2\"><slot name=\"progress\" /></div>\n <div\n v-if=\"$slots.actions\"\n class=\"flex flex-wrap items-center\"\n :class=\"\n isCompact\n ? [\n 'min-w-0 max-w-full gap-1.5 [&_a]:max-w-full [&_a]:whitespace-normal',\n '[&_button]:max-w-full [&_button]:whitespace-normal',\n 'pointer-coarse:[&_a]:min-h-11 pointer-coarse:[&_button]:min-h-11',\n ]\n : 'mt-2 gap-2'\n \"\n >\n <slot name=\"actions\" />\n </div>\n <div v-if=\"$slots.progress && isCompact\" class=\"min-w-0 basis-full\"><slot name=\"progress\" /></div>\n <slot v-if=\"!isCompact\" />\n <div v-else-if=\"$slots.default\" class=\"min-w-0 basis-full\"><slot /></div>\n </div>\n</template>\n"],"names":["_createElementBlock","_unref","$slots","_renderSlot","_normalizeClass","_openBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;0BAkCEA,mBA8BM,OAAA;AAAA,QA7BJ,sBAAA;AAAA,QACC,sBAAoBC,MAAA,QAAA,EAAS,QAAA,SAAS;AAAA,QACtC,sBAAO,QAAA,aAAS,kFAAA;AAAA,MAAA;QAENC,KAAAA,OAAO,SAASA,KAAAA,OAAO,4BAAlCF,mBAKM,OAAA;AAAA;UAL0C,sBAAO,QAAA,YAAS,4BAAA,UAAA;AAAA,QAAA;UACnDE,KAAAA,OAAO,sBAAlBF,mBAAsF,OAAA;AAAA;YAA5D,IAAI,QAAA;AAAA,YAAS,OAAM;AAAA,UAAA;YAAcG,WAAqB,KAAA,QAAA,OAAA;AAAA,UAAA;UACrED,KAAAA,OAAO,4BAAlBF,mBAEM,OAAA;AAAA;YAF0B,OAAKI,eAAA,CAAA,WAAcF,KAAAA,OAAO,SAAK,8BAAA,CAAA;AAAA,UAAA;YAC7DC,WAA2B,KAAA,QAAA,aAAA;AAAA,UAAA;;QAGpBD,KAAAA,OAAO,YAAQ,CAAK,QAAA,aAA/BG,aAAAL,mBAAqF,OAArF,YAAqF;AAAA,UAA9BG,WAAwB,KAAA,QAAA,UAAA;AAAA,QAAA;QAEvED,KAAAA,OAAO,wBADfF,mBAcM,OAAA;AAAA;UAZJ;YAAM;AAAA,YACW,QAAA;;;;;;;UAUjBG,WAAuB,KAAA,QAAA,SAAA;AAAA,QAAA;QAEdD,KAAAA,OAAO,YAAY,QAAA,aAA9BG,aAAAL,mBAAkG,OAAlG,YAAkG;AAAA,UAA9BG,WAAwB,KAAA,QAAA,UAAA;AAAA,QAAA;SAC/E,QAAA,YAAbA,WAA0B,KAAA,QAAA,WAAA,CAAA,GAAA,QAAA,QAAA,CAAA,IACVD,KAAAA,OAAO,WAAvBG,aAAAL,mBAAyE,OAAzE,YAAyE;AAAA,UAAdG,WAAQ,KAAA,QAAA,SAAA;AAAA,QAAA;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContent2.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NoticeProgress } from '../../../feedback';
|
|
2
|
+
import { Severity } from '../../../foundation/styles';
|
|
3
|
+
/** Defines props for the running operation's progress bar. */
|
|
4
|
+
export interface ToastRunningProgressProps {
|
|
5
|
+
/** The running operation's progress. Omit `value` for indeterminate; `max` defaults to 1. */
|
|
6
|
+
readonly progress: NoticeProgress;
|
|
7
|
+
/** The severity palette of the fill. Default `neutral`. */
|
|
8
|
+
readonly severity?: Severity;
|
|
9
|
+
/** Draws the thinner bar of compact cards and group rows. */
|
|
10
|
+
readonly isCompact?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: import('vue').DefineComponent<ToastRunningProgressProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ToastRunningProgressProps> & Readonly<{}>, {
|
|
13
|
+
readonly severity: Severity;
|
|
14
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { defineComponent, useAttrs, useId, computed, openBlock, createElementBlock, mergeProps, createElementVNode, normalizeClass, unref, normalizeStyle, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
import { AriaAttribute } from "../../../foundation/dom/enums/AriaAttribute.js";
|
|
3
|
+
import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
4
|
+
import { cn } from "../../../foundation/styles/Cn.js";
|
|
5
|
+
import { Severity } from "../../../foundation/styles/enums/Severity.js";
|
|
6
|
+
const _hoisted_1 = ["data-toast-running-mode", "aria-valuemax", "aria-valuenow", "aria-labelledby", "aria-label", "aria-describedby"];
|
|
7
|
+
const _hoisted_2 = ["id"];
|
|
8
|
+
const FillClasses = {
|
|
9
|
+
[Severity.Neutral]: "bg-primary",
|
|
10
|
+
[Severity.Info]: "bg-info",
|
|
11
|
+
[Severity.Success]: "bg-success",
|
|
12
|
+
[Severity.Warning]: "bg-warning",
|
|
13
|
+
[Severity.Danger]: "bg-destructive"
|
|
14
|
+
};
|
|
15
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
+
...{ name: "ToastRunningProgress", inheritAttrs: false },
|
|
17
|
+
__name: "ToastRunningProgress",
|
|
18
|
+
props: {
|
|
19
|
+
progress: {},
|
|
20
|
+
severity: { default: Severity.Neutral },
|
|
21
|
+
isCompact: { type: Boolean }
|
|
22
|
+
},
|
|
23
|
+
setup(__props) {
|
|
24
|
+
const props = __props;
|
|
25
|
+
const attrs = useAttrs();
|
|
26
|
+
const locale = useLocale();
|
|
27
|
+
const labelId = useId();
|
|
28
|
+
const labelledby = computed(() => attrs[AriaAttribute.LabelledBy]);
|
|
29
|
+
const rest = computed(() => {
|
|
30
|
+
const { class: _class, [AriaAttribute.LabelledBy]: _labelledby, ...others } = attrs;
|
|
31
|
+
return others;
|
|
32
|
+
});
|
|
33
|
+
const rootClasses = computed(() => cn("min-w-0", attrs.class));
|
|
34
|
+
const max = computed(() => {
|
|
35
|
+
const value = props.progress.max;
|
|
36
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 1;
|
|
37
|
+
});
|
|
38
|
+
const now = computed(() => {
|
|
39
|
+
const value = props.progress.value;
|
|
40
|
+
return typeof value === "number" && !Number.isNaN(value) ? Math.min(max.value, Math.max(0, value)) : void 0;
|
|
41
|
+
});
|
|
42
|
+
const percent = computed(() => now.value === void 0 ? void 0 : now.value / max.value * 100);
|
|
43
|
+
const label = computed(() => props.progress.label || void 0);
|
|
44
|
+
const fallbackName = computed(() => label.value ?? locale.t("Toast.progress", void 0, "Progress"));
|
|
45
|
+
const trackClasses = computed(
|
|
46
|
+
() => cn("relative w-full overflow-hidden rounded-full bg-foreground/15", props.isCompact ? "h-0.5" : "h-1")
|
|
47
|
+
);
|
|
48
|
+
const fillClasses = computed(
|
|
49
|
+
() => cn(
|
|
50
|
+
"h-full rounded-full",
|
|
51
|
+
FillClasses[props.severity],
|
|
52
|
+
percent.value === void 0 ? "w-1/3 motion-safe:animate-[indeterminate_1.4s_ease-in-out_infinite]" : "motion-safe:transition-[width] motion-safe:duration-300 motion-safe:ease-out"
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
return (_ctx, _cache) => {
|
|
56
|
+
return openBlock(), createElementBlock("div", mergeProps({ "data-toast-running": "" }, rest.value, { class: rootClasses.value }), [
|
|
57
|
+
createElementVNode("div", {
|
|
58
|
+
role: "progressbar",
|
|
59
|
+
"data-toast-running-bar": "",
|
|
60
|
+
"data-toast-running-mode": percent.value === void 0 ? "indeterminate" : "determinate",
|
|
61
|
+
"aria-valuemin": 0,
|
|
62
|
+
"aria-valuemax": max.value,
|
|
63
|
+
"aria-valuenow": now.value,
|
|
64
|
+
"aria-labelledby": labelledby.value,
|
|
65
|
+
"aria-label": labelledby.value ? void 0 : fallbackName.value,
|
|
66
|
+
"aria-describedby": labelledby.value && label.value ? unref(labelId) : void 0,
|
|
67
|
+
class: normalizeClass(trackClasses.value)
|
|
68
|
+
}, [
|
|
69
|
+
createElementVNode("div", {
|
|
70
|
+
"data-toast-running-fill": "",
|
|
71
|
+
class: normalizeClass(fillClasses.value),
|
|
72
|
+
style: normalizeStyle(percent.value === void 0 ? void 0 : { width: `${percent.value}%` })
|
|
73
|
+
}, null, 6)
|
|
74
|
+
], 10, _hoisted_1),
|
|
75
|
+
label.value ? (openBlock(), createElementBlock("div", {
|
|
76
|
+
key: 0,
|
|
77
|
+
id: unref(labelId),
|
|
78
|
+
"data-toast-running-label": "",
|
|
79
|
+
class: "mt-1 text-xs text-muted-foreground"
|
|
80
|
+
}, toDisplayString(label.value), 9, _hoisted_2)) : createCommentVNode("", true)
|
|
81
|
+
], 16);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export {
|
|
86
|
+
_sfc_main as default
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=ToastRunningProgress.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastRunningProgress.vue.js","sources":["../../../../src/presentation/feedback/toast/ToastRunningProgress.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { NoticeProgress } from '../../../feedback';\nimport { cn, Severity } from '../../../foundation/styles';\n\n/** Defines props for the running operation's progress bar. */\nexport interface ToastRunningProgressProps {\n /** The running operation's progress. Omit `value` for indeterminate; `max` defaults to 1. */\n readonly progress: NoticeProgress;\n\n /** The severity palette of the fill. Default `neutral`. */\n readonly severity?: Severity;\n\n /** Draws the thinner bar of compact cards and group rows. */\n readonly isCompact?: boolean;\n}\n\n/** @internal The fill colour per severity; the neutral bar uses the brand primary. */\nconst FillClasses: Record<Severity, string> = {\n [Severity.Neutral]: 'bg-primary',\n [Severity.Info]: 'bg-info',\n [Severity.Success]: 'bg-success',\n [Severity.Warning]: 'bg-warning',\n [Severity.Danger]: 'bg-destructive',\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs, useId } from 'vue';\n\nimport { AriaAttribute } from '../../../foundation/dom';\nimport { useLocale } from '../../../foundation/i18n';\n\n/**\n * Renders the progress of a running operation as a slim bar with an optional step label under it. Name the bar\n * with `aria-labelledby`; without it, `progress.label` does.\n */\ndefineOptions({ name: 'ToastRunningProgress', inheritAttrs: false });\n\nconst props = withDefaults(defineProps<ToastRunningProgressProps>(), { severity: Severity.Neutral });\n\nconst attrs = useAttrs();\nconst locale = useLocale();\nconst labelId = useId();\n\n/** The id of the element that names the bar — the toast's title. */\nconst labelledby = computed(() => attrs[AriaAttribute.LabelledBy] as string | undefined);\n\n/** The fallthrough attributes minus `class` and the one relocated to the bar. */\nconst rest = computed(() => {\n const { class: _class, [AriaAttribute.LabelledBy]: _labelledby, ...others } = attrs;\n return others;\n});\n\nconst rootClasses = computed(() => cn('min-w-0', attrs.class as string | undefined));\n\n/** The usable maximum — 1 when absent, zero, negative or not finite. */\nconst max = computed(() => {\n const value = props.progress.max;\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 1;\n});\n\n/** The value kept inside 0–`max`; `undefined` (or `NaN`) is indeterminate. */\nconst now = computed(() => {\n const value = props.progress.value;\n return typeof value === 'number' && !Number.isNaN(value) ? Math.min(max.value, Math.max(0, value)) : undefined;\n});\n\nconst percent = computed(() => (now.value === undefined ? undefined : (now.value / max.value) * 100));\nconst label = computed(() => props.progress.label || undefined);\nconst fallbackName = computed(() => label.value ?? locale.t('Toast.progress', undefined, 'Progress'));\n\nconst trackClasses = computed(() =>\n cn('relative w-full overflow-hidden rounded-full bg-foreground/15', props.isCompact ? 'h-0.5' : 'h-1'),\n);\n\n/** The fill's classes; reduced motion keeps the indeterminate fill still, at a third of the track. */\nconst fillClasses = computed(() =>\n cn(\n 'h-full rounded-full',\n FillClasses[props.severity],\n percent.value === undefined\n ? 'w-1/3 motion-safe:animate-[indeterminate_1.4s_ease-in-out_infinite]'\n : 'motion-safe:transition-[width] motion-safe:duration-300 motion-safe:ease-out',\n ),\n);\n</script>\n\n<template>\n <div data-toast-running v-bind=\"rest\" :class=\"rootClasses\">\n <div\n role=\"progressbar\"\n data-toast-running-bar\n :data-toast-running-mode=\"percent === undefined ? 'indeterminate' : 'determinate'\"\n :aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :aria-valuenow=\"now\"\n :aria-labelledby=\"labelledby\"\n :aria-label=\"labelledby ? undefined : fallbackName\"\n :aria-describedby=\"labelledby && label ? labelId : undefined\"\n :class=\"trackClasses\"\n >\n <div\n data-toast-running-fill\n :class=\"fillClasses\"\n :style=\"percent === undefined ? undefined : { width: `${percent}%` }\"\n />\n </div>\n <div v-if=\"label\" :id=\"labelId\" data-toast-running-label class=\"mt-1 text-xs text-muted-foreground\">\n {{ label }}\n </div>\n </div>\n</template>\n"],"names":["_createElementBlock","_mergeProps","_createElementVNode","_unref"],"mappings":";;;;;;;AAiBA,MAAM,cAAwC;AAAA,EAC5C,CAAC,SAAS,OAAO,GAAG;AAAA,EACpB,CAAC,SAAS,IAAI,GAAG;AAAA,EACjB,CAAC,SAAS,OAAO,GAAG;AAAA,EACpB,CAAC,SAAS,OAAO,GAAG;AAAA,EACpB,CAAC,SAAS,MAAM,GAAG;AACrB;;;;;;;;;;AAeA,UAAM,QAAQ;AAEd,UAAM,QAAQ,SAAA;AACd,UAAM,SAAS,UAAA;AACf,UAAM,UAAU,MAAA;AAGhB,UAAM,aAAa,SAAS,MAAM,MAAM,cAAc,UAAU,CAAuB;AAGvF,UAAM,OAAO,SAAS,MAAM;AAC1B,YAAM,EAAE,OAAO,QAAQ,CAAC,cAAc,UAAU,GAAG,aAAa,GAAG,OAAA,IAAW;AAC9E,aAAO;AAAA,IACT,CAAC;AAED,UAAM,cAAc,SAAS,MAAM,GAAG,WAAW,MAAM,KAA2B,CAAC;AAGnF,UAAM,MAAM,SAAS,MAAM;AACzB,YAAM,QAAQ,MAAM,SAAS;AAC7B,aAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,QAAQ,IAAI,QAAQ;AAAA,IACpF,CAAC;AAGD,UAAM,MAAM,SAAS,MAAM;AACzB,YAAM,QAAQ,MAAM,SAAS;AAC7B,aAAO,OAAO,UAAU,YAAY,CAAC,OAAO,MAAM,KAAK,IAAI,KAAK,IAAI,IAAI,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,IAAI;AAAA,IACvG,CAAC;AAED,UAAM,UAAU,SAAS,MAAO,IAAI,UAAU,SAAY,SAAa,IAAI,QAAQ,IAAI,QAAS,GAAI;AACpG,UAAM,QAAQ,SAAS,MAAM,MAAM,SAA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
1
|
+
/** Defines the material a toast card is painted with. */
|
|
2
|
+
export declare const ToastSurface: {
|
|
3
|
+
/** Refers to the opaque popover fill. */
|
|
4
|
+
readonly Solid: "solid";
|
|
5
|
+
/** Refers to the translucent menu glass, which falls back to an opaque fill under reduced transparency. */
|
|
6
|
+
readonly Glass: "glass";
|
|
7
|
+
};
|
|
8
|
+
export type ToastSurface = (typeof ToastSurface)[keyof typeof ToastSurface];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const ToastSurface = {
|
|
2
|
+
/** Refers to the opaque popover fill. */
|
|
3
|
+
Solid: "solid",
|
|
4
|
+
/** Refers to the translucent menu glass, which falls back to an opaque fill under reduced transparency. */
|
|
5
|
+
Glass: "glass"
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
ToastSurface
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=ToastSurface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastSurface.js","sources":["../../../../src/presentation/feedback/toast/ToastSurface.ts"],"sourcesContent":["/** Defines the material a toast card is painted with. */\nexport const ToastSurface = {\n /** Refers to the opaque popover fill. */\n Solid: 'solid',\n /** Refers to the translucent menu glass, which falls back to an opaque fill under reduced transparency. */\n Glass: 'glass',\n} as const;\n\nexport type ToastSurface = (typeof ToastSurface)[keyof typeof ToastSurface];\n"],"names":[],"mappings":"AACO,MAAM,eAAe;AAAA;AAAA,EAE1B,OAAO;AAAA;AAAA,EAEP,OAAO;AACT;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToastOptions } from './ToastOptions';
|
|
2
|
+
/** Represents a toast as the store holds it — the caller's options plus its identity and delivery order. */
|
|
3
|
+
export interface ToastEntry extends ToastOptions {
|
|
4
|
+
/** The toast's identity, assigned by the store. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** The epoch milliseconds when the toast was first shown. */
|
|
7
|
+
createdAtMs: number;
|
|
8
|
+
/** Delivery order, including while the toast is exiting. */
|
|
9
|
+
sequence: number;
|
|
10
|
+
/** Bumped on every `update` / dedup so the viewport can reset that toast's auto-dismiss timer. */
|
|
11
|
+
nonce: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastFocusExtensions.js","sources":["../../../../src/presentation/feedback/toastHost/ToastFocusExtensions.ts"],"sourcesContent":["/** Reports whether an element's focus shows its ring — the keyboard's focus, as opposed to a pointer's. */\nexport function isFocusVisible(element: Element | null): boolean {\n try {\n return element?.matches(':focus-visible') ?? false;\n } catch {\n // An engine without the selector cannot tell the two apart; keep the pointer behaviour.\n return false;\n }\n}\n"],"names":[],"mappings":"AACO,SAAS,eAAe,SAAkC;AAC/D,MAAI;AACF,WAAO,SAAS,QAAQ,gBAAgB,KAAK;AAAA,EAC/C,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ToastGroupLatest } from './ToastGroupLatest';
|
|
2
|
+
/** Represents the live notices a single toast stands for. */
|
|
3
|
+
export interface ToastGroup {
|
|
4
|
+
/** The number of live notices in the group. */
|
|
5
|
+
readonly count: number;
|
|
6
|
+
/** The newest notice, previewed while the group merges. */
|
|
7
|
+
readonly latest: ToastGroupLatest;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ToastSeverity } from './ToastSeverity';
|
|
2
|
+
/** Represents the newest notice of a toast's group, as a plain-text preview. */
|
|
3
|
+
export interface ToastGroupLatest {
|
|
4
|
+
/** The newest notice's title, when it is plain text. */
|
|
5
|
+
readonly title?: string;
|
|
6
|
+
/** The newest notice's description, when it is plain text. */
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
/** The newest notice's severity. */
|
|
9
|
+
readonly severity?: ToastSeverity;
|
|
10
|
+
}
|