@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,14 +1,25 @@
|
|
|
1
|
+
import * as reactivity_u0 from '@esportsplus/reactivity';
|
|
1
2
|
import * as template_u0 from '@esportsplus/template';
|
|
2
3
|
import { component } from '@esportsplus/template';
|
|
3
|
-
import { omit } from '@esportsplus/utilities';
|
|
4
4
|
import './scss/index.scss';
|
|
5
5
|
const template_u2 = template_u0.template(`<div class='accordion' ><div class='accordion-content'>`);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
class ReactiveObject_04mlrpv0 extends reactivity_u0.ReactiveObject {
|
|
7
|
+
#active = this[reactivity_u0.SIGNAL](false);
|
|
8
|
+
constructor() {
|
|
9
|
+
super(null);
|
|
10
|
+
}
|
|
11
|
+
get active() {
|
|
12
|
+
return reactivity_u0.read(this.#active);
|
|
13
|
+
}
|
|
14
|
+
set active(_v0) {
|
|
15
|
+
reactivity_u0.write(this.#active, _v0);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default component(function ({ state = new ReactiveObject_04mlrpv0(), ...attributes }, content) {
|
|
9
19
|
return (() => {
|
|
10
20
|
let root_u1 = template_u2(), element_u3 = root_u1.firstChild, element_u4 = element_u3.firstElementChild;
|
|
11
|
-
template_u0.setProperties(element_u3,
|
|
21
|
+
template_u0.setProperties(element_u3, attributes);
|
|
22
|
+
template_u0.setList(element_u3, 'class', () => state.active && '--active');
|
|
12
23
|
template_u0.setProperty(element_u3, 'inert', () => !state.active);
|
|
13
24
|
template_u0.slot(element_u4, content, 1);
|
|
14
25
|
return root_u1;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@layer components {.accordion{grid-template-rows:1fr;transition:grid-template-rows .3s;display:grid}.accordion
|
|
1
|
+
@layer components {.accordion{grid-template-rows:1fr;transition:grid-template-rows .3s;display:grid}.accordion:not(.--active){grid-template-rows:0fr}.accordion-content{min-height:0;overflow:hidden}}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { type Attributes } from '@esportsplus/template';
|
|
2
|
+
import { CHECKBOX_INPUT } from './constants.js';
|
|
2
3
|
import './scss/index.scss';
|
|
3
4
|
type A = Attributes & {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
[CHECKBOX_INPUT]?: Attributes;
|
|
6
|
+
};
|
|
7
|
+
declare const factory: (type: 'checkbox' | 'radio' | 'switch') => ((this: {
|
|
8
|
+
attributes?: A;
|
|
9
|
+
} | void, { state, ...attributes }?: A & {
|
|
10
|
+
state?: {
|
|
11
|
+
error: string;
|
|
12
|
+
};
|
|
13
|
+
}) => DocumentFragment | Text) & {
|
|
14
|
+
readonly input: typeof CHECKBOX_INPUT;
|
|
15
|
+
};
|
|
16
|
+
declare const _default: ((this: {
|
|
17
|
+
attributes?: A;
|
|
18
|
+
} | void, { state, ...attributes }?: A & {
|
|
8
19
|
state?: {
|
|
9
20
|
error: string;
|
|
10
21
|
};
|
|
11
|
-
|
|
22
|
+
}) => DocumentFragment | Text) & {
|
|
23
|
+
readonly input: typeof CHECKBOX_INPUT;
|
|
12
24
|
};
|
|
13
|
-
declare const factory: (type: 'checkbox' | 'radio' | 'switch') => (this: {
|
|
14
|
-
attributes?: Exclude<A, 'state'>;
|
|
15
|
-
} | void, attributes?: A) => DocumentFragment | Text;
|
|
16
|
-
declare const _default: (this: {
|
|
17
|
-
attributes?: Exclude<A, 'state'>;
|
|
18
|
-
} | void, attributes?: A) => DocumentFragment | Text;
|
|
19
25
|
export default _default;
|
|
20
26
|
export { factory };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as template_u0 from '@esportsplus/template';
|
|
2
2
|
import * as reactivity_u0 from '@esportsplus/reactivity';
|
|
3
|
-
import { omit } from '@esportsplus/utilities';
|
|
4
3
|
import form from '../form/index.js';
|
|
5
4
|
import icon from '../icon/index.js';
|
|
5
|
+
import { CHECKBOX_INPUT } from './constants.js';
|
|
6
6
|
import check from './svg/check.svg';
|
|
7
7
|
import './scss/index.scss';
|
|
8
|
-
const template_u6 = template_u0.template(`<div class='checkbox ' ><input class='checkbox-tag' type=checkbox >`);
|
|
9
|
-
const template_ua = template_u0.template(`<div class='checkbox ' ><input class='checkbox-tag' type=radio >`);
|
|
10
|
-
const template_uh = template_u0.template(`<div class='checkbox ' ><input class='checkbox-tag' >`);
|
|
8
|
+
const template_u6 = template_u0.template(`<div class='checkbox ' ><input class='checkbox-tag' value='1' type=checkbox >`);
|
|
9
|
+
const template_ua = template_u0.template(`<div class='checkbox ' ><input class='checkbox-tag' value='1' type=radio >`);
|
|
10
|
+
const template_uh = template_u0.template(`<div class='checkbox ' ><input class='checkbox-tag' value='1' >`);
|
|
11
11
|
class ReactiveObject_0l38kpg0 extends reactivity_u0.ReactiveObject {
|
|
12
12
|
#error = this[reactivity_u0.SIGNAL]('');
|
|
13
13
|
constructor() {
|
|
@@ -20,66 +20,52 @@ class ReactiveObject_0l38kpg0 extends reactivity_u0.ReactiveObject {
|
|
|
20
20
|
reactivity_u0.write(this.#error, _v0);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
const OMIT = ['aria-label', 'checked', 'id', 'name', 'state', 'value'];
|
|
24
23
|
const factory = (type) => {
|
|
25
|
-
function template(attributes) {
|
|
26
|
-
let state = attributes?.state || new ReactiveObject_0l38kpg0();
|
|
24
|
+
function template({ state = new ReactiveObject_0l38kpg0(), ...attributes } = {}) {
|
|
27
25
|
return (type === "checkbox" ? (() => {
|
|
28
26
|
let root_u5 = template_u6(), element_u7 = root_u5.firstChild, element_u8 = element_u7.firstElementChild;
|
|
29
27
|
template_u0.setList(element_u7, 'class', (type === 'radio' || type === 'switch') && `checkbox--${type}`);
|
|
30
|
-
template_u0.setProperties(element_u7, this?.attributes
|
|
31
|
-
template_u0.setProperties(element_u7, attributes
|
|
32
|
-
template_u0.
|
|
33
|
-
template_u0.
|
|
34
|
-
template_u0.setProperty(element_u8, 'id', attributes?.id ?? this?.attributes?.id);
|
|
35
|
-
template_u0.setProperty(element_u8, 'name', attributes?.name ?? this?.attributes?.name);
|
|
28
|
+
template_u0.setProperties(element_u7, this?.attributes);
|
|
29
|
+
template_u0.setProperties(element_u7, attributes);
|
|
30
|
+
template_u0.setProperties(element_u8, this?.attributes?.[CHECKBOX_INPUT]);
|
|
31
|
+
template_u0.setProperties(element_u8, attributes[CHECKBOX_INPUT]);
|
|
36
32
|
template_u0.onrender(element_u8, form.input.onrender(state));
|
|
37
|
-
template_u0.setProperty(element_u8, 'value', attributes?.value ?? 1);
|
|
38
33
|
template_u0.slot(element_u7, type === 'checkbox' && icon({ 'aria-hidden': true, class: 'checkbox-check' }, check), 2);
|
|
39
34
|
return root_u5;
|
|
40
35
|
})() : type === "radio" ? (() => {
|
|
41
36
|
let root_u9 = template_ua(), element_ub = root_u9.firstChild, element_uc = element_ub.firstElementChild;
|
|
42
37
|
template_u0.setList(element_ub, 'class', (type === 'radio' || type === 'switch') && `checkbox--${type}`);
|
|
43
|
-
template_u0.setProperties(element_ub, this?.attributes
|
|
44
|
-
template_u0.setProperties(element_ub, attributes
|
|
45
|
-
template_u0.
|
|
46
|
-
template_u0.
|
|
47
|
-
template_u0.setProperty(element_uc, 'id', attributes?.id ?? this?.attributes?.id);
|
|
48
|
-
template_u0.setProperty(element_uc, 'name', attributes?.name ?? this?.attributes?.name);
|
|
38
|
+
template_u0.setProperties(element_ub, this?.attributes);
|
|
39
|
+
template_u0.setProperties(element_ub, attributes);
|
|
40
|
+
template_u0.setProperties(element_uc, this?.attributes?.[CHECKBOX_INPUT]);
|
|
41
|
+
template_u0.setProperties(element_uc, attributes[CHECKBOX_INPUT]);
|
|
49
42
|
template_u0.onrender(element_uc, form.input.onrender(state));
|
|
50
|
-
template_u0.setProperty(element_uc, 'value', attributes?.value ?? 1);
|
|
51
43
|
template_u0.slot(element_ub, type === 'checkbox' && icon({ 'aria-hidden': true, class: 'checkbox-check' }, check), 2);
|
|
52
44
|
return root_u9;
|
|
53
45
|
})() : type === "switch" ? (() => {
|
|
54
46
|
let root_ud = template_u6(), element_ue = root_ud.firstChild, element_uf = element_ue.firstElementChild;
|
|
55
47
|
template_u0.setList(element_ue, 'class', (type === 'radio' || type === 'switch') && `checkbox--${type}`);
|
|
56
|
-
template_u0.setProperties(element_ue, this?.attributes
|
|
57
|
-
template_u0.setProperties(element_ue, attributes
|
|
58
|
-
template_u0.
|
|
59
|
-
template_u0.
|
|
60
|
-
template_u0.setProperty(element_uf, 'id', attributes?.id ?? this?.attributes?.id);
|
|
61
|
-
template_u0.setProperty(element_uf, 'name', attributes?.name ?? this?.attributes?.name);
|
|
48
|
+
template_u0.setProperties(element_ue, this?.attributes);
|
|
49
|
+
template_u0.setProperties(element_ue, attributes);
|
|
50
|
+
template_u0.setProperties(element_uf, this?.attributes?.[CHECKBOX_INPUT]);
|
|
51
|
+
template_u0.setProperties(element_uf, attributes[CHECKBOX_INPUT]);
|
|
62
52
|
template_u0.onrender(element_uf, form.input.onrender(state));
|
|
63
|
-
template_u0.setProperty(element_uf, 'value', attributes?.value ?? 1);
|
|
64
53
|
template_u0.slot(element_ue, type === 'checkbox' && icon({ 'aria-hidden': true, class: 'checkbox-check' }, check), 2);
|
|
65
54
|
return root_ud;
|
|
66
55
|
})() : (() => {
|
|
67
56
|
let root_ug = template_uh(), element_ui = root_ug.firstChild, element_uj = element_ui.firstElementChild;
|
|
68
57
|
template_u0.setList(element_ui, 'class', (type === 'radio' || type === 'switch') && `checkbox--${type}`);
|
|
69
|
-
template_u0.setProperties(element_ui, this?.attributes
|
|
70
|
-
template_u0.setProperties(element_ui, attributes
|
|
71
|
-
template_u0.
|
|
72
|
-
template_u0.
|
|
73
|
-
template_u0.setProperty(element_uj, 'id', attributes?.id ?? this?.attributes?.id);
|
|
74
|
-
template_u0.setProperty(element_uj, 'name', attributes?.name ?? this?.attributes?.name);
|
|
58
|
+
template_u0.setProperties(element_ui, this?.attributes);
|
|
59
|
+
template_u0.setProperties(element_ui, attributes);
|
|
60
|
+
template_u0.setProperties(element_uj, this?.attributes?.[CHECKBOX_INPUT]);
|
|
61
|
+
template_u0.setProperties(element_uj, attributes[CHECKBOX_INPUT]);
|
|
75
62
|
template_u0.onrender(element_uj, form.input.onrender(state));
|
|
76
63
|
template_u0.setProperty(element_uj, 'type', type === 'radio' ? 'radio' : 'checkbox');
|
|
77
|
-
template_u0.setProperty(element_uj, 'value', attributes?.value ?? 1);
|
|
78
64
|
template_u0.slot(element_ui, type === 'checkbox' && icon({ 'aria-hidden': true, class: 'checkbox-check' }, check), 2);
|
|
79
65
|
return root_ug;
|
|
80
66
|
})());
|
|
81
67
|
}
|
|
82
|
-
return template;
|
|
68
|
+
return Object.assign(template, { input: CHECKBOX_INPUT });
|
|
83
69
|
};
|
|
84
70
|
export default factory('checkbox');
|
|
85
71
|
export { factory };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as template_u0 from '@esportsplus/template';
|
|
2
2
|
import { type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
3
|
type A = Attributes & {
|
|
4
|
-
onerror?: () => void;
|
|
5
4
|
timeout?: number;
|
|
6
5
|
value: string;
|
|
7
6
|
};
|
|
8
7
|
declare const _default: template_u0.Factory<A, (state: {
|
|
9
8
|
copied: boolean;
|
|
9
|
+
failed: boolean;
|
|
10
10
|
}) => Renderable<unknown>, Renderable<any>>;
|
|
11
11
|
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as template_u0 from '@esportsplus/template';
|
|
2
2
|
import { component } from '@esportsplus/template';
|
|
3
3
|
import * as reactivity_u0 from '@esportsplus/reactivity';
|
|
4
|
-
import { omit } from '@esportsplus/utilities';
|
|
5
4
|
import write from './write.js';
|
|
6
5
|
const template_ul = template_u0.template(`<button type='button' >`);
|
|
7
6
|
class ReactiveObject_0irbxmo0 extends reactivity_u0.ReactiveObject {
|
|
8
7
|
#copied = this[reactivity_u0.SIGNAL](false);
|
|
8
|
+
#failed = this[reactivity_u0.SIGNAL](false);
|
|
9
9
|
constructor() {
|
|
10
10
|
super(null);
|
|
11
11
|
}
|
|
@@ -15,13 +15,18 @@ class ReactiveObject_0irbxmo0 extends reactivity_u0.ReactiveObject {
|
|
|
15
15
|
set copied(_v0) {
|
|
16
16
|
reactivity_u0.write(this.#copied, _v0);
|
|
17
17
|
}
|
|
18
|
+
get failed() {
|
|
19
|
+
return reactivity_u0.read(this.#failed);
|
|
20
|
+
}
|
|
21
|
+
set failed(_v1) {
|
|
22
|
+
reactivity_u0.write(this.#failed, _v1);
|
|
23
|
+
}
|
|
18
24
|
}
|
|
19
|
-
|
|
20
|
-
export default component((attributes, content) => {
|
|
25
|
+
export default component(({ timeout = 3000, value, ...attributes }, content) => {
|
|
21
26
|
let state = new ReactiveObject_0irbxmo0(), timer, connected = true;
|
|
22
27
|
return (() => {
|
|
23
28
|
let root_uk = template_ul(), element_um = root_uk.firstChild;
|
|
24
|
-
template_u0.setProperties(element_um,
|
|
29
|
+
template_u0.setProperties(element_um, attributes);
|
|
25
30
|
template_u0.onconnect(element_um, () => { connected = true; });
|
|
26
31
|
template_u0.ondisconnect(element_um, () => {
|
|
27
32
|
connected = false;
|
|
@@ -31,17 +36,17 @@ export default component((attributes, content) => {
|
|
|
31
36
|
template_u0.delegate(element_um, 'click', async (event) => {
|
|
32
37
|
event.preventDefault();
|
|
33
38
|
event.stopPropagation();
|
|
34
|
-
let copied = await write(
|
|
39
|
+
let copied = await write(value);
|
|
35
40
|
if (!connected) {
|
|
36
41
|
return;
|
|
37
42
|
}
|
|
38
43
|
clearTimeout(timer);
|
|
39
44
|
state.copied = copied;
|
|
40
45
|
if (!copied) {
|
|
41
|
-
|
|
46
|
+
state.failed = true;
|
|
42
47
|
return;
|
|
43
48
|
}
|
|
44
|
-
timer = setTimeout(() => { state.copied = false; },
|
|
49
|
+
timer = setTimeout(() => { state.copied = false; }, timeout);
|
|
45
50
|
});
|
|
46
51
|
new template_u0.EffectSlot(element_um, () => content(state), 1);
|
|
47
52
|
return root_uk;
|