@digital-realty/ix-drawer 1.2.12 → 1.3.1

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.
Files changed (2) hide show
  1. package/dist/ix-drawer.min.js +418 -1
  2. package/package.json +14 -23
@@ -1 +1,418 @@
1
- import{__decorate}from"tslib";import{css,LitElement,nothing,html}from"lit";import{classMap}from"lit/directives/class-map.js";import{state,property,query}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";let IxDrawerStyles=css`:host,:host :root,:root{--ix-drawer-animation-time:225ms}.drawer-container{z-index:1000;display:block;position:fixed;top:0;bottom:0;left:0;right:0;background-color:var(--ix-drawer-scrim-bg,rgba(0,0,0,.5));scroll-behavior:auto;overflow:auto}.drawer-container[closing]{animation:fadeOut var(--ix-drawer-animation-time,225ms) linear forwards}.drawer{display:flex;flex-direction:column;width:var(--ix-drawer-width-md,min(816px,90vw));top:0;bottom:0;right:0;position:fixed;padding:var(--ix-drawer-padding,0 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%);z-index:2}.drawer.animate-vert{transform:translateY(-100%)}.aside-hidden{display:none}: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-drawer-scrim-bg,#00000080)}}@keyframes fadeOut{0%{background-color:var(--ix-drawer-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:1200px){.drawer{width:var(--ix-drawer-width-lg,min(816px,90vw))}}@media screen and (max-width:600px){.drawer{width:min(var(--ix-drawer-width-sm,100vw),100vw);border-radius:var(--ix-drawer-border-radius,0)}}.drawer-header{display:flex;justify-content:space-between;position:fixed;left:40px;right:40px;top:0;padding-top:2rem;z-index:10}.drawer-header__close-btn{background:#fff;border-radius:50%;position:relative;z-index:9}.drawer-header__minimise-btn{flex:0}.drawer-body{overflow:auto;padding-top:32px;display:flex;flex-direction:column}.drawer.compact .drawer-body{padding-top:0}.drawer-body.no-scroll{overflow:hidden}.drawer-body.minimisable{padding-top:72px}.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}.drawer-minimised-sub-title{font-style:normal;font-weight:700;font-size:14px;line-height:24px;letter-spacing:.1px}.drawer-minimised-actions{margin-left:42px;display:flex;-webkit-box-align:center;align-items:center}.drawer-delete-dialog__title{line-height:1.25}.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}.has-header-footer .content{overflow-y:auto;padding-top:1rem;padding-bottom:1rem;height:100%}`;class IxDrawer extends LitElement{constructor(){super(...arguments),this.minimised=!1,this.openDeleteConfirmationDialog=!1,this.isVisible=!1,this.minimisedTitle="Draft",this.minimisedSubTitle="",this.minimisable=!1,this.hideAside=!1,this.showConfirmationDialogOnClose=!1,this.animateVertical=!1,this.hideClose=!1,this.scrollable=!0,this.compact=!1,this.closing=!1,this.minimising=!1,this.hasHeaderFooter=!1,this.handleOnScroll=()=>{var e;this.contentBox&&(e=new CustomEvent("on-content-scroll",{detail:{scrollTop:this.contentBox.scrollTop,scrollHeight:this.contentBox.scrollHeight,clientHeight:this.contentBox.clientHeight},bubbles:!0,composed:!0}),this.dispatchEvent(e))}}static get styles(){return[IxDrawerStyles]}disconnectedCallback(){super.disconnectedCallback(),this.resetState()}updated(e){var i;super.updated(e),e.has("isVisible")&&(this.isVisible?(e=document.body.clientWidth,document.documentElement.style.overflow="hidden",i=document.body.clientWidth,document.body.style.paddingRight=i-e+"px"):(document.documentElement.style.overflow="initial",document.body.style.paddingRight="0px"))}resetState(){this.closing=!1,this.minimising=!1,this.openDeleteConfirmationDialog=!1,this.minimised=!1}onMinimised(){this.minimising=!0,this.closing=!0,setTimeout(()=>{this.handleClosed()},300)}onMaximised(){this.minimised=!1}handleOnCancel(){this.openDeleteConfirmationDialog=!1}handleOnDelete(){this.openDeleteConfirmationDialog=!0}handleClosed(){this.closing&&(this.closing=!1,this.openDeleteConfirmationDialog=!1,this.minimising?(this.minimising=!1,this.minimised=!this.minimised):(this.minimised=!1,this.onClosed()))}clickOutsideDrawer(e){e.target.classList.contains("drawer-container")&&(!this.minimising&&this.showConfirmationDialogOnClose?this.openDeleteConfirmationDialog=!0:this.handleClosing())}handleCloseButton(){this.showConfirmationDialogOnClose?this.openDeleteConfirmationDialog=!0:this.handleClosing()}handleOnBlur(){this.handleOnCancel()}handleClosing(){this.closing=!0,setTimeout(()=>{this.handleClosed()},300)}renderCloseButton(){return this.hideClose?nothing:html`<ix-icon-button data-testid="drawer-close" @click="${this.handleCloseButton}" icon="close" aria-label="Close dialog"></ix-icon-button>`}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>`}renderDeleteConfirmationDialog(){return html`<ix-dialog .open="${this.openDeleteConfirmationDialog}" @blur="${this.handleOnBlur}"><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 data-testid="drawer-action-no" appearance="text" form="form-id" @click="${this.handleOnCancel}" aria-label="Cancel and keep the dialog open">NO</ix-button><ix-button data-testid="drawer-action-yes" appearance="text" form="form-id" @click="${this.handleClosing}" aria-label="Confirm closing and discard changes">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>`}handleHeaderFooterChange(){var e=0<((null==(e=null==(e=this.header)?void 0:e.assignedElements())?void 0:e.length)||0),i=0<((null==(i=null==(i=this.footer)?void 0:i.assignedElements())?void 0:i.length)||0);this.hasHeaderFooter=e||i}renderDrawerContainer(){var e={drawer:!0,"animate-vert":this.animateVertical,"aside-hidden":this.hideAside,compact:this.compact};return html`<div class="drawer-container" ?closing="${this.closing}" @click="${this.clickOutsideDrawer}" @keydown="${this.clickOutsideDrawer}"><aside class="${classMap(e)}" @animationend="${this.handleClosed}"><div class="drawer-header"><div class="drawer-header__minimise-btn">${this.renderMinimiseButton()}</div><div class="drawer-header__close-btn">${this.renderCloseButton()}</div></div><div class="drawer-body ${this.scrollable?"":"no-scroll"} ${this.minimisable?"minimisable":""} ${this.hasHeaderFooter?"has-header-footer":""}" @scroll="${this.handleOnScroll}" id="content-scroll-box"><div class="header"><slot name="header" @slotchange="${this.handleHeaderFooterChange}"></slot></div><div class="content"><slot name="content"></slot></div><div class="footer"><slot name="footer" @slotchange="${this.handleHeaderFooterChange}"></slot></div></div></aside></div>`}render(){return this.isVisible?html`${this.minimised?this.renderMinimisedContainer():this.renderDrawerContainer()} ${this.renderDeleteConfirmationDialog()}`:nothing}}__decorate([state()],IxDrawer.prototype,"minimised",void 0),__decorate([state()],IxDrawer.prototype,"openDeleteConfirmationDialog",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})],IxDrawer.prototype,"hideAside",void 0),__decorate([property({type:Boolean})],IxDrawer.prototype,"showConfirmationDialogOnClose",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([property({type:Boolean})],IxDrawer.prototype,"scrollable",void 0),__decorate([property({type:Boolean})],IxDrawer.prototype,"compact",void 0),__decorate([state()],IxDrawer.prototype,"closing",void 0),__decorate([state()],IxDrawer.prototype,"minimising",void 0),__decorate([state()],IxDrawer.prototype,"hasHeaderFooter",void 0),__decorate([query("#content-scroll-box")],IxDrawer.prototype,"contentBox",void 0),__decorate([query('slot[name="header"]')],IxDrawer.prototype,"header",void 0),__decorate([query('slot[name="footer"]')],IxDrawer.prototype,"footer",void 0),window.customElements.define("ix-drawer",IxDrawer);
1
+ import{__decorate as i}from"tslib";import{css as e,LitElement as t,nothing as o,html as n}from"lit";import{classMap as r}from"lit/directives/class-map.js";import{state as a,property as s,query as d}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 l=e`
2
+ :root,
3
+ :host :root,
4
+ :host {
5
+ --ix-drawer-animation-time: 225ms;
6
+ }
7
+
8
+ .drawer-container {
9
+ z-index: 1000;
10
+ display: block;
11
+ position: fixed;
12
+ top: 0;
13
+ bottom: 0;
14
+ left: 0;
15
+ right: 0;
16
+ background-color: var(--ix-drawer-scrim-bg, rgba(0, 0, 0, 0.5));
17
+ scroll-behavior: auto;
18
+ overflow: auto;
19
+ }
20
+
21
+ .drawer-container[closing] {
22
+ animation: fadeOut var(--ix-drawer-animation-time, 225ms) linear forwards;
23
+ }
24
+
25
+ .drawer {
26
+ display: flex;
27
+ flex-direction: column;
28
+ width: var(--ix-drawer-width-md, min(816px, 90vw));
29
+ top: 0;
30
+ bottom: 0;
31
+ right: 0;
32
+ position: fixed;
33
+ padding: var(--ix-drawer-padding, 0 40px);
34
+ background-color: white;
35
+ border-radius: var(--ix-drawer-border-radius, 16px 0px 0px 16px);
36
+ box-sizing: border-box;
37
+ box-shadow: 0px 12px 20px -12px rgba(0, 0, 0, 0.12),
38
+ 0px 0px 0px 1px #e1e4e8 inset;
39
+ transform: translateX(100%);
40
+ z-index: 2;
41
+ }
42
+
43
+ .drawer.animate-vert {
44
+ transform: translateY(-100%);
45
+ }
46
+
47
+ .aside-hidden {
48
+ display: none;
49
+ }
50
+
51
+ :host([isvisible]) .drawer {
52
+ animation: slideIn var(--ix-drawer-animation-time, 225ms)
53
+ cubic-bezier(0, 0, 0.2, 1) forwards;
54
+ }
55
+
56
+ :host([isvisible]) .drawer-container[closing] .drawer {
57
+ animation: slideOut var(--ix-drawer-animation-time, 225ms) 0ms
58
+ cubic-bezier(0, 0, 0.2, 1) forwards;
59
+ }
60
+
61
+ :host([isvisible]) .drawer.animate-vert {
62
+ animation: slideInVert var(--ix-drawer-animation-time, 225ms)
63
+ cubic-bezier(0, 0, 0.2, 1) forwards;
64
+ }
65
+
66
+ :host([isvisible]) .drawer-container[closing] .drawer.animate-vert {
67
+ animation: slideOutVert var(--ix-drawer-animation-time, 225ms) 0ms
68
+ cubic-bezier(0, 0, 0.2, 1) forwards;
69
+ }
70
+
71
+ @keyframes fadeIn {
72
+ 0% {
73
+ background-color: transparent;
74
+ }
75
+ 100% {
76
+ background-color: var(--ix-drawer-scrim-bg, #00000080);
77
+ }
78
+ }
79
+
80
+ @keyframes fadeOut {
81
+ 0% {
82
+ background-color: var(--ix-drawer-scrim-bg, #00000080);
83
+ }
84
+ 100% {
85
+ background-color: transparent;
86
+ }
87
+ }
88
+
89
+ @keyframes slideIn {
90
+ 100% {
91
+ transform: translateX(0);
92
+ }
93
+ }
94
+
95
+ @keyframes slideOut {
96
+ 0% {
97
+ transform: translateX(0);
98
+ }
99
+ 100% {
100
+ transform: translateX(100%);
101
+ }
102
+ }
103
+
104
+ @keyframes slideInVert {
105
+ 100% {
106
+ transform: translateY(0);
107
+ }
108
+ }
109
+
110
+ @keyframes slideOutVert {
111
+ 0% {
112
+ transform: translateY(0);
113
+ }
114
+ 100% {
115
+ transform: translateY(-100%);
116
+ }
117
+ }
118
+
119
+ @media screen and (min-width: 1200px) {
120
+ .drawer {
121
+ width: var(--ix-drawer-width-lg, min(816px, 90vw));
122
+ }
123
+ }
124
+
125
+ @media screen and (max-width: 600px) {
126
+ .drawer {
127
+ width: min(var(--ix-drawer-width-sm, 100vw), 100vw);
128
+ border-radius: var(--ix-drawer-border-radius, 0px);
129
+ }
130
+ }
131
+
132
+ .drawer-header {
133
+ display: flex;
134
+ justify-content: space-between;
135
+ position: fixed;
136
+ left: 40px;
137
+ right: 40px;
138
+ top: 0;
139
+ padding-top: 2rem;
140
+ z-index: 10;
141
+ }
142
+
143
+ .drawer-header__close-btn {
144
+ background: white;
145
+ border-radius: 50%;
146
+ position: relative;
147
+ z-index: 9;
148
+ }
149
+
150
+ .drawer-header__minimise-btn {
151
+ flex: 0;
152
+ }
153
+
154
+ .drawer-body {
155
+ overflow: auto;
156
+ padding-top: 32px;
157
+ display: flex;
158
+ flex-direction: column;
159
+ }
160
+
161
+ .drawer.compact .drawer-body {
162
+ padding-top: 0;
163
+ }
164
+
165
+ .drawer-body.no-scroll {
166
+ overflow: hidden;
167
+ }
168
+
169
+ .drawer-body.minimisable {
170
+ padding-top: 72px;
171
+ }
172
+
173
+ .drawer-minimised-container {
174
+ bottom: 24px;
175
+ position: absolute;
176
+ right: 24px;
177
+ z-index: 1200;
178
+ display: flex;
179
+ flex-direction: row;
180
+ gap: 8px;
181
+ }
182
+
183
+ .drawer-minimised-body {
184
+ background-color: rgb(255, 255, 255);
185
+ height: 72px;
186
+ display: flex;
187
+ -webkit-box-align: center;
188
+ align-items: center;
189
+ padding: 4px 24px;
190
+ box-shadow: rgba(0, 0, 0, 0.12) 0px 12px 20px -12px,
191
+ rgb(225, 228, 232) 0px 0px 0px 1px inset;
192
+ border-radius: 16px;
193
+ -webkit-box-pack: justify;
194
+ justify-content: space-between;
195
+ }
196
+
197
+ .drawer-minimised-title {
198
+ color: rgba(9, 34, 65, 0.7);
199
+ font-style: normal;
200
+ font-weight: normal;
201
+ font-size: 12px;
202
+ line-height: 16px;
203
+ letter-spacing: 0.4px;
204
+ }
205
+
206
+ .drawer-minimised-sub-title {
207
+ font-style: normal;
208
+ font-weight: bold;
209
+ font-size: 14px;
210
+ line-height: 24px;
211
+ letter-spacing: 0.1px;
212
+ }
213
+
214
+ .drawer-minimised-actions {
215
+ margin-left: 42px;
216
+ display: flex;
217
+ -webkit-box-align: center;
218
+ align-items: center;
219
+ }
220
+
221
+ .drawer-delete-dialog__title {
222
+ line-height: 1.25;
223
+ }
224
+
225
+ .drawer__delete-btn {
226
+ user-select: none;
227
+ width: 1em;
228
+ height: 1em;
229
+ display: inline-block;
230
+ fill: currentcolor;
231
+ flex-shrink: 0;
232
+ transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
233
+ font-size: 1.5rem;
234
+ color: rgb(219, 0, 40);
235
+ cursor: pointer;
236
+ margin-right: 20px;
237
+ }
238
+
239
+ .drawer__maximise-btn {
240
+ display: inline-flex;
241
+ -webkit-box-align: center;
242
+ align-items: center;
243
+ -webkit-box-pack: center;
244
+ justify-content: center;
245
+ position: relative;
246
+ box-sizing: border-box;
247
+ -webkit-tap-highlight-color: transparent;
248
+ outline: 0px;
249
+ border: 0px;
250
+ margin: 0px;
251
+ cursor: pointer;
252
+ user-select: none;
253
+ vertical-align: middle;
254
+ appearance: none;
255
+ text-decoration: none;
256
+ font-family: 'Red Hat Display', sans-serif;
257
+ font-weight: 700;
258
+ font-style: normal;
259
+ font-size: 1.5rem;
260
+ line-height: 18.52px;
261
+ letter-spacing: 1.25px;
262
+ text-transform: uppercase;
263
+ min-height: 36px;
264
+ transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
265
+ box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
266
+ border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
267
+ border-radius: 50%;
268
+ padding: 0px;
269
+ min-width: 0px;
270
+ z-index: 1050;
271
+ color: rgb(255, 255, 255);
272
+ height: 40px !important;
273
+ width: 40px !important;
274
+ background-color: rgb(20, 86, 224) !important;
275
+ box-shadow: none !important;
276
+ }
277
+
278
+ ix-dialog {
279
+ form {
280
+ max-width: 500px;
281
+ }
282
+ }
283
+
284
+ /* Notifications / compact drawer */
285
+ .drawer.compact .drawer-header {
286
+ display: flex;
287
+ justify-content: space-between;
288
+ align-items: center;
289
+ position: relative;
290
+ left: 0;
291
+ right: 0;
292
+ top: 0;
293
+ padding-top: 0;
294
+ background-color: #ffffff;
295
+ z-index: 10;
296
+ }
297
+
298
+ .has-header-footer .content {
299
+ overflow-y: auto;
300
+ padding-top: 1rem;
301
+ padding-bottom: 1rem;
302
+ height: 100%;
303
+ }
304
+ `;class c extends t{constructor(){super(...arguments),this.minimised=!1,this.openDeleteConfirmationDialog=!1,this.isVisible=!1,this.minimisedTitle="Draft",this.minimisedSubTitle="",this.minimisable=!1,this.hideAside=!1,this.showConfirmationDialogOnClose=!1,this.animateVertical=!1,this.hideClose=!1,this.scrollable=!0,this.compact=!1,this.closing=!1,this.minimising=!1,this.hasHeaderFooter=!1,this.handleOnScroll=()=>{if(this.contentBox){const i=new CustomEvent("on-content-scroll",{detail:{scrollTop:this.contentBox.scrollTop,scrollHeight:this.contentBox.scrollHeight,clientHeight:this.contentBox.clientHeight},bubbles:!0,composed:!0});this.dispatchEvent(i)}}}static get styles(){return[l]}disconnectedCallback(){super.disconnectedCallback(),this.resetState()}updated(i){if(super.updated(i),i.has("isVisible"))if(this.isVisible){const i=document.body.clientWidth;document.documentElement.style.overflow="hidden";const e=document.body.clientWidth-i;document.body.style.paddingRight=`${e}px`}else document.documentElement.style.overflow="initial",document.body.style.paddingRight="0px"}resetState(){this.closing=!1,this.minimising=!1,this.openDeleteConfirmationDialog=!1,this.minimised=!1}onMinimised(){this.minimising=!0,this.closing=!0,setTimeout(()=>{this.handleClosed()},300)}onMaximised(){this.minimised=!1}handleOnCancel(){this.openDeleteConfirmationDialog=!1}handleOnDelete(){this.openDeleteConfirmationDialog=!0}handleClosed(){if(this.closing){if(this.closing=!1,this.openDeleteConfirmationDialog=!1,this.minimising)return this.minimising=!1,void(this.minimised=!this.minimised);this.minimised=!1,this.onClosed()}}clickOutsideDrawer(i){i.target.classList.contains("drawer-container")&&(!this.minimising&&this.showConfirmationDialogOnClose?this.openDeleteConfirmationDialog=!0:this.handleClosing())}handleCloseButton(){this.showConfirmationDialogOnClose?this.openDeleteConfirmationDialog=!0:this.handleClosing()}handleOnBlur(){this.handleOnCancel()}handleClosing(){this.closing=!0,setTimeout(()=>{this.handleClosed()},300)}renderCloseButton(){return this.hideClose?o:n`<ix-icon-button
305
+ data-testid="drawer-close"
306
+ @click=${this.handleCloseButton}
307
+ icon="close"
308
+ aria-label="Close dialog"
309
+ ></ix-icon-button>`}renderMinimiseButton(){return this.minimisable?n`<ix-button
310
+ data-testid="hideButton"
311
+ appearance="text"
312
+ has-icon
313
+ @click=${this.onMinimised}
314
+ >
315
+ <ix-icon slot="icon">fullscreen_exit</ix-icon>
316
+ HIDE
317
+ </ix-button>`:o}renderMaximiseButton(){return n`<div class="drawer__maximise-btn">
318
+ <ix-icon @click=${this.onMaximised}>fullscreen</ix-icon>
319
+ </div>`}renderDeleteButton(){return n`<svg
320
+ class="drawer__delete-btn"
321
+ focusable="false"
322
+ aria-hidden="true"
323
+ viewBox="0 0 24 24"
324
+ data-testid="deleteIcon"
325
+ @click=${this.handleOnDelete}
326
+ >
327
+ <path
328
+ d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
329
+ ></path>
330
+ </svg> `}renderDeleteConfirmationDialog(){return n`
331
+ <ix-dialog
332
+ .open=${this.openDeleteConfirmationDialog}
333
+ @blur=${this.handleOnBlur}
334
+ >
335
+ <form slot="content" id="form-id" method="dialog">
336
+ <h2 class="drawer-delete-dialog__title">
337
+ Are you sure you want to proceed? All details provided will be lost.
338
+ </h2>
339
+ </form>
340
+ <div slot="actions">
341
+ <ix-button
342
+ data-testid="drawer-action-no"
343
+ appearance="text"
344
+ form="form-id"
345
+ @click=${this.handleOnCancel}
346
+ aria-label="Cancel and keep the dialog open"
347
+ >
348
+ NO
349
+ </ix-button>
350
+ <ix-button
351
+ data-testid="drawer-action-yes"
352
+ appearance="text"
353
+ form="form-id"
354
+ @click=${this.handleClosing}
355
+ aria-label="Confirm closing and discard changes"
356
+ >
357
+ YES
358
+ </ix-button>
359
+ </div>
360
+ </ix-dialog>
361
+ `}renderMinimisedContainer(){return n`<div class="drawer-minimised-container">
362
+ <div class="drawer-minimised-body">
363
+ <div>
364
+ <div class="drawer-minimised-title">${this.minimisedTitle}</div>
365
+ <div class="drawer-minimised-sub-title">
366
+ ${this.minimisedSubTitle}
367
+ </div>
368
+ </div>
369
+ <div class="drawer-minimised-actions">
370
+ ${this.renderDeleteButton()} ${this.renderMaximiseButton()}
371
+ </div>
372
+ </div>
373
+ </div>`}handleHeaderFooterChange(){var i,e,t,o;const n=((null===(e=null===(i=this.header)||void 0===i?void 0:i.assignedElements())||void 0===e?void 0:e.length)||0)>0,r=((null===(o=null===(t=this.footer)||void 0===t?void 0:t.assignedElements())||void 0===o?void 0:o.length)||0)>0;this.hasHeaderFooter=n||r}renderDrawerContainer(){const i={drawer:!0,"animate-vert":this.animateVertical,"aside-hidden":this.hideAside,compact:this.compact};return n`
374
+ <div
375
+ class="drawer-container"
376
+ ?closing=${this.closing}
377
+ @click=${this.clickOutsideDrawer}
378
+ @keydown=${this.clickOutsideDrawer}
379
+ >
380
+ <aside
381
+ class=${r(i)}
382
+ @animationend=${this.handleClosed}
383
+ >
384
+ <div class="drawer-header">
385
+ <div class="drawer-header__minimise-btn">
386
+ ${this.renderMinimiseButton()}
387
+ </div>
388
+ <div class="drawer-header__close-btn">
389
+ ${this.renderCloseButton()}
390
+ </div>
391
+ </div>
392
+ <div
393
+ class="drawer-body ${this.scrollable?"":"no-scroll"} ${this.minimisable?"minimisable":""}
394
+ ${this.hasHeaderFooter?"has-header-footer":""}
395
+ "
396
+ @scroll=${this.handleOnScroll}
397
+ id="content-scroll-box"
398
+ >
399
+ <div class="header">
400
+ <slot
401
+ name="header"
402
+ @slotchange=${this.handleHeaderFooterChange}
403
+ ></slot>
404
+ </div>
405
+ <div class="content"><slot name="content"></slot></div>
406
+ <div class="footer">
407
+ <slot
408
+ name="footer"
409
+ @slotchange=${this.handleHeaderFooterChange}
410
+ ></slot>
411
+ </div>
412
+ </div>
413
+ </aside>
414
+ </div>
415
+ `}render(){return this.isVisible?n`
416
+ ${this.minimised?this.renderMinimisedContainer():this.renderDrawerContainer()}
417
+ ${this.renderDeleteConfirmationDialog()}
418
+ `:o}}i([a()],c.prototype,"minimised",void 0),i([a()],c.prototype,"openDeleteConfirmationDialog",void 0),i([s({type:Boolean})],c.prototype,"isVisible",void 0),i([s({type:Function})],c.prototype,"onClosed",void 0),i([s({type:String})],c.prototype,"minimisedTitle",void 0),i([s({type:String})],c.prototype,"minimisedSubTitle",void 0),i([s({type:Boolean})],c.prototype,"minimisable",void 0),i([s({type:Boolean})],c.prototype,"hideAside",void 0),i([s({type:Boolean})],c.prototype,"showConfirmationDialogOnClose",void 0),i([s({type:Boolean,attribute:"animate-vertical"})],c.prototype,"animateVertical",void 0),i([s({type:Boolean,attribute:"hide-close"})],c.prototype,"hideClose",void 0),i([s({type:Boolean})],c.prototype,"scrollable",void 0),i([s({type:Boolean})],c.prototype,"compact",void 0),i([a()],c.prototype,"closing",void 0),i([a()],c.prototype,"minimising",void 0),i([a()],c.prototype,"hasHeaderFooter",void 0),i([d("#content-scroll-box")],c.prototype,"contentBox",void 0),i([d('slot[name="header"]')],c.prototype,"header",void 0),i([d('slot[name="footer"]')],c.prototype,"footer",void 0),window.customElements.define("ix-drawer",c);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ix-drawer following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "interxion",
6
- "version": "1.2.12",
6
+ "version": "1.3.1",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -21,18 +21,16 @@
21
21
  "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
