@operato/popup 2.0.0-alpha.99 → 2.0.0-beta.12

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 (68) hide show
  1. package/CHANGELOG.md +246 -0
  2. package/dist/src/ox-floating-overlay.js +17 -14
  3. package/dist/src/ox-floating-overlay.js.map +1 -1
  4. package/dist/src/ox-popup-list.d.ts +17 -3
  5. package/dist/src/ox-popup-list.js +109 -31
  6. package/dist/src/ox-popup-list.js.map +1 -1
  7. package/dist/src/ox-popup-menu.js +21 -16
  8. package/dist/src/ox-popup-menu.js.map +1 -1
  9. package/dist/src/ox-popup-menuitem.js +5 -5
  10. package/dist/src/ox-popup-menuitem.js.map +1 -1
  11. package/dist/src/ox-popup.d.ts +1 -0
  12. package/dist/src/ox-popup.js +19 -9
  13. package/dist/src/ox-popup.js.map +1 -1
  14. package/dist/src/ox-prompt.js +68 -28
  15. package/dist/src/ox-prompt.js.map +1 -1
  16. package/dist/stories/open-popup.stories.d.ts +6 -0
  17. package/dist/stories/open-popup.stories.js +26 -6
  18. package/dist/stories/open-popup.stories.js.map +1 -1
  19. package/dist/stories/ox-popup-list-sortable.stories.d.ts +24 -0
  20. package/dist/stories/ox-popup-list-sortable.stories.js +169 -0
  21. package/dist/stories/ox-popup-list-sortable.stories.js.map +1 -0
  22. package/dist/stories/ox-popup-list.stories.d.ts +8 -2
  23. package/dist/stories/ox-popup-list.stories.js +52 -32
  24. package/dist/stories/ox-popup-list.stories.js.map +1 -1
  25. package/dist/stories/ox-popup-menu.stories.d.ts +8 -2
  26. package/dist/stories/ox-popup-menu.stories.js +26 -7
  27. package/dist/stories/ox-popup-menu.stories.js.map +1 -1
  28. package/dist/stories/ox-popup.stories.d.ts +8 -1
  29. package/dist/stories/ox-popup.stories.js +47 -13
  30. package/dist/stories/ox-popup.stories.js.map +1 -1
  31. package/dist/stories/ox-prompt-icon.stories.d.ts +6 -0
  32. package/dist/stories/ox-prompt-icon.stories.js +24 -9
  33. package/dist/stories/ox-prompt-icon.stories.js.map +1 -1
  34. package/dist/stories/ox-prompt-normal.stories.d.ts +8 -1
  35. package/dist/stories/ox-prompt-normal.stories.js +25 -7
  36. package/dist/stories/ox-prompt-normal.stories.js.map +1 -1
  37. package/dist/stories/ox-prompt.stories.d.ts +7 -1
  38. package/dist/stories/ox-prompt.stories.js +26 -9
  39. package/dist/stories/ox-prompt.stories.js.map +1 -1
  40. package/dist/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +5 -4
  42. package/src/ox-floating-overlay.ts +17 -14
  43. package/src/ox-popup-list.ts +133 -34
  44. package/src/ox-popup-menu.ts +21 -16
  45. package/src/ox-popup-menuitem.ts +5 -5
  46. package/src/ox-popup.ts +17 -9
  47. package/src/ox-prompt.ts +71 -28
  48. package/stories/open-popup.stories.ts +28 -6
  49. package/stories/ox-popup-list-sortable.stories.ts +188 -0
  50. package/stories/ox-popup-list.stories.ts +55 -34
  51. package/stories/ox-popup-menu.stories.ts +29 -8
  52. package/stories/ox-popup.stories.ts +51 -16
  53. package/stories/ox-prompt-icon.stories.ts +30 -9
  54. package/stories/ox-prompt-normal.stories.ts +28 -8
  55. package/stories/ox-prompt.stories.ts +30 -10
  56. package/themes/dark-hc.css +151 -0
  57. package/themes/dark-mc.css +151 -0
  58. package/themes/dark.css +151 -0
  59. package/themes/grist-theme.css +173 -0
  60. package/themes/light-hc.css +151 -0
  61. package/themes/light-mc.css +151 -0
  62. package/themes/light.css +151 -0
  63. package/themes/md-typescale-styles.css +100 -0
  64. package/themes/spacing.css +43 -0
  65. package/themes/state-color.css +6 -0
  66. package/themes/app-theme.css +0 -145
  67. package/themes/input-theme.css +0 -19
  68. package/themes/material-theme.css +0 -88
