@digital-realty/ix-drawer 1.0.25 → 1.0.27

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.
@@ -12,6 +12,8 @@ export declare class IxDrawer extends LitElement {
12
12
  minimisedTitle: string;
13
13
  minimisedSubTitle: string;
14
14
  minimisable: boolean;
15
+ animateVertical: boolean;
16
+ hideClose: boolean;
15
17
  closing: boolean;
16
18
  minimising: boolean;
17
19
  onMinimised(): void;
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 class="drawer" @animationend=${this.handleClosed}>
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
- <div class="drawer-header__close-btn">
153
- <ix-icon-button
154
- @click=${this.handleClosing}
155
- icon="close"
156
- ></ix-icon-button>
157
- </div>
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);
@@ -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,OAAO,QAAS,SAAQ,UAAU;IAAxC;;QAKqB,cAAS,GAAG,KAAK,CAAC;QAElB,iCAA4B,GAAG,KAAK,CAAC;QAE3B,cAAS,GAAG,KAAK,CAAC;QAInB,mBAAc,GAAG,OAAO,CAAC;QAEzB,sBAAiB,GAAG,EAAE,CAAC;QAEtB,gBAAW,GAAG,KAAK,CAAC;QAExC,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,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3B;IAA5B,QAAQ,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;AAExC;IAAR,KAAK,EAAE;yCAAiB;AAEhB;IAAR,KAAK,EAAE;4CAAoB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\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 @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 return html`\n <div\n class=\"drawer-container\"\n ?closing=${this.closing}\n @click=${this.clickOutsideDrawer}\n @keydown=${this.clickOutsideDrawer}\n >\n <aside class=\"drawer\" @animationend=${this.handleClosed}>\n <div class=\"drawer-header\">\n <div class=\"drawer-header__minimise-btn\">\n ${this.renderMinimiseButton()}\n </div>\n <slot name=\"header\"></slot>\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 </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"]}
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,MAAM,6BAA6B,CAAC;AACvD,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,OAAO,QAAS,SAAQ,UAAU;IAAxC;;QAKqB,cAAS,GAAG,KAAK,CAAC;QAElB,iCAA4B,GAAG,KAAK,CAAC;QAE3B,cAAS,GAAG,KAAK,CAAC;QAInB,mBAAc,GAAG,OAAO,CAAC;QAEzB,sBAAiB,GAAG,EAAE,CA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;;;+BAGW,IAAI,CAAC,aAAa;;;;iBAIhC;;;;;;;KAOZ,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAE3D,OAAO,IAAI,CAAC,qBAAqB,EAAE,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAxMU;IAAR,KAAK,EAAE;2CAA6B;AAE5B;IAAR,KAAK,EAAE;8DAAgD;AAE3B;IAA5B,QAAQ,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"]}
@@ -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: 90%;
31
- height: 100%;
32
- float: right;
33
- padding: 32px 0 46px 40px;
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: 45%;
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
- padding-right: 40px;
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkOhC,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 width: 100%;\n height: 100%;\n top: 0;\n left: 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: 90%;\n height: 100%;\n float: right;\n padding: 32px 0 46px 40px;\n background-color: white;\n 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 }\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 @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 @media screen and (min-width: 1024px) {\n .drawer {\n width: 45%;\n }\n }\n\n .drawer-header {\n padding-right: 40px;\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 height: 95%;\n overflow: auto;\n padding-right: 40px;\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"]}
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,7 +3,7 @@
3
3
  "description": "Webcomponent ix-drawer following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "interxion",
6
- "version": "1.0.25",
6
+ "version": "1.0.27",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "@digital-realty/ix-button": "^3.2.30",
32
32
  "@digital-realty/ix-dialog": "^1.0.23",
33
33
  "@digital-realty/ix-icon": "^1.0.35",
34
- "@digital-realty/ix-icon-button": "^1.0.35",
34
+ "@digital-realty/ix-icon-button": "^1.0.36",
35
35
  "@lit/react": "^1.0.2",
36
36
  "@material/web": "1.2.0",
37
37
  "lit": "^2.0.2",
@@ -105,5 +105,5 @@
105
105
  "README.md",
106
106
  "LICENSE"
107
107
  ],
108
- "gitHead": "e21beb0a9ade15ab27c4896bf4dc2ba54ff7ceb7"
108
+ "gitHead": "57b88cc0ca98069100359155373d7150added1b0"
109
109
  }