@digital-realty/ix-drawer 1.0.26 → 1.0.28
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/IxDrawer.d.ts
CHANGED
package/dist/IxDrawer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement, html, nothing } from 'lit';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
3
4
|
import { property, state } from 'lit/decorators.js';
|
|
4
5
|
import { IxDrawerStyles } from './styles/ix-drawer-styles.js';
|
|
5
6
|
import '@digital-realty/ix-button/ix-button.js';
|
|
@@ -15,6 +16,8 @@ export class IxDrawer extends LitElement {
|
|
|
15
16
|
this.minimisedTitle = 'Draft';
|
|
16
17
|
this.minimisedSubTitle = '';
|
|
17
18
|
this.minimisable = false;
|
|
19
|
+
this.animateVertical = false;
|
|
20
|
+
this.hideClose = false;
|
|
18
21
|
this.closing = false;
|
|
19
22
|
this.minimising = false;
|
|
20
23
|
}
|
|
@@ -136,6 +139,10 @@ export class IxDrawer extends LitElement {
|
|
|
136
139
|
</div>`;
|
|
137
140
|
}
|
|
138
141
|
renderDrawerContainer() {
|
|
142
|
+
const drawerClasses = {
|
|
143
|
+
drawer: true,
|
|
144
|
+
'animate-vert': this.animateVertical,
|
|
145
|
+
};
|
|
139
146
|
return html `
|
|
140
147
|
<div
|
|
141
148
|
class="drawer-container"
|
|
@@ -143,18 +150,25 @@ export class IxDrawer extends LitElement {
|
|
|
143
150
|
@click=${this.clickOutsideDrawer}
|
|
144
151
|
@keydown=${this.clickOutsideDrawer}
|
|
145
152
|
>
|
|
146
|
-
<aside
|
|
153
|
+
<aside
|
|
154
|
+
class=${classMap(drawerClasses)}
|
|
155
|
+
@animationend=${this.handleClosed}
|
|
156
|
+
>
|
|
147
157
|
<div class="drawer-header">
|
|
148
158
|
<div class="drawer-header__minimise-btn">
|
|
149
159
|
${this.renderMinimiseButton()}
|
|
150
160
|
</div>
|
|
151
161
|
<slot name="header"></slot>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
162
|
+
${this.hideClose
|
|
163
|
+
? nothing
|
|
164
|
+
: html `
|
|
165
|
+
<div class="drawer-header__close-btn">
|
|
166
|
+
<ix-icon-button
|
|
167
|
+
@click=${this.handleClosing}
|
|
168
|
+
icon="close"
|
|
169
|
+
></ix-icon-button>
|
|
170
|
+
</div>
|
|
171
|
+
`}
|
|
158
172
|
</div>
|
|
159
173
|
<div class="drawer-body">
|
|
160
174
|
<slot name="content"></slot>
|
|
@@ -193,6 +207,12 @@ __decorate([
|
|
|
193
207
|
__decorate([
|
|
194
208
|
property({ type: Boolean })
|
|
195
209
|
], IxDrawer.prototype, "minimisable", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ type: Boolean, attribute: 'animate-vertical' })
|
|
212
|
+
], IxDrawer.prototype, "animateVertical", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ type: Boolean, attribute: 'hide-close' })
|
|
215
|
+
], IxDrawer.prototype, "hideClose", void 0);
|
|
196
216
|
__decorate([
|
|
197
217
|
state()
|
|
198
218
|
], IxDrawer.prototype, "closing", void 0);
|
package/dist/IxDrawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IxDrawer.js","sourceRoot":"","sources":["../src/IxDrawer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,wCAAwC,CAAC;AAChD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,wCAAwC,CAAC;AAEhD,MAAM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AQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAmB;AAEjB;IAA7B,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;0CAAe;AAEhB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA0B;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAwB;AAEtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAqB;AAEW;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;iDACnD;AAE8C;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;2CAAmB;AAE/D;IAAR,KAAK,EAAE;yCAAiB;AAEhB;IAAR,KAAK,EAAE;4CAAoB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { property, state } from 'lit/decorators.js';\nimport { IxDrawerStyles } from './styles/ix-drawer-styles.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-dialog/ix-dialog.js';\n\nexport class IxDrawer extends LitElement {\n static get styles() {\n return [IxDrawerStyles];\n }\n\n @state() protected minimised = false;\n\n @state() protected showDeleteConfirmationDialog = false;\n\n @property({ type: Boolean }) isVisible = false;\n\n @property({ type: Function }) onClosed: any;\n\n @property({ type: String }) minimisedTitle = 'Draft';\n\n @property({ type: String }) minimisedSubTitle = '';\n\n @property({ type: Boolean }) minimisable = false;\n\n @property({ type: Boolean, attribute: 'animate-vertical' }) animateVertical =\n false;\n\n @property({ type: Boolean, attribute: 'hide-close' }) hideClose = false;\n\n @state() closing = false;\n\n @state() minimising = false;\n\n onMinimised() {\n this.minimising = true;\n this.closing = true;\n setTimeout(() => {\n this.handleClosed();\n }, 300);\n }\n\n onMaximised() {\n this.minimised = false;\n }\n\n handleOnCancel() {\n this.showDeleteConfirmationDialog = false;\n }\n\n handleOnDelete() {\n this.showDeleteConfirmationDialog = true;\n }\n\n handleClosed() {\n if (this.closing) {\n this.closing = false;\n if (this.minimising) {\n this.minimising = false;\n this.minimised = !this.minimised;\n return;\n }\n this.onClosed();\n }\n }\n\n clickOutsideDrawer(event: MouseEvent) {\n const el = event.target as HTMLElement;\n if (el.classList.contains('drawer-container')) {\n this.handleClosing();\n }\n }\n\n handleClosing() {\n this.closing = true;\n // Backup timeout to complete closing\n // if animation end event has not fired\n setTimeout(() => {\n this.handleClosed();\n }, 300);\n }\n\n renderMinimiseButton() {\n if (this.minimisable)\n return html`<ix-button\n data-testid=\"hideButton\"\n appearance=\"text\"\n has-icon\n @click=${this.onMinimised}\n >\n <ix-icon slot=\"icon\">fullscreen_exit</ix-icon>\n HIDE\n </ix-button>`;\n\n return nothing;\n }\n\n renderMaximiseButton() {\n return html`<div class=\"drawer__maximise-btn\">\n <ix-icon @click=${this.onMaximised}>fullscreen</ix-icon>\n </div>`;\n }\n\n renderDeleteButton() {\n return html`<svg\n class=\"drawer__delete-btn\"\n focusable=\"false\"\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n data-testid=\"deleteIcon\"\n @click=${this.handleOnDelete}\n >\n <path\n d=\"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z\"\n ></path>\n </svg>\n ${this.renderDeleteConfirmationDialog()}`;\n }\n\n renderDeleteConfirmationDialog() {\n return html`\n <ix-dialog .open=${this.showDeleteConfirmationDialog}>\n <form slot=\"content\" id=\"form-id\" method=\"dialog\">\n <h2 class=\"drawer-delete-dialog__title\">\n Are you sure you want to proceed? All details provided will be lost.\n </h2>\n </form>\n <div slot=\"actions\">\n <ix-button\n appearance=\"text\"\n form=\"form-id\"\n @click=${this.handleOnCancel}\n >NO</ix-button\n >\n <ix-button\n appearance=\"text\"\n form=\"form-id\"\n @click=${this.handleClosing}\n >YES</ix-button\n >\n </div>\n </ix-dialog>\n `;\n }\n\n renderMinimisedContainer() {\n return html`<div class=\"drawer-minimised-container\">\n <div class=\"drawer-minimised-body\">\n <div>\n <div class=\"drawer-minimised-title\">${this.minimisedTitle}</div>\n <div class=\"drawer-minimised-sub-title\">\n ${this.minimisedSubTitle}\n </div>\n </div>\n <div class=\"drawer-minimised-actions\">\n ${this.renderDeleteButton()} ${this.renderMaximiseButton()}\n </div>\n </div>\n </div>`;\n }\n\n renderDrawerContainer() {\n const drawerClasses = {\n drawer: true,\n 'animate-vert': this.animateVertical,\n };\n\n return html`\n <div\n class=\"drawer-container\"\n ?closing=${this.closing}\n @click=${this.clickOutsideDrawer}\n @keydown=${this.clickOutsideDrawer}\n >\n <aside\n class=${classMap(drawerClasses)}\n @animationend=${this.handleClosed}\n >\n <div class=\"drawer-header\">\n <div class=\"drawer-header__minimise-btn\">\n ${this.renderMinimiseButton()}\n </div>\n <slot name=\"header\"></slot>\n ${this.hideClose\n ? nothing\n : html`\n <div class=\"drawer-header__close-btn\">\n <ix-icon-button\n @click=${this.handleClosing}\n icon=\"close\"\n ></ix-icon-button>\n </div>\n `}\n </div>\n <div class=\"drawer-body\">\n <slot name=\"content\"></slot>\n </div>\n </aside>\n </div>\n `;\n }\n\n render() {\n if (this.isVisible) {\n if (this.minimised) return this.renderMinimisedContainer();\n\n return this.renderDrawerContainer();\n }\n\n return nothing;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__decorate}from"tslib";import{css,LitElement,html,nothing}from"lit";import{classMap}from"lit/directives/class-map.js";import{state,property}from"lit/decorators.js";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-dialog/ix-dialog.js";const IxDrawerStyles=css`:host,:host :root,:root{font-size:var(--ix-drawer-font-size,.875rem);line-height:var(--ix-drawer-line-height,1.25rem);--ix-drawer-animation-time:225ms}.drawer-container{z-index:1;display:block;position:fixed;top:0;bottom:0;left:0;right:0;background-color:var(--ix-draw-scrim-bg,#00000080);scroll-behavior:auto;overflow:auto;animation:fadeIn var(--ix-drawer-animation-time,225ms) linear forwards}.drawer-container[closing]{animation:fadeOut var(--ix-drawer-animation-time,225ms) linear forwards}.drawer{width:90vw;top:0;bottom:0;right:0;position:fixed;padding:var(--ix-drawer-padding,32px 40px 46px 40px);background-color:#fff;border-radius:var(--ix-drawer-border-radius,16px 0 0 16px);box-sizing:border-box;box-shadow:0 12px 20px -12px rgba(0,0,0,.12),0 0 0 1px #e1e4e8 inset;transform:translateX(100%);overflow:hidden;z-index:2}.drawer.animate-vert{transform:translateY(-100%)}:host([isvisible]) .drawer{animation:slideIn var(--ix-drawer-animation-time,225ms) cubic-bezier(0,0,.2,1) forwards}:host([isvisible]) .drawer-container[closing] .drawer{animation:slideOut var(--ix-drawer-animation-time,225ms) 0s cubic-bezier(0,0,.2,1) forwards}:host([isvisible]) .drawer.animate-vert{animation:slideInVert var(--ix-drawer-animation-time,225ms) cubic-bezier(0,0,.2,1) forwards}:host([isvisible]) .drawer-container[closing] .drawer.animate-vert{animation:slideOutVert var(--ix-drawer-animation-time,225ms) 0s cubic-bezier(0,0,.2,1) forwards}@keyframes fadeIn{0%{background-color:transparent}100%{background-color:var(--ix-draw-scrim-bg,#00000080)}}@keyframes fadeOut{0%{background-color:var(--ix-draw-scrim-bg,#00000080)}100%{background-color:transparent}}@keyframes slideIn{100%{transform:translateX(0)}}@keyframes slideOut{0%{transform:translateX(0)}100%{transform:translateX(100%)}}@keyframes slideInVert{100%{transform:translateY(0)}}@keyframes slideOutVert{0%{transform:translateY(0)}100%{transform:translateY(-100%)}}@media screen and (min-width:1024px){.drawer{width:45vw}}.drawer-header{display:flex;justify-content:space-between;align-items:center}.drawer-header__close-btn{margin-bottom:-16px;background:#fff;border-radius:50%;position:relative;z-index:9}.drawer-header__minimise-btn{flex:0}.drawer-body{overflow:auto;height:100%}.drawer-minimised-container{bottom:24px;position:absolute;right:24px;z-index:1200;display:flex;flex-direction:row;gap:8px}.drawer-minimised-body{background-color:#fff;height:72px;display:flex;-webkit-box-align:center;align-items:center;padding:4px 24px;box-shadow:rgba(0,0,0,.12) 0 12px 20px -12px,#e1e4e8 0 0 0 1px inset;border-radius:16px;-webkit-box-pack:justify;justify-content:space-between}.drawer-minimised-title{color:rgba(9,34,65,.7);font-style:normal;font-weight:400;font-size:12px;line-height:16px;letter-spacing:.4px;font-family:'Open Sans',sans-serif}.drawer-minimised-sub-title{font-style:normal;font-weight:700;font-size:14px;line-height:24px;letter-spacing:.1px;font-family:'Open Sans',sans-serif}.drawer-minimised-actions{margin-left:42px;display:flex;-webkit-box-align:center;align-items:center}.drawer-delete-dialog__title{color:#092241}.drawer__delete-btn{user-select:none;width:1em;height:1em;display:inline-block;fill:currentcolor;flex-shrink:0;transition:fill .2s cubic-bezier(.4,0,.2,1) 0s;font-size:1.5rem;color:#db0028;cursor:pointer;margin-right:20px}.drawer__maximise-btn{display:inline-flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;outline:0;border:0;margin:0;cursor:pointer;user-select:none;vertical-align:middle;appearance:none;text-decoration:none;font-family:'Red Hat Display',sans-serif;font-weight:700;font-style:normal;font-size:1.5rem;line-height:18.52px;letter-spacing:1.25px;text-transform:uppercase;min-height:36px;transition:background-color 250ms cubic-bezier(.4,0,.2,1) 0s,box-shadow 250ms cubic-bezier(.4,0,.2,1) 0s,border-color 250ms cubic-bezier(.4,0,.2,1) 0s;border-radius:50%;padding:0;min-width:0;z-index:1050;color:#fff;height:40px!important;width:40px!important;background-color:#1456e0!important;box-shadow:none!important}`;class IxDrawer extends LitElement{constructor(){super(...arguments),this.minimised=!1,this.showDeleteConfirmationDialog=!1,this.isVisible=!1,this.minimisedTitle="Draft",this.minimisedSubTitle="",this.minimisable=!1,this.animateVertical=!1,this.hideClose=!1,this.closing=!1,this.minimising=!1}static get styles(){return[IxDrawerStyles]}onMinimised(){this.minimising=!0,this.closing=!0,setTimeout(()=>{this.handleClosed()},300)}onMaximised(){this.minimised=!1}handleOnCancel(){this.showDeleteConfirmationDialog=!1}handleOnDelete(){this.showDeleteConfirmationDialog=!0}handleClosed(){this.closing&&(this.closing=!1,this.minimising?(this.minimising=!1,this.minimised=!this.minimised):this.onClosed())}clickOutsideDrawer(i){i.target.classList.contains("drawer-container")&&this.handleClosing()}handleClosing(){this.closing=!0,setTimeout(()=>{this.handleClosed()},300)}renderMinimiseButton(){return this.minimisable?html`<ix-button data-testid="hideButton" appearance="text" has-icon @click="${this.onMinimised}"><ix-icon slot="icon">fullscreen_exit</ix-icon>HIDE</ix-button>`:nothing}renderMaximiseButton(){return html`<div class="drawer__maximise-btn"><ix-icon @click="${this.onMaximised}">fullscreen</ix-icon></div>`}renderDeleteButton(){return html`<svg class="drawer__delete-btn" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="deleteIcon" @click="${this.handleOnDelete}"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></svg> ${this.renderDeleteConfirmationDialog()}`}renderDeleteConfirmationDialog(){return html`<ix-dialog .open="${this.showDeleteConfirmationDialog}"><form slot="content" id="form-id" method="dialog"><h2 class="drawer-delete-dialog__title">Are you sure you want to proceed? All details provided will be lost.</h2></form><div slot="actions"><ix-button appearance="text" form="form-id" @click="${this.handleOnCancel}">NO</ix-button><ix-button appearance="text" form="form-id" @click="${this.handleClosing}">YES</ix-button></div></ix-dialog>`}renderMinimisedContainer(){return html`<div class="drawer-minimised-container"><div class="drawer-minimised-body"><div><div class="drawer-minimised-title">${this.minimisedTitle}</div><div class="drawer-minimised-sub-title">${this.minimisedSubTitle}</div></div><div class="drawer-minimised-actions">${this.renderDeleteButton()} ${this.renderMaximiseButton()}</div></div></div>`}renderDrawerContainer(){var i={drawer:!0,"animate-vert":this.animateVertical};return html`<div class="drawer-container" ?closing="${this.closing}" @click="${this.clickOutsideDrawer}" @keydown="${this.clickOutsideDrawer}"><aside class="${classMap(i)}" @animationend="${this.handleClosed}"><div class="drawer-header"><div class="drawer-header__minimise-btn">${this.renderMinimiseButton()}</div><slot name="header"></slot>${this.hideClose?nothing:html`<div class="drawer-header__close-btn"><ix-icon-button @click="${this.handleClosing}" icon="close"></ix-icon-button></div>`}</div><div class="drawer-body"><slot name="content"></slot></div></aside></div>`}render(){return this.isVisible?this.minimised?this.renderMinimisedContainer():this.renderDrawerContainer():nothing}}__decorate([state()],IxDrawer.prototype,"minimised",void 0),__decorate([state()],IxDrawer.prototype,"showDeleteConfirmationDialog",void 0),__decorate([property({type:Boolean})],IxDrawer.prototype,"isVisible",void 0),__decorate([property({type:Function})],IxDrawer.prototype,"onClosed",void 0),__decorate([property({type:String})],IxDrawer.prototype,"minimisedTitle",void 0),__decorate([property({type:String})],IxDrawer.prototype,"minimisedSubTitle",void 0),__decorate([property({type:Boolean})],IxDrawer.prototype,"minimisable",void 0),__decorate([property({type:Boolean,attribute:"animate-vertical"})],IxDrawer.prototype,"animateVertical",void 0),__decorate([property({type:Boolean,attribute:"hide-close"})],IxDrawer.prototype,"hideClose",void 0),__decorate([state()],IxDrawer.prototype,"closing",void 0),__decorate([state()],IxDrawer.prototype,"minimising",void 0),window.customElements.define("ix-drawer",IxDrawer);
|
|
@@ -12,10 +12,10 @@ export const IxDrawerStyles = css `
|
|
|
12
12
|
z-index: 1;
|
|
13
13
|
display: block;
|
|
14
14
|
position: fixed;
|
|
15
|
-
width: 100%;
|
|
16
|
-
height: 100%;
|
|
17
15
|
top: 0;
|
|
16
|
+
bottom: 0;
|
|
18
17
|
left: 0;
|
|
18
|
+
right: 0;
|
|
19
19
|
background-color: var(--ix-draw-scrim-bg, #00000080);
|
|
20
20
|
scroll-behavior: auto;
|
|
21
21
|
overflow: auto;
|
|
@@ -27,16 +27,24 @@ export const IxDrawerStyles = css `
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.drawer {
|
|
30
|
-
width:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
width: 90vw;
|
|
31
|
+
top: 0;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
right: 0;
|
|
34
|
+
position: fixed;
|
|
35
|
+
padding: var(--ix-drawer-padding, 32px 40px 46px 40px);
|
|
34
36
|
background-color: white;
|
|
35
|
-
border-radius: 16px 0px 0px 16px;
|
|
37
|
+
border-radius: var(--ix-drawer-border-radius, 16px 0px 0px 16px);
|
|
36
38
|
box-sizing: border-box;
|
|
37
39
|
box-shadow: 0px 12px 20px -12px rgba(0, 0, 0, 0.12),
|
|
38
40
|
0px 0px 0px 1px #e1e4e8 inset;
|
|
39
41
|
transform: translateX(100%);
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
z-index: 2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.drawer.animate-vert {
|
|
47
|
+
transform: translateY(-100%);
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
:host([isvisible]) .drawer {
|
|
@@ -49,6 +57,16 @@ export const IxDrawerStyles = css `
|
|
|
49
57
|
cubic-bezier(0, 0, 0.2, 1) forwards;
|
|
50
58
|
}
|
|
51
59
|
|
|
60
|
+
:host([isvisible]) .drawer.animate-vert {
|
|
61
|
+
animation: slideInVert var(--ix-drawer-animation-time, 225ms)
|
|
62
|
+
cubic-bezier(0, 0, 0.2, 1) forwards;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host([isvisible]) .drawer-container[closing] .drawer.animate-vert {
|
|
66
|
+
animation: slideOutVert var(--ix-drawer-animation-time, 225ms) 0ms
|
|
67
|
+
cubic-bezier(0, 0, 0.2, 1) forwards;
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
@keyframes fadeIn {
|
|
53
71
|
0% {
|
|
54
72
|
background-color: transparent;
|
|
@@ -82,14 +100,28 @@ export const IxDrawerStyles = css `
|
|
|
82
100
|
}
|
|
83
101
|
}
|
|
84
102
|
|
|
103
|
+
@keyframes slideInVert {
|
|
104
|
+
100% {
|
|
105
|
+
transform: translateY(0);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@keyframes slideOutVert {
|
|
110
|
+
0% {
|
|
111
|
+
transform: translateY(0);
|
|
112
|
+
}
|
|
113
|
+
100% {
|
|
114
|
+
transform: translateY(-100%);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
85
118
|
@media screen and (min-width: 1024px) {
|
|
86
119
|
.drawer {
|
|
87
|
-
width:
|
|
120
|
+
width: 45vw;
|
|
88
121
|
}
|
|
89
122
|
}
|
|
90
123
|
|
|
91
124
|
.drawer-header {
|
|
92
|
-
padding-right: 40px;
|
|
93
125
|
display: flex;
|
|
94
126
|
justify-content: space-between;
|
|
95
127
|
align-items: center;
|
|
@@ -108,9 +140,8 @@ export const IxDrawerStyles = css `
|
|
|
108
140
|
}
|
|
109
141
|
|
|
110
142
|
.drawer-body {
|
|
111
|
-
height: 95%;
|
|
112
143
|
overflow: auto;
|
|
113
|
-
|
|
144
|
+
height: 100%;
|
|
114
145
|
}
|
|
115
146
|
|
|
116
147
|
.drawer-minimised-container {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ix-drawer-styles.js","sourceRoot":"","sources":["../../src/styles/ix-drawer-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"ix-drawer-styles.js","sourceRoot":"","sources":["../../src/styles/ix-drawer-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiQhC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxDrawerStyles = css`\n :root,\n :host :root,\n :host {\n font-size: var(--ix-drawer-font-size, 0.875rem);\n line-height: var(--ix-drawer-line-height, 1.25rem);\n --ix-drawer-animation-time: 225ms;\n }\n\n .drawer-container {\n z-index: 1;\n display: block;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: var(--ix-draw-scrim-bg, #00000080);\n scroll-behavior: auto;\n overflow: auto;\n animation: fadeIn var(--ix-drawer-animation-time, 225ms) linear forwards;\n }\n\n .drawer-container[closing] {\n animation: fadeOut var(--ix-drawer-animation-time, 225ms) linear forwards;\n }\n\n .drawer {\n width: 90vw;\n top: 0;\n bottom: 0;\n right: 0;\n position: fixed;\n padding: var(--ix-drawer-padding, 32px 40px 46px 40px);\n background-color: white;\n border-radius: var(--ix-drawer-border-radius, 16px 0px 0px 16px);\n box-sizing: border-box;\n box-shadow: 0px 12px 20px -12px rgba(0, 0, 0, 0.12),\n 0px 0px 0px 1px #e1e4e8 inset;\n transform: translateX(100%);\n overflow: hidden;\n z-index: 2;\n }\n\n .drawer.animate-vert {\n transform: translateY(-100%);\n }\n\n :host([isvisible]) .drawer {\n animation: slideIn var(--ix-drawer-animation-time, 225ms)\n cubic-bezier(0, 0, 0.2, 1) forwards;\n }\n\n :host([isvisible]) .drawer-container[closing] .drawer {\n animation: slideOut var(--ix-drawer-animation-time, 225ms) 0ms\n cubic-bezier(0, 0, 0.2, 1) forwards;\n }\n\n :host([isvisible]) .drawer.animate-vert {\n animation: slideInVert var(--ix-drawer-animation-time, 225ms)\n cubic-bezier(0, 0, 0.2, 1) forwards;\n }\n\n :host([isvisible]) .drawer-container[closing] .drawer.animate-vert {\n animation: slideOutVert var(--ix-drawer-animation-time, 225ms) 0ms\n cubic-bezier(0, 0, 0.2, 1) forwards;\n }\n\n @keyframes fadeIn {\n 0% {\n background-color: transparent;\n }\n 100% {\n background-color: var(--ix-draw-scrim-bg, #00000080);\n }\n }\n\n @keyframes fadeOut {\n 0% {\n background-color: var(--ix-draw-scrim-bg, #00000080);\n }\n 100% {\n background-color: transparent;\n }\n }\n\n @keyframes slideIn {\n 100% {\n transform: translateX(0);\n }\n }\n\n @keyframes slideOut {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(100%);\n }\n }\n\n @keyframes slideInVert {\n 100% {\n transform: translateY(0);\n }\n }\n\n @keyframes slideOutVert {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(-100%);\n }\n }\n\n @media screen and (min-width: 1024px) {\n .drawer {\n width: 45vw;\n }\n }\n\n .drawer-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .drawer-header__close-btn {\n margin-bottom: -16px;\n background: white;\n border-radius: 50%;\n position: relative;\n z-index: 9;\n }\n\n .drawer-header__minimise-btn {\n flex: 0;\n }\n\n .drawer-body {\n overflow: auto;\n height: 100%;\n }\n\n .drawer-minimised-container {\n bottom: 24px;\n position: absolute;\n right: 24px;\n z-index: 1200;\n display: flex;\n flex-direction: row;\n gap: 8px;\n }\n\n .drawer-minimised-body {\n background-color: rgb(255, 255, 255);\n height: 72px;\n display: flex;\n -webkit-box-align: center;\n align-items: center;\n padding: 4px 24px;\n box-shadow: rgba(0, 0, 0, 0.12) 0px 12px 20px -12px,\n rgb(225, 228, 232) 0px 0px 0px 1px inset;\n border-radius: 16px;\n -webkit-box-pack: justify;\n justify-content: space-between;\n }\n\n .drawer-minimised-title {\n color: rgba(9, 34, 65, 0.7);\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 16px;\n letter-spacing: 0.4px;\n font-family: 'Open Sans', sans-serif;\n }\n\n .drawer-minimised-sub-title {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n line-height: 24px;\n letter-spacing: 0.1px;\n font-family: 'Open Sans', sans-serif;\n }\n\n .drawer-minimised-actions {\n margin-left: 42px;\n display: flex;\n -webkit-box-align: center;\n align-items: center;\n }\n\n .drawer-delete-dialog__title {\n color: rgb(9, 34, 65);\n }\n\n .drawer__delete-btn {\n user-select: none;\n width: 1em;\n height: 1em;\n display: inline-block;\n fill: currentcolor;\n flex-shrink: 0;\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n font-size: 1.5rem;\n color: rgb(219, 0, 40);\n cursor: pointer;\n margin-right: 20px;\n }\n\n .drawer__maximise-btn {\n display: inline-flex;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n -webkit-tap-highlight-color: transparent;\n outline: 0px;\n border: 0px;\n margin: 0px;\n cursor: pointer;\n user-select: none;\n vertical-align: middle;\n appearance: none;\n text-decoration: none;\n font-family: 'Red Hat Display', sans-serif;\n font-weight: 700;\n font-style: normal;\n font-size: 1.5rem;\n line-height: 18.52px;\n letter-spacing: 1.25px;\n text-transform: uppercase;\n min-height: 36px;\n transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,\n border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n border-radius: 50%;\n padding: 0px;\n min-width: 0px;\n z-index: 1050;\n color: rgb(255, 255, 255);\n height: 40px !important;\n width: 40px !important;\n background-color: rgb(20, 86, 224) !important;\n box-shadow: none !important;\n }\n\n ix-dialog {\n form {\n max-width: 500px;\n }\n }\n`;\n"]}
|
package/package.json
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
"description": "Webcomponent ix-drawer following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "interxion",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.28",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./dist/index.js",
|
|
12
12
|
"./ix-drawer.js": "./dist/ix-drawer.js",
|
|
13
|
+
"./ix-drawer.min.js": "./dist/ix-drawer.min.js",
|
|
13
14
|
"./IxDrawer": "./dist/react/IxDrawer.js"
|
|
14
15
|
},
|
|
15
16
|
"publishConfig": {
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
"scripts": {
|
|
19
20
|
"analyze": "cem analyze --litelement",
|
|
20
21
|
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
21
|
-
"build": "tsc && npm run analyze -- --exclude dist",
|
|
22
|
+
"build": "tsc && npm run analyze -- --exclude dist && rollup -c",
|
|
22
23
|
"prepublish": "tsc && npm run analyze -- --exclude dist",
|
|
23
24
|
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
24
25
|
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
@@ -28,10 +29,10 @@
|
|
|
28
29
|
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@digital-realty/ix-button": "^3.2.
|
|
32
|
-
"@digital-realty/ix-dialog": "^1.0.
|
|
33
|
-
"@digital-realty/ix-icon": "^1.0.
|
|
34
|
-
"@digital-realty/ix-icon-button": "^1.0.
|
|
32
|
+
"@digital-realty/ix-button": "^3.2.31",
|
|
33
|
+
"@digital-realty/ix-dialog": "^1.0.24",
|
|
34
|
+
"@digital-realty/ix-icon": "^1.0.36",
|
|
35
|
+
"@digital-realty/ix-icon-button": "^1.0.37",
|
|
35
36
|
"@lit/react": "^1.0.2",
|
|
36
37
|
"@material/web": "1.2.0",
|
|
37
38
|
"lit": "^2.0.2",
|
|
@@ -52,6 +53,9 @@
|
|
|
52
53
|
"husky": "^4.3.8",
|
|
53
54
|
"lint-staged": "^10.5.4",
|
|
54
55
|
"prettier": "^2.4.1",
|
|
56
|
+
"rollup-plugin-minify-html-literals": "^1.2.6",
|
|
57
|
+
"rollup-plugin-summary": "^2.0.0",
|
|
58
|
+
"rollup-plugin-uglify": "^6.0.4",
|
|
55
59
|
"tslib": "^2.3.1",
|
|
56
60
|
"typescript": "^4.5.2"
|
|
57
61
|
},
|
|
@@ -105,5 +109,5 @@
|
|
|
105
109
|
"README.md",
|
|
106
110
|
"LICENSE"
|
|
107
111
|
],
|
|
108
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "c7668fda980293ca038c0dd061ebe350fa88ee60"
|
|
109
113
|
}
|