@operato/popup 1.4.86 → 1.5.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [1.5.1](https://github.com/hatiolab/operato/compare/v1.5.0...v1.5.1) (2023-10-07)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * ox-prompt style ([7df21cb](https://github.com/hatiolab/operato/commit/7df21cb0af5870805f7a33015004a2fa1a1d6ed3))
12
+ * prompt style ([5b774f3](https://github.com/hatiolab/operato/commit/5b774f39bcba10172f3f69a88cebc0cfaee22ff8))
13
+
14
+
15
+
16
+ ## [1.5.0](https://github.com/hatiolab/operato/compare/v1.4.87...v1.5.0) (2023-10-07)
17
+
18
+
19
+ ### :rocket: New Features
20
+
21
+ * ox-prompt ([3434709](https://github.com/hatiolab/operato/commit/34347091634a19fae3ed7e856b08389e5262c246))
22
+
23
+
24
+
6
25
  ### [1.4.86](https://github.com/hatiolab/operato/compare/v1.4.85...v1.4.86) (2023-09-30)
7
26
 
8
27
 
@@ -0,0 +1,70 @@
1
+ import '@material/mwc-button';
2
+ import { LitElement } from 'lit';
3
+ export declare class OxPrompt extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ type?: 'success' | 'error' | 'warning' | 'info' | 'question';
6
+ icon?: string;
7
+ titler?: string;
8
+ text?: string;
9
+ footer?: string;
10
+ toast?: boolean;
11
+ confirmButton?: {
12
+ text: string;
13
+ color?: string;
14
+ };
15
+ cancelButton?: {
16
+ text: string;
17
+ color?: string;
18
+ };
19
+ callback?: Function;
20
+ _parent?: Element;
21
+ private resolveFn;
22
+ render(): import("lit-html").TemplateResult<1>;
23
+ onConfirm(): void;
24
+ onCancel(): void;
25
+ protected _onfocusout: (e: FocusEvent) => void;
26
+ protected _onkeydown: (e: KeyboardEvent) => void;
27
+ protected _onkeyup: (e: KeyboardEvent) => void;
28
+ protected _onmouseup: (e: MouseEvent) => void;
29
+ protected _onmousedown: (e: MouseEvent) => void;
30
+ protected _oncontext: (e: Event) => void;
31
+ protected _onclick: (e: MouseEvent) => void;
32
+ protected _onclose: (e: Event) => void;
33
+ protected _oncollapse: (e: Event) => void;
34
+ protected _onwindowblur: (e: Event) => void;
35
+ connectedCallback(): void;
36
+ static open({ template, type, icon, title, text, footer, confirmButton, cancelButton, top, left, right, bottom, width, height, parent }: {
37
+ template?: unknown;
38
+ type?: 'success' | 'error' | 'warning' | 'info' | 'question';
39
+ icon?: 'success' | 'error' | 'warning' | 'info' | 'question';
40
+ title?: string;
41
+ text?: string;
42
+ footer?: string;
43
+ confirmButton?: {
44
+ text: string;
45
+ color?: string;
46
+ };
47
+ cancelButton?: {
48
+ text: string;
49
+ color?: string;
50
+ };
51
+ top?: number;
52
+ left?: number;
53
+ right?: number;
54
+ bottom?: number;
55
+ width?: string;
56
+ height?: string;
57
+ parent?: Element | null;
58
+ }): Promise<boolean>;
59
+ open({ left, top, right, bottom, width, height, silent }: {
60
+ left?: number;
61
+ top?: number;
62
+ right?: number;
63
+ bottom?: number;
64
+ width?: string;
65
+ height?: string;
66
+ silent?: boolean;
67
+ }): Promise<boolean>;
68
+ guaranteeFocus(target?: HTMLElement): void;
69
+ close(): void;
70
+ }
@@ -0,0 +1,298 @@
1
+ import { __decorate } from "tslib";
2
+ import '@material/mwc-button';
3
+ import { css, html, nothing, LitElement } from 'lit';
4
+ import { render } from 'lit-html';
5
+ import { customElement, property, state } from 'lit/decorators.js';
6
+ let OxPrompt = class OxPrompt extends LitElement {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.titler = '';
10
+ this.resolveFn = null;
11
+ this._onfocusout = function (e) {
12
+ const to = e.relatedTarget;
13
+ if (!this.contains(to)) {
14
+ /* 분명히 내 범위가 아닌 엘리먼트로 포커스가 옮겨졌다면, ox-prompt은 닫혀야 한다. */
15
+ // @ts-ignore for debug
16
+ !window.POPUP_DEBUG && this.close();
17
+ }
18
+ }.bind(this);
19
+ this._onkeydown = function (e) {
20
+ e.stopPropagation();
21
+ switch (e.key) {
22
+ case 'Esc': // for IE/Edge
23
+ case 'Escape':
24
+ this.close();
25
+ break;
26
+ }
27
+ }.bind(this);
28
+ this._onkeyup = function (e) {
29
+ e.stopPropagation();
30
+ }.bind(this);
31
+ this._onmouseup = function (e) {
32
+ e.stopPropagation();
33
+ }.bind(this);
34
+ this._onmousedown = function (e) {
35
+ e.stopPropagation();
36
+ }.bind(this);
37
+ this._oncontext = function (e) {
38
+ e.stopPropagation();
39
+ }.bind(this);
40
+ this._onclick = function (e) {
41
+ e.stopPropagation();
42
+ }.bind(this);
43
+ this._onclose = function (e) {
44
+ this.close();
45
+ }.bind(this);
46
+ this._oncollapse = function (e) {
47
+ e.stopPropagation();
48
+ this.close();
49
+ }.bind(this);
50
+ this._onwindowblur = function (e) {
51
+ // @ts-ignore for debug
52
+ !window.POPUP_DEBUG && this.close();
53
+ }.bind(this);
54
+ }
55
+ render() {
56
+ var _a, _b;
57
+ return html `
58
+ ${this.titler ? html ` <div titler>${this.titler}</div> ` : nothing}
59
+ <div content>
60
+ ${this.icon || this.type ? html ` <mwc-icon icon>${this.icon || this.type}</mwc-icon> ` : nothing}
61
+ ${this.text ? html ` <div text>${this.text}</div> ` : nothing}
62
+ <slot> </slot>
63
+ ${this.footer ? html ` <div footer>${this.footer}</div> ` : nothing}
64
+ </div>
65
+ <div buttons>
66
+ ${this.confirmButton
67
+ ? html ` <mwc-button raised @click=${(e) => this.onConfirm()}>${(_a = this.confirmButton) === null || _a === void 0 ? void 0 : _a.text}</mwc-button> `
68
+ : nothing}
69
+ ${this.cancelButton
70
+ ? html ` <mwc-button raised @click=${(e) => this.onCancel()}>${(_b = this.cancelButton) === null || _b === void 0 ? void 0 : _b.text}</mwc-button> `
71
+ : nothing}
72
+ </div>
73
+ `;
74
+ }
75
+ onConfirm() {
76
+ this.resolveFn && this.resolveFn(true);
77
+ this.close();
78
+ }
79
+ onCancel() {
80
+ this.resolveFn && this.resolveFn(false);
81
+ this.close();
82
+ }
83
+ connectedCallback() {
84
+ super.connectedCallback();
85
+ this.addEventListener('focusout', this._onfocusout);
86
+ this.addEventListener('keydown', this._onkeydown);
87
+ this.addEventListener('keyup', this._onkeyup);
88
+ this.addEventListener('click', this._onclick);
89
+ this.addEventListener('mouseup', this._onmouseup);
90
+ this.addEventListener('mousedown', this._onmousedown);
91
+ this.addEventListener('context', this._oncontext);
92
+ this.addEventListener('ox-close', this._onclose);
93
+ this.addEventListener('ox-collapse', this._oncollapse);
94
+ this.setAttribute('tabindex', '0'); // make this element focusable
95
+ this.guaranteeFocus();
96
+ }
97
+ static open({ template, type, icon, title, text, footer, confirmButton, cancelButton, top, left, right, bottom, width, height, parent }) {
98
+ const owner = parent || document.body;
99
+ const target = document.createElement('ox-prompt');
100
+ target.type = type;
101
+ target.icon = icon;
102
+ target.text = text;
103
+ target.titler = title;
104
+ target.footer = footer;
105
+ target.confirmButton = confirmButton;
106
+ target.cancelButton = cancelButton;
107
+ render(template, target);
108
+ target._parent = owner;
109
+ owner.appendChild(target);
110
+ return target.open({ top, left, right, bottom, width, height });
111
+ }
112
+ open({ left, top, right, bottom, width, height, silent = false }) {
113
+ if (width) {
114
+ this.style.maxWidth = width;
115
+ this.style.overflowX = 'auto';
116
+ }
117
+ if (height) {
118
+ this.style.maxHeight = height;
119
+ this.style.overflowY = 'auto';
120
+ }
121
+ if (left === undefined && top === undefined && right === undefined && bottom === undefined) {
122
+ this.style.left = '50%';
123
+ this.style.top = '50%';
124
+ this.style.transform = 'translateX(-50%) translateY(-50%)';
125
+ }
126
+ else {
127
+ if (left !== undefined)
128
+ this.style.left = `${left}px`;
129
+ if (top !== undefined)
130
+ this.style.top = `${top}px`;
131
+ if (right !== undefined)
132
+ this.style.right = `${right}px`;
133
+ if (bottom !== undefined)
134
+ this.style.bottom = `${bottom}px`;
135
+ }
136
+ this.setAttribute('active', '');
137
+ // adjust popup position
138
+ requestAnimationFrame(() => {
139
+ const vh = document.body.clientHeight;
140
+ const vw = document.body.clientWidth;
141
+ var bounding = this.getBoundingClientRect();
142
+ var h = bounding.height;
143
+ var w = bounding.width;
144
+ var t = bounding.top;
145
+ var l = bounding.left;
146
+ // If the popup is too large, it will cause overflow scrolling.
147
+ if (vh < h) {
148
+ this.style.height = `${Math.min(Math.max(Math.floor((vh * 2) / 3), vh - (t + 20)), vh)}px`;
149
+ this.style.overflow = 'auto';
150
+ h = vh;
151
+ }
152
+ if (vw < w) {
153
+ this.style.width = `${Math.min(Math.max(Math.floor((vw * 2) / 3), vw - (l + 20)), vw)}px`;
154
+ this.style.overflow = 'auto';
155
+ w = vw;
156
+ }
157
+ // To prevent pop-ups from crossing screen boundaries, use the
158
+ const computedStyle = getComputedStyle(this);
159
+ if (t < 0) {
160
+ this.style.top = `calc(${computedStyle.top} + ${t}px)`; // 현재의 top 값에 t를 추가한다.
161
+ this.style.bottom = '';
162
+ }
163
+ else if (vh < t + h) {
164
+ this.style.top = `calc(${computedStyle.top} - ${t + h - vh}px)`; // 현재의 top 값에 차감한다.
165
+ this.style.bottom = '';
166
+ }
167
+ if (l < 0) {
168
+ this.style.left = `calc(${computedStyle.left} + ${l}px)`; // 현재의 left 값에 l를 추가한다.
169
+ this.style.right = '';
170
+ }
171
+ else if (vw < l + w) {
172
+ this.style.left = `calc(${computedStyle.left} - ${l + w - vw}px)`; // 현재의 left 값에 차감한다.
173
+ this.style.right = '';
174
+ }
175
+ });
176
+ // auto focusing
177
+ !silent && this.guaranteeFocus();
178
+ /* When the window is out of focus, all pop-ups should disappear. */
179
+ window.addEventListener('blur', this._onwindowblur);
180
+ return new Promise(resolve => {
181
+ this.resolveFn = resolve;
182
+ });
183
+ }
184
+ guaranteeFocus(target) {
185
+ const focusible = (target || this).querySelector(':scope > button, :scope > [href], :scope > input, :scope > select, :scope > textarea, :scope > [tabindex]:not([tabindex="-1"])');
186
+ if (focusible) {
187
+ ;
188
+ focusible.focus();
189
+ }
190
+ else {
191
+ this.focus();
192
+ }
193
+ }
194
+ close() {
195
+ this.removeAttribute('active');
196
+ window.removeEventListener('blur', this._onwindowblur);
197
+ if (this._parent) {
198
+ /* this case is when the popup is opened by OxPrompt.open(...) */
199
+ this.removeEventListener('focusout', this._onfocusout);
200
+ this.removeEventListener('keydown', this._onkeydown);
201
+ this.removeEventListener('keyup', this._onkeyup);
202
+ this.removeEventListener('click', this._onclick);
203
+ this.removeEventListener('ox-close', this._onclose);
204
+ this.removeEventListener('ox-collapse', this._oncollapse);
205
+ this.removeEventListener('mouseup', this._onmouseup);
206
+ this.removeEventListener('mousedown', this._onmousedown);
207
+ this.removeEventListener('context', this._oncontext);
208
+ this._parent.removeChild(this);
209
+ delete this._parent;
210
+ }
211
+ }
212
+ };
213
+ OxPrompt.styles = [
214
+ css `
215
+ :host {
216
+ --prompt-container-border-radius: 12px;
217
+ --prompt-container-box-shadow: 2px 3px 10px 5px rgba(0, 0, 0, 0.15);
218
+
219
+ position: absolute;
220
+ display: none;
221
+ background-color: var(--theme-white-color, #fff);
222
+ z-index: 100;
223
+ padding: var(--padding-wide);
224
+ box-shadow: var(--prompt-container-box-shadow);
225
+ border-radius: var(--prompt-container-border-radius);
226
+ box-sizing: border-box;
227
+ min-width: fit-content;
228
+ line-height: initial;
229
+ text-align: initial;
230
+ }
231
+
232
+ :host([active]) {
233
+ display: block;
234
+ }
235
+
236
+ :host(*:focus) {
237
+ outline: none;
238
+ }
239
+
240
+ [titler] {
241
+ padding: var(--default-padding, 6px);
242
+ font: var(--title-font);
243
+ color: var(--title-text-color);
244
+ }
245
+
246
+ [content] {
247
+ display: flex;
248
+ flex-direction: column;
249
+ gap: var(--margin-default);
250
+ padding: var(--padding-default);
251
+ color: var(--primary-text-color);
252
+ word-break: keep-all;
253
+ }
254
+
255
+ [buttons] {
256
+ display: flex;
257
+ gap: var(--margin-default);
258
+ padding: var(--padding-wide) 0 var(--padding-narrow) 0;
259
+ border-top: var(--border-dark-color);
260
+ justify-content: center;
261
+ }
262
+ `
263
+ ];
264
+ __decorate([
265
+ property({ type: String })
266
+ ], OxPrompt.prototype, "type", void 0);
267
+ __decorate([
268
+ property({ type: String })
269
+ ], OxPrompt.prototype, "icon", void 0);
270
+ __decorate([
271
+ property({ type: String })
272
+ ], OxPrompt.prototype, "titler", void 0);
273
+ __decorate([
274
+ property({ type: String })
275
+ ], OxPrompt.prototype, "text", void 0);
276
+ __decorate([
277
+ property({ type: String })
278
+ ], OxPrompt.prototype, "footer", void 0);
279
+ __decorate([
280
+ property({ type: Boolean })
281
+ ], OxPrompt.prototype, "toast", void 0);
282
+ __decorate([
283
+ property({ type: Object })
284
+ ], OxPrompt.prototype, "confirmButton", void 0);
285
+ __decorate([
286
+ property({ type: Object })
287
+ ], OxPrompt.prototype, "cancelButton", void 0);
288
+ __decorate([
289
+ property({ type: Object })
290
+ ], OxPrompt.prototype, "callback", void 0);
291
+ __decorate([
292
+ state()
293
+ ], OxPrompt.prototype, "_parent", void 0);
294
+ OxPrompt = __decorate([
295
+ customElement('ox-prompt')
296
+ ], OxPrompt);
297
+ export { OxPrompt };
298
+ //# sourceMappingURL=ox-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-prompt.js","sourceRoot":"","sources":["../../src/ox-prompt.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAG3D,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAuDuB,WAAM,GAAY,EAAE,CAAA;QAoBxC,cAAS,GAAsC,IAAI,CAAA;QAgCjD,gBA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EAAE,MAAM,EAAE,CAAC;wCAAgB;AAWd;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAAgB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAiD;AAChD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgD;AAC/C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAoB;AAEtC;IAAR,KAAK,EAAE;yCAAkB;AAzEf,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAwWpB","sourcesContent":["import '@material/mwc-button'\n\nimport { css, html, nothing, LitElement } from 'lit'\nimport { render } from 'lit-html'\nimport { customElement, property, state } from 'lit/decorators.js'\n\n@customElement('ox-prompt')\nexport class OxPrompt extends LitElement {\n static styles = [\n css`\n :host {\n --prompt-container-border-radius: 12px;\n --prompt-container-box-shadow: 2px 3px 10px 5px rgba(0, 0, 0, 0.15);\n\n position: absolute;\n display: none;\n background-color: var(--theme-white-color, #fff);\n z-index: 100;\n padding: var(--padding-wide);\n box-shadow: var(--prompt-container-box-shadow);\n border-radius: var(--prompt-container-border-radius);\n box-sizing: border-box;\n min-width: fit-content;\n line-height: initial;\n text-align: initial;\n }\n\n :host([active]) {\n display: block;\n }\n\n :host(*:focus) {\n outline: none;\n }\n\n [titler] {\n padding: var(--default-padding, 6px);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n\n [content] {\n display: flex;\n flex-direction: column;\n gap: var(--margin-default);\n padding: var(--padding-default);\n color: var(--primary-text-color);\n word-break: keep-all;\n }\n\n [buttons] {\n display: flex;\n gap: var(--margin-default);\n padding: var(--padding-wide) 0 var(--padding-narrow) 0;\n border-top: var(--border-dark-color);\n justify-content: center;\n }\n `\n ]\n\n @property({ type: String }) type?: 'success' | 'error' | 'warning' | 'info' | 'question'\n @property({ type: String }) icon?: string\n @property({ type: String }) titler?: string = ''\n @property({ type: String }) text?: string\n @property({ type: String }) footer?: string\n // @property({ type: String }) position?:\n // | 'top'\n // | 'top-start'\n // | 'top-end'\n // | 'center'\n // | 'center-start'\n // | 'center-end'\n // | 'bottom'\n // | 'bottom-start'\n // | 'bottom-end'\n @property({ type: Boolean }) toast?: boolean\n @property({ type: Object }) confirmButton?: { text: string; color?: string }\n @property({ type: Object }) cancelButton?: { text: string; color?: string }\n @property({ type: Object }) callback?: Function\n\n @state() _parent?: Element\n\n private resolveFn: ((value: boolean) => void) | null = null\n\n render() {\n return html`\n ${this.titler ? html` <div titler>${this.titler}</div> ` : nothing}\n <div content>\n ${this.icon || this.type ? html` <mwc-icon icon>${this.icon || this.type}</mwc-icon> ` : nothing}\n ${this.text ? html` <div text>${this.text}</div> ` : nothing}\n <slot> </slot>\n ${this.footer ? html` <div footer>${this.footer}</div> ` : nothing}\n </div>\n <div buttons>\n ${this.confirmButton\n ? html` <mwc-button raised @click=${(e: Event) => this.onConfirm()}>${this.confirmButton?.text}</mwc-button> `\n : nothing}\n ${this.cancelButton\n ? html` <mwc-button raised @click=${(e: Event) => this.onCancel()}>${this.cancelButton?.text}</mwc-button> `\n : nothing}\n </div>\n `\n }\n\n onConfirm() {\n this.resolveFn && this.resolveFn(true)\n this.close()\n }\n\n onCancel() {\n this.resolveFn && this.resolveFn(false)\n this.close()\n }\n\n protected _onfocusout: (e: FocusEvent) => void = function (this: OxPrompt, e: FocusEvent) {\n const to = e.relatedTarget as HTMLElement\n\n if (!this.contains(to)) {\n /* 분명히 내 범위가 아닌 엘리먼트로 포커스가 옮겨졌다면, ox-prompt은 닫혀야 한다. */\n // @ts-ignore for debug\n !window.POPUP_DEBUG && this.close()\n }\n }.bind(this)\n\n protected _onkeydown: (e: KeyboardEvent) => void = function (this: OxPrompt, e: KeyboardEvent) {\n e.stopPropagation()\n\n switch (e.key) {\n case 'Esc': // for IE/Edge\n case 'Escape':\n this.close()\n break\n }\n }.bind(this)\n\n protected _onkeyup: (e: KeyboardEvent) => void = function (this: OxPrompt, e: KeyboardEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onmouseup: (e: MouseEvent) => void = function (this: OxPrompt, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onmousedown: (e: MouseEvent) => void = function (this: OxPrompt, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _oncontext: (e: Event) => void = function (this: OxPrompt, e: Event) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onclick: (e: MouseEvent) => void = function (this: OxPrompt, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onclose: (e: Event) => void = function (this: OxPrompt, e: Event) {\n this.close()\n }.bind(this)\n\n protected _oncollapse: (e: Event) => void = function (this: OxPrompt, e: Event) {\n e.stopPropagation()\n this.close()\n }.bind(this)\n\n protected _onwindowblur: (e: Event) => void = function (this: OxPrompt, e: Event) {\n // @ts-ignore for debug\n !window.POPUP_DEBUG && this.close()\n }.bind(this)\n\n connectedCallback() {\n super.connectedCallback()\n\n this.addEventListener('focusout', this._onfocusout)\n this.addEventListener('keydown', this._onkeydown)\n this.addEventListener('keyup', this._onkeyup)\n this.addEventListener('click', this._onclick)\n this.addEventListener('mouseup', this._onmouseup)\n this.addEventListener('mousedown', this._onmousedown)\n this.addEventListener('context', this._oncontext)\n this.addEventListener('ox-close', this._onclose)\n this.addEventListener('ox-collapse', this._oncollapse)\n\n this.setAttribute('tabindex', '0') // make this element focusable\n this.guaranteeFocus()\n }\n\n public static open({\n template,\n type,\n icon,\n title,\n text,\n footer,\n confirmButton,\n cancelButton,\n top,\n left,\n right,\n bottom,\n width,\n height,\n parent\n }: {\n template?: unknown\n type?: 'success' | 'error' | 'warning' | 'info' | 'question'\n icon?: 'success' | 'error' | 'warning' | 'info' | 'question'\n title?: string\n text?: string\n footer?: string\n confirmButton?: { text: string; color?: string }\n cancelButton?: { text: string; color?: string }\n top?: number\n left?: number\n right?: number\n bottom?: number\n width?: string\n height?: string\n parent?: Element | null\n }): Promise<boolean> {\n const owner = parent || document.body\n const target = document.createElement('ox-prompt') as OxPrompt\n\n target.type = type\n target.icon = icon\n target.text = text\n target.titler = title\n target.footer = footer\n target.confirmButton = confirmButton\n target.cancelButton = cancelButton\n\n render(template, target)\n\n target._parent = owner\n owner.appendChild(target)\n\n return target.open({ top, left, right, bottom, width, height })\n }\n\n open({\n left,\n top,\n right,\n bottom,\n width,\n height,\n silent = false\n }: {\n left?: number\n top?: number\n right?: number\n bottom?: number\n width?: string\n height?: string\n silent?: boolean\n }): Promise<boolean> {\n if (width) {\n this.style.maxWidth = width\n this.style.overflowX = 'auto'\n }\n\n if (height) {\n this.style.maxHeight = height\n this.style.overflowY = 'auto'\n }\n\n if (left === undefined && top === undefined && right === undefined && bottom === undefined) {\n this.style.left = '50%'\n this.style.top = '50%'\n this.style.transform = 'translateX(-50%) translateY(-50%)'\n } else {\n if (left !== undefined) this.style.left = `${left}px`\n if (top !== undefined) this.style.top = `${top}px`\n if (right !== undefined) this.style.right = `${right}px`\n if (bottom !== undefined) this.style.bottom = `${bottom}px`\n }\n\n this.setAttribute('active', '')\n\n // adjust popup position\n requestAnimationFrame(() => {\n const vh = document.body.clientHeight\n const vw = document.body.clientWidth\n\n var bounding = this.getBoundingClientRect()\n\n var h = bounding.height\n var w = bounding.width\n var t = bounding.top\n var l = bounding.left\n\n // If the popup is too large, it will cause overflow scrolling.\n if (vh < h) {\n this.style.height = `${Math.min(Math.max(Math.floor((vh * 2) / 3), vh - (t + 20)), vh)}px`\n this.style.overflow = 'auto'\n h = vh\n }\n\n if (vw < w) {\n this.style.width = `${Math.min(Math.max(Math.floor((vw * 2) / 3), vw - (l + 20)), vw)}px`\n this.style.overflow = 'auto'\n w = vw\n }\n\n // To prevent pop-ups from crossing screen boundaries, use the\n const computedStyle = getComputedStyle(this)\n\n if (t < 0) {\n this.style.top = `calc(${computedStyle.top} + ${t}px)` // 현재의 top 값에 t를 추가한다.\n this.style.bottom = ''\n } else if (vh < t + h) {\n this.style.top = `calc(${computedStyle.top} - ${t + h - vh}px)` // 현재의 top 값에 차감한다.\n this.style.bottom = ''\n }\n\n if (l < 0) {\n this.style.left = `calc(${computedStyle.left} + ${l}px)` // 현재의 left 값에 l를 추가한다.\n this.style.right = ''\n } else if (vw < l + w) {\n this.style.left = `calc(${computedStyle.left} - ${l + w - vw}px)` // 현재의 left 값에 차감한다.\n this.style.right = ''\n }\n })\n\n // auto focusing\n !silent && this.guaranteeFocus()\n\n /* When the window is out of focus, all pop-ups should disappear. */\n window.addEventListener('blur', this._onwindowblur)\n\n return new Promise(resolve => {\n this.resolveFn = resolve\n })\n }\n\n guaranteeFocus(target?: HTMLElement) {\n const focusible = (target || this).querySelector(\n ':scope > button, :scope > [href], :scope > input, :scope > select, :scope > textarea, :scope > [tabindex]:not([tabindex=\"-1\"])'\n )\n\n if (focusible) {\n ;(focusible as HTMLElement).focus()\n } else {\n this.focus()\n }\n }\n\n close() {\n this.removeAttribute('active')\n\n window.removeEventListener('blur', this._onwindowblur)\n\n if (this._parent) {\n /* this case is when the popup is opened by OxPrompt.open(...) */\n this.removeEventListener('focusout', this._onfocusout)\n this.removeEventListener('keydown', this._onkeydown)\n this.removeEventListener('keyup', this._onkeyup)\n this.removeEventListener('click', this._onclick)\n this.removeEventListener('ox-close', this._onclose)\n this.removeEventListener('ox-collapse', this._oncollapse)\n this.removeEventListener('mouseup', this._onmouseup)\n this.removeEventListener('mousedown', this._onmousedown)\n this.removeEventListener('context', this._oncontext)\n\n this._parent.removeChild(this)\n delete this._parent\n }\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { TemplateResult } from 'lit';
2
+ declare const _default: {
3
+ title: string;
4
+ component: string;
5
+ argTypes: {};
6
+ };
7
+ export default _default;
8
+ interface Story<T> {
9
+ (args: T): TemplateResult;
10
+ args?: Partial<T>;
11
+ argTypes?: Record<string, unknown>;
12
+ }
13
+ interface ArgTypes {
14
+ }
15
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,35 @@
1
+ import { html } from 'lit';
2
+ import { OxPrompt } from '../src/ox-prompt';
3
+ export default {
4
+ title: 'OxPrompt - Normal',
5
+ component: 'ox-prompt',
6
+ argTypes: {}
7
+ };
8
+ function popup(e) {
9
+ const noImage = new URL('/assets/images/no-image.png', import.meta.url).href;
10
+ OxPrompt.open({
11
+ title: 'Are you sure ?',
12
+ text: 'Are you sure to exit this page ?',
13
+ confirmButton: { text: 'Confirm' },
14
+ cancelButton: { text: 'Cancel' }
15
+ });
16
+ }
17
+ const Template = ({}) => html `
18
+ <link href="/themes/app-theme.css" rel="stylesheet" />
19
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
20
+
21
+ <style>
22
+ #place {
23
+ width: 100%;
24
+ height: 500px;
25
+ background: lightgreen;
26
+ text-align: center;
27
+ line-height: 500px;
28
+ }
29
+ </style>
30
+
31
+ <div id="place" @click=${(e) => popup(e)}>Click this to prompt image</div>
32
+ `;
33
+ export const Regular = Template.bind({});
34
+ Regular.args = {};
35
+ //# sourceMappingURL=ox-prompt-normal.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-prompt-normal.stories.js","sourceRoot":"","sources":["../../stories/ox-prompt-normal.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,eAAe;IACb,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,EAAE;CACb,CAAA;AAUD,SAAS,KAAK,CAAC,CAAa;IAC1B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;IAE5E,QAAQ,CAAC,IAAI,CAAC;QACZ,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,kCAAkC;QACxC,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAClC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACjC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,QAAQ,GAAoB,CAAC,EAAY,EAAE,EAAE,CACjD,IAAI,CAAA;;;;;;;;;;;;;;6BAcuB,CAAC,CAAa,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;GACrD,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAA","sourcesContent":["import { html, TemplateResult } from 'lit'\n\nimport { OxPrompt } from '../src/ox-prompt'\n\nexport default {\n title: 'OxPrompt - Normal',\n component: 'ox-prompt',\n argTypes: {}\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {}\n\nfunction popup(e: MouseEvent) {\n const noImage = new URL('/assets/images/no-image.png', import.meta.url).href\n\n OxPrompt.open({\n title: 'Are you sure ?',\n text: 'Are you sure to exit this page ?',\n confirmButton: { text: 'Confirm' },\n cancelButton: { text: 'Cancel' }\n })\n}\n\nconst Template: Story<ArgTypes> = ({}: ArgTypes) =>\n html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n\n <style>\n #place {\n width: 100%;\n height: 500px;\n background: lightgreen;\n text-align: center;\n line-height: 500px;\n }\n </style>\n\n <div id=\"place\" @click=${(e: MouseEvent) => popup(e)}>Click this to prompt image</div>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {}\n"]}
@@ -0,0 +1,15 @@
1
+ import { TemplateResult } from 'lit';
2
+ declare const _default: {
3
+ title: string;
4
+ component: string;
5
+ argTypes: {};
6
+ };
7
+ export default _default;
8
+ interface Story<T> {
9
+ (args: T): TemplateResult;
10
+ args?: Partial<T>;
11
+ argTypes?: Record<string, unknown>;
12
+ }
13
+ interface ArgTypes {
14
+ }
15
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,38 @@
1
+ import { html } from 'lit';
2
+ import { OxPrompt } from '../src/ox-prompt';
3
+ export default {
4
+ title: 'OxPrompt',
5
+ component: 'ox-prompt',
6
+ argTypes: {}
7
+ };
8
+ function popup(e) {
9
+ const noImage = new URL('/assets/images/no-image.png', import.meta.url).href;
10
+ OxPrompt.open({
11
+ type: 'info',
12
+ title: 'title',
13
+ text: 'Are you sure ?',
14
+ footer: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
15
+ template: html `<img src=${noImage} />`,
16
+ confirmButton: { text: 'Confirm' },
17
+ cancelButton: { text: 'Cancel' }
18
+ });
19
+ }
20
+ const Template = ({}) => html `
21
+ <link href="/themes/app-theme.css" rel="stylesheet" />
22
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
23
+
24
+ <style>
25
+ #place {
26
+ width: 100%;
27
+ height: 500px;
28
+ background: lightgreen;
29
+ text-align: center;
30
+ line-height: 500px;
31
+ }
32
+ </style>
33
+
34
+ <div id="place" @click=${(e) => popup(e)}>Click this to prompt image</div>
35
+ `;
36
+ export const Regular = Template.bind({});
37
+ Regular.args = {};
38
+ //# sourceMappingURL=ox-prompt.stories%20copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-prompt.stories copy.js","sourceRoot":"","sources":["../../stories/ox-prompt.stories copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,eAAe;IACb,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,EAAE;CACb,CAAA;AAUD,SAAS,KAAK,CAAC,CAAa;IAC1B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;IAE5E,QAAQ,CAAC,IAAI,CAAC;QACZ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,4BAA4B;QACpC,QAAQ,EAAE,IAAI,CAAA,YAAY,OAAO,KAAK;QACtC,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAClC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACjC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,QAAQ,GAAoB,CAAC,EAAY,EAAE,EAAE,CACjD,IAAI,CAAA;;;;;;;;;;;;;;6BAcuB,CAAC,CAAa,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;GACrD,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAA","sourcesContent":["import { html, TemplateResult } from 'lit'\n\nimport { OxPrompt } from '../src/ox-prompt'\n\nexport default {\n title: 'OxPrompt',\n component: 'ox-prompt',\n argTypes: {}\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {}\n\nfunction popup(e: MouseEvent) {\n const noImage = new URL('/assets/images/no-image.png', import.meta.url).href\n\n OxPrompt.open({\n type: 'info',\n title: 'title',\n text: 'Are you sure ?',\n footer: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',\n template: html`<img src=${noImage} />`,\n confirmButton: { text: 'Confirm' },\n cancelButton: { text: 'Cancel' }\n })\n}\n\nconst Template: Story<ArgTypes> = ({}: ArgTypes) =>\n html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n\n <style>\n #place {\n width: 100%;\n height: 500px;\n background: lightgreen;\n text-align: center;\n line-height: 500px;\n }\n </style>\n\n <div id=\"place\" @click=${(e: MouseEvent) => popup(e)}>Click this to prompt image</div>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {}\n"]}
@@ -0,0 +1,15 @@
1
+ import { TemplateResult } from 'lit';
2
+ declare const _default: {
3
+ title: string;
4
+ component: string;
5
+ argTypes: {};
6
+ };
7
+ export default _default;
8
+ interface Story<T> {
9
+ (args: T): TemplateResult;
10
+ args?: Partial<T>;
11
+ argTypes?: Record<string, unknown>;
12
+ }
13
+ interface ArgTypes {
14
+ }
15
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,38 @@
1
+ import { html } from 'lit';
2
+ import { OxPrompt } from '../src/ox-prompt';
3
+ export default {
4
+ title: 'OxPrompt',
5
+ component: 'ox-prompt',
6
+ argTypes: {}
7
+ };
8
+ function popup(e) {
9
+ const noImage = new URL('/assets/images/no-image.png', import.meta.url).href;
10
+ OxPrompt.open({
11
+ type: 'info',
12
+ title: 'title',
13
+ text: 'Are you sure ?',
14
+ footer: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
15
+ template: html `<img src=${noImage} />`,
16
+ confirmButton: { text: 'Confirm' },
17
+ cancelButton: { text: 'Cancel' }
18
+ });
19
+ }
20
+ const Template = ({}) => html `
21
+ <link href="/themes/app-theme.css" rel="stylesheet" />
22
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
23
+
24
+ <style>
25
+ #place {
26
+ width: 100%;
27
+ height: 500px;
28
+ background: lightgreen;
29
+ text-align: center;
30
+ line-height: 500px;
31
+ }
32
+ </style>
33
+
34
+ <div id="place" @click=${(e) => popup(e)}>Click this to prompt image</div>
35
+ `;
36
+ export const Regular = Template.bind({});
37
+ Regular.args = {};
38
+ //# sourceMappingURL=ox-prompt.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-prompt.stories.js","sourceRoot":"","sources":["../../stories/ox-prompt.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,eAAe;IACb,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,EAAE;CACb,CAAA;AAUD,SAAS,KAAK,CAAC,CAAa;IAC1B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;IAE5E,QAAQ,CAAC,IAAI,CAAC;QACZ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,4BAA4B;QACpC,QAAQ,EAAE,IAAI,CAAA,YAAY,OAAO,KAAK;QACtC,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAClC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACjC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,QAAQ,GAAoB,CAAC,EAAY,EAAE,EAAE,CACjD,IAAI,CAAA;;;;;;;;;;;;;;6BAcuB,CAAC,CAAa,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;GACrD,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAA","sourcesContent":["import { html, TemplateResult } from 'lit'\n\nimport { OxPrompt } from '../src/ox-prompt'\n\nexport default {\n title: 'OxPrompt',\n component: 'ox-prompt',\n argTypes: {}\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {}\n\nfunction popup(e: MouseEvent) {\n const noImage = new URL('/assets/images/no-image.png', import.meta.url).href\n\n OxPrompt.open({\n type: 'info',\n title: 'title',\n text: 'Are you sure ?',\n footer: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',\n template: html`<img src=${noImage} />`,\n confirmButton: { text: 'Confirm' },\n cancelButton: { text: 'Cancel' }\n })\n}\n\nconst Template: Story<ArgTypes> = ({}: ArgTypes) =>\n html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n\n <style>\n #place {\n width: 100%;\n height: 500px;\n background: lightgreen;\n text-align: center;\n line-height: 500px;\n }\n </style>\n\n <div id=\"place\" @click=${(e: MouseEvent) => popup(e)}>Click this to prompt image</div>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {}\n"]}