@cds/core 6.0.3 → 6.0.4
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/alert/alert.element.js +1 -1
- package/alert/alert.element.js.map +1 -1
- package/alert/alert.element.scss.js +1 -1
- package/button-action/button-action.element.d.ts +1 -0
- package/button-action/button-action.element.js +1 -1
- package/button-action/button-action.element.js.map +1 -1
- package/custom-elements.json +153 -0
- package/internal/utils/global.js +1 -1
- package/package.json +1 -1
package/alert/alert.element.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__decorate as t}from"tslib";import{LitElement as e,html as s}from"lit";import{I18nService as
|
|
1
|
+
import{__decorate as t}from"tslib";import{LitElement as e,html as s}from"lit";import{I18nService as a,setAttributes as r,syncDefinedProps as n,baseStyles as o,property as i,state as c,id as l,i18n as p,querySlot as d,querySlotAll as h,closable as u}from"@cds/core/internal";import{ClarityIcons as g}from"@cds/core/icon/icon.service.js";import{infoStandardIcon as y}from"@cds/core/icon/shapes/info-standard.js";import{successStandardIcon as m}from"@cds/core/icon/shapes/success-standard.js";import{warningStandardIcon as b}from"@cds/core/icon/shapes/warning-standard.js";import{errorStandardIcon as f}from"@cds/core/icon/shapes/error-standard.js";import{helpIcon as w}from"@cds/core/icon/shapes/help.js";import $ from"./alert.element.scss.js";function v(t){const e={info:[g.getIconNameFromShape(y),a.keys.alert.info],success:[g.getIconNameFromShape(m),a.keys.alert.success],warning:[g.getIconNameFromShape(b),a.keys.alert.warning],danger:[g.getIconNameFromShape(f),a.keys.alert.danger],unknown:[g.getIconNameFromShape(w),a.keys.alert.info],loading:["loading",a.keys.alert.loading]};return e[t]?e[t]:e.info}function k(t){return["info","success","warning","danger","unknown"].map((t=>F(t))).indexOf(t)>-1}function z(t){return v(t)[1]}function F(t){return v(t)[0]}function S(t,e,s){const a="align:stretch";switch(e){case"light":return"";case"banner":switch(t){case"wrapper":case"actions":return s?a:"";case"content":return"align:shrink align:vertical-center";default:return""}default:switch(t){case"wrapper":case"content":return a;case"actions":return"align:shrink";default:return""}}}let j=class extends e{constructor(){super();this.size="default",this.type="light",this.closable=!1,this.status="neutral",this.i18n=a.keys.alert,g.addIcons(y,f,m,b,w)}connectedCallback(){super.connectedCallback(),r(this,["aria-describedby",this.idForAriaDescriber],["role","region"])}updated(t){super.updated(t),n(t,this,[this.alertActions])}get parentGroupHasPager(){return"banner"===this.type&&!!this.parentElement.pager}render(){return s`<div class="private-host" cds-layout="${"banner"===this.type?"horizontal wrap:none gap:xs align:vertical-center align:horizontal-center":"horizontal wrap:none gap:xs"}">${"banner"!==this.type||this.parentGroupHasPager?s``:s`<span class="alert-spacer" cds-layout="align:stretch"> </span>`} <span class="alert-icon-wrapper" cds-layout="horizontal">${"loading"===this.status?s`<cds-progress-circle class="alert-spinner" status="info" size="${"banner"===this.type?"20":"18"}" aria-label="${z(this.status)}" role="img" cds-layout="align:horizontal-center"></cds-progress-circle>`:s`<slot name="alert-icon"><cds-icon class="alert-status-icon" shape="${F(this.status)}" role="img" aria-label="${z(this.status)}" cds-layout="align:horizontal-center"></cds-icon></slot>`} </span><span class="alert-content-wrapper" cds-layout="horizontal wrap:none ${S("wrapper",this.type,this.parentGroupHasPager)}"><span id="${this.idForAriaDescriber}" role="status" class="alert-content" cds-layout="${S("content",this.type,this.parentGroupHasPager)}"><slot></slot>${"light"===this.type?s`<slot name="actions"></slot>`:s``} </span>${"light"===this.type?s``:s`<span class="alert-actions-wrapper" cds-layout="${this.alertActions?"p-l:md":""} ${S("actions",this.type,this.parentGroupHasPager)}"><slot name="actions"></slot></span>`} </span>${"banner"!==this.type||this.parentGroupHasPager?s``:s`<span class="alert-spacer" cds-layout="align:stretch"> </span>`} ${"light"!==this.type&&this.closable?s`<span class="alert-close-wrapper"><slot name="close-button"><cds-internal-close-button icon-size="${"banner"===this.type?"20":"16"}" @click="${()=>this.closableController.close(!0)}" aria-label="${this.i18n.closeButtonAriaLabel}"></cds-internal-close-button></slot></span>`:s``}</div>`}static get styles(){return[o,$]}};t([i({type:String})],j.prototype,"size",void 0),t([c({type:String,reflect:!0})],j.prototype,"type",void 0),t([l()],j.prototype,"idForAriaDescriber",void 0),t([i({type:Boolean})],j.prototype,"closable",void 0),t([i({type:String})],j.prototype,"status",void 0),t([p()],j.prototype,"i18n",void 0),t([d("cds-alert-actions")],j.prototype,"alertActions",void 0),t([h("cds-icon",{assign:"alert-icon"})],j.prototype,"alertIcons",void 0),t([d("cds-internal-close-button",{assign:"close-button"})],j.prototype,"closeButton",void 0),j=t([u({escape:!1})],j);export{j as CdsAlert,S as getAlertContentLayout,z as getIconStatusLabel,F as getIconStatusShape,v as getIconStatusTuple,k as iconShapeIsAlertStatusType};
|
|
2
2
|
//# sourceMappingURL=alert.element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.element.js","sources":["../../../src/alert/alert.element.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { __decorate } from \"tslib\";\nimport { html, LitElement } from 'lit';\nimport { baseStyles, property, querySlot, querySlotAll, setAttributes, syncDefinedProps, state, id, I18nService, i18n, closable, } from '@cds/core/internal';\nimport { ClarityIcons } from '@cds/core/icon/icon.service.js';\nimport { infoStandardIcon } from '@cds/core/icon/shapes/info-standard.js';\nimport { successStandardIcon } from '@cds/core/icon/shapes/success-standard.js';\nimport { warningStandardIcon } from '@cds/core/icon/shapes/warning-standard.js';\nimport { errorStandardIcon } from '@cds/core/icon/shapes/error-standard.js';\nimport { helpIcon } from '@cds/core/icon/shapes/help.js';\nimport styles from './alert.element.scss';\nexport function getIconStatusTuple(status) {\n const statusIcons = {\n info: [ClarityIcons.getIconNameFromShape(infoStandardIcon), I18nService.keys.alert.info],\n success: [ClarityIcons.getIconNameFromShape(successStandardIcon), I18nService.keys.alert.success],\n warning: [ClarityIcons.getIconNameFromShape(warningStandardIcon), I18nService.keys.alert.warning],\n danger: [ClarityIcons.getIconNameFromShape(errorStandardIcon), I18nService.keys.alert.danger],\n unknown: [ClarityIcons.getIconNameFromShape(helpIcon), I18nService.keys.alert.info],\n loading: ['loading', I18nService.keys.alert.loading],\n };\n return statusIcons[status] ? statusIcons[status] : statusIcons.info;\n}\nexport function iconShapeIsAlertStatusType(shape) {\n const statusShapes = ['info', 'success', 'warning', 'danger', 'unknown'].map(s => {\n return getIconStatusShape(s);\n });\n return statusShapes.indexOf(shape) > -1;\n}\nexport function getIconStatusLabel(status) {\n return getIconStatusTuple(status)[1];\n}\nexport function getIconStatusShape(status) {\n return getIconStatusTuple(status)[0];\n}\nexport function getAlertContentLayout(containerType, alertGroupType, alertGroupHasPager) {\n const fillLayoutValue = 'align:stretch';\n switch (alertGroupType) {\n case 'light':\n return '';\n case 'banner':\n switch (containerType) {\n case 'wrapper':\n return alertGroupHasPager ? fillLayoutValue : '';\n case 'content':\n return 'align:shrink align:vertical-center';\n case 'actions':\n return alertGroupHasPager ? fillLayoutValue : '';\n default:\n return '';\n }\n default:\n switch (containerType) {\n case 'wrapper':\n return fillLayoutValue;\n case 'content':\n return fillLayoutValue;\n case 'actions':\n return 'align:shrink';\n default:\n return '';\n }\n }\n}\n/**\n * Alerts are banners that communicate a message with a severity attached to it.\n * They grab the user’s attention to provide critical information needed in context.\n *\n * Alerts outside of a cds-alert-group or cds-app-alert-group component will be\n * displayed as a \"lightweight alert\". Lightweight alerts, by default, provide no\n * close button component and they inherit no status (a.k.a. success, danger, etc.).\n *\n * Alerts inside a cds-alert-group component inherit their status from the containing\n * alert group.\n *\n * Alerts inside a cds-app-alert-group component inherit their status as a default from\n * the containing app-alert group, although it can be overridden on individual alerts.\n *\n * ```typescript\n * import '@cds/core/alert/register.js';\n * ```\n *\n * ```html\n * <cds-alert>\n * Single Alert\n * <cds-alert-actions>\n * buttons, links\n * </cds-alert-actions>\n * </cds-alert>\n * ```\n *\n * @element cds-alert\n * @slot - Content slot for inside the alert\n * @event closeChange - notify when the user has clicked the dismiss button\n * @cssprop --color\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --border-color\n * @cssprop --icon-color\n * @cssprop --close-icon-color\n * @cssprop --close-icon-color-hover\n */\nlet CdsAlert = class CdsAlert extends LitElement {\n constructor() {\n super();\n /**\n * Sets the overall height and width of the alert and icon based on value\n * @type {default | sm}\n */\n this.size = 'default';\n /**\n * Sets up the buttons, layouts, close-button and other properties based on the alert group container\n * Internal Use Only\n * @private\n */\n this.type = 'light';\n /**\n * If false, the alert will not render the close button.\n *\n * Lightweight alerts do not display close buttons\n */\n this.closable = false;\n /**\n * Sets the color of the alert from a predefined list of statuses\n * @type {neutral | info | success | warning | danger | alt | loading}\n */\n this.status = 'neutral';\n this.i18n = I18nService.keys.alert;\n ClarityIcons.addIcons(infoStandardIcon, errorStandardIcon, successStandardIcon, warningStandardIcon, helpIcon);\n }\n connectedCallback() {\n super.connectedCallback();\n setAttributes(this, ['aria-describedby', this.idForAriaDescriber], ['role', 'region']);\n }\n updated(props) {\n super.updated(props);\n syncDefinedProps(props, this, [this.alertActions]);\n }\n get parentGroupHasPager() {\n return this.type === 'banner' && !!this.parentElement.pager;\n }\n render() {\n return html `\n <div\n class=\"private-host\"\n cds-layout=\"${this.type === 'banner'\n ? 'horizontal wrap:none gap:xs align:vertical-center align:horizontal-center'\n : 'horizontal wrap:none gap:xs'}\"\n >\n ${this.type === 'banner' && !this.parentGroupHasPager\n ? html `<span class=\"alert-spacer\" cds-layout=\"align:stretch\"> </span>`\n : html ``}\n <span class=\"alert-icon-wrapper\" cds-layout=\"horizontal\">\n ${this.status === 'loading'\n ? html `<cds-progress-circle\n class=\"alert-spinner\"\n status=\"info\"\n size=\"${this.type === 'banner' ? '20' : '18'}\"\n aria-label=\"${getIconStatusLabel(this.status)}\"\n role=\"img\"\n cds-layout=\"align:horizontal-center\"\n ></cds-progress-circle>`\n : html `<slot name=\"alert-icon\"\n ><cds-icon\n class=\"alert-status-icon\"\n shape=\"${getIconStatusShape(this.status)}\"\n role=\"img\"\n aria-label=\"${getIconStatusLabel(this.status)}\"\n cds-layout=\"align:horizontal-center\"\n ></cds-icon\n ></slot>`}\n </span>\n <span\n class=\"alert-content-wrapper\"\n cds-layout=\"horizontal wrap:none ${getAlertContentLayout('wrapper', this.type, this.parentGroupHasPager)}\"\n >\n <span\n id=\"${this.idForAriaDescriber}\"\n role=\"status\"\n class=\"alert-content\"\n cds-layout=\"${getAlertContentLayout('content', this.type, this.parentGroupHasPager)}\"\n >\n <slot></slot>\n ${this.type === 'light' ? html `<slot name=\"actions\"></slot>` : html ``}\n </span>\n ${this.type === 'light'\n ? html ``\n : html `<span\n class=\"alert-actions-wrapper\"\n cds-layout=\"${this.alertActions ? 'p-l:md' : ''} ${getAlertContentLayout('actions', this.type, this.parentGroupHasPager)}\"\n ><slot name=\"actions\"></slot\n ></span>`}\n </span>\n\n ${this.type === 'banner' && !this.parentGroupHasPager\n ? html `<span class=\"alert-spacer\" cds-layout=\"align:stretch\"> </span>`\n : html ``}\n ${this.type !== 'light' && this.closable\n ? html `<slot name=\"close-button\">\n <cds-internal-close-button\n icon-size=\"${this.type === 'banner' ? '20' : '16'}\"\n @click=\"${() => this.closableController.close(true)}\"\n aria-label=\"${this.i18n.closeButtonAriaLabel}\"\n ></cds-internal-close-button\n ></slot>`\n : html ``}\n </div>\n `;\n }\n static get styles() {\n return [baseStyles, styles];\n }\n};\n__decorate([\n property({ type: String })\n], CdsAlert.prototype, \"size\", void 0);\n__decorate([\n state({ type: String, reflect: true })\n], CdsAlert.prototype, \"type\", void 0);\n__decorate([\n id()\n], CdsAlert.prototype, \"idForAriaDescriber\", void 0);\n__decorate([\n property({ type: Boolean })\n], CdsAlert.prototype, \"closable\", void 0);\n__decorate([\n property({ type: String })\n], CdsAlert.prototype, \"status\", void 0);\n__decorate([\n i18n()\n], CdsAlert.prototype, \"i18n\", void 0);\n__decorate([\n querySlot('cds-alert-actions')\n], CdsAlert.prototype, \"alertActions\", void 0);\n__decorate([\n querySlotAll('cds-icon', { assign: 'alert-icon' })\n], CdsAlert.prototype, \"alertIcons\", void 0);\n__decorate([\n querySlot('cds-internal-close-button', { assign: 'close-button' })\n], CdsAlert.prototype, \"closeButton\", void 0);\nCdsAlert = __decorate([\n closable({ escape: false })\n], CdsAlert);\nexport { CdsAlert };\n"],"names":["getIconStatusTuple","status","statusIcons","info","ClarityIcons","getIconNameFromShape","infoStandardIcon","I18nService","keys","alert","success","successStandardIcon","warning","warningStandardIcon","danger","errorStandardIcon","unknown","helpIcon","loading","iconShapeIsAlertStatusType","shape","map","s","getIconStatusShape","indexOf","getIconStatusLabel","getAlertContentLayout","containerType","alertGroupType","alertGroupHasPager","fillLayoutValue","CdsAlert","LitElement","constructor","super","this","size","type","closable","i18n","addIcons","connectedCallback","setAttributes","idForAriaDescriber","updated","props","syncDefinedProps","alertActions","parentGroupHasPager","parentElement","pager","render","html","closableController","close","closeButtonAriaLabel","styles","baseStyles","__decorate","property","String","prototype","state","reflect","id","Boolean","querySlot","querySlotAll","assign","escape"],"mappings":"suBAeO,SAASA,EAAmBC,GAC/B,MAAMC,EAAc,CAChBC,KAAM,CAACC,EAAaC,qBAAqBC,GAAmBC,EAAYC,KAAKC,MAAMN,MACnFO,QAAS,CAACN,EAAaC,qBAAqBM,GAAsBJ,EAAYC,KAAKC,MAAMC,SACzFE,QAAS,CAACR,EAAaC,qBAAqBQ,GAAsBN,EAAYC,KAAKC,MAAMG,SACzFE,OAAQ,CAACV,EAAaC,qBAAqBU,GAAoBR,EAAYC,KAAKC,MAAMK,QACtFE,QAAS,CAACZ,EAAaC,qBAAqBY,GAAWV,EAAYC,KAAKC,MAAMN,MAC9Ee,QAAS,CAAC,UAAWX,EAAYC,KAAKC,MAAMS,UAEhD,OAAOhB,EAAYD,GAAUC,EAAYD,GAAUC,EAAYC,KAE5D,SAASgB,EAA2BC,GAIvC,MAHqB,CAAC,OAAQ,UAAW,UAAW,SAAU,WAAWC,KAAIC,G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.js","sources":["../../../src/alert/alert.element.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { __decorate } from \"tslib\";\nimport { html, LitElement } from 'lit';\nimport { baseStyles, property, querySlot, querySlotAll, setAttributes, syncDefinedProps, state, id, I18nService, i18n, closable, } from '@cds/core/internal';\nimport { ClarityIcons } from '@cds/core/icon/icon.service.js';\nimport { infoStandardIcon } from '@cds/core/icon/shapes/info-standard.js';\nimport { successStandardIcon } from '@cds/core/icon/shapes/success-standard.js';\nimport { warningStandardIcon } from '@cds/core/icon/shapes/warning-standard.js';\nimport { errorStandardIcon } from '@cds/core/icon/shapes/error-standard.js';\nimport { helpIcon } from '@cds/core/icon/shapes/help.js';\nimport styles from './alert.element.scss';\nexport function getIconStatusTuple(status) {\n const statusIcons = {\n info: [ClarityIcons.getIconNameFromShape(infoStandardIcon), I18nService.keys.alert.info],\n success: [ClarityIcons.getIconNameFromShape(successStandardIcon), I18nService.keys.alert.success],\n warning: [ClarityIcons.getIconNameFromShape(warningStandardIcon), I18nService.keys.alert.warning],\n danger: [ClarityIcons.getIconNameFromShape(errorStandardIcon), I18nService.keys.alert.danger],\n unknown: [ClarityIcons.getIconNameFromShape(helpIcon), I18nService.keys.alert.info],\n loading: ['loading', I18nService.keys.alert.loading],\n };\n return statusIcons[status] ? statusIcons[status] : statusIcons.info;\n}\nexport function iconShapeIsAlertStatusType(shape) {\n const statusShapes = ['info', 'success', 'warning', 'danger', 'unknown'].map(s => {\n return getIconStatusShape(s);\n });\n return statusShapes.indexOf(shape) > -1;\n}\nexport function getIconStatusLabel(status) {\n return getIconStatusTuple(status)[1];\n}\nexport function getIconStatusShape(status) {\n return getIconStatusTuple(status)[0];\n}\nexport function getAlertContentLayout(containerType, alertGroupType, alertGroupHasPager) {\n const fillLayoutValue = 'align:stretch';\n switch (alertGroupType) {\n case 'light':\n return '';\n case 'banner':\n switch (containerType) {\n case 'wrapper':\n return alertGroupHasPager ? fillLayoutValue : '';\n case 'content':\n return 'align:shrink align:vertical-center';\n case 'actions':\n return alertGroupHasPager ? fillLayoutValue : '';\n default:\n return '';\n }\n default:\n switch (containerType) {\n case 'wrapper':\n return fillLayoutValue;\n case 'content':\n return fillLayoutValue;\n case 'actions':\n return 'align:shrink';\n default:\n return '';\n }\n }\n}\n/**\n * Alerts are banners that communicate a message with a severity attached to it.\n * They grab the user’s attention to provide critical information needed in context.\n *\n * Alerts outside of a cds-alert-group or cds-app-alert-group component will be\n * displayed as a \"lightweight alert\". Lightweight alerts, by default, provide no\n * close button component and they inherit no status (a.k.a. success, danger, etc.).\n *\n * Alerts inside a cds-alert-group component inherit their status from the containing\n * alert group.\n *\n * Alerts inside a cds-app-alert-group component inherit their status as a default from\n * the containing app-alert group, although it can be overridden on individual alerts.\n *\n * ```typescript\n * import '@cds/core/alert/register.js';\n * ```\n *\n * ```html\n * <cds-alert>\n * Single Alert\n * <cds-alert-actions>\n * buttons, links\n * </cds-alert-actions>\n * </cds-alert>\n * ```\n *\n * @element cds-alert\n * @slot - Content slot for inside the alert\n * @event closeChange - notify when the user has clicked the dismiss button\n * @cssprop --color\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --border-color\n * @cssprop --icon-color\n * @cssprop --close-icon-color\n * @cssprop --close-icon-color-hover\n */\nlet CdsAlert = class CdsAlert extends LitElement {\n constructor() {\n super();\n /**\n * Sets the overall height and width of the alert and icon based on value\n * @type {default | sm}\n */\n this.size = 'default';\n /**\n * Sets up the buttons, layouts, close-button and other properties based on the alert group container\n * Internal Use Only\n * @private\n */\n this.type = 'light';\n /**\n * If false, the alert will not render the close button.\n *\n * Lightweight alerts do not display close buttons\n */\n this.closable = false;\n /**\n * Sets the color of the alert from a predefined list of statuses\n * @type {neutral | info | success | warning | danger | alt | loading}\n */\n this.status = 'neutral';\n this.i18n = I18nService.keys.alert;\n ClarityIcons.addIcons(infoStandardIcon, errorStandardIcon, successStandardIcon, warningStandardIcon, helpIcon);\n }\n connectedCallback() {\n super.connectedCallback();\n setAttributes(this, ['aria-describedby', this.idForAriaDescriber], ['role', 'region']);\n }\n updated(props) {\n super.updated(props);\n syncDefinedProps(props, this, [this.alertActions]);\n }\n get parentGroupHasPager() {\n return this.type === 'banner' && !!this.parentElement.pager;\n }\n render() {\n return html `\n <div\n class=\"private-host\"\n cds-layout=\"${this.type === 'banner'\n ? 'horizontal wrap:none gap:xs align:vertical-center align:horizontal-center'\n : 'horizontal wrap:none gap:xs'}\"\n >\n ${this.type === 'banner' && !this.parentGroupHasPager\n ? html `<span class=\"alert-spacer\" cds-layout=\"align:stretch\"> </span>`\n : html ``}\n <span class=\"alert-icon-wrapper\" cds-layout=\"horizontal\">\n ${this.status === 'loading'\n ? html `<cds-progress-circle\n class=\"alert-spinner\"\n status=\"info\"\n size=\"${this.type === 'banner' ? '20' : '18'}\"\n aria-label=\"${getIconStatusLabel(this.status)}\"\n role=\"img\"\n cds-layout=\"align:horizontal-center\"\n ></cds-progress-circle>`\n : html `<slot name=\"alert-icon\"\n ><cds-icon\n class=\"alert-status-icon\"\n shape=\"${getIconStatusShape(this.status)}\"\n role=\"img\"\n aria-label=\"${getIconStatusLabel(this.status)}\"\n cds-layout=\"align:horizontal-center\"\n ></cds-icon\n ></slot>`}\n </span>\n <span\n class=\"alert-content-wrapper\"\n cds-layout=\"horizontal wrap:none ${getAlertContentLayout('wrapper', this.type, this.parentGroupHasPager)}\"\n >\n <span\n id=\"${this.idForAriaDescriber}\"\n role=\"status\"\n class=\"alert-content\"\n cds-layout=\"${getAlertContentLayout('content', this.type, this.parentGroupHasPager)}\"\n >\n <slot></slot>\n ${this.type === 'light' ? html `<slot name=\"actions\"></slot>` : html ``}\n </span>\n ${this.type === 'light'\n ? html ``\n : html `<span\n class=\"alert-actions-wrapper\"\n cds-layout=\"${this.alertActions ? 'p-l:md' : ''} ${getAlertContentLayout('actions', this.type, this.parentGroupHasPager)}\"\n ><slot name=\"actions\"></slot\n ></span>`}\n </span>\n\n ${this.type === 'banner' && !this.parentGroupHasPager\n ? html `<span class=\"alert-spacer\" cds-layout=\"align:stretch\"> </span>`\n : html ``}\n ${this.type !== 'light' && this.closable\n ? html `<span class=\"alert-close-wrapper\"\n ><slot name=\"close-button\">\n <cds-internal-close-button\n icon-size=\"${this.type === 'banner' ? '20' : '16'}\"\n @click=\"${() => this.closableController.close(true)}\"\n aria-label=\"${this.i18n.closeButtonAriaLabel}\"\n >\n </cds-internal-close-button> </slot\n ></span>`\n : html ``}\n </div>\n `;\n }\n static get styles() {\n return [baseStyles, styles];\n }\n};\n__decorate([\n property({ type: String })\n], CdsAlert.prototype, \"size\", void 0);\n__decorate([\n state({ type: String, reflect: true })\n], CdsAlert.prototype, \"type\", void 0);\n__decorate([\n id()\n], CdsAlert.prototype, \"idForAriaDescriber\", void 0);\n__decorate([\n property({ type: Boolean })\n], CdsAlert.prototype, \"closable\", void 0);\n__decorate([\n property({ type: String })\n], CdsAlert.prototype, \"status\", void 0);\n__decorate([\n i18n()\n], CdsAlert.prototype, \"i18n\", void 0);\n__decorate([\n querySlot('cds-alert-actions')\n], CdsAlert.prototype, \"alertActions\", void 0);\n__decorate([\n querySlotAll('cds-icon', { assign: 'alert-icon' })\n], CdsAlert.prototype, \"alertIcons\", void 0);\n__decorate([\n querySlot('cds-internal-close-button', { assign: 'close-button' })\n], CdsAlert.prototype, \"closeButton\", void 0);\nCdsAlert = __decorate([\n closable({ escape: false })\n], CdsAlert);\nexport { CdsAlert };\n"],"names":["getIconStatusTuple","status","statusIcons","info","ClarityIcons","getIconNameFromShape","infoStandardIcon","I18nService","keys","alert","success","successStandardIcon","warning","warningStandardIcon","danger","errorStandardIcon","unknown","helpIcon","loading","iconShapeIsAlertStatusType","shape","map","s","getIconStatusShape","indexOf","getIconStatusLabel","getAlertContentLayout","containerType","alertGroupType","alertGroupHasPager","fillLayoutValue","CdsAlert","LitElement","constructor","super","this","size","type","closable","i18n","addIcons","connectedCallback","setAttributes","idForAriaDescriber","updated","props","syncDefinedProps","alertActions","parentGroupHasPager","parentElement","pager","render","html","closableController","close","closeButtonAriaLabel","styles","baseStyles","__decorate","property","String","prototype","state","reflect","id","Boolean","querySlot","querySlotAll","assign","escape"],"mappings":"suBAeO,SAASA,EAAmBC,GAC/B,MAAMC,EAAc,CAChBC,KAAM,CAACC,EAAaC,qBAAqBC,GAAmBC,EAAYC,KAAKC,MAAMN,MACnFO,QAAS,CAACN,EAAaC,qBAAqBM,GAAsBJ,EAAYC,KAAKC,MAAMC,SACzFE,QAAS,CAACR,EAAaC,qBAAqBQ,GAAsBN,EAAYC,KAAKC,MAAMG,SACzFE,OAAQ,CAACV,EAAaC,qBAAqBU,GAAoBR,EAAYC,KAAKC,MAAMK,QACtFE,QAAS,CAACZ,EAAaC,qBAAqBY,GAAWV,EAAYC,KAAKC,MAAMN,MAC9Ee,QAAS,CAAC,UAAWX,EAAYC,KAAKC,MAAMS,UAEhD,OAAOhB,EAAYD,GAAUC,EAAYD,GAAUC,EAAYC,KAE5D,SAASgB,EAA2BC,GAIvC,MAHqB,CAAC,OAAQ,UAAW,UAAW,SAAU,WAAWC,KAAIC,GAClEC,EAAmBD,KAEVE,QAAQJ,IAAU,EAEnC,SAASK,EAAmBxB,GAC/B,OAAOD,EAAmBC,GAAQ,GAE/B,SAASsB,EAAmBtB,GAC/B,OAAOD,EAAmBC,GAAQ,GAE/B,SAASyB,EAAsBC,EAAeC,EAAgBC,GACjE,MAAMC,EAAkB,gBACxB,OAAQF,GACJ,IAAK,QACD,MAAO,GACX,IAAK,SACD,OAAQD,GACJ,IAAK,UAIL,IAAK,UACD,OAAOE,EAAqBC,EAAkB,GAHlD,IAAK,UACD,MAAO,qCAGX,QACI,MAAO,GAEnB,QACI,OAAQH,GACJ,IAAK,UAEL,IAAK,UACD,OAAOG,EACX,IAAK,UACD,MAAO,eACX,QACI,MAAO,KA0CxB,IAACC,EAAW,cAAuBC,EAClCC,cACIC,QAKAC,KA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,MAAO,CAACC,EAAYD,KAG5BE,EAAW,CACPC,EAAS,CAAEtB,KAAMuB,UAClB7B,EAAS8B,UAAW,YAAQ,GAC/BH,EAAW,CACPI,EAAM,CAAEzB,KAAMuB,OAAQG,SAAS,KAChChC,EAAS8B,UAAW,YAAQ,GAC/BH,EAAW,CACPM,KACDjC,EAAS8B,UAAW,0BAAsB,GAC7CH,EAAW,CACPC,EAAS,CAAEtB,KAAM4B,WAClBlC,EAAS8B,UAAW,gBAAY,GACnCH,EAAW,CACPC,EAAS,CAAEtB,KAAMuB,UAClB7B,EAAS8B,UAAW,cAAU,GACjCH,EAAW,CACPnB,KACDR,EAAS8B,UAAW,YAAQ,GAC/BH,EAAW,CACPQ,EAAU,sBACXnC,EAAS8B,UAAW,oBAAgB,GACvCH,EAAW,CACPS,EAAa,WAAY,CAAEC,OAAQ,gBACpCrC,EAAS8B,UAAW,kBAAc,GACrCH,EAAW,CACPQ,EAAU,4BAA6B,CAAEE,OAAQ,kBAClDrC,EAAS8B,UAAW,mBAAe,GACtC9B,EAAW2B,EAAW,CAClBpB,EAAS,CAAE+B,QAAQ,KACpBtC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{css as a}from"lit";var l=a`:host{--container-padding:var(--cds-global-space-2, calc(2 * 1rem / var(--cds-global-base, 20))) 0;--min-height:var(--cds-global-space-9, calc(24 * 1rem / var(--cds-global-base, 20)));--color:var(--cds-global-typography-color-400, var(--cds-global-color-construction-900, #21333b));--font-size:var(--cds-global-typography-secondary-font-size, calc(13 * 1rem / var(--cds-global-base, 20)));--font-weight:var(--cds-global-typography-secondary-font-weight, 400);--letter-spacing:var(--cds-global-typography-body-letter-spacing, -0.014286em);--icon-size:var(--cds-global-space-8, calc(18 * 1rem / var(--cds-global-base, 20)));--icon-color:var(--color);width:100%}.private-host{min-height:var(--min-height);color:var(--color)}:host([_type=banner]){--icon-size:var(--cds-global-space-9, calc(24 * 1rem / var(--cds-global-base, 20)))}.alert-status-icon,::slotted(cds-icon){height:var(--icon-size);width:var(--icon-size);--color:var(--icon-color)}cds-internal-close-button{--color:inherit}.alert-content-wrapper,.alert-icon-wrapper{display:flex;min-height:var(--cds-global-space-6,calc(12 * 1rem / var(--cds-global-base,20)));padding:var(--container-padding)}.alert-icon-wrapper{min-width:var(--icon-size)}.alert-content-wrapper{display:inline-flex;align-items:center;transform:translateY(var(--cds-global-space-1,calc(1 * 1rem / var(--cds-global-base,20))));color:var(--color);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:var(--letter-spacing);line-height:var(--cds-global-typography-body-line-height,1.42857em)}::slotted(cds-alert-actions){--action-text-color:var(--color);--action-size:var(--cds-global-typography-body-line-height, 1.42857em);display:none}:host([_type=banner]) ::slotted(cds-alert-actions),:host([_type=default]) ::slotted(cds-alert-actions){--action-size:calc(var(--min-height) - var(--cds-global-space-4, calc(6 * 1rem / var(--cds-global-base, 20))));white-space:nowrap;display:block}:host([_type=default]) cds-internal-close-button{height:var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20)))}:host([_type=default]) .alert-content-wrapper{align-items:self-start}:host([_type=light][status=info]){--icon-color:var(--cds-alias-status-info, var(--cds-global-color-blue-700, #0079ad))}:host([_type=light][status=success]){--icon-color:var(--cds-alias-status-success, var(--cds-global-color-green-700, #42810e))}:host([_type=light][status=warning]){--icon-color:var(--cds-alias-status-warning-dark, var(--cds-global-color-ochre-800, #a36500))}:host([_type=light][status=danger]){--icon-color:var(--cds-alias-status-danger, var(--cds-global-color-red-700, #e02200))}:host([status=loading][_type=banner]) .alert-spinner,:host([status=loading][_type=default]) .alert-spinner{--ring-color:var(--cds-alias-object-opacity-200, rgba(0, 0, 0, 0.4))}:host([status=loading][_type=banner]) .alert-spinner{--fill-color:var(--icon-color)}:host([size=sm]:not([_type=banner])){--font-size:var(--cds-global-typography-font-size-1, calc(11 * 1rem / var(--cds-global-base, 20)));--letter-spacing:normal}:host([_type=banner]){--color:var(--cds-global-typography-color-100, var(--cds-global-color-white, white))}:host([_type=banner][status=warning]),:host([_type=default][status=warning]){--color:var(--cds-global-color-construction-900, #21333b)}:host([_type=banner][status=warning]) cds-alert-actions,:host([_type=default][status=warning]) cds-alert-actions{--action-hover-text-color:var(--color);--action-text-color:var(--color)}:host([_type=banner]) .spinner{height:calc(var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20))) + var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20))));width:calc(var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20))) + var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20))));min-height:calc(var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20))) + var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20))));min-width:calc(var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20))) + var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20))));margin-top:var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20)))}:host([_type=banner]) cds-internal-close-button{height:var(--cds-global-space-9,calc(24 * 1rem / var(--cds-global-base,20)));margin-top:var(--cds-global-space-3,calc(4 * 1rem / var(--cds-global-base,20)))}@supports (-moz-appearance:none) and (text-emphasis:none){:host(:not([_type=banner]):not([size=sm])) .alert-content{transform:translateY(calc(-1*var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20)))))}}`;export{l as default};
|
|
1
|
+
import{css as a}from"lit";var l=a`:host{--container-padding:var(--cds-global-space-2, calc(2 * 1rem / var(--cds-global-base, 20))) 0;--min-height:var(--cds-global-space-9, calc(24 * 1rem / var(--cds-global-base, 20)));--color:var(--cds-global-typography-color-400, var(--cds-global-color-construction-900, #21333b));--font-size:var(--cds-global-typography-secondary-font-size, calc(13 * 1rem / var(--cds-global-base, 20)));--font-weight:var(--cds-global-typography-secondary-font-weight, 400);--letter-spacing:var(--cds-global-typography-body-letter-spacing, -0.014286em);--icon-size:var(--cds-global-space-8, calc(18 * 1rem / var(--cds-global-base, 20)));--icon-color:var(--color);width:100%}.private-host{min-height:var(--min-height);color:var(--color)}:host([_type=banner]){--icon-size:var(--cds-global-space-9, calc(24 * 1rem / var(--cds-global-base, 20)))}.alert-status-icon,::slotted(cds-icon){height:var(--icon-size);width:var(--icon-size);--color:var(--icon-color)}.alert-close-wrapper{padding:var(--container-padding);padding-bottom:0}cds-internal-close-button{--color:inherit}.alert-content-wrapper,.alert-icon-wrapper{display:flex;min-height:var(--cds-global-space-6,calc(12 * 1rem / var(--cds-global-base,20)));padding:var(--container-padding)}.alert-icon-wrapper{min-width:var(--icon-size)}.alert-content-wrapper{display:inline-flex;align-items:center;transform:translateY(var(--cds-global-space-1,calc(1 * 1rem / var(--cds-global-base,20))));color:var(--color);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:var(--letter-spacing);line-height:var(--cds-global-typography-body-line-height,1.42857em)}::slotted(cds-alert-actions){--action-text-color:var(--color);--action-size:var(--cds-global-typography-body-line-height, 1.42857em);display:none}:host([_type=banner]) ::slotted(cds-alert-actions),:host([_type=default]) ::slotted(cds-alert-actions){--action-size:calc(var(--min-height) - var(--cds-global-space-4, calc(6 * 1rem / var(--cds-global-base, 20))));white-space:nowrap;display:block}:host([_type=default]) cds-internal-close-button{height:var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20)))}:host([_type=default]) .alert-content-wrapper{align-items:self-start}:host([_type=light][status=info]){--icon-color:var(--cds-alias-status-info, var(--cds-global-color-blue-700, #0079ad))}:host([_type=light][status=success]){--icon-color:var(--cds-alias-status-success, var(--cds-global-color-green-700, #42810e))}:host([_type=light][status=warning]){--icon-color:var(--cds-alias-status-warning-dark, var(--cds-global-color-ochre-800, #a36500))}:host([_type=light][status=danger]){--icon-color:var(--cds-alias-status-danger, var(--cds-global-color-red-700, #e02200))}:host([status=loading][_type=banner]) .alert-spinner,:host([status=loading][_type=default]) .alert-spinner{--ring-color:var(--cds-alias-object-opacity-200, rgba(0, 0, 0, 0.4))}:host([status=loading][_type=banner]) .alert-spinner{--fill-color:var(--icon-color)}:host([size=sm]:not([_type=banner])){--font-size:var(--cds-global-typography-font-size-1, calc(11 * 1rem / var(--cds-global-base, 20)));--letter-spacing:normal}:host([_type=banner]){--color:var(--cds-global-typography-color-100, var(--cds-global-color-white, white))}:host([_type=banner][status=warning]),:host([_type=default][status=warning]){--color:var(--cds-global-color-construction-900, #21333b)}:host([_type=banner][status=warning]) cds-alert-actions,:host([_type=default][status=warning]) cds-alert-actions{--action-hover-text-color:var(--color);--action-text-color:var(--color)}:host([_type=banner]) .spinner{height:calc(var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20))) + var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20))));width:calc(var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20))) + var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20))));min-height:calc(var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20))) + var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20))));min-width:calc(var(--cds-global-space-8,calc(18 * 1rem / var(--cds-global-base,20))) + var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20))));margin-top:var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20)))}:host([_type=banner]) cds-internal-close-button{height:var(--cds-global-space-9,calc(24 * 1rem / var(--cds-global-base,20)));margin-top:var(--cds-global-space-3,calc(4 * 1rem / var(--cds-global-base,20)))}@supports (-moz-appearance:none) and (text-emphasis:none){:host(:not([_type=banner]):not([size=sm])) .alert-content{transform:translateY(calc(-1*var(--cds-global-space-2,calc(2 * 1rem / var(--cds-global-base,20)))))}}`;export{l as default};
|
|
2
2
|
//# sourceMappingURL=alert.element.scss.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__decorate as t}from"tslib";import{html as
|
|
1
|
+
import{__decorate as t}from"tslib";import{html as i}from"lit";import{CdsBaseButton as e,I18nService as s,LogService as o,baseStyles as r,property as n,i18n as a,state as d}from"@cds/core/internal";import p from"./button-action.element.scss.js";class c extends e{constructor(){super(...arguments);this.i18n=s.keys.actions,this.cdsButtonAction=!0}render(){return i`<div class="private-host"><slot><cds-icon .shape="${this.shape?this.shape:"ellipsis-vertical"}" .size="${this.iconSize}" ?solid="${this.pressed||this.expanded}" inner-offset="${1}"></cds-icon></slot></div>`}updated(t){super.updated(t),this.ariaLabel||this.readonly||o.warn("A aria-label is required for interactive cds-button-action type",this),t.has("readonly")&&(this.readonly&&!this.hasAttribute("aria-label")?this.ariaHidden="true":this.ariaHidden=null)}}c.styles=[r,p],t([n({type:String})],c.prototype,"shape",void 0),t([n({type:String,reflect:!0})],c.prototype,"action",void 0),t([n({type:String})],c.prototype,"iconSize",void 0),t([a()],c.prototype,"i18n",void 0),t([d({type:Boolean,reflect:!0,attribute:"cds-button-action"})],c.prototype,"cdsButtonAction",void 0);export{c as CdsButtonAction};
|
|
2
2
|
//# sourceMappingURL=button-action.element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-action.element.js","sources":["../../../src/button-action/button-action.element.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { __decorate } from \"tslib\";\nimport { html } from 'lit';\nimport { property, baseStyles, CdsBaseButton, LogService, state, i18n, I18nService } from '@cds/core/internal';\nimport styles from './button-action.element.scss';\n/**\n * Action Button\n *\n * ```typescript\n * import '@cds/core/button-action/register.js';\n * ```\n *\n * ```html\n * <cds-button-action></cds-button-action>\n * ```\n * @beta\n * @element cds-button-action\n * @slot - For projecting text content or cds-icon\n * @property pressed\n * @cssprop --icon-width\n * @cssprop --icon-height\n * @cssprop --width\n * @cssprop --height\n * @cssprop --cursor\n * @cssprop --color\n * @cssprop --font-size\n * @cssprop --background\n * @cssprop --padding\n * @cssprop --outline\n * @cssprop --outline-offset\n * @property pressed - boolean\n * @property expanded - boolean\n */\nexport class CdsButtonAction extends CdsBaseButton {\n constructor() {\n super(...arguments);\n this.i18n = I18nService.keys.actions;\n this.cdsButtonAction = true;\n }\n render() {\n return html `\n <div class=\"private-host\">\n <slot\n ><cds-icon\n .shape=${this.shape ? this.shape : 'ellipsis-vertical'}\n ?solid=${this.pressed || this.expanded}\n inner-offset=${1}\n ></cds-icon\n ></slot>\n </div>\n `;\n }\n updated(props) {\n super.updated(props);\n if (!this.ariaLabel && !this.readonly) {\n LogService.warn('A aria-label is required for interactive cds-button-action type', this);\n }\n if (props.has('readonly')) {\n this.readonly && !this.hasAttribute('aria-label') ? (this.ariaHidden = 'true') : (this.ariaHidden = null);\n }\n }\n}\nCdsButtonAction.styles = [baseStyles, styles];\n__decorate([\n property({ type: String })\n], CdsButtonAction.prototype, \"shape\", void 0);\n__decorate([\n property({ type: String, reflect: true })\n], CdsButtonAction.prototype, \"action\", void 0);\n__decorate([\n i18n()\n], CdsButtonAction.prototype, \"i18n\", void 0);\n__decorate([\n state({ type: Boolean, reflect: true, attribute: 'cds-button-action' })\n], CdsButtonAction.prototype, \"cdsButtonAction\", void 0);\n"],"names":["CdsButtonAction","CdsBaseButton","constructor","super","this","i18n","I18nService","keys","actions","cdsButtonAction","render","html","shape","pressed","expanded","updated","props","ariaLabel","readonly","LogService","warn","has","hasAttribute","ariaHidden","styles","baseStyles","__decorate","property","type","String","prototype","reflect","state","Boolean","attribute"],"mappings":"oPAqCO,MAAMA,UAAwBC,EACjCC,cACIC,oBACAC,KAAKC,KAAOC,EAAYC,KAAKC,QAC7BJ,KAAKK,iBAAkB,EAE3BC,SACI,OAAOC,CAAK,qDAICP,KAAKQ,MAAQR,KAAKQ,MAAQ,
|
|
1
|
+
{"version":3,"file":"button-action.element.js","sources":["../../../src/button-action/button-action.element.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { __decorate } from \"tslib\";\nimport { html } from 'lit';\nimport { property, baseStyles, CdsBaseButton, LogService, state, i18n, I18nService } from '@cds/core/internal';\nimport styles from './button-action.element.scss';\n/**\n * Action Button\n *\n * ```typescript\n * import '@cds/core/button-action/register.js';\n * ```\n *\n * ```html\n * <cds-button-action></cds-button-action>\n * ```\n * @beta\n * @element cds-button-action\n * @slot - For projecting text content or cds-icon\n * @property pressed\n * @cssprop --icon-width\n * @cssprop --icon-height\n * @cssprop --width\n * @cssprop --height\n * @cssprop --cursor\n * @cssprop --color\n * @cssprop --font-size\n * @cssprop --background\n * @cssprop --padding\n * @cssprop --outline\n * @cssprop --outline-offset\n * @property pressed - boolean\n * @property expanded - boolean\n */\nexport class CdsButtonAction extends CdsBaseButton {\n constructor() {\n super(...arguments);\n this.i18n = I18nService.keys.actions;\n this.cdsButtonAction = true;\n }\n render() {\n return html `\n <div class=\"private-host\">\n <slot\n ><cds-icon\n .shape=${this.shape ? this.shape : 'ellipsis-vertical'}\n .size=${this.iconSize}\n ?solid=${this.pressed || this.expanded}\n inner-offset=${1}\n ></cds-icon\n ></slot>\n </div>\n `;\n }\n updated(props) {\n super.updated(props);\n if (!this.ariaLabel && !this.readonly) {\n LogService.warn('A aria-label is required for interactive cds-button-action type', this);\n }\n if (props.has('readonly')) {\n this.readonly && !this.hasAttribute('aria-label') ? (this.ariaHidden = 'true') : (this.ariaHidden = null);\n }\n }\n}\nCdsButtonAction.styles = [baseStyles, styles];\n__decorate([\n property({ type: String })\n], CdsButtonAction.prototype, \"shape\", void 0);\n__decorate([\n property({ type: String, reflect: true })\n], CdsButtonAction.prototype, \"action\", void 0);\n__decorate([\n property({ type: String })\n], CdsButtonAction.prototype, \"iconSize\", void 0);\n__decorate([\n i18n()\n], CdsButtonAction.prototype, \"i18n\", void 0);\n__decorate([\n state({ type: Boolean, reflect: true, attribute: 'cds-button-action' })\n], CdsButtonAction.prototype, \"cdsButtonAction\", void 0);\n"],"names":["CdsButtonAction","CdsBaseButton","constructor","super","this","i18n","I18nService","keys","actions","cdsButtonAction","render","html","shape","iconSize","pressed","expanded","updated","props","ariaLabel","readonly","LogService","warn","has","hasAttribute","ariaHidden","styles","baseStyles","__decorate","property","type","String","prototype","reflect","state","Boolean","attribute"],"mappings":"oPAqCO,MAAMA,UAAwBC,EACjCC,cACIC,oBACAC,KAAKC,KAAOC,EAAYC,KAAKC,QAC7BJ,KAAKK,iBAAkB,EAE3BC,SACI,OAAOC,CAAK,qDAICP,KAAKQ,MAAQR,KAAKQ,MAAQ,+BAC3BR,KAAKS,qBACJT,KAAKU,SAAWV,KAAKW,2BACf,8BAMvBC,QAAQC,GACJd,MAAMa,QAAQC,GACTb,KAAKc,WAAcd,KAAKe,UACzBC,EAAWC,KAAK,kEAAmEjB,MAEnFa,EAAMK,IAAI,cACVlB,KAAKe,WAAaf,KAAKmB,aAAa,cAAiBnB,KAAKoB,WAAa,OAAWpB,KAAKoB,WAAa,OAIhHxB,EAAgByB,OAAS,CAACC,EAAYD,GACtCE,EAAW,CACPC,EAAS,CAAEC,KAAMC,UAClB9B,EAAgB+B,UAAW,aAAS,GACvCJ,EAAW,CACPC,EAAS,CAAEC,KAAMC,OAAQE,SAAS,KACnChC,EAAgB+B,UAAW,cAAU,GACxCJ,EAAW,CACPC,EAAS,CAAEC,KAAMC,UAClB9B,EAAgB+B,UAAW,gBAAY,GAC1CJ,EAAW,CACPtB,KACDL,EAAgB+B,UAAW,YAAQ,GACtCJ,EAAW,CACPM,EAAM,CAAEJ,KAAMK,QAASF,SAAS,EAAMG,UAAW,uBAClDnC,EAAgB+B,UAAW,uBAAmB"}
|
package/custom-elements.json
CHANGED
|
@@ -1225,6 +1225,14 @@
|
|
|
1225
1225
|
"attribute": "action",
|
|
1226
1226
|
"reflects": true
|
|
1227
1227
|
},
|
|
1228
|
+
{
|
|
1229
|
+
"kind": "field",
|
|
1230
|
+
"name": "iconSize",
|
|
1231
|
+
"type": {
|
|
1232
|
+
"text": "string"
|
|
1233
|
+
},
|
|
1234
|
+
"attribute": "iconSize"
|
|
1235
|
+
},
|
|
1228
1236
|
{
|
|
1229
1237
|
"kind": "field",
|
|
1230
1238
|
"name": "i18n"
|
|
@@ -1353,6 +1361,13 @@
|
|
|
1353
1361
|
},
|
|
1354
1362
|
"fieldName": "action"
|
|
1355
1363
|
},
|
|
1364
|
+
{
|
|
1365
|
+
"name": "iconSize",
|
|
1366
|
+
"type": {
|
|
1367
|
+
"text": "string"
|
|
1368
|
+
},
|
|
1369
|
+
"fieldName": "iconSize"
|
|
1370
|
+
},
|
|
1356
1371
|
{
|
|
1357
1372
|
"name": "pressed",
|
|
1358
1373
|
"type": {
|
|
@@ -1550,6 +1565,18 @@
|
|
|
1550
1565
|
"module": "button-action/button-action.element.js"
|
|
1551
1566
|
}
|
|
1552
1567
|
},
|
|
1568
|
+
{
|
|
1569
|
+
"kind": "field",
|
|
1570
|
+
"name": "iconSize",
|
|
1571
|
+
"type": {
|
|
1572
|
+
"text": "string"
|
|
1573
|
+
},
|
|
1574
|
+
"attribute": "iconSize",
|
|
1575
|
+
"inheritedFrom": {
|
|
1576
|
+
"name": "CdsButtonAction",
|
|
1577
|
+
"module": "button-action/button-action.element.js"
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1553
1580
|
{
|
|
1554
1581
|
"kind": "field",
|
|
1555
1582
|
"name": "i18n",
|
|
@@ -1682,6 +1709,17 @@
|
|
|
1682
1709
|
"module": "button-action/button-action.element.js"
|
|
1683
1710
|
}
|
|
1684
1711
|
},
|
|
1712
|
+
{
|
|
1713
|
+
"name": "iconSize",
|
|
1714
|
+
"type": {
|
|
1715
|
+
"text": "string"
|
|
1716
|
+
},
|
|
1717
|
+
"fieldName": "iconSize",
|
|
1718
|
+
"inheritedFrom": {
|
|
1719
|
+
"name": "CdsButtonAction",
|
|
1720
|
+
"module": "button-action/button-action.element.js"
|
|
1721
|
+
}
|
|
1722
|
+
},
|
|
1685
1723
|
{
|
|
1686
1724
|
"name": "pressed",
|
|
1687
1725
|
"type": {
|
|
@@ -1852,6 +1890,18 @@
|
|
|
1852
1890
|
"module": "button-action/button-action.element.js"
|
|
1853
1891
|
}
|
|
1854
1892
|
},
|
|
1893
|
+
{
|
|
1894
|
+
"kind": "field",
|
|
1895
|
+
"name": "iconSize",
|
|
1896
|
+
"type": {
|
|
1897
|
+
"text": "string"
|
|
1898
|
+
},
|
|
1899
|
+
"attribute": "iconSize",
|
|
1900
|
+
"inheritedFrom": {
|
|
1901
|
+
"name": "CdsButtonAction",
|
|
1902
|
+
"module": "button-action/button-action.element.js"
|
|
1903
|
+
}
|
|
1904
|
+
},
|
|
1855
1905
|
{
|
|
1856
1906
|
"kind": "field",
|
|
1857
1907
|
"name": "i18n",
|
|
@@ -2002,6 +2052,17 @@
|
|
|
2002
2052
|
"module": "button-action/button-action.element.js"
|
|
2003
2053
|
}
|
|
2004
2054
|
},
|
|
2055
|
+
{
|
|
2056
|
+
"name": "iconSize",
|
|
2057
|
+
"type": {
|
|
2058
|
+
"text": "string"
|
|
2059
|
+
},
|
|
2060
|
+
"fieldName": "iconSize",
|
|
2061
|
+
"inheritedFrom": {
|
|
2062
|
+
"name": "CdsButtonAction",
|
|
2063
|
+
"module": "button-action/button-action.element.js"
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2005
2066
|
{
|
|
2006
2067
|
"name": "pressed",
|
|
2007
2068
|
"type": {
|
|
@@ -2665,6 +2726,18 @@
|
|
|
2665
2726
|
"module": "button-action/button-action.element.js"
|
|
2666
2727
|
}
|
|
2667
2728
|
},
|
|
2729
|
+
{
|
|
2730
|
+
"kind": "field",
|
|
2731
|
+
"name": "iconSize",
|
|
2732
|
+
"type": {
|
|
2733
|
+
"text": "string"
|
|
2734
|
+
},
|
|
2735
|
+
"attribute": "iconSize",
|
|
2736
|
+
"inheritedFrom": {
|
|
2737
|
+
"name": "CdsButtonAction",
|
|
2738
|
+
"module": "button-action/button-action.element.js"
|
|
2739
|
+
}
|
|
2740
|
+
},
|
|
2668
2741
|
{
|
|
2669
2742
|
"kind": "field",
|
|
2670
2743
|
"name": "i18n",
|
|
@@ -2817,6 +2890,17 @@
|
|
|
2817
2890
|
"module": "button-action/button-action.element.js"
|
|
2818
2891
|
}
|
|
2819
2892
|
},
|
|
2893
|
+
{
|
|
2894
|
+
"name": "iconSize",
|
|
2895
|
+
"type": {
|
|
2896
|
+
"text": "string"
|
|
2897
|
+
},
|
|
2898
|
+
"fieldName": "iconSize",
|
|
2899
|
+
"inheritedFrom": {
|
|
2900
|
+
"name": "CdsButtonAction",
|
|
2901
|
+
"module": "button-action/button-action.element.js"
|
|
2902
|
+
}
|
|
2903
|
+
},
|
|
2820
2904
|
{
|
|
2821
2905
|
"name": "pressed",
|
|
2822
2906
|
"type": {
|
|
@@ -7836,6 +7920,18 @@
|
|
|
7836
7920
|
"module": "button-action/button-action.element.js"
|
|
7837
7921
|
}
|
|
7838
7922
|
},
|
|
7923
|
+
{
|
|
7924
|
+
"kind": "field",
|
|
7925
|
+
"name": "iconSize",
|
|
7926
|
+
"type": {
|
|
7927
|
+
"text": "string"
|
|
7928
|
+
},
|
|
7929
|
+
"attribute": "iconSize",
|
|
7930
|
+
"inheritedFrom": {
|
|
7931
|
+
"name": "CdsButtonAction",
|
|
7932
|
+
"module": "button-action/button-action.element.js"
|
|
7933
|
+
}
|
|
7934
|
+
},
|
|
7839
7935
|
{
|
|
7840
7936
|
"kind": "field",
|
|
7841
7937
|
"name": "i18n",
|
|
@@ -7980,6 +8076,17 @@
|
|
|
7980
8076
|
"module": "button-action/button-action.element.js"
|
|
7981
8077
|
}
|
|
7982
8078
|
},
|
|
8079
|
+
{
|
|
8080
|
+
"name": "iconSize",
|
|
8081
|
+
"type": {
|
|
8082
|
+
"text": "string"
|
|
8083
|
+
},
|
|
8084
|
+
"fieldName": "iconSize",
|
|
8085
|
+
"inheritedFrom": {
|
|
8086
|
+
"name": "CdsButtonAction",
|
|
8087
|
+
"module": "button-action/button-action.element.js"
|
|
8088
|
+
}
|
|
8089
|
+
},
|
|
7983
8090
|
{
|
|
7984
8091
|
"name": "pressed",
|
|
7985
8092
|
"type": {
|
|
@@ -36078,6 +36185,18 @@
|
|
|
36078
36185
|
"module": "button-action/button-action.element.js"
|
|
36079
36186
|
}
|
|
36080
36187
|
},
|
|
36188
|
+
{
|
|
36189
|
+
"kind": "field",
|
|
36190
|
+
"name": "iconSize",
|
|
36191
|
+
"type": {
|
|
36192
|
+
"text": "string"
|
|
36193
|
+
},
|
|
36194
|
+
"attribute": "iconSize",
|
|
36195
|
+
"inheritedFrom": {
|
|
36196
|
+
"name": "CdsButtonAction",
|
|
36197
|
+
"module": "button-action/button-action.element.js"
|
|
36198
|
+
}
|
|
36199
|
+
},
|
|
36081
36200
|
{
|
|
36082
36201
|
"kind": "field",
|
|
36083
36202
|
"name": "i18n",
|
|
@@ -36223,6 +36342,17 @@
|
|
|
36223
36342
|
"module": "button-action/button-action.element.js"
|
|
36224
36343
|
}
|
|
36225
36344
|
},
|
|
36345
|
+
{
|
|
36346
|
+
"name": "iconSize",
|
|
36347
|
+
"type": {
|
|
36348
|
+
"text": "string"
|
|
36349
|
+
},
|
|
36350
|
+
"fieldName": "iconSize",
|
|
36351
|
+
"inheritedFrom": {
|
|
36352
|
+
"name": "CdsButtonAction",
|
|
36353
|
+
"module": "button-action/button-action.element.js"
|
|
36354
|
+
}
|
|
36355
|
+
},
|
|
36226
36356
|
{
|
|
36227
36357
|
"name": "pressed",
|
|
36228
36358
|
"type": {
|
|
@@ -50244,6 +50374,18 @@
|
|
|
50244
50374
|
"module": "button-action/button-action.element.js"
|
|
50245
50375
|
}
|
|
50246
50376
|
},
|
|
50377
|
+
{
|
|
50378
|
+
"kind": "field",
|
|
50379
|
+
"name": "iconSize",
|
|
50380
|
+
"type": {
|
|
50381
|
+
"text": "string"
|
|
50382
|
+
},
|
|
50383
|
+
"attribute": "iconSize",
|
|
50384
|
+
"inheritedFrom": {
|
|
50385
|
+
"name": "CdsButtonAction",
|
|
50386
|
+
"module": "button-action/button-action.element.js"
|
|
50387
|
+
}
|
|
50388
|
+
},
|
|
50247
50389
|
{
|
|
50248
50390
|
"kind": "field",
|
|
50249
50391
|
"name": "i18n",
|
|
@@ -50376,6 +50518,17 @@
|
|
|
50376
50518
|
"module": "button-action/button-action.element.js"
|
|
50377
50519
|
}
|
|
50378
50520
|
},
|
|
50521
|
+
{
|
|
50522
|
+
"name": "iconSize",
|
|
50523
|
+
"type": {
|
|
50524
|
+
"text": "string"
|
|
50525
|
+
},
|
|
50526
|
+
"fieldName": "iconSize",
|
|
50527
|
+
"inheritedFrom": {
|
|
50528
|
+
"name": "CdsButtonAction",
|
|
50529
|
+
"module": "button-action/button-action.element.js"
|
|
50530
|
+
}
|
|
50531
|
+
},
|
|
50379
50532
|
{
|
|
50380
50533
|
"name": "pressed",
|
|
50381
50534
|
"type": {
|
package/internal/utils/global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isBrowser as e}from"./environment.js";import{getAngularVersion as n,getAngularJSVersion as o,getReactVersion as t,getVueVersion as i}from"./framework.js";import{browserFeatures as s}from"./supports.js";import{LogService as r}from"../services/log.service.js";function w(){e()&&(window.CDS=window.CDS||{_version:[],_react:{version:void 0},_supports:s.supports,_isStateProxied:!1,_state:{focusTrapItems:[],layerElements:[],i18nRegistry:{},elementRegistry:{},iconRegistry:{},motionRegistry:{}},environment:{production:!1},getDetails:a,logDetails:d},function(){const e="6.0.
|
|
1
|
+
import{isBrowser as e}from"./environment.js";import{getAngularVersion as n,getAngularJSVersion as o,getReactVersion as t,getVueVersion as i}from"./framework.js";import{browserFeatures as s}from"./supports.js";import{LogService as r}from"../services/log.service.js";function w(){e()&&(window.CDS=window.CDS||{_version:[],_react:{version:void 0},_supports:s.supports,_isStateProxied:!1,_state:{focusTrapItems:[],layerElements:[],i18nRegistry:{},elementRegistry:{},iconRegistry:{},motionRegistry:{}},environment:{production:!1},getDetails:a,logDetails:d},function(){const e="6.0.4";window.CDS._version.indexOf(e)<0&&(window.CDS._version.push(e),document.querySelector("body")?.setAttribute("cds-version",window.CDS._version.join(" "))),window.CDS._version.length>1&&r.warn("Running more than one version of Clarity can cause unexpected issues. Please ensure only one version is loaded.")}(),window.CDS._isStateProxied||(window.CDS._isStateProxied=!0,window.CDS._state=new Proxy(window.CDS._state,{set:(e,n,o)=>{const t={key:n,prev:window.CDS._state[n],current:o};return e[n]=o,document.dispatchEvent(new CustomEvent("CDS_STATE_UPDATE",{detail:t})),!0}})))}function a(){return{versions:window.CDS._version,environment:window.CDS.environment,userAgent:navigator.userAgent,supports:window.CDS._supports,angularVersion:n(!1),angularJSVersion:o(!1),reactVersion:t(!1),vueVersion:i(!1),state:{...window.CDS._state,iconRegistry:Object.keys(window.CDS._state.iconRegistry),motionRegistry:Object.keys(window.CDS._state.motionRegistry),focusTrapRegistry:Object.keys(window.CDS._state.focusTrapItems.map((e=>e.focusTrapId)))}}}function d(){r.log(JSON.stringify(a(),null,2))}export{w as setupCDSGlobal};
|
|
2
2
|
//# sourceMappingURL=global.js.map
|
package/package.json
CHANGED