@operato/popup 2.0.0-alpha.9 → 2.0.0-alpha.92

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 (49) hide show
  1. package/CHANGELOG.md +151 -0
  2. package/demo/index.html +25 -14
  3. package/demo/ox-popup-list.html +14 -3
  4. package/demo/ox-popup-menu.html +25 -14
  5. package/dist/src/ox-floating-overlay.d.ts +2 -2
  6. package/dist/src/ox-floating-overlay.js +5 -7
  7. package/dist/src/ox-floating-overlay.js.map +1 -1
  8. package/dist/src/ox-popup-list.d.ts +2 -2
  9. package/dist/src/ox-popup-list.js +12 -10
  10. package/dist/src/ox-popup-list.js.map +1 -1
  11. package/dist/src/ox-popup-menu.d.ts +1 -1
  12. package/dist/src/ox-popup-menuitem.d.ts +1 -1
  13. package/dist/src/ox-popup-menuitem.js +2 -2
  14. package/dist/src/ox-popup-menuitem.js.map +1 -1
  15. package/dist/src/ox-popup.d.ts +1 -1
  16. package/dist/src/ox-popup.js +1 -1
  17. package/dist/src/ox-popup.js.map +1 -1
  18. package/dist/src/ox-prompt.d.ts +3 -2
  19. package/dist/src/ox-prompt.js +39 -6
  20. package/dist/src/ox-prompt.js.map +1 -1
  21. package/dist/stories/open-popup.stories.js +27 -18
  22. package/dist/stories/open-popup.stories.js.map +1 -1
  23. package/dist/stories/ox-popup-list.stories.d.ts +1 -1
  24. package/dist/stories/ox-popup-list.stories.js +15 -3
  25. package/dist/stories/ox-popup-list.stories.js.map +1 -1
  26. package/dist/stories/ox-popup-menu.stories.d.ts +1 -1
  27. package/dist/stories/ox-popup-menu.stories.js +37 -25
  28. package/dist/stories/ox-popup-menu.stories.js.map +1 -1
  29. package/dist/stories/ox-prompt-icon.stories.d.ts +25 -0
  30. package/dist/stories/ox-prompt-icon.stories.js +57 -0
  31. package/dist/stories/ox-prompt-icon.stories.js.map +1 -0
  32. package/dist/stories/ox-prompt-normal.stories.js +24 -13
  33. package/dist/stories/ox-prompt-normal.stories.js.map +1 -1
  34. package/dist/stories/ox-prompt.stories.js +24 -13
  35. package/dist/stories/ox-prompt.stories.js.map +1 -1
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +16 -16
  38. package/src/ox-floating-overlay.ts +5 -7
  39. package/src/ox-popup-list.ts +12 -10
  40. package/src/ox-popup-menuitem.ts +2 -2
  41. package/src/ox-popup.ts +1 -1
  42. package/src/ox-prompt.ts +39 -6
  43. package/stories/open-popup.stories.ts +28 -20
  44. package/stories/ox-popup-list.stories.ts +15 -3
  45. package/stories/ox-popup-menu.stories.ts +38 -27
  46. package/stories/ox-prompt-icon.stories.ts +74 -0
  47. package/stories/ox-prompt-normal.stories.ts +27 -17
  48. package/stories/ox-prompt.stories.ts +27 -17
  49. package/themes/input-theme.css +7 -7
@@ -1,6 +1,6 @@
1
1
  import '../src/ox-popup-menu.js'
2
2
  import '../src/ox-popup-menuitem.js'
3
- import '@material/mwc-icon'
3
+ import '@material/web/icon/icon.js'
4
4
  import '@operato/input/ox-checkbox.js'
5
5
 
6
6
  import { html, TemplateResult } from 'lit'
@@ -30,11 +30,11 @@ function popup(e: MouseEvent) {
30
30
  console.log('first level article selected')
31
31
  }}
32
32
  >
33
- <mwc-icon slot="icon">article</mwc-icon>
33
+ <md-icon slot="icon">article</md-icon>
34
34
  </ox-popup-menuitem>
35
35
 
36
36
  <ox-popup-menuitem label="home">
37
- <mwc-icon slot="icon">home</mwc-icon>
37
+ <md-icon slot="icon">home</md-icon>
38
38
  </ox-popup-menuitem>
39
39
 
40
40
  <ox-popup-menuitem label="empty"> </ox-popup-menuitem>
