@digital-realty/ix-drawer 1.0.10 → 1.0.24

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.
@@ -1,6 +1,7 @@
1
1
  import { LitElement, nothing } from 'lit';
2
2
  import '@digital-realty/ix-button/ix-button.js';
3
3
  import '@digital-realty/ix-icon/ix-icon.js';
4
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
4
5
  import '@digital-realty/ix-dialog/ix-dialog.js';
5
6
  export declare class IxDrawer extends LitElement {
6
7
  static get styles(): import("lit").CSSResult[];
@@ -11,9 +12,15 @@ export declare class IxDrawer extends LitElement {
11
12
  minimisedTitle: string;
12
13
  minimisedSubTitle: string;
13
14
  minimisable: boolean;
15
+ closing: boolean;
16
+ minimising: boolean;
14
17
  onMinimised(): void;
18
+ onMaximised(): void;
15
19
  handleOnCancel(): void;
16
20
  handleOnDelete(): void;
21
+ handleClosed(): void;
22
+ clickOutsideDrawer(event: MouseEvent): void;
23
+ handleClosing(): void;
17
24
  renderMinimiseButton(): import("lit").TemplateResult<1> | typeof nothing;
18
25
  renderMaximiseButton(): import("lit").TemplateResult<1>;
19
26
  renderDeleteButton(): import("lit").TemplateResult<1>;
package/dist/IxDrawer.js CHANGED
@@ -4,6 +4,7 @@ import { property, state } from 'lit/decorators.js';
4
4
  import { IxDrawerStyles } from './styles/ix-drawer-styles.js';
5
5
  import '@digital-realty/ix-button/ix-button.js';
6
6
  import '@digital-realty/ix-icon/ix-icon.js';
7
+ import '@digital-realty/ix-icon-button/ix-icon-button.js';
7
8
  import '@digital-realty/ix-dialog/ix-dialog.js';
8
9
  export class IxDrawer extends LitElement {
9
10
  constructor() {
@@ -14,12 +15,21 @@ export class IxDrawer extends LitElement {
14
15
  this.minimisedTitle = 'Draft';
15
16
  this.minimisedSubTitle = '';
16
17
  this.minimisable = false;
18
+ this.closing = false;
19
+ this.minimising = false;
17
20
  }
18
21
  static get styles() {
19
22
  return [IxDrawerStyles];
20
23
  }
21
24
  onMinimised() {
22
- 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;
23
33
  }
24
34
  handleOnCancel() {
25
35
  this.showDeleteConfirmationDialog = false;
@@ -27,6 +37,31 @@ export class IxDrawer extends LitElement {
27
37
  handleOnDelete() {
28
38
  this.showDeleteConfirmationDialog = true;
29
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
+ }
30
65
  renderMinimiseButton() {
31
66
  if (this.minimisable)
32
67
  return html `<ix-button
@@ -42,7 +77,7 @@ export class IxDrawer extends LitElement {
42
77
  }
43
78
  renderMaximiseButton() {
44
79
  return html `<div class="drawer__maximise-btn">
45
- <ix-icon @click=${this.onMinimised}>fullscreen</ix-icon>
80
+ <ix-icon @click=${this.onMaximised}>fullscreen</ix-icon>
46
81
  </div>`;
47
82
  }
48
83
  renderDeleteButton() {
@@ -75,7 +110,10 @@ export class IxDrawer extends LitElement {
75
110
  @click=${this.handleOnCancel}
76
111
  >NO</ix-button
77
112
  >
78
- <ix-button appearance="text" form="form-id" @click=${this.onClosed}
113
+ <ix-button
114
+ appearance="text"
115
+ form="form-id"
116
+ @click=${this.handleClosing}
79
117
  >YES</ix-button
80
118
  >
81
119
  </div>
@@ -99,17 +137,23 @@ export class IxDrawer extends LitElement {
99
137
  }
100
138
  renderDrawerContainer() {
101
139
  return html `
102
- <div class="drawer-container">
103
- <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}>
104
147
  <div class="drawer-header">
105
148
  <div class="drawer-header__minimise-btn">
106
149
  ${this.renderMinimiseButton()}
107
150
  </div>
108
151
  <slot name="header"></slot>
109
152
  <div class="drawer-header__close-btn">
110
- <div class="drawer-header__close-btn-hover-layer">
111
- <ix-icon @click=${this.onClosed}>Close</ix-icon>
112
- </div>
153
+ <ix-icon-button
154
+ @click=${this.handleClosing}
155
+ icon="close"
156
+ ></ix-icon-button>
113
157
  </div>
114
158
  </div>
115
159
  <div class="drawer-body">
@@ -149,4 +193,10 @@ __decorate([
149
193
  __decorate([
150
194
  property({ type: Boolean })
151
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);
152
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,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,G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1C,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;AAtIU;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","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-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 <div class=\"drawer-header__close-btn-hover-layer\">\n <ix-icon @click=${this.onClosed}>Close</ix-icon>\n </div>\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,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,GAAG,KAAK,CAAC;IAuK9B,CAAC;IA3LC,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC;IAoBD,WAAW;QACT,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,UAAU,CAAC,GAAG,EAAE;YACd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AAC,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,58 +1,116 @@
1
1
  import { css } from 'lit';
2
2
  export const IxDrawerStyles = css `
3
+ :root,
4
+ :host :root,
5
+ :host {
6
+ font-size: var(--ix-drawer-font-size, 0.875rem);
7
+ line-height: var(--ix-drawer-line-height, 1.25rem);
8
+ --ix-drawer-animation-time: 225ms;
9
+ }
10
+
3
11
  .drawer-container {
4
12
  z-index: 1;
5
13
  display: block;
6
- position: absolute;
14
+ position: fixed;
7
15
  width: 100%;
8
16
  height: 100%;
9
17
  top: 0;
10
18
  left: 0;
11
- background-color: rgba(0, 0, 0, 0.2);
19
+ background-color: var(--ix-draw-scrim-bg, #00000080);
12
20
  scroll-behavior: auto;
13
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;
14
27
  }
15
28
 
16
29
  .drawer {
17
30
  width: 90%;
18
31
  height: 100%;
19
32
  float: right;
20
- padding: 32px 40px 40px;
33
+ padding: 32px 0 46px 40px;
21
34
  background-color: white;
22
- border-radius: 20px 0px 0px 20px;
35
+ border-radius: 16px 0px 0px 16px;
23
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
+ }
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
+ }
24
83
  }
84
+
25
85
  @media screen and (min-width: 1024px) {
26
86
  .drawer {
27
87
  width: 45%;
28
88
  }
29
89
  }
90
+
30
91
  .drawer-header {
92
+ padding-right: 40px;
31
93
  display: flex;
32
94
  justify-content: space-between;
33
95
  align-items: center;
34
96
  }
35
- .drawer-header__minimise-btn {
36
- flex: 0;
37
- }
97
+
38
98
  .drawer-header__close-btn {
39
- cursor: pointer;
40
- flex: 1;
41
- }
42
- .drawer-header__close-btn-hover-layer {
43
- width: 24px;
44
- height: 24px;
45
- border-radius: 9999px;
46
- float: right;
99
+ margin-bottom: -16px;
100
+ background: white;
101
+ border-radius: 50%;
102
+ position: relative;
103
+ z-index: 9;
47
104
  }
48
- .drawer-header__close-btn-hover-layer:hover {
49
- transition: 0.15s;
50
- background-color: lightgrey;
105
+
106
+ .drawer-header__minimise-btn {
107
+ flex: 0;
51
108
  }
52
109
 
53
110
  .drawer-body {
54
111
  height: 95%;
55
112
  overflow: auto;
113
+ padding-right: 40px;
56
114
  }
57
115
 
58
116
  .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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwKhC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxDrawerStyles = css`\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: rgba(0, 0, 0, 0.2);\n scroll-behavior: auto;\n overflow: auto;\n }\n\n .drawer {\n width: 90%;\n height: 100%;\n float: right;\n padding: 32px 40px 40px;\n background-color: white;\n border-radius: 20px 0px 0px 20px;\n box-sizing: border-box;\n }\n @media screen and (min-width: 1024px) {\n .drawer {\n width: 45%;\n }\n }\n .drawer-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .drawer-header__minimise-btn {\n flex: 0;\n }\n .drawer-header__close-btn {\n cursor: pointer;\n flex: 1;\n }\n .drawer-header__close-btn-hover-layer {\n width: 24px;\n height: 24px;\n border-radius: 9999px;\n float: right;\n }\n .drawer-header__close-btn-hover-layer:hover {\n transition: 0.15s;\n background-color: lightgrey;\n }\n\n .drawer-body {\n height: 95%;\n overflow: auto;\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.10",
6
+ "version": "1.0.24",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -28,9 +28,10 @@
28
28
  "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
29
29
  },
30
30
  "dependencies": {
31
- "@digital-realty/ix-button": "^3.2.15",
32
- "@digital-realty/ix-dialog": "^1.0.10",
33
- "@digital-realty/ix-icon": "^1.0.4",
31
+ "@digital-realty/ix-button": "^3.2.29",
32
+ "@digital-realty/ix-dialog": "^1.0.23",
33
+ "@digital-realty/ix-icon": "^1.0.35",
34
+ "@digital-realty/ix-icon-button": "^1.0.35",
34
35
  "@lit/react": "^1.0.2",
35
36
  "@material/web": "1.2.0",
36
37
  "lit": "^2.0.2",
@@ -104,5 +105,5 @@
104
105
  "README.md",
105
106
  "LICENSE"
106
107
  ],
107
- "gitHead": "43b0e609ef85f29e50a1872181cb8e685bcc13ec"
108
+ "gitHead": "0860f07eace975fd8512a4a774d98227d3caddd7"
108
109
  }