@digital-realty/ix-drawer 1.0.23 → 1.0.25

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,9 +12,15 @@ export declare class IxDrawer extends LitElement {
12
12
  minimisedTitle: string;
13
13
  minimisedSubTitle: string;
14
14
  minimisable: boolean;
15
+ closing: boolean;
16
+ minimising: boolean;
15
17
  onMinimised(): void;
18
+ onMaximised(): void;
16
19
  handleOnCancel(): void;
17
20
  handleOnDelete(): void;
21
+ handleClosed(): void;
22
+ clickOutsideDrawer(event: MouseEvent): void;
23
+ handleClosing(): void;
18
24
  renderMinimiseButton(): import("lit").TemplateResult<1> | typeof nothing;
19
25
  renderMaximiseButton(): import("lit").TemplateResult<1>;
20
26
  renderDeleteButton(): import("lit").TemplateResult<1>;
package/dist/IxDrawer.js CHANGED
@@ -15,12 +15,21 @@ export class IxDrawer extends LitElement {
15
15
  this.minimisedTitle = 'Draft';
16
16
  this.minimisedSubTitle = '';
17
17
  this.minimisable = false;
18
+ this.closing = false;
19
+ this.minimising = false;
18
20
  }
19
21
  static get styles() {
20
22
  return [IxDrawerStyles];
21
23
  }
22
24
  onMinimised() {
23
- this.minimised = !this.minimised;
25
+ this.minimising = true;
26
+ this.closing = true;
27
+ setTimeout(() => {
28
+ this.handleClosed();
29
+ }, 300);
30
+ }
31
+ onMaximised() {
32
+ this.minimised = false;
24
33
  }
25
34
  handleOnCancel() {
26
35
  this.showDeleteConfirmationDialog = false;
@@ -28,6 +37,31 @@ export class IxDrawer extends LitElement {
28
37
  handleOnDelete() {
29
38
  this.showDeleteConfirmationDialog = true;
30
39
  }
40
+ handleClosed() {
41
+ if (this.closing) {
42
+ this.closing = false;
43
+ if (this.minimising) {
44
+ this.minimising = false;
45
+ this.minimised = !this.minimised;
46
+ return;
47
+ }
48
+ this.onClosed();
49
+ }
50
+ }
51
+ clickOutsideDrawer(event) {
52
+ const el = event.target;
53
+ if (el.classList.contains('drawer-container')) {
54
+ this.handleClosing();
55
+ }
56
+ }
57
+ handleClosing() {
58
+ this.closing = true;
59
+ // Backup timeout to complete closing
60
+ // if animation end event has not fired
61
+ setTimeout(() => {
62
+ this.handleClosed();
63
+ }, 300);
64
+ }
31
65
  renderMinimiseButton() {
32
66
  if (this.minimisable)
33
67
  return html `<ix-button
@@ -43,7 +77,7 @@ export class IxDrawer extends LitElement {
43
77
  }
44
78
  renderMaximiseButton() {
45
79
  return html `<div class="drawer__maximise-btn">
46
- <ix-icon @click=${this.onMinimised}>fullscreen</ix-icon>
80
+ <ix-icon @click=${this.onMaximised}>fullscreen</ix-icon>
47
81
  </div>`;
48
82
  }
49
83
  renderDeleteButton() {
@@ -76,7 +110,10 @@ export class IxDrawer extends LitElement {
76
110
  @click=${this.handleOnCancel}
77
111
  >NO</ix-button
78
112
  >
79
- <ix-button appearance="text" form="form-id" @click=${this.onClosed}
113
+ <ix-button
114
+ appearance="text"
115
+ form="form-id"
116
+ @click=${this.handleClosing}
80
117
  >YES</ix-button
81
118
  >
82
119
  </div>
@@ -100,8 +137,13 @@ export class IxDrawer extends LitElement {
100
137
  }
101
138
  renderDrawerContainer() {
102
139
  return html `
103
- <div class="drawer-container">
104
- <aside class="drawer">
140
+ <div
141
+ class="drawer-container"
142
+ ?closing=${this.closing}
143
+ @click=${this.clickOutsideDrawer}
144
+ @keydown=${this.clickOutsideDrawer}
145
+ >
146
+ <aside class="drawer" @animationend=${this.handleClosed}>
105
147
  <div class="drawer-header">
106
148
  <div class="drawer-header__minimise-btn">
107
149
  ${this.renderMinimiseButton()}
@@ -109,7 +151,7 @@ export class IxDrawer extends LitElement {
109
151
  <slot name="header"></slot>
110
152
  <div class="drawer-header__close-btn">
111
153
  <ix-icon-button
112
- @click=${this.onClosed}
154
+ @click=${this.handleClosing}
113
155
  icon="close"
114
156
  ></ix-icon-button>
115
157
  </div>
@@ -151,4 +193,10 @@ __decorate([
151
193
  __decorate([
152
194
  property({ type: Boolean })
153
195
  ], IxDrawer.prototype, "minimisable", void 0);
196
+ __decorate([
197
+ state()
198
+ ], IxDrawer.prototype, "closing", void 0);
199
+ __decorate([
200
+ state()
201
+ ], IxDrawer.prototype, "minimising", void 0);
154
202
  //# sourceMappingURL=IxDrawer.js.map
@@ -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;IA2HnD,CAAC;IA3IC,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC;IAgBD,WAAW;QACT,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;IACnC,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,4BAA4B,GAAG,KAAK,CAAC;IAC5C,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC;IAC3C,CAAC;IAED,oBAAoB;QAClB,IAAI,IAAI,CAAC,WAAW;YAClB,OAAO,IAAI,CAAA;;;;iBAIA,IAAI,CAAC,WAAW;;;;mBAId,CAAC;QAEhB,OAAO,OAAO,CAAC;IACjB,CAAC;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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAwB;AAEtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAqB","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 onMinimised() {\n this.minimised = !this.minimised;\n }\n\n handleOnCancel() {\n this.showDeleteConfirmationDialog = false;\n }\n\n handleOnDelete() {\n this.showDeleteConfirmationDialog = true;\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.onMinimised}>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 appearance=\"text\" form=\"form-id\" @click=${this.onClosed}\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 class=\"drawer-container\">\n <aside class=\"drawer\">\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.onClosed}\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,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AAO;iBACd,IAAI,CAAC,kBAAkB;mBACrB,IAAI,CAAC,kBAAkB;;8CAEI,IAAI,CAAC,YAAY;;;gBAG/C,IAAI,CAAC,oBAAoB,EAAE;;;;;yBAKlB,IAAI,CAAC,aAAa;;;;;;;;;;KAUtC,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;AAvLU;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;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"]}
@@ -5,12 +5,13 @@ export const IxDrawerStyles = css `
5
5
  :host {
6
6
  font-size: var(--ix-drawer-font-size, 0.875rem);
7
7
  line-height: var(--ix-drawer-line-height, 1.25rem);
8
+ --ix-drawer-animation-time: 225ms;
8
9
  }
9
10
 
10
11
  .drawer-container {
11
12
  z-index: 1;
12
13
  display: block;
13
- position: absolute;
14
+ position: fixed;
14
15
  width: 100%;
15
16
  height: 100%;
16
17
  top: 0;
@@ -18,6 +19,11 @@ export const IxDrawerStyles = css `
18
19
  background-color: var(--ix-draw-scrim-bg, #00000080);
19
20
  scroll-behavior: auto;
20
21
  overflow: auto;
22
+ animation: fadeIn var(--ix-drawer-animation-time, 225ms) linear forwards;
23
+ }
24
+
25
+ .drawer-container[closing] {
26
+ animation: fadeOut var(--ix-drawer-animation-time, 225ms) linear forwards;
21
27
  }
22
28
 
23
29
  .drawer {
@@ -30,6 +36,50 @@ export const IxDrawerStyles = css `
30
36
  box-sizing: border-box;
31
37
  box-shadow: 0px 12px 20px -12px rgba(0, 0, 0, 0.12),
32
38
  0px 0px 0px 1px #e1e4e8 inset;
39
+ transform: translateX(100%);
40
+ }
41
+
42
+ :host([isvisible]) .drawer {
43
+ animation: slideIn var(--ix-drawer-animation-time, 225ms)
44
+ cubic-bezier(0, 0, 0.2, 1) forwards;
45
+ }
46
+
47
+ :host([isvisible]) .drawer-container[closing] .drawer {
48
+ animation: slideOut var(--ix-drawer-animation-time, 225ms) 0ms
49
+ cubic-bezier(0, 0, 0.2, 1) forwards;
50
+ }
51
+
52
+ @keyframes fadeIn {
53
+ 0% {
54
+ background-color: transparent;
55
+ }
56
+ 100% {
57
+ background-color: var(--ix-draw-scrim-bg, #00000080);
58
+ }
59
+ }
60
+
61
+ @keyframes fadeOut {
62
+ 0% {
63
+ background-color: var(--ix-draw-scrim-bg, #00000080);
64
+ }
65
+ 100% {
66
+ background-color: transparent;
67
+ }
68
+ }
69
+
70
+ @keyframes slideIn {
71
+ 100% {
72
+ transform: translateX(0);
73
+ }
74
+ }
75
+
76
+ @keyframes slideOut {
77
+ 0% {
78
+ transform: translateX(0);
79
+ }
80
+ 100% {
81
+ transform: translateX(100%);
82
+ }
33
83
  }
34
84
 
35
85
  @media screen and (min-width: 1024px) {
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgLhC,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 }\n\n .drawer-container {\n z-index: 1;\n display: block;\n position: absolute;\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 }\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 }\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"]}
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.23",
6
+ "version": "1.0.25",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
29
29
  },
30
30
  "dependencies": {
31
- "@digital-realty/ix-button": "^3.2.29",
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
34
  "@digital-realty/ix-icon-button": "^1.0.35",
@@ -105,5 +105,5 @@
105
105
  "README.md",
106
106
  "LICENSE"
107
107
  ],
108
- "gitHead": "dced04ebef5c8342344b1fd3df33b5e22a78725f"
108
+ "gitHead": "e21beb0a9ade15ab27c4896bf4dc2ba54ff7ceb7"
109
109
  }