{"version":3,"names":["SLOTS","title","message","link","actionsEnd","CSS","close","container","content","icon","noticeCss","CalciteNoticeStyle0","Notice","this","setTransitionEl","el","transitionEl","open","openTransitionProp","openHandler","onToggleOpenCloseComponent","onMessagesChange","updateRequestedIcon","requestedIcon","setRequestedIcon","KindIcons","kind","connectedCallback","connectConditionalSlotComponent","connectLocalized","connectMessages","disconnectedCallback","disconnectConditionalSlotComponent","disconnectLocalized","disconnectMessages","componentWillLoad","setUpLoadableComponent","setUpMessages","componentDidLoad","setComponentLoaded","render","closeButton","h","key","messages","class","onClick","ref","scale","getIconScale","hasActionEnd","getSlotted","flipRtl","iconFlipRtl","name","closable","setFocus","componentFocusable","noticeLinkEl","querySelector","focus","onBeforeClose","calciteNoticeBeforeClose","emit","onBeforeOpen","calciteNoticeBeforeOpen","onClose","calciteNoticeClose","onOpen","calciteNoticeOpen","effectiveLocaleChange","updateMessages","effectiveLocale"],"sources":["src/components/notice/resources.ts","src/components/notice/notice.scss?tag=calcite-notice&encapsulation=shadow","src/components/notice/notice.tsx"],"sourcesContent":["export const SLOTS = {\n title: \"title\",\n message: \"message\",\n link: \"link\",\n actionsEnd: \"actions-end\",\n};\n\nexport const CSS = {\n actionsEnd: \"actions-end\",\n close: \"notice-close\",\n container: \"container\",\n content: \"notice-content\",\n icon: \"notice-icon\",\n};\n","/**\n * CSS Custom Properties\n *\n * These properties can be overridden using the component's tag as selector.\n *\n * @prop --calcite-notice-width: The width of the component.\n */\n\n// scale variables\n:host([scale=\"s\"]) {\n --calcite-notice-spacing-token-small: theme(\"spacing.2\");\n --calcite-notice-spacing-token-large: theme(\"spacing.3\");\n @include slotted(\"title\", \"*\", \".container\") {\n @apply text-n1-wrap my-0.5;\n }\n @include slotted(\"message\", \"*\", \".container\") {\n @apply text-n2-wrap my-0.5;\n }\n ::slotted(calcite-link) {\n @apply text-n2-wrap my-0.5;\n }\n .notice-close {\n // specific padding for close button to align with calcite-action small-scale spacing\n @apply p-2;\n }\n}\n\n:host([scale=\"m\"]) {\n --calcite-notice-spacing-token-small: theme(\"spacing.3\");\n --calcite-notice-spacing-token-large: theme(\"spacing.4\");\n @include slotted(\"title\", \"*\", \".container\") {\n @apply text-0-wrap my-0.5;\n }\n @include slotted(\"message\", \"*\", \".container\") {\n @apply text-n1-wrap my-0.5;\n }\n ::slotted(calcite-link) {\n @apply text-n1-wrap my-0.5;\n }\n}\n\n:host([scale=\"l\"]) {\n --calcite-notice-spacing-token-small: theme(\"spacing.4\");\n --calcite-notice-spacing-token-large: theme(\"spacing.5\");\n @include slotted(\"title\", \"*\", \".container\") {\n @apply text-1-wrap my-0.5;\n }\n @include slotted(\"message\", \"*\", \".container\") {\n @apply text-0-wrap my-0.5;\n }\n ::slotted(calcite-link) {\n @apply text-0-wrap my-0.5;\n }\n}\n\n:host([width=\"auto\"]) {\n --calcite-notice-width: theme(\"width.auto\");\n}\n\n:host([width=\"half\"]) {\n --calcite-notice-width: theme(\"width[1/2]\");\n}\n\n:host([width=\"full\"]) {\n --calcite-notice-width: theme(\"width.full\");\n}\n\n:host {\n @apply mx-auto hidden max-w-full items-center;\n inline-size: var(--calcite-notice-width);\n}\n\n.container {\n @apply bg-foreground-1\n pointer-events-none\n my-0\n box-border\n flex\n w-full\n opacity-0;\n max-block-size: 0;\n transition-property: opacity, max-block-size;\n transition-duration: var(--calcite-animation-timing);\n text-align: start;\n border-inline-start: var(--calcite-border-width-md) solid;\n box-shadow: 0 0 0 0 transparent;\n}\n\n// focus styles\n.notice-close {\n @apply focus-base;\n &:focus {\n @apply focus-inset;\n }\n}\n\n:host {\n @apply flex;\n}\n\n:host([open]) .container {\n @apply shadow-1\n pointer-events-auto\n max-h-full\n items-center\n opacity-100;\n}\n\n@include slotted(\"title\", \"*\", \".container\") {\n @apply text-color-1 m-0 font-medium;\n}\n\n@include slotted(\"message\", \"*\", \".container\") {\n @apply text-color-2 m-0 inline font-normal;\n margin-inline-end: var(--calcite-notice-spacing-token-small);\n}\n\n@mixin notice-element-base() {\n @apply transition-default box-border;\n padding-block: var(--calcite-notice-spacing-token-small);\n padding-inline: var(--calcite-notice-spacing-token-large);\n flex: 0 0 auto;\n}\n\n.notice-content {\n @include notice-element-base;\n @apply flex min-w-0 flex-col break-words;\n flex: 1 1 0;\n padding-block: var(--calcite-notice-spacing-token-small);\n padding-inline: 0 var(--calcite-notice-spacing-token-small);\n\n &:first-of-type:not(:only-child) {\n padding-inline-start: var(--calcite-notice-spacing-token-large);\n }\n &:only-of-type {\n padding-block: var(--calcite-notice-spacing-token-small);\n padding-inline: var(--calcite-notice-spacing-token-large);\n }\n}\n\n.notice-icon {\n @apply flex items-center;\n @include notice-element-base;\n}\n\n.notice-close {\n @apply text-color-3 flex cursor-pointer items-center self-stretch border-none bg-transparent outline-none;\n @include notice-element-base;\n -webkit-appearance: none;\n\n &:hover,\n &:focus {\n @apply bg-foreground-2 text-color-1;\n }\n\n &:active {\n @apply bg-foreground-3;\n }\n}\n\n.actions-end {\n @apply flex self-stretch;\n}\n\n$notice-kinds:\n \"brand\" var(--calcite-color-brand),\n \"info\" var(--calcite-color-status-info),\n \"danger\" var(--calcite-color-status-danger),\n \"success\" var(--calcite-color-status-success),\n \"warning\" var(--calcite-color-status-warning);\n\n@each $notice-kind in $notice-kinds {\n $name: nth($notice-kind, 1);\n $kind: nth($notice-kind, 2);\n\n :host([kind=\"#{$name}\"]) .container {\n border-color: $kind;\n & .notice-icon {\n color: $kind;\n }\n }\n}\n\n@include base-component();\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Method,\n Prop,\n State,\n VNode,\n Watch,\n} from \"@stencil/core\";\nimport {\n ConditionalSlotComponent,\n connectConditionalSlotComponent,\n disconnectConditionalSlotComponent,\n} from \"../../utils/conditionalSlot\";\nimport { getSlotted, setRequestedIcon } from \"../../utils/dom\";\nimport {\n componentFocusable,\n LoadableComponent,\n setComponentLoaded,\n setUpLoadableComponent,\n} from \"../../utils/loadable\";\nimport { connectLocalized, disconnectLocalized, LocalizedComponent } from \"../../utils/locale\";\nimport {\n connectMessages,\n disconnectMessages,\n setUpMessages,\n T9nComponent,\n updateMessages,\n} from \"../../utils/t9n\";\nimport { Kind, Scale, Width } from \"../interfaces\";\nimport { KindIcons } from \"../resources\";\nimport { onToggleOpenCloseComponent, OpenCloseComponent } from \"../../utils/openCloseComponent\";\nimport { getIconScale } from \"../../utils/component\";\nimport { IconNameOrString } from \"../icon/interfaces\";\nimport { NoticeMessages } from \"./assets/notice/t9n\";\nimport { CSS, SLOTS } from \"./resources\";\n\n/**\n * Notices are intended to be used to present users with important-but-not-crucial contextual tips or copy. Because\n * notices are displayed inline, a common use case is displaying them on page-load to present users with short hints or contextual copy.\n * They are optionally closable - useful for keeping track of whether or not a user has closed the notice. You can also choose not\n * to display a notice on page load and set the \"active\" attribute as needed to contextually provide inline messaging to users.\n */\n\n/**\n * @slot title - A slot for adding the title.\n * @slot message - A slot for adding the message.\n * @slot link - A slot for adding a `calcite-action` to take, such as: \"undo\", \"try again\", \"link to page\", etc.\n * @slot actions-end - A slot for adding `calcite-action`s to the end of the component. It is recommended to use two or less actions.\n */\n\n@Component({\n tag: \"calcite-notice\",\n styleUrl: \"notice.scss\",\n shadow: true,\n assetsDirs: [\"assets\"],\n})\nexport class Notice\n implements\n ConditionalSlotComponent,\n LoadableComponent,\n T9nComponent,\n LocalizedComponent,\n OpenCloseComponent\n{\n //--------------------------------------------------------------------------\n //\n // Properties\n //\n //---------------------------------------------------------------------------\n\n /** When `true`, the component is visible. */\n @Prop({ reflect: true, mutable: true }) open = false;\n\n @Watch(\"open\")\n openHandler(): void {\n onToggleOpenCloseComponent(this);\n }\n\n /** Specifies the kind of the component, which will apply to top border and icon. */\n @Prop({ reflect: true }) kind: Extract<\n \"brand\" | \"danger\" | \"info\" | \"success\" | \"warning\",\n Kind\n > = \"brand\";\n\n /** When `true`, a close button is added to the component. */\n @Prop({ reflect: true }) closable = false;\n\n /**\n * When `true`, shows a default recommended icon. Alternatively, pass a Calcite UI Icon name to display a specific icon.\n */\n @Prop({ reflect: true }) icon: IconNameOrString | boolean;\n\n /** When `true`, the icon will be flipped when the element direction is right-to-left (`\"rtl\"`). */\n @Prop({ reflect: true }) iconFlipRtl = false;\n\n /** Specifies the size of the component. */\n @Prop({ reflect: true }) scale: Scale = \"m\";\n\n /** Specifies the width of the component. */\n @Prop({ reflect: true }) width: Width = \"auto\";\n\n /**\n * Made into a prop for testing purposes only\n *\n * @internal\n */\n // eslint-disable-next-line @stencil-community/strict-mutable -- updated by t9n module\n @Prop({ mutable: true }) messages: NoticeMessages;\n\n /**\n * Use this property to override individual strings used by the component.\n */\n // eslint-disable-next-line @stencil-community/strict-mutable -- updated by t9n module\n @Prop({ mutable: true }) messageOverrides: Partial;\n\n @Watch(\"messageOverrides\")\n onMessagesChange(): void {\n /* wired up by t9n util */\n }\n\n @Watch(\"icon\")\n @Watch(\"kind\")\n updateRequestedIcon(): void {\n this.requestedIcon = setRequestedIcon(KindIcons, this.icon, this.kind);\n }\n\n //--------------------------------------------------------------------------\n //\n // Lifecycle\n //\n //--------------------------------------------------------------------------\n\n connectedCallback(): void {\n connectConditionalSlotComponent(this);\n connectLocalized(this);\n connectMessages(this);\n }\n\n disconnectedCallback(): void {\n disconnectConditionalSlotComponent(this);\n disconnectLocalized(this);\n disconnectMessages(this);\n }\n\n async componentWillLoad(): Promise {\n setUpLoadableComponent(this);\n this.requestedIcon = setRequestedIcon(KindIcons, this.icon, this.kind);\n await setUpMessages(this);\n if (this.open) {\n onToggleOpenCloseComponent(this);\n }\n }\n\n componentDidLoad(): void {\n setComponentLoaded(this);\n }\n\n render(): VNode {\n const { el } = this;\n const closeButton = (\n (this.closeButton = el)}\n >\n \n \n );\n\n const hasActionEnd = getSlotted(el, SLOTS.actionsEnd);\n\n return (\n
\n {this.requestedIcon ? (\n
\n \n
\n ) : null}\n
\n \n \n \n
\n {hasActionEnd ? (\n
\n \n
\n ) : null}\n {this.closable ? closeButton : null}\n
\n );\n }\n\n //--------------------------------------------------------------------------\n //\n // Events\n //\n //--------------------------------------------------------------------------\n\n /** Fires when the component is requested to be closed and before the closing transition begins. */\n @Event({ cancelable: false }) calciteNoticeBeforeClose: EventEmitter;\n\n /** Fires when the component is added to the DOM but not rendered, and before the opening transition begins. */\n @Event({ cancelable: false }) calciteNoticeBeforeOpen: EventEmitter;\n\n /** Fires when the component is closed and animation is complete. */\n @Event({ cancelable: false }) calciteNoticeClose: EventEmitter;\n\n /** Fires when the component is open and animation is complete. */\n @Event({ cancelable: false }) calciteNoticeOpen: EventEmitter;\n\n //--------------------------------------------------------------------------\n //\n // Public Methods\n //\n //--------------------------------------------------------------------------\n\n /** Sets focus on the component's first focusable element. */\n @Method()\n async setFocus(): Promise {\n await componentFocusable(this);\n\n const noticeLinkEl = this.el.querySelector(\"calcite-link\");\n\n if (!this.closeButton && !noticeLinkEl) {\n return;\n }\n if (noticeLinkEl) {\n return noticeLinkEl.setFocus();\n } else if (this.closeButton) {\n this.closeButton.focus();\n }\n }\n\n onBeforeClose(): void {\n this.calciteNoticeBeforeClose.emit();\n }\n\n onBeforeOpen(): void {\n this.calciteNoticeBeforeOpen.emit();\n }\n\n onClose(): void {\n this.calciteNoticeClose.emit();\n }\n\n onOpen(): void {\n this.calciteNoticeOpen.emit();\n }\n\n private setTransitionEl = (el: HTMLElement): void => {\n this.transitionEl = el;\n };\n\n //--------------------------------------------------------------------------\n //\n // Private Methods\n //\n //--------------------------------------------------------------------------\n private close = (): void => {\n this.open = false;\n };\n\n //--------------------------------------------------------------------------\n //\n // Private State/Props\n //\n //--------------------------------------------------------------------------\n\n @Element() el: HTMLCalciteNoticeElement;\n\n /** The close button element. */\n private closeButton?: HTMLButtonElement;\n\n /** The computed icon to render. */\n private requestedIcon?: IconNameOrString;\n\n @State() effectiveLocale: string;\n\n @Watch(\"effectiveLocale\")\n effectiveLocaleChange(): void {\n updateMessages(this, this.effectiveLocale);\n }\n\n @State() defaultMessages: NoticeMessages;\n\n openTransitionProp = \"opacity\";\n\n transitionEl: HTMLEl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