@operato/popup 7.0.5 → 7.0.20

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.
@@ -28,8 +28,9 @@ interface ArgTypes {
28
28
  function popup(e: MouseEvent, preventCloseOnBlur: boolean) {
29
29
  const popupList = document.querySelector('#popup-list') as OxPopupList
30
30
  popupList?.open({
31
- top: e.pageY,
32
- left: e.pageX
31
+ top: e.offsetY,
32
+ left: e.offsetX,
33
+ absolutePosition: false
33
34
  })
34
35
  }
35
36
 
@@ -58,6 +59,15 @@ const Template: Story<ArgTypes> = ({ preventCloseOnBlur }: ArgTypes) => html`
58
59
  </style>
59
60
 
60
61
  <style>
62
+ #container {
63
+ display: flex;
64
+ }
65
+
66
+ #noise {
67
+ width: 100px;
68
+ height: 100px;
69
+ }
70
+
61
71
  #place {
62
72
  width: 100%;
63
73
  height: 500px;
@@ -68,31 +78,34 @@ const Template: Story<ArgTypes> = ({ preventCloseOnBlur }: ArgTypes) => html`
68
78
  }
69
79
  </style>
70
80
 
71
- <div id="place" @click=${(e: MouseEvent) => popup(e, preventCloseOnBlur)} class="md-typescale-display-medium">
72
- Click this to popup list
73
- </div>
74
- <ox-popup-list
75
- id="popup-list"
76
- @select=${(e: Event) => console.log('select', e.target)}
77
- multiple
78
- ?prevent-close-on-blur=${preventCloseOnBlur}
79
- >
80
- <div option>Plain Text</div>
81
-
82
- <div option>
83
- <ox-checkbox label="checkbox" slot="icon" checked>checkbox</ox-checkbox>
84
- </div>
85
-
86
- <div option>
87
- <input id="checkbox-01" type="checkbox" />
88
- <label for="checkbox-01">custom option</label>
81
+ <div id="container">
82
+ <div id="noise"></div>
83
+ <div id="place" @click=${(e: MouseEvent) => popup(e, preventCloseOnBlur)} class="md-typescale-display-medium">
84
+ Click this to popup list
85
+ <ox-popup-list
86
+ id="popup-list"
87
+ @select=${(e: Event) => console.log('select', e.target)}
88
+ multiple
89
+ ?prevent-close-on-blur=${preventCloseOnBlur}
90
+ >
91
+ <div option>Plain Text</div>
92
+
93
+ <div option>
94
+ <ox-checkbox label="checkbox" slot="icon" checked>checkbox</ox-checkbox>
95
+ </div>
96
+
97
+ <div option>
98
+ <input id="checkbox-01" type="checkbox" />
99
+ <label for="checkbox-01">custom option</label>
100
+ </div>
101
+
102
+ <div option>
103
+ <label for="text-01">value</label>
104
+ <input id="text-01" type="text" value="Plain text input" />
105
+ </div>
106
+ </ox-popup-list>
89
107
  </div>
90
-
91
- <div option>
92
- <label for="text-01">value</label>
93
- <input id="text-01" type="text" value="Plain text input" />
94
- </div>
95
- </ox-popup-list>
108
+ </div>
96
109
  `
97
110
 
98
111
  export const Regular = Template.bind({})
@@ -119,9 +119,10 @@ function popup(e: MouseEvent) {
119
119
  <input id="text-01" type="text" value="Plain text input" />
120
120
  </div>
121
121
  `,
122
- top: e.pageY,
123
- left: e.pageX,
124
- parent: e.target as HTMLElement
122
+ top: e.offsetY,
123
+ left: e.offsetX,
124
+ parent: e.target as HTMLElement,
125
+ absolutePosition: false
125
126
  })
126
127
  }
127
128
 
@@ -150,18 +151,33 @@ const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
150
151
  </style>
151
152
 
152
153
  <style>
154
+ #container {
155
+ display: flex;
156
+ flex-direction: row;
157
+ height: 600px;
158
+ }
159
+
160
+ #padding {
161
+ width: 100px;
162
+ height: 100px;
163
+ }
164
+
153
165
  #place {
154
166
  width: 100%;
155
- height: 500px;
167
+ height: 400px;
156
168
  text-align: center;
169
+ padding-left: 100px;
157
170
 
158
171
  background-color: var(--md-sys-color-primary-container);
159
172
  color: var(--md-sys-color-on-primary-container);
160
173
  }
161
174
  </style>
162
175
 
163
- <div id="place" @click=${(e: MouseEvent) => popup(e)} class="md-typescale-display-medium">
164
- Click this to popup menu
176
+ <div id="container">
177
+ <div id="padding"></div>
178
+ <div id="place" @click=${(e: MouseEvent) => popup(e)} class="md-typescale-display-medium">
179
+ Click this to popup menu
180
+ </div>
165
181
  </div>
166
182
  `
167
183
 
@@ -5,7 +5,7 @@ import { OxPopup } from '../src/ox-popup'
5
5
  import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
6
6
 
7
7
  export default {
8
- title: 'ContextMenu',
8
+ title: 'Simple Popup',
9
9
  component: 'ox-popup',
10
10
  argTypes: {}
11
11
  }
@@ -23,9 +23,10 @@ function popup(e: MouseEvent) {
23
23
 
24
24
  OxPopup.open({
25
25
  template: html`<img src=${noImage} />`,
26
- top: e.pageY,
27
- left: e.pageX,
28
- parent: e.target as HTMLElement
26
+ top: e.offsetY,
27
+ left: e.offsetX,
28
+ parent: e.target as HTMLElement,
29
+ absolutePosition: false
29
30
  })
30
31
  }
31
32
 
@@ -58,6 +59,8 @@ const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
58
59
  width: 100%;
59
60
  height: 500px;
60
61
  text-align: center;
62
+ padding: 20px;
63
+ margin: 20px;
61
64
 
62
65
  background-color: var(--md-sys-color-primary-container);
63
66
  color: var(--md-sys-color-on-primary-container);