@operato/popup 1.0.0-beta.8 → 1.0.6

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +389 -0
  2. package/assets/images/no-image.png +0 -0
  3. package/dist/src/index.d.ts +5 -4
  4. package/dist/src/index.js +5 -4
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/open-popup.d.ts +59 -0
  7. package/dist/src/open-popup.js +84 -0
  8. package/dist/src/open-popup.js.map +1 -0
  9. package/dist/src/ox-floating-overlay.d.ts +21 -0
  10. package/dist/src/ox-floating-overlay.js +349 -0
  11. package/dist/src/ox-floating-overlay.js.map +1 -0
  12. package/dist/src/ox-popup.js +4 -2
  13. package/dist/src/ox-popup.js.map +1 -1
  14. package/dist/stories/open-popup.stories.d.ts +46 -0
  15. package/dist/stories/open-popup.stories.js +51 -0
  16. package/dist/stories/open-popup.stories.js.map +1 -0
  17. package/dist/stories/ox-popup-list.stories.d.ts +18 -0
  18. package/dist/stories/ox-popup-list.stories.js +50 -0
  19. package/dist/stories/ox-popup-list.stories.js.map +1 -0
  20. package/dist/stories/ox-popup-menu.stories.d.ts +19 -0
  21. package/dist/stories/ox-popup-menu.stories.js +131 -0
  22. package/dist/stories/ox-popup-menu.stories.js.map +1 -0
  23. package/dist/stories/ox-popup.stories.d.ts +15 -0
  24. package/dist/stories/ox-popup.stories.js +32 -0
  25. package/dist/stories/ox-popup.stories.js.map +1 -0
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +28 -8
  28. package/src/index.ts +6 -4
  29. package/src/open-popup.ts +140 -0
  30. package/src/ox-floating-overlay.ts +330 -0
  31. package/src/ox-popup.ts +4 -2
  32. package/stories/open-popup.stories.ts +81 -0
  33. package/stories/ox-popup-list.stories.ts +65 -0
  34. package/stories/ox-popup-menu.stories.ts +145 -0
  35. package/stories/ox-popup.stories.ts +46 -0
  36. package/themes/app-theme.css +142 -0
  37. package/themes/input-theme.css +19 -0
  38. package/dist/stories/index.stories.d.ts +0 -33
  39. package/dist/stories/index.stories.js +0 -33
  40. package/dist/stories/index.stories.js.map +0 -1
  41. package/stories/index.stories.ts +0 -52
