@esportsplus/ui 0.48.7 → 0.49.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 +4 -4
- package/build/components/accordion/index.d.ts +16 -16
- package/build/components/accordion/index.js +16 -15
- package/build/components/alert/index.d.ts +1 -1
- package/build/components/alert/index.js +50 -42
- package/build/components/back/index.d.ts +8 -9
- package/build/components/back/index.js +11 -10
- package/build/components/button/index.d.ts +21 -22
- package/build/components/button/index.js +24 -24
- package/build/components/checkbox/index.d.ts +1 -1
- package/build/components/checkbox/index.js +20 -18
- package/build/components/clipboard/index.d.ts +1120 -1120
- package/build/components/clipboard/onclick.d.ts +1 -1
- package/build/components/clipboard/onclick.js +17 -18
- package/build/components/counter/index.d.ts +1 -1
- package/build/components/counter/index.js +27 -34
- package/build/components/ellipsis/index.d.ts +1 -1
- package/build/components/ellipsis/index.js +8 -7
- package/build/components/form/action.d.ts +1 -1
- package/build/components/form/action.js +15 -12
- package/build/components/form/index.d.ts +3 -3
- package/build/components/form/input.d.ts +1 -1
- package/build/components/frame/index.d.ts +10 -10
- package/build/components/highlight/index.d.ts +16 -16
- package/build/components/highlight/index.js +14 -13
- package/build/components/icon/index.d.ts +10 -11
- package/build/components/icon/index.js +6 -9
- package/build/components/input/index.d.ts +1 -1
- package/build/components/input/index.js +17 -16
- package/build/components/loader/index.d.ts +16 -16
- package/build/components/loader/index.js +44 -37
- package/build/components/loading/index.d.ts +1 -1
- package/build/components/loading/index.js +9 -7
- package/build/components/overlay/index.d.ts +10 -10
- package/build/components/radio/index.d.ts +2 -2
- package/build/components/range/index.d.ts +1 -1
- package/build/components/range/index.js +21 -19
- package/build/components/scrollbar/index.d.ts +11 -12
- package/build/components/scrollbar/index.js +32 -19
- package/build/components/select/index.d.ts +1 -1
- package/build/components/select/index.js +88 -83
- package/build/components/sidebar/index.d.ts +10 -10
- package/build/components/site/index.d.ts +10 -10
- package/build/components/switch/index.d.ts +2 -2
- package/build/components/template/index.d.ts +1 -1
- package/build/components/textarea/index.d.ts +1 -1
- package/build/components/textarea/index.js +17 -16
- package/build/components/tooltip/index.d.ts +2295 -2295
- package/build/components/tooltip/menu.d.ts +11 -12
- package/build/components/tooltip/menu.js +33 -29
- package/build/components/tooltip/onclick.d.ts +1120 -1121
- package/build/components/tooltip/onclick.js +14 -12
- package/build/components/tooltip/onhover.d.ts +16 -16
- package/build/components/tooltip/onhover.js +16 -14
- package/build/components/typewriter/index.d.ts +10 -11
- package/build/components/typewriter/index.js +10 -12
- package/build/themes/dark/alert.d.ts +3 -3
- package/build/themes/dark/back.d.ts +11 -11
- package/build/themes/dark/input.d.ts +111 -111
- package/build/themes/dark/select.d.ts +1220 -1220
- package/build/themes/dark/textarea.d.ts +111 -111
- package/package.json +2 -2
- package/src/components/accordion/index.ts +1 -1
- package/src/components/alert/index.ts +1 -1
- package/src/components/back/index.ts +1 -1
- package/src/components/button/index.ts +1 -1
- package/src/components/checkbox/index.ts +1 -1
- package/src/components/clipboard/onclick.ts +1 -1
- package/src/components/counter/index.ts +1 -1
- package/src/components/ellipsis/index.ts +1 -1
- package/src/components/form/action.ts +1 -1
- package/src/components/form/input.ts +1 -1
- package/src/components/highlight/index.ts +1 -1
- package/src/components/icon/index.ts +1 -1
- package/src/components/input/index.ts +1 -1
- package/src/components/loader/index.ts +1 -1
- package/src/components/loading/index.ts +1 -1
- package/src/components/range/index.ts +1 -1
- package/src/components/scrollbar/index.ts +1 -1
- package/src/components/select/index.ts +1 -1
- package/src/components/template/index.ts +1 -1
- package/src/components/textarea/index.ts +1 -1
- package/src/components/tooltip/menu.ts +1 -1
- package/src/components/tooltip/onclick.ts +1 -1
- package/src/components/tooltip/onhover.ts +1 -1
- package/src/components/typewriter/index.ts +1 -1
- package/tsconfig.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ pnpm add @esportsplus/ui
|
|
|
10
10
|
|
|
11
11
|
## Dependencies
|
|
12
12
|
|
|
13
|
-
- `@esportsplus/
|
|
13
|
+
- `@esportsplus/frontend` - Tagged template literals with compile-time transforms and reactive state management
|
|
14
14
|
- `@esportsplus/action` - Response/error handling
|
|
15
15
|
- `@esportsplus/utilities` - Core utilities
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ pnpm add @esportsplus/ui
|
|
|
18
18
|
|
|
19
19
|
```typescript
|
|
20
20
|
import { button, form, input, select } from '@esportsplus/ui';
|
|
21
|
-
import { html } from '@esportsplus/
|
|
21
|
+
import { html } from '@esportsplus/frontend';
|
|
22
22
|
|
|
23
23
|
// Simple component
|
|
24
24
|
html`${button({}, 'Click Me')}`;
|
|
@@ -123,7 +123,7 @@ component({ class: 'custom' }, html`<span>Content</span>`)
|
|
|
123
123
|
Components can accept and return reactive state:
|
|
124
124
|
|
|
125
125
|
```typescript
|
|
126
|
-
import { reactive } from '@esportsplus/
|
|
126
|
+
import { reactive } from '@esportsplus/frontend';
|
|
127
127
|
|
|
128
128
|
let state = reactive({ active: false });
|
|
129
129
|
|
|
@@ -261,7 +261,7 @@ build/
|
|
|
261
261
|
Full type safety with zero `any` types:
|
|
262
262
|
|
|
263
263
|
```typescript
|
|
264
|
-
import type { Attributes } from '@esportsplus/
|
|
264
|
+
import type { Attributes } from '@esportsplus/frontend';
|
|
265
265
|
|
|
266
266
|
// Components are generic
|
|
267
267
|
template.factory<A extends Attributes, C>(fn);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Attributes } from '@esportsplus/frontend';
|
|
2
2
|
import './scss/index.scss';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(): ReturnType<(this: {
|
|
5
|
-
attributes?:
|
|
6
|
-
content?:
|
|
7
|
-
}, attributes: Readonly<
|
|
8
|
-
<T extends
|
|
9
|
-
attributes?:
|
|
10
|
-
content?:
|
|
11
|
-
}, attributes: Readonly<
|
|
12
|
-
<T extends
|
|
13
|
-
attributes?:
|
|
14
|
-
content?:
|
|
15
|
-
}, attributes: Readonly<
|
|
16
|
-
(attributes:
|
|
17
|
-
attributes?:
|
|
18
|
-
content?:
|
|
19
|
-
}, attributes: Readonly<
|
|
5
|
+
attributes?: Attributes | undefined;
|
|
6
|
+
content?: import("@esportsplus/frontend").Renderable<any>;
|
|
7
|
+
}, attributes: Readonly<Attributes>, content: import("@esportsplus/frontend").Renderable<any>) => import("@esportsplus/frontend").Renderable<any>>;
|
|
8
|
+
<T extends Attributes>(attributes: T): ReturnType<(this: {
|
|
9
|
+
attributes?: Attributes | undefined;
|
|
10
|
+
content?: import("@esportsplus/frontend").Renderable<any>;
|
|
11
|
+
}, attributes: Readonly<Attributes>, content: import("@esportsplus/frontend").Renderable<any>) => import("@esportsplus/frontend").Renderable<any>>;
|
|
12
|
+
<T extends import("@esportsplus/frontend").Renderable<any>>(content: T): ReturnType<(this: {
|
|
13
|
+
attributes?: Attributes | undefined;
|
|
14
|
+
content?: import("@esportsplus/frontend").Renderable<any>;
|
|
15
|
+
}, attributes: Readonly<Attributes>, content: import("@esportsplus/frontend").Renderable<any>) => import("@esportsplus/frontend").Renderable<any>>;
|
|
16
|
+
(attributes: Attributes, content: import("@esportsplus/frontend").Renderable<any>): ReturnType<(this: {
|
|
17
|
+
attributes?: Attributes | undefined;
|
|
18
|
+
content?: import("@esportsplus/frontend").Renderable<any>;
|
|
19
|
+
}, attributes: Readonly<Attributes>, content: import("@esportsplus/frontend").Renderable<any>) => import("@esportsplus/frontend").Renderable<any>>;
|
|
20
20
|
};
|
|
21
21
|
export default _default;
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { reactive } from '@esportsplus/template';
|
|
1
|
+
import { html, reactive } from '@esportsplus/frontend';
|
|
3
2
|
import { omit } from '@esportsplus/utilities';
|
|
4
3
|
import template from '../../components/template/index.js';
|
|
5
4
|
import './scss/index.scss';
|
|
6
|
-
const template_69d8ea42df6d40bfb4950d47c33fd3633 = template_69d8ea42df6d40bfb4950d47c33fd3631.template(`<div><!--$--></div>`);
|
|
7
5
|
const OMIT = ['state'];
|
|
8
6
|
let key = Symbol();
|
|
9
7
|
export default template.factory(function (attributes, content) {
|
|
10
8
|
let ref, state = attributes.state || reactive({
|
|
11
9
|
active: 0
|
|
12
10
|
});
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
return html `
|
|
12
|
+
<div
|
|
13
|
+
${omit(attributes, OMIT)}
|
|
14
|
+
${{
|
|
15
|
+
class: () => {
|
|
17
16
|
return state.active && '--active';
|
|
18
|
-
},
|
|
19
|
-
|
|
17
|
+
},
|
|
18
|
+
onrender: (element) => {
|
|
20
19
|
(ref = element)[key] = state;
|
|
21
|
-
}
|
|
22
|
-
|
|
20
|
+
},
|
|
21
|
+
style: () => {
|
|
23
22
|
let parent = ref.closest('accordion');
|
|
24
23
|
if (parent && key in parent) {
|
|
25
24
|
parent[key].active = (+parent[key].active) + 1;
|
|
26
25
|
}
|
|
27
26
|
return state.active && `--max-height: ${ref.scrollHeight}`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
}
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
${content}
|
|
31
|
+
</div>
|
|
32
|
+
`;
|
|
32
33
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@esportsplus/vite/global.d.ts';
|
|
2
2
|
import { Response } from '@esportsplus/action';
|
|
3
|
-
import { Attributes, Renderable } from '@esportsplus/
|
|
3
|
+
import { Attributes, Renderable } from '@esportsplus/frontend';
|
|
4
4
|
import './scss/index.scss';
|
|
5
5
|
declare const _default: (attributes: Attributes & {
|
|
6
6
|
"alert-close"?: Attributes;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import '@esportsplus/vite/global.d.ts';
|
|
2
|
-
import
|
|
3
|
-
import { reactive, svg } from '@esportsplus/template';
|
|
2
|
+
import { html, reactive, svg } from '@esportsplus/frontend';
|
|
4
3
|
import { omit } from '@esportsplus/utilities';
|
|
5
4
|
import { icon } from '@esportsplus/ui';
|
|
6
5
|
import check from './svg/check.svg';
|
|
7
6
|
import close from './svg/close.svg';
|
|
8
7
|
import e from './svg/error.svg';
|
|
9
8
|
import './scss/index.scss';
|
|
10
|
-
const template_69d8ea42df6d40bfb4950d47c33fd3638 = template_69d8ea42df6d40bfb4950d47c33fd3631.template(`<div class='--flex-vertical'><!--$--></div>`);
|
|
11
|
-
const template_69d8ea42df6d40bfb4950d47c33fd363d = template_69d8ea42df6d40bfb4950d47c33fd3631.template(`<p><!--$--></p>`);
|
|
12
|
-
const template_69d8ea42df6d40bfb4950d47c33fd363i = template_69d8ea42df6d40bfb4950d47c33fd3631.template(`<div class='--flex-start'><!--$--></div>`);
|
|
13
|
-
const template_69d8ea42df6d40bfb4950d47c33fd363l = template_69d8ea42df6d40bfb4950d47c33fd3631.template(`<div class='alert anchor anchor--n --flex-row'><!--$--><div class='alert-messages --flex-column --flex-fill'><!--$--></div><div class="--flex-vertical"><div class='alert-close button --padding-300'><div class="icon" style='--size: 14px;'><!--$--></div></div></div></div>`);
|
|
14
9
|
const OMIT = ['alert-close', 'alert-messages', 'alert-message'];
|
|
15
10
|
let modifiers = {
|
|
16
11
|
error: 'red',
|
|
@@ -76,43 +71,56 @@ export default (attributes) => {
|
|
|
76
71
|
}), 5);
|
|
77
72
|
};
|
|
78
73
|
return {
|
|
79
|
-
content:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
content: html `
|
|
75
|
+
<div
|
|
76
|
+
class='alert anchor anchor--n ${() => state.active && '--active'} --flex-row'
|
|
77
|
+
${omit(attributes, OMIT)}
|
|
78
|
+
>
|
|
79
|
+
${() => {
|
|
80
|
+
let type = state.type;
|
|
81
|
+
return html `
|
|
82
|
+
<div class='--flex-vertical' style='${`--color: var(--color-${modifiers[type]}-400);`}'>
|
|
83
|
+
${icon({ class: '--size-500' }, type === 'error' ? e : check)}
|
|
84
|
+
</div>
|
|
85
|
+
`;
|
|
86
|
+
}}
|
|
87
|
+
|
|
88
|
+
<div
|
|
89
|
+
class='alert-messages --flex-column --flex-fill'
|
|
90
|
+
${attributes['alert-messages']}
|
|
91
|
+
>
|
|
92
|
+
${() => {
|
|
93
|
+
let message = attributes['alert-message'];
|
|
94
|
+
return state.rerender && [...state.messages].map((content) => {
|
|
95
|
+
if (typeof content === 'string') {
|
|
96
|
+
return html `
|
|
97
|
+
<p ${message}>
|
|
98
|
+
${content}
|
|
99
|
+
</p>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
return html `
|
|
103
|
+
<div class='--flex-start'>
|
|
104
|
+
${content}
|
|
105
|
+
</div>
|
|
106
|
+
`;
|
|
91
107
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
})();
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
template_69d8ea42df6d40bfb4950d47c33fd3631.delegate(element_69d8ea42df6d40bfb4950d47c33fd363q, 'click', () => deactivate(state));
|
|
112
|
-
template_69d8ea42df6d40bfb4950d47c33fd3631.setProperties(element_69d8ea42df6d40bfb4950d47c33fd363q, attributes['alert-close'], attributes_69d8ea42df6d40bfb4950d47c33fd363u);
|
|
113
|
-
template_69d8ea42df6d40bfb4950d47c33fd3631.slot(element_69d8ea42df6d40bfb4950d47c33fd363r, svg.sprite(close));
|
|
114
|
-
return root_69d8ea42df6d40bfb4950d47c33fd363k;
|
|
115
|
-
})(),
|
|
108
|
+
}}
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="--flex-vertical">
|
|
112
|
+
<div
|
|
113
|
+
class='alert-close button --padding-300'
|
|
114
|
+
onclick='${() => deactivate(state)}'
|
|
115
|
+
${attributes['alert-close']}
|
|
116
|
+
>
|
|
117
|
+
<div class="icon" style='--size: 14px;'>
|
|
118
|
+
${svg.sprite(close)}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
`,
|
|
116
124
|
deactivate: () => deactivate(state),
|
|
117
125
|
error,
|
|
118
126
|
info: (messages, seconds = 0) => activate('info', messages, seconds, state),
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Attributes } from '@esportsplus/template';
|
|
1
|
+
import { Attributes } from '@esportsplus/frontend';
|
|
3
2
|
import './scss/index.scss';
|
|
4
3
|
declare const _default: {
|
|
5
4
|
(): ReturnType<(this: {
|
|
6
5
|
attributes?: Attributes;
|
|
7
|
-
}, attributes: Readonly<
|
|
8
|
-
<T extends
|
|
6
|
+
}, attributes: Readonly<Attributes>, content: import("@esportsplus/frontend").Renderable<any>) => import("@esportsplus/frontend").Renderable<any>>;
|
|
7
|
+
<T extends Attributes>(attributes: T): ReturnType<(this: {
|
|
9
8
|
attributes?: Attributes;
|
|
10
|
-
}, attributes: Readonly<
|
|
11
|
-
<T extends
|
|
9
|
+
}, attributes: Readonly<Attributes>, content: import("@esportsplus/frontend").Renderable<any>) => import("@esportsplus/frontend").Renderable<any>>;
|
|
10
|
+
<T extends import("@esportsplus/frontend").Renderable<any>>(content: T): ReturnType<(this: {
|
|
12
11
|
attributes?: Attributes;
|
|
13
|
-
}, attributes: Readonly<
|
|
14
|
-
(attributes:
|
|
12
|
+
}, attributes: Readonly<Attributes>, content: import("@esportsplus/frontend").Renderable<any>) => import("@esportsplus/frontend").Renderable<any>>;
|
|
13
|
+
(attributes: Attributes, content: import("@esportsplus/frontend").Renderable<any>): ReturnType<(this: {
|
|
15
14
|
attributes?: Attributes;
|
|
16
|
-
}, attributes: Readonly<
|
|
15
|
+
}, attributes: Readonly<Attributes>, content: import("@esportsplus/frontend").Renderable<any>) => import("@esportsplus/frontend").Renderable<any>>;
|
|
17
16
|
};
|
|
18
17
|
export default _default;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { html } from '@esportsplus/frontend';
|
|
2
2
|
import icon from '../../components/icon/index.js';
|
|
3
3
|
import template from '../../components/template/index.js';
|
|
4
4
|
import arrow from './svg/arrow.svg';
|
|
5
5
|
import './scss/index.scss';
|
|
6
|
-
const template_69d8ea42df6d40bfb4950d47c33fd363w = template_69d8ea42df6d40bfb4950d47c33fd3631.template(`<a class='back link --padding-0px --flex-vertical'><!--$--><!--$--></a>`);
|
|
7
6
|
export default template.factory(function (attributes, content) {
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
return html `
|
|
8
|
+
<a
|
|
9
|
+
class='back link --padding-0px --flex-vertical'
|
|
10
|
+
${this.attributes}
|
|
11
|
+
${attributes}
|
|
12
|
+
>
|
|
13
|
+
${icon({ class: 'back-arrow --margin-right --margin-200' }, arrow)}
|
|
14
|
+
${content}
|
|
15
|
+
</a>
|
|
16
|
+
`;
|
|
16
17
|
});
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Renderable } from '@esportsplus/template';
|
|
1
|
+
import { type Renderable } from '@esportsplus/frontend';
|
|
3
2
|
import './scss/index.scss';
|
|
4
3
|
declare const hold: {
|
|
5
4
|
(): ReturnType<(this: {
|
|
6
|
-
attributes?:
|
|
5
|
+
attributes?: import("@esportsplus/frontend").Attributes | undefined;
|
|
7
6
|
content?: ((state: {
|
|
8
7
|
holding: boolean;
|
|
9
8
|
complete: boolean;
|
|
10
9
|
}) => Renderable<any>) | undefined;
|
|
11
|
-
}, attributes: Readonly<
|
|
10
|
+
}, attributes: Readonly<import("@esportsplus/frontend").Attributes>, content: (state: {
|
|
12
11
|
holding: boolean;
|
|
13
12
|
complete: boolean;
|
|
14
13
|
}) => Renderable<any>) => Renderable<any>>;
|
|
15
|
-
<T extends
|
|
16
|
-
attributes?:
|
|
14
|
+
<T extends import("@esportsplus/frontend").Attributes>(attributes: T): ReturnType<(this: {
|
|
15
|
+
attributes?: import("@esportsplus/frontend").Attributes | undefined;
|
|
17
16
|
content?: ((state: {
|
|
18
17
|
holding: boolean;
|
|
19
18
|
complete: boolean;
|
|
20
19
|
}) => Renderable<any>) | undefined;
|
|
21
|
-
}, attributes: Readonly<
|
|
20
|
+
}, attributes: Readonly<import("@esportsplus/frontend").Attributes>, content: (state: {
|
|
22
21
|
holding: boolean;
|
|
23
22
|
complete: boolean;
|
|
24
23
|
}) => Renderable<any>) => Renderable<any>>;
|
|
@@ -26,25 +25,25 @@ declare const hold: {
|
|
|
26
25
|
holding: boolean;
|
|
27
26
|
complete: boolean;
|
|
28
27
|
}) => Renderable<any>>(content: T): ReturnType<(this: {
|
|
29
|
-
attributes?:
|
|
28
|
+
attributes?: import("@esportsplus/frontend").Attributes | undefined;
|
|
30
29
|
content?: ((state: {
|
|
31
30
|
holding: boolean;
|
|
32
31
|
complete: boolean;
|
|
33
32
|
}) => Renderable<any>) | undefined;
|
|
34
|
-
}, attributes: Readonly<
|
|
33
|
+
}, attributes: Readonly<import("@esportsplus/frontend").Attributes>, content: (state: {
|
|
35
34
|
holding: boolean;
|
|
36
35
|
complete: boolean;
|
|
37
36
|
}) => Renderable<any>) => Renderable<any>>;
|
|
38
|
-
(attributes:
|
|
37
|
+
(attributes: import("@esportsplus/frontend").Attributes, content: (state: {
|
|
39
38
|
holding: boolean;
|
|
40
39
|
complete: boolean;
|
|
41
40
|
}) => Renderable<any>): ReturnType<(this: {
|
|
42
|
-
attributes?:
|
|
41
|
+
attributes?: import("@esportsplus/frontend").Attributes | undefined;
|
|
43
42
|
content?: ((state: {
|
|
44
43
|
holding: boolean;
|
|
45
44
|
complete: boolean;
|
|
46
45
|
}) => Renderable<any>) | undefined;
|
|
47
|
-
}, attributes: Readonly<
|
|
46
|
+
}, attributes: Readonly<import("@esportsplus/frontend").Attributes>, content: (state: {
|
|
48
47
|
holding: boolean;
|
|
49
48
|
complete: boolean;
|
|
50
49
|
}) => Renderable<any>) => Renderable<any>>;
|
|
@@ -52,22 +51,22 @@ declare const hold: {
|
|
|
52
51
|
declare const _default: {
|
|
53
52
|
hold: {
|
|
54
53
|
(): ReturnType<(this: {
|
|
55
|
-
attributes?:
|
|
54
|
+
attributes?: import("@esportsplus/frontend").Attributes | undefined;
|
|
56
55
|
content?: ((state: {
|
|
57
56
|
holding: boolean;
|
|
58
57
|
complete: boolean;
|
|
59
58
|
}) => Renderable<any>) | undefined;
|
|
60
|
-
}, attributes: Readonly<
|
|
59
|
+
}, attributes: Readonly<import("@esportsplus/frontend").Attributes>, content: (state: {
|
|
61
60
|
holding: boolean;
|
|
62
61
|
complete: boolean;
|
|
63
62
|
}) => Renderable<any>) => Renderable<any>>;
|
|
64
|
-
<T extends
|
|
65
|
-
attributes?:
|
|
63
|
+
<T extends import("@esportsplus/frontend").Attributes>(attributes: T): ReturnType<(this: {
|
|
64
|
+
attributes?: import("@esportsplus/frontend").Attributes | undefined;
|
|
66
65
|
content?: ((state: {
|
|
67
66
|
holding: boolean;
|
|
68
67
|
complete: boolean;
|
|
69
68
|
}) => Renderable<any>) | undefined;
|
|
70
|
-
}, attributes: Readonly<
|
|
69
|
+
}, attributes: Readonly<import("@esportsplus/frontend").Attributes>, content: (state: {
|
|
71
70
|
holding: boolean;
|
|
72
71
|
complete: boolean;
|
|
73
72
|
}) => Renderable<any>) => Renderable<any>>;
|
|
@@ -75,25 +74,25 @@ declare const _default: {
|
|
|
75
74
|
holding: boolean;
|
|
76
75
|
complete: boolean;
|
|
77
76
|
}) => Renderable<any>>(content: T): ReturnType<(this: {
|
|
78
|
-
attributes?:
|
|
77
|
+
attributes?: import("@esportsplus/frontend").Attributes | undefined;
|
|
79
78
|
content?: ((state: {
|
|
80
79
|
holding: boolean;
|
|
81
80
|
complete: boolean;
|
|
82
81
|
}) => Renderable<any>) | undefined;
|
|
83
|
-
}, attributes: Readonly<
|
|
82
|
+
}, attributes: Readonly<import("@esportsplus/frontend").Attributes>, content: (state: {
|
|
84
83
|
holding: boolean;
|
|
85
84
|
complete: boolean;
|
|
86
85
|
}) => Renderable<any>) => Renderable<any>>;
|
|
87
|
-
(attributes:
|
|
86
|
+
(attributes: import("@esportsplus/frontend").Attributes, content: (state: {
|
|
88
87
|
holding: boolean;
|
|
89
88
|
complete: boolean;
|
|
90
89
|
}) => Renderable<any>): ReturnType<(this: {
|
|
91
|
-
attributes?:
|
|
90
|
+
attributes?: import("@esportsplus/frontend").Attributes | undefined;
|
|
92
91
|
content?: ((state: {
|
|
93
92
|
holding: boolean;
|
|
94
93
|
complete: boolean;
|
|
95
94
|
}) => Renderable<any>) | undefined;
|
|
96
|
-
}, attributes: Readonly<
|
|
95
|
+
}, attributes: Readonly<import("@esportsplus/frontend").Attributes>, content: (state: {
|
|
97
96
|
holding: boolean;
|
|
98
97
|
complete: boolean;
|
|
99
98
|
}) => Renderable<any>) => Renderable<any>>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { reactive } from '@esportsplus/template';
|
|
1
|
+
import { html, reactive } from '@esportsplus/frontend';
|
|
3
2
|
import template from '../template/index.js';
|
|
4
3
|
import './scss/index.scss';
|
|
5
|
-
const template_69d8ea42df6d40bfb4950d47c33fd36312 = template_69d8ea42df6d40bfb4950d47c33fd3631.template(`<div class='button '><!--$--></div>`);
|
|
6
4
|
const hold = template.factory(function (attributes, content) {
|
|
7
5
|
let end = () => {
|
|
8
6
|
if (!state.complete) {
|
|
@@ -12,34 +10,36 @@ const hold = template.factory(function (attributes, content) {
|
|
|
12
10
|
complete: false,
|
|
13
11
|
holding: false
|
|
14
12
|
});
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
return html `
|
|
14
|
+
<div
|
|
15
|
+
class='button ${() => state.holding && 'button--holding'} ${() => state.complete && '--active'}'
|
|
16
|
+
onmousedown='${(e) => {
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
state.holding = true;
|
|
19
|
+
}}'
|
|
20
|
+
${attributes}
|
|
21
|
+
${{
|
|
22
|
+
onanimationend: (e) => {
|
|
25
23
|
if (e.animationName === 'buttonHolding') {
|
|
26
24
|
state.complete = true;
|
|
27
25
|
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
},
|
|
27
|
+
onclick: () => { },
|
|
28
|
+
onmousedown: (e) => {
|
|
31
29
|
e.preventDefault();
|
|
32
30
|
state.holding = true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
},
|
|
32
|
+
onmouseup: end,
|
|
33
|
+
ontouchend: end,
|
|
34
|
+
ontouchstart: (e) => {
|
|
37
35
|
e.preventDefault();
|
|
38
36
|
state.holding = true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
}
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
${() => content(state)}
|
|
41
|
+
</div>
|
|
42
|
+
`;
|
|
43
43
|
});
|
|
44
44
|
export default { hold };
|
|
45
45
|
export { hold };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { reactive, root } from '@esportsplus/template';
|
|
1
|
+
import { html, reactive, root } from '@esportsplus/frontend';
|
|
3
2
|
import { omit } from '@esportsplus/utilities';
|
|
4
3
|
import form from '../../components/form/index.js';
|
|
5
4
|
import './scss/index.scss';
|
|
6
|
-
const template_69d8ea42df6d40bfb4950d47c33fd36317 = template_69d8ea42df6d40bfb4950d47c33fd3631.template(`<div><input></div>`);
|
|
7
5
|
const OMIT = ['checked', 'value'];
|
|
8
6
|
const factory = (type) => {
|
|
9
7
|
function template(attributes) {
|
|
@@ -14,22 +12,26 @@ const factory = (type) => {
|
|
|
14
12
|
if (attributes?.checked) {
|
|
15
13
|
state.active = true;
|
|
16
14
|
}
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
return html `
|
|
16
|
+
<div
|
|
17
|
+
class='${type} ${() => state.active && '--active'}'
|
|
18
|
+
${this?.attributes && omit(this.attributes, OMIT)}
|
|
19
|
+
${attributes && omit(attributes, OMIT)}
|
|
20
|
+
>
|
|
21
|
+
<input
|
|
22
|
+
${{
|
|
23
|
+
checked: attributes?.checked || root(() => state.active),
|
|
24
|
+
class: `${type}-tag`,
|
|
25
|
+
onchange: (e) => {
|
|
26
26
|
state.active = e.target.checked;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
},
|
|
28
|
+
onrender: form.input.onrender(state),
|
|
29
|
+
type: type === 'radio' ? 'radio' : 'checkbox',
|
|
30
|
+
value: attributes?.value || 1
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
</div>
|
|
34
|
+
`;
|
|
33
35
|
}
|
|
34
36
|
return template;
|
|
35
37
|
};
|