package/src/ox-prompt.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import '@material/web/button/elevated-button.js'
2
2
  import '@material/web/icon/icon.js'
3
+ import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
3
4
 
4
5
  import { css, html, nothing, LitElement } from 'lit'
5
6
  import { render } from 'lit-html'
@@ -20,21 +21,21 @@ const TYPES_ICON = {
20
21
  @customElement('ox-prompt')
21
22
  export class OxPrompt extends LitElement {
22
23
  static styles = [
24
+ MDTypeScaleStyles,
23
25
  ScrollbarStyles,
24
26
  css`
25
27
  :host {
26
- --prompt-container-border-radius: 12px;
27
- --prompt-container-box-shadow: 2px 3px 10px 5px rgba(0, 0, 0, 0.15);
28
-
29
28
  position: absolute;
30
- display: none;
31
- background-color: var(--theme-white-color, #fff);
29
+ display: flex;
30
+ flex-direction: column;
31
+ gap: var(--ox-prompt-gap, var(--spacing-medium));
32
+ background-color: var(--ox-popup-list-background-color, var(--md-sys-color-surface));
32
33
  z-index: 100;
33
- padding: var(--padding-wide);
34
- box-shadow: var(--prompt-container-box-shadow);
35
- border-radius: var(--prompt-container-border-radius);
34
+ padding: var(--ox-prompt-container-padding, var(--spacing-medium));
35
+ box-shadow: var(--ox-prompt-container-box-shadow, 2px 3px 10px 5px rgba(0, 0, 0, 0.15));
36
+ border-radius: var(--ox-prompt-container-border-radius, var(--md-sys-shape-corner-medium));
36
37
  box-sizing: border-box;
37
- min-width: 260px;
38
+ min-width: 300;
38
39
  line-height: initial;
39
40
  text-align: initial;
40
41
  }
@@ -48,23 +49,25 @@ export class OxPrompt extends LitElement {
48
49
  }
49
50
 
50
51
  [titler] {
51
- padding: var(--default-padding, 6px);
52
- font: var(--title-font);
53
- color: var(--title-text-color);
52
+ padding: var(--ox-prompt-title-padding, var(--spacing-medium));
53
+ padding-bottom: 0;
54
+ color: var(--ox-prompt-title-color, var(--md-sys-color-primary));
55
+ font-size: var(--md-sys-typescale-label-large-weight, var(--md-ref-typeface-weight-medium, 500));
56
+ font-weight: var(--md-sys-typescale-label-large-weight, var(--md-ref-typeface-weight-medium, 500));
54
57
  }
55
58
 
56
59
  [content] {
57
60
  display: flex;
58
61
  flex-direction: column;
59
- gap: var(--margin-default);
60
- padding: var(--padding-default);
61
- color: var(--primary-text-color);
62
+ gap: var(--ox-prompt-content-gap, var(--spacing-medium));
63
+ padding: var(--ox-prompt-content-padding, var(--spacing-medium));
64
+ color: var(--ox-prompt-body-color, var(--md-sys-color-on-surface));
62
65
  word-break: keep-all;
63
66
 
64
67
  md-icon {
65
68
  align-self: center;
66
- --md-icon-size: 60px;
67
- color: var(--primary-color);
69
+ --md-icon-size: var(--icon-size-huge);
70
+ color: var(--ox-prompt-body-color-variant, var(--md-sys-color-primary));
68
71
  }
69
72
  }
70
73
 
@@ -73,7 +76,7 @@ export class OxPrompt extends LitElement {
73
76
  }
74
77
 
75
78
  [content].error md-icon {
76
- color: var(--status-danger-color, #d14946);
79
+ color: var(--status-danger-color, var(--md-sys-color-error));
77
80
  }
78
81
 
79
82
  [content].info md-icon {
@@ -86,11 +89,37 @@ export class OxPrompt extends LitElement {
86
89
 
87
90
  [buttons] {
88
91
  display: flex;
89
- gap: var(--margin-default);
90
- padding: var(--padding-wide) 0 var(--padding-narrow) 0;
91
- border-top: var(--border-dark-color);
92
+ border-top: 1px solid var(--md-sys-color-surface-variant);
93
+ gap: var(--ox-prompt-buttons-spacing, var(--spacing-large));
94
+ padding: var(--ox-prompt-buttons-padding, var(--spacing-medium));
95
+ padding-top: var(--spacing-large);
92
96
  justify-content: center;
93
97
  }
98
+
99
+ #confirm {
100
+ --md-filled-button-container-color: var(--md-sys-color-primary);
101
+ --md-filled-button-label-text-color: var(--md-sys-color-primary-container);
102
+ --md-filled-button-label-text-size: var(--md-sys-typescale-label-large-size, 0.875rem);
103
+ --md-filled-button-container-height: var(--form-element-height-medium);
104
+ --md-filled-button-container-shape: var(--md-sys-shape-corner-small);
105
+ --md-filled-button-leading-space: var(--spacing-large);
106
+ --md-filled-button-trailing-space: var(--spacing-large);
107
+ --md-filled-button-hover-label-text-color: var(--md-sys-color-secondary-container);
108
+ --md-filled-button-pressed-label-text-color: var(--md-sys-color-secondary-container);
109
+ --md-filled-button-focus-label-text-color: var(--md-sys-color-secondary-container);
110
+ }
111
+
112
+ #cancel {
113
+ --md-outlined-button-label-text-color: var(--md-sys-color-on-surface-variant);
114
+ --md-outlined-button-label-text-size: var(--md-sys-typescale-label-large-size, 0.875rem);
115
+ --md-outlined-button-container-height: var(--form-element-height-medium);
116
+ --md-outlined-button-container-shape: var(--md-sys-shape-corner-small);
117
+ --md-outlined-button-leading-space: var(--spacing-large);
118
+ --md-outlined-button-trailing-space: var(--spacing-large);
119
+ --md-outlined-button-hover-label-text-color: var(--md-sys-color-primary);
120
+ --md-outlined-button-pressed-outline-color: var(--md-sys-color-primary);
121
+ --md-outlined-button-pressed-label-text-color: var(--md-sys-color-primary);
122
+ }
94
123
  `
95
124
  ]
96
125
 
@@ -145,26 +174,26 @@ export class OxPrompt extends LitElement {
145
174
 
146
175
  render() {
147
176
  return html`
148
- ${this.titler ? html` <div titler>${this.titler}</div> ` : nothing}
149
- <div content class="${this.type || 'info'}">
177
+ ${this.titler ? html` <div titler class="md-typescale-title-large">${this.titler}</div> ` : nothing}
178
+ <div content class="${this.type || 'info'} md-typescale-body-large">
150
179
  ${this.icon || this.type
151
180
  ? html` <md-icon icon>${this.icon || TYPES_ICON[this.type || 'info']}</md-icon> `
152
181
  : nothing}
153
182
  ${this.text ? html` <div text>${this.text}</div> ` : nothing}
154
183
  <slot> </slot>
155
- ${this.footer ? html` <div footer>${this.footer}</div> ` : nothing}
184
+ ${this.footer ? html` <div footer class="md-typescale-body-large">${this.footer}</div> ` : nothing}
156
185
  </div>
157
186
  <div buttons>
158
187
  ${this.confirmButton
159
188
  ? html`
160
- <md-elevated-button raised @click=${(e: Event) => this.onConfirm()}
189
+ <md-filled-button id="confirm" @click=${(e: Event) => this.onConfirm()}
161
190
  >${this.confirmButton?.text}</md-elevated-button
162
191
  >
163
192
  `
164
193
  : nothing}
165
194
  ${this.cancelButton
166
195
  ? html`
167
- <md-elevated-button raised @click=${(e: Event) => this.onCancel()}
196
+ <md-outlined-button id="cancel" @click=${(e: Event) => this.onCancel()}
168
197
  >${this.cancelButton?.text}</md-elevated-button
169
198
  >
170
199
  `
@@ -195,7 +224,12 @@ export class OxPrompt extends LitElement {
195
224
  if (!this.contains(to)) {
196
225
  /* 분명히 내 범위가 아닌 엘리먼트로 포커스가 옮겨졌다면, ox-prompt은 닫혀야 한다. */
197
226
  // @ts-ignore for debug
198
- !window.POPUP_DEBUG && this.close()
227
+ if (window.POPUP_DEBUG) {
228
+ return
229
+ }
230
+
231
+ this.resolveFn && this.resolveFn(false)
232
+ this.close()
199
233
  }
200
234
  }.bind(this)
201
235
 
@@ -205,6 +239,7 @@ export class OxPrompt extends LitElement {
205
239
  switch (e.key) {
206
240
  case 'Esc': // for IE/Edge
207
241
  case 'Escape':
242
+ this.resolveFn && this.resolveFn(false)
208
243
  this.close()
209
244
  break
210
245
  }
@@ -231,17 +266,25 @@ export class OxPrompt extends LitElement {
231
266
  }.bind(this)
232
267
 
233
268
  protected _onclose: (e: Event) => void = function (this: OxPrompt, e: Event) {
269
+ this.resolveFn && this.resolveFn(false)
234
270
  this.close()
235
271
  }.bind(this)
236
272
 
237
273
  protected _oncollapse: (e: Event) => void = function (this: OxPrompt, e: Event) {
238
274
  e.stopPropagation()
275
+
276
+ this.resolveFn && this.resolveFn(false)
239
277
  this.close()
240
278
  }.bind(this)
241
279
 
242
280
  protected _onwindowblur: (e: Event) => void = function (this: OxPrompt, e: Event) {
243
281
  // @ts-ignore for debug
244
- !window.POPUP_DEBUG && this.close()
282
+ if (window.POPUP_DEBUG) {
283
+ return
284
+ }
285
+
286
+ this.resolveFn && this.resolveFn(false)
287
+ this.close()
245
288
  }.bind(this)
246
289
 
247
290
  connectedCallback() {
@@ -1,6 +1,8 @@
1
+ import '@material/web/all.js'
1
2
  import { html, TemplateResult } from 'lit'
2
3
 
3
4
  import { openPopup, PopupOptions } from '../src/open-popup'
5
+ import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
4
6
 
5
7
  export default {
6
8
  title: 'openPopup',
@@ -12,7 +14,8 @@ export default {
12
14
  closable: { control: 'boolean' },
13
15
  escapable: { control: 'boolean' },
14
16
  backdrop: { control: 'boolean' },
15
- help: { constol: 'string' }
17
+ help: { constol: 'string' },
18
+ theme: { control: 'select', options: ['light', 'dark'] }
16
19
  }
17
20
  }
18
21
 
@@ -30,6 +33,7 @@ interface ArgTypes {
30
33
  escapable: boolean
31
34
  backdrop: boolean
32
35
  help: string
36
+ theme?: 'light' | 'dark'
33
37
  }
34
38
 
35
39
  function popup(e: MouseEvent, options: PopupOptions) {
@@ -45,9 +49,14 @@ const Template: Story<ArgTypes> = ({
45
49
  closable,
46
50
  escapable,
47
51
  backdrop,
48
- help
52
+ help,
53
+ theme = 'light'
49
54
  }: ArgTypes) => html`
50
- <link href="/themes/app-theme.css" rel="stylesheet" />
55
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
56
+
57
+ <link href="/themes/light.css" rel="stylesheet" />
58
+ <link href="/themes/dark.css" rel="stylesheet" />
59
+ <link href="/themes/spacing.css" rel="stylesheet" />
51
60
 
52
61
  <link
53
62
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
@@ -62,17 +71,30 @@ const Template: Story<ArgTypes> = ({
62
71
  rel="stylesheet"
63
72
  />
64
73
 
74
+ <style>
75
+ ${MDTypeScaleStyles.cssText}
76
+ </style>
77
+
65
78
  <style>
66
79
  #place {
67
80
  width: 100%;
68
81
  height: 500px;
69
- background: lightgreen;
70
82
  text-align: center;
71
- line-height: 500px;
83
+
84
+ background-color: var(--md-sys-color-primary-container);
85
+ color: var(--md-sys-color-on-primary-container);
72
86
  }
73
87
  </style>
74
88
 
75
- <div id="place" @click=${(e: MouseEvent) => popup(e, { title, size, hovering, closable, escapable, backdrop, help })}>
89
+ <script>
90
+ document.body.classList.add('${theme}')
91
+ </script>
92
+
93
+ <div
94
+ id="place"
95
+ @click=${(e: MouseEvent) => popup(e, { title, size, hovering, closable, escapable, backdrop, help })}
96
+ class="md-typescale-display-medium"
97
+ >
76
98
  Click this to popup image
77
99
  </div>
78
100
  `
@@ -0,0 +1,188 @@
1
+ import '@material/web/icon/icon.js'
2
+ import '@material/web/button/outlined-button.js'
3
+ import '@operato/input/ox-checkbox.js'
4
+ import '../src/ox-popup-list.js'
5
+
6
+ import { html, TemplateResult } from 'lit'
7
+
8
+ import { OxPopupList } from '../src/ox-popup-list.js'
9
+
10
+ export default {
11
+ title: 'sortable OxPopupList',
12
+ component: 'ox-popup-list',
13
+ argTypes: {
14
+ debug: { control: 'boolean' }
15
+ }
16
+ }
17
+
18
+ interface Story<T> {
19
+ (args: T): TemplateResult
20
+ args?: Partial<T>
21
+ argTypes?: Record<string, unknown>
22
+ }
23
+
24
+ interface ArgTypes {
25
+ debug: boolean
26
+ }
27
+
28
+ function popup(e: MouseEvent) {
29
+ const popupList = document.querySelector('#popup-list') as OxPopupList
30
+ popupList?.open({
31
+ top: e.pageY,
32
+ left: e.pageX
33
+ })
34
+ }
35
+
36
+ const columns = [
37
+ {
38
+ name: 'AAAAAA',
39
+ hidden: false
40
+ },
41
+ {
42
+ name: 'BBBBBB',
43
+ hidden: true
44
+ },
45
+ {
46
+ name: 'CCCCCC',
47
+ hidden: false
48
+ },
49
+ {
50
+ name: 'DDDDDD',
51
+ hidden: false
52
+ },
53
+ {
54
+ name: 'EEEEEE',
55
+ hidden: false
56
+ },
57
+ {
58
+ name: 'FFFFFF',
59
+ hidden: false
60
+ },
61
+ {
62
+ name: 'GGGGGG',
63
+ hidden: false
64
+ },
65
+ {
66
+ name: 'HHHHHH',
67
+ hidden: false
68
+ },
69
+ {
70
+ name: 'IIIIII',
71
+ hidden: false
72
+ },
73
+ {
74
+ name: 'JJJJJJ',
75
+ hidden: false
76
+ },
77
+ {
78
+ name: 'KKKKKK',
79
+ hidden: false
80
+ },
81
+ {
82
+ name: 'LLLLLL',
83
+ hidden: false
84
+ },
85
+ {
86
+ name: 'MMMMMM',
87
+ hidden: false
88
+ }
89
+ ]
90
+
91
+ const Template: Story<ArgTypes> = ({ debug }: ArgTypes) => html`
92
+ <link
93
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
94
+ rel="stylesheet"
95
+ />
96
+ <link
97
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
98
+ rel="stylesheet"
99
+ />
100
+ <link
101
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
102
+ rel="stylesheet"
103
+ />
104
+
105
+ <style>
106
+ #place {
107
+ width: 100%;
108
+ height: 100px;
109
+ background: lightgreen;
110
+ text-align: center;
111
+ line-height: 100px;
112
+ }
113
+
114
+ ox-popup-list {
115
+ width: 240px;
116
+ max-height: 240px;
117
+ overflow: hidden;
118
+ }
119
+
120
+ [titler] {
121
+ --md-icon-size: 1.2em;
122
+ --md-outlined-button-container-height: 24px;
123
+ --md-outlined-button-container-shape: 4px;
124
+ --md-outlined-button-leading-space: 4px;
125
+ --md-outlined-button-trailing-space: 4px;
126
+
127
+ display: flex;
128
+ flex-direction: row;
129
+ align-items: center;
130
+ text-transform: capitalize;
131
+ }
132
+
133
+ md-outlined-button {
134
+ margin-left: auto;
135
+ }
136
+
137
+ [option] {
138
+ position: relative; /* 상대 위치 설정 */
139
+ cursor: move; /* 커서를 이동 가능 표시로 변경 */
140
+ user-select: none;
141
+ }
142
+
143
+ [option]::after {
144
+ content: '☰'; /* 드래그 핸들 아이콘 (혹은 기호) */
145
+ position: absolute; /* 절대 위치 설정 */
146
+ top: 0; /* 위에서부터 10px */
147
+ right: 10px; /* 오른쪽에서부터 10px */
148
+ font-size: 20px; /* 폰트 크기 설정 */
149
+ color: #888; /* 폰트 색상 설정 */
150
+ }
151
+
152
+ div[overlay] {
153
+ display: block;
154
+ width: 300px;
155
+ height: 300px;
156
+ left: 100px;
157
+ top: 100px;
158
+ z-index: 10;
159
+ background-color: var(--md-sys-color-surface);
160
+ }
161
+ </style>
162
+
163
+ <div id="place" @click=${(e: MouseEvent) => popup(e)}>
164
+ Click this to popup list
165
+ <ox-popup-list
166
+ id="popup-list"
167
+ @select=${(e: Event) => console.log('select', e.target)}
168
+ @sorted=${(e: Event) => {
169
+ console.log('sorted\n', (e as CustomEvent).detail.map((element: any) => element.value).join('\n'))
170
+ }}
171
+ multiple
172
+ sortable
173
+ ?debug=${debug}
174
+ >
175
+ <div slot="header" titler>Plain Text <md-outlined-button>save</md-outlined-button></div>
176
+ ${columns.map(
177
+ column => html`
178
+ <ox-checkbox label="checkbox" ?checked=${!column.hidden} value=${column.name} option />${column.name}</ox-checkbox>
179
+ `
180
+ )}
181
+ </ox-popup-list>
182
+ </div>
183
+
184
+ <div overlay>OVERLAYED</div>
185
+ `
186
+
187
+ export const Regular = Template.bind({})
188
+ Regular.args = {}
@@ -1,15 +1,18 @@
1
- import '@material/web/icon/icon.js'
1
+ import '@material/web/all.js'
2
2
  import '@operato/input/ox-checkbox.js'
3
3
  import '../src/ox-popup-list.js'
4
4
 
5
5
  import { html, TemplateResult } from 'lit'
6
+ import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
6
7
 
7
8
  import { OxPopupList } from '../src/ox-popup-list.js'
8
9
 
9
10
  export default {
10
11
  title: 'OxPopupList',
11
12
  component: 'ox-popup-list',
12
- argTypes: {}
13
+ argTypes: {
14
+ theme: { control: 'select', options: ['light', 'dark'] }
15
+ }
13
16
  }
14
17
 
15
18
  interface Story<T> {
@@ -18,7 +21,9 @@ interface Story<T> {
18
21
  argTypes?: Record<string, unknown>
19
22
  }
20
23
 
21
- interface ArgTypes {}
24
+ interface ArgTypes {
25
+ theme?: 'light' | 'dark'
26
+ }
22
27
 
23
28
  function popup(e: MouseEvent) {
24
29
  const popupList = document.querySelector('#popup-list') as OxPopupList
@@ -28,8 +33,13 @@ function popup(e: MouseEvent) {
28
33
  })
29
34
  }
30
35
 
31
- const Template: Story<ArgTypes> = ({}: ArgTypes) =>
32
- html`
36
+ const Template: Story<ArgTypes> = ({ theme = 'light' }: ArgTypes) => html`
37
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
38
+
39
+ <link href="/themes/light.css" rel="stylesheet" />
40
+ <link href="/themes/dark.css" rel="stylesheet" />
41
+ <link href="/themes/spacing.css" rel="stylesheet" />
42
+
33
43
  <link
34
44
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
35
45
  rel="stylesheet"
@@ -42,36 +52,47 @@ const Template: Story<ArgTypes> = ({}: ArgTypes) =>
42
52
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
43
53
  rel="stylesheet"
44
54
  />
45
-
55
+
56
+ <style>
57
+ ${MDTypeScaleStyles.cssText}
58
+ </style>
59
+
46
60
  <style>
47
- #place {
48
- width: 100%;
49
- height: 500px;
50
- background: lightgreen;
51
- text-align: center;
52
- line-height: 500px;
53
- }
54
- </style>
55
-
56
- <div id="place" @click=${(e: MouseEvent) => popup(e)}>Click this to popup list</div>
57
- <ox-popup-list id="popup-list" @select=${(e: Event) => console.log('select', e.target)} multiple>
58
- <div option>Plain Text</div>
59
-
60
- <div option>
61
- <ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
62
- </div>
63
-
64
- <div option>
65
- <input id="checkbox-01" type="checkbox" />
66
- <label for="checkbox-01">custom option</label>
67
- </div>
68
-
69
- <div option>
70
- <label for="text-01">value</label>
71
- <input id="text-01" type="text" value="Plain text input" />
72
- </div>
73
- </ox-popup-list>
74
- `
61
+ #place {
62
+ width: 100%;
63
+ height: 500px;
64
+ text-align: center;
65
+
66
+ background-color: var(--md-sys-color-primary-container);
67
+ color: var(--md-sys-color-on-primary-container);
68
+ }
69
+ </style>
70
+
71
+ <script>
72
+ document.body.classList.add('${theme}')
73
+ </script>
74
+
75
+ <div id="place" @click=${(e: MouseEvent) => popup(e)} class="md-typescale-display-medium">
76
+ Click this to popup list
77
+ </div>
78
+ <ox-popup-list id="popup-list" @select=${(e: Event) => console.log('select', e.target)} multiple>
79
+ <div option>Plain Text</div>
80
+
81
+ <div option>
82
+ <ox-checkbox label="checkbox" slot="icon" checked>checkbox</ox-checkbox>
83
+ </div>
84
+
85
+ <div option>
86
+ <input id="checkbox-01" type="checkbox" />
87
+ <label for="checkbox-01">custom option</label>
88
+ </div>
89
+
90
+ <div option>
91
+ <label for="text-01">value</label>
92
+ <input id="text-01" type="text" value="Plain text input" />
93
+ </div>
94
+ </ox-popup-list>
95
+ `
75
96
 
76
97
  export const Regular = Template.bind({})
77
98
  Regular.args = {}
@@ -1,16 +1,19 @@
1
+ import '@material/web/all.js'
1
2
  import '../src/ox-popup-menu.js'
2
3
  import '../src/ox-popup-menuitem.js'
3
- import '@material/web/icon/icon.js'
4
4
  import '@operato/input/ox-checkbox.js'
5
5
 
6
6
  import { html, TemplateResult } from 'lit'
7
+ import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
7
8
 
8
9
  import { OxPopupMenu } from '../src/ox-popup-menu.js'
9
10
 
10
11
  export default {
11
12
  title: 'OxPopuMenu',
12
13
  component: 'ox-popup-menu',
13
- argTypes: {}
14
+ argTypes: {
15
+ theme: { control: 'select', options: ['light', 'dark'] }
16
+ }
14
17
  }
15
18
 
16
19
  interface Story<T> {
@@ -19,7 +22,9 @@ interface Story<T> {
19
22
  argTypes?: Record<string, unknown>
20
23
  }
21
24
 
22
- interface ArgTypes {}
25
+ interface ArgTypes {
26
+ theme?: 'light' | 'dark'
27
+ }
23
28
 
24
29
  function popup(e: MouseEvent) {
25
30
  OxPopupMenu.open({
@@ -86,7 +91,6 @@ function popup(e: MouseEvent) {
86
91
  <input type="checkbox" slot="icon" />
87
92
  </ox-popup-menuitem>
88
93
 
89
- <div separator></div>
90
94
  </ox-popup-menu>
91
95
  </ox-popup-menuitem>
92
96
 
@@ -125,7 +129,13 @@ function popup(e: MouseEvent) {
125
129
  })
126
130
  }
127
131
 
128
- const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
132
+ const Template: Story<ArgTypes> = ({ theme = 'light' }: ArgTypes) => html`
133
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
134
+
135
+ <link href="/themes/light.css" rel="stylesheet" />
136
+ <link href="/themes/dark.css" rel="stylesheet" />
137
+ <link href="/themes/spacing.css" rel="stylesheet" />
138
+
129
139
  <link
130
140
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
131
141
  rel="stylesheet"
@@ -139,17 +149,28 @@ const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
139
149
  rel="stylesheet"
140
150
  />
141
151
 
152
+ <style>
153
+ ${MDTypeScaleStyles.cssText}
154
+ </style>
155
+
142
156
  <style>
143
157
  #place {
144
158
  width: 100%;
145
159
  height: 500px;
146
- background: lightgreen;
147
160
  text-align: center;
148
- line-height: 500px;
161
+
162
+ background-color: var(--md-sys-color-primary-container);
163
+ color: var(--md-sys-color-on-primary-container);
149
164
  }
150
165
  </style>
151
166
 
152
- <div id="place" @click=${(e: MouseEvent) => popup(e)}>Click this to popup menu</div>
167
+ <script>
168
+ document.body.classList.add('${theme}')
169
+ </script>
170
+
171
+ <div id="place" @click=${(e: MouseEvent) => popup(e)} class="md-typescale-display-medium">
172
+ Click this to popup menu
173
+ </div>
153
174
  `
154
175
 
155
176
  export const Regular = Template.bind({})