@digital-realty/ix-icon-button 1.2.3 → 1.2.5
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/IxIconButton.d.ts
CHANGED
|
@@ -4,11 +4,12 @@ import '@material/web/iconbutton/filled-icon-button.js';
|
|
|
4
4
|
import '@material/web/iconbutton/filled-tonal-icon-button.js';
|
|
5
5
|
import '@material/web/iconbutton/outlined-icon-button.js';
|
|
6
6
|
import '@digital-realty/ix-icon/ix-icon.js';
|
|
7
|
-
import { IconButton } from '@material/web/iconbutton/internal/icon-button';
|
|
7
|
+
import { IconButton } from '@material/web/iconbutton/internal/icon-button.js';
|
|
8
8
|
import { FormSubmitterType } from '@material/web/internal/controller/form-submitter.js';
|
|
9
9
|
type LinkTarget = '_blank' | '_parent' | '_self' | '_top';
|
|
10
10
|
export type Appearance = 'filled' | 'filled-tonal' | 'outlined' | 'icon-filled' | 'default';
|
|
11
|
-
|
|
11
|
+
declare const IxIconButton_base: typeof LitElement & import("@digital-realty/ix-shared-fns/aria-forward-mixin.js").Constructor<import("@digital-realty/ix-shared-fns/aria-forward-mixin.js").AriaForwardMixinInterface>;
|
|
12
|
+
export declare class IxIconButton extends IxIconButton_base {
|
|
12
13
|
readonly component: IconButton;
|
|
13
14
|
appearance: Appearance;
|
|
14
15
|
icon: string;
|
package/dist/IxIconButton.js
CHANGED
|
@@ -8,7 +8,9 @@ import '@material/web/iconbutton/filled-icon-button.js';
|
|
|
8
8
|
import '@material/web/iconbutton/filled-tonal-icon-button.js';
|
|
9
9
|
import '@material/web/iconbutton/outlined-icon-button.js';
|
|
10
10
|
import '@digital-realty/ix-icon/ix-icon.js';
|
|
11
|
-
|
|
11
|
+
import { AriaForwardMixin } from '@digital-realty/ix-shared-fns/aria-forward-mixin.js';
|
|
12
|
+
import { spread } from '@open-wc/lit-helpers';
|
|
13
|
+
export class IxIconButton extends AriaForwardMixin(LitElement) {
|
|
12
14
|
constructor() {
|
|
13
15
|
super(...arguments);
|
|
14
16
|
this.appearance = 'default';
|
|
@@ -76,6 +78,7 @@ export class IxIconButton extends LitElement {
|
|
|
76
78
|
type=${this.type}
|
|
77
79
|
name=${ifDefined(this.name)}
|
|
78
80
|
value=${ifDefined(this.value)}
|
|
81
|
+
${spread(this.ariaAttributes)}
|
|
79
82
|
>${this.icon
|
|
80
83
|
? html `<ix-icon ?filled=${this.filledIcon}>${this.icon}</ix-icon>`
|
|
81
84
|
: html `<slot name="default"></slot
|
package/dist/IxIconButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IxIconButton.js","sourceRoot":"","sources":["../src/IxIconButton.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAe,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,yCAAyC,CAAC;AACjD,OAAO,gDAAgD,CAAC;AACxD,OAAO,sDAAsD,CAAC;AAC9D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"IxIconButton.js","sourceRoot":"","sources":["../src/IxIconButton.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAe,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,yCAAyC,CAAC;AACjD,OAAO,gDAAgD,CAAC;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AAQ,CAAC,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;uDAErB;AAMG;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAgB;AAOA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAkB;AAEjD;IAAX,QAAQ,EAAE;0CAAoC;AAEnC;IAAX,QAAQ,EAAE;0CAAsC;AAErC;IAAX,QAAQ,EAAE;2CAAuC;AAEtC;IAAX,QAAQ,EAAE;2CAAuC;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAoB","sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { StaticValue, literal, html as staticHtml } from 'lit/static-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { ARIAMixinStrict } from '@material/web/internal/aria/aria.js';\nimport '@material/web/iconbutton/icon-button.js';\nimport '@material/web/iconbutton/filled-icon-button.js';\nimport '@material/web/iconbutton/filled-tonal-icon-button.js';\nimport '@material/web/iconbutton/outlined-icon-button.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport { IconButton } from '@material/web/iconbutton/internal/icon-button.js';\nimport { FormSubmitterType } from '@material/web/internal/controller/form-submitter.js';\nimport { AriaForwardMixin } from '@digital-realty/ix-shared-fns/aria-forward-mixin.js';\nimport { spread } from '@open-wc/lit-helpers';\n\ntype LinkTarget = '_blank' | '_parent' | '_self' | '_top';\nexport type Appearance =\n | 'filled'\n | 'filled-tonal'\n | 'outlined'\n | 'icon-filled'\n | 'default';\n\nexport class IxIconButton extends AriaForwardMixin(LitElement) {\n @query('.button')\n readonly component!: IconButton;\n\n @property()\n appearance: Appearance = 'default';\n\n @property()\n icon: string = '';\n\n @property()\n selectedIcon: string = '';\n\n /**\n * Disables the icon button and makes it non-interactive.\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * Flips the icon if it is in an RTL context at startup.\n */\n @property({ type: Boolean, attribute: 'flip-icon-in-rtl' })\n flipIconInRtl = false;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `href` resource attribute.\n */\n @property() href: string | undefined = undefined;\n\n /**\n * Sets the underlying `HTMLAnchorElement`'s `target` attribute.\n */\n @property() target: LinkTarget | '' | undefined = undefined;\n\n /**\n * The `aria-label` of the button when the button is toggleable and selected.\n */\n @property({ attribute: 'aria-label-selected' }) ariaLabelSelected:\n | string\n | undefined = undefined;\n\n /**\n * When true, the button will toggle between selected and unselected\n * states\n */\n @property({ type: Boolean }) toggle = false;\n\n /**\n * Sets the selected state. When false, displays the default icon. When true,\n * displays the selected icon, or the default icon If no `slot=\"selected\"`\n * icon is provided.\n */\n @property({ type: Boolean, reflect: true }) selected = false;\n\n @property() type: FormSubmitterType = 'submit';\n\n @property() name: string | undefined = undefined;\n\n @property() value: string | undefined = undefined;\n\n @property() label: string | undefined = undefined;\n\n @property({ type: Boolean }) filledIcon = false;\n\n render() {\n const ariaLabel = this.label || (this as ARIAMixinStrict).ariaLabel;\n\n let tag: StaticValue = literal`md-icon-button`;\n if (this.appearance === 'outlined') {\n tag = literal`md-outlined-icon-button`;\n } else if (this.appearance === 'filled') {\n tag = literal`md-filled-icon-button`;\n } else if (this.appearance === 'filled-tonal') {\n tag = literal`md-filled-tonal-icon-button`;\n }\n\n return staticHtml`<${tag}\n class=\"button\"\n ?disabled=${this.disabled}\n ?flip-icon-in-rtl=${this.flipIconInRtl}\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n aria-label-selected=${ifDefined(this.ariaLabelSelected)}\n aria-label=${ariaLabel || nothing}\n ?toggle=${this.toggle}\n ?selected=${this.selected}\n type=${this.type}\n name=${ifDefined(this.name)}\n value=${ifDefined(this.value)}\n ${spread(this.ariaAttributes)}\n >${\n this.icon\n ? html`<ix-icon ?filled=${this.filledIcon}>${this.icon}</ix-icon>`\n : html`<slot name=\"default\"></slot\n ><slot name=\"selected\" slot=\"selected\"></slot>`\n }\n ${\n this.selectedIcon\n ? html`<ix-icon ?filled=${this.filledIcon} slot=\"selected\"\n >${this.selectedIcon}</ix-icon\n >`\n : nothing\n }\n </${tag}>`;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LitElement,nothing,html,css}from"lit";import{__decorate}from"tslib";import{query,property}from"lit/decorators.js";import{literal,html as html$1}from"lit/static-html.js";import{ifDefined}from"lit/directives/if-defined.js";import"@material/web/iconbutton/icon-button.js";import"@material/web/iconbutton/filled-icon-button.js";import"@material/web/iconbutton/filled-tonal-icon-button.js";import"@material/web/iconbutton/outlined-icon-button.js";import"@digital-realty/ix-icon/ix-icon.js";class IxIconButton extends LitElement{constructor(){super(...arguments),this.appearance="default",this.icon="",this.selectedIcon="",this.disabled=!1,this.flipIconInRtl=!1,this.href=void 0,this.target=void 0,this.ariaLabelSelected=void 0,this.toggle=!1,this.selected=!1,this.type="submit",this.name=void 0,this.value=void 0,this.label=void 0,this.filledIcon=!1}render(){var t=this.label||this.ariaLabel;let e=literal`md-icon-button`;return"outlined"===this.appearance?e=literal`md-outlined-icon-button`:"filled"===this.appearance?e=literal`md-filled-icon-button`:"filled-tonal"===this.appearance&&(e=literal`md-filled-tonal-icon-button`),html$1`<${e}
|
|
1
|
+
import{LitElement,nothing,html,css}from"lit";import{__decorate}from"tslib";import{query,property}from"lit/decorators.js";import{literal,html as html$1}from"lit/static-html.js";import{ifDefined}from"lit/directives/if-defined.js";import"@material/web/iconbutton/icon-button.js";import"@material/web/iconbutton/filled-icon-button.js";import"@material/web/iconbutton/filled-tonal-icon-button.js";import"@material/web/iconbutton/outlined-icon-button.js";import"@digital-realty/ix-icon/ix-icon.js";import{AriaForwardMixin}from"@digital-realty/ix-shared-fns/aria-forward-mixin.js";import{spread}from"@open-wc/lit-helpers";class IxIconButton extends AriaForwardMixin(LitElement){constructor(){super(...arguments),this.appearance="default",this.icon="",this.selectedIcon="",this.disabled=!1,this.flipIconInRtl=!1,this.href=void 0,this.target=void 0,this.ariaLabelSelected=void 0,this.toggle=!1,this.selected=!1,this.type="submit",this.name=void 0,this.value=void 0,this.label=void 0,this.filledIcon=!1}render(){var t=this.label||this.ariaLabel;let e=literal`md-icon-button`;return"outlined"===this.appearance?e=literal`md-outlined-icon-button`:"filled"===this.appearance?e=literal`md-filled-icon-button`:"filled-tonal"===this.appearance&&(e=literal`md-filled-tonal-icon-button`),html$1`<${e}
|
|
2
2
|
class="button"
|
|
3
3
|
?disabled=${this.disabled}
|
|
4
4
|
?flip-icon-in-rtl=${this.flipIconInRtl}
|
|
@@ -11,6 +11,7 @@ import{LitElement,nothing,html,css}from"lit";import{__decorate}from"tslib";impor
|
|
|
11
11
|
type=${this.type}
|
|
12
12
|
name=${ifDefined(this.name)}
|
|
13
13
|
value=${ifDefined(this.value)}
|
|
14
|
+
${spread(this.ariaAttributes)}
|
|
14
15
|
>${this.icon?html`<ix-icon ?filled=${this.filledIcon}>${this.icon}</ix-icon>`:html`<slot name="default"></slot
|
|
15
16
|
><slot name="selected" slot="selected"></slot>`}
|
|
16
17
|
${this.selectedIcon?html`<ix-icon ?filled=${this.filledIcon} slot="selected"
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Webcomponent ix-icon-button following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Digital Realty",
|
|
6
|
-
"version": "1.2.
|
|
6
|
+
"version": "1.2.5",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -27,9 +27,11 @@
|
|
|
27
27
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@digital-realty/ix-icon": "^1.2.
|
|
30
|
+
"@digital-realty/ix-icon": "^1.2.4",
|
|
31
|
+
"@digital-realty/ix-shared-fns": "1.0.1",
|
|
31
32
|
"@lit/react": "^1.0.2",
|
|
32
33
|
"@material/web": "2.4.0",
|
|
34
|
+
"@open-wc/lit-helpers": "^0.7.0",
|
|
33
35
|
"lit": "^3.2.1",
|
|
34
36
|
"react": "^18.2.0"
|
|
35
37
|
},
|
|
@@ -103,5 +105,5 @@
|
|
|
103
105
|
"README.md",
|
|
104
106
|
"LICENSE"
|
|
105
107
|
],
|
|
106
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "ab315b433acc9b12065e1a2038a2bc3a7c07487f"
|
|
107
109
|
}
|