@esportsplus/ui 0.54.0 → 0.55.0
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/build/components/accordion/index.d.ts +713 -5
- package/build/components/accordion/index.js +16 -5
- package/build/components/accordion/scss/index.scss +1 -1
- package/build/components/checkbox/constants.d.ts +2 -0
- package/build/components/checkbox/constants.js +2 -0
- package/build/components/checkbox/index.d.ts +17 -11
- package/build/components/checkbox/index.js +22 -36
- package/build/components/clipboard/copy.d.ts +1 -1
- package/build/components/clipboard/copy.js +12 -7
- package/build/components/clipboard/index.d.ts +981 -981
- package/build/components/clipboard/onclick.js +4 -6
- package/build/components/counter/index.d.ts +1 -1
- package/build/components/counter/index.js +4 -8
- package/build/components/form/action.d.ts +1 -1
- package/build/components/form/action.js +2 -5
- package/build/components/form/index.d.ts +1 -1
- package/build/components/input/index.d.ts +1 -1
- package/build/components/input/index.js +2 -3
- package/build/components/radio/index.d.ts +3 -1442
- package/build/components/radio/index.js +2 -1
- package/build/components/select/constants.d.ts +4 -0
- package/build/components/select/constants.js +4 -0
- package/build/components/select/index.d.ts +12 -6
- package/build/components/select/index.js +43 -60
- package/build/components/switch/index.d.ts +3 -1442
- package/build/components/switch/index.js +2 -1
- package/build/components/textarea/index.d.ts +490 -490
- package/build/components/textarea/index.js +5 -8
- package/build/components/tooltip/constants.d.ts +3 -0
- package/build/components/tooltip/constants.js +3 -0
- package/build/components/tooltip/index.d.ts +8 -2153
- package/build/components/tooltip/index.js +2 -1
- package/build/components/tooltip/menu.d.ts +9 -5
- package/build/components/tooltip/menu.js +14 -17
- package/build/components/tooltip/onclick.d.ts +490 -490
- package/build/components/tooltip/onclick.js +17 -23
- package/build/components/tooltip/onhover.d.ts +497 -494
- package/build/components/tooltip/onhover.js +12 -17
- package/build/themes/dark/input.d.ts +491 -491
- package/build/themes/dark/select.d.ts +3 -735
- package/build/themes/dark/select.js +5 -4
- package/build/themes/dark/textarea.d.ts +490 -490
- package/package.json +2 -2
- package/pnpm-workspace.yaml +1 -1
- package/src/components/accordion/index.ts +7 -14
- package/src/components/accordion/scss/index.scss +3 -1
- package/src/components/checkbox/constants.ts +4 -0
- package/src/components/checkbox/index.ts +12 -23
- package/src/components/clipboard/copy.ts +7 -12
- package/src/components/clipboard/onclick.ts +4 -9
- package/src/components/counter/index.ts +5 -14
- package/src/components/form/action.ts +2 -8
- package/src/components/input/index.ts +7 -5
- package/src/components/radio/index.ts +5 -2
- package/src/components/select/constants.ts +8 -0
- package/src/components/select/index.ts +49 -53
- package/src/components/switch/index.ts +5 -2
- package/src/components/textarea/index.ts +13 -14
- package/src/components/tooltip/constants.ts +6 -0
- package/src/components/tooltip/index.ts +4 -1
- package/src/components/tooltip/menu.ts +18 -29
- package/src/components/tooltip/onclick.ts +22 -33
- package/src/components/tooltip/onhover.ts +18 -29
- package/src/themes/dark/select.ts +7 -4
|
@@ -1,55 +1,44 @@
|
|
|
1
1
|
import { component, html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
|
-
import {
|
|
3
|
+
import { MENU_OPTION, MENU_TOOLTIP_CONTENT } from './constants';
|
|
4
4
|
import onclick from './onclick';
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
type A = Attributes & {
|
|
8
|
+
[MENU_OPTION]?: Attributes,
|
|
9
|
+
[MENU_TOOLTIP_CONTENT]?: Attributes & { direction?: string },
|
|
8
10
|
options: (Attributes & { content: Renderable<unknown> })[],
|
|
9
|
-
option?: Attributes,
|
|
10
11
|
state?: { active: boolean },
|
|
11
|
-
toggle?: boolean
|
|
12
|
-
'tooltip-content': Attributes & { direction?: string }
|
|
12
|
+
toggle?: boolean
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const OMIT_TOOLTIP_CONTENT = ['direction'];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export default component<A>(
|
|
24
|
-
(attributes, content) => {
|
|
25
|
-
let options = attributes.options,
|
|
26
|
-
option = attributes.option,
|
|
27
|
-
state = attributes.state || reactive({ active: false }),
|
|
28
|
-
tooltipContent = attributes?.['tooltip-content'],
|
|
29
|
-
tooltipContentDirection = tooltipContent?.direction || 'nw';
|
|
16
|
+
export default Object.assign(component<A>(
|
|
17
|
+
({ options, state = reactive({ active: false }), ...attributes }, content) => {
|
|
18
|
+
let { direction = 'nw', ...tooltipContent } = attributes[MENU_TOOLTIP_CONTENT] ?? {};
|
|
30
19
|
|
|
31
20
|
return onclick(
|
|
32
|
-
{ ...
|
|
21
|
+
{ ...attributes, state },
|
|
33
22
|
html`
|
|
34
23
|
${content}
|
|
35
24
|
|
|
36
25
|
<div
|
|
37
|
-
class='tooltip-content ${`tooltip-content--${
|
|
38
|
-
${tooltipContent
|
|
26
|
+
class='tooltip-content ${`tooltip-content--${direction}`}'
|
|
27
|
+
${tooltipContent}
|
|
39
28
|
${{
|
|
40
29
|
inert: () => !state.active
|
|
41
30
|
}}
|
|
42
31
|
>
|
|
43
|
-
${options.map((o) => {
|
|
32
|
+
${options.map(({ content, ...o }) => {
|
|
44
33
|
if (o.href) {
|
|
45
34
|
return html`
|
|
46
35
|
<a
|
|
47
36
|
class='link --width-full'
|
|
48
37
|
target='_blank'
|
|
49
|
-
${
|
|
50
|
-
${
|
|
38
|
+
${o}
|
|
39
|
+
${attributes[MENU_OPTION]}
|
|
51
40
|
>
|
|
52
|
-
${
|
|
41
|
+
${content}
|
|
53
42
|
</a>
|
|
54
43
|
`;
|
|
55
44
|
}
|
|
@@ -57,10 +46,10 @@ export default component<A>(
|
|
|
57
46
|
return html`
|
|
58
47
|
<div
|
|
59
48
|
class='link --width-full'
|
|
60
|
-
${
|
|
61
|
-
${
|
|
49
|
+
${o}
|
|
50
|
+
${attributes[MENU_OPTION]}
|
|
62
51
|
>
|
|
63
|
-
${
|
|
52
|
+
${content}
|
|
64
53
|
</div>
|
|
65
54
|
`;
|
|
66
55
|
})}
|
|
@@ -68,4 +57,4 @@ export default component<A>(
|
|
|
68
57
|
`
|
|
69
58
|
);
|
|
70
59
|
}
|
|
71
|
-
);
|
|
60
|
+
), { option: MENU_OPTION, tooltipContent: MENU_TOOLTIP_CONTENT } as const);
|
|
@@ -1,40 +1,29 @@
|
|
|
1
1
|
import { component, html, type Attributes } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
|
-
import { omit } from '@esportsplus/utilities';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const OMIT = ['state', 'toggle'];
|
|
7
3
|
|
|
8
4
|
|
|
9
5
|
export default component<Attributes & { state?: { active: boolean }, toggle?: boolean }>(
|
|
10
|
-
(attributes, content) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
6
|
+
({ state = reactive({ active: false }), toggle = false, ...attributes }, content) => html`
|
|
7
|
+
<div
|
|
8
|
+
class='tooltip'
|
|
9
|
+
${attributes}
|
|
10
|
+
${{
|
|
11
|
+
class: () => state.active && '--active',
|
|
12
|
+
onclick: function(e) {
|
|
13
|
+
state.active = this === e.target || toggle ? !state.active : true;
|
|
14
|
+
},
|
|
15
|
+
ondocumentclick: function(this, event) {
|
|
16
|
+
if (!this?.isConnected || !state.active) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
>
|
|
36
|
-
${content}
|
|
37
|
-
</div>
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
20
|
+
if (!this.contains(event.target as Node | null)) {
|
|
21
|
+
state.active = false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
${content}
|
|
27
|
+
</div>
|
|
28
|
+
`
|
|
40
29
|
);
|
|
@@ -1,34 +1,23 @@
|
|
|
1
1
|
import { component, html, Attributes } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
|
-
import { omit } from '@esportsplus/utilities';
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
onmouseout: () => {
|
|
26
|
-
state.active = false;
|
|
27
|
-
}
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
${content}
|
|
31
|
-
</div>
|
|
32
|
-
`;
|
|
33
|
-
}
|
|
5
|
+
export default component<Attributes & { state?: { active: boolean } }>(
|
|
6
|
+
({ state = reactive({ active: false }), ...attributes }, content) => html`
|
|
7
|
+
<div
|
|
8
|
+
class='tooltip'
|
|
9
|
+
${attributes}
|
|
10
|
+
${{
|
|
11
|
+
class: () => state.active && '--active',
|
|
12
|
+
onmouseover: () => {
|
|
13
|
+
state.active = true;
|
|
14
|
+
},
|
|
15
|
+
onmouseout: () => {
|
|
16
|
+
state.active = false;
|
|
17
|
+
}
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
${content}
|
|
21
|
+
</div>
|
|
22
|
+
`
|
|
34
23
|
);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import select from '~/components/select';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const themed: typeof select = Object.assign(select.bind({
|
|
5
5
|
attributes: {
|
|
6
6
|
class: '--background-black --border-black --color-white',
|
|
7
|
-
option: {
|
|
7
|
+
[select.option]: {
|
|
8
8
|
class: '--background-black --color-white',
|
|
9
9
|
style: '--color-default: var(--color-grey-500); --padding-horizontal: var(--size-500); white-space: nowrap; width: 100%;'
|
|
10
10
|
},
|
|
11
11
|
style: '--border-color-default: var(--color-black-300); --border-width: var(--border-width-400); border: var(--border-width) solid var(--border-color);',
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
[select.tooltipContent]: {
|
|
14
14
|
direction: 'sw',
|
|
15
15
|
style: `
|
|
16
16
|
--background: var(--color-black-400);
|
|
@@ -21,4 +21,7 @@ export default select.bind({
|
|
|
21
21
|
`
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
});
|
|
24
|
+
}), { arrow: select.arrow, option: select.option, tooltipContent: select.tooltipContent } as const);
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export default themed;
|