@@ -0,0 +1,349 @@
1
+ import { __decorate } from "tslib";
2
+ import '@material/mwc-icon';
3
+ import { css, html, LitElement } from 'lit';
4
+ import { customElement, property } from 'lit/decorators.js';
5
+ import { ScrollbarStyles } from '@operato/styles';
6
+ let OxFloatingOverlay = class OxFloatingOverlay extends LitElement {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.backdrop = false;
10
+ this.title = '';
11
+ this.closable = false;
12
+ this.historical = false;
13
+ }
14
+ render() {
15
+ var direction = this.hovering == 'center' ? false : this.direction;
16
+ return html `
17
+ ${Boolean(this.backdrop)
18
+ ? html ` <div id="backdrop" ?hidden=${!this.backdrop} @click=${() => this.onClose(true)}></div> `
19
+ : html ``}
20
+
21
+ <div
22
+ overlayed
23
+ hovering=${this.hovering || 'center'}
24
+ direction=${direction}
25
+ size=${this.size || 'medium'}
26
+ @close-overlay=${(e) => {
27
+ e.stopPropagation();
28
+ this.onClose();
29
+ }}
30
+ @transitionstart=${(e) => {
31
+ /* to hide scrollbar during transition */
32
+ ;
33
+ e.target.removeAttribute('settled');
34
+ }}
35
+ @transitionend=${(e) => {
36
+ ;
37
+ e.target.setAttribute('settled', '');
38
+ }}
39
+ >
40
+ <div header>
41
+ <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} historyback>arrow_back</mwc-icon>
42
+ <slot name="header">
43
+ ${this.title || this.closable
44
+ ? html `
45
+ <h1>
46
+ ${this.title || ''}&nbsp;${this.help
47
+ ? html ` <ox-help-icon .topic=${this.help}></ox-help-icon>`
48
+ : html ``}
49
+ </h1>
50
+ `
51
+ : html ``}</slot
52
+ >
53
+ <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} close>close</mwc-icon>
54
+ </div>
55
+
56
+ <div content>
57
+ <slot> </slot>
58
+ </div>
59
+ </div>
60
+ `;
61
+ }
62
+ updated(changes) {
63
+ if (changes.has('templateProperties') && this.templateProperties) {
64
+ var template = this.firstElementChild;
65
+ if (template) {
66
+ for (let prop in this.templateProperties) {
67
+ //@ts-ignore
68
+ template[prop] = this.templateProperties[prop];
69
+ }
70
+ }
71
+ }
72
+ }
73
+ firstUpdated() {
74
+ requestAnimationFrame(() => {
75
+ var _a;
76
+ /* transition(animation) 효과를 위해 'opened' 속성을 변화시킨다. */
77
+ (_a = this.renderRoot.querySelector('[overlayed]')) === null || _a === void 0 ? void 0 : _a.setAttribute('opened', 'true');
78
+ });
79
+ }
80
+ disconnectedCallback() {
81
+ document.dispatchEvent(new CustomEvent('overlay-closed', {
82
+ detail: this.name
83
+ }));
84
+ super.disconnectedCallback();
85
+ }
86
+ close() {
87
+ var _a;
88
+ (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this);
89
+ }
90
+ onClose(escape) {
91
+ /* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */
92
+ if (this.historical) {
93
+ var state = history.state;
94
+ var overlay = (state || {}).overlay;
95
+ if (!overlay || overlay.name !== this.name) {
96
+ return;
97
+ }
98
+ /* Backdrop click 경우는 escape 시도라고 정의한다. overlay 속성이 escapable이 아닌 경우에는 동작하지 않는다. */
99
+ if (escape && !overlay.escapable) {
100
+ return true;
101
+ }
102
+ history.back();
103
+ }
104
+ else {
105
+ this.close();
106
+ }
107
+ }
108
+ };
109
+ OxFloatingOverlay.styles = [
110
+ ScrollbarStyles,
111
+ css `
112
+ /* for layout style */
113
+ :host {
114
+ position: relative;
115
+ z-index: 1;
116
+ }
117
+
118
+ :host([hovering='edge']) {
119
+ /* edge hovering 인 경우에는 상위 relative position 크기와 위치를 반영한다. */
120
+ position: initial;
121
+ }
122
+
123
+ #backdrop {
124
+ position: fixed;
125
+ left: 0;
126
+ top: 0;
127
+
128
+ width: 100vw;
129
+ height: 100vh;
130
+
131
+ background-color: var(--overlay-background-color);
132
+ }
133
+
134
+ [overlayed] {
135
+ position: absolute;
136
+
137
+ display: flex;
138
+ flex-direction: column;
139
+ overflow: hidden;
140
+ background: transparent;
141
+ pointer-events: none;
142
+ }
143
+
144
+ [overlayed][hovering='center'] {
145
+ position: fixed;
146
+
147
+ left: 50%;
148
+ top: 50%;
149
+ transform: translate(-50%, -50%);
150
+
151
+ opacity: 0;
152
+ }
153
+
154
+ [overlayed][hovering='center'][opened] {
155
+ opacity: 1;
156
+ transition: opacity 0.3s ease-in;
157
+ }
158
+
159
+ [hovering='center'] {
160
+ width: var(--overlay-center-normal-width, 60%);
161
+ height: var(--overlay-center-normal-height, 60%);
162
+ }
163
+
164
+ [hovering='center'][size='small'] {
165
+ width: var(--overlay-center-small-width, 40%);
166
+ height: var(--overlay-center-small-height, 40%);
167
+ }
168
+
169
+ [hovering='center'][size='large'] {
170
+ width: var(--overlay-center-large-width, 100%);
171
+ height: var(--overlay-center-large-height, 100%);
172
+ }
173
+
174
+ [header] {
175
+ --help-icon-color: #fff;
176
+ --help-icon-hover-color: #fff;
177
+
178
+ pointer-events: initial;
179
+ }
180
+
181
+ [content] {
182
+ flex: 1;
183
+
184
+ overflow: hidden;
185
+ }
186
+
187
+ ::slotted(*) {
188
+ box-sizing: border-box;
189
+ pointer-events: initial;
190
+ }
191
+
192
+ [hovering='center'] [content] ::slotted(*) {
193
+ width: 100%;
194
+ height: 100%;
195
+ }
196
+ [direction='up'],
197
+ [direction='down'] {
198
+ width: 100%;
199
+
200
+ max-height: 0;
201
+ transition: max-height 0.7s ease-in;
202
+ }
203
+ [direction='up'] {
204
+ bottom: 0;
205
+ }
206
+ [direction='down'] {
207
+ top: 0;
208
+ }
209
+
210
+ [direction='up'][opened],
211
+ [direction='down'][opened] {
212
+ max-height: 100vh;
213
+ }
214
+
215
+ [settled][direction='down'] [content],
216
+ [settled][direction='up'] [content] {
217
+ overflow-y: auto;
218
+ }
219
+
220
+ [direction='left'],
221
+ [direction='right'] {
222
+ height: 100%;
223
+
224
+ max-width: 0;
225
+ transition: max-width 0.5s ease-in;
226
+ }
227
+ [direction='left'] {
228
+ right: 0;
229
+ }
230
+ [direction='right'] {
231
+ left: 0;
232
+ }
233
+
234
+ [direction='left'][opened],
235
+ [direction='right'][opened] {
236
+ max-width: 100vw;
237
+ }
238
+
239
+ [settled][direction='left'] [content],
240
+ [settled][direction='right'] [content] {
241
+ overflow-x: auto;
242
+ }
243
+
244
+ @media screen and (max-width: 460px) {
245
+ [direction='up'],
246
+ [direction='down'] {
247
+ max-height: 100vh;
248
+ }
249
+
250
+ [direction='left'],
251
+ [direction='right'] {
252
+ max-width: 100vw;
253
+ }
254
+ }
255
+ `,
256
+ css `
257
+ /* for header style */
258
+ [header] {
259
+ display: flex;
260
+ flex-direction: row;
261
+ align-items: center;
262
+
263
+ background-color: var(--overlay-header-background-color);
264
+ color: var(--overlay-header-color);
265
+ }
266
+
267
+ slot[name='header'] {
268
+ flex: 1;
269
+
270
+ display: flex;
271
+ flex-direction: row;
272
+ align-items: center;
273
+ justify-content: center;
274
+ }
275
+
276
+ [name='header']::slotted(*) {
277
+ margin: 0 auto;
278
+ }
279
+
280
+ [name='header'] > h1 {
281
+ text-transform: capitalize;
282
+ font: var(--overlay-header-font);
283
+ }
284
+
285
+ [historyback] {
286
+ margin-left: 10px;
287
+ margin-right: auto;
288
+ }
289
+
290
+ [close] {
291
+ margin-left: auto;
292
+ margin-right: 10px;
293
+ }
294
+
295
+ [historyback],
296
+ [close] {
297
+ display: none;
298
+ }
299
+
300
+ [closable][close] {
301
+ display: block;
302
+ }
303
+
304
+ @media screen and (max-width: 460px) {
305
+ [closable][historyback] {
306
+ display: block;
307
+ }
308
+
309
+ [closable][close] {
310
+ display: none;
311
+ }
312
+ }
313
+ `
314
+ ];
315
+ __decorate([
316
+ property({ type: Boolean })
317
+ ], OxFloatingOverlay.prototype, "backdrop", void 0);
318
+ __decorate([
319
+ property({ type: String })
320
+ ], OxFloatingOverlay.prototype, "direction", void 0);
321
+ __decorate([
322
+ property({ type: String, reflect: true })
323
+ ], OxFloatingOverlay.prototype, "hovering", void 0);
324
+ __decorate([
325
+ property({ type: String })
326
+ ], OxFloatingOverlay.prototype, "size", void 0);
327
+ __decorate([
328
+ property({ type: String })
329
+ ], OxFloatingOverlay.prototype, "name", void 0);
330
+ __decorate([
331
+ property({ type: String })
332
+ ], OxFloatingOverlay.prototype, "title", void 0);
333
+ __decorate([
334
+ property({ type: Boolean })
335
+ ], OxFloatingOverlay.prototype, "closable", void 0);
336
+ __decorate([
337
+ property({ type: Object })
338
+ ], OxFloatingOverlay.prototype, "templateProperties", void 0);
339
+ __decorate([
340
+ property({ type: Object })
341
+ ], OxFloatingOverlay.prototype, "help", void 0);
342
+ __decorate([
343
+ property({ type: Boolean })
344
+ ], OxFloatingOverlay.prototype, "historical", void 0);
345
+ OxFloatingOverlay = __decorate([
346
+ customElement('ox-floating-overlay')
347
+ ], OxFloatingOverlay);
348
+ export { OxFloatingOverlay };
349
+ //# sourceMappingURL=ox-floating-overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-floating-overlay.js","sourceRoot":"","sources":["../../src/ox-floating-overlay.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,UAAU;IAAjD;;QAgN+B,aAAQ,GAAa,KAAK,CAAA;QAK3B,UAAK,GAAW,EAAE,CAAA;QACjB,aAAQ,GAAa,KAAK,CAAA;QAG1B,eAAU,GAAa,KAAK,CAAA;IAwG3D,CAAC;IAtGC,MAAM;QACJ,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,IAAI,Q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AAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAiU7B;SAjUY,iBAAiB","sourcesContent":["import '@material/mwc-icon'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-floating-overlay')\nexport class OxFloatingOverlay extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n /* for layout style */\n :host {\n position: relative;\n z-index: 1;\n }\n\n :host([hovering='edge']) {\n /* edge hovering 인 경우에는 상위 relative position 크기와 위치를 반영한다. */\n position: initial;\n }\n\n #backdrop {\n position: fixed;\n left: 0;\n top: 0;\n\n width: 100vw;\n height: 100vh;\n\n background-color: var(--overlay-background-color);\n }\n\n [overlayed] {\n position: absolute;\n\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n }\n\n [overlayed][hovering='center'] {\n position: fixed;\n\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n\n opacity: 0;\n }\n\n [overlayed][hovering='center'][opened] {\n opacity: 1;\n transition: opacity 0.3s ease-in;\n }\n\n [hovering='center'] {\n width: var(--overlay-center-normal-width, 60%);\n height: var(--overlay-center-normal-height, 60%);\n }\n\n [hovering='center'][size='small'] {\n width: var(--overlay-center-small-width, 40%);\n height: var(--overlay-center-small-height, 40%);\n }\n\n [hovering='center'][size='large'] {\n width: var(--overlay-center-large-width, 100%);\n height: var(--overlay-center-large-height, 100%);\n }\n\n [header] {\n --help-icon-color: #fff;\n --help-icon-hover-color: #fff;\n\n pointer-events: initial;\n }\n\n [content] {\n flex: 1;\n\n overflow: hidden;\n }\n\n ::slotted(*) {\n box-sizing: border-box;\n pointer-events: initial;\n }\n\n [hovering='center'] [content] ::slotted(*) {\n width: 100%;\n height: 100%;\n }\n [direction='up'],\n [direction='down'] {\n width: 100%;\n\n max-height: 0;\n transition: max-height 0.7s ease-in;\n }\n [direction='up'] {\n bottom: 0;\n }\n [direction='down'] {\n top: 0;\n }\n\n [direction='up'][opened],\n [direction='down'][opened] {\n max-height: 100vh;\n }\n\n [settled][direction='down'] [content],\n [settled][direction='up'] [content] {\n overflow-y: auto;\n }\n\n [direction='left'],\n [direction='right'] {\n height: 100%;\n\n max-width: 0;\n transition: max-width 0.5s ease-in;\n }\n [direction='left'] {\n right: 0;\n }\n [direction='right'] {\n left: 0;\n }\n\n [direction='left'][opened],\n [direction='right'][opened] {\n max-width: 100vw;\n }\n\n [settled][direction='left'] [content],\n [settled][direction='right'] [content] {\n overflow-x: auto;\n }\n\n @media screen and (max-width: 460px) {\n [direction='up'],\n [direction='down'] {\n max-height: 100vh;\n }\n\n [direction='left'],\n [direction='right'] {\n max-width: 100vw;\n }\n }\n `,\n css`\n /* for header style */\n [header] {\n display: flex;\n flex-direction: row;\n align-items: center;\n\n background-color: var(--overlay-header-background-color);\n color: var(--overlay-header-color);\n }\n\n slot[name='header'] {\n flex: 1;\n\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n }\n\n [name='header']::slotted(*) {\n margin: 0 auto;\n }\n\n [name='header'] > h1 {\n text-transform: capitalize;\n font: var(--overlay-header-font);\n }\n\n [historyback] {\n margin-left: 10px;\n margin-right: auto;\n }\n\n [close] {\n margin-left: auto;\n margin-right: 10px;\n }\n\n [historyback],\n [close] {\n display: none;\n }\n\n [closable][close] {\n display: block;\n }\n\n @media screen and (max-width: 460px) {\n [closable][historyback] {\n display: block;\n }\n\n [closable][close] {\n display: none;\n }\n }\n `\n ]\n\n @property({ type: Boolean }) backdrop?: boolean = false\n @property({ type: String }) direction?: 'up' | 'down' | 'left' | 'right'\n @property({ type: String, reflect: true }) hovering?: 'center' | 'edge' | 'next'\n @property({ type: String }) size?: 'small' | 'medium' | 'large'\n @property({ type: String }) name?: string\n @property({ type: String }) title: string = ''\n @property({ type: Boolean }) closable?: boolean = false\n @property({ type: Object }) templateProperties: any\n @property({ type: Object }) help: any\n @property({ type: Boolean }) historical?: boolean = false\n\n render() {\n var direction = this.hovering == 'center' ? false : this.direction\n\n return html`\n ${Boolean(this.backdrop)\n ? html` <div id=\"backdrop\" ?hidden=${!this.backdrop} @click=${() => this.onClose(true)}></div> `\n : html``}\n\n <div\n overlayed\n hovering=${this.hovering || 'center'}\n direction=${direction}\n size=${this.size || 'medium'}\n @close-overlay=${(e: Event) => {\n e.stopPropagation()\n this.onClose()\n }}\n @transitionstart=${(e: Event) => {\n /* to hide scrollbar during transition */\n ;(e.target as HTMLElement).removeAttribute('settled')\n }}\n @transitionend=${(e: Event) => {\n ;(e.target as HTMLElement).setAttribute('settled', '')\n }}\n >\n <div header>\n <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} historyback>arrow_back</mwc-icon>\n <slot name=\"header\">\n ${this.title || this.closable\n ? html`\n <h1>\n ${this.title || ''}&nbsp;${this.help\n ? html` <ox-help-icon .topic=${this.help}></ox-help-icon>`\n : html``}\n </h1>\n `\n : html``}</slot\n >\n <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} close>close</mwc-icon>\n </div>\n\n <div content>\n <slot> </slot>\n </div>\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('templateProperties') && this.templateProperties) {\n var template = this.firstElementChild\n if (template) {\n for (let prop in this.templateProperties) {\n //@ts-ignore\n template[prop] = this.templateProperties[prop]\n }\n }\n }\n }\n\n firstUpdated() {\n requestAnimationFrame(() => {\n /* transition(animation) 효과를 위해 'opened' 속성을 변화시킨다. */\n this.renderRoot.querySelector('[overlayed]')?.setAttribute('opened', 'true')\n })\n }\n\n disconnectedCallback() {\n document.dispatchEvent(\n new CustomEvent('overlay-closed', {\n detail: this.name\n })\n )\n\n super.disconnectedCallback()\n }\n\n close() {\n this.parentElement?.removeChild(this)\n }\n\n onClose(escape?: boolean) {\n /* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */\n\n if (this.historical) {\n var state = history.state\n var overlay = (state || {}).overlay\n\n if (!overlay || overlay.name !== this.name) {\n return\n }\n\n /* Backdrop click 경우는 escape 시도라고 정의한다. overlay 속성이 escapable이 아닌 경우에는 동작하지 않는다. */\n if (escape && !overlay.escapable) {\n return true\n }\n\n history.back()\n } else {\n this.close()\n }\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { __decorate } from "tslib";
2
- import { LitElement, css, html } from 'lit';
2
+ import { css, html, LitElement } from 'lit';
3
+ import { render } from 'lit-html';
3
4
  import { customElement, state } from 'lit/decorators.js';