@@ -42,16 +42,16 @@ function popup(e: MouseEvent) {
42
42
  <ox-popup-menuitem
43
43
  label="click me to toggle"
44
44
  @selected=${function (e: Event) {
45
- const icon = (e.target as HTMLElement).querySelector('mwc-icon')
45
+ const icon = (e.target as HTMLElement).querySelector('md-icon')
46
46
  icon && (icon.innerHTML = icon.innerHTML == 'check' ? '' : 'check')
47
47
  }}
48
48
  alive-on-select
49
49
  >
50
- <mwc-icon slot="icon" style="width: 20px;height: 20px;"></mwc-icon>
50
+ <md-icon slot="icon" style="width: 20px;height: 20px;"></md-icon>
51
51
  </ox-popup-menuitem>
52
52
 
53
53
  <ox-popup-menuitem label="verified" @selected=${(e: Event) => console.log('selected verified')}>
54
- <mwc-icon slot="icon">verified</mwc-icon>
54
+ <md-icon slot="icon">verified</md-icon>
55
55
  <ox-popup-menu>
56
56
  <ox-popup-menuitem
57
57
  label="article"
@@ -60,26 +60,26 @@ function popup(e: MouseEvent) {
60
60
  }}
61
61
  alive-on-select
62
62
  >
63
- <mwc-icon slot="icon">article</mwc-icon>
63
+ <md-icon slot="icon">article</md-icon>
64
64
  </ox-popup-menuitem>
65
65
 
66
66
  <ox-popup-menuitem label="home">
67
- <mwc-icon slot="icon">home</mwc-icon>
67
+ <md-icon slot="icon">home</md-icon>
68
68
  </ox-popup-menuitem>
69
69
 
70
70
  <ox-popup-menuitem label="verified">
71
- <mwc-icon slot="icon">verified</mwc-icon>
71
+ <md-icon slot="icon">verified</md-icon>
72
72
  <ox-popup-menu>
73
73
  <ox-popup-menuitem label="article">
74
- <mwc-icon slot="icon">article</mwc-icon>
74
+ <md-icon slot="icon">article</md-icon>
75
75
  </ox-popup-menuitem>
76
76
 
77
77
  <ox-popup-menuitem label="home">
78
- <mwc-icon slot="icon">home</mwc-icon>
78
+ <md-icon slot="icon">home</md-icon>
79
79
  </ox-popup-menuitem>
80
80
 
81
81
  <ox-popup-menuitem label="verified">
82
- <mwc-icon slot="icon">verified</mwc-icon>
82
+ <md-icon slot="icon">verified</md-icon>
83
83
  </ox-popup-menuitem>
84
84
 
85
85
  <ox-popup-menuitem label="checkbox">
@@ -125,21 +125,32 @@ function popup(e: MouseEvent) {
125
125
  })
126
126
  }
127
127
 
128
- const Template: Story<ArgTypes> = ({}: ArgTypes) =>
129
- html`
130
- <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
131
- <style>
132
- #place {
133
- width: 100%;
134
- height: 500px;
135
- background: lightgreen;
136
- text-align: center;
137
- line-height: 500px;
138
- }
139
- </style>
140
-
141
- <div id="place" @click=${(e: MouseEvent) => popup(e)}>Click this to popup menu</div>
142
- `
128
+ const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
129
+ <link
130
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
131
+ rel="stylesheet"
132
+ />
133
+ <link
134
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
135
+ rel="stylesheet"
136
+ />
137
+ <link
138
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
139
+ rel="stylesheet"
140
+ />
141
+
142
+ <style>
143
+ #place {
144
+ width: 100%;
145
+ height: 500px;
146
+ background: lightgreen;
147
+ text-align: center;
148
+ line-height: 500px;
149
+ }
150
+ </style>
151
+
152
+ <div id="place" @click=${(e: MouseEvent) => popup(e)}>Click this to popup menu</div>
153
+ `
143
154
 
144
155
  export const Regular = Template.bind({})
145
156
  Regular.args = {}
@@ -0,0 +1,74 @@
1
+ import { html, TemplateResult } from 'lit'
2
+
3
+ import { OxPrompt } from '../src/ox-prompt'
4
+
5
+ export default {
6
+ title: 'OxPrompt - Icon',
7
+ component: 'ox-prompt',
8
+ argTypes: {
9
+ type: { control: 'select', options: ['success', 'error', 'warning', 'info', 'question'] },
10
+ debug: { control: 'boolean' }
11
+ }
12
+ }
13
+
14
+ interface Story<T> {
15
+ (args: T): TemplateResult
16
+ args?: Partial<T>
17
+ argTypes?: Record<string, unknown>
18
+ }
19
+
20
+ interface ArgTypes {
21
+ type: 'success' | 'error' | 'warning' | 'info' | 'question'
22
+ debug: boolean
23
+ }
24
+
25
+ function popup(e: MouseEvent, type: 'success' | 'error' | 'warning' | 'info' | 'question' = 'warning', debug: boolean) {
26
+ const noImage = new URL('/assets/images/no-image.png', import.meta.url).href
27
+
28
+ //@ts-ignore
29
+ window.POPUP_DEBUG = debug
30
+
31
+ OxPrompt.open({
32
+ title: 'Are you sure ?',
33
+ text: 'Are you sure to exit this page ?',
34
+ type,
35
+ confirmButton: { text: 'Confirm' },
36
+ cancelButton: { text: 'Cancel' }
37
+ })
38
+ }
39
+
40
+ const Template: Story<ArgTypes> = ({ type, debug }: ArgTypes) => html`
41
+ <link href="/themes/app-theme.css" rel="stylesheet" />
42
+ <link
43
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
44
+ rel="stylesheet"
45
+ />
46
+ <link
47
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
48
+ rel="stylesheet"
49
+ />
50
+ <link
51
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
52
+ rel="stylesheet"
53
+ />
54
+
55
+ <script></script>
56
+
57
+ <style>
58
+ #place {
59
+ width: 100%;
60
+ height: 500px;
61
+ background: lightgreen;
62
+ text-align: center;
63
+ line-height: 500px;
64
+ }
65
+ </style>
66
+
67
+ <div id="place" @click=${(e: MouseEvent) => popup(e, type, debug)}>Click this to prompt image</div>
68
+ `
69
+
70
+ export const Regular = Template.bind({})
71
+ Regular.args = {
72
+ type: 'warning',
73
+ debug: true
74
+ }
@@ -27,23 +27,33 @@ function popup(e: MouseEvent) {
27
27
  })
28
28
  }
29
29
 
30
- const Template: Story<ArgTypes> = ({}: ArgTypes) =>
31
- html`
32
- <link href="/themes/app-theme.css" rel="stylesheet" />
33
- <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
34
-
35
- <style>
36
- #place {
37
- width: 100%;
38
- height: 500px;
39
- background: lightgreen;
40
- text-align: center;
41
- line-height: 500px;
42
- }
43
- </style>
44
-
45
- <div id="place" @click=${(e: MouseEvent) => popup(e)}>Click this to prompt image</div>
46
- `
30
+ const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
31
+ <link href="/themes/app-theme.css" rel="stylesheet" />
32
+ <link
33
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
34
+ rel="stylesheet"
35
+ />
36
+ <link
37
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
38
+ rel="stylesheet"
39
+ />
40
+ <link
41
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
42
+ rel="stylesheet"
43
+ />
44
+
45
+ <style>
46
+ #place {
47
+ width: 100%;
48
+ height: 500px;
49
+ background: lightgreen;
50
+ text-align: center;
51
+ line-height: 500px;
52
+ }
53
+ </style>
54
+
55
+ <div id="place" @click=${(e: MouseEvent) => popup(e)}>Click this to prompt image</div>
56
+ `
47
57
 
