@frontile/overlays 0.15.0 → 0.16.0-alpha.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/addon-main.js +4 -0
- package/declarations/components/drawer/body.d.ts +15 -0
- package/declarations/components/drawer/body.d.ts.map +1 -0
- package/declarations/components/drawer/footer.d.ts +15 -0
- package/declarations/components/drawer/footer.d.ts.map +1 -0
- package/{components → declarations/components}/drawer/header.d.ts +7 -2
- package/declarations/components/drawer/header.d.ts.map +1 -0
- package/{components → declarations/components}/drawer/index.d.ts +10 -8
- package/declarations/components/drawer/index.d.ts.map +1 -0
- package/{components → declarations/components}/modal/body.d.ts +5 -1
- package/declarations/components/modal/body.d.ts.map +1 -0
- package/{components → declarations/components}/modal/footer.d.ts +5 -1
- package/declarations/components/modal/footer.d.ts.map +1 -0
- package/{components → declarations/components}/modal/header.d.ts +5 -1
- package/declarations/components/modal/header.d.ts.map +1 -0
- package/{components → declarations/components}/modal/index.d.ts +10 -8
- package/declarations/components/modal/index.d.ts.map +1 -0
- package/{components → declarations/components}/overlay.d.ts +5 -1
- package/declarations/components/overlay.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +9 -0
- package/declarations/template-registry.d.ts.map +1 -0
- package/dist/_app_/components/drawer/body.js +1 -0
- package/dist/_app_/components/drawer/footer.js +1 -0
- package/dist/_app_/components/drawer/header.js +1 -0
- package/dist/_app_/components/drawer/index.js +1 -0
- package/dist/_app_/components/modal/body.js +1 -0
- package/dist/_app_/components/modal/footer.js +1 -0
- package/dist/_app_/components/modal/header.js +1 -0
- package/dist/_app_/components/modal/index.js +1 -0
- package/dist/_app_/components/overlay.js +1 -0
- package/dist/components/drawer/body.js +17 -0
- package/dist/components/drawer/body.js.map +1 -0
- package/dist/components/drawer/footer.js +17 -0
- package/dist/components/drawer/footer.js.map +1 -0
- package/dist/components/drawer/header.js +17 -0
- package/dist/components/drawer/header.js.map +1 -0
- package/dist/components/drawer/index.js +50 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/modal/body.js +17 -0
- package/dist/components/modal/body.js.map +1 -0
- package/dist/components/modal/footer.js +17 -0
- package/dist/components/modal/footer.js.map +1 -0
- package/dist/components/modal/header.js +17 -0
- package/dist/components/modal/header.js.map +1 -0
- package/dist/components/modal/index.js +45 -0
- package/dist/components/modal/index.js.map +1 -0
- package/dist/components/overlay.js +182 -0
- package/dist/components/overlay.js.map +1 -0
- package/dist/template-registry.js +2 -0
- package/dist/template-registry.js.map +1 -0
- package/package.json +84 -51
- package/-private/dom.d.ts +0 -5
- package/addon/-private/dom.d.ts +0 -5
- package/addon/-private/dom.js +0 -61
- package/addon/components/drawer/body.hbs +0 -6
- package/addon/components/drawer/body.ts +0 -12
- package/addon/components/drawer/demo/composition.md +0 -94
- package/addon/components/drawer/demo/placements.md +0 -60
- package/addon/components/drawer/demo/sizes.md +0 -60
- package/addon/components/drawer/demo/usage.md +0 -73
- package/addon/components/drawer/footer.hbs +0 -6
- package/addon/components/drawer/footer.ts +0 -12
- package/addon/components/drawer/header.hbs +0 -7
- package/addon/components/drawer/header.ts +0 -16
- package/addon/components/drawer/index.hbs +0 -43
- package/addon/components/drawer/index.md +0 -9
- package/addon/components/drawer/index.ts +0 -94
- package/addon/components/modal/body.hbs +0 -6
- package/addon/components/modal/body.ts +0 -11
- package/addon/components/modal/demo/sizes.md +0 -61
- package/addon/components/modal/demo/usage.md +0 -73
- package/addon/components/modal/footer.hbs +0 -6
- package/addon/components/modal/footer.ts +0 -11
- package/addon/components/modal/header.hbs +0 -7
- package/addon/components/modal/header.ts +0 -16
- package/addon/components/modal/index.hbs +0 -43
- package/addon/components/modal/index.md +0 -9
- package/addon/components/modal/index.ts +0 -84
- package/addon/components/overlay-demo/usage.md +0 -42
- package/addon/components/overlay.hbs +0 -68
- package/addon/components/overlay.md +0 -24
- package/addon/components/overlay.ts +0 -217
- package/app/components/drawer/body.js +0 -1
- package/app/components/drawer/footer.js +0 -1
- package/app/components/drawer/header.js +0 -1
- package/app/components/drawer.js +0 -1
- package/app/components/modal/body.js +0 -1
- package/app/components/modal/footer.js +0 -1
- package/app/components/modal/header.js +0 -1
- package/app/components/modal.js +0 -1
- package/app/components/overlay.js +0 -1
- package/components/drawer/body.d.ts +0 -10
- package/components/drawer/footer.d.ts +0 -10
- package/config/environment.js +0 -5
- package/index.js +0 -5
- package/tsconfig.json +0 -23
- package/types/dummy/index.d.ts +0 -0
- package/types/global.d.ts +0 -6
- package/types/index.d.ts +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
+
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
|
|
4
|
+
import '@babel/runtime/helpers/esm/initializerWarningHelper';
|
|
5
|
+
import Component from '@glimmer/component';
|
|
6
|
+
import { tracked } from '@glimmer/tracking';
|
|
7
|
+
import { action } from '@ember/object';
|
|
8
|
+
import { later } from '@ember/runloop';
|
|
9
|
+
import { on } from '@ember/modifier';
|
|
10
|
+
import { getOwner } from '@ember/application';
|
|
11
|
+
import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
|
|
12
|
+
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
13
|
+
import willDestroy from '@ember/render-modifiers/modifiers/will-destroy';
|
|
14
|
+
import { cssTransition } from 'ember-css-transitions';
|
|
15
|
+
import { focusTrap } from 'ember-focus-trap';
|
|
16
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
17
|
+
import { setComponentTemplate } from '@ember/component';
|
|
18
|
+
import templateOnly from '@ember/component/template-only';
|
|
19
|
+
|
|
20
|
+
// adjusted from https://github.com/yapplabs/ember-wormhole/blob/0.5.4/addon/utils/dom.js#L45-L63
|
|
21
|
+
// Copied from https://github.com/ember-intl/ember-intl/blob/a66560d0af9f08af20778a3eb3003045e19fbf16/addon/-private/utils/get-dom.js
|
|
22
|
+
//
|
|
23
|
+
// Private Ember API usage. Get the dom implementation used by the current
|
|
24
|
+
// renderer, be it native browser DOM or Fastboot SimpleDOM
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @hide
|
|
28
|
+
*/
|
|
29
|
+
function getDOM(context) {
|
|
30
|
+
let {
|
|
31
|
+
renderer
|
|
32
|
+
} = context;
|
|
33
|
+
if (!renderer || !renderer._dom) {
|
|
34
|
+
// pre glimmer2
|
|
35
|
+
const container = getOwner ? getOwner(context) : context.container;
|
|
36
|
+
const documentService = container.lookup('service:-document');
|
|
37
|
+
if (documentService) {
|
|
38
|
+
return documentService;
|
|
39
|
+
}
|
|
40
|
+
renderer = container.lookup('renderer:-dom');
|
|
41
|
+
}
|
|
42
|
+
if (renderer._dom && renderer._dom.document) {
|
|
43
|
+
// pre Ember 2.6
|
|
44
|
+
return renderer._dom.document;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function childNodesOfElement(element) {
|
|
49
|
+
const children = [];
|
|
50
|
+
let child = element.firstChild;
|
|
51
|
+
while (child) {
|
|
52
|
+
children.push(child);
|
|
53
|
+
child = child.nextSibling;
|
|
54
|
+
}
|
|
55
|
+
return children;
|
|
56
|
+
}
|
|
57
|
+
function getElementById(doc, id) {
|
|
58
|
+
if (doc.getElementById) {
|
|
59
|
+
return doc.getElementById(id);
|
|
60
|
+
}
|
|
61
|
+
let nodes = childNodesOfElement(doc);
|
|
62
|
+
let node;
|
|
63
|
+
while (nodes.length) {
|
|
64
|
+
node = nodes.shift();
|
|
65
|
+
if (node.getAttribute && node.getAttribute('id') === id) {
|
|
66
|
+
return node;
|
|
67
|
+
}
|
|
68
|
+
nodes = childNodesOfElement(node).concat(nodes);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var _class, _descriptor, _class2;
|
|
73
|
+
const MaybeInElement = setComponentTemplate(precompileTemplate("\n {{#if @renderInPlace}}\n {{yield}}\n {{else if @destinationElement}}\n {{#in-element @destinationElement insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n", {
|
|
74
|
+
strictMode: true
|
|
75
|
+
}), templateOnly());
|
|
76
|
+
let Overlay = (_class = (_class2 = class Overlay extends Component {
|
|
77
|
+
constructor(...args) {
|
|
78
|
+
super(...args);
|
|
79
|
+
_initializerDefineProperty(this, "keepOpen", _descriptor, this);
|
|
80
|
+
_defineProperty(this, "contentElement", void 0);
|
|
81
|
+
_defineProperty(this, "mouseDownContentElement", null);
|
|
82
|
+
}
|
|
83
|
+
get destinationElement() {
|
|
84
|
+
const doc1 = getDOM(this);
|
|
85
|
+
if (!doc1) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
if (this.args.destinationElementId) {
|
|
89
|
+
return getElementById(doc1, this.args.destinationElementId);
|
|
90
|
+
} else {
|
|
91
|
+
return doc1.body;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
get isVisible() {
|
|
95
|
+
return this.args.isOpen || this.keepOpen;
|
|
96
|
+
}
|
|
97
|
+
get isBackdropVisible() {
|
|
98
|
+
return Boolean(this.args.isOpen && this.args.disableBackdrop !== true);
|
|
99
|
+
}
|
|
100
|
+
get isAnimationEnabled() {
|
|
101
|
+
return !(this.args.disableTransitions === true);
|
|
102
|
+
}
|
|
103
|
+
get focusTrapOptions() {
|
|
104
|
+
return this.args.focusTrapOptions || {
|
|
105
|
+
allowOutsideClick: true
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
handleOverlayClick() {
|
|
109
|
+
if (this.args.closeOnOutsideClick !== false) {
|
|
110
|
+
this.handleClose();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
handleContentClick(event1) {
|
|
114
|
+
if (this.args.closeOnOutsideClick !== false && event1.target === this.contentElement && this.mouseDownContentElement == this.contentElement) {
|
|
115
|
+
this.handleClose();
|
|
116
|
+
}
|
|
117
|
+
this.mouseDownContentElement = null;
|
|
118
|
+
}
|
|
119
|
+
handleClose() {
|
|
120
|
+
if (typeof this.args.onClose === 'function') {
|
|
121
|
+
this.args.onClose();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
handleContentMouseDown(event1) {
|
|
125
|
+
this.mouseDownContentElement = event1.target;
|
|
126
|
+
}
|
|
127
|
+
handleKeyDown(event1) {
|
|
128
|
+
if (event1.key === 'Escape' && this.args.closeOnEscapeKey !== false) {
|
|
129
|
+
this.handleClose();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
setup(element1) {
|
|
133
|
+
this.contentElement = element1;
|
|
134
|
+
this.keepOpen = true;
|
|
135
|
+
if (this.args.renderInPlace !== true) {
|
|
136
|
+
document.body.style.overflow = 'hidden';
|
|
137
|
+
}
|
|
138
|
+
if (typeof this.args.onOpen === 'function') {
|
|
139
|
+
this.args.onOpen();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
teardown() {
|
|
143
|
+
this.contentElement = undefined;
|
|
144
|
+
if (this.args.renderInPlace !== true && document.body.classList) {
|
|
145
|
+
document.body.style.overflow = '';
|
|
146
|
+
}
|
|
147
|
+
let duration1 = this.args.transitionDuration || 200;
|
|
148
|
+
if (this.args.disableTransitions === true) {
|
|
149
|
+
duration1 = 0;
|
|
150
|
+
}
|
|
151
|
+
const {
|
|
152
|
+
didClose: didClose1
|
|
153
|
+
} = this.args;
|
|
154
|
+
later(() => {
|
|
155
|
+
if (!this.isDestroyed) this.keepOpen = false;
|
|
156
|
+
if (typeof didClose1 === 'function' && !this.isDestroyed) {
|
|
157
|
+
didClose1();
|
|
158
|
+
}
|
|
159
|
+
}, duration1);
|
|
160
|
+
}
|
|
161
|
+
}, setComponentTemplate(precompileTemplate("\n {{#if this.isVisible}}\n <MaybeInElement @renderInPlace={{@renderInPlace}} @destinationElement={{this.destinationElement}}>\n <div class={{useFrontileClass \"overlay\" (if @renderInPlace \"in-place\")}} ...attributes {{focusTrap isActive=(if @disableFocusTrap false @isOpen) focusTrapOptions=this.focusTrapOptions}}>\n {{!-- template-lint-disable no-invalid-interactive --}}\n {{#if this.isBackdropVisible}}\n <div class={{useFrontileClass \"overlay\" (if @renderInPlace \"in-place\") part=\"backdrop\"}} {{on \"click\" this.handleOverlayClick}} {{cssTransition (if @backdropTransitionName @backdropTransitionName \"overlay-transition--fade\") isEnabled=this.isAnimationEnabled}}></div>\n {{/if}}\n\n {{!--\n This is required to make css-transition work with 2\n sibling elements been removed at the same time.\n --}}\n <span data-is-visible={{this.isVisible}}></span>\n\n {{#if @isOpen}}\n {{!-- template-lint-disable no-pointer-down-event-binding --}}\n <div class={{useFrontileClass \"overlay\" (if @renderInPlace \"in-place\") part=\"content\"}} {{on \"click\" this.handleContentClick}} {{on \"keydown\" this.handleKeyDown}} {{on \"mousedown\" this.handleContentMouseDown}} {{didInsert this.setup}} {{willDestroy this.teardown}} {{cssTransition (if @contentTransitionName @contentTransitionName \"overlay-transition--fade\") isEnabled=this.isAnimationEnabled}}>\n {{!-- template-lint-enable no-pointer-down-event-binding --}}\n {{yield}}\n </div>\n {{/if}}\n {{!-- template-lint-enable no-invalid-interactive --}}\n </div>\n </MaybeInElement>\n {{/if}}\n ", {
|
|
162
|
+
scope: () => ({
|
|
163
|
+
MaybeInElement,
|
|
164
|
+
useFrontileClass,
|
|
165
|
+
focusTrap,
|
|
166
|
+
on,
|
|
167
|
+
cssTransition,
|
|
168
|
+
didInsert,
|
|
169
|
+
willDestroy
|
|
170
|
+
}),
|
|
171
|
+
strictMode: true
|
|
172
|
+
}), _class2), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "keepOpen", [tracked], {
|
|
173
|
+
configurable: true,
|
|
174
|
+
enumerable: true,
|
|
175
|
+
writable: true,
|
|
176
|
+
initializer: function () {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}), _applyDecoratedDescriptor(_class.prototype, "handleOverlayClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleOverlayClick"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleContentClick", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleContentClick"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleClose", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleClose"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleContentMouseDown", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleContentMouseDown"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleKeyDown", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleKeyDown"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "setup", [action], Object.getOwnPropertyDescriptor(_class.prototype, "setup"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "teardown", [action], Object.getOwnPropertyDescriptor(_class.prototype, "teardown"), _class.prototype)), _class);
|
|
180
|
+
|
|
181
|
+
export { Overlay as default };
|
|
182
|
+
//# sourceMappingURL=overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.js","sources":["../../src/-private/dom.js","../../src/components/overlay.gts"],"sourcesContent":["import { getOwner } from '@ember/application';\n\n// adjusted from https://github.com/yapplabs/ember-wormhole/blob/0.5.4/addon/utils/dom.js#L45-L63\n// Copied from https://github.com/ember-intl/ember-intl/blob/a66560d0af9f08af20778a3eb3003045e19fbf16/addon/-private/utils/get-dom.js\n//\n// Private Ember API usage. Get the dom implementation used by the current\n// renderer, be it native browser DOM or Fastboot SimpleDOM\n/**\n * @private\n * @hide\n */\nexport function getDOM(context) {\n let { renderer } = context;\n if (!renderer || !renderer._dom) {\n // pre glimmer2\n const container = getOwner ? getOwner(context) : context.container;\n const documentService = container.lookup('service:-document');\n\n if (documentService) {\n return documentService;\n }\n\n renderer = container.lookup('renderer:-dom');\n }\n\n if (renderer._dom && renderer._dom.document) {\n // pre Ember 2.6\n return renderer._dom.document;\n }\n\n return null;\n}\n\nfunction childNodesOfElement(element) {\n const children = [];\n let child = element.firstChild;\n while (child) {\n children.push(child);\n child = child.nextSibling;\n }\n return children;\n}\n\nexport function getElementById(doc, id) {\n if (doc.getElementById) {\n return doc.getElementById(id);\n }\n\n let nodes = childNodesOfElement(doc);\n let node;\n\n while (nodes.length) {\n node = nodes.shift();\n\n if (node.getAttribute && node.getAttribute('id') === id) {\n return node;\n }\n\n nodes = childNodesOfElement(node).concat(nodes);\n }\n}\n","import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { getDOM, getElementById } from '../-private/dom';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport willDestroy from '@ember/render-modifiers/modifiers/will-destroy';\nimport { cssTransition } from 'ember-css-transitions';\n// @ts-ignore\nimport { focusTrap } from 'ember-focus-trap';\nimport type { TOC } from '@ember/component/template-only';\nconst MaybeInElement: TOC<{\n Args: {\n destinationElement?: Element | null;\n renderInPlace?: boolean;\n };\n Blocks: {\n default: [];\n };\n}> = template(`\n {{#if @renderInPlace}}\n {{yield}}\n {{else if @destinationElement}}\n {{#in-element @destinationElement insertBefore=null}}\n {{yield}}\n {{/in-element}}\n {{/if}}\n`, {\n eval () {\n return eval(arguments[0]);\n }\n});\nexport interface OverlayArgs {\n /**\n * Whether to render in place or in the specified/default destination\n *\n * @defaultValue false\n */ renderInPlace?: boolean;\n /**\n * The destination where the overlay will be inserted, defaults to\n * `document.body`\n *\n * @defaultValue undefined\n */ destinationElementId?: string;\n /**\n * Duration of the animation\n *\n * @defaultValue 200\n */ transitionDuration?: number;\n /**\n * Whether to hide the backdrop or not\n *\n * @defaultValue false\n */ disableBackdrop?: boolean;\n /**\n * Disable css transitions\n *\n * @defaultValue false\n */ disableTransitions?: boolean;\n /**\n * Whether the focus trap is disabled or not\n *\n * @defaultValue false\n */ disableFocusTrap?: boolean;\n /**\n * Focus trap options\n *\n * @defaultValue { allowOutsideClick: true }\n */ focusTrapOptions?: unknown;\n /**\n * Whether it is open or not\n */ isOpen: boolean;\n /**\n * A function that will be called when closed\n */ onClose?: () => void;\n /**\n * A function that will be called when closing is finished executing, this\n * includes waiting for animations/transitions to finish.\n */ didClose?: () => void;\n /**\n * A function that will be called when opened\n */ onOpen?: () => void;\n /**\n * Whether to close when the area outside (the backdrop) is clicked\n *\n * @defaultValue true\n */ closeOnOutsideClick?: boolean;\n /**\n * Whether to close when the escape key is pressed\n *\n * @defaultValue true\n */ closeOnEscapeKey?: boolean;\n /**\n * The name of the transition to be used in the backdrop.\n *\n * @defaultValue 'overlay-transition--fade'\n */ backdropTransitionName?: string;\n /**\n * The name of the transition to be used in the content.\n *\n * @defaultValue 'overlay-transition--fade'\n */ contentTransitionName?: string;\n}\nexport interface OverlaySignature {\n Args: OverlayArgs;\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\nexport default class Overlay extends Component<OverlaySignature> {\n @tracked\n keepOpen = false;\n contentElement: HTMLElement | undefined;\n mouseDownContentElement: EventTarget | null = null;\n get destinationElement(): HTMLElement | null {\n const doc1 = getDOM(this);\n if (!doc1) {\n return null;\n }\n if (this.args.destinationElementId) {\n return getElementById(doc1, this.args.destinationElementId);\n } else {\n return doc1.body;\n }\n }\n get isVisible(): boolean {\n return this.args.isOpen || this.keepOpen;\n }\n get isBackdropVisible(): boolean {\n return Boolean(this.args.isOpen && this.args.disableBackdrop !== true);\n }\n get isAnimationEnabled(): boolean {\n return !(this.args.disableTransitions === true);\n }\n get focusTrapOptions(): unknown {\n return this.args.focusTrapOptions || {\n allowOutsideClick: true\n };\n }\n @action\n handleOverlayClick(): void {\n if (this.args.closeOnOutsideClick !== false) {\n this.handleClose();\n }\n }\n @action\n handleContentClick(event1: MouseEvent): void {\n if (this.args.closeOnOutsideClick !== false && event1.target === this.contentElement && this.mouseDownContentElement == this.contentElement) {\n this.handleClose();\n }\n this.mouseDownContentElement = null;\n }\n @action\n handleClose(): void {\n if (typeof this.args.onClose === 'function') {\n this.args.onClose();\n }\n }\n @action\n handleContentMouseDown(event1: MouseEvent): void {\n this.mouseDownContentElement = event1.target;\n }\n @action\n handleKeyDown(event1: KeyboardEvent): void {\n if (event1.key === 'Escape' && this.args.closeOnEscapeKey !== false) {\n this.handleClose();\n }\n }\n @action\n setup(element1: HTMLElement): void {\n this.contentElement = element1;\n this.keepOpen = true;\n if (this.args.renderInPlace !== true) {\n document.body.style.overflow = 'hidden';\n }\n if (typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n @action\n teardown(): void {\n this.contentElement = undefined;\n if (this.args.renderInPlace !== true && document.body.classList) {\n document.body.style.overflow = '';\n }\n let duration1 = this.args.transitionDuration || 200;\n if (this.args.disableTransitions === true) {\n duration1 = 0;\n }\n const { didClose: didClose1 } = this.args;\n later(()=>{\n if (!this.isDestroyed) this.keepOpen = false;\n if (typeof didClose1 === 'function' && !this.isDestroyed) {\n didClose1();\n }\n }, duration1);\n }\n static{\n template(`\n {{#if this.isVisible}}\n <MaybeInElement\n @renderInPlace={{@renderInPlace}}\n @destinationElement={{this.destinationElement}}\n >\n <div\n class={{useFrontileClass \"overlay\" (if @renderInPlace \"in-place\")}}\n ...attributes\n {{focusTrap\n isActive=(if @disableFocusTrap false @isOpen)\n focusTrapOptions=this.focusTrapOptions\n }}\n >\n {{! template-lint-disable no-invalid-interactive }}\n {{#if this.isBackdropVisible}}\n <div\n class={{useFrontileClass\n \"overlay\"\n (if @renderInPlace \"in-place\")\n part=\"backdrop\"\n }}\n {{on \"click\" this.handleOverlayClick}}\n {{cssTransition\n (if\n @backdropTransitionName\n @backdropTransitionName\n \"overlay-transition--fade\"\n )\n isEnabled=this.isAnimationEnabled\n }}\n ></div>\n {{/if}}\n\n {{!\n This is required to make css-transition work with 2\n sibling elements been removed at the same time.\n }}\n <span data-is-visible={{this.isVisible}}></span>\n\n {{#if @isOpen}}\n {{! template-lint-disable no-pointer-down-event-binding }}\n <div\n class={{useFrontileClass\n \"overlay\"\n (if @renderInPlace \"in-place\")\n part=\"content\"\n }}\n {{on \"click\" this.handleContentClick}}\n {{on \"keydown\" this.handleKeyDown}}\n {{on \"mousedown\" this.handleContentMouseDown}}\n {{didInsert this.setup}}\n {{willDestroy this.teardown}}\n {{cssTransition\n (if\n @contentTransitionName\n @contentTransitionName\n \"overlay-transition--fade\"\n )\n isEnabled=this.isAnimationEnabled\n }}\n >\n {{! template-lint-enable no-pointer-down-event-binding }}\n {{yield}}\n </div>\n {{/if}}\n {{! template-lint-enable no-invalid-interactive }}\n </div>\n </MaybeInElement>\n {{/if}}\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["getDOM","context","renderer","_dom","container","getOwner","documentService","lookup","document","childNodesOfElement","element","children","child","firstChild","push","nextSibling","getElementById","doc","id","nodes","node","length","shift","getAttribute","concat","MaybeInElement","setComponentTemplate","precompileTemplate","strictMode","templateOnly","Overlay","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","_defineProperty","destinationElement","doc1","destinationElementId","body","isVisible","isOpen","keepOpen","isBackdropVisible","Boolean","disableBackdrop","isAnimationEnabled","disableTransitions","focusTrapOptions","allowOutsideClick","handleOverlayClick","closeOnOutsideClick","handleClose","handleContentClick","event1","target","contentElement","mouseDownContentElement","onClose","handleContentMouseDown","handleKeyDown","key","closeOnEscapeKey","setup","element1","renderInPlace","style","overflow","onOpen","teardown","undefined","classList","duration1","transitionDuration","didClose","didClose1","later","isDestroyed","scope","useFrontileClass","focusTrap","on","cssTransition","didInsert","willDestroy","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAMA,CAACC,OAAO,EAAE;EAC9B,IAAI;AAAEC,IAAAA,QAAAA;AAA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AAA,CAAA0D,SAAA,CAAA,EAAAD,yBAAA,CAAAzD,MAAA,CAAA0D,SAAA,EAONM,aAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAA0D,SAAA,EAAA,aAAA,CAAA,EAAA1D,MAAA,CAAA0D,SAAA,CAAAD,EAAAA,yBAAA,CAAAzD,MAAA,CAAA0D,SAAA,EAMNM,wBAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAA0D,SAAA,EAAA,wBAAA,CAAA,EAAA1D,MAAA,CAAA0D,SAAA,CAAAD,EAAAA,yBAAA,CAAAzD,MAAA,CAAA0D,SAAA,oBAINM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAA0D,SAAA,EAAA1D,eAAAA,CAAAA,EAAAA,MAAA,CAAA0D,SAAA,CAAAD,EAAAA,yBAAA,CAAAzD,MAAA,CAAA0D,SAAA,EAAA,OAAA,EAAA,CAMNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAA0D,SAAA,EAAA1D,OAAAA,CAAAA,EAAAA,MAAA,CAAA0D,SAAA,CAAAD,EAAAA,yBAAA,CAAAzD,MAAA,CAAA0D,SAAA,EAAA,UAAA,EAAA,CAWNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAA0D,SAAA,EAAA1D,UAAAA,CAAAA,EAAAA,MAAA,CAAA0D,SAAA,IAAA1D,MAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-registry.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontile/overlays",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0-alpha.0",
|
|
4
4
|
"description": "Component Library for Ember Octane apps: overlays",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -13,67 +13,63 @@
|
|
|
13
13
|
"doc": "doc",
|
|
14
14
|
"test": "tests"
|
|
15
15
|
},
|
|
16
|
+
"files": [
|
|
17
|
+
"addon-main.js",
|
|
18
|
+
"declarations",
|
|
19
|
+
"dist",
|
|
20
|
+
"tailwind"
|
|
21
|
+
],
|
|
16
22
|
"scripts": {
|
|
17
|
-
"build": "
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
23
|
+
"build": "concurrently -m 1 'npm:build:*'",
|
|
24
|
+
"build:js": "rollup --config",
|
|
25
|
+
"build:types": "glint --declaration",
|
|
26
|
+
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
|
|
27
|
+
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
|
|
28
|
+
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
|
|
29
|
+
"lint:js": "eslint . --cache",
|
|
30
|
+
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
|
|
31
|
+
"lint:js:fix": "eslint . --fix",
|
|
32
|
+
"lint:types": "glint",
|
|
33
|
+
"start": "concurrently 'npm:start:*'",
|
|
34
|
+
"start:js": "rollup --config --watch --no-watch.clearScreen",
|
|
35
|
+
"start:types": "glint -d --watch",
|
|
36
|
+
"test": "echo 'A v2 addon does not have tests, run tests in test-app'",
|
|
37
|
+
"prepack": "concurrently 'npm:build'"
|
|
24
38
|
},
|
|
25
39
|
"peerDependencies": {
|
|
40
|
+
"@babel/runtime": ">= 7",
|
|
26
41
|
"ember-source": "^4.0.0 || ^5.0.0"
|
|
27
42
|
},
|
|
28
43
|
"dependencies": {
|
|
29
44
|
"@ember/render-modifiers": "^2.1.0",
|
|
30
|
-
"@
|
|
45
|
+
"@embroider/addon-shim": "^1.8.7",
|
|
46
|
+
"@frontile/core": "^0.16.0-alpha.0",
|
|
31
47
|
"@frontile/tailwindcss-plugin-helpers": "^0.15.0",
|
|
32
|
-
"ember-
|
|
33
|
-
"ember-
|
|
34
|
-
"ember-cli-htmlbars": "^6.2.0",
|
|
35
|
-
"ember-cli-typescript": "^5.2.1",
|
|
36
|
-
"ember-css-transitions": "^4.3.2",
|
|
37
|
-
"ember-focus-trap": "^1.0.2",
|
|
38
|
-
"ember-maybe-in-element": "^2.1.0"
|
|
48
|
+
"ember-css-transitions": "^4.4.0",
|
|
49
|
+
"ember-focus-trap": "^1.0.2"
|
|
39
50
|
},
|
|
40
51
|
"devDependencies": {
|
|
41
|
-
"@babel/core": "
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"ember-cli-fastboot": "^4.1.1",
|
|
58
|
-
"ember-cli-inject-live-reload": "^2.1.0",
|
|
59
|
-
"ember-cli-sri": "^2.1.1",
|
|
60
|
-
"ember-cli-typescript-blueprints": "^3.0.0",
|
|
61
|
-
"ember-cli-uglify": "^3.0.0",
|
|
62
|
-
"ember-disable-prototype-extensions": "^1.1.3",
|
|
63
|
-
"ember-load-initializers": "^2.1.2",
|
|
64
|
-
"ember-qunit": "^7.0.0",
|
|
65
|
-
"ember-resolver": "^11.0.0",
|
|
66
|
-
"ember-source": "^5.1.2",
|
|
67
|
-
"ember-try": "^2.0.0",
|
|
68
|
-
"loader.js": "^4.7.0",
|
|
69
|
-
"qunit": "^2.19.4",
|
|
70
|
-
"qunit-dom": "^2.0.0",
|
|
52
|
+
"@babel/core": "7.23.6",
|
|
53
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
54
|
+
"@babel/plugin-proposal-decorators": "7.23.6",
|
|
55
|
+
"@babel/plugin-transform-class-static-block": "^7.23.4",
|
|
56
|
+
"@babel/preset-typescript": "7.23.3",
|
|
57
|
+
"@embroider/addon-dev": "4.1.3",
|
|
58
|
+
"@glint/core": "1.2.1",
|
|
59
|
+
"@glint/environment-ember-loose": "1.2.1",
|
|
60
|
+
"@glint/environment-ember-template-imports": "1.2.1",
|
|
61
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
62
|
+
"@tsconfig/ember": "^3.0.3",
|
|
63
|
+
"babel-plugin-ember-template-compilation": "^2.2.1",
|
|
64
|
+
"concurrently": "^8.2.0",
|
|
65
|
+
"ember-source": "^5.5.0",
|
|
66
|
+
"rollup": "^4.9.1",
|
|
67
|
+
"rollup-plugin-ts": "^3.4.5",
|
|
71
68
|
"tailwindcss": "^3.3.3",
|
|
72
|
-
"typescript": "^5.
|
|
73
|
-
"webpack": "^5.88.2"
|
|
69
|
+
"typescript": "^5.3.3"
|
|
74
70
|
},
|
|
75
71
|
"engines": {
|
|
76
|
-
"node": "10.*
|
|
72
|
+
"node": ">= 10.*"
|
|
77
73
|
},
|
|
78
74
|
"publishConfig": {
|
|
79
75
|
"access": "public"
|
|
@@ -82,7 +78,44 @@
|
|
|
82
78
|
"edition": "octane"
|
|
83
79
|
},
|
|
84
80
|
"ember-addon": {
|
|
85
|
-
"
|
|
81
|
+
"version": 2,
|
|
82
|
+
"type": "addon",
|
|
83
|
+
"main": "addon-main.js",
|
|
84
|
+
"app-js": {
|
|
85
|
+
"./components/drawer/body.js": "./dist/_app_/components/drawer/body.js",
|
|
86
|
+
"./components/drawer/footer.js": "./dist/_app_/components/drawer/footer.js",
|
|
87
|
+
"./components/drawer/header.js": "./dist/_app_/components/drawer/header.js",
|
|
88
|
+
"./components/drawer/index.js": "./dist/_app_/components/drawer/index.js",
|
|
89
|
+
"./components/modal/body.js": "./dist/_app_/components/modal/body.js",
|
|
90
|
+
"./components/modal/footer.js": "./dist/_app_/components/modal/footer.js",
|
|
91
|
+
"./components/modal/header.js": "./dist/_app_/components/modal/header.js",
|
|
92
|
+
"./components/modal/index.js": "./dist/_app_/components/modal/index.js",
|
|
93
|
+
"./components/overlay.js": "./dist/_app_/components/overlay.js"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"exports": {
|
|
97
|
+
".": {
|
|
98
|
+
"types": "./declarations/index.d.ts",
|
|
99
|
+
"default": "./dist/index.js"
|
|
100
|
+
},
|
|
101
|
+
"./*": {
|
|
102
|
+
"types": "./declarations/*.d.ts",
|
|
103
|
+
"default": "./dist/*.js"
|
|
104
|
+
},
|
|
105
|
+
"./addon-main.js": "./addon-main.js",
|
|
106
|
+
"./tailwind": {
|
|
107
|
+
"default": "./tailwind/index.js"
|
|
108
|
+
},
|
|
109
|
+
"./tailwind/*": {
|
|
110
|
+
"default": "./tailwind/*.js"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"typesVersions": {
|
|
114
|
+
"*": {
|
|
115
|
+
"*": [
|
|
116
|
+
"declarations/*"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
86
119
|
},
|
|
87
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "c1f2fb51b859e18d1bcb94090055ad9c1128d4d3"
|
|
88
121
|
}
|
package/-private/dom.d.ts
DELETED
package/addon/-private/dom.d.ts
DELETED
package/addon/-private/dom.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { getOwner } from '@ember/application';
|
|
2
|
-
|
|
3
|
-
// adjusted from https://github.com/yapplabs/ember-wormhole/blob/0.5.4/addon/utils/dom.js#L45-L63
|
|
4
|
-
// Copied from https://github.com/ember-intl/ember-intl/blob/a66560d0af9f08af20778a3eb3003045e19fbf16/addon/-private/utils/get-dom.js
|
|
5
|
-
//
|
|
6
|
-
// Private Ember API usage. Get the dom implementation used by the current
|
|
7
|
-
// renderer, be it native browser DOM or Fastboot SimpleDOM
|
|
8
|
-
/**
|
|
9
|
-
* @private
|
|
10
|
-
* @hide
|
|
11
|
-
*/
|
|
12
|
-
export function getDOM(context) {
|
|
13
|
-
let { renderer } = context;
|
|
14
|
-
if (!renderer || !renderer._dom) {
|
|
15
|
-
// pre glimmer2
|
|
16
|
-
const container = getOwner ? getOwner(context) : context.container;
|
|
17
|
-
const documentService = container.lookup('service:-document');
|
|
18
|
-
|
|
19
|
-
if (documentService) {
|
|
20
|
-
return documentService;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
renderer = container.lookup('renderer:-dom');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (renderer._dom && renderer._dom.document) {
|
|
27
|
-
// pre Ember 2.6
|
|
28
|
-
return renderer._dom.document;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function childNodesOfElement(element) {
|
|
35
|
-
const children = [];
|
|
36
|
-
let child = element.firstChild;
|
|
37
|
-
while (child) {
|
|
38
|
-
children.push(child);
|
|
39
|
-
child = child.nextSibling;
|
|
40
|
-
}
|
|
41
|
-
return children;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function getElementById(doc, id) {
|
|
45
|
-
if (doc.getElementById) {
|
|
46
|
-
return doc.getElementById(id);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let nodes = childNodesOfElement(doc);
|
|
50
|
-
let node;
|
|
51
|
-
|
|
52
|
-
while (nodes.length) {
|
|
53
|
-
node = nodes.shift();
|
|
54
|
-
|
|
55
|
-
if (node.getAttribute && node.getAttribute('id') === id) {
|
|
56
|
-
return node;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
nodes = childNodesOfElement(node).concat(nodes);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { DrawerArgs } from '.';
|
|
3
|
-
|
|
4
|
-
export interface DrawerBodyArgs
|
|
5
|
-
extends Pick<DrawerArgs, 'size' | 'placement'> {}
|
|
6
|
-
|
|
7
|
-
export interface DrawerBodySignature {
|
|
8
|
-
Args: DrawerBodyArgs;
|
|
9
|
-
Element: HTMLDivElement | null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default class DrawerBody extends Component<DrawerBodySignature> {}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 4
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Combining Placement and Size
|
|
6
|
-
|
|
7
|
-
As an composition example, you can set the Drawer to a given placement and size at the same time.
|
|
8
|
-
|
|
9
|
-
```hbs template
|
|
10
|
-
<FormRadioGroup
|
|
11
|
-
@isInline={{true}}
|
|
12
|
-
@label="Placement"
|
|
13
|
-
@value={{this.placement}}
|
|
14
|
-
@onChange={{this.setPlacement}}
|
|
15
|
-
as |Radio|
|
|
16
|
-
>
|
|
17
|
-
{{#each this.placements as |placement|}}
|
|
18
|
-
<Radio @value={{placement}} @label={{placement}} />
|
|
19
|
-
{{/each}}
|
|
20
|
-
</FormRadioGroup>
|
|
21
|
-
|
|
22
|
-
<FormRadioGroup
|
|
23
|
-
@containerClass="mt-2"
|
|
24
|
-
@isInline={{true}}
|
|
25
|
-
@label="Size"
|
|
26
|
-
@value={{this.size}}
|
|
27
|
-
@onChange={{this.setSize}}
|
|
28
|
-
as |Radio|
|
|
29
|
-
>
|
|
30
|
-
{{#each this.sizes as |size|}}
|
|
31
|
-
<Radio @value={{size}} @label={{size}} />
|
|
32
|
-
{{/each}}
|
|
33
|
-
</FormRadioGroup>
|
|
34
|
-
|
|
35
|
-
<Button
|
|
36
|
-
class="mt-6"
|
|
37
|
-
{{on "click" this.toggle}}
|
|
38
|
-
>
|
|
39
|
-
Open Drawer
|
|
40
|
-
</Button>
|
|
41
|
-
|
|
42
|
-
<Drawer
|
|
43
|
-
@isOpen={{this.isOpen}}
|
|
44
|
-
@placement={{this.placement}}
|
|
45
|
-
@size={{this.size}}
|
|
46
|
-
@onClose={{this.toggle}}
|
|
47
|
-
as |m|
|
|
48
|
-
>
|
|
49
|
-
<m.Header>Title</m.Header>
|
|
50
|
-
<m.Body>
|
|
51
|
-
<p>
|
|
52
|
-
Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis.
|
|
53
|
-
</p>
|
|
54
|
-
<p>
|
|
55
|
-
Sunt ad dolore quis aute consequat. Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam.
|
|
56
|
-
</p>
|
|
57
|
-
</m.Body>
|
|
58
|
-
<m.Footer>
|
|
59
|
-
<Button
|
|
60
|
-
class="mr-4"
|
|
61
|
-
{{on "click" this.toggle}}
|
|
62
|
-
>
|
|
63
|
-
Close
|
|
64
|
-
</Button>
|
|
65
|
-
</m.Footer>
|
|
66
|
-
</Drawer>
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
```js component
|
|
70
|
-
import Component from '@glimmer/component';
|
|
71
|
-
import { tracked } from '@glimmer/tracking';
|
|
72
|
-
import { action } from '@ember/object';
|
|
73
|
-
|
|
74
|
-
export default class Demo extends Component {
|
|
75
|
-
placements = ['top', 'bottom', 'left', 'right'];
|
|
76
|
-
sizes = ['xs', 'sm', 'md', 'lg', 'xl', 'full'];
|
|
77
|
-
|
|
78
|
-
@tracked isOpen = false;
|
|
79
|
-
@tracked placement = 'right';
|
|
80
|
-
@tracked size = 'md';
|
|
81
|
-
|
|
82
|
-
@action toggle() {
|
|
83
|
-
this.isOpen = !this.isOpen;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
@action setPlacement(placement) {
|
|
87
|
-
this.placement = placement;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@action setSize(size) {
|
|
91
|
-
this.size = size;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
```
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 3
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Placements
|
|
6
|
-
|
|
7
|
-
Use the `placement` argument to set the desired Drawer placement.
|
|
8
|
-
|
|
9
|
-
```hbs template
|
|
10
|
-
{{#each this.placements as |placement|}}
|
|
11
|
-
<Button
|
|
12
|
-
{{on "click" (fn this.toggle placement)}}
|
|
13
|
-
>
|
|
14
|
-
Open {{placement}}
|
|
15
|
-
</Button>
|
|
16
|
-
{{/each}}
|
|
17
|
-
|
|
18
|
-
<Drawer
|
|
19
|
-
@isOpen={{this.isOpen}}
|
|
20
|
-
@placement={{this.placement}}
|
|
21
|
-
@onClose={{this.toggle}}
|
|
22
|
-
as |m|
|
|
23
|
-
>
|
|
24
|
-
<m.Header>Title</m.Header>
|
|
25
|
-
<m.Body>
|
|
26
|
-
<p>
|
|
27
|
-
Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis.
|
|
28
|
-
</p>
|
|
29
|
-
<p>
|
|
30
|
-
Sunt ad dolore quis aute consequat. Magna exercitation reprehenderit magna aute tempor cupidatat consequat elit dolor adipisicing. Mollit dolor eiusmod sunt ex incididunt cillum quis. Velit duis sit officia eiusmod Lorem aliqua enim laboris do dolor eiusmod. Et mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident Lorem eiusmod et. Culpa deserunt nostrud ad veniam.
|
|
31
|
-
</p>
|
|
32
|
-
</m.Body>
|
|
33
|
-
<m.Footer>
|
|
34
|
-
<Button
|
|
35
|
-
class="mr-4"
|
|
36
|
-
{{on "click" this.toggle}}
|
|
37
|
-
>
|
|
38
|
-
Close
|
|
39
|
-
</Button>
|
|
40
|
-
</m.Footer>
|
|
41
|
-
</Drawer>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
```js component
|
|
45
|
-
import Component from '@glimmer/component';
|
|
46
|
-
import { tracked } from '@glimmer/tracking';
|
|
47
|
-
import { action } from '@ember/object';
|
|
48
|
-
|
|
49
|
-
export default class Demo extends Component {
|
|
50
|
-
placements = ['top', 'bottom', 'left', 'right'];
|
|
51
|
-
|
|
52
|
-
@tracked isOpen = false;
|
|
53
|
-
@tracked placement;
|
|
54
|
-
|
|
55
|
-
@action toggle(placement) {
|
|
56
|
-
this.isOpen = !this.isOpen;
|
|
57
|
-
this.placement = placement;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
```
|