22
22
  "build": "tsc && npm run analyze -- --exclude dist && rollup -c",
23
23
  "prepublish": "tsc && npm run analyze -- --exclude dist",
24
- "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
25
- "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
24
+ "lint": "eslint --ext .ts,.html . && prettier \"**/*.ts\" --check --ignore-path .gitignore",
25
+ "format": "eslint --ext .ts,.html . --fix && prettier \"**/*.ts\" --write --ignore-path .gitignore",
26
26
  "test": "tsc && wtr --coverage",
27
- "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
28
- "storybook": "tsc && npm run analyze -- --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds -c .storybook/server.mjs\"",
29
- "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
27
+ "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
30
28
  },
31
29
  "dependencies": {
32
- "@digital-realty/ix-button": "^3.4.8",
33
- "@digital-realty/ix-dialog": "^1.2.12",
34
- "@digital-realty/ix-icon": "^1.2.4",
35
- "@digital-realty/ix-icon-button": "^1.2.7",
30
+ "@digital-realty/ix-button": "^3.5.1",
31
+ "@digital-realty/ix-dialog": "^1.3.1",
32
+ "@digital-realty/ix-icon": "^1.3.1",
33
+ "@digital-realty/ix-icon-button": "^1.3.1",
36
34
  "@lit/react": "^1.0.2",
37
35
  "@material/web": "2.4.0",
38
36
  "lit": "^3.2.1",
@@ -40,33 +38,26 @@
40
38
  },
