@sula-tech/webcomponents 0.19.3 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-i5WGQEGK.js → index-BjAGuSPl.js} +30 -5
- package/dist/cjs/index-BjAGuSPl.js.map +1 -0
- package/dist/cjs/index.cjs.js +17 -11
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sula-avatar_31.cjs.entry.js +41 -41
- package/dist/cjs/sula-avatar_31.cjs.entry.js.map +1 -1
- package/dist/cjs/sula-menu.model-BDxbWyPG.js +16 -0
- package/dist/cjs/sula-menu.model-BDxbWyPG.js.map +1 -0
- package/dist/cjs/sula-toast-stack.cjs.entry.js +314 -0
- package/dist/cjs/sula-toast-stack.cjs.entry.js.map +1 -0
- package/dist/cjs/sula-toast-stack.entry.cjs.js.map +1 -0
- package/dist/cjs/sula-toast.cjs.entry.js +195 -0
- package/dist/cjs/sula-toast.cjs.entry.js.map +1 -0
- package/dist/cjs/sula-toast.entry.cjs.js.map +1 -0
- package/dist/cjs/sula-toast.model-frnF9yhp.js +14 -0
- package/dist/cjs/sula-toast.model-frnF9yhp.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/sula-avatar/sula-avatar.css +1 -1
- package/dist/collection/components/sula-badge/sula-badge.css +1 -1
- package/dist/collection/components/sula-breadcrumb/sula-breadcrumb.css +1 -1
- package/dist/collection/components/sula-button/sula-button.css +1 -1
- package/dist/collection/components/sula-checkbox/sula-checkbox.css +1 -1
- package/dist/collection/components/sula-chip/sula-chip.css +1 -1
- package/dist/collection/components/sula-dropdown/sula-dropdown.css +1 -1
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-icon-picker/sula-icon-picker.css +1 -1
- package/dist/collection/components/sula-loader/sula-loader.css +1 -1
- package/dist/collection/components/sula-menu/sula-menu.css +1 -1
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.css +1 -1
- package/dist/collection/components/sula-modal/sula-modal.css +1 -1
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.css +1 -1
- package/dist/collection/components/sula-radio-button/sula-radio-button.css +1 -1
- package/dist/collection/components/sula-search-bar/sula-search-bar.css +1 -1
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.css +1 -1
- package/dist/collection/components/sula-switch/sula-switch.css +1 -1
- package/dist/collection/components/sula-table/sula-table.css +1 -1
- package/dist/collection/components/sula-table-body/sula-table-body.css +1 -1
- package/dist/collection/components/sula-table-cell/sula-table-cell.css +1 -1
- package/dist/collection/components/sula-table-head-cell/sula-table-head-cell.css +1 -1
- package/dist/collection/components/sula-table-header/sula-table-header.css +1 -1
- package/dist/collection/components/sula-table-row/sula-table-row.css +1 -1
- package/dist/collection/components/sula-tag/sula-tag.css +1 -1
- package/dist/collection/components/sula-textarea/sula-textarea.css +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.css +1 -1
- package/dist/collection/components/sula-tiles/sula-tiles.css +1 -1
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.css +1 -1
- package/dist/collection/components/sula-toast/model/sula-toast.model.js +10 -0
- package/dist/collection/components/sula-toast/model/sula-toast.model.js.map +1 -0
- package/dist/collection/components/sula-toast/sula-toast.css +1 -0
- package/dist/collection/components/sula-toast/sula-toast.js +501 -0
- package/dist/collection/components/sula-toast/sula-toast.js.map +1 -0
- package/dist/collection/components/sula-toast/sula-toast.stories.js +101 -0
- package/dist/collection/components/sula-toast/sula-toast.stories.js.map +1 -0
- package/dist/collection/components/sula-toast-stack/model/sula-toast-stack.model.js +2 -0
- package/dist/collection/components/sula-toast-stack/model/sula-toast-stack.model.js.map +1 -0
- package/dist/collection/components/sula-toast-stack/sula-toast-stack.css +1 -0
- package/dist/collection/components/sula-toast-stack/sula-toast-stack.js +333 -0
- package/dist/collection/components/sula-toast-stack/sula-toast-stack.js.map +1 -0
- package/dist/collection/components/sula-toast-stack/sula-toast-stack.motion.js +67 -0
- package/dist/collection/components/sula-toast-stack/sula-toast-stack.motion.js.map +1 -0
- package/dist/collection/components/sula-toast-stack/sula-toast-stack.stories.js +87 -0
- package/dist/collection/components/sula-toast-stack/sula-toast-stack.stories.js.map +1 -0
- package/dist/collection/components/sula-toggle/sula-toggle.css +1 -1
- package/dist/collection/components/sula-toggle/sula-toggle.js +1 -1
- package/dist/collection/components/sula-tooltip/sula-tooltip.css +1 -1
- package/dist/collection/components/sula-tooltip/sula-tooltip.js +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/components/index.js +3 -15
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-CelSwSJG.js → p-CJ2i2jVV.js} +5 -5
- package/dist/components/{p-CelSwSJG.js.map → p-CJ2i2jVV.js.map} +1 -1
- package/dist/components/p-Cs9RR1ZV.js +16 -0
- package/dist/components/p-Cs9RR1ZV.js.map +1 -0
- package/dist/components/{p-Bqd5Y-Ir.js → p-D0ZAC0yK.js} +6 -6
- package/dist/components/p-D0ZAC0yK.js.map +1 -0
- package/dist/components/{p-BJQZqrGi.js → p-DGfvh6dZ.js} +5 -5
- package/dist/components/{p-BJQZqrGi.js.map → p-DGfvh6dZ.js.map} +1 -1
- package/dist/components/{p-Cy4ZswbA.js → p-DYfmicjp.js} +31 -6
- package/dist/components/p-DYfmicjp.js.map +1 -0
- package/dist/components/{p-f7rEWsEo.js → p-DmCNhtp_.js} +4 -4
- package/dist/components/{p-f7rEWsEo.js.map → p-DmCNhtp_.js.map} +1 -1
- package/dist/components/p-DmQoJS86.js +235 -0
- package/dist/components/p-DmQoJS86.js.map +1 -0
- package/dist/components/{p-bHiC51v2.js → p-DqRqPukj.js} +4 -4
- package/dist/components/{p-bHiC51v2.js.map → p-DqRqPukj.js.map} +1 -1
- package/dist/components/{p-D1tWu3qb.js → p-b7t6bSNa.js} +6 -6
- package/dist/components/{p-D1tWu3qb.js.map → p-b7t6bSNa.js.map} +1 -1
- package/dist/components/p-t0X4JATS.js +14 -0
- package/dist/components/p-t0X4JATS.js.map +1 -0
- package/dist/components/sula-avatar.js +3 -3
- package/dist/components/sula-avatar.js.map +1 -1
- package/dist/components/sula-badge.js +3 -3
- package/dist/components/sula-badge.js.map +1 -1
- package/dist/components/sula-breadcrumb.js +3 -3
- package/dist/components/sula-breadcrumb.js.map +1 -1
- package/dist/components/sula-button.js +1 -1
- package/dist/components/sula-checkbox.js +3 -3
- package/dist/components/sula-checkbox.js.map +1 -1
- package/dist/components/sula-chip.js +4 -4
- package/dist/components/sula-chip.js.map +1 -1
- package/dist/components/sula-dropdown.js +1 -1
- package/dist/components/sula-icon-picker.js +6 -6
- package/dist/components/sula-icon-picker.js.map +1 -1
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-loader.js +1 -1
- package/dist/components/sula-menu-select-list.js +1 -1
- package/dist/components/sula-menu.js +4 -4
- package/dist/components/sula-menu.js.map +1 -1
- package/dist/components/sula-modal.js +5 -5
- package/dist/components/sula-modal.js.map +1 -1
- package/dist/components/sula-progress-bar.js +3 -3
- package/dist/components/sula-progress-bar.js.map +1 -1
- package/dist/components/sula-radio-button.js +2 -2
- package/dist/components/sula-radio-button.js.map +1 -1
- package/dist/components/sula-search-bar.js +1 -1
- package/dist/components/sula-segmented-control.js +3 -3
- package/dist/components/sula-segmented-control.js.map +1 -1
- package/dist/components/sula-switch.js +2 -2
- package/dist/components/sula-switch.js.map +1 -1
- package/dist/components/sula-table-body.js +2 -2
- package/dist/components/sula-table-body.js.map +1 -1
- package/dist/components/sula-table-cell.js +2 -2
- package/dist/components/sula-table-cell.js.map +1 -1
- package/dist/components/sula-table-head-cell.js +2 -2
- package/dist/components/sula-table-head-cell.js.map +1 -1
- package/dist/components/sula-table-header.js +2 -2
- package/dist/components/sula-table-header.js.map +1 -1
- package/dist/components/sula-table-row.js +2 -2
- package/dist/components/sula-table-row.js.map +1 -1
- package/dist/components/sula-table.js +2 -2
- package/dist/components/sula-table.js.map +1 -1
- package/dist/components/sula-tag.js +3 -3
- package/dist/components/sula-tag.js.map +1 -1
- package/dist/components/sula-textarea.js +2 -2
- package/dist/components/sula-textarea.js.map +1 -1
- package/dist/components/sula-textfield.js +3 -3
- package/dist/components/sula-textfield.js.map +1 -1
- package/dist/components/sula-tiles.js +3 -3
- package/dist/components/sula-tiles.js.map +1 -1
- package/dist/components/sula-timeline-list.js +3 -3
- package/dist/components/sula-timeline-list.js.map +1 -1
- package/dist/components/sula-toast-stack.d.ts +11 -0
- package/dist/components/sula-toast-stack.js +352 -0
- package/dist/components/sula-toast-stack.js.map +1 -0
- package/dist/components/sula-toast.d.ts +11 -0
- package/dist/components/sula-toast.js +9 -0
- package/dist/components/sula-toast.js.map +1 -0
- package/dist/components/sula-toggle.js +4 -4
- package/dist/components/sula-toggle.js.map +1 -1
- package/dist/components/sula-tooltip.js +4 -4
- package/dist/components/sula-tooltip.js.map +1 -1
- package/dist/esm/{index-lrQT_q8m.js → index-BL15Tt3m.js} +30 -5
- package/dist/esm/index-BL15Tt3m.js.map +1 -0
- package/dist/esm/index.js +2 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/sula-avatar_31.entry.js +35 -35
- package/dist/esm/sula-avatar_31.entry.js.map +1 -1
- package/dist/esm/sula-menu.model-Cs9RR1ZV.js +16 -0
- package/dist/esm/sula-menu.model-Cs9RR1ZV.js.map +1 -0
- package/dist/esm/sula-toast-stack.entry.js +312 -0
- package/dist/esm/sula-toast-stack.entry.js.map +1 -0
- package/dist/esm/sula-toast.entry.js +193 -0
- package/dist/esm/sula-toast.entry.js.map +1 -0
- package/dist/esm/sula-toast.model-t0X4JATS.js +14 -0
- package/dist/esm/sula-toast.model-t0X4JATS.js.map +1 -0
- package/dist/esm/webcomponents.js +3 -3
- package/dist/types/components/sula-toast/model/sula-toast.model.d.ts +31 -0
- package/dist/types/components/sula-toast/sula-toast.d.ts +64 -0
- package/dist/types/components/sula-toast/sula-toast.stories.d.ts +188 -0
- package/dist/types/components/sula-toast-stack/model/sula-toast-stack.model.d.ts +8 -0
- package/dist/types/components/sula-toast-stack/sula-toast-stack.d.ts +51 -0
- package/dist/types/components/sula-toast-stack/sula-toast-stack.motion.d.ts +9 -0
- package/dist/types/components/sula-toast-stack/sula-toast-stack.stories.d.ts +64 -0
- package/dist/types/components.d.ts +204 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/webcomponents/index.esm.js +2 -15
- package/dist/webcomponents/index.esm.js.map +1 -1
- package/dist/webcomponents/p-170854a5.entry.js +270 -0
- package/dist/webcomponents/p-170854a5.entry.js.map +1 -0
- package/dist/webcomponents/{p-lrQT_q8m.js → p-BL15Tt3m.js} +240 -215
- package/dist/webcomponents/p-BL15Tt3m.js.map +1 -0
- package/dist/webcomponents/p-Cs9RR1ZV.js +18 -0
- package/dist/webcomponents/p-Cs9RR1ZV.js.map +1 -0
- package/dist/webcomponents/p-c58125e1.entry.js +376 -0
- package/dist/webcomponents/p-c58125e1.entry.js.map +1 -0
- package/dist/webcomponents/{p-95ca03c9.entry.js → p-fcc1a28c.entry.js} +42 -42
- package/dist/webcomponents/p-t0X4JATS.js +14 -0
- package/dist/webcomponents/p-t0X4JATS.js.map +1 -0
- package/dist/webcomponents/sula-toast-stack.entry.esm.js.map +1 -0
- package/dist/webcomponents/sula-toast.entry.esm.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +35 -6
- package/package.json +2 -2
- package/dist/cjs/index-i5WGQEGK.js.map +0 -1
- package/dist/components/p-Bqd5Y-Ir.js.map +0 -1
- package/dist/components/p-Cy4ZswbA.js.map +0 -1
- package/dist/esm/index-lrQT_q8m.js.map +0 -1
- package/dist/webcomponents/p-lrQT_q8m.js.map +0 -1
- /package/dist/webcomponents/{p-95ca03c9.entry.js.map → p-fcc1a28c.entry.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CACxD,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { SulaToastAnnouncement, SulaToastDismissEvent, SulaToastType } from './model/sula-toast.model';\n\nconst DEFAULT_DURATION = 5000;\nconst FOCUS_RING_CLASSES = 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-feedback-informational focus-visible:outline-offset-2';\n\nconst TOAST_INTENTS: Record<SulaToastType, { border: string; borderColor: string; color: string; background: string }> = {\n [SulaToastType.Neutral]: {\n border: 'border-line-general',\n borderColor: 'var(--color-line-general)',\n color: 'text-icon-primary',\n background: 'bg-surface-on-body',\n },\n [SulaToastType.Brand]: {\n border: 'border-brand-primary',\n borderColor: 'var(--color-brand-primary)',\n color: 'text-brand-primary',\n background: 'bg-surface-on-body-brand',\n },\n [SulaToastType.Info]: {\n border: 'border-feedback-informational',\n borderColor: 'var(--color-feedback-informational)',\n color: 'text-feedback-informational',\n background: 'bg-surface-on-body-feedback-info',\n },\n [SulaToastType.Success]: {\n border: 'border-feedback-success',\n borderColor: 'var(--color-feedback-success)',\n color: 'text-feedback-success',\n background: 'bg-surface-on-body-feedback-success',\n },\n [SulaToastType.Warning]: {\n border: 'border-feedback-alert',\n borderColor: 'var(--color-feedback-alert)',\n color: 'text-feedback-alert',\n background: 'bg-surface-on-body-feedback-alert',\n },\n [SulaToastType.Danger]: {\n border: 'border-feedback-error',\n borderColor: 'var(--color-feedback-error)',\n color: 'text-feedback-error',\n background: 'bg-surface-on-body-feedback-error',\n },\n};\n\n/**\n * A controlled notification. The consumer removes it after toastDismissRequested.\n * @part container - Notification surface.\n * @part icon - Decorative intent icon.\n * @part content - Title, description and action.\n * @part close-button - Dismiss button.\n */\n@Component({ tag: 'sula-toast', styleUrl: 'sula-toast.scss', shadow: true })\nexport class SulaToast {\n @Element() hostElement: HTMLElement;\n\n /** Notification title. */\n @Prop() toastTitle = '';\n\n /** Optional notification description, displayed on up to four lines. */\n @Prop() message = '';\n\n /** Visual intent, independent of announcement urgency. */\n @Prop() type: SulaToastType = SulaToastType.Neutral;\n\n /** Optional full Phosphor class name. No icon is displayed when omitted or empty. */\n @Prop() icon?: string;\n\n /** Optional single-line action label. The consumer implements the action. */\n @Prop() actionText = '';\n\n /** Whether to display the dismiss button. */\n @Prop() closable = true;\n\n /** Milliseconds before requesting dismissal. Zero persists; omitted means 5000 without an action and persistent with an action. */\n @Prop() duration?: number;\n\n /** Externally pause the remaining timeout, for example while covered by a stack. */\n @Prop() paused = false;\n\n /** Whether to play the entrance animations (fade-in and border trace). Disable when a parent already controls the animation, for example toasts covered in a stack. */\n @Prop() animated = true;\n\n /** Screen reader announcement priority. Use off when a parent owns announcements. */\n @Prop() announcement: SulaToastAnnouncement = 'polite';\n\n /** Accessible dismiss button label. */\n @Prop() closeLabel = 'Fechar notificação';\n\n /** Requests removal by the consumer. Does not remove or hide the element. */\n @Event() toastDismissRequested: EventEmitter<SulaToastDismissEvent>;\n /** Requests the configured action without dismissing the notification. */\n @Event() toastAction: EventEmitter<void>;\n\n @State() announcedText = '';\n private timer?: ReturnType<typeof setTimeout>;\n private observer?: IntersectionObserver;\n private remaining = 0;\n private startedAt = 0;\n private timedOut = false;\n private timeoutEnabled = false;\n private hovering = false;\n private focused = false;\n private visible = false;\n private ready = false;\n private connected = false;\n\n connectedCallback() {\n this.connected = true;\n if (this.ready) this.observeVisibility();\n }\n\n componentDidLoad() {\n this.ready = true;\n this.resetTimeout();\n Promise.resolve().then(() => {\n if (this.connected) this.updateAnnouncement();\n });\n this.observeVisibility();\n }\n\n disconnectedCallback() {\n this.connected = false;\n this.stopTimeout();\n this.observer?.disconnect();\n this.hovering = false;\n this.focused = false;\n }\n\n @Watch('toastTitle')\n @Watch('message')\n @Watch('actionText')\n @Watch('duration')\n handleContentChange() {\n this.resetTimeout();\n this.updateAnnouncement();\n }\n\n @Watch('announcement')\n updateAnnouncement() {\n this.announcedText = this.announcement === 'off' ? '' : [this.toastTitle, this.message].filter(Boolean).join('. ');\n }\n\n @Watch('paused')\n @Listen('visibilitychange', { target: 'document' })\n updateTimeout() {\n const blocked = !this.connected || !this.ready || !this.visible || this.paused || this.hovering || this.focused || document.visibilityState === 'hidden';\n if (blocked) {\n this.stopTimeout();\n } else if (this.timer === undefined && this.timeoutEnabled && !this.timedOut) {\n this.startedAt = Date.now();\n this.timer = setTimeout(() => {\n this.timer = undefined;\n this.remaining = 0;\n this.timedOut = true;\n this.toastDismissRequested.emit({ reason: 'timeout' });\n }, this.remaining);\n }\n }\n\n private resetTimeout() {\n this.stopTimeout();\n this.remaining = this.resolveDuration();\n this.timeoutEnabled = this.remaining > 0;\n this.timedOut = false;\n this.updateTimeout();\n }\n\n private resolveDuration() {\n if (typeof this.duration === 'number' && Number.isFinite(this.duration) && this.duration >= 0) return this.duration;\n return this.actionText ? 0 : DEFAULT_DURATION;\n }\n\n private stopTimeout() {\n if (this.timer !== undefined) {\n clearTimeout(this.timer);\n this.timer = undefined;\n this.remaining = Math.max(0, this.remaining - (Date.now() - this.startedAt));\n }\n }\n\n private observeVisibility() {\n this.observer?.disconnect();\n if (typeof IntersectionObserver === 'undefined') {\n this.visible = true;\n this.updateTimeout();\n return;\n }\n this.visible = false;\n this.observer = new IntersectionObserver(entries => {\n this.visible = entries.some(entry => entry.isIntersecting && entry.intersectionRatio > 0);\n this.updateTimeout();\n });\n this.observer.observe(this.hostElement);\n }\n\n private setHover(value: boolean) {\n this.hovering = value && !(window.matchMedia?.('(hover: none)').matches ?? false);\n this.updateTimeout();\n }\n\n private handleFocusOut = (event: FocusEvent) => {\n const target = event.relatedTarget as Node | null;\n this.focused = !!target && (this.hostElement.contains(target) || this.hostElement.shadowRoot.contains(target));\n this.updateTimeout();\n };\n\n private get intent() {\n return TOAST_INTENTS[this.type] || TOAST_INTENTS[SulaToastType.Neutral];\n }\n\n render() {\n const intent = this.intent;\n return (\n <Host\n onMouseEnter={() => this.setHover(true)}\n onMouseLeave={() => this.setHover(false)}\n onFocusin={() => {\n this.focused = true;\n this.updateTimeout();\n }}\n onFocusout={this.handleFocusOut}\n >\n <div\n part=\"container\"\n class={`toast-surface relative isolate box-border flex items-center w-full p-16 gap-12 rounded-sm border bg-opacity-toast ${intent.border} ${this.animated ? 'toast-surface--animated' : ''}`}\n style={{ '--toast-border-color': intent.borderColor }}\n >\n {this.icon && (\n <div part=\"icon\" aria-hidden=\"true\" class={`flex shrink-0 items-center justify-center w-44 h-44 rounded-xxl ${intent.background}`}>\n <sula-icon icon={this.icon} customClass={`text-2xl ${intent.color}`} class=\"flex leading-none\" />\n </div>\n )}\n <div part=\"content\" class={`flex min-w-0 flex-1 flex-col gap-8 ${this.closable ? 'pr-48' : ''}`}>\n <div class=\"flex flex-col gap-4\">\n {this.toastTitle && (\n <p class=\"toast-copy toast-title text-label-medium-bold text-text-primary\" title={this.toastTitle}>\n {this.toastTitle}\n </p>\n )}\n {this.message && (\n <p class=\"toast-copy toast-message text-label-medium-regular text-text-secondary\" title={this.message}>\n {this.message}\n </p>\n )}\n </div>\n {this.actionText && (\n <button\n type=\"button\"\n class={`toast-copy toast-action self-start text-left text-label-medium-bold text-text-link underline rounded ${FOCUS_RING_CLASSES}`}\n title={this.actionText}\n onClick={() => this.toastAction.emit()}\n >\n {this.actionText}\n </button>\n )}\n </div>\n {this.closable && (\n <button\n part=\"close-button\"\n type=\"button\"\n aria-label={this.closeLabel}\n class={`absolute top-16 right-16 flex items-center justify-center w-24 h-24 rounded ${intent.color} ${FOCUS_RING_CLASSES}`}\n onClick={() => this.toastDismissRequested.emit({ reason: 'close' })}\n >\n <sula-icon aria-hidden=\"true\" icon=\"ph ph-x\" customClass=\"text-2xl\" class=\"flex leading-none\" />\n </button>\n )}\n <svg class=\"toast-border\" aria-hidden=\"true\" focusable=\"false\">\n <rect class=\"toast-border__path\" pathLength=\"1\" />\n </svg>\n </div>\n <div class=\"sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n {this.announcement === 'polite' ? this.announcedText : ''}\n </div>\n <div class=\"sr-only\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\">\n {this.announcement === 'assertive' ? this.announcedText : ''}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { SulaToastType } from "./model/sula-toast.model";
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Components/sula-toast',
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
parameters: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: 'Notificação controlada com seis intenções. Ao entrar, surge suavemente enquanto a borda percorre o perímetro. A aplicação remove o elemento ao receber toastDismissRequested e implementa a ação em toastAction. Sem duração explícita, mensagens sem ação duram 5 segundos; com ação permanecem. As demonstrações visuais usam duration=0.',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
toastTitle: { control: 'text', description: 'Título da notificação.' },
|
|
26
|
+
message: { control: 'text', description: 'Descrição opcional, limitada visualmente a quatro linhas.' },
|
|
27
|
+
type: { control: 'select', options: Object.values(SulaToastType) },
|
|
28
|
+
icon: { control: 'text', description: 'Classe Phosphor completa; omitida ou vazia não exibe ícone.' },
|
|
29
|
+
actionText: { control: 'text', description: 'Ação opcional de uma linha, com reticências quando necessário.' },
|
|
30
|
+
closable: { control: 'boolean' },
|
|
31
|
+
duration: { control: 'number', description: 'Milissegundos; 0 mantém a mensagem visível.' },
|
|
32
|
+
paused: { control: 'boolean' },
|
|
33
|
+
animated: { control: 'boolean', description: 'Controla a animação de entrada (fade e traçado da borda).' },
|
|
34
|
+
announcement: { control: 'select', options: ['polite', 'assertive', 'off'] },
|
|
35
|
+
closeLabel: { control: 'text' },
|
|
36
|
+
toastAction: { action: 'toastAction' },
|
|
37
|
+
toastDismissRequested: { action: 'toastDismissRequested' },
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const Template = args => {
|
|
41
|
+
const surface = document.createElement('div');
|
|
42
|
+
surface.className = 'bg-surface-on-body rounded-sm p-32';
|
|
43
|
+
const toast = document.createElement('sula-toast');
|
|
44
|
+
const { toastAction, toastDismissRequested } = args, props = __rest(args, ["toastAction", "toastDismissRequested"]);
|
|
45
|
+
Object.assign(toast, props);
|
|
46
|
+
toast.addEventListener('toastAction', event => toastAction === null || toastAction === void 0 ? void 0 : toastAction(event));
|
|
47
|
+
toast.addEventListener('toastDismissRequested', event => toastDismissRequested === null || toastDismissRequested === void 0 ? void 0 : toastDismissRequested(event));
|
|
48
|
+
surface.append(toast);
|
|
49
|
+
return surface;
|
|
50
|
+
};
|
|
51
|
+
const defaults = {
|
|
52
|
+
toastTitle: 'Toast title',
|
|
53
|
+
message: 'This is a description with supporting details.',
|
|
54
|
+
actionText: 'Desfazer',
|
|
55
|
+
duration: 0,
|
|
56
|
+
icon: 'ph ph-circle-dashed',
|
|
57
|
+
closable: true,
|
|
58
|
+
announcement: 'polite',
|
|
59
|
+
closeLabel: 'Fechar notificação',
|
|
60
|
+
};
|
|
61
|
+
export const Neutral = { render: Template, args: Object.assign(Object.assign({}, defaults), { type: SulaToastType.Neutral }) };
|
|
62
|
+
export const Brand = { render: Template, args: Object.assign(Object.assign({}, defaults), { type: SulaToastType.Brand }) };
|
|
63
|
+
export const Info = { render: Template, args: Object.assign(Object.assign({}, defaults), { type: SulaToastType.Info, icon: 'ph ph-info' }) };
|
|
64
|
+
export const Success = { render: Template, args: Object.assign(Object.assign({}, defaults), { type: SulaToastType.Success, icon: 'ph ph-check-circle' }) };
|
|
65
|
+
export const Warning = { render: Template, args: Object.assign(Object.assign({}, defaults), { type: SulaToastType.Warning, icon: 'ph ph-warning' }) };
|
|
66
|
+
export const Danger = { render: Template, args: Object.assign(Object.assign({}, defaults), { type: SulaToastType.Danger, icon: 'ph ph-warning-circle' }) };
|
|
67
|
+
export const WithoutAction = { render: Template, args: Object.assign(Object.assign({}, defaults), { actionText: '' }) };
|
|
68
|
+
export const WithoutIconOrClose = { render: Template, args: Object.assign(Object.assign({}, defaults), { icon: '', closable: false }) };
|
|
69
|
+
export const LongContent = {
|
|
70
|
+
render: Template,
|
|
71
|
+
args: Object.assign(Object.assign({}, defaults), { toastTitle: 'Um título que pode ocupar mais de uma linha', message: 'A descrição ocupa até quatro linhas e termina com reticências quando o conteúdo ultrapassa o espaço disponível: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz.', actionText: 'Uma ação extensa também permanece em uma única linha' }),
|
|
72
|
+
};
|
|
73
|
+
export const ControlledDismissal = {
|
|
74
|
+
render: () => {
|
|
75
|
+
const container = document.createElement('div');
|
|
76
|
+
const show = document.createElement('button');
|
|
77
|
+
show.type = 'button';
|
|
78
|
+
show.textContent = 'Mostrar notificação novamente';
|
|
79
|
+
show.className = 'text-text-link underline mb-24';
|
|
80
|
+
const output = document.createElement('div');
|
|
81
|
+
const showToast = () => {
|
|
82
|
+
const toast = document.createElement('sula-toast');
|
|
83
|
+
toast.toastTitle = 'Alterações salvas';
|
|
84
|
+
toast.message = 'Passe o mouse ou use Tab para pausar o tempo.';
|
|
85
|
+
toast.addEventListener('toastDismissRequested', () => {
|
|
86
|
+
const wasFocused = toast.matches(':focus-within');
|
|
87
|
+
toast.remove();
|
|
88
|
+
show.hidden = false;
|
|
89
|
+
if (wasFocused)
|
|
90
|
+
show.focus();
|
|
91
|
+
});
|
|
92
|
+
show.hidden = true;
|
|
93
|
+
output.replaceChildren(toast);
|
|
94
|
+
};
|
|
95
|
+
show.addEventListener('click', showToast);
|
|
96
|
+
container.append(show, output);
|
|
97
|
+
showToast();
|
|
98
|
+
return container;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=sula-toast.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-toast.stories.js","sourceRoot":"","sources":["../../../src/components/sula-toast/sula-toast.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,eAAe;IACb,KAAK,EAAE,uBAAuB;IAC9B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EACP,6UAA6U;aAChV;SACF;KACF;IACD,QAAQ,EAAE;QACR,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,wBAAwB,EAAE;QACtE,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,2DAA2D,EAAE;QACtG,IAAI,EAAE,EAAE,O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AC,UAAU,GAAG,mBAAmB,CAAC;YACvC,KAAK,CAAC,OAAO,GAAG,+CAA+C,CAAC;YAChE,KAAK,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,GAAG,EAAE;gBACnD,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;gBAClD,KAAK,CAAC,MAAM,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;gBACpB,IAAI,UAAU;oBAAE,IAAI,CAAC,KAAK,EAAE,CAAC;YAC/B,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC;QAEF,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC1C,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/B,SAAS,EAAE,CAAC;QACZ,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["import { SulaToastType } from './model/sula-toast.model';\n\nexport default {\n title: 'Components/sula-toast',\n tags: ['autodocs'],\n parameters: {\n docs: {\n description: {\n component:\n 'Notificação controlada com seis intenções. Ao entrar, surge suavemente enquanto a borda percorre o perímetro. A aplicação remove o elemento ao receber toastDismissRequested e implementa a ação em toastAction. Sem duração explícita, mensagens sem ação duram 5 segundos; com ação permanecem. As demonstrações visuais usam duration=0.',\n },\n },\n },\n argTypes: {\n toastTitle: { control: 'text', description: 'Título da notificação.' },\n message: { control: 'text', description: 'Descrição opcional, limitada visualmente a quatro linhas.' },\n type: { control: 'select', options: Object.values(SulaToastType) },\n icon: { control: 'text', description: 'Classe Phosphor completa; omitida ou vazia não exibe ícone.' },\n actionText: { control: 'text', description: 'Ação opcional de uma linha, com reticências quando necessário.' },\n closable: { control: 'boolean' },\n duration: { control: 'number', description: 'Milissegundos; 0 mantém a mensagem visível.' },\n paused: { control: 'boolean' },\n animated: { control: 'boolean', description: 'Controla a animação de entrada (fade e traçado da borda).' },\n announcement: { control: 'select', options: ['polite', 'assertive', 'off'] },\n closeLabel: { control: 'text' },\n toastAction: { action: 'toastAction' },\n toastDismissRequested: { action: 'toastDismissRequested' },\n },\n};\n\nconst Template = args => {\n const surface = document.createElement('div');\n surface.className = 'bg-surface-on-body rounded-sm p-32';\n const toast = document.createElement('sula-toast');\n const { toastAction, toastDismissRequested, ...props } = args;\n Object.assign(toast, props);\n toast.addEventListener('toastAction', event => toastAction?.(event));\n toast.addEventListener('toastDismissRequested', event => toastDismissRequested?.(event));\n surface.append(toast);\n return surface;\n};\n\nconst defaults = {\n toastTitle: 'Toast title',\n message: 'This is a description with supporting details.',\n actionText: 'Desfazer',\n duration: 0,\n icon: 'ph ph-circle-dashed',\n closable: true,\n announcement: 'polite',\n closeLabel: 'Fechar notificação',\n};\nexport const Neutral = { render: Template, args: { ...defaults, type: SulaToastType.Neutral } };\nexport const Brand = { render: Template, args: { ...defaults, type: SulaToastType.Brand } };\nexport const Info = { render: Template, args: { ...defaults, type: SulaToastType.Info, icon: 'ph ph-info' } };\nexport const Success = { render: Template, args: { ...defaults, type: SulaToastType.Success, icon: 'ph ph-check-circle' } };\nexport const Warning = { render: Template, args: { ...defaults, type: SulaToastType.Warning, icon: 'ph ph-warning' } };\nexport const Danger = { render: Template, args: { ...defaults, type: SulaToastType.Danger, icon: 'ph ph-warning-circle' } };\nexport const WithoutAction = { render: Template, args: { ...defaults, actionText: '' } };\nexport const WithoutIconOrClose = { render: Template, args: { ...defaults, icon: '', closable: false } };\nexport const LongContent = {\n render: Template,\n args: {\n ...defaults,\n toastTitle: 'Um título que pode ocupar mais de uma linha',\n message:\n 'A descrição ocupa até quatro linhas e termina com reticências quando o conteúdo ultrapassa o espaço disponível: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz.',\n actionText: 'Uma ação extensa também permanece em uma única linha',\n },\n};\nexport const ControlledDismissal = {\n render: () => {\n const container = document.createElement('div');\n const show = document.createElement('button');\n show.type = 'button';\n show.textContent = 'Mostrar notificação novamente';\n show.className = 'text-text-link underline mb-24';\n const output = document.createElement('div');\n\n const showToast = () => {\n const toast = document.createElement('sula-toast');\n toast.toastTitle = 'Alterações salvas';\n toast.message = 'Passe o mouse ou use Tab para pausar o tempo.';\n toast.addEventListener('toastDismissRequested', () => {\n const wasFocused = toast.matches(':focus-within');\n toast.remove();\n show.hidden = false;\n if (wasFocused) show.focus();\n });\n show.hidden = true;\n output.replaceChildren(toast);\n };\n\n show.addEventListener('click', showToast);\n container.append(show, output);\n showToast();\n return container;\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-toast-stack.model.js","sourceRoot":"","sources":["../../../../src/components/sula-toast-stack/model/sula-toast-stack.model.ts"],"names":[],"mappings":"","sourcesContent":["import type { SulaToastAnnouncement } from '../../sula-toast/model/sula-toast.model';\n\nexport type AnnouncementPriority = Exclude<SulaToastAnnouncement, 'off'>;\n\nexport interface Announcement {\n id: string;\n version: number;\n text: string;\n priority: AnnouncementPriority;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{font-family:Figtree;line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.absolute{position:absolute}.block{display:block}.hidden{display:none}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}:host,:host button,:host input,:host option,:host select,:host textarea{font-family:Figtree,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}:host{background-color:transparent;display:block;max-width:400px;width:100%}.toast-region{background-color:transparent}.toast-list--collapsed{padding-top:var(--toast-layer-offset)}.toast-layer--entering{animation:sula-toast-stack-enter .2s cubic-bezier(.2,.8,.2,1)}@keyframes sula-toast-stack-enter{0%{scale:.98;translate:0 -8px}to{scale:1;translate:0}}@media (prefers-reduced-motion:reduce){.toast-layer--entering{animation:none}}.toast-layer.toast-layer--covered{bottom:0;clip-path:inset(0 0 calc(100% - 12px) 0);position:absolute;top:var(--toast-layer-offset);inset-inline:0;margin-inline:auto;pointer-events:none;transform:translateY(calc(var(--toast-depth)*-12px));width:var(--toast-width)}.toast-layer.toast-layer--covered sula-toast,.toast-layer.toast-layer--covered sula-toast::part(container){height:100%}.toast-layer.toast-layer--covered sula-toast::part(container){box-shadow:none;isolation:auto;overflow:hidden}.toast-layer.toast-layer--covered sula-toast::part(close-button),.toast-layer.toast-layer--covered sula-toast::part(content),.toast-layer.toast-layer--covered sula-toast::part(icon){visibility:hidden}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:300;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Light.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:300;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-LightItalic.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:400;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Regular.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:400;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Italic.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:500;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Medium.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:500;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-MediumItalic.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:600;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-SemiBold.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:600;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-SemiBoldItalic.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:700;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Bold.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:700;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-BoldItalic.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:800;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-ExtraBold.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:800;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-ExtraBoldItalic.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:900;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Black.ttf) format("truetype")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:900;src:local("Figtree"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-BlackItalic.ttf) format("truetype")}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#012b15;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#330d00;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#402705;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#401204;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#402301;--color-gray-50:#fff;--color-gray-100:#f3f4f4;--color-gray-200:#e5e6e6;--color-gray-300:#bfc0c0;--color-gray-400:#acaeae;--color-gray-500:#949595;--color-gray-600:#737575;--color-gray-700:#6c6e6e;--color-gray-800:#313333;--color-gray-900:#272929;--color-gray-950:#191d1d;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#071e40;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:rgba(25,29,29,.02);--color-black-opacity-100:rgba(25,29,29,.05);--color-black-opacity-200:rgba(25,29,29,.11);--color-black-opacity-300:rgba(25,29,29,.28);--color-black-opacity-400:rgba(25,29,29,.36);--color-black-opacity-500:rgba(25,29,29,.44);--color-black-opacity-600:rgba(25,29,29,.62);--color-black-opacity-700:rgba(25,29,29,.64);--color-black-opacity-800:rgba(25,29,29,.72);--color-black-opacity-900:rgba(25,29,29,.8);--color-black-opacity-950:rgba(25,29,29,.96);--color-shadow-opacity-50:rgba(0,0,0,.04);--color-shadow-opacity-100:rgba(0,0,0,.06);--color-shadow-opacity-200:rgba(0,0,0,.12);--color-shadow-opacity-300:rgba(0,0,0,.2);--color-shadow-opacity-400:rgba(0,0,0,.32);--color-shadow-opacity-500:rgba(0,0,0,.5);--color-shadow-opacity-600:rgba(0,0,0,.55);--color-shadow-opacity-700:rgba(0,0,0,.64);--color-shadow-opacity-800:rgba(0,0,0,.73);--color-shadow-opacity-900:rgba(0,0,0,.8);--color-shadow-opacity-950:rgba(0,0,0,.91);--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f3f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#313333;--color-text-secondary:#6c6e6e;--color-text-disabled:#949595;--color-text-link:#1355b4;--color-states-empty-bg-hover:rgba(25,29,29,.05);--color-states-empty-bg-pressed:rgba(25,29,29,.11);--color-states-bg-disabled:rgba(25,29,29,.02);--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e5e6e6;--color-states-negative-pressed:#bfc0c0;--color-icon-primary:#6c6e6e;--color-icon-secondary:#fff;--color-icon-tertiary:#b30404;--color-icon-disabled:#acaeae;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f3f4f4;--color-neutral-neutral-3:#acaeae;--color-neutral-neutral-4:#949595;--color-neutral-neutral-5:#737575;--color-neutral-neutral-6:#6c6e6e;--color-neutral-neutral-7:#313333;--color-neutral-neutral-8:#272929;--color-negative-negative-1:#fff;--color-negative-negative-2:#313333;--color-opacity-body:#fffc;--color-opacity-on-body:rgba(25,29,29,.02);--color-opacity-overlay:rgba(25,29,29,.62);--color-opacity-on-overlay:#ffffff1a;--color-opacity-toast:#ffffff45;--color-line-input:#949595;--color-line-general-strong:#bfc0c0;--color-line-general:#e5e6e6;--color-line-hair:rgba(25,29,29,.05);--color-box-shadow-body:#fff;--color-box-shadow-shadow-color-1:rgba(0,0,0,.04);--color-box-shadow-shadow-color-2:rgba(0,0,0,.06)}.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.static{position:static}.relative{position:relative}.flex{display:flex}.w-full{width:100%}.min-w-0{min-width:0}.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.gap-12{gap:.75rem}.rounded-sm{border-radius:.75rem}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-2:focus-visible{outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-feedback-informational:focus-visible{outline-color:var(--color-feedback-informational)}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { SulaToastStackMotion } from "./sula-toast-stack.motion";
|
|
3
|
+
const MAX_VISIBLE_LAYERS = 3;
|
|
4
|
+
const LAYER_OFFSET = 12;
|
|
5
|
+
const LAYER_WIDTH_STEP = 5;
|
|
6
|
+
export class SulaToastStack {
|
|
7
|
+
constructor() {
|
|
8
|
+
/** Notifications in chronological order, oldest first. Only the latest three are rendered. Replace the array to update it. IDs must be unique. */
|
|
9
|
+
this.items = [];
|
|
10
|
+
this.hovering = false;
|
|
11
|
+
this.focused = false;
|
|
12
|
+
this.noHover = false;
|
|
13
|
+
this.retainingPointerExpansion = false;
|
|
14
|
+
this.announcements = [];
|
|
15
|
+
this.announcementVersions = 0;
|
|
16
|
+
this.announcementSignatures = new Map();
|
|
17
|
+
this.enteringIds = new Set();
|
|
18
|
+
this.keyboardInteraction = false;
|
|
19
|
+
this.releaseFocusAfterRender = false;
|
|
20
|
+
this.ready = false;
|
|
21
|
+
this.connected = false;
|
|
22
|
+
this.motion = new SulaToastStackMotion();
|
|
23
|
+
this.handleMediaChange = (event) => {
|
|
24
|
+
this.noHover = event.matches;
|
|
25
|
+
this.hovering = false;
|
|
26
|
+
this.stopRetainingPointerExpansion();
|
|
27
|
+
};
|
|
28
|
+
this.handlePointerMove = (event) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const bounds = (_a = this.region) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
31
|
+
this.hovering = !!bounds && event.clientX >= bounds.left && event.clientX <= bounds.right && event.clientY >= bounds.top && event.clientY <= bounds.bottom;
|
|
32
|
+
this.stopRetainingPointerExpansion();
|
|
33
|
+
};
|
|
34
|
+
this.handleFocusOut = () => {
|
|
35
|
+
if (this.focusFrame !== undefined)
|
|
36
|
+
cancelAnimationFrame(this.focusFrame);
|
|
37
|
+
this.focusFrame = requestAnimationFrame(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
this.focusFrame = undefined;
|
|
40
|
+
this.focused = !!((_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
this.dismiss = (event, id) => {
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
this.toastDismissRequested.emit({ id, reason: event.detail.reason });
|
|
46
|
+
};
|
|
47
|
+
this.action = (event, id) => {
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
this.toastAction.emit({ id });
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
get expanded() {
|
|
53
|
+
return this.noHover || this.hovering || this.focused || this.retainingPointerExpansion;
|
|
54
|
+
}
|
|
55
|
+
get visibleItems() {
|
|
56
|
+
return this.items.slice(-MAX_VISIBLE_LAYERS);
|
|
57
|
+
}
|
|
58
|
+
get motionTargets() {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
const reduceMotion = (_b = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(prefers-reduced-motion: reduce)').matches) !== null && _b !== void 0 ? _b : false;
|
|
61
|
+
if (!this.ready || this.noHover || reduceMotion || !((_c = this.region) === null || _c === void 0 ? void 0 : _c.animate) || !this.list)
|
|
62
|
+
return;
|
|
63
|
+
return { region: this.region, list: this.list };
|
|
64
|
+
}
|
|
65
|
+
connectedCallback() {
|
|
66
|
+
this.connected = true;
|
|
67
|
+
if (this.ready)
|
|
68
|
+
this.connectListeners();
|
|
69
|
+
}
|
|
70
|
+
componentDidLoad() {
|
|
71
|
+
this.ready = true;
|
|
72
|
+
this.connectListeners();
|
|
73
|
+
Promise.resolve().then(() => {
|
|
74
|
+
if (this.connected)
|
|
75
|
+
this.updateAnnouncements();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
componentWillRender() {
|
|
79
|
+
if (this.renderedExpanded === this.expanded)
|
|
80
|
+
return;
|
|
81
|
+
this.renderedExpanded = this.expanded;
|
|
82
|
+
const targets = this.motionTargets;
|
|
83
|
+
if (!targets) {
|
|
84
|
+
this.motion.cancel();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.motion.capture(targets.region, targets.list);
|
|
88
|
+
}
|
|
89
|
+
componentDidRender() {
|
|
90
|
+
this.restoreFocus();
|
|
91
|
+
this.releasePointerFocus();
|
|
92
|
+
if (this.region && this.list)
|
|
93
|
+
this.motion.play(this.region, this.list);
|
|
94
|
+
}
|
|
95
|
+
disconnectedCallback() {
|
|
96
|
+
var _a;
|
|
97
|
+
this.connected = false;
|
|
98
|
+
this.motion.cancel();
|
|
99
|
+
(_a = this.media) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', this.handleMediaChange);
|
|
100
|
+
window.removeEventListener('pointermove', this.handlePointerMove);
|
|
101
|
+
if (this.focusFrame !== undefined)
|
|
102
|
+
cancelAnimationFrame(this.focusFrame);
|
|
103
|
+
this.focusFrame = undefined;
|
|
104
|
+
this.keyboardInteraction = false;
|
|
105
|
+
this.retainingPointerExpansion = false;
|
|
106
|
+
this.hovering = false;
|
|
107
|
+
this.focused = false;
|
|
108
|
+
}
|
|
109
|
+
handleItemsChange(next, previous = []) {
|
|
110
|
+
var _a, _b, _c, _d, _e, _f;
|
|
111
|
+
const targets = this.motionTargets;
|
|
112
|
+
if (targets)
|
|
113
|
+
this.motion.capture(targets.region, targets.list);
|
|
114
|
+
else
|
|
115
|
+
this.motion.cancel();
|
|
116
|
+
const active = (_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement;
|
|
117
|
+
const focusedId = (_b = active === null || active === void 0 ? void 0 : active.closest('[data-toast-id]')) === null || _b === void 0 ? void 0 : _b.dataset.toastId;
|
|
118
|
+
const nextVisible = next.slice(-MAX_VISIBLE_LAYERS);
|
|
119
|
+
const previousVisibleIds = new Set(previous.slice(-MAX_VISIBLE_LAYERS).map(item => item.id));
|
|
120
|
+
this.enteringIds = this.ready ? new Set(nextVisible.filter(item => !previousVisibleIds.has(item.id)).map(item => item.id)) : new Set();
|
|
121
|
+
if (focusedId !== undefined && !nextVisible.some(item => item.id === focusedId)) {
|
|
122
|
+
if (this.keyboardInteraction) {
|
|
123
|
+
const visibleIds = new Set(nextVisible.map(item => item.id));
|
|
124
|
+
const index = previous.findIndex(item => item.id === focusedId);
|
|
125
|
+
const following = previous.slice(index + 1).find(item => visibleIds.has(item.id));
|
|
126
|
+
const preceding = previous
|
|
127
|
+
.slice(0, index)
|
|
128
|
+
.reverse()
|
|
129
|
+
.find(item => visibleIds.has(item.id));
|
|
130
|
+
this.focusTarget = (_f = (_d = (_c = following === null || following === void 0 ? void 0 : following.id) !== null && _c !== void 0 ? _c : preceding === null || preceding === void 0 ? void 0 : preceding.id) !== null && _d !== void 0 ? _d : (_e = nextVisible[0]) === null || _e === void 0 ? void 0 : _e.id) !== null && _f !== void 0 ? _f : '';
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.focusTarget = undefined;
|
|
134
|
+
this.releaseFocusAfterRender = true;
|
|
135
|
+
if (nextVisible.length && !this.noHover) {
|
|
136
|
+
this.retainingPointerExpansion = true;
|
|
137
|
+
window.addEventListener('pointermove', this.handlePointerMove, { once: true });
|
|
138
|
+
}
|
|
139
|
+
this.focused = false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (this.ready)
|
|
143
|
+
this.updateAnnouncements();
|
|
144
|
+
}
|
|
145
|
+
updateAnnouncements() {
|
|
146
|
+
const records = [];
|
|
147
|
+
const signatures = new Map();
|
|
148
|
+
for (const item of this.visibleItems) {
|
|
149
|
+
const priority = item.announcement || 'polite';
|
|
150
|
+
const text = [item.title, item.message].filter(Boolean).join('. ');
|
|
151
|
+
const signature = JSON.stringify([text, priority]);
|
|
152
|
+
signatures.set(item.id, signature);
|
|
153
|
+
if (priority === 'off' || !text)
|
|
154
|
+
continue;
|
|
155
|
+
const previous = this.announcements.find(record => record.id === item.id);
|
|
156
|
+
records.push(this.announcementSignatures.get(item.id) === signature && previous
|
|
157
|
+
? previous
|
|
158
|
+
: {
|
|
159
|
+
id: item.id,
|
|
160
|
+
text,
|
|
161
|
+
priority,
|
|
162
|
+
version: ++this.announcementVersions,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
this.announcementSignatures = signatures;
|
|
166
|
+
this.announcements = records;
|
|
167
|
+
}
|
|
168
|
+
connectListeners() {
|
|
169
|
+
var _a, _b, _c, _d;
|
|
170
|
+
this.media = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(hover: none)');
|
|
171
|
+
this.noHover = (_c = (_b = this.media) === null || _b === void 0 ? void 0 : _b.matches) !== null && _c !== void 0 ? _c : false;
|
|
172
|
+
(_d = this.media) === null || _d === void 0 ? void 0 : _d.addEventListener('change', this.handleMediaChange);
|
|
173
|
+
}
|
|
174
|
+
stopRetainingPointerExpansion() {
|
|
175
|
+
window.removeEventListener('pointermove', this.handlePointerMove);
|
|
176
|
+
this.retainingPointerExpansion = false;
|
|
177
|
+
}
|
|
178
|
+
restoreFocus() {
|
|
179
|
+
var _a, _b;
|
|
180
|
+
if (this.focusTarget === undefined)
|
|
181
|
+
return;
|
|
182
|
+
const targetId = this.focusTarget;
|
|
183
|
+
this.focusTarget = undefined;
|
|
184
|
+
const target = Array.from(((_a = this.list) === null || _a === void 0 ? void 0 : _a.querySelectorAll('[data-toast-id]')) || []).find(element => element.dataset.toastId === targetId);
|
|
185
|
+
(_b = (target || this.region)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
186
|
+
}
|
|
187
|
+
releasePointerFocus() {
|
|
188
|
+
var _a, _b;
|
|
189
|
+
if (!this.releaseFocusAfterRender)
|
|
190
|
+
return;
|
|
191
|
+
this.releaseFocusAfterRender = false;
|
|
192
|
+
let active = (_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement;
|
|
193
|
+
while ((_b = active === null || active === void 0 ? void 0 : active.shadowRoot) === null || _b === void 0 ? void 0 : _b.activeElement)
|
|
194
|
+
active = active.shadowRoot.activeElement;
|
|
195
|
+
active === null || active === void 0 ? void 0 : active.blur();
|
|
196
|
+
this.focused = false;
|
|
197
|
+
}
|
|
198
|
+
render() {
|
|
199
|
+
const expanded = this.expanded;
|
|
200
|
+
const visibleItems = this.visibleItems;
|
|
201
|
+
return (h(Host, { key: 'e52aeb1dd9f0d54498a4c7a0ad2300cdc5d24484' }, h("section", { key: '7c829968e841616450c308571cd1b60341b3c38b', ref: el => (this.region = el), role: "region", "aria-label": "Notifica\u00E7\u00F5es", tabIndex: 0, class: "toast-region w-full rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-feedback-informational focus-visible:outline-offset-2", onMouseEnter: () => {
|
|
202
|
+
if (!this.noHover)
|
|
203
|
+
this.hovering = true;
|
|
204
|
+
}, onMouseLeave: () => (this.hovering = false), onPointerDown: () => {
|
|
205
|
+
this.keyboardInteraction = false;
|
|
206
|
+
this.stopRetainingPointerExpansion();
|
|
207
|
+
}, onKeyDown: () => {
|
|
208
|
+
this.keyboardInteraction = true;
|
|
209
|
+
this.stopRetainingPointerExpansion();
|
|
210
|
+
}, onFocusin: () => (this.focused = true), onFocusout: this.handleFocusOut }, h("div", { key: '2327880499750943034cf47d8f2ea2dfd13d0e5a', ref: el => (this.list = el), class: { 'toast-list relative flex flex-col gap-12': true, 'toast-list--collapsed': !expanded }, style: {
|
|
211
|
+
'--toast-layer-offset': `${Math.max(0, visibleItems.length - 1) * LAYER_OFFSET}px`,
|
|
212
|
+
} }, visibleItems.map((item, index) => {
|
|
213
|
+
var _a, _b, _c, _d;
|
|
214
|
+
const depth = visibleItems.length - 1 - index;
|
|
215
|
+
const covered = !expanded && depth > 0;
|
|
216
|
+
return (h("div", { key: item.id, "data-toast-id": item.id, tabIndex: -1, "aria-hidden": covered ? 'true' : undefined, inert: covered, class: {
|
|
217
|
+
'toast-layer relative w-full min-w-0 shrink-0': true,
|
|
218
|
+
'toast-layer--covered': covered,
|
|
219
|
+
'toast-layer--entering': this.enteringIds.has(item.id),
|
|
220
|
+
}, style: {
|
|
221
|
+
'--toast-depth': String(depth),
|
|
222
|
+
'--toast-width': `${100 - Math.min(depth, MAX_VISIBLE_LAYERS - 1) * LAYER_WIDTH_STEP}%`,
|
|
223
|
+
} }, h("sula-toast", { toastTitle: item.title, message: (_a = item.message) !== null && _a !== void 0 ? _a : '', type: item.type, icon: item.icon, actionText: (_b = item.actionText) !== null && _b !== void 0 ? _b : '', closable: (_c = item.closable) !== null && _c !== void 0 ? _c : true, duration: item.duration, closeLabel: (_d = item.closeLabel) !== null && _d !== void 0 ? _d : 'Fechar notificação', paused: covered || this.hovering || this.focused || this.retainingPointerExpansion, announcement: "off", animated: depth === 0, onToastDismissRequested: event => this.dismiss(event, item.id), onToastAction: event => this.action(event, item.id) })));
|
|
224
|
+
}))), h("div", { key: 'be446beb46594f14b6079a5a0649c9bf3a17b0cb', class: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "false", "aria-relevant": "additions text" }, this.announcements
|
|
225
|
+
.filter(record => record.priority === 'polite')
|
|
226
|
+
.map(record => (h("p", { key: record.version }, record.text)))), h("div", { key: '5d9e871c11e91fb293f22c92ddd5a590517576f1', class: "sr-only", role: "alert", "aria-live": "assertive", "aria-atomic": "false", "aria-relevant": "additions text" }, this.announcements
|
|
227
|
+
.filter(record => record.priority === 'assertive')
|
|
228
|
+
.map(record => (h("p", { key: record.version }, record.text))))));
|
|
229
|
+
}
|
|
230
|
+
static get is() { return "sula-toast-stack"; }
|
|
231
|
+
static get encapsulation() { return "shadow"; }
|
|
232
|
+
static get originalStyleUrls() {
|
|
233
|
+
return {
|
|
234
|
+
"$": ["sula-toast-stack.scss"]
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
static get styleUrls() {
|
|
238
|
+
return {
|
|
239
|
+
"$": ["sula-toast-stack.css"]
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
static get properties() {
|
|
243
|
+
return {
|
|
244
|
+
"items": {
|
|
245
|
+
"type": "unknown",
|
|
246
|
+
"attribute": "items",
|
|
247
|
+
"mutable": false,
|
|
248
|
+
"complexType": {
|
|
249
|
+
"original": "SulaToastItem[]",
|
|
250
|
+
"resolved": "SulaToastItem[]",
|
|
251
|
+
"references": {
|
|
252
|
+
"SulaToastItem": {
|
|
253
|
+
"location": "import",
|
|
254
|
+
"path": "../sula-toast/model/sula-toast.model",
|
|
255
|
+
"id": "src/components/sula-toast/model/sula-toast.model.ts::SulaToastItem"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"required": false,
|
|
260
|
+
"optional": false,
|
|
261
|
+
"docs": {
|
|
262
|
+
"tags": [],
|
|
263
|
+
"text": "Notifications in chronological order, oldest first. Only the latest three are rendered. Replace the array to update it. IDs must be unique."
|
|
264
|
+
},
|
|
265
|
+
"getter": false,
|
|
266
|
+
"setter": false,
|
|
267
|
+
"defaultValue": "[]"
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
static get states() {
|
|
272
|
+
return {
|
|
273
|
+
"hovering": {},
|
|
274
|
+
"focused": {},
|
|
275
|
+
"noHover": {},
|
|
276
|
+
"retainingPointerExpansion": {},
|
|
277
|
+
"announcements": {}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
static get events() {
|
|
281
|
+
return [{
|
|
282
|
+
"method": "toastDismissRequested",
|
|
283
|
+
"name": "toastDismissRequested",
|
|
284
|
+
"bubbles": true,
|
|
285
|
+
"cancelable": true,
|
|
286
|
+
"composed": true,
|
|
287
|
+
"docs": {
|
|
288
|
+
"tags": [],
|
|
289
|
+
"text": "Requests removal of the identified notification by the consumer."
|
|
290
|
+
},
|
|
291
|
+
"complexType": {
|
|
292
|
+
"original": "SulaToastStackDismissEvent",
|
|
293
|
+
"resolved": "SulaToastStackDismissEvent",
|
|
294
|
+
"references": {
|
|
295
|
+
"SulaToastStackDismissEvent": {
|
|
296
|
+
"location": "import",
|
|
297
|
+
"path": "../sula-toast/model/sula-toast.model",
|
|
298
|
+
"id": "src/components/sula-toast/model/sula-toast.model.ts::SulaToastStackDismissEvent"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}, {
|
|
303
|
+
"method": "toastAction",
|
|
304
|
+
"name": "toastAction",
|
|
305
|
+
"bubbles": true,
|
|
306
|
+
"cancelable": true,
|
|
307
|
+
"composed": true,
|
|
308
|
+
"docs": {
|
|
309
|
+
"tags": [],
|
|
310
|
+
"text": "Requests the identified notification's action without removing it."
|
|
311
|
+
},
|
|
312
|
+
"complexType": {
|
|
313
|
+
"original": "SulaToastStackActionEvent",
|
|
314
|
+
"resolved": "SulaToastStackActionEvent",
|
|
315
|
+
"references": {
|
|
316
|
+
"SulaToastStackActionEvent": {
|
|
317
|
+
"location": "import",
|
|
318
|
+
"path": "../sula-toast/model/sula-toast.model",
|
|
319
|
+
"id": "src/components/sula-toast/model/sula-toast.model.ts::SulaToastStackActionEvent"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}];
|
|
324
|
+
}
|
|
325
|
+
static get elementRef() { return "hostElement"; }
|
|
326
|
+
static get watchers() {
|
|
327
|
+
return [{
|
|
328
|
+
"propName": "items",
|
|
329
|
+
"methodName": "handleItemsChange"
|
|
330
|
+
}];
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=sula-toast-stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-toast-stack.js","sourceRoot":"","sources":["../../../src/components/sula-toast-stack/sula-toast-stack.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAGrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAG3B,MAAM,OAAO,cAAc;IAD3B;QAIE,kJAAkJ;QAC1I,UAAK,GAAoB,EAAE,CAAC;QAQ3B,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,GAAG,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AS,EAAC,IAAI,EAAC,OAAO,eAAW,WAAW,iBAAa,OAAO,mBAAe,gBAAgB,IACvG,IAAI,CAAC,aAAa;iBAChB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;iBACjD,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CACb,SAAG,GAAG,EAAE,MAAM,CAAC,OAAO,IAAG,MAAM,CAAC,IAAI,CAAK,CAC1C,CAAC,CACA,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\nimport { SulaToastDismissEvent, SulaToastItem, SulaToastStackActionEvent, SulaToastStackDismissEvent } from '../sula-toast/model/sula-toast.model';\nimport type { Announcement } from './model/sula-toast-stack.model';\nimport { SulaToastStackMotion } from './sula-toast-stack.motion';\n\nconst MAX_VISIBLE_LAYERS = 3;\nconst LAYER_OFFSET = 12;\nconst LAYER_WIDTH_STEP = 5;\n\n@Component({ tag: 'sula-toast-stack', styleUrl: 'sula-toast-stack.scss', shadow: true })\nexport class SulaToastStack {\n @Element() hostElement: HTMLElement;\n\n /** Notifications in chronological order, oldest first. Only the latest three are rendered. Replace the array to update it. IDs must be unique. */\n @Prop() items: SulaToastItem[] = [];\n\n /** Requests removal of the identified notification by the consumer. */\n @Event() toastDismissRequested: EventEmitter<SulaToastStackDismissEvent>;\n\n /** Requests the identified notification's action without removing it. */\n @Event() toastAction: EventEmitter<SulaToastStackActionEvent>;\n\n @State() hovering = false;\n @State() focused = false;\n @State() noHover = false;\n @State() retainingPointerExpansion = false;\n @State() announcements: Announcement[] = [];\n\n private region?: HTMLElement;\n private list?: HTMLElement;\n private media?: MediaQueryList;\n private announcementVersions = 0;\n private announcementSignatures = new Map<string, string>();\n private enteringIds = new Set<string>();\n private focusTarget?: string;\n private focusFrame?: number;\n private keyboardInteraction = false;\n private releaseFocusAfterRender = false;\n private ready = false;\n private connected = false;\n private renderedExpanded?: boolean;\n private motion = new SulaToastStackMotion();\n\n private get expanded() {\n return this.noHover || this.hovering || this.focused || this.retainingPointerExpansion;\n }\n\n private get visibleItems() {\n return this.items.slice(-MAX_VISIBLE_LAYERS);\n }\n\n private get motionTargets() {\n const reduceMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;\n if (!this.ready || this.noHover || reduceMotion || !this.region?.animate || !this.list) return;\n return { region: this.region, list: this.list };\n }\n\n connectedCallback() {\n this.connected = true;\n if (this.ready) this.connectListeners();\n }\n\n componentDidLoad() {\n this.ready = true;\n this.connectListeners();\n Promise.resolve().then(() => {\n if (this.connected) this.updateAnnouncements();\n });\n }\n\n componentWillRender() {\n if (this.renderedExpanded === this.expanded) return;\n this.renderedExpanded = this.expanded;\n const targets = this.motionTargets;\n if (!targets) {\n this.motion.cancel();\n return;\n }\n this.motion.capture(targets.region, targets.list);\n }\n\n componentDidRender() {\n this.restoreFocus();\n this.releasePointerFocus();\n if (this.region && this.list) this.motion.play(this.region, this.list);\n }\n\n disconnectedCallback() {\n this.connected = false;\n this.motion.cancel();\n this.media?.removeEventListener('change', this.handleMediaChange);\n window.removeEventListener('pointermove', this.handlePointerMove);\n if (this.focusFrame !== undefined) cancelAnimationFrame(this.focusFrame);\n this.focusFrame = undefined;\n this.keyboardInteraction = false;\n this.retainingPointerExpansion = false;\n this.hovering = false;\n this.focused = false;\n }\n\n @Watch('items')\n handleItemsChange(next: SulaToastItem[], previous: SulaToastItem[] = []) {\n const targets = this.motionTargets;\n if (targets) this.motion.capture(targets.region, targets.list);\n else this.motion.cancel();\n const active = this.hostElement.shadowRoot?.activeElement as HTMLElement | null;\n const focusedId = active?.closest<HTMLElement>('[data-toast-id]')?.dataset.toastId;\n const nextVisible = next.slice(-MAX_VISIBLE_LAYERS);\n const previousVisibleIds = new Set(previous.slice(-MAX_VISIBLE_LAYERS).map(item => item.id));\n this.enteringIds = this.ready ? new Set(nextVisible.filter(item => !previousVisibleIds.has(item.id)).map(item => item.id)) : new Set();\n if (focusedId !== undefined && !nextVisible.some(item => item.id === focusedId)) {\n if (this.keyboardInteraction) {\n const visibleIds = new Set(nextVisible.map(item => item.id));\n const index = previous.findIndex(item => item.id === focusedId);\n const following = previous.slice(index + 1).find(item => visibleIds.has(item.id));\n const preceding = previous\n .slice(0, index)\n .reverse()\n .find(item => visibleIds.has(item.id));\n this.focusTarget = following?.id ?? preceding?.id ?? nextVisible[0]?.id ?? '';\n } else {\n this.focusTarget = undefined;\n this.releaseFocusAfterRender = true;\n if (nextVisible.length && !this.noHover) {\n this.retainingPointerExpansion = true;\n window.addEventListener('pointermove', this.handlePointerMove, { once: true });\n }\n this.focused = false;\n }\n }\n if (this.ready) this.updateAnnouncements();\n }\n\n private updateAnnouncements() {\n const records: Announcement[] = [];\n const signatures = new Map<string, string>();\n for (const item of this.visibleItems) {\n const priority = item.announcement || 'polite';\n const text = [item.title, item.message].filter(Boolean).join('. ');\n const signature = JSON.stringify([text, priority]);\n signatures.set(item.id, signature);\n if (priority === 'off' || !text) continue;\n const previous = this.announcements.find(record => record.id === item.id);\n records.push(\n this.announcementSignatures.get(item.id) === signature && previous\n ? previous\n : {\n id: item.id,\n text,\n priority,\n version: ++this.announcementVersions,\n },\n );\n }\n this.announcementSignatures = signatures;\n this.announcements = records;\n }\n\n private connectListeners() {\n this.media = window.matchMedia?.('(hover: none)');\n this.noHover = this.media?.matches ?? false;\n this.media?.addEventListener('change', this.handleMediaChange);\n }\n\n private handleMediaChange = (event: MediaQueryListEvent) => {\n this.noHover = event.matches;\n this.hovering = false;\n this.stopRetainingPointerExpansion();\n };\n\n private handlePointerMove = (event: PointerEvent) => {\n const bounds = this.region?.getBoundingClientRect();\n this.hovering = !!bounds && event.clientX >= bounds.left && event.clientX <= bounds.right && event.clientY >= bounds.top && event.clientY <= bounds.bottom;\n this.stopRetainingPointerExpansion();\n };\n\n private stopRetainingPointerExpansion() {\n window.removeEventListener('pointermove', this.handlePointerMove);\n this.retainingPointerExpansion = false;\n }\n\n private restoreFocus() {\n if (this.focusTarget === undefined) return;\n const targetId = this.focusTarget;\n this.focusTarget = undefined;\n const target = Array.from(this.list?.querySelectorAll<HTMLElement>('[data-toast-id]') || []).find(element => element.dataset.toastId === targetId);\n (target || this.region)?.focus();\n }\n\n private releasePointerFocus() {\n if (!this.releaseFocusAfterRender) return;\n this.releaseFocusAfterRender = false;\n let active = this.hostElement.shadowRoot?.activeElement as HTMLElement | null;\n while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement as HTMLElement;\n active?.blur();\n this.focused = false;\n }\n\n private handleFocusOut = () => {\n if (this.focusFrame !== undefined) cancelAnimationFrame(this.focusFrame);\n this.focusFrame = requestAnimationFrame(() => {\n this.focusFrame = undefined;\n this.focused = !!this.hostElement.shadowRoot?.activeElement;\n });\n };\n\n private dismiss = (event: CustomEvent<SulaToastDismissEvent>, id: string) => {\n event.stopPropagation();\n this.toastDismissRequested.emit({ id, reason: event.detail.reason });\n };\n\n private action = (event: CustomEvent<void>, id: string) => {\n event.stopPropagation();\n this.toastAction.emit({ id });\n };\n\n render() {\n const expanded = this.expanded;\n const visibleItems = this.visibleItems;\n return (\n <Host>\n <section\n ref={el => (this.region = el)}\n role=\"region\"\n aria-label=\"Notificações\"\n tabIndex={0}\n class=\"toast-region w-full rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-feedback-informational focus-visible:outline-offset-2\"\n onMouseEnter={() => {\n if (!this.noHover) this.hovering = true;\n }}\n onMouseLeave={() => (this.hovering = false)}\n onPointerDown={() => {\n this.keyboardInteraction = false;\n this.stopRetainingPointerExpansion();\n }}\n onKeyDown={() => {\n this.keyboardInteraction = true;\n this.stopRetainingPointerExpansion();\n }}\n onFocusin={() => (this.focused = true)}\n onFocusout={this.handleFocusOut}\n >\n <div\n ref={el => (this.list = el)}\n class={{ 'toast-list relative flex flex-col gap-12': true, 'toast-list--collapsed': !expanded }}\n style={{\n '--toast-layer-offset': `${Math.max(0, visibleItems.length - 1) * LAYER_OFFSET}px`,\n }}\n >\n {visibleItems.map((item, index) => {\n const depth = visibleItems.length - 1 - index;\n const covered = !expanded && depth > 0;\n return (\n <div\n key={item.id}\n data-toast-id={item.id}\n tabIndex={-1}\n aria-hidden={covered ? 'true' : undefined}\n inert={covered}\n class={{\n 'toast-layer relative w-full min-w-0 shrink-0': true,\n 'toast-layer--covered': covered,\n 'toast-layer--entering': this.enteringIds.has(item.id),\n }}\n style={{\n '--toast-depth': String(depth),\n '--toast-width': `${100 - Math.min(depth, MAX_VISIBLE_LAYERS - 1) * LAYER_WIDTH_STEP}%`,\n }}\n >\n <sula-toast\n toastTitle={item.title}\n message={item.message ?? ''}\n type={item.type}\n icon={item.icon}\n actionText={item.actionText ?? ''}\n closable={item.closable ?? true}\n duration={item.duration}\n closeLabel={item.closeLabel ?? 'Fechar notificação'}\n paused={covered || this.hovering || this.focused || this.retainingPointerExpansion}\n announcement=\"off\"\n animated={depth === 0}\n onToastDismissRequested={event => this.dismiss(event, item.id)}\n onToastAction={event => this.action(event, item.id)}\n />\n </div>\n );\n })}\n </div>\n </section>\n <div class=\"sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"false\" aria-relevant=\"additions text\">\n {this.announcements\n .filter(record => record.priority === 'polite')\n .map(record => (\n <p key={record.version}>{record.text}</p>\n ))}\n </div>\n <div class=\"sr-only\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"false\" aria-relevant=\"additions text\">\n {this.announcements\n .filter(record => record.priority === 'assertive')\n .map(record => (\n <p key={record.version}>{record.text}</p>\n ))}\n </div>\n </Host>\n );\n }\n}\n"]}
|