@operato/popup 8.0.0-beta.0 → 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 +9 -0
- 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
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,15 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
|
7
|
+
|
8
|
+
|
9
|
+
### :bug: Bug Fix
|
10
|
+
|
11
|
+
* missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
|
12
|
+
|
13
|
+
|
14
|
+
|
6
15
|
## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
|
7
16
|
|
8
17
|
**Note:** Version bump only for package @operato/popup
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@operato/popup",
|
3
3
|
"description": "Webcomponent popup following open-wc recommendations",
|
4
4
|
"author": "heartyoh",
|
5
|
-
"version": "8.0.0-beta.
|
5
|
+
"version": "8.0.0-beta.1",
|
6
6
|
"main": "dist/src/index.js",
|
7
7
|
"module": "dist/src/index.js",
|
8
8
|
"exports": {
|
@@ -62,8 +62,8 @@
|
|
62
62
|
},
|
63
63
|
"dependencies": {
|
64
64
|
"@material/web": "^2.0.0",
|
65
|
-
"@operato/styles": "^8.0.0-beta.
|
66
|
-
"@operato/utils": "^8.0.0-beta.
|
65
|
+
"@operato/styles": "^8.0.0-beta.1",
|
66
|
+
"@operato/utils": "^8.0.0-beta.1",
|
67
67
|
"lit": "^3.1.2"
|
68
68
|
},
|
69
69
|
"devDependencies": {
|
@@ -100,5 +100,5 @@
|
|
100
100
|
"prettier --write"
|
101
101
|
]
|
102
102
|
},
|
103
|
-
"gitHead": "
|
103
|
+
"gitHead": "d5b28a2e9deb632c0dc80132f6a7196dd6fe4220"
|
104
104
|
}
|
package/.editorconfig
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
2
|
-
# coding styles between different editors and IDEs
|
3
|
-
# editorconfig.org
|
4
|
-
|
5
|
-
root = true
|
6
|
-
|
7
|
-
|
8
|
-
[*]
|
9
|
-
|
10
|
-
# Change these settings to your own preference
|
11
|
-
indent_style = space
|
12
|
-
indent_size = 2
|
13
|
-
|
14
|
-
# We recommend you to keep these unchanged
|
15
|
-
end_of_line = lf
|
16
|
-
charset = utf-8
|
17
|
-
trim_trailing_whitespace = true
|
18
|
-
insert_final_newline = true
|
19
|
-
|
20
|
-
[*.md]
|
21
|
-
trim_trailing_whitespace = false
|
22
|
-
|
23
|
-
[*.json]
|
24
|
-
indent_size = 2
|
25
|
-
|
26
|
-
[*.{html,js,md}]
|
27
|
-
block_comment_start = /**
|
28
|
-
block_comment = *
|
29
|
-
block_comment_end = */
|
package/.storybook/main.js
DELETED
package/.storybook/preview.js
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
import { i18next } from '@operato/i18n'
|
2
|
-
|
3
|
-
export const globalTypes = {
|
4
|
-
locale: {
|
5
|
-
name: 'Locale',
|
6
|
-
description: 'Internationalization locale',
|
7
|
-
toolbar: {
|
8
|
-
icon: 'globe',
|
9
|
-
items: [
|
10
|
-
{ value: 'en', right: '🇺🇸', title: 'English' },
|
11
|
-
{ value: 'ko', right: '🇰🇷', title: '한국어' },
|
12
|
-
{ value: 'zh', right: '🇨🇳', title: '中文' },
|
13
|
-
{ value: 'ja', right: '🇯🇵', title: '日本語' },
|
14
|
-
{ value: 'ms', right: '🇲🇾', title: 'Bahasa Melayu' }
|
15
|
-
],
|
16
|
-
showName: true
|
17
|
-
}
|
18
|
-
},
|
19
|
-
theme: {
|
20
|
-
name: 'Theme',
|
21
|
-
description: 'Global theme for components',
|
22
|
-
toolbar: {
|
23
|
-
icon: 'paintbrush',
|
24
|
-
items: [
|
25
|
-
{ value: 'light', title: 'Light' },
|
26
|
-
{ value: 'dark', title: 'Dark' }
|
27
|
-
],
|
28
|
-
showName: true
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
export const decorators = [
|
34
|
-
(Story, context) => {
|
35
|
-
const { locale, theme } = context.globals
|
36
|
-
|
37
|
-
if (locale) {
|
38
|
-
i18next.changeLanguage(locale)
|
39
|
-
}
|
40
|
-
|
41
|
-
// Set the theme class for the document
|
42
|
-
if (theme === 'dark') {
|
43
|
-
document.documentElement.classList.add('dark')
|
44
|
-
document.documentElement.classList.remove('light')
|
45
|
-
} else {
|
46
|
-
document.documentElement.classList.add('light')
|
47
|
-
document.documentElement.classList.remove('dark')
|
48
|
-
}
|
49
|
-
|
50
|
-
return Story()
|
51
|
-
}
|
52
|
-
]
|
package/.storybook/server.mjs
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
import { storybookPlugin } from '@web/dev-server-storybook';
|
2
|
-
import baseConfig from '../web-dev-server.config.mjs';
|
3
|
-
|
4
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
5
|
-
...baseConfig,
|
6
|
-
open: '/',
|
7
|
-
plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
|
8
|
-
});
|
package/src/index.ts
DELETED
package/src/open-popup.ts
DELETED
@@ -1,166 +0,0 @@
|
|
1
|
-
import './ox-floating-overlay.js'
|
2
|
-
|
3
|
-
import { html, render, TemplateResult } from 'lit'
|
4
|
-
|
5
|
-
import { OxFloatingOverlay } from './ox-floating-overlay.js'
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Options for popup
|
9
|
-
*
|
10
|
-
* @typedef {Object} PopupOptions
|
11
|
-
* @property {String} [title] - popup title
|
12
|
-
* @property {'center' | 'next' | 'edge'} [hovering] - hovering position (default: 'center'). 'edge' : edge of the HEADERBAR, 'next' : next of the clicked position.
|
13
|
-
* @property {'large' | 'medium' | small'} [size] - popup size
|
14
|
-
* @property {Boolean} [closable] - set whether the close 'X' button is shown on top-right most position (default true)
|
15
|
-
* @property {Boolean} [escapable] - set whether the close popup with 'ESC' key (default true)
|
16
|
-
* @property {Boolean} [backdrop] - set whether to do background masking around the pop-up. If true, it becomes modal (default true)
|
17
|
-
* @property {Boolean} [movable] - set whether to be able to movable by the gesture dragging on header once the hovering option is 'center'
|
18
|
-
* @property {String} [help] - inline help link
|
19
|
-
*/
|
20
|
-
export type PopupOptions = {
|
21
|
-
title?: string
|
22
|
-
hovering?: 'center' | 'next' | 'edge'
|
23
|
-
size?: 'large' | 'medium' | 'small'
|
24
|
-
closable?: boolean
|
25
|
-
escapable?: boolean
|
26
|
-
backdrop?: boolean
|
27
|
-
movable?: boolean
|
28
|
-
help?: string
|
29
|
-
search?: {
|
30
|
-
value?: string
|
31
|
-
handler?: (closure: any, value: string) => void
|
32
|
-
placeholder?: string
|
33
|
-
autofocus?: boolean
|
34
|
-
}
|
35
|
-
filter?: {
|
36
|
-
handler?: (closure: any) => void
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
/**
|
41
|
-
* Popup handle object that will be returned openPopup
|
42
|
-
*
|
43
|
-
* @typedef {Object} PopupHandle
|
44
|
-
* @property {String} [name] - popup instance name
|
45
|
-
* @property {Function} [close] - call this function to close the popup.
|
46
|
-
* @property {Boolean} [closed] - state telling whether the popup is closed or not.
|
47
|
-
* @property {Function} [onclosed] - set callback function on close. It will be called when the popup about to close.
|
48
|
-
*/
|
49
|
-
export type PopupHandle = {
|
50
|
-
name: string
|
51
|
-
close: () => void
|
52
|
-
closed: boolean
|
53
|
-
onclosed?: () => void
|
54
|
-
}
|
55
|
-
|
56
|
-
/*
|
57
|
-
* popup handling
|
58
|
-
*
|
59
|
-
* popup은 overlay의 특별한 형태이다.
|
60
|
-
* popup은 open될 때, viewpart를 append 하며, close 될 때 viewpart를 remove 한다.
|
61
|
-
* - name: '$popup-${popupSequence}'
|
62
|
-
* - position: VIEWPART_POSITION_HEADERBAR
|
63
|
-
* - hovering: 'center' | 'next' | 'edge'
|
64
|
-
*/
|
65
|
-
var popupSequence = 0
|
66
|
-
|
67
|
-
/**
|
68
|
-
* default openPopup implementation for operato application environment
|
69
|
-
*
|
70
|
-
* @param {*} template html template to be rendered inside the popup
|
71
|
-
* @param {PopupOptions} options
|
72
|
-
* @returns popup handle object. This object is used to close the popup.
|
73
|
-
*/
|
74
|
-
function defaultOpenPopup(template: TemplateResult, options: PopupOptions = {}): PopupHandle {
|
75
|
-
const {
|
76
|
-
title,
|
77
|
-
size = 'large',
|
78
|
-
closable = false,
|
79
|
-
escapable = false,
|
80
|
-
help,
|
81
|
-
hovering,
|
82
|
-
backdrop,
|
83
|
-
movable = false,
|
84
|
-
search,
|
85
|
-
filter
|
86
|
-
} = options
|
87
|
-
const name = `$popup-${popupSequence++}`
|
88
|
-
|
89
|
-
render(
|
90
|
-
html`
|
91
|
-
<ox-floating-overlay
|
92
|
-
id=${name}
|
93
|
-
name=${name}
|
94
|
-
.backdrop=${backdrop}
|
95
|
-
direction="down"
|
96
|
-
.hovering=${hovering}
|
97
|
-
.title=${title || ''}
|
98
|
-
.help=${help}
|
99
|
-
.size=${size}
|
100
|
-
.closable=${closable}
|
101
|
-
.historical=${false}
|
102
|
-
.movable=${movable}
|
103
|
-
.search=${search}
|
104
|
-
.filter=${filter}
|
105
|
-
>${template}</ox-floating-overlay
|
106
|
-
>
|
107
|
-
`,
|
108
|
-
document.body
|
109
|
-
)
|
110
|
-
|
111
|
-
requestAnimationFrame(() => {
|
112
|
-
dispatchEvent(new Event('resize'))
|
113
|
-
})
|
114
|
-
|
115
|
-
const popupHandle = {
|
116
|
-
name,
|
117
|
-
close: () => {
|
118
|
-
const popup = document.body.querySelector(`#${name}`) as OxFloatingOverlay
|
119
|
-
popup?.close()
|
120
|
-
popupHandle.onclosed && popupHandle.onclosed()
|
121
|
-
},
|
122
|
-
closed: false
|
123
|
-
} as PopupHandle
|
124
|
-
|
125
|
-
return popupHandle
|
126
|
-
}
|
127
|
-
|
128
|
-
var openPopupImpl: (template: TemplateResult, options: PopupOptions) => PopupHandle = defaultOpenPopup
|
129
|
-
|
130
|
-
/**
|
131
|
-
* replace default openPopup implementation
|
132
|
-
*
|
133
|
-
* @param {(template: TemplateResult, options: PopupOptions) => PopupHandle} implementation
|
134
|
-
*/
|
135
|
-
export function setOpenPopupImplementation(
|
136
|
-
implementation: (template: TemplateResult, options: PopupOptions) => PopupHandle
|
137
|
-
) {
|
138
|
-
openPopupImpl = implementation
|
139
|
-
}
|
140
|
-
|
141
|
-
/**
|
142
|
-
* open popup out of operato application environment
|
143
|
-
*
|
144
|
-
* @param {*} template html template to be rendered inside the popup
|
145
|
-
* @param {PopupOptions} options
|
146
|
-
* @returns popup handle object. This object is used to close the popup.
|
147
|
-
*/
|
148
|
-
export const openPopup = (template: TemplateResult, options: PopupOptions = {}): PopupHandle => {
|
149
|
-
return openPopupImpl(template, options)
|
150
|
-
}
|
151
|
-
|
152
|
-
/**
|
153
|
-
* open popup out of operato application environment
|
154
|
-
*
|
155
|
-
* @param {*} template html template to be rendered inside the popup
|
156
|
-
* @param {PopupOptions} options
|
157
|
-
* @returns popup handle object. This object is used to close the popup.
|
158
|
-
*/
|
159
|
-
export const closePopup = (element: HTMLElement): void => {
|
160
|
-
element.dispatchEvent(
|
161
|
-
new CustomEvent('close-overlay', {
|
162
|
-
bubbles: true,
|
163
|
-
composed: true
|
164
|
-
})
|
165
|
-
)
|
166
|
-
}
|