@operato/popup 8.0.0-alpha.51 → 8.0.0-beta.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 +17 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/src/index.ts +0 -7
- package/src/open-popup.ts +0 -166
- package/src/ox-floating-overlay.ts +0 -618
- package/src/ox-popup-list.ts +0 -577
- package/src/ox-popup-menu.ts +0 -247
- package/src/ox-popup-menuitem.ts +0 -187
- package/src/ox-popup.ts +0 -400
- package/src/ox-prompt.ts +0 -549
- package/src/position-converter.ts +0 -37
- package/stories/open-popup.stories.ts +0 -104
- package/stories/ox-popup-list-sortable.stories.ts +0 -215
- package/stories/ox-popup-list.stories.ts +0 -121
- package/stories/ox-popup-menu.stories.ts +0 -188
- package/stories/ox-popup.stories.ts +0 -79
- package/stories/ox-prompt-icon.stories.ts +0 -87
- package/stories/ox-prompt-normal.stories.ts +0 -80
- package/stories/ox-prompt.stories.ts +0 -82
- package/tsconfig.json +0 -25
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
@@ -1,215 +0,0 @@
|
|
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
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
|
10
|
-
|
11
|
-
export default {
|
12
|
-
title: 'sortable OxPopupList',
|
13
|
-
component: 'ox-popup-list',
|
14
|
-
argTypes: {
|
15
|
-
preventCloseOnBlur: { control: 'boolean' }
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
interface Story<T> {
|
20
|
-
(args: T): TemplateResult
|
21
|
-
args?: Partial<T>
|
22
|
-
argTypes?: Record<string, unknown>
|
23
|
-
}
|
24
|
-
|
25
|
-
interface ArgTypes {
|
26
|
-
preventCloseOnBlur: boolean
|
27
|
-
}
|
28
|
-
|
29
|
-
function popup(e: MouseEvent) {
|
30
|
-
const popupList = document.querySelector('#popup-list') as OxPopupList
|
31
|
-
popupList?.open({
|
32
|
-
top: e.offsetY,
|
33
|
-
left: e.offsetX
|
34
|
-
})
|
35
|
-
}
|
36
|
-
|
37
|
-
const columns = [
|
38
|
-
{
|
39
|
-
name: 'AAAAAA',
|
40
|
-
hidden: false
|
41
|
-
},
|
42
|
-
{
|
43
|
-
name: 'BBBBBB',
|
44
|
-
hidden: true
|
45
|
-
},
|
46
|
-
{
|
47
|
-
name: 'CCCCCC',
|
48
|
-
hidden: false
|
49
|
-
},
|
50
|
-
{
|
51
|
-
name: 'DDDDDD',
|
52
|
-
hidden: false
|
53
|
-
},
|
54
|
-
{
|
55
|
-
name: 'EEEEEE',
|
56
|
-
hidden: false
|
57
|
-
},
|
58
|
-
{
|
59
|
-
name: 'FFFFFF',
|
60
|
-
hidden: false
|
61
|
-
},
|
62
|
-
{
|
63
|
-
name: 'GGGGGG',
|
64
|
-
hidden: false
|
65
|
-
},
|
66
|
-
{
|
67
|
-
name: 'HHHHHH',
|
68
|
-
hidden: false
|
69
|
-
},
|
70
|
-
{
|
71
|
-
name: 'IIIIII',
|
72
|
-
hidden: false
|
73
|
-
},
|
74
|
-
{
|
75
|
-
name: 'JJJJJJ',
|
76
|
-
hidden: false
|
77
|
-
},
|
78
|
-
{
|
79
|
-
name: 'KKKKKK',
|
80
|
-
hidden: false
|
81
|
-
},
|
82
|
-
{
|
83
|
-
name: 'LLLLLL',
|
84
|
-
hidden: false
|
85
|
-
},
|
86
|
-
{
|
87
|
-
name: 'MMMMMM',
|
88
|
-
hidden: false
|
89
|
-
}
|
90
|
-
]
|
91
|
-
|
92
|
-
const Template: Story<ArgTypes> = ({ preventCloseOnBlur }: ArgTypes) => html`
|
93
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
94
|
-
|
95
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
96
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
97
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
98
|
-
|
99
|
-
<link
|
100
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
101
|
-
rel="stylesheet"
|
102
|
-
/>
|
103
|
-
<link
|
104
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
105
|
-
rel="stylesheet"
|
106
|
-
/>
|
107
|
-
<link
|
108
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
109
|
-
rel="stylesheet"
|
110
|
-
/>
|
111
|
-
|
112
|
-
<style>
|
113
|
-
${MDTypeScaleStyles.cssText}
|
114
|
-
</style>
|
115
|
-
|
116
|
-
<style>
|
117
|
-
#place {
|
118
|
-
position: relative;
|
119
|
-
width: 100%;
|
120
|
-
height: 100px;
|
121
|
-
background: lightgreen;
|
122
|
-
text-align: center;
|
123
|
-
line-height: 100px;
|
124
|
-
padding: 20px;
|
125
|
-
margin: 20px;
|
126
|
-
|
127
|
-
background-color: var(--md-sys-color-primary-container);
|
128
|
-
color: var(--md-sys-color-on-primary-container);
|
129
|
-
}
|
130
|
-
|
131
|
-
#place-child {
|
132
|
-
position: relative;
|
133
|
-
display: block;
|
134
|
-
width: 100%;
|
135
|
-
height: 100%;
|
136
|
-
background-color: var(--md-sys-color-primary);
|
137
|
-
color: var(--md-sys-color-on-primary);
|
138
|
-
}
|
139
|
-
|
140
|
-
ox-popup-list {
|
141
|
-
width: 240px;
|
142
|
-
max-height: 240px;
|
143
|
-
overflow: hidden;
|
144
|
-
}
|
145
|
-
|
146
|
-
[titler] {
|
147
|
-
--md-icon-size: 1.2em;
|
148
|
-
--md-outlined-button-container-height: 24px;
|
149
|
-
--md-outlined-button-container-shape: 4px;
|
150
|
-
--md-outlined-button-leading-space: 4px;
|
151
|
-
--md-outlined-button-trailing-space: 4px;
|
152
|
-
|
153
|
-
display: flex;
|
154
|
-
flex-direction: row;
|
155
|
-
align-items: center;
|
156
|
-
text-transform: capitalize;
|
157
|
-
}
|
158
|
-
|
159
|
-
md-outlined-button {
|
160
|
-
margin-left: auto;
|
161
|
-
}
|
162
|
-
|
163
|
-
[option] {
|
164
|
-
position: relative; /* 상대 위치 설정 */
|
165
|
-
cursor: move; /* 커서를 이동 가능 표시로 변경 */
|
166
|
-
user-select: none;
|
167
|
-
}
|
168
|
-
|
169
|
-
[option]::after {
|
170
|
-
content: '☰'; /* 드래그 핸들 아이콘 (혹은 기호) */
|
171
|
-
position: absolute; /* 절대 위치 설정 */
|
172
|
-
top: 0; /* 위에서부터 10px */
|
173
|
-
right: 10px; /* 오른쪽에서부터 10px */
|
174
|
-
font-size: 20px; /* 폰트 크기 설정 */
|
175
|
-
color: #888; /* 폰트 색상 설정 */
|
176
|
-
}
|
177
|
-
|
178
|
-
div[overlay] {
|
179
|
-
display: block;
|
180
|
-
width: 300px;
|
181
|
-
height: 300px;
|
182
|
-
left: 100px;
|
183
|
-
top: 100px;
|
184
|
-
z-index: 10000;
|
185
|
-
background-color: var(--md-sys-color-surface);
|
186
|
-
}
|
187
|
-
</style>
|
188
|
-
|
189
|
-
<div id="place">
|
190
|
-
<div id="place-child" @click=${(e: MouseEvent) => popup(e)}>
|
191
|
-
Click this to popup list
|
192
|
-
<ox-popup-list
|
193
|
-
id="popup-list"
|
194
|
-
@select=${(e: Event) => console.log('select', e.target)}
|
195
|
-
@sorted=${(e: Event) => {
|
196
|
-
console.log('sorted\n', (e as CustomEvent).detail.map((element: any) => element.value).join('\n'))
|
197
|
-
}}
|
198
|
-
multiple
|
199
|
-
sortable
|
200
|
-
?prevent-close-on-blur=${preventCloseOnBlur}
|
201
|
-
>
|
202
|
-
<div slot="header" titler>Plain Text <md-outlined-button>save</md-outlined-button></div>
|
203
|
-
${columns.map(
|
204
|
-
column => html`
|
205
|
-
<ox-checkbox label="checkbox" ?checked=${!column.hidden} value=${column.name} option />${column.name}</ox-checkbox>
|
206
|
-
`
|
207
|
-
)}
|
208
|
-
</ox-popup-list>
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
<div overlay>OVERLAYED</div>
|
212
|
-
`
|
213
|
-
|
214
|
-
export const Regular = Template.bind({})
|
215
|
-
Regular.args = {}
|
@@ -1,121 +0,0 @@
|
|
1
|
-
import '@material/web/all.js'
|
2
|
-
import '@operato/input/ox-checkbox.js'
|
3
|
-
import '../src/ox-popup-list.js'
|
4
|
-
|
5
|
-
import { html, TemplateResult } from 'lit'
|
6
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
|
7
|
-
|
8
|
-
import { OxPopupList } from '../src/ox-popup-list.js'
|
9
|
-
|
10
|
-
export default {
|
11
|
-
title: 'OxPopupList',
|
12
|
-
component: 'ox-popup-list',
|
13
|
-
argTypes: {
|
14
|
-
preventCloseOnBlur: { 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
|
-
preventCloseOnBlur: boolean
|
26
|
-
}
|
27
|
-
|
28
|
-
function popup(e: MouseEvent, preventCloseOnBlur: boolean) {
|
29
|
-
const popupList = document.querySelector('#popup-list') as OxPopupList
|
30
|
-
popupList.preventCloseOnBlur = preventCloseOnBlur
|
31
|
-
|
32
|
-
popupList?.open({
|
33
|
-
top: e.offsetY,
|
34
|
-
left: e.offsetX
|
35
|
-
})
|
36
|
-
}
|
37
|
-
|
38
|
-
const Template: Story<ArgTypes> = ({ preventCloseOnBlur }: ArgTypes) => html`
|
39
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
40
|
-
|
41
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
42
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
43
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
44
|
-
|
45
|
-
<link
|
46
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
47
|
-
rel="stylesheet"
|
48
|
-
/>
|
49
|
-
<link
|
50
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
51
|
-
rel="stylesheet"
|
52
|
-
/>
|
53
|
-
<link
|
54
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
55
|
-
rel="stylesheet"
|
56
|
-
/>
|
57
|
-
|
58
|
-
<style>
|
59
|
-
${MDTypeScaleStyles.cssText}
|
60
|
-
</style>
|
61
|
-
|
62
|
-
<style>
|
63
|
-
#container {
|
64
|
-
display: flex;
|
65
|
-
}
|
66
|
-
|
67
|
-
#noise {
|
68
|
-
width: 100px;
|
69
|
-
height: 100px;
|
70
|
-
}
|
71
|
-
|
72
|
-
#place {
|
73
|
-
position: fixed;
|
74
|
-
top: 50%;
|
75
|
-
left: 50%;
|
76
|
-
transform: translate(-50%, -50%);
|
77
|
-
|
78
|
-
width: 50%;
|
79
|
-
height: 50%;
|
80
|
-
text-align: center;
|
81
|
-
|
82
|
-
background-color: var(--md-sys-color-primary-container);
|
83
|
-
color: var(--md-sys-color-on-primary-container);
|
84
|
-
border: 2px solid var(--md-sys-color-primary);
|
85
|
-
}
|
86
|
-
</style>
|
87
|
-
|
88
|
-
<div id="container">
|
89
|
-
<div id="noise"></div>
|
90
|
-
<div id="place" @click=${(e: MouseEvent) => popup(e, preventCloseOnBlur)} class="md-typescale-display-medium">
|
91
|
-
Click this to popup list
|
92
|
-
<ox-popup-list
|
93
|
-
id="popup-list"
|
94
|
-
@select=${(e: Event) => console.log('select', e.target)}
|
95
|
-
multiple
|
96
|
-
?prevent-close-on-blur=${preventCloseOnBlur}
|
97
|
-
>
|
98
|
-
<div option>Plain Text</div>
|
99
|
-
|
100
|
-
<div option>
|
101
|
-
<ox-checkbox label="checkbox" slot="icon" checked>checkbox</ox-checkbox>
|
102
|
-
</div>
|
103
|
-
|
104
|
-
<div option>
|
105
|
-
<input id="checkbox-01" type="checkbox" />
|
106
|
-
<label for="checkbox-01">custom option</label>
|
107
|
-
</div>
|
108
|
-
|
109
|
-
<div option>
|
110
|
-
<label for="text-01">value</label>
|
111
|
-
<input id="text-01" type="text" value="Plain text input" />
|
112
|
-
</div>
|
113
|
-
</ox-popup-list>
|
114
|
-
</div>
|
115
|
-
</div>
|
116
|
-
`
|
117
|
-
|
118
|
-
export const Regular = Template.bind({})
|
119
|
-
Regular.args = {
|
120
|
-
preventCloseOnBlur: true
|
121
|
-
}
|
@@ -1,188 +0,0 @@
|
|
1
|
-
import '@material/web/all.js'
|
2
|
-
import '@operato/input/ox-checkbox.js'
|
3
|
-
import '../src/ox-popup-menu.js'
|
4
|
-
import '../src/ox-popup-menuitem.js'
|
5
|
-
|
6
|
-
import { html, TemplateResult } from 'lit'
|
7
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
|
8
|
-
|
9
|
-
import { OxPopupMenu } from '../src/ox-popup-menu.js'
|
10
|
-
|
11
|
-
export default {
|
12
|
-
title: 'OxPopuMenu',
|
13
|
-
component: 'ox-popup-menu',
|
14
|
-
argTypes: {}
|
15
|
-
}
|
16
|
-
|
17
|
-
interface Story<T> {
|
18
|
-
(args: T): TemplateResult
|
19
|
-
args?: Partial<T>
|
20
|
-
argTypes?: Record<string, unknown>
|
21
|
-
}
|
22
|
-
|
23
|
-
interface ArgTypes {}
|
24
|
-
|
25
|
-
function popup(e: MouseEvent) {
|
26
|
-
OxPopupMenu.open({
|
27
|
-
template: html`
|
28
|
-
<ox-popup-menuitem
|
29
|
-
label="article - click me"
|
30
|
-
@selected=${function (e: Event) {
|
31
|
-
console.log('first level article selected')
|
32
|
-
}}
|
33
|
-
>
|
34
|
-
<md-icon slot="icon">article</md-icon>
|
35
|
-
</ox-popup-menuitem>
|
36
|
-
|
37
|
-
<ox-popup-menuitem label="home">
|
38
|
-
<md-icon slot="icon">home</md-icon>
|
39
|
-
</ox-popup-menuitem>
|
40
|
-
|
41
|
-
<ox-popup-menuitem label="empty"> </ox-popup-menuitem>
|
42
|
-
|
43
|
-
<ox-popup-menuitem
|
44
|
-
label="click me to toggle"
|
45
|
-
@selected=${function (e: Event) {
|
46
|
-
const icon = (e.target as HTMLElement).querySelector('md-icon')
|
47
|
-
icon && (icon.innerHTML = icon.innerHTML == 'check' ? '' : 'check')
|
48
|
-
}}
|
49
|
-
alive-on-select
|
50
|
-
>
|
51
|
-
<md-icon slot="icon" style="width: 20px;height: 20px;"></md-icon>
|
52
|
-
</ox-popup-menuitem>
|
53
|
-
|
54
|
-
<ox-popup-menuitem label="verified" @selected=${(e: Event) => console.log('selected verified')}>
|
55
|
-
<md-icon slot="icon">verified</md-icon>
|
56
|
-
<ox-popup-menu>
|
57
|
-
<ox-popup-menuitem
|
58
|
-
label="article"
|
59
|
-
@selected=${function (e: Event) {
|
60
|
-
console.log('article selected')
|
61
|
-
}}
|
62
|
-
alive-on-select
|
63
|
-
>
|
64
|
-
<md-icon slot="icon">article</md-icon>
|
65
|
-
</ox-popup-menuitem>
|
66
|
-
|
67
|
-
<ox-popup-menuitem label="home">
|
68
|
-
<md-icon slot="icon">home</md-icon>
|
69
|
-
</ox-popup-menuitem>
|
70
|
-
|
71
|
-
<ox-popup-menuitem label="verified">
|
72
|
-
<md-icon slot="icon">verified</md-icon>
|
73
|
-
<ox-popup-menu>
|
74
|
-
<ox-popup-menuitem label="article">
|
75
|
-
<md-icon slot="icon">article</md-icon>
|
76
|
-
</ox-popup-menuitem>
|
77
|
-
|
78
|
-
<ox-popup-menuitem label="home">
|
79
|
-
<md-icon slot="icon">home</md-icon>
|
80
|
-
</ox-popup-menuitem>
|
81
|
-
|
82
|
-
<ox-popup-menuitem label="verified">
|
83
|
-
<md-icon slot="icon">verified</md-icon>
|
84
|
-
</ox-popup-menuitem>
|
85
|
-
|
86
|
-
<ox-popup-menuitem label="checkbox">
|
87
|
-
<input type="checkbox" slot="icon" />
|
88
|
-
</ox-popup-menuitem>
|
89
|
-
|
90
|
-
</ox-popup-menu>
|
91
|
-
</ox-popup-menuitem>
|
92
|
-
|
93
|
-
<div separator></div>
|
94
|
-
|
95
|
-
<ox-popup-menuitem label="checkbox">
|
96
|
-
<input type="checkbox" slot="icon" />
|
97
|
-
</ox-popup-menuitem>
|
98
|
-
</ox-popup-menu>
|
99
|
-
</ox-popup-menuitem>
|
100
|
-
|
101
|
-
<ox-popup-menuitem label="checkbox in icon area" alive-on-select>
|
102
|
-
<input type="checkbox" slot="icon" />
|
103
|
-
</ox-popup-menuitem>
|
104
|
-
|
105
|
-
<div separator></div>
|
106
|
-
|
107
|
-
<div menu>Plain Text</div>
|
108
|
-
|
109
|
-
<div menu alive-on-select>
|
110
|
-
<ox-checkbox label="checkbox" slot="icon" checked />checkbox</ox-checkbox>
|
111
|
-
</div>
|
112
|
-
|
113
|
-
<div menu alive-on-select>
|
114
|
-
<input id="checkbox-01" type="checkbox" />
|
115
|
-
<label for="checkbox-01">custom menu</label>
|
116
|
-
</div>
|
117
|
-
<div menu alive-on-select>
|
118
|
-
<label for="text-01">value</label>
|
119
|
-
<input id="text-01" type="text" value="Plain text input" />
|
120
|
-
</div>
|
121
|
-
`,
|
122
|
-
top: e.offsetY,
|
123
|
-
left: e.offsetX,
|
124
|
-
parent: e.target as HTMLElement
|
125
|
-
})
|
126
|
-
}
|
127
|
-
|
128
|
-
const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
|
129
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
130
|
-
|
131
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
132
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
133
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
134
|
-
|
135
|
-
<link
|
136
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
137
|
-
rel="stylesheet"
|
138
|
-
/>
|
139
|
-
<link
|
140
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
141
|
-
rel="stylesheet"
|
142
|
-
/>
|
143
|
-
<link
|
144
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
145
|
-
rel="stylesheet"
|
146
|
-
/>
|
147
|
-
|
148
|
-
<style>
|
149
|
-
${MDTypeScaleStyles.cssText}
|
150
|
-
</style>
|
151
|
-
|
152
|
-
<style>
|
153
|
-
#container {
|
154
|
-
display: flex;
|
155
|
-
flex-direction: row;
|
156
|
-
height: 600px;
|
157
|
-
}
|
158
|
-
|
159
|
-
#padding {
|
160
|
-
width: 100px;
|
161
|
-
height: 100px;
|
162
|
-
}
|
163
|
-
|
164
|
-
#place {
|
165
|
-
position: fixed;
|
166
|
-
top: 50%;
|
167
|
-
left: 50%;
|
168
|
-
transform: translate(-50%, -50%);
|
169
|
-
|
170
|
-
width: 50%;
|
171
|
-
height: 50%;
|
172
|
-
text-align: center;
|
173
|
-
|
174
|
-
background-color: var(--md-sys-color-primary-container);
|
175
|
-
color: var(--md-sys-color-on-primary-container);
|
176
|
-
}
|
177
|
-
</style>
|
178
|
-
|
179
|
-
<div id="container">
|
180
|
-
<div id="padding"></div>
|
181
|
-
<div id="place" @click=${(e: MouseEvent) => popup(e)} class="md-typescale-display-medium">
|
182
|
-
Click this to popup menu
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
`
|
186
|
-
|
187
|
-
export const Regular = Template.bind({})
|
188
|
-
Regular.args = {}
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import '@material/web/all.js'
|
2
|
-
import { html, TemplateResult } from 'lit'
|
3
|
-
|
4
|
-
import { OxPopup } from '../src/ox-popup'
|
5
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
|
6
|
-
|
7
|
-
export default {
|
8
|
-
title: 'Simple Popup',
|
9
|
-
component: 'ox-popup',
|
10
|
-
argTypes: {}
|
11
|
-
}
|
12
|
-
|
13
|
-
interface Story<T> {
|
14
|
-
(args: T): TemplateResult
|
15
|
-
args?: Partial<T>
|
16
|
-
argTypes?: Record<string, unknown>
|
17
|
-
}
|
18
|
-
|
19
|
-
interface ArgTypes {}
|
20
|
-
|
21
|
-
function popup(e: MouseEvent) {
|
22
|
-
const noImage = new URL('/assets/images/no-image.png', import.meta.url).href
|
23
|
-
|
24
|
-
OxPopup.open({
|
25
|
-
template: html`<img src=${noImage} />`,
|
26
|
-
top: e.offsetY,
|
27
|
-
left: e.offsetX,
|
28
|
-
backdrop: true,
|
29
|
-
parent: e.target as HTMLElement
|
30
|
-
})
|
31
|
-
}
|
32
|
-
|
33
|
-
const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
|
34
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
35
|
-
|
36
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
37
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
38
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
39
|
-
|
40
|
-
<link
|
41
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
42
|
-
rel="stylesheet"
|
43
|
-
/>
|
44
|
-
<link
|
45
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
46
|
-
rel="stylesheet"
|
47
|
-
/>
|
48
|
-
<link
|
49
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
50
|
-
rel="stylesheet"
|
51
|
-
/>
|
52
|
-
|
53
|
-
<style>
|
54
|
-
${MDTypeScaleStyles.cssText}
|
55
|
-
</style>
|
56
|
-
|
57
|
-
<style>
|
58
|
-
#place {
|
59
|
-
position: fixed;
|
60
|
-
top: 50%;
|
61
|
-
left: 50%;
|
62
|
-
transform: translate(-50%, -50%);
|
63
|
-
|
64
|
-
width: 50%;
|
65
|
-
height: 50%;
|
66
|
-
text-align: center;
|
67
|
-
|
68
|
-
background-color: var(--md-sys-color-primary-container);
|
69
|
-
color: var(--md-sys-color-on-primary-container);
|
70
|
-
}
|
71
|
-
</style>
|
72
|
-
|
73
|
-
<div id="place" @click=${(e: MouseEvent) => popup(e)} class="md-typescale-display-medium">
|
74
|
-
Click this to popup image
|
75
|
-
</div>
|
76
|
-
`
|
77
|
-
|
78
|
-
export const Regular = Template.bind({})
|
79
|
-
Regular.args = {}
|
@@ -1,87 +0,0 @@
|
|
1
|
-
import '@material/web/all.js'
|
2
|
-
import { html, TemplateResult } from 'lit'
|
3
|
-
|
4
|
-
import { OxPrompt } from '../src/ox-prompt'
|
5
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
|
6
|
-
|
7
|
-
export default {
|
8
|
-
title: 'OxPrompt - Icon',
|
9
|
-
component: 'ox-prompt',
|
10
|
-
argTypes: {
|
11
|
-
type: { control: 'select', options: ['success', 'error', 'warning', 'info', 'question'] },
|
12
|
-
preventCloseOnBlur: { control: 'boolean' }
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
interface Story<T> {
|
17
|
-
(args: T): TemplateResult
|
18
|
-
args?: Partial<T>
|
19
|
-
argTypes?: Record<string, unknown>
|
20
|
-
}
|
21
|
-
|
22
|
-
interface ArgTypes {
|
23
|
-
type: 'success' | 'error' | 'warning' | 'info' | 'question'
|
24
|
-
preventCloseOnBlur: boolean
|
25
|
-
}
|
26
|
-
|
27
|
-
function popup(
|
28
|
-
e: MouseEvent,
|
29
|
-
type: 'success' | 'error' | 'warning' | 'info' | 'question' = 'warning',
|
30
|
-
preventCloseOnBlur: boolean
|
31
|
-
) {
|
32
|
-
OxPrompt.open({
|
33
|
-
title: 'Are you sure ?',
|
34
|
-
text: 'Are you sure to exit this page ?',
|
35
|
-
type,
|
36
|
-
icon: 'logout',
|
37
|
-
confirmButton: { text: 'Confirm' },
|
38
|
-
cancelButton: { text: 'Cancel' },
|
39
|
-
preventCloseOnBlur
|
40
|
-
})
|
41
|
-
}
|
42
|
-
|
43
|
-
const Template: Story<ArgTypes> = ({ type, preventCloseOnBlur }: ArgTypes) => html`
|
44
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
45
|
-
|
46
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
47
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
48
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
49
|
-
|
50
|
-
<link
|
51
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
52
|
-
rel="stylesheet"
|
53
|
-
/>
|
54
|
-
<link
|
55
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
56
|
-
rel="stylesheet"
|
57
|
-
/>
|
58
|
-
<link
|
59
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
60
|
-
rel="stylesheet"
|
61
|
-
/>
|
62
|
-
|
63
|
-
<style>
|
64
|
-
${MDTypeScaleStyles.cssText}
|
65
|
-
</style>
|
66
|
-
|
67
|
-
<style>
|
68
|
-
#place {
|
69
|
-
width: 100%;
|
70
|
-
height: 500px;
|
71
|
-
text-align: center;
|
72
|
-
|
73
|
-
background-color: var(--md-sys-color-primary-container);
|
74
|
-
color: var(--md-sys-color-on-primary-container);
|
75
|
-
}
|
76
|
-
</style>
|
77
|
-
|
78
|
-
<div id="place" @click=${(e: MouseEvent) => popup(e, type, preventCloseOnBlur)} class="md-typescale-display-medium">
|
79
|
-
Click this to prompt image
|
80
|
-
</div>
|
81
|
-
`
|
82
|
-
|
83
|
-
export const Regular = Template.bind({})
|
84
|
-
Regular.args = {
|
85
|
-
type: 'warning',
|
86
|
-
preventCloseOnBlur: true
|
87
|
-
}
|