48
58
  export const Regular = Template.bind({})
49
59
  Regular.args = {}
@@ -30,23 +30,33 @@ function popup(e: MouseEvent) {
30
30
  })
31
31
  }
32
32
 
33
- const Template: Story<ArgTypes> = ({}: ArgTypes) =>
34
- html`
35
- <link href="/themes/app-theme.css" rel="stylesheet" />
36
- <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
37
-
38
- <style>
39
- #place {
40
- width: 100%;
41
- height: 500px;
42
- background: lightgreen;
43
- text-align: center;
44
- line-height: 500px;
45
- }
46
- </style>
47
-
48
- <div id="place" @click=${(e: MouseEvent) => popup(e)}>Click this to prompt image</div>
49
- `
33
+ const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
34
+ <link href="/themes/app-theme.css" rel="stylesheet" />
35
+ <link
36
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
37
+ rel="stylesheet"
38
+ />
39
+ <link
40
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
41
+ rel="stylesheet"
42
+ />
43
+ <link
44
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
45
+ rel="stylesheet"
46
+ />
47
+
48
+ <style>
49
+ #place {
50
+ width: 100%;
51
+ height: 500px;
52
+ background: lightgreen;
53
+ text-align: center;
54
+ line-height: 500px;
55
+ }
56
+ </style>
57
+
58
+ <div id="place" @click=${(e: MouseEvent) => popup(e)}>Click this to prompt image</div>
59
+ `
50
60
 
51
61
  export const Regular = Template.bind({})
52
62
  Regular.args = {}
@@ -1,9 +1,9 @@
1
1
  body {
2
- --ox-input-border: 1px solid rgba(0, 0, 0, 0.1);
3
- --ox-input-border-radius: var(--border-radius);
4
- --ox-input-padding: var(--input-padding);
5
- --ox-input-font: normal 15px var(--theme-font);
6
- --ox-input-color: var(--secondary-color);
2
+ --input-border: 1px solid rgba(0, 0, 0, 0.1);
3
+ --input-border-radius: var(--border-radius);
4
+ --input-padding: var(--input-padding);
5
+ --input-font: normal 15px var(--theme-font);
6
+ --input-color: var(--secondary-color);
7
7
  }
8
8
 
9
9
  @media screen and (max-width: 480px) {
@@ -13,7 +13,7 @@ body {
13
13
 
14
14
  @media (min-width: 481px) and (max-width: 1024px) {
15
15
  body {
16
- --ox-input-font: normal 16px var(--theme-font);
17
- --ox-input-padding: 4px 5px;
16
+ --input-font: normal 16px var(--theme-font);
17
+ --input-padding: 4px 5px;
18
18
  }
19
19
  }