41
39
  "devDependencies": {
42
40
  "@custom-elements-manifest/analyzer": "^0.4.17",
43
- "@open-wc/eslint-config": "^9.2.1",
44
41
  "@open-wc/testing": "^3.1.6",
45
- "@typescript-eslint/eslint-plugin": "^5.48.0",
46
- "@typescript-eslint/parser": "^5.48.0",
42
+ "@rollup/plugin-terser": "^1.0.0",
43
+ "@typescript-eslint/eslint-plugin": "^8.58.2",
44
+ "@typescript-eslint/parser": "^8.58.2",
47
45
  "@web/dev-server": "^0.4.6",
48
- "@web/dev-server-storybook": "^2.0.3",
49
46
  "@web/test-runner": "^0.20.2",
50
- "concurrently": "^9.1.0",
51
- "eslint": "^8.31.0",
47
+ "concurrently": "^9.2.1",
48
+ "eslint": "^9.39.4",
52
49
  "eslint-config-prettier": "^8.3.0",
53
50
  "husky": "^4.3.8",
54
51
  "lint-staged": "^10.5.4",
55
52
  "prettier": "^2.4.1",
56
53
  "rollup": "^4.29.1",
57
- "rollup-plugin-minify-html-literals": "^1.2.6",
58
54
  "rollup-plugin-summary": "^2.0.0",
59
- "rollup-plugin-uglify": "^6.0.4",
60
55
  "tslib": "^2.3.1",
61
56
  "typescript": "^4.5.2"
62
57
  },
63
58
  "customElements": "custom-elements.json",
64
59
  "eslintConfig": {
65
60
  "parser": "@typescript-eslint/parser",
66
- "extends": [
67
- "@open-wc",
68
- "prettier"
69
- ],
70
61
  "plugins": [
71
62
  "@typescript-eslint"
72
63
  ],
@@ -110,5 +101,5 @@
110
101
  "README.md",
111
102
  "LICENSE"
112
103
  ],
113
- "gitHead": "4cd8803f4c5f3b3833ae6ebb5791f73a057863f8"
104
+ "gitHead": "da06737d6707fd3d4ef898ba0fa632e7b3ed8019"
114
105
  }