@esportsplus/ui 0.51.7 → 0.53.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/README.md +2 -3
- package/build/components/accordion/index.d.ts +15 -10
- package/build/components/accordion/index.js +8 -34
- package/build/components/accordion/scss/index.scss +1 -1
- package/build/components/back/index.d.ts +14 -11
- package/build/components/back/index.js +3 -3
- package/build/components/button/index.js +2 -2
- package/build/components/checkbox/index.js +7 -3
- package/build/components/clipboard/index.d.ts +23 -20
- package/build/components/clipboard/index.js +1 -0
- package/build/components/clipboard/onclick.js +3 -3
- package/build/components/form/input.js +3 -3
- package/build/components/frame/index.d.ts +16 -15
- package/build/components/frame/index.js +11 -5
- package/build/components/highlight/index.js +2 -2
- package/build/components/icon/index.js +2 -2
- package/build/components/index.d.ts +1 -4
- package/build/components/index.js +1 -4
- package/build/components/loader/index.js +4 -4
- package/build/components/loader/scss/index.scss +1 -1
- package/build/components/overlay/index.d.ts +16 -15
- package/build/components/overlay/index.js +11 -5
- package/build/components/overlay/scss/index.scss +1 -1
- package/build/components/page/scss/index.scss +1 -1
- package/build/components/root/scss/index.scss +1 -1
- package/build/components/select/index.d.ts +3 -6
- package/build/components/select/index.js +72 -78
- package/build/components/sidebar/index.d.ts +16 -15
- package/build/components/sidebar/index.js +11 -5
- package/build/components/sidebar/scss/index.scss +1 -1
- package/build/components/toast/index.d.ts +9 -0
- package/build/components/toast/index.js +157 -0
- package/build/components/toast/manager.d.ts +60 -0
- package/build/components/toast/manager.js +203 -0
- package/build/components/toast/scss/index.scss +2 -0
- package/build/components/toast/svg/check.svg +1 -0
- package/build/components/toast/svg/chevron.svg +1 -0
- package/build/components/toast/svg/close.svg +1 -0
- package/build/components/toast/svg/copy.svg +1 -0
- package/build/components/toast/svg/error.svg +1 -0
- package/build/components/toast/svg/info.svg +1 -0
- package/build/components/toast/svg/loading.svg +1 -0
- package/build/components/toast/svg/success.svg +1 -0
- package/build/components/toast/svg/warning.svg +1 -0
- package/build/components/tooltip/index.d.ts +40 -40
- package/build/components/tooltip/menu.js +37 -23
- package/build/components/tooltip/onclick.d.ts +20 -20
- package/build/components/tooltip/onclick.js +2 -2
- package/build/components/tooltip/onhover.js +2 -2
- package/build/components/typewriter/index.js +2 -2
- package/build/css-utilities/index.scss +1 -1
- package/build/css-utilities/scroll-fade/scss/index.scss +2 -0
- package/build/css-utilities/scrollbar/scss/index.scss +2 -0
- package/build/themes/dark/back.d.ts +8 -4
- package/build/themes/dark/index.d.ts +0 -1
- package/build/themes/dark/index.js +0 -1
- package/build/themes/dark/input.d.ts +2 -2
- package/build/themes/dark/select.d.ts +60 -110
- package/build/themes/dark/textarea.d.ts +2 -2
- package/package.json +15 -15
- package/pnpm-workspace.yaml +11 -8
- package/src/components/accordion/index.ts +7 -30
- package/src/components/accordion/scss/index.scss +9 -12
- package/src/components/back/index.ts +4 -5
- package/src/components/button/index.ts +2 -3
- package/src/components/checkbox/index.ts +7 -2
- package/src/components/clipboard/index.ts +2 -1
- package/src/components/clipboard/onclick.ts +3 -4
- package/src/components/form/input.ts +4 -4
- package/src/components/frame/index.ts +9 -5
- package/src/components/highlight/index.ts +2 -3
- package/src/components/icon/index.ts +2 -3
- package/src/components/index.ts +1 -4
- package/src/components/loader/index.ts +5 -6
- package/src/components/loader/scss/index.scss +1 -1
- package/src/components/overlay/index.ts +9 -5
- package/src/components/overlay/scss/index.scss +0 -1
- package/src/components/page/scss/index.scss +1 -1
- package/src/components/root/scss/index.scss +35 -4
- package/src/components/root/scss/variables.scss +1 -2
- package/src/components/select/index.ts +71 -83
- package/src/components/sidebar/index.ts +9 -5
- package/src/components/sidebar/scss/index.scss +0 -1
- package/src/components/toast/index.ts +188 -0
- package/src/components/toast/manager.ts +312 -0
- package/src/components/toast/scss/index.scss +276 -0
- package/src/components/toast/scss/variables.scss +19 -0
- package/src/components/toast/svg/check.svg +1 -0
- package/src/components/toast/svg/chevron.svg +1 -0
- package/src/components/toast/svg/close.svg +1 -0
- package/src/components/toast/svg/copy.svg +1 -0
- package/src/components/toast/svg/error.svg +1 -0
- package/src/components/toast/svg/info.svg +1 -0
- package/src/components/toast/svg/loading.svg +1 -0
- package/src/components/toast/svg/success.svg +1 -0
- package/src/components/toast/svg/warning.svg +1 -0
- package/src/components/tooltip/menu.ts +8 -4
- package/src/components/tooltip/onclick.ts +2 -3
- package/src/components/tooltip/onhover.ts +2 -3
- package/src/components/typewriter/index.ts +2 -3
- package/src/css-utilities/index.scss +3 -2
- package/src/css-utilities/scroll-fade/scss/index.scss +47 -0
- package/src/css-utilities/scroll-fade/scss/variables.scss +3 -0
- package/src/css-utilities/scrollbar/scss/index.scss +53 -0
- package/src/css-utilities/scrollbar/scss/variables.scss +5 -0
- package/src/themes/dark/index.ts +0 -1
- package/src/tokens/scss/color.scss +14 -14
- package/src/tokens/scss/font-size.scss +12 -11
- package/src/tokens/scss/line-height.scss +7 -4
- package/src/tokens/scss/scale.scss +22 -0
- package/src/tokens/scss/size.scss +12 -9
- package/src/tokens/scss/spacer.scss +9 -9
- package/storage/svg/bolt.svg +1 -0
- package/storage/svg/star.svg +1 -0
- package/tsconfig.json +6 -2
- package/vite-env.d.ts +1 -0
- package/vite.config.ts +73 -72
- package/build/components/alert/index.d.ts +0 -19
- package/build/components/alert/index.js +0 -151
- package/build/components/alert/scss/index.scss +0 -2
- package/build/components/alert/svg/check.svg +0 -11
- package/build/components/alert/svg/close.svg +0 -12
- package/build/components/alert/svg/error.svg +0 -18
- package/build/components/scrollbar/index.d.ts +0 -27
- package/build/components/scrollbar/index.js +0 -56
- package/build/components/scrollbar/scss/index.scss +0 -2
- package/build/components/site/index.d.ts +0 -20
- package/build/components/site/index.js +0 -9
- package/build/components/site/scss/index.scss +0 -2
- package/build/components/template/index.d.ts +0 -14
- package/build/components/template/index.js +0 -21
- package/build/css-utilities/scroller/scss/index.scss +0 -2
- package/build/themes/dark/alert.d.ts +0 -11
- package/build/themes/dark/alert.js +0 -20
- package/src/components/accordion/scss/variables.scss +0 -9
- package/src/components/alert/index.ts +0 -165
- package/src/components/alert/scss/index.scss +0 -25
- package/src/components/alert/scss/variables.scss +0 -3
- package/src/components/alert/svg/check.svg +0 -11
- package/src/components/alert/svg/close.svg +0 -12
- package/src/components/alert/svg/error.svg +0 -18
- package/src/components/scrollbar/index.ts +0 -70
- package/src/components/scrollbar/scss/index.scss +0 -82
- package/src/components/scrollbar/scss/variables.scss +0 -6
- package/src/components/site/index.ts +0 -11
- package/src/components/site/scss/index.scss +0 -3
- package/src/components/template/index.ts +0 -40
- package/src/css-utilities/scroller/scss/index.scss +0 -8
- package/src/css-utilities/scroller/scss/variables.scss +0 -4
- package/src/themes/dark/alert.ts +0 -23
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
@use '/tokens';
|
|
2
|
-
@use 'variables';
|
|
3
|
-
|
|
4
1
|
.accordion {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
transition:
|
|
9
|
-
max-height var(--transition-duration) ease-in-out,
|
|
10
|
-
opacity var(--transition-duration) ease-in-out;
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-rows: 1fr;
|
|
4
|
+
transition: grid-template-rows .3s;
|
|
11
5
|
|
|
6
|
+
&[inert] {
|
|
7
|
+
grid-template-rows: 0fr;
|
|
8
|
+
}
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
&-content {
|
|
11
|
+
min-height: 0;
|
|
12
|
+
overflow: hidden;
|
|
16
13
|
}
|
|
17
14
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { component, html } from '@esportsplus/template';
|
|
2
2
|
import icon from '~/components/icon';
|
|
3
|
-
import template from '~/components/template';
|
|
4
3
|
import arrow from './svg/arrow.svg';
|
|
5
4
|
import './scss/index.scss';
|
|
6
5
|
|
|
7
6
|
|
|
8
|
-
export default
|
|
9
|
-
function (this
|
|
7
|
+
export default component(
|
|
8
|
+
function (this, attributes, content) {
|
|
10
9
|
return html`
|
|
11
10
|
<a
|
|
12
11
|
class='back link --padding-0px --flex-vertical'
|
|
13
|
-
${this
|
|
12
|
+
${this?.attributes}
|
|
14
13
|
${attributes}
|
|
15
14
|
>
|
|
16
15
|
${icon({ class: 'back-arrow --margin-right --margin-200' }, arrow)}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { html, type Renderable } from '@esportsplus/template';
|
|
1
|
+
import { component, html, type Renderable } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
|
-
import template from '../template';
|
|
4
3
|
import './scss/index.scss';
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
const hold =
|
|
6
|
+
const hold = component(
|
|
8
7
|
function(attributes, content: (state: { holding: boolean, complete: boolean }) => Renderable<any>) {
|
|
9
8
|
let end = () => {
|
|
10
9
|
if (!state.complete) {
|
|
@@ -13,7 +13,8 @@ const factory = (type: string) => {
|
|
|
13
13
|
this: { attributes?: Attributes } | any,
|
|
14
14
|
attributes?: Attributes & { state?: { active: boolean, error: string } }
|
|
15
15
|
) {
|
|
16
|
-
let
|
|
16
|
+
let ref: HTMLElement,
|
|
17
|
+
state = attributes?.state || reactive({
|
|
17
18
|
active: false,
|
|
18
19
|
error: ''
|
|
19
20
|
});
|
|
@@ -24,9 +25,10 @@ const factory = (type: string) => {
|
|
|
24
25
|
|
|
25
26
|
return html`
|
|
26
27
|
<div
|
|
27
|
-
class='${
|
|
28
|
+
class='${() => state.active ? type + " --active" : type}'
|
|
28
29
|
${this?.attributes && omit(this.attributes, OMIT)}
|
|
29
30
|
${attributes && omit(attributes, OMIT)}
|
|
31
|
+
onclick=${() => ref.click()}
|
|
30
32
|
>
|
|
31
33
|
<input
|
|
32
34
|
${{
|
|
@@ -35,6 +37,9 @@ const factory = (type: string) => {
|
|
|
35
37
|
onchange: (e: Event) => {
|
|
36
38
|
state.active = (e.target as HTMLInputElement).checked;
|
|
37
39
|
},
|
|
40
|
+
onconnect: (input) => {
|
|
41
|
+
ref = input;
|
|
42
|
+
},
|
|
38
43
|
onrender: form.input.onrender(state),
|
|
39
44
|
type: type === 'radio' ? 'radio' : 'checkbox',
|
|
40
45
|
value: attributes?.value || 1
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
1
|
+
import { component, html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
3
|
import { omit } from '@esportsplus/utilities';
|
|
4
|
-
import template from '~/components/template';
|
|
5
4
|
import write from './write';
|
|
6
5
|
|
|
7
6
|
|
|
@@ -11,7 +10,7 @@ type A = { timeout?: number, value: string } & Attributes;
|
|
|
11
10
|
const OMIT = ['timeout', 'value'];
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
export default
|
|
13
|
+
export default component<A, (state: { copied: boolean }) => Renderable<unknown>>(
|
|
15
14
|
function(attributes, content) {
|
|
16
15
|
let state = reactive({
|
|
17
16
|
copied: false
|
|
@@ -25,7 +24,7 @@ export default template.factory<A, (state: { copied: boolean }) => Renderable<un
|
|
|
25
24
|
e.preventDefault();
|
|
26
25
|
e.stopPropagation();
|
|
27
26
|
|
|
28
|
-
write(attributes.value).then(() => {
|
|
27
|
+
void write(attributes.value).then(() => {
|
|
29
28
|
state.copied = true;
|
|
30
29
|
|
|
31
30
|
setTimeout(() => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Element } from '@esportsplus/template';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const KEY = Symbol();
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
const get = (element?: Element)
|
|
7
|
+
const get = (element?: Element) => {
|
|
8
8
|
if (element) {
|
|
9
|
-
return element[
|
|
9
|
+
return element[KEY] as { error: string } | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
return undefined;
|
|
@@ -14,7 +14,7 @@ const get = (element?: Element): { error: string } | undefined => {
|
|
|
14
14
|
|
|
15
15
|
const onrender = (reactive: { error: string }) => {
|
|
16
16
|
return (element: Element) => {
|
|
17
|
-
element[
|
|
17
|
+
element[KEY] = reactive;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { component, html } from '@esportsplus/template';
|
|
2
2
|
import './scss/index.scss';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
export default
|
|
6
|
-
attributes
|
|
7
|
-
|
|
5
|
+
export default component(
|
|
6
|
+
function(this, attributes, content) {
|
|
7
|
+
return html`
|
|
8
|
+
<div class='frame --scrollbar' ${this?.attributes} ${attributes}>
|
|
9
|
+
${content}
|
|
10
|
+
</div>
|
|
11
|
+
`;
|
|
8
12
|
}
|
|
9
|
-
|
|
13
|
+
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { html, Attributes } from '@esportsplus/template';
|
|
1
|
+
import { component, html, Attributes } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
3
|
import { omit } from '@esportsplus/utilities';
|
|
4
|
-
import template from '~/components/template';
|
|
5
4
|
import './scss/index.scss';
|
|
6
5
|
|
|
7
6
|
|
|
@@ -15,7 +14,7 @@ let key = Symbol(),
|
|
|
15
14
|
observer: IntersectionObserver | null = null;
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
export default
|
|
17
|
+
export default component(
|
|
19
18
|
(attributes: A, content) => {
|
|
20
19
|
if (observer === null) {
|
|
21
20
|
observer = new IntersectionObserver((entries) => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { html } from '@esportsplus/template';
|
|
2
|
-
import template from '~/components/template';
|
|
1
|
+
import { component, html } from '@esportsplus/template';
|
|
3
2
|
import './scss/index.scss';
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
export default
|
|
5
|
+
export default component(
|
|
7
6
|
(attributes, href: string) => {
|
|
8
7
|
if (href[0] !== '#') {
|
|
9
8
|
href = '#' + href;
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as accordion } from './accordion';
|
|
2
|
-
export { default as alert } from './alert';
|
|
3
2
|
export { default as back } from './back';
|
|
4
3
|
export { default as button } from './button';
|
|
5
4
|
export { default as checkbox } from './checkbox';
|
|
@@ -21,11 +20,9 @@ export { default as range } from './range';
|
|
|
21
20
|
export { default as root } from './root';
|
|
22
21
|
export { default as select } from './select';
|
|
23
22
|
export { default as switch } from './switch';
|
|
24
|
-
export { default as scrollbar } from './scrollbar';
|
|
25
23
|
export { default as sidebar } from './sidebar';
|
|
26
|
-
export { default as site } from './site';
|
|
27
|
-
export { default as template } from './template';
|
|
28
24
|
export { default as textarea } from './textarea';
|
|
25
|
+
export { default as toaster, toast } from './toast';
|
|
29
26
|
export { default as tooltip } from './tooltip';
|
|
30
27
|
export { default as truncate } from './truncate';
|
|
31
28
|
export { default as typewriter } from './typewriter';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { html, type Attributes } from '@esportsplus/template';
|
|
1
|
+
import { component, html, type Attributes } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
|
-
import { omit } from '@esportsplus/utilities'
|
|
4
|
-
import template from '~/components/template';
|
|
3
|
+
import { omit } from '@esportsplus/utilities';
|
|
5
4
|
import './scss/index.scss';
|
|
6
5
|
|
|
7
6
|
|
|
@@ -15,7 +14,7 @@ type A = Attributes & {
|
|
|
15
14
|
const OMIT = ['loader-content', 'loader-logo'];
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
export default
|
|
17
|
+
export default component(
|
|
19
18
|
(attributes: A, content) => {
|
|
20
19
|
let state = reactive({
|
|
21
20
|
load: false,
|
|
@@ -33,10 +32,10 @@ export default template.factory(
|
|
|
33
32
|
return html`
|
|
34
33
|
<div
|
|
35
34
|
class='loader ${() => state.load && 'loader--load'}'
|
|
36
|
-
onanimationend=${(
|
|
35
|
+
onanimationend=${({ animationName: name }: AnimationEvent) => {
|
|
37
36
|
i++;
|
|
38
37
|
|
|
39
|
-
if (
|
|
38
|
+
if (name === 'move' && i > 1) {
|
|
40
39
|
state.remove = true;
|
|
41
40
|
}
|
|
42
41
|
}}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { component, html } from '@esportsplus/template';
|
|
2
2
|
import './scss/index.scss';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
export default
|
|
6
|
-
attributes
|
|
7
|
-
|
|
5
|
+
export default component(
|
|
6
|
+
function(this, attributes, content) {
|
|
7
|
+
return html`
|
|
8
|
+
<div class='overlay --scrollbar' ${this?.attributes} ${attributes}>
|
|
9
|
+
${content}
|
|
10
|
+
</div>
|
|
11
|
+
`;
|
|
8
12
|
}
|
|
9
|
-
|
|
13
|
+
);
|
|
@@ -36,11 +36,9 @@ section {
|
|
|
36
36
|
width: var(--width);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
h1, h2, h3, h4, h5 {
|
|
39
|
+
h1, h2, h3, h4, h5, h6 {
|
|
40
40
|
color: var(--color);
|
|
41
|
-
|
|
42
|
-
font-weight: var(--font-weight);
|
|
43
|
-
line-height: var(--line-height);
|
|
41
|
+
line-height: 1.2;
|
|
44
42
|
margin: 0;
|
|
45
43
|
padding: 0;
|
|
46
44
|
position: relative;
|
|
@@ -54,6 +52,39 @@ h1, h2, h3, h4, h5 {
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
|
|
55
|
+
h1 {
|
|
56
|
+
font-size: var(--font-size-800);
|
|
57
|
+
font-weight: var(--font-weight-600);
|
|
58
|
+
letter-spacing: -0.02em;
|
|
59
|
+
line-height: 1.1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
h2 {
|
|
63
|
+
font-size: var(--font-size-700);
|
|
64
|
+
font-weight: var(--font-weight-500);
|
|
65
|
+
letter-spacing: -0.015em;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
h3 {
|
|
69
|
+
font-size: var(--font-size-600);
|
|
70
|
+
font-weight: var(--font-weight-500);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
h4 {
|
|
74
|
+
font-size: var(--font-size-500);
|
|
75
|
+
font-weight: var(--font-weight-500);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
h5 {
|
|
79
|
+
font-size: var(--font-size-400);
|
|
80
|
+
font-weight: var(--font-weight-500);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
h6 {
|
|
84
|
+
font-size: var(--font-size-300);
|
|
85
|
+
font-weight: var(--font-weight-500);
|
|
86
|
+
}
|
|
87
|
+
|
|
57
88
|
a {
|
|
58
89
|
color: var(--color, inherit);
|
|
59
90
|
cursor: pointer;
|
|
@@ -13,14 +13,13 @@
|
|
|
13
13
|
@include lib.css-variables(size, tokens.$size);
|
|
14
14
|
@include lib.css-variables(spacer, tokens.$spacer);
|
|
15
15
|
|
|
16
|
-
--background: var(--color-
|
|
16
|
+
--background: var(--color-white-400);
|
|
17
17
|
--color: var(--color-text-400);
|
|
18
18
|
--font-family: 'Montserrat', sans-serif;
|
|
19
19
|
--font-size: var(--font-size-400);
|
|
20
20
|
--font-weight: var(--font-weight-400);
|
|
21
21
|
--line-height: var(--line-height-400);
|
|
22
22
|
--min-width: 320px;
|
|
23
|
-
--scrollbar-width: 17px;
|
|
24
23
|
--transition-duration: #{tokens.$transition-duration};
|
|
25
24
|
|
|
26
25
|
// https://gist.github.com/jh3y/1b3afdfa7af3ebc5668bf169cea17d09
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { html, type Renderable, type Attributes } from '@esportsplus/template';
|
|
1
|
+
import { component, html, type Renderable, type Attributes } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
3
|
import { EMPTY_ARRAY, omit, toArray } from '@esportsplus/utilities';
|
|
4
4
|
import form from '~/components/form';
|
|
5
5
|
import root from '~/components/root';
|
|
6
|
-
import scrollbar, { Attributes as Attr } from '~/components/scrollbar';
|
|
7
|
-
import template from '~/components/template';
|
|
8
6
|
import './scss/index.scss';
|
|
9
7
|
|
|
10
8
|
|
|
@@ -12,8 +10,6 @@ const OMIT = [
|
|
|
12
10
|
'arrow',
|
|
13
11
|
'options',
|
|
14
12
|
'option',
|
|
15
|
-
'scrollbar',
|
|
16
|
-
'scrollbar-container-content',
|
|
17
13
|
'tooltip-content',
|
|
18
14
|
];
|
|
19
15
|
|
|
@@ -22,8 +18,6 @@ type A = {
|
|
|
22
18
|
arrow?: Attributes;
|
|
23
19
|
options: Record<number | string, Renderable<unknown> | { content: Renderable<unknown>, selected: Renderable<unknown> }>;
|
|
24
20
|
option?: Attributes;
|
|
25
|
-
scrollbar?: Attributes;
|
|
26
|
-
'scrollbar-container-content'?: Attributes;
|
|
27
21
|
'tooltip-content'?: Attributes & { direction?: string };
|
|
28
22
|
} & (
|
|
29
23
|
{
|
|
@@ -37,18 +31,11 @@ type A = {
|
|
|
37
31
|
selected?: number | string;
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
|
-
) & Attributes
|
|
34
|
+
) & Attributes;
|
|
41
35
|
|
|
42
36
|
|
|
43
|
-
let previous: { active: boolean } | null = null
|
|
44
|
-
|
|
45
|
-
attributes: {
|
|
46
|
-
class: 'tooltip-content',
|
|
47
|
-
'scrollbar-container-content': {
|
|
48
|
-
class: '--flex-column'
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
37
|
+
let previous: { active: boolean } | null = null;
|
|
38
|
+
|
|
52
39
|
|
|
53
40
|
function set(current: { active: boolean }, value: boolean) {
|
|
54
41
|
current.active = value;
|
|
@@ -73,7 +60,8 @@ function set(current: { active: boolean }, value: boolean) {
|
|
|
73
60
|
}
|
|
74
61
|
}
|
|
75
62
|
|
|
76
|
-
|
|
63
|
+
|
|
64
|
+
export default component<A, (state: { active: boolean, selected?: string | number }) => Renderable<unknown>>(
|
|
77
65
|
function(this: { attributes?: Exclude<A, 'options' | 'selected' | 'state'> }, attributes: A, content) {
|
|
78
66
|
let { options, option } = attributes,
|
|
79
67
|
state = attributes.state || reactive({
|
|
@@ -131,77 +119,77 @@ const select = template.factory<A, (state: { active: boolean, selected?: string
|
|
|
131
119
|
Object.fromEntries( keys.map(key => [key, false]) )
|
|
132
120
|
);
|
|
133
121
|
|
|
134
|
-
return
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
...
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
122
|
+
return html`
|
|
123
|
+
<div
|
|
124
|
+
class='tooltip-content --flex-column --scrollbar'
|
|
125
|
+
${{
|
|
126
|
+
...this?.attributes?.['tooltip-content'] || EMPTY_ARRAY,
|
|
127
|
+
...attributes['tooltip-content'],
|
|
128
|
+
class: [
|
|
129
|
+
...toArray(this?.attributes?.['tooltip-content']?.class),
|
|
130
|
+
...toArray(attributes['tooltip-content']?.class),
|
|
131
|
+
`tooltip-content--${attributes['tooltip-content']?.direction || 's'}`
|
|
132
|
+
],
|
|
133
|
+
inert: () => !state.active,
|
|
134
|
+
onclick: (e: Event) => {
|
|
135
|
+
let element = e.target as HTMLElement,
|
|
136
|
+
key = element.dataset?.key;
|
|
137
|
+
|
|
138
|
+
if (key === undefined) {
|
|
139
|
+
let parent;
|
|
140
|
+
|
|
141
|
+
while (parent = element.parentElement) {
|
|
142
|
+
key = parent.dataset?.key;
|
|
143
|
+
|
|
144
|
+
if (key !== undefined) {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
155
147
|
}
|
|
156
148
|
}
|
|
157
|
-
}
|
|
158
149
|
|
|
159
|
-
|
|
160
|
-
|
|
150
|
+
if (key === undefined) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
let previous = state.selected!;
|
|
155
|
+
|
|
156
|
+
set(state, false);
|
|
157
|
+
state.selected = key;
|
|
158
|
+
|
|
159
|
+
selected[key] = true;
|
|
160
|
+
selected[previous] = false;
|
|
161
|
+
},
|
|
162
|
+
onconnect: () => {
|
|
163
|
+
set(state, true);
|
|
164
|
+
},
|
|
165
|
+
style: [
|
|
166
|
+
...toArray(this?.attributes?.['tooltip-content']?.style),
|
|
167
|
+
...toArray(attributes['tooltip-content']?.style)
|
|
168
|
+
],
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
${keys.map((key) => {
|
|
172
|
+
let content = options[key];
|
|
173
|
+
|
|
174
|
+
if (content !== null && typeof content === 'object' && 'content' in content) {
|
|
175
|
+
content = content.content;
|
|
161
176
|
}
|
|
162
177
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
style: [
|
|
177
|
-
...toArray(this?.attributes?.['tooltip-content']?.style),
|
|
178
|
-
...toArray(attributes['tooltip-content']?.style)
|
|
179
|
-
],
|
|
180
|
-
},
|
|
181
|
-
keys.map((key) => {
|
|
182
|
-
let content = options[key];
|
|
183
|
-
|
|
184
|
-
if (content !== null && typeof content === 'object' && 'content' in content) {
|
|
185
|
-
content = content.content;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return html`
|
|
189
|
-
<div
|
|
190
|
-
class='link select-option ${() => selected[key] && '--active'}'
|
|
191
|
-
${this?.attributes?.option}
|
|
192
|
-
${option}
|
|
193
|
-
data-key='${key}'
|
|
194
|
-
>
|
|
195
|
-
${content}
|
|
196
|
-
</div>
|
|
197
|
-
`;
|
|
198
|
-
})
|
|
199
|
-
);
|
|
178
|
+
return html`
|
|
179
|
+
<div
|
|
180
|
+
class='link select-option ${() => selected[key] && '--active'}'
|
|
181
|
+
${this?.attributes?.option}
|
|
182
|
+
${option}
|
|
183
|
+
data-key='${key}'
|
|
184
|
+
>
|
|
185
|
+
${content}
|
|
186
|
+
</div>
|
|
187
|
+
`;
|
|
188
|
+
})}
|
|
189
|
+
</div>
|
|
190
|
+
`;
|
|
200
191
|
}}
|
|
201
192
|
</div>
|
|
202
193
|
`;
|
|
203
194
|
}
|
|
204
|
-
);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
export default select;
|
|
195
|
+
);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { component, html } from '@esportsplus/template';
|
|
2
2
|
import './scss/index.scss';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
export default
|
|
6
|
-
attributes
|
|
7
|
-
|
|
5
|
+
export default component(
|
|
6
|
+
function(this, attributes, content) {
|
|
7
|
+
return html`
|
|
8
|
+
<div class='sidebar --flex-column --scrollbar' ${this?.attributes} ${attributes}>
|
|
9
|
+
${content}
|
|
10
|
+
</div>
|
|
11
|
+
`;
|
|
8
12
|
}
|
|
9
|
-
|
|
13
|
+
);
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
@include lib.position(absolute, var(--margin-vertical) null var(--margin-vertical) null);
|
|
7
7
|
cursor: default;
|
|
8
8
|
height: calc(100% - (var(--margin-vertical) * 2));
|
|
9
|
-
overflow: hidden;
|
|
10
9
|
transition:
|
|
11
10
|
max-width var(--transition-duration) ease-in-out,
|
|
12
11
|
opacity var(--transition-duration) ease-in-out,
|