@aquera/nile-elements 1.9.10 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/demo/nxtgen-dark.css +2265 -0
- package/dist/{index-6832c52b.cjs.js → index-3ca67627.cjs.js} +2 -2
- package/dist/{index-6832c52b.cjs.js.map → index-3ca67627.cjs.js.map} +1 -1
- package/dist/{index-f956f56d.cjs.js → index-403841c7.cjs.js} +2 -2
- package/dist/{index-f956f56d.cjs.js.map → index-403841c7.cjs.js.map} +1 -1
- package/dist/{index-a487d8b4.esm.js → index-802939a8.esm.js} +1 -1
- package/dist/{index-50880eb7.cjs.js → index-c3210a9c.cjs.js} +2 -2
- package/dist/{index-50880eb7.cjs.js.map → index-c3210a9c.cjs.js.map} +1 -1
- package/dist/index-ccff99d6.esm.js +1 -0
- package/dist/{index-747d1880.cjs.js → index-d37d33cb.cjs.js} +2 -2
- package/dist/index-d37d33cb.cjs.js.map +1 -0
- package/dist/index-e43755f5.cjs.js +2 -0
- package/dist/index-e43755f5.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +418 -352
- package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.esm.js +1 -1
- package/dist/nile-calendar/nile-calendar.esm.js +10 -10
- package/dist/nile-carousel/nile-carousel.cjs.js +1 -1
- package/dist/nile-carousel/nile-carousel.cjs.js.map +1 -1
- package/dist/nile-carousel/nile-carousel.esm.js +2 -0
- package/dist/nile-code-editor/extensionSetup.cjs.js +7 -7
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/index.cjs.js +1 -1
- package/dist/nile-code-editor/index.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.esm.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js.map +1 -1
- package/dist/nile-code-editor/theme.esm.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.css.cjs.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.css.cjs.js.map +1 -1
- package/dist/nile-color-picker/nile-color-picker.css.esm.js +1 -1
- package/dist/nile-combobox/index.cjs.js +1 -1
- package/dist/nile-combobox/index.esm.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.esm.js +1 -1
- package/dist/nile-context-menu/index.cjs.js +1 -1
- package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
- package/dist/nile-context-submenu/index.cjs.js +1 -1
- package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
- package/dist/nile-detail/index.cjs.js +1 -1
- package/dist/nile-detail/index.esm.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.esm.js +1 -1
- package/dist/nile-drawer/nile-drawer.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.cjs.js.map +1 -1
- package/dist/nile-drawer/nile-drawer.css.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.css.cjs.js.map +1 -1
- package/dist/nile-drawer/nile-drawer.css.esm.js +56 -1
- package/dist/nile-drawer/nile-drawer.esm.js +7 -7
- package/dist/nile-error-message/nile-error-message.css.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.css.cjs.js.map +1 -1
- package/dist/nile-error-message/nile-error-message.css.esm.js +4 -3
- package/dist/nile-error-notification/nile-error-notification.css.cjs.js +1 -1
- package/dist/nile-error-notification/nile-error-notification.css.cjs.js.map +1 -1
- package/dist/nile-error-notification/nile-error-notification.css.esm.js +1 -1
- package/dist/nile-floating-panel/index.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.esm.js +1 -0
- package/dist/nile-lite-tooltip/index.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.css.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.css.cjs.js.map +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.css.esm.js +1 -1
- package/dist/nile-popup/nile-popup.css.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.css.cjs.js.map +1 -1
- package/dist/nile-popup/nile-popup.css.esm.js +5 -4
- package/dist/nile-tooltip/nile-tooltip.css.cjs.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.cjs.js.map +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.esm.js +7 -1
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.js +4 -4
- package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/dist/src/nile-carousel/nile-carousel.js +2 -0
- package/dist/src/nile-carousel/nile-carousel.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.css.js +2 -2
- package/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.js +4 -3
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-code-editor/theme.d.ts +118 -2
- package/dist/src/nile-code-editor/theme.js +169 -19
- package/dist/src/nile-code-editor/theme.js.map +1 -1
- package/dist/src/nile-color-picker/nile-color-picker.css.js +12 -12
- package/dist/src/nile-color-picker/nile-color-picker.css.js.map +1 -1
- package/dist/src/nile-drawer/nile-drawer.css.js +56 -1
- package/dist/src/nile-drawer/nile-drawer.css.js.map +1 -1
- package/dist/src/nile-drawer/nile-drawer.d.ts +4 -0
- package/dist/src/nile-drawer/nile-drawer.js +84 -39
- package/dist/src/nile-drawer/nile-drawer.js.map +1 -1
- package/dist/src/nile-drawer/nile-drawer.test.js +71 -0
- package/dist/src/nile-drawer/nile-drawer.test.js.map +1 -1
- package/dist/src/nile-error-message/nile-error-message.css.js +2 -1
- package/dist/src/nile-error-message/nile-error-message.css.js.map +1 -1
- package/dist/src/nile-error-notification/nile-error-notification.css.js +1 -1
- package/dist/src/nile-error-notification/nile-error-notification.css.js.map +1 -1
- package/dist/src/nile-hero/nile-hero.css.js +1 -0
- package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
- package/dist/src/nile-lite-tooltip/nile-lite-tooltip.css.js +1 -1
- package/dist/src/nile-lite-tooltip/nile-lite-tooltip.css.js.map +1 -1
- package/dist/src/nile-popup/nile-popup.css.js +3 -2
- package/dist/src/nile-popup/nile-popup.css.js.map +1 -1
- package/dist/src/nile-tooltip/nile-tooltip.css.js +7 -1
- package/dist/src/nile-tooltip/nile-tooltip.css.js.map +1 -1
- package/dist/src/version.js +2 -2
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-calendar/nile-calendar.css.ts +1 -1
- package/src/nile-calendar/nile-calendar.ts +4 -4
- package/src/nile-carousel/nile-carousel.ts +2 -0
- package/src/nile-code-editor/nile-code-editor.css.ts +2 -2
- package/src/nile-code-editor/nile-code-editor.ts +3 -3
- package/src/nile-code-editor/theme.ts +172 -19
- package/src/nile-color-picker/nile-color-picker.css.ts +12 -12
- package/src/nile-drawer/nile-drawer.css.ts +56 -1
- package/src/nile-drawer/nile-drawer.test.ts +73 -0
- package/src/nile-drawer/nile-drawer.ts +59 -12
- package/src/nile-error-message/nile-error-message.css.ts +2 -1
- package/src/nile-error-notification/nile-error-notification.css.ts +1 -1
- package/src/nile-hero/nile-hero.css.ts +1 -0
- package/src/nile-lite-tooltip/nile-lite-tooltip.css.ts +1 -1
- package/src/nile-popup/nile-popup.css.ts +3 -2
- package/src/nile-tooltip/nile-tooltip.css.ts +7 -1
- package/vscode-html-custom-data.json +11 -1
- package/dist/index-747d1880.cjs.js.map +0 -1
|
@@ -11,7 +11,7 @@ import { css } from 'lit';
|
|
|
11
11
|
export const styles = css `
|
|
12
12
|
:host {
|
|
13
13
|
box-sizing: border-box;
|
|
14
|
-
--nile-drawer-remove-icon-color:var(--nile-colors-dark-900, var(--ng-
|
|
14
|
+
--nile-drawer-remove-icon-color:var(--nile-colors-dark-900, var(--ng-colors-fg-secondary-700));
|
|
15
15
|
-webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
|
|
16
16
|
-moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));
|
|
17
17
|
text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));
|
|
@@ -55,6 +55,56 @@ export const styles = css `
|
|
|
55
55
|
z-index: 700;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
.drawer--push {
|
|
59
|
+
position: relative;
|
|
60
|
+
z-index: initial;
|
|
61
|
+
}
|
|
62
|
+
:host([push]) {
|
|
63
|
+
display: block;
|
|
64
|
+
flex: 0 0 auto;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
transition: inline-size var(--push-duration, 250ms) var(--push-easing, ease),
|
|
67
|
+
block-size var(--push-duration, 250ms) var(--push-easing, ease);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host([push][placement='start']),
|
|
71
|
+
:host([push][placement='end']) {
|
|
72
|
+
inline-size: 0;
|
|
73
|
+
max-inline-size: 100%;
|
|
74
|
+
align-self: stretch;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:host([push][placement='top']),
|
|
78
|
+
:host([push][placement='bottom']) {
|
|
79
|
+
block-size: 0;
|
|
80
|
+
max-block-size: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([push][open][placement='start']),
|
|
84
|
+
:host([push][open][placement='end']) {
|
|
85
|
+
inline-size: var(--size);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([push][open][placement='top']),
|
|
89
|
+
:host([push][open][placement='bottom']) {
|
|
90
|
+
block-size: var(--size);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@media (prefers-reduced-motion: reduce) {
|
|
94
|
+
:host([push]) {
|
|
95
|
+
transition: none;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.drawer--push .drawer__overlay {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.drawer--push .drawer__panel {
|
|
104
|
+
max-inline-size: none;
|
|
105
|
+
max-block-size: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
58
108
|
.drawer__panel {
|
|
59
109
|
position: absolute;
|
|
60
110
|
display: flex;
|
|
@@ -63,6 +113,7 @@ export const styles = css `
|
|
|
63
113
|
max-width: 100%;
|
|
64
114
|
max-height: 100%;
|
|
65
115
|
background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
|
|
116
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
66
117
|
box-shadow: var(--nile-box-shadow-2, 0px 20px 24px -4px var(--ng-colors-effects-shadow-xl-01), 0px 8px 8px -4px var(--ng-colors-effects-shadow-xl-02), 0px 3px 3px -1.5px var(--ng-colors-effects-shadow-xl-03));
|
|
67
118
|
overflow: auto;
|
|
68
119
|
pointer-events: all;
|
|
@@ -175,6 +226,10 @@ export const styles = css `
|
|
|
175
226
|
display: none;
|
|
176
227
|
}
|
|
177
228
|
|
|
229
|
+
:host([nooverlay]) .drawer__overlay {
|
|
230
|
+
background-color: transparent;
|
|
231
|
+
}
|
|
232
|
+
|
|
178
233
|
.drawer__close:hover {
|
|
179
234
|
cursor:pointer;
|
|
180
235
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-drawer.css.js","sourceRoot":"","sources":["../../../src/nile-drawer/nile-drawer.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"nile-drawer.css.js","sourceRoot":"","sources":["../../../src/nile-drawer/nile-drawer.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuOxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Drawer CSS\n */\nexport const styles = css`\n :host {\n box-sizing: border-box;\n --nile-drawer-remove-icon-color:var(--nile-colors-dark-900, var(--ng-colors-fg-secondary-700));\n -webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));\n -moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));\n text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));\n }\n\n :host *,\n :host *::before,\n :host *::after {\n box-sizing: inherit;\n }\n\n [hidden] {\n display: none !important;\n }\n\n :host {\n --size: 25rem;\n --header-spacing: var(--nile-line-height-small, var(--ng-spacing-2xl));\n --body-spacing: var(--nile-line-height-small, var(--ng-spacing-2xl));\n --footer-spacing: var(--nile-line-height-small, var(--ng-spacing-2xl));\n\n display: contents;\n }\n\n .drawer {\n top: 0;\n inset-inline-start: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n }\n\n .drawer--contained {\n position: absolute;\n z-index: initial;\n }\n\n .drawer--fixed {\n position: fixed;\n z-index: 700;\n }\n\n .drawer--push {\n position: relative;\n z-index: initial;\n }\n :host([push]) {\n display: block;\n flex: 0 0 auto;\n overflow: hidden;\n transition: inline-size var(--push-duration, 250ms) var(--push-easing, ease),\n block-size var(--push-duration, 250ms) var(--push-easing, ease);\n }\n\n :host([push][placement='start']),\n :host([push][placement='end']) {\n inline-size: 0;\n max-inline-size: 100%;\n align-self: stretch;\n }\n\n :host([push][placement='top']),\n :host([push][placement='bottom']) {\n block-size: 0;\n max-block-size: 100%;\n }\n\n :host([push][open][placement='start']),\n :host([push][open][placement='end']) {\n inline-size: var(--size);\n }\n\n :host([push][open][placement='top']),\n :host([push][open][placement='bottom']) {\n block-size: var(--size);\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host([push]) {\n transition: none;\n }\n }\n\n .drawer--push .drawer__overlay {\n display: none;\n }\n\n .drawer--push .drawer__panel {\n max-inline-size: none;\n max-block-size: none;\n }\n\n .drawer__panel {\n position: absolute;\n display: flex;\n flex-direction: column;\n z-index: 2;\n max-width: 100%;\n max-height: 100%;\n background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n box-shadow: var(--nile-box-shadow-2, 0px 20px 24px -4px var(--ng-colors-effects-shadow-xl-01), 0px 8px 8px -4px var(--ng-colors-effects-shadow-xl-02), 0px 3px 3px -1.5px var(--ng-colors-effects-shadow-xl-03));\n overflow: auto;\n pointer-events: all;\n }\n\n .drawer__panel:focus {\n outline: none;\n }\n\n .drawer--top .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--end .drawer__panel {\n top: 0;\n inset-inline-end: 0;\n bottom: auto;\n inset-inline-start: auto;\n width: var(--size);\n height: 100%;\n }\n\n .drawer--bottom .drawer__panel {\n top: auto;\n inset-inline-end: auto;\n bottom: 0;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--start .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: var(--size);\n height: 100%;\n }\n\n .drawer__header {\n display: flex;\n }\n\n .drawer__title {\n flex: 1 1 auto;\n font-family: var(--nile-font-family-body, var(--ng-font-family-body));\n font-size: var(--nile-font-size-rem-small, var(--ng-font-size-text-lg));\n font-weight: inherit;\n line-height: 1.4;\n padding: var(--header-spacing);\n margin: 0;\n }\n\n .drawer__header-actions {\n flex-shrink: 0;\n display: flex;\n flex-wrap: wrap;\n justify-content: end;\n gap: 0.5rem;\n padding: 0 var(--header-spacing);\n }\n\n .drawer__header-actions nile-icon-button,\n .drawer__header-actions ::slotted(nile-icon-button) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n font-size: var(--nile-type-scale-4, var(--ng-font-size-text-md));\n }\n\n .drawer__body {\n flex: 1 1 auto;\n display: block;\n padding: var(--body-spacing);\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n }\n\n .drawer__footer {\n text-align: right;\n padding: var(--footer-spacing, var(--ng-spacing-xl)) var(--footer-spacing, var(--ng-spacing-3xl)) var(--footer-spacing, var(--ng-spacing-xl)) var(--footer-spacing, var(--ng-spacing-3xl));\n }\n\n .drawer__footer ::slotted(nile-button:not(:last-of-type)) {\n margin-inline-end: 0.5rem;\n }\n\n .drawer:not(.drawer--has-footer) .drawer__footer {\n display: none;\n }\n\n .drawer__overlay {\n display: block;\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: hsl(240 3.8% 46.1% / 33%);\n pointer-events: all;\n }\n\n .drawer--contained .drawer__overlay {\n display: none;\n }\n\n :host([nooverlay]) .drawer__overlay {\n background-color: transparent;\n }\n\n .drawer__close:hover {\n cursor:pointer;\n }\n\n @media (forced-colors: active) {\n .drawer__panel {\n border: solid 1px var(--nile-colors-white-base, var(--ng-colors-border-tertiary));\n }\n }\n`;\n\nexport default [styles];\n"]}
|
|
@@ -87,6 +87,7 @@ export declare class NileDrawer extends NileElement {
|
|
|
87
87
|
* its parent element, set this attribute and add `position: relative` to the parent.
|
|
88
88
|
*/
|
|
89
89
|
contained: boolean;
|
|
90
|
+
push: boolean;
|
|
90
91
|
/**
|
|
91
92
|
* Drawer doesnt close when clicled on overlay, the only way to close is to do by handling open property
|
|
92
93
|
*/
|
|
@@ -96,6 +97,8 @@ export declare class NileDrawer extends NileElement {
|
|
|
96
97
|
* accessible way for users to dismiss the drawer.
|
|
97
98
|
*/
|
|
98
99
|
noHeader: boolean;
|
|
100
|
+
noOverlay: boolean;
|
|
101
|
+
private get isNonModal();
|
|
99
102
|
connectedCallback(): void;
|
|
100
103
|
firstUpdated(): void;
|
|
101
104
|
disconnectedCallback(): void;
|
|
@@ -103,6 +106,7 @@ export declare class NileDrawer extends NileElement {
|
|
|
103
106
|
private addOpenListeners;
|
|
104
107
|
private removeOpenListeners;
|
|
105
108
|
private handleDocumentKeyDown;
|
|
109
|
+
private waitForPushTransition;
|
|
106
110
|
handleOpenChange(): Promise<void>;
|
|
107
111
|
handleNoModalChange(): void;
|
|
108
112
|
/** Shows the drawer. */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { __decorate } from "tslib";
|
|
8
8
|
import '../nile-icon-button/nile-icon-button';
|
|
9
|
-
import { animateTo, stopAnimations } from '../internal/animate';
|
|
9
|
+
import { animateTo, parseDuration, stopAnimations } from '../internal/animate';
|
|
10
10
|
import { classMap } from 'lit/directives/class-map.js';
|
|
11
11
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
12
12
|
import { getAnimation, setDefaultAnimation } from '../utilities/animation-registry';
|
|
@@ -96,6 +96,7 @@ let NileDrawer = class NileDrawer extends NileElement {
|
|
|
96
96
|
* its parent element, set this attribute and add `position: relative` to the parent.
|
|
97
97
|
*/
|
|
98
98
|
this.contained = false;
|
|
99
|
+
this.push = false;
|
|
99
100
|
/**
|
|
100
101
|
* Drawer doesnt close when clicled on overlay, the only way to close is to do by handling open property
|
|
101
102
|
*/
|
|
@@ -105,6 +106,10 @@ let NileDrawer = class NileDrawer extends NileElement {
|
|
|
105
106
|
* accessible way for users to dismiss the drawer.
|
|
106
107
|
*/
|
|
107
108
|
this.noHeader = false;
|
|
109
|
+
this.noOverlay = false;
|
|
110
|
+
}
|
|
111
|
+
get isNonModal() {
|
|
112
|
+
return this.contained || this.push;
|
|
108
113
|
}
|
|
109
114
|
connectedCallback() {
|
|
110
115
|
super.connectedCallback();
|
|
@@ -115,7 +120,7 @@ let NileDrawer = class NileDrawer extends NileElement {
|
|
|
115
120
|
this.drawer.hidden = !this.open;
|
|
116
121
|
if (this.open) {
|
|
117
122
|
this.addOpenListeners();
|
|
118
|
-
if (!this.
|
|
123
|
+
if (!this.isNonModal) {
|
|
119
124
|
this.modal.activate();
|
|
120
125
|
lockBodyScrolling(this);
|
|
121
126
|
}
|
|
@@ -148,19 +153,41 @@ let NileDrawer = class NileDrawer extends NileElement {
|
|
|
148
153
|
document.removeEventListener('keydown', this.handleDocumentKeyDown);
|
|
149
154
|
}
|
|
150
155
|
handleDocumentKeyDown(event) {
|
|
151
|
-
if (this.open && !this.
|
|
156
|
+
if (this.open && !this.isNonModal && event.key === 'Escape') {
|
|
152
157
|
event.stopPropagation();
|
|
153
158
|
this.requestClose('keyboard');
|
|
154
159
|
}
|
|
155
160
|
}
|
|
161
|
+
async waitForPushTransition() {
|
|
162
|
+
await this.updateComplete;
|
|
163
|
+
const style = getComputedStyle(this);
|
|
164
|
+
const duration = parseDuration(style.transitionDuration.split(',')[0]) + parseDuration(style.transitionDelay.split(',')[0]);
|
|
165
|
+
if (!duration) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
return new Promise(resolve => {
|
|
169
|
+
const finish = () => {
|
|
170
|
+
this.removeEventListener('transitionend', handleTransitionEnd);
|
|
171
|
+
clearTimeout(fallback);
|
|
172
|
+
resolve();
|
|
173
|
+
};
|
|
174
|
+
const handleTransitionEnd = (event) => {
|
|
175
|
+
if (event.target === this) {
|
|
176
|
+
finish();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const fallback = setTimeout(finish, duration + 50);
|
|
180
|
+
this.addEventListener('transitionend', handleTransitionEnd);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
156
183
|
async handleOpenChange() {
|
|
157
184
|
if (this.open) {
|
|
158
185
|
// Show
|
|
159
186
|
this.emit('nile-show');
|
|
160
187
|
this.addOpenListeners();
|
|
161
188
|
this.originalTrigger = document.activeElement;
|
|
162
|
-
// Lock body scrolling only if the drawer isn't contained
|
|
163
|
-
if (!this.
|
|
189
|
+
// Lock body scrolling only if the drawer isn't contained or pushing
|
|
190
|
+
if (!this.isNonModal) {
|
|
164
191
|
this.modal.activate();
|
|
165
192
|
lockBodyScrolling(this);
|
|
166
193
|
}
|
|
@@ -192,44 +219,55 @@ let NileDrawer = class NileDrawer extends NileElement {
|
|
|
192
219
|
autoFocusTarget.setAttribute('autofocus', '');
|
|
193
220
|
}
|
|
194
221
|
});
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
222
|
+
if (this.push) {
|
|
223
|
+
await this.waitForPushTransition();
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
const panelAnimation = getAnimation(this, `drawer.show${uppercaseFirstLetter(this.placement)}`, {
|
|
227
|
+
dir: ''
|
|
228
|
+
});
|
|
229
|
+
const overlayAnimation = getAnimation(this, 'drawer.overlay.show', { dir: '' });
|
|
230
|
+
await Promise.all([
|
|
231
|
+
animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options),
|
|
232
|
+
animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)
|
|
233
|
+
]);
|
|
234
|
+
}
|
|
203
235
|
this.emit('nile-after-show');
|
|
204
236
|
}
|
|
205
237
|
else {
|
|
206
238
|
// Hide
|
|
207
239
|
this.emit('nile-hide');
|
|
208
240
|
this.removeOpenListeners();
|
|
209
|
-
if (!this.
|
|
241
|
+
if (!this.isNonModal) {
|
|
210
242
|
this.modal.deactivate();
|
|
211
243
|
unlockBodyScrolling(this);
|
|
212
244
|
}
|
|
213
245
|
await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
246
|
+
if (this.push) {
|
|
247
|
+
await this.waitForPushTransition();
|
|
248
|
+
this.drawer.hidden = true;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
const panelAnimation = getAnimation(this, `drawer.hide${uppercaseFirstLetter(this.placement)}`, {
|
|
252
|
+
dir: ''
|
|
253
|
+
});
|
|
254
|
+
const overlayAnimation = getAnimation(this, 'drawer.overlay.hide', { dir: '' });
|
|
255
|
+
// Animate the overlay and the panel at the same time. Because animation durations might be different, we need to
|
|
256
|
+
// hide each one individually when the animation finishes, otherwise the first one that finishes will reappear
|
|
257
|
+
// unexpectedly. We'll unhide them after all animations have completed.
|
|
258
|
+
await Promise.all([
|
|
259
|
+
animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options).then(() => {
|
|
260
|
+
this.overlay.hidden = true;
|
|
261
|
+
}),
|
|
262
|
+
animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options).then(() => {
|
|
263
|
+
this.panel.hidden = true;
|
|
264
|
+
})
|
|
265
|
+
]);
|
|
266
|
+
this.drawer.hidden = true;
|
|
267
|
+
// Now that the dialog is hidden, restore the overlay and panel for next time
|
|
268
|
+
this.overlay.hidden = false;
|
|
269
|
+
this.panel.hidden = false;
|
|
270
|
+
}
|
|
233
271
|
// Restore focus to the original trigger
|
|
234
272
|
const trigger = this.originalTrigger;
|
|
235
273
|
if (typeof trigger?.focus === 'function') {
|
|
@@ -239,11 +277,11 @@ let NileDrawer = class NileDrawer extends NileElement {
|
|
|
239
277
|
}
|
|
240
278
|
}
|
|
241
279
|
handleNoModalChange() {
|
|
242
|
-
if (this.open && !this.
|
|
280
|
+
if (this.open && !this.isNonModal) {
|
|
243
281
|
this.modal.activate();
|
|
244
282
|
lockBodyScrolling(this);
|
|
245
283
|
}
|
|
246
|
-
if (this.open && this.
|
|
284
|
+
if (this.open && this.isNonModal) {
|
|
247
285
|
this.modal.deactivate();
|
|
248
286
|
unlockBodyScrolling(this);
|
|
249
287
|
}
|
|
@@ -275,8 +313,9 @@ let NileDrawer = class NileDrawer extends NileElement {
|
|
|
275
313
|
'drawer--end': this.placement === 'end',
|
|
276
314
|
'drawer--bottom': this.placement === 'bottom',
|
|
277
315
|
'drawer--start': this.placement === 'start',
|
|
278
|
-
'drawer--contained': this.contained,
|
|
279
|
-
'drawer--
|
|
316
|
+
'drawer--contained': this.contained && !this.push,
|
|
317
|
+
'drawer--push': this.push,
|
|
318
|
+
'drawer--fixed': !this.contained && !this.push,
|
|
280
319
|
'drawer--rtl': 'rtl',
|
|
281
320
|
'drawer--has-footer': this.hasSlotController.test('footer'),
|
|
282
321
|
})}
|
|
@@ -318,7 +357,7 @@ let NileDrawer = class NileDrawer extends NileElement {
|
|
|
318
357
|
label="close"
|
|
319
358
|
part="close-button"
|
|
320
359
|
exportparts="base:close-button__base"
|
|
321
|
-
color="var(--nile-drawer-remove-icon-color)"
|
|
360
|
+
color="var(--nile-drawer-remove-icon-color, var(--ng-colors-bg-primary))"
|
|
322
361
|
@click=${() => this.requestClose('close-button')}
|
|
323
362
|
></nile-icon>
|
|
324
363
|
</div>
|
|
@@ -361,17 +400,23 @@ __decorate([
|
|
|
361
400
|
__decorate([
|
|
362
401
|
property({ type: Boolean, reflect: true })
|
|
363
402
|
], NileDrawer.prototype, "contained", void 0);
|
|
403
|
+
__decorate([
|
|
404
|
+
property({ type: Boolean, reflect: true })
|
|
405
|
+
], NileDrawer.prototype, "push", void 0);
|
|
364
406
|
__decorate([
|
|
365
407
|
property({ type: Boolean, reflect: true })
|
|
366
408
|
], NileDrawer.prototype, "preventOverlayClose", void 0);
|
|
367
409
|
__decorate([
|
|
368
410
|
property({ attribute: 'no-header', type: Boolean, reflect: true })
|
|
369
411
|
], NileDrawer.prototype, "noHeader", void 0);
|
|
412
|
+
__decorate([
|
|
413
|
+
property({ type: Boolean, reflect: true })
|
|
414
|
+
], NileDrawer.prototype, "noOverlay", void 0);
|
|
370
415
|
__decorate([
|
|
371
416
|
watch('open', { waitUntilFirstUpdate: true })
|
|
372
417
|
], NileDrawer.prototype, "handleOpenChange", null);
|
|
373
418
|
__decorate([
|
|
374
|
-
watch('contained', { waitUntilFirstUpdate: true })
|
|
419
|
+
watch(['contained', 'push'], { waitUntilFirstUpdate: true })
|
|
375
420
|
], NileDrawer.prototype, "handleNoModalChange", null);
|
|
376
421
|
NileDrawer = __decorate([
|
|
377
422
|
customElement('nile-drawer')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-drawer.js","sourceRoot":"","sources":["../../../src/nile-drawer/nile-drawer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,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G,EAAE;CAC3B,CAAC,CAAC;AAEH,mBAAmB,CAAC,qBAAqB,EAAE;IACzC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;CAC3B,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport '../nile-icon-button/nile-icon-button';\nimport { animateTo, stopAnimations } from '../internal/animate';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { getAnimation, setDefaultAnimation } from '../utilities/animation-registry';\nimport { HasSlotController } from '../internal/slot';\nimport { html } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { lockBodyScrolling, unlockBodyScrolling } from '../internal/scroll';\nimport { uppercaseFirstLetter } from '../internal/string';\nimport { waitForEvent } from '../internal/event';\nimport { watch } from '../internal/watch';\nimport Modal from '../internal/modal';\nimport NileElement from '../internal/nile-element';\nimport styles from './nile-drawer.css';\nimport type { CSSResultGroup, TemplateResult } from 'lit';\n\n/**\n * Nile drawer component.\n *\n * @tag nile-drawer\n *\n * @summary Drawers slide in from a container to expose additional options and information.\n *\n * @dependency nile-icon-button\n *\n * @slot - The drawer's main content.\n * @slot label - The drawer's label. Alternatively, you can use the `label` attribute.\n * @slot header-actions - Optional actions to add to the header. Works best with `<nile-icon-button>`.\n * @slot footer - The drawer's footer, usually one or more buttons representing various options.\n *\n * @event nile-show - Emitted when the drawer opens.\n * @event nile-after-show - Emitted after the drawer opens and all animations are complete.\n * @event nile-hide - Emitted when the drawer closes.\n * @event nile-after-hide - Emitted after the drawer closes and all animations are complete.\n * @event nile-initial-focus - Emitted when the drawer opens and is ready to receive focus. Calling\n * `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.\n * @event {{ source: 'close-button' | 'keyboard' | 'overlay' }} nile-request-close - Emitted when the user attempts to\n * close the drawer by clicking the close button, clicking the overlay, or pressing escape. Calling\n * `event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in\n * destructive behavior such as data loss.\n *\n * @csspart base - The component's base wrapper.\n * @csspart overlay - The overlay that covers the screen behind the drawer.\n * @csspart panel - The drawer's panel (where the drawer and its content are rendered).\n * @csspart header - The drawer's header. This element wraps the title and header actions.\n * @csspart header-actions - Optional actions to add to the header. Works best with `<nile-icon-button>`.\n * @csspart title - The drawer's title.\n * @csspart close-button - The close button, an `<nile-icon-button>`.\n * @csspart close-button__base - The close button's exported `base` part.\n * @csspart body - The drawer's body.\n * @csspart footer - The drawer's footer.\n *\n * @cssproperty --size - The preferred size of the drawer. This will be applied to the drawer's width or height\n * depending on its `placement`. Note that the drawer will shrink to accommodate smaller screens.\n * @cssproperty --header-spacing - The amount of padding to use for the header.\n * @cssproperty --body-spacing - The amount of padding to use for the body.\n * @cssproperty --footer-spacing - The amount of padding to use for the footer.\n *\n * @animation drawer.showTop - The animation to use when showing a drawer with `top` placement.\n * @animation drawer.showEnd - The animation to use when showing a drawer with `end` placement.\n * @animation drawer.showBottom - The animation to use when showing a drawer with `bottom` placement.\n * @animation drawer.showStart - The animation to use when showing a drawer with `start` placement.\n * @animation drawer.hideTop - The animation to use when hiding a drawer with `top` placement.\n * @animation drawer.hideEnd - The animation to use when hiding a drawer with `end` placement.\n * @animation drawer.hideBottom - The animation to use when hiding a drawer with `bottom` placement.\n * @animation drawer.hideStart - The animation to use when hiding a drawer with `start` placement.\n * @animation drawer.denyClose - The animation to use when a request to close the drawer is denied.\n * @animation drawer.overlay.show - The animation to use when showing the drawer's overlay.\n * @animation drawer.overlay.hide - The animation to use when hiding the drawer's overlay.\n */\n@customElement('nile-drawer')\nexport class NileDrawer extends NileElement {\n\n\tstatic styles: CSSResultGroup = styles;\n\n private readonly hasSlotController = new HasSlotController(this, 'footer');\n private modal: Modal;\n private originalTrigger: HTMLElement | null;\n\n @query('.drawer') drawer: HTMLElement;\n @query('.drawer__panel') panel: HTMLElement;\n @query('.drawer__overlay') overlay: HTMLElement;\n\n /**\n * Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\n * use the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n @property({ type: Boolean, reflect: true }) closeOnEscape = true;\n\n /**\n * The drawer's label as displayed in the header. You should always include a relevant label even when using\n * `no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n */\n @property({ reflect: true }) label = '';\n\n /** The direction from which the drawer will open. */\n @property({ reflect: true }) placement: 'top' | 'end' | 'bottom' | 'start' = 'end';\n\n /**\n * By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\n * its parent element, set this attribute and add `position: relative` to the parent.\n */\n @property({ type: Boolean, reflect: true }) contained = false;\n\n /**\n * Drawer doesnt close when clicled on overlay, the only way to close is to do by handling open property\n */\n @property({ type: Boolean, reflect:true }) preventOverlayClose = false;\n\n /**\n * Removes the header. This will also remove the default close button, so please ensure you provide an easy,\n * accessible way for users to dismiss the drawer.\n */\n @property({ attribute: 'no-header', type: Boolean, reflect: true }) noHeader = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.modal = new Modal(this);\n }\n\n firstUpdated() {\n this.drawer.hidden = !this.open;\n\n if (this.open) {\n this.addOpenListeners();\n\n if (!this.contained) {\n this.modal.activate();\n lockBodyScrolling(this);\n }\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n unlockBodyScrolling(this);\n }\n\n private requestClose(source: 'close-button' | 'keyboard' | 'overlay') {\n if((source=='overlay' || source=='keyboard') && this.preventOverlayClose) return;\n const slRequestClose = this.emit('nile-request-close', {\n cancelable: true,\n detail: { source }\n });\n\n if (slRequestClose.defaultPrevented) {\n const animation = getAnimation(this, 'drawer.denyClose', { dir: '' });\n animateTo(this.panel, animation.keyframes, animation.options);\n return;\n }\n\n this.hide();\n }\n\n private addOpenListeners() {\n if(this.closeOnEscape) document.addEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n private removeOpenListeners() {\n if(this.closeOnEscape) document.removeEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n private handleDocumentKeyDown(event: KeyboardEvent) {\n if (this.open && !this.contained && event.key === 'Escape') {\n event.stopPropagation();\n this.requestClose('keyboard');\n }\n }\n\n @watch('open', { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.emit('nile-show');\n this.addOpenListeners();\n this.originalTrigger = document.activeElement as HTMLElement;\n\n // Lock body scrolling only if the drawer isn't contained\n if (!this.contained) {\n this.modal.activate();\n lockBodyScrolling(this);\n }\n\n // When the drawer is shown, Safari will attempt to set focus on whatever element has autofocus. This causes the\n // drawer's animation to jitter, so we'll temporarily remove the attribute, call `focus({ preventScroll: true })`\n // ourselves, and add the attribute back afterwards.\n //\n //\n const autoFocusTarget = this.querySelector('[autofocus]');\n if (autoFocusTarget) {\n autoFocusTarget.removeAttribute('autofocus');\n }\n\n await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);\n this.drawer.hidden = false;\n\n // Set initial focus\n requestAnimationFrame(() => {\n const slInitialFocus = this.emit('nile-initial-focus', { cancelable: true });\n\n if (!slInitialFocus.defaultPrevented) {\n // Set focus to the autofocus target and restore the attribute\n if (autoFocusTarget) {\n (autoFocusTarget as HTMLInputElement).focus({ preventScroll: true });\n } else {\n this.panel.focus({ preventScroll: true });\n }\n }\n\n // Restore the autofocus attribute\n if (autoFocusTarget) {\n autoFocusTarget.setAttribute('autofocus', '');\n }\n });\n\n const panelAnimation = getAnimation(this, `drawer.show${uppercaseFirstLetter(this.placement)}`, {\n dir: ''\n });\n const overlayAnimation = getAnimation(this, 'drawer.overlay.show', { dir: '' });\n await Promise.all([\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options),\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)\n ]);\n\n this.emit('nile-after-show');\n } else {\n // Hide\n this.emit('nile-hide');\n this.removeOpenListeners();\n\n if (!this.contained) {\n this.modal.deactivate();\n unlockBodyScrolling(this);\n }\n\n await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);\n const panelAnimation = getAnimation(this, `drawer.hide${uppercaseFirstLetter(this.placement)}`, {\n dir: ''\n });\n const overlayAnimation = getAnimation(this, 'drawer.overlay.hide', { dir: '' });\n\n // Animate the overlay and the panel at the same time. Because animation durations might be different, we need to\n // hide each one individually when the animation finishes, otherwise the first one that finishes will reappear\n // unexpectedly. We'll unhide them after all animations have completed.\n await Promise.all([\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options).then(() => {\n this.overlay.hidden = true;\n }),\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options).then(() => {\n this.panel.hidden = true;\n })\n ]);\n\n this.drawer.hidden = true;\n\n // Now that the dialog is hidden, restore the overlay and panel for next time\n this.overlay.hidden = false;\n this.panel.hidden = false;\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (typeof trigger?.focus === 'function') {\n setTimeout(() => trigger.focus());\n }\n\n this.emit('nile-after-hide');\n }\n }\n\n @watch('contained', { waitUntilFirstUpdate: true })\n handleNoModalChange() {\n if (this.open && !this.contained) {\n this.modal.activate();\n lockBodyScrolling(this);\n }\n\n if (this.open && this.contained) {\n this.modal.deactivate();\n unlockBodyScrolling(this);\n }\n }\n\n /** Shows the drawer. */\n async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, 'nile-after-show');\n }\n\n /** Hides the drawer */\n async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, 'nile-after-hide');\n }\n\n render() {\n return html`\n <div\n part=\"base\"\n class=${classMap({\n drawer: true,\n 'drawer--open': this.open,\n 'drawer--top': this.placement === 'top',\n 'drawer--end': this.placement === 'end',\n 'drawer--bottom': this.placement === 'bottom',\n 'drawer--start': this.placement === 'start',\n 'drawer--contained': this.contained,\n 'drawer--fixed': !this.contained,\n 'drawer--rtl': 'rtl',\n 'drawer--has-footer': this.hasSlotController.test('footer'),\n })}\n >\n <div\n part=\"overlay\"\n class=\"drawer__overlay\"\n @click=${() => this.requestClose('overlay')}\n tabindex=\"-1\"\n ></div>\n\n <div\n part=\"panel\"\n class=\"drawer__panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden=${this.open ? 'false' : 'true'}\n aria-label=${ifDefined(this.noHeader ? this.label : undefined)}\n aria-labelledby=${ifDefined(!this.noHeader ? 'title' : undefined)}\n tabindex=\"0\"\n >\n ${!this.noHeader\n ? html`\n <header part=\"header\" class=\"drawer__header\">\n <h2 part=\"title\" class=\"drawer__title\" id=\"title\">\n <!-- If there's no label, use an invisible character to prevent the header from collapsing -->\n <slot name=\"label\">\n ${this.label.length > 0\n ? this.label\n : String.fromCharCode(65279)}\n </slot>\n </h2>\n <div part=\"header-actions\" class=\"drawer__header-actions\">\n <slot name=\"header-actions\"></slot>\n <nile-icon\n class=\"drawer__close\"\n name=\"var(--nile-icon-close, var(--ng-icon-x-close))\"\n method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"\n label=\"close\"\n part=\"close-button\"\n exportparts=\"base:close-button__base\"\n color=\"var(--nile-drawer-remove-icon-color)\"\n @click=${() => this.requestClose('close-button')}\n ></nile-icon>\n </div>\n </header>\n `\n : ''}\n\n <slot part=\"body\" class=\"drawer__body\"></slot>\n\n <footer part=\"footer\" class=\"drawer__footer\">\n <slot name=\"footer\"></slot>\n </footer>\n </div>\n </div>\n `;\n }\n}\n\n// Top\nsetDefaultAnimation('drawer.showTop', {\n keyframes: [\n { opacity: 0, translate: '0 -100%' },\n { opacity: 1, translate: '0 0' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\nsetDefaultAnimation('drawer.hideTop', {\n keyframes: [\n { opacity: 1, translate: '0 0' },\n { opacity: 0, translate: '0 -100%' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\n// End\nsetDefaultAnimation('drawer.showEnd', {\n keyframes: [\n { opacity: 0, translate: '100%' },\n { opacity: 1, translate: '0' }\n ],\n rtlKeyframes: [\n { opacity: 0, translate: '-100%' },\n { opacity: 1, translate: '0' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\nsetDefaultAnimation('drawer.hideEnd', {\n keyframes: [\n { opacity: 1, translate: '0' },\n { opacity: 0, translate: '100%' }\n ],\n rtlKeyframes: [\n { opacity: 1, translate: '0' },\n { opacity: 0, translate: '-100%' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\n// Bottom\nsetDefaultAnimation('drawer.showBottom', {\n keyframes: [\n { opacity: 0, translate: '0 100%' },\n { opacity: 1, translate: '0 0' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\nsetDefaultAnimation('drawer.hideBottom', {\n keyframes: [\n { opacity: 1, translate: '0 0' },\n { opacity: 0, translate: '0 100%' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\n// Start\nsetDefaultAnimation('drawer.showStart', {\n keyframes: [\n { opacity: 0, translate: '-100%' },\n { opacity: 1, translate: '0' }\n ],\n rtlKeyframes: [\n { opacity: 0, translate: '100%' },\n { opacity: 1, translate: '0' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\nsetDefaultAnimation('drawer.hideStart', {\n keyframes: [\n { opacity: 1, translate: '0' },\n { opacity: 0, translate: '-100%' }\n ],\n rtlKeyframes: [\n { opacity: 1, translate: '0' },\n { opacity: 0, translate: '100%' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\n// Deny close\nsetDefaultAnimation('drawer.denyClose', {\n keyframes: [{ scale: 1 }, { scale: 1.01 }, { scale: 1 }],\n options: { duration: 250 }\n});\n\n// Overlay\nsetDefaultAnimation('drawer.overlay.show', {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n options: { duration: 250 }\n});\n\nsetDefaultAnimation('drawer.overlay.hide', {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n options: { duration: 250 }\n});\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-drawer': NileDrawer;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nile-drawer.js","sourceRoot":"","sources":["../../../src/nile-drawer/nile-drawer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,WAAW;IAApC;;QAIY,sBAAiB,GAAG,IAAI,iBAAiB,CAAC,I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AG,EAAE;CAC3B,CAAC,CAAC;AAEH,UAAU;AACV,mBAAmB,CAAC,qBAAqB,EAAE;IACzC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;CAC3B,CAAC,CAAC;AAEH,mBAAmB,CAAC,qBAAqB,EAAE;IACzC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;CAC3B,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport '../nile-icon-button/nile-icon-button';\nimport { animateTo, parseDuration, stopAnimations } from '../internal/animate';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { getAnimation, setDefaultAnimation } from '../utilities/animation-registry';\nimport { HasSlotController } from '../internal/slot';\nimport { html } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { lockBodyScrolling, unlockBodyScrolling } from '../internal/scroll';\nimport { uppercaseFirstLetter } from '../internal/string';\nimport { waitForEvent } from '../internal/event';\nimport { watch } from '../internal/watch';\nimport Modal from '../internal/modal';\nimport NileElement from '../internal/nile-element';\nimport styles from './nile-drawer.css';\nimport type { CSSResultGroup, TemplateResult } from 'lit';\n\n/**\n * Nile drawer component.\n *\n * @tag nile-drawer\n *\n * @summary Drawers slide in from a container to expose additional options and information.\n *\n * @dependency nile-icon-button\n *\n * @slot - The drawer's main content.\n * @slot label - The drawer's label. Alternatively, you can use the `label` attribute.\n * @slot header-actions - Optional actions to add to the header. Works best with `<nile-icon-button>`.\n * @slot footer - The drawer's footer, usually one or more buttons representing various options.\n *\n * @event nile-show - Emitted when the drawer opens.\n * @event nile-after-show - Emitted after the drawer opens and all animations are complete.\n * @event nile-hide - Emitted when the drawer closes.\n * @event nile-after-hide - Emitted after the drawer closes and all animations are complete.\n * @event nile-initial-focus - Emitted when the drawer opens and is ready to receive focus. Calling\n * `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.\n * @event {{ source: 'close-button' | 'keyboard' | 'overlay' }} nile-request-close - Emitted when the user attempts to\n * close the drawer by clicking the close button, clicking the overlay, or pressing escape. Calling\n * `event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in\n * destructive behavior such as data loss.\n *\n * @csspart base - The component's base wrapper.\n * @csspart overlay - The overlay that covers the screen behind the drawer.\n * @csspart panel - The drawer's panel (where the drawer and its content are rendered).\n * @csspart header - The drawer's header. This element wraps the title and header actions.\n * @csspart header-actions - Optional actions to add to the header. Works best with `<nile-icon-button>`.\n * @csspart title - The drawer's title.\n * @csspart close-button - The close button, an `<nile-icon-button>`.\n * @csspart close-button__base - The close button's exported `base` part.\n * @csspart body - The drawer's body.\n * @csspart footer - The drawer's footer.\n *\n * @cssproperty --size - The preferred size of the drawer. This will be applied to the drawer's width or height\n * depending on its `placement`. Note that the drawer will shrink to accommodate smaller screens.\n * @cssproperty --header-spacing - The amount of padding to use for the header.\n * @cssproperty --body-spacing - The amount of padding to use for the body.\n * @cssproperty --footer-spacing - The amount of padding to use for the footer.\n *\n * @animation drawer.showTop - The animation to use when showing a drawer with `top` placement.\n * @animation drawer.showEnd - The animation to use when showing a drawer with `end` placement.\n * @animation drawer.showBottom - The animation to use when showing a drawer with `bottom` placement.\n * @animation drawer.showStart - The animation to use when showing a drawer with `start` placement.\n * @animation drawer.hideTop - The animation to use when hiding a drawer with `top` placement.\n * @animation drawer.hideEnd - The animation to use when hiding a drawer with `end` placement.\n * @animation drawer.hideBottom - The animation to use when hiding a drawer with `bottom` placement.\n * @animation drawer.hideStart - The animation to use when hiding a drawer with `start` placement.\n * @animation drawer.denyClose - The animation to use when a request to close the drawer is denied.\n * @animation drawer.overlay.show - The animation to use when showing the drawer's overlay.\n * @animation drawer.overlay.hide - The animation to use when hiding the drawer's overlay.\n */\n@customElement('nile-drawer')\nexport class NileDrawer extends NileElement {\n\n\tstatic styles: CSSResultGroup = styles;\n\n private readonly hasSlotController = new HasSlotController(this, 'footer');\n private modal: Modal;\n private originalTrigger: HTMLElement | null;\n\n @query('.drawer') drawer: HTMLElement;\n @query('.drawer__panel') panel: HTMLElement;\n @query('.drawer__overlay') overlay: HTMLElement;\n\n /**\n * Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\n * use the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n @property({ type: Boolean, reflect: true }) closeOnEscape = true;\n\n /**\n * The drawer's label as displayed in the header. You should always include a relevant label even when using\n * `no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n */\n @property({ reflect: true }) label = '';\n\n /** The direction from which the drawer will open. */\n @property({ reflect: true }) placement: 'top' | 'end' | 'bottom' | 'start' = 'end';\n\n /**\n * By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\n * its parent element, set this attribute and add `position: relative` to the parent.\n */\n @property({ type: Boolean, reflect: true }) contained = false;\n\n @property({ type: Boolean, reflect: true }) push = false;\n\n /**\n * Drawer doesnt close when clicled on overlay, the only way to close is to do by handling open property\n */\n @property({ type: Boolean, reflect:true }) preventOverlayClose = false;\n\n /**\n * Removes the header. This will also remove the default close button, so please ensure you provide an easy,\n * accessible way for users to dismiss the drawer.\n */\n @property({ attribute: 'no-header', type: Boolean, reflect: true }) noHeader = false;\n \n @property({type: Boolean, reflect: true }) noOverlay = false;\n\n private get isNonModal() {\n return this.contained || this.push;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.modal = new Modal(this);\n }\n\n firstUpdated() {\n this.drawer.hidden = !this.open;\n\n if (this.open) {\n this.addOpenListeners();\n\n if (!this.isNonModal) {\n this.modal.activate();\n lockBodyScrolling(this);\n }\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n unlockBodyScrolling(this);\n }\n\n private requestClose(source: 'close-button' | 'keyboard' | 'overlay') {\n if((source=='overlay' || source=='keyboard') && this.preventOverlayClose) return;\n const slRequestClose = this.emit('nile-request-close', {\n cancelable: true,\n detail: { source }\n });\n\n if (slRequestClose.defaultPrevented) {\n const animation = getAnimation(this, 'drawer.denyClose', { dir: '' });\n animateTo(this.panel, animation.keyframes, animation.options);\n return;\n }\n\n this.hide();\n }\n\n private addOpenListeners() {\n if(this.closeOnEscape) document.addEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n private removeOpenListeners() {\n if(this.closeOnEscape) document.removeEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n private handleDocumentKeyDown(event: KeyboardEvent) {\n if (this.open && !this.isNonModal && event.key === 'Escape') {\n event.stopPropagation();\n this.requestClose('keyboard');\n }\n }\n\n private async waitForPushTransition() {\n await this.updateComplete;\n\n const style = getComputedStyle(this);\n const duration =\n parseDuration(style.transitionDuration.split(',')[0]) + parseDuration(style.transitionDelay.split(',')[0]);\n\n if (!duration) {\n return;\n }\n\n return new Promise<void>(resolve => {\n const finish = () => {\n this.removeEventListener('transitionend', handleTransitionEnd);\n clearTimeout(fallback);\n resolve();\n };\n\n const handleTransitionEnd = (event: Event) => {\n if (event.target === this) {\n finish();\n }\n };\n const fallback = setTimeout(finish, duration + 50);\n this.addEventListener('transitionend', handleTransitionEnd);\n });\n }\n\n @watch('open', { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.emit('nile-show');\n this.addOpenListeners();\n this.originalTrigger = document.activeElement as HTMLElement;\n\n // Lock body scrolling only if the drawer isn't contained or pushing\n if (!this.isNonModal) {\n this.modal.activate();\n lockBodyScrolling(this);\n }\n\n // When the drawer is shown, Safari will attempt to set focus on whatever element has autofocus. This causes the\n // drawer's animation to jitter, so we'll temporarily remove the attribute, call `focus({ preventScroll: true })`\n // ourselves, and add the attribute back afterwards.\n //\n //\n const autoFocusTarget = this.querySelector('[autofocus]');\n if (autoFocusTarget) {\n autoFocusTarget.removeAttribute('autofocus');\n }\n\n await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);\n this.drawer.hidden = false;\n\n // Set initial focus\n requestAnimationFrame(() => {\n const slInitialFocus = this.emit('nile-initial-focus', { cancelable: true });\n\n if (!slInitialFocus.defaultPrevented) {\n // Set focus to the autofocus target and restore the attribute\n if (autoFocusTarget) {\n (autoFocusTarget as HTMLInputElement).focus({ preventScroll: true });\n } else {\n this.panel.focus({ preventScroll: true });\n }\n }\n\n // Restore the autofocus attribute\n if (autoFocusTarget) {\n autoFocusTarget.setAttribute('autofocus', '');\n }\n });\n\n if (this.push) {\n await this.waitForPushTransition();\n } else {\n const panelAnimation = getAnimation(this, `drawer.show${uppercaseFirstLetter(this.placement)}`, {\n dir: ''\n });\n const overlayAnimation = getAnimation(this, 'drawer.overlay.show', { dir: '' });\n await Promise.all([\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options),\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)\n ]);\n }\n\n this.emit('nile-after-show');\n } else {\n // Hide\n this.emit('nile-hide');\n this.removeOpenListeners();\n\n if (!this.isNonModal) {\n this.modal.deactivate();\n unlockBodyScrolling(this);\n }\n\n await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);\n\n if (this.push) {\n await this.waitForPushTransition();\n this.drawer.hidden = true;\n } else {\n const panelAnimation = getAnimation(this, `drawer.hide${uppercaseFirstLetter(this.placement)}`, {\n dir: ''\n });\n const overlayAnimation = getAnimation(this, 'drawer.overlay.hide', { dir: '' });\n\n // Animate the overlay and the panel at the same time. Because animation durations might be different, we need to\n // hide each one individually when the animation finishes, otherwise the first one that finishes will reappear\n // unexpectedly. We'll unhide them after all animations have completed.\n await Promise.all([\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options).then(() => {\n this.overlay.hidden = true;\n }),\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options).then(() => {\n this.panel.hidden = true;\n })\n ]);\n\n this.drawer.hidden = true;\n\n // Now that the dialog is hidden, restore the overlay and panel for next time\n this.overlay.hidden = false;\n this.panel.hidden = false;\n }\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (typeof trigger?.focus === 'function') {\n setTimeout(() => trigger.focus());\n }\n\n this.emit('nile-after-hide');\n }\n }\n\n @watch(['contained', 'push'], { waitUntilFirstUpdate: true })\n handleNoModalChange() {\n if (this.open && !this.isNonModal) {\n this.modal.activate();\n lockBodyScrolling(this);\n }\n\n if (this.open && this.isNonModal) {\n this.modal.deactivate();\n unlockBodyScrolling(this);\n }\n }\n\n /** Shows the drawer. */\n async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, 'nile-after-show');\n }\n\n /** Hides the drawer */\n async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, 'nile-after-hide');\n }\n\n render() {\n return html`\n <div\n part=\"base\"\n class=${classMap({\n drawer: true,\n 'drawer--open': this.open,\n 'drawer--top': this.placement === 'top',\n 'drawer--end': this.placement === 'end',\n 'drawer--bottom': this.placement === 'bottom',\n 'drawer--start': this.placement === 'start',\n 'drawer--contained': this.contained && !this.push,\n 'drawer--push': this.push,\n 'drawer--fixed': !this.contained && !this.push,\n 'drawer--rtl': 'rtl',\n 'drawer--has-footer': this.hasSlotController.test('footer'),\n })}\n >\n <div\n part=\"overlay\"\n class=\"drawer__overlay\"\n @click=${() => this.requestClose('overlay')}\n tabindex=\"-1\"\n ></div>\n\n <div\n part=\"panel\"\n class=\"drawer__panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden=${this.open ? 'false' : 'true'}\n aria-label=${ifDefined(this.noHeader ? this.label : undefined)}\n aria-labelledby=${ifDefined(!this.noHeader ? 'title' : undefined)}\n tabindex=\"0\"\n >\n ${!this.noHeader\n ? html`\n <header part=\"header\" class=\"drawer__header\">\n <h2 part=\"title\" class=\"drawer__title\" id=\"title\">\n <!-- If there's no label, use an invisible character to prevent the header from collapsing -->\n <slot name=\"label\">\n ${this.label.length > 0\n ? this.label\n : String.fromCharCode(65279)}\n </slot>\n </h2>\n <div part=\"header-actions\" class=\"drawer__header-actions\">\n <slot name=\"header-actions\"></slot>\n <nile-icon\n class=\"drawer__close\"\n name=\"var(--nile-icon-close, var(--ng-icon-x-close))\"\n method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"\n label=\"close\"\n part=\"close-button\"\n exportparts=\"base:close-button__base\"\n color=\"var(--nile-drawer-remove-icon-color, var(--ng-colors-bg-primary))\"\n @click=${() => this.requestClose('close-button')}\n ></nile-icon>\n </div>\n </header>\n `\n : ''}\n\n <slot part=\"body\" class=\"drawer__body\"></slot>\n\n <footer part=\"footer\" class=\"drawer__footer\">\n <slot name=\"footer\"></slot>\n </footer>\n </div>\n </div>\n `;\n }\n}\n\n// Top\nsetDefaultAnimation('drawer.showTop', {\n keyframes: [\n { opacity: 0, translate: '0 -100%' },\n { opacity: 1, translate: '0 0' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\nsetDefaultAnimation('drawer.hideTop', {\n keyframes: [\n { opacity: 1, translate: '0 0' },\n { opacity: 0, translate: '0 -100%' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\n// End\nsetDefaultAnimation('drawer.showEnd', {\n keyframes: [\n { opacity: 0, translate: '100%' },\n { opacity: 1, translate: '0' }\n ],\n rtlKeyframes: [\n { opacity: 0, translate: '-100%' },\n { opacity: 1, translate: '0' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\nsetDefaultAnimation('drawer.hideEnd', {\n keyframes: [\n { opacity: 1, translate: '0' },\n { opacity: 0, translate: '100%' }\n ],\n rtlKeyframes: [\n { opacity: 1, translate: '0' },\n { opacity: 0, translate: '-100%' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\n// Bottom\nsetDefaultAnimation('drawer.showBottom', {\n keyframes: [\n { opacity: 0, translate: '0 100%' },\n { opacity: 1, translate: '0 0' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\nsetDefaultAnimation('drawer.hideBottom', {\n keyframes: [\n { opacity: 1, translate: '0 0' },\n { opacity: 0, translate: '0 100%' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\n// Start\nsetDefaultAnimation('drawer.showStart', {\n keyframes: [\n { opacity: 0, translate: '-100%' },\n { opacity: 1, translate: '0' }\n ],\n rtlKeyframes: [\n { opacity: 0, translate: '100%' },\n { opacity: 1, translate: '0' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\nsetDefaultAnimation('drawer.hideStart', {\n keyframes: [\n { opacity: 1, translate: '0' },\n { opacity: 0, translate: '-100%' }\n ],\n rtlKeyframes: [\n { opacity: 1, translate: '0' },\n { opacity: 0, translate: '100%' }\n ],\n options: { duration: 250, easing: 'ease' }\n});\n\n// Deny close\nsetDefaultAnimation('drawer.denyClose', {\n keyframes: [{ scale: 1 }, { scale: 1.01 }, { scale: 1 }],\n options: { duration: 250 }\n});\n\n// Overlay\nsetDefaultAnimation('drawer.overlay.show', {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n options: { duration: 250 }\n});\n\nsetDefaultAnimation('drawer.overlay.hide', {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n options: { duration: 250 }\n});\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-drawer': NileDrawer;\n }\n}\n"]}
|
|
@@ -104,5 +104,76 @@ describe('NileDrawer', () => {
|
|
|
104
104
|
it('98. header-actions part', async () => { const el = await fixture(html `<nile-drawer></nile-drawer>`); expect(el.shadowRoot.querySelector('[part="header-actions"]')).to.exist; });
|
|
105
105
|
it('99. dynamic closeOnEscape', async () => { const el = await fixture(html `<nile-drawer></nile-drawer>`); el.closeOnEscape = false; await el.updateComplete; expect(el.closeOnEscape).to.be.false; });
|
|
106
106
|
it('100. full integration', async () => { const el = await fixture(html `<nile-drawer label="Settings" placement="start" class="dr" id="dr1">Content<div slot="footer">Footer</div></nile-drawer>`); expect(el.label).to.equal('Settings'); expect(el.placement).to.equal('start'); expect(el.id).to.equal('dr1'); expect(el.open).to.be.false; expect(el.shadowRoot.querySelector('.drawer')).to.exist; expect(el.shadowRoot.querySelector('.drawer__panel')).to.exist; });
|
|
107
|
+
// Push mode: the drawer is part of the layout instead of an overlay.
|
|
108
|
+
it('101. push defaults false', async () => { const el = await fixture(html `<nile-drawer></nile-drawer>`); expect(el.push).to.equal(false); });
|
|
109
|
+
it('102. push reflects', async () => { const el = await fixture(html `<nile-drawer push></nile-drawer>`); expect(el.push).to.be.true; expect(el.hasAttribute('push')).to.be.true; });
|
|
110
|
+
it('103. push adds drawer--push', async () => { const el = await fixture(html `<nile-drawer push></nile-drawer>`); expect(el.shadowRoot.querySelector('.drawer--push')).to.exist; });
|
|
111
|
+
it('104. push drops drawer--fixed', async () => { const el = await fixture(html `<nile-drawer push></nile-drawer>`); expect(el.shadowRoot.querySelector('.drawer--fixed')).to.be.null; });
|
|
112
|
+
it('105. push wins over contained', async () => { const el = await fixture(html `<nile-drawer push contained></nile-drawer>`); expect(el.shadowRoot.querySelector('.drawer--push')).to.exist; expect(el.shadowRoot.querySelector('.drawer--contained')).to.be.null; });
|
|
113
|
+
it('106. push hides the overlay', async () => { const el = await fixture(html `<nile-drawer push open></nile-drawer>`); await el.updateComplete; expect(getComputedStyle(el.shadowRoot.querySelector('.drawer__overlay')).display).to.equal('none'); });
|
|
114
|
+
it('107. push host is not display:contents', async () => { const el = await fixture(html `<nile-drawer push></nile-drawer>`); await el.updateComplete; expect(getComputedStyle(el).display).to.equal('block'); });
|
|
115
|
+
it('108. overlay mode host stays display:contents', async () => { const el = await fixture(html `<nile-drawer></nile-drawer>`); await el.updateComplete; expect(getComputedStyle(el).display).to.equal('contents'); });
|
|
116
|
+
it('109. push takes inline space when open', async () => {
|
|
117
|
+
const c = await fixture(html `<div style="display:flex;width:400px;height:200px"><nile-drawer push placement="end" style="--size:100px"></nile-drawer><div style="flex:1 1 auto"></div></div>`);
|
|
118
|
+
const el = c.querySelector('nile-drawer');
|
|
119
|
+
await el.updateComplete;
|
|
120
|
+
expect(el.getBoundingClientRect().width).to.equal(0);
|
|
121
|
+
await el.show();
|
|
122
|
+
expect(el.getBoundingClientRect().width).to.equal(100);
|
|
123
|
+
await el.hide();
|
|
124
|
+
expect(el.getBoundingClientRect().width).to.equal(0);
|
|
125
|
+
});
|
|
126
|
+
it('110. push pushes its sibling', async () => {
|
|
127
|
+
const c = await fixture(html `<div style="display:flex;width:400px;height:200px"><nile-drawer push placement="start" style="--size:100px"></nile-drawer><div id="c" style="flex:1 1 auto"></div></div>`);
|
|
128
|
+
const el = c.querySelector('nile-drawer');
|
|
129
|
+
const content = c.querySelector('#c');
|
|
130
|
+
await el.updateComplete;
|
|
131
|
+
expect(content.getBoundingClientRect().width).to.equal(400);
|
|
132
|
+
await el.show();
|
|
133
|
+
expect(content.getBoundingClientRect().width).to.equal(300);
|
|
134
|
+
});
|
|
135
|
+
it('111. push takes block space when open', async () => {
|
|
136
|
+
const c = await fixture(html `<div style="display:flex;flex-direction:column;width:400px;height:200px"><nile-drawer push placement="top" style="--size:60px"></nile-drawer><div style="flex:1 1 auto"></div></div>`);
|
|
137
|
+
const el = c.querySelector('nile-drawer');
|
|
138
|
+
await el.updateComplete;
|
|
139
|
+
expect(el.getBoundingClientRect().height).to.equal(0);
|
|
140
|
+
await el.show();
|
|
141
|
+
expect(el.getBoundingClientRect().height).to.equal(60);
|
|
142
|
+
});
|
|
143
|
+
it('112. push emits after-show and after-hide', async () => {
|
|
144
|
+
const el = await fixture(html `<nile-drawer push style="--size:100px"></nile-drawer>`);
|
|
145
|
+
const seen = [];
|
|
146
|
+
['nile-show', 'nile-after-show', 'nile-hide', 'nile-after-hide'].forEach(t => el.addEventListener(t, e => seen.push(e.type)));
|
|
147
|
+
await el.show();
|
|
148
|
+
await el.hide();
|
|
149
|
+
expect(seen).to.deep.equal(['nile-show', 'nile-after-show', 'nile-hide', 'nile-after-hide']);
|
|
150
|
+
});
|
|
151
|
+
it('113. escape does not close a push drawer', async () => { const el = await fixture(html `<nile-drawer push open></nile-drawer>`); await el.updateComplete; document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })); await el.updateComplete; expect(el.open).to.be.true; });
|
|
152
|
+
it('114. push does not lock body scrolling', async () => { const el = await fixture(html `<nile-drawer push style="--size:100px"></nile-drawer>`); await el.show(); expect(document.body.classList.contains('nile-scroll-lock')).to.be.false; });
|
|
153
|
+
// noOverlay: hides the backdrop tint without giving up modal behaviour.
|
|
154
|
+
it('115. noOverlay defaults false', async () => { const el = await fixture(html `<nile-drawer></nile-drawer>`); expect(el.noOverlay).to.equal(false); });
|
|
155
|
+
it('116. noOverlay reflects as nooverlay', async () => { const el = await fixture(html `<nile-drawer nooverlay></nile-drawer>`); expect(el.noOverlay).to.be.true; expect(el.hasAttribute('nooverlay')).to.be.true; el.noOverlay = false; await el.updateComplete; expect(el.hasAttribute('nooverlay')).to.be.false; });
|
|
156
|
+
it('116b. noOverlay property sets the attribute', async () => { const el = await fixture(html `<nile-drawer></nile-drawer>`); el.noOverlay = true; await el.updateComplete; expect(el.hasAttribute('nooverlay')).to.be.true; expect(el.hasAttribute('no-overlay')).to.be.false; });
|
|
157
|
+
it('117. overlay is tinted by default', async () => {
|
|
158
|
+
const el = await fixture(html `<nile-drawer open></nile-drawer>`);
|
|
159
|
+
await el.updateComplete;
|
|
160
|
+
const bg = getComputedStyle(el.shadowRoot.querySelector('.drawer__overlay')).backgroundColor;
|
|
161
|
+
expect(bg).to.not.equal('rgba(0, 0, 0, 0)');
|
|
162
|
+
});
|
|
163
|
+
it('118. noOverlay makes the overlay transparent', async () => {
|
|
164
|
+
const el = await fixture(html `<nile-drawer open nooverlay></nile-drawer>`);
|
|
165
|
+
await el.updateComplete;
|
|
166
|
+
const bg = getComputedStyle(el.shadowRoot.querySelector('.drawer__overlay')).backgroundColor;
|
|
167
|
+
expect(bg).to.equal('rgba(0, 0, 0, 0)');
|
|
168
|
+
});
|
|
169
|
+
it('119. noOverlay keeps click-outside-to-close working', async () => {
|
|
170
|
+
const el = await fixture(html `<nile-drawer open nooverlay></nile-drawer>`);
|
|
171
|
+
await el.updateComplete;
|
|
172
|
+
el.shadowRoot.querySelector('.drawer__overlay').click();
|
|
173
|
+
await el.updateComplete;
|
|
174
|
+
expect(el.open).to.be.false;
|
|
175
|
+
});
|
|
176
|
+
it('120. noOverlay still locks body scrolling', async () => { const el = await fixture(html `<nile-drawer nooverlay></nile-drawer>`); await el.show(); expect(document.body.classList.contains('nile-scroll-lock')).to.be.true; await el.hide(); });
|
|
177
|
+
it('121. camelCase noOverlay in markup still works', async () => { const el = await fixture(html `<nile-drawer open noOverlay></nile-drawer>`); await el.updateComplete; expect(el.noOverlay).to.be.true; expect(getComputedStyle(el.shadowRoot.querySelector('.drawer__overlay')).backgroundColor).to.equal('rgba(0, 0, 0, 0)'); });
|
|
107
178
|
});
|
|
108
179
|
//# sourceMappingURL=nile-drawer.test.js.map
|