4
5
  import { ScrollbarStyles } from '@operato/styles';
5
- import { render } from 'lit-html';
6
6
  let OxPopup = class OxPopup extends LitElement {
7
7
  constructor() {
8
8
  super(...arguments);
@@ -158,6 +158,8 @@ OxPopup.styles = [
158
158
  box-shadow: 2px 3px 10px 5px rgba(0, 0, 0, 0.15);
159
159
  box-sizing: border-box;
160
160
  min-width: fit-content;
161
+ line-height: initial;
162
+ text-align: initial;
161
163
  }
162
164
 
163
165
  :host([active]) {
@@ -1 +1 @@
1
- {"version":3,"file":"ox-popup.js","sourceRoot":"","sources":["../../src/ox-popup.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QA+BY,gBAAW,GAA4B,UAAyB,CAAa;YACrF,MAAM,EAAE,GAAG,CAAC,CAAC,aAA4B,CAAA;YAEzC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;gBACtB,sDAAsD;gBACtD,uBAAuB;gBACvB,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,EAAE,CAAA;aACpC;QACH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IAAI,CAAC,UAAU,CAAC,CAAA;YACpD,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;YACxD,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;YAEpD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;YAC9B,OAAO,IAAI,CAAC,OAAO,CAAA;SACpB;IACH,CAAC;CACF,CAAA;AAjOQ,cAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;KAmBF;CACF,CAAA;AAEQ;IAAR,KAAK,EAAE;wCAAkB;AAzBf,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAkOnB;SAlOY,OAAO","sourcesContent":["import { LitElement, css, html } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { render } from 'lit-html'\n\n@customElement('ox-popup')\nexport class OxPopup extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n position: absolute;\n display: none;\n background-color: var(--theme-white-color, #fff);\n z-index: 100;\n padding: 0;\n box-shadow: 2px 3px 10px 5px rgba(0, 0, 0, 0.15);\n box-sizing: border-box;\n min-width: fit-content;\n }\n\n :host([active]) {\n display: block;\n }\n\n :host(*:focus) {\n outline: none;\n }\n `\n ]\n\n @state() _parent?: Element\n\n render() {\n return html` <slot> </slot> `\n }\n\n protected _onfocusout: (e: FocusEvent) => void = function (this: OxPopup, e: FocusEvent) {\n const to = e.relatedTarget as HTMLElement\n\n if (!this.contains(to)) {\n /* 분명히 내 범위가 아닌 엘리먼트로 포커스가 옮겨졌다면, ox-popup은 닫혀야 한다. */\n // @ts-ignore for debug\n !window.POPUP_DEBUG && this.close()\n }\n }.bind(this)\n\n protected _onkeydown: (e: KeyboardEvent) => void = function (this: OxPopup, 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: OxPopup, e: KeyboardEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onmouseup: (e: MouseEvent) => void = function (this: OxPopup, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onmousedown: (e: MouseEvent) => void = function (this: OxPopup, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _oncontext: (e: Event) => void = function (this: OxPopup, e: Event) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onclick: (e: MouseEvent) => void = function (this: OxPopup, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onclose: (e: Event) => void = function (this: OxPopup, e: Event) {\n this.close()\n }.bind(this)\n\n protected _oncollapse: (e: Event) => void = function (this: OxPopup, e: Event) {\n e.stopPropagation()\n this.close()\n }.bind(this)\n\n protected _onwindowblur: (e: Event) => void = function (this: OxPopup, 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 /**\n * Configuration for opening ox-popup\n *\n * @typedef {Object} PopupOpenOptions\n * @property {HTMLTemplate} template HTMLTemplate to be displayed inside the popup\n * @property {Number} top The position-top where the pop-up will be displayed\n * @property {Number} left The position-left where the pop-up will be displayed\n * @property {HTMLElement} parent Popup's parent element\n */\n\n /**\n * Open Popup\n *\n * @param {PopupOpenOptions}\n */\n static open({\n template,\n top,\n left,\n right,\n bottom,\n width,\n height,\n parent\n }: {\n template: unknown\n top?: number\n left?: number\n right?: number\n bottom?: number\n width?: string\n height?: string\n parent?: Element | null\n }): OxPopup {\n const owner = parent || document.body\n const target = document.createElement('ox-popup') as OxPopup\n\n render(template, target)\n\n target._parent = owner\n owner.appendChild(target)\n\n target.open({ top, left, right, bottom, width, height })\n\n return target\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 }) {\n if (width) {\n this.style.width = width\n }\n if (height) {\n this.style.height = height\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 !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\n guaranteeFocus() {\n const focusible = 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 OxPopup.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"]}
1
+ {"version":3,"file":"ox-popup.js","sourceRoot":"","sources":["../../src/ox-popup.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QAiCY,gBAAW,GAA4B,UAAyB,CAAa;YACrF,MAAM,EAAE,GAAG,CAAC,CAAC,aAA4B,CAAA;YAEzC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;gBACtB,sDAAsD;gBACtD,uBAAuB;gBACvB,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,EAAE,CAAA;aACpC;QACH,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEF,eAAU,GAA+B,UAAyB,CAAgB;YAC1F,CAAC,CAAC,eAAe,EAAE,CAAA;YAEnB,QAAQ,CAAC,CAAC,GAAG,EAAE;gBACb,KAAK,KAAK,CAAC,CAAC,cAAc;gBAC1B,KAAK,QAAQ;oBACX,IAAI,CAAC,KAAK,EAAE,CAAA;oBACZ,MAAK;aACR;QACH,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEF,aAAQ,GAA+B,UAAyB,CAAgB;YACxF,CAAC,CAAC,eAAe,EAAE,CAAA;QACrB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEF,eAAU,GAA4B,UAAyB,CAAa;YACpF,CAAC,CAAC,eAAe,EAAE,CAAA;QACrB,CAAC,CAAC,IAAI,CAAC,IAAI,CA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import { render } from 'lit-html'\nimport { customElement, state } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-popup')\nexport class OxPopup extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n position: absolute;\n display: none;\n background-color: var(--theme-white-color, #fff);\n z-index: 100;\n padding: 0;\n box-shadow: 2px 3px 10px 5px rgba(0, 0, 0, 0.15);\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 ]\n\n @state() _parent?: Element\n\n render() {\n return html` <slot> </slot> `\n }\n\n protected _onfocusout: (e: FocusEvent) => void = function (this: OxPopup, e: FocusEvent) {\n const to = e.relatedTarget as HTMLElement\n\n if (!this.contains(to)) {\n /* 분명히 내 범위가 아닌 엘리먼트로 포커스가 옮겨졌다면, ox-popup은 닫혀야 한다. */\n // @ts-ignore for debug\n !window.POPUP_DEBUG && this.close()\n }\n }.bind(this)\n\n protected _onkeydown: (e: KeyboardEvent) => void = function (this: OxPopup, 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: OxPopup, e: KeyboardEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onmouseup: (e: MouseEvent) => void = function (this: OxPopup, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onmousedown: (e: MouseEvent) => void = function (this: OxPopup, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _oncontext: (e: Event) => void = function (this: OxPopup, e: Event) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onclick: (e: MouseEvent) => void = function (this: OxPopup, e: MouseEvent) {\n e.stopPropagation()\n }.bind(this)\n\n protected _onclose: (e: Event) => void = function (this: OxPopup, e: Event) {\n this.close()\n }.bind(this)\n\n protected _oncollapse: (e: Event) => void = function (this: OxPopup, e: Event) {\n e.stopPropagation()\n this.close()\n }.bind(this)\n\n protected _onwindowblur: (e: Event) => void = function (this: OxPopup, 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 /**\n * Configuration for opening ox-popup\n *\n * @typedef {Object} PopupOpenOptions\n * @property {HTMLTemplate} template HTMLTemplate to be displayed inside the popup\n * @property {Number} top The position-top where the pop-up will be displayed\n * @property {Number} left The position-left where the pop-up will be displayed\n * @property {HTMLElement} parent Popup's parent element\n */\n\n /**\n * Open Popup\n *\n * @param {PopupOpenOptions}\n */\n static open({\n template,\n top,\n left,\n right,\n bottom,\n width,\n height,\n parent\n }: {\n template: unknown\n top?: number\n left?: number\n right?: number\n bottom?: number\n width?: string\n height?: string\n parent?: Element | null\n }): OxPopup {\n const owner = parent || document.body\n const target = document.createElement('ox-popup') as OxPopup\n\n render(template, target)\n\n target._parent = owner\n owner.appendChild(target)\n\n target.open({ top, left, right, bottom, width, height })\n\n return target\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 }) {\n if (width) {\n this.style.width = width\n }\n if (height) {\n this.style.height = height\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 !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\n guaranteeFocus() {\n const focusible = 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 OxPopup.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,46 @@
1
+ import { TemplateResult } from 'lit';
2
+ declare const _default: {
3
+ title: string;
4
+ component: string;
5
+ argTypes: {
6
+ title: {
7
+ constol: string;
8
+ };
9
+ size: {
10
+ control: string;
11
+ options: string[];
12
+ };
13
+ hovering: {
14
+ control: string;
15
+ options: string[];
16
+ };
17
+ closable: {
18
+ control: string;
19
+ };
20
+ escapable: {
21
+ control: string;
22
+ };
23
+ backdrop: {
24
+ control: string;
25
+ };
26
+ help: {
27
+ constol: string;
28
+ };
29
+ };
30
+ };
31
+ export default _default;
32
+ interface Story<T> {
33
+ (args: T): TemplateResult;
34
+ args?: Partial<T>;
35
+ argTypes?: Record<string, unknown>;
36
+ }
37
+ interface ArgTypes {
38
+ title: string;
39
+ size: 'large' | 'medium' | 'small';
40
+ hovering: 'center' | 'next' | 'edge';
41
+ closable: boolean;
42
+ escapable: boolean;
43
+ backdrop: boolean;
44
+ help: string;
45
+ }
46
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,51 @@
1
+ import { html } from 'lit';
2
+ import { openPopup } from '../src/open-popup';
3
+ export default {
4
+ title: 'openPopup',
5
+ component: 'ox-popup',
6
+ argTypes: {
7
+ title: { constol: 'string' },
8
+ size: { control: 'select', options: ['large', 'medium', 'small'] },
9
+ hovering: { control: 'select', options: ['center', 'next', 'edge'] },
10
+ closable: { control: 'boolean' },
11
+ escapable: { control: 'boolean' },
12
+ backdrop: { control: 'boolean' },
13
+ help: { constol: 'string' }
14
+ }
15
+ };
16
+ function popup(e, options) {
17
+ const noImage = new URL('/assets/images/no-image.png', import.meta.url).href;
18
+ return openPopup(html `<img src=${noImage} />`, options);
19
+ }
20
+ const Template = ({ title = '', size = 'medium', hovering = 'center', closable, escapable, backdrop, help }) => 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
35
+ id="place"
36
+ @click=${(e) => popup(e, { title, size, hovering, closable, escapable, backdrop, help })}
37
+ >
38
+ Click this to popup image
39
+ </div>
40
+ `;
41
+ export const Regular = Template.bind({});
42
+ Regular.args = {
43
+ title: 'Regular popup',
44
+ size: 'medium',
45
+ hovering: 'center',
46
+ closable: true,
47
+ escapable: true,
48
+ backdrop: true,
49
+ help: ''
50
+ };
51
+ //# sourceMappingURL=open-popup.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-popup.stories.js","sourceRoot":"","sources":["../../stories/open-popup.stories.ts"],"names":[],"m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,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;;;GAIvG,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,EAAE;CACT,CAAA","sourcesContent":["import { html, TemplateResult } from 'lit'\n\nimport { openPopup, PopupOptions } from '../src/open-popup'\n\nexport default {\n title: 'openPopup',\n component: 'ox-popup',\n argTypes: {\n title: { constol: 'string' },\n size: { control: 'select', options: ['large', 'medium', 'small'] },\n hovering: { control: 'select', options: ['center', 'next', 'edge'] },\n closable: { control: 'boolean' },\n escapable: { control: 'boolean' },\n backdrop: { control: 'boolean' },\n help: { constol: 'string' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n title: string\n size: 'large' | 'medium' | 'small'\n hovering: 'center' | 'next' | 'edge'\n closable: boolean\n escapable: boolean\n backdrop: boolean\n help: string\n}\n\nfunction popup(e: MouseEvent, options: PopupOptions) {\n const noImage = new URL('/assets/images/no-image.png', import.meta.url).href\n\n return openPopup(html`<img src=${noImage} />`, options)\n}\n\nconst Template: Story<ArgTypes> = ({\n title = '',\n size = 'medium',\n hovering = 'center',\n closable,\n escapable,\n backdrop,\n help\n}: 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\n id=\"place\"\n @click=${(e: MouseEvent) => popup(e, { title, size, hovering, closable, escapable, backdrop, help })}\n >\n Click this to popup image\n </div>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {\n title: 'Regular popup',\n size: 'medium',\n hovering: 'center',\n closable: true,\n escapable: true,\n backdrop: true,\n help: ''\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import '@material/mwc-icon';
2
+ import '@operato/input/ox-checkbox.js';
3
+ import '../src/ox-popup-list.js';
4
+ import { TemplateResult } from 'lit';
5
+ declare const _default: {
6
+ title: string;
7
+ component: string;
8
+ argTypes: {};
9
+ };
10
+ export default _default;
11
+ interface Story<T> {
12
+ (args: T): TemplateResult;
13
+ args?: Partial<T>;
14
+ argTypes?: Record<string, unknown>;
15
+ }
16
+ interface ArgTypes {
17
+ }
18
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,50 @@
1
+ import '@material/mwc-icon';
2
+ import '@operato/input/ox-checkbox.js';
3
+ import '../src/ox-popup-list.js';
4
+ import { html } from 'lit';
5
+ export default {
6
+ title: 'OxPopuList',
7
+ component: 'ox-popup-list',
8
+ argTypes: {}
9
+ };
10
+ function popup(e) {
11
+ const popupList = document.querySelector('#popup-list');
12
+ popupList === null || popupList === void 0 ? void 0 : popupList.open({
13
+ top: e.pageY,
14
+ left: e.pageX
15
+ });
16
+ }
17
+ const Template = ({}) => html `
18
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
19
+ <style>
20
+ #place {
21
+ width: 100%;
22
+ height: 500px;
23
+ background: lightgreen;
24
+ text-align: center;
25
+ line-height: 500px;
26
+ }
27
+ </style>
28
+
29
+ <div id="place" @click=${(e) => popup(e)}>Click this to popup list</div>
30
+ <ox-popup-list id="popup-list" @select=${(e) => console.log('select', e.target)} multiple>
31
+ <div option>Plain Text</div>
32
+
33
+ <div option>
34
+ <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
35
+ </div>
36
+
37
+ <div option>
38
+ <input id="checkbox-01" type="checkbox" />
39
+ <label for="checkbox-01">custom option</label>
40
+ </div>
41
+
42
+ <div option>
43
+ <label for="text-01">value</label>
44
+ <input id="text-01" type="text" value="Plain text input" />
45
+ </div>
46
+ </ox-popup-list>
47
+ `;
48
+ export const Regular = Template.bind({});
49
+ Regular.args = {};
50
+ //# sourceMappingURL=ox-popup-list.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-popup-list.stories.js","sourceRoot":"","sources":["../../stories/ox-popup-list.stories.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,+BAA+B,CAAA;AACtC,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAI1C,eAAe;IACb,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE,EAAE;CACb,CAAA;AAUD,SAAS,KAAK,CAAC,CAAa;IAC1B,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAgB,CAAA;IACtE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAC;QACd,GAAG,EAAE,CAAC,CAAC,KAAK;QACZ,IAAI,EAAE,CAAC,CAAC,KAAK;KACd,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,QAAQ,GAAoB,CAAC,EAAY,EAAE,EAAE,CACjD,IAAI,CAAA;;;;;;;;;;;;6BAYuB,CAAC,CAAa,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;6CACX,CAAC,CAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;GAiBvF,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAA","sourcesContent":["import '@material/mwc-icon'\nimport '@operato/input/ox-checkbox.js'\nimport '../src/ox-popup-list.js'\n\nimport { html, TemplateResult } from 'lit'\n\nimport { OxPopupList } from '../src/ox-popup-list.js'\n\nexport default {\n title: 'OxPopuList',\n component: 'ox-popup-list',\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 popupList = document.querySelector('#popup-list') as OxPopupList\n popupList?.open({\n top: e.pageY,\n left: e.pageX\n })\n}\n\nconst Template: Story<ArgTypes> = ({}: ArgTypes) =>\n html`\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\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 popup list</div>\n <ox-popup-list id=\"popup-list\" @select=${(e: Event) => console.log('select', e.target)} multiple>\n <div option>Plain Text</div>\n\n <div option>\n <ox-checkbox label=\"checkbox\" slot=\"icon\" checked />checkbox</ox-checkbox>\n </div>\n\n <div option>\n <input id=\"checkbox-01\" type=\"checkbox\" />\n <label for=\"checkbox-01\">custom option</label>\n </div>\n \n <div option>\n <label for=\"text-01\">value</label>\n <input id=\"text-01\" type=\"text\" value=\"Plain text input\" />\n </div>\n </ox-popup-list>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {}\n"]}
@@ -0,0 +1,19 @@
1
+ import '../src/ox-popup-menu.js';
2
+ import '../src/ox-popup-menuitem.js';
3
+ import '@material/mwc-icon';
4
+ import '@operato/input/ox-checkbox.js';
5
+ import { TemplateResult } from 'lit';
6
+ declare const _default: {
7
+ title: string;
8
+ component: string;
9
+ argTypes: {};
10
+ };
11
+ export default _default;
12
+ interface Story<T> {
13
+ (args: T): TemplateResult;
14
+ args?: Partial<T>;
15
+ argTypes?: Record<string, unknown>;
16
+ }
17
+ interface ArgTypes {
18
+ }
19
+ export declare const Regular: Story<ArgTypes>;