@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
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const SELECT_ARROW = Symbol.for('@esportsplus/ui/select.arrow');
|
|
2
|
+
const SELECT_OPTION = Symbol.for('@esportsplus/ui/select.option');
|
|
3
|
+
const SELECT_TOOLTIP_CONTENT = Symbol.for('@esportsplus/ui/select.tooltip-content');
|
|
4
|
+
export { SELECT_ARROW, SELECT_OPTION, SELECT_TOOLTIP_CONTENT };
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import * as template_u0 from '@esportsplus/template';
|
|
2
2
|
import { type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
|
+
import { SELECT_ARROW, SELECT_OPTION, SELECT_TOOLTIP_CONTENT } from './constants.js';
|
|
3
4
|
import './scss/index.scss';
|
|
4
5
|
type A = {
|
|
5
|
-
|
|
6
|
+
[SELECT_ARROW]?: Attributes;
|
|
7
|
+
[SELECT_OPTION]?: Attributes;
|
|
8
|
+
[SELECT_TOOLTIP_CONTENT]?: Attributes & {
|
|
9
|
+
direction?: string;
|
|
10
|
+
};
|
|
6
11
|
options: Record<number | string, Renderable<unknown> | {
|
|
7
12
|
content: Renderable<unknown>;
|
|
8
13
|
selected: Renderable<unknown>;
|
|
9
14
|
}>;
|
|
10
|
-
option?: Attributes;
|
|
11
|
-
'tooltip-content'?: Attributes & {
|
|
12
|
-
direction?: string;
|
|
13
|
-
};
|
|
14
15
|
} & ({
|
|
15
16
|
selected?: number | string;
|
|
16
17
|
state?: never;
|
|
17
18
|
} | {
|
|
19
|
+
selected?: never;
|
|
18
20
|
state: {
|
|
19
21
|
active: boolean;
|
|
20
22
|
error: string;
|
|
@@ -25,5 +27,9 @@ type A = {
|
|
|
25
27
|
declare const _default: template_u0.Factory<A, (state: {
|
|
26
28
|
active: boolean;
|
|
27
29
|
selected?: string | number;
|
|
28
|
-
}) => Renderable<unknown>, Renderable<any
|
|
30
|
+
}) => Renderable<unknown>, Renderable<any>> & {
|
|
31
|
+
readonly arrow: typeof SELECT_ARROW;
|
|
32
|
+
readonly option: typeof SELECT_OPTION;
|
|
33
|
+
readonly tooltipContent: typeof SELECT_TOOLTIP_CONTENT;
|
|
34
|
+
};
|
|
29
35
|
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 { EMPTY_ARRAY, omit, toArray } from '@esportsplus/utilities';
|
|
5
4
|
import form from '../form/index.js';
|
|
5
|
+
import { SELECT_ARROW, SELECT_OPTION, SELECT_TOOLTIP_CONTENT } from './constants.js';
|
|
6
6
|
import './scss/index.scss';
|
|
7
7
|
const template_u1n = template_u0.template(`<div class='link select-option ' >`);
|
|
8
|
-
const template_u1q = template_u0.template(`<div class='tooltip-content
|
|
8
|
+
const template_u1q = template_u0.template(`<div class='tooltip-content --flex-column --scrollbar' >`);
|
|
9
9
|
const template_u1t = template_u0.template(`<div class='select tooltip ' ><!--$--><div class='select-arrow' ></div><input class='select-tag' />`);
|
|
10
10
|
class ReactiveObject_167mg1f0 extends reactivity_u0.ReactiveObject {
|
|
11
11
|
#active = this[reactivity_u0.SIGNAL](false);
|
|
@@ -41,34 +41,27 @@ class ReactiveObject_167mg1f0 extends reactivity_u0.ReactiveObject {
|
|
|
41
41
|
reactivity_u0.write(this.#selected, _v3);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
'
|
|
46
|
-
'options',
|
|
47
|
-
'option',
|
|
48
|
-
'tooltip-content',
|
|
49
|
-
];
|
|
50
|
-
export default component(function (attributes, content) {
|
|
51
|
-
let element, { options, option } = attributes, state = attributes.state || new ReactiveObject_167mg1f0(attributes.selected || Object.keys(options)[0]);
|
|
44
|
+
export default Object.assign(component(function ({ options, selected, state = new ReactiveObject_167mg1f0(selected || Object.keys(options)[0]), ...attributes }, content) {
|
|
45
|
+
let { direction: defaultDirection, ...defaultTooltipContent } = this?.attributes?.[SELECT_TOOLTIP_CONTENT] ?? {}, { direction = defaultDirection || 's', ...tooltipContent } = attributes[SELECT_TOOLTIP_CONTENT] ?? {};
|
|
52
46
|
return (() => {
|
|
53
47
|
let root_u1s = template_u1t(), element_u1u = root_u1s.firstChild, element_u1v = element_u1u.firstChild, element_u1w = element_u1u.firstElementChild, element_u1x = element_u1w.nextElementSibling;
|
|
54
48
|
template_u0.setList(element_u1u, 'class', () => state.active && '--active');
|
|
55
|
-
template_u0.setProperties(element_u1u, this?.attributes
|
|
56
|
-
template_u0.setProperties(element_u1u,
|
|
57
|
-
template_u0.onrender(element_u1u, (node) => element = node);
|
|
58
|
-
template_u0.ondocument(element_u1u, 'click', (event) => {
|
|
59
|
-
if (!state.active || !element?.isConnected) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (!element.contains(event.target)) {
|
|
63
|
-
state.active = false;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
49
|
+
template_u0.setProperties(element_u1u, this?.attributes);
|
|
50
|
+
template_u0.setProperties(element_u1u, attributes);
|
|
66
51
|
template_u0.delegate(element_u1u, 'click', () => {
|
|
67
52
|
if (state.render) {
|
|
68
53
|
state.active = !state.active;
|
|
69
54
|
}
|
|
70
55
|
state.render = true;
|
|
71
56
|
});
|
|
57
|
+
template_u0.ondocument(element_u1u, 'click', function (event) {
|
|
58
|
+
if (!state.active || !this?.isConnected) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!this.contains(event.target)) {
|
|
62
|
+
state.active = false;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
72
65
|
new template_u0.EffectSlot(element_u1v, content ? (() => content(state)) : (() => {
|
|
73
66
|
let selected = options[state.selected];
|
|
74
67
|
if (!selected) {
|
|
@@ -79,8 +72,8 @@ export default component(function (attributes, content) {
|
|
|
79
72
|
}
|
|
80
73
|
return selected;
|
|
81
74
|
}));
|
|
82
|
-
template_u0.setProperties(element_u1w, this?.attributes?.
|
|
83
|
-
template_u0.setProperties(element_u1w, attributes
|
|
75
|
+
template_u0.setProperties(element_u1w, this?.attributes?.[SELECT_ARROW]);
|
|
76
|
+
template_u0.setProperties(element_u1w, attributes[SELECT_ARROW]);
|
|
84
77
|
template_u0.setProperty(element_u1x, 'name', attributes.name);
|
|
85
78
|
template_u0.delegate(element_u1x, 'click', () => { });
|
|
86
79
|
template_u0.onrender(element_u1x, form.input.onrender(state));
|
|
@@ -92,42 +85,32 @@ export default component(function (attributes, content) {
|
|
|
92
85
|
let keys = Object.keys(options), selected = reactivity_u0.reactive(Object.fromEntries(keys.map(key => [key, false])));
|
|
93
86
|
return (() => {
|
|
94
87
|
let root_u1p = template_u1q(), element_u1r = root_u1p.firstChild;
|
|
95
|
-
template_u0.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
let parent;
|
|
108
|
-
while (parent = element.parentElement) {
|
|
109
|
-
key = parent.dataset?.key;
|
|
110
|
-
if (key !== undefined) {
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
88
|
+
template_u0.setList(element_u1r, 'class', template_u0.interpolate(["tooltip-content--", (direction)]));
|
|
89
|
+
template_u0.setProperties(element_u1r, defaultTooltipContent);
|
|
90
|
+
template_u0.setProperties(element_u1r, tooltipContent);
|
|
91
|
+
template_u0.setProperty(element_u1r, 'inert', () => !state.active);
|
|
92
|
+
template_u0.delegate(element_u1r, 'click', (e) => {
|
|
93
|
+
let element = e.target, key = element.dataset?.key;
|
|
94
|
+
if (key === undefined) {
|
|
95
|
+
let parent;
|
|
96
|
+
while (parent = element.parentElement) {
|
|
97
|
+
key = parent.dataset?.key;
|
|
98
|
+
if (key !== undefined) {
|
|
99
|
+
break;
|
|
113
100
|
}
|
|
114
101
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
style: [
|
|
128
|
-
...toArray(this?.attributes?.['tooltip-content']?.style),
|
|
129
|
-
...toArray(attributes['tooltip-content']?.style)
|
|
130
|
-
],
|
|
102
|
+
}
|
|
103
|
+
if (key === undefined) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
let previous = state.selected;
|
|
107
|
+
state.active = false;
|
|
108
|
+
state.selected = key;
|
|
109
|
+
selected[key] = true;
|
|
110
|
+
selected[previous] = false;
|
|
111
|
+
});
|
|
112
|
+
template_u0.onconnect(element_u1r, () => {
|
|
113
|
+
state.active = true;
|
|
131
114
|
});
|
|
132
115
|
template_u0.slot(element_u1r, keys.map((key) => {
|
|
133
116
|
let content = options[key];
|
|
@@ -137,8 +120,8 @@ export default component(function (attributes, content) {
|
|
|
137
120
|
return (() => {
|
|
138
121
|
let root_u1m = template_u1n(), element_u1o = root_u1m.firstChild;
|
|
139
122
|
template_u0.setList(element_u1o, 'class', () => selected[key] && '--active');
|
|
140
|
-
template_u0.setProperties(element_u1o, this?.attributes?.
|
|
141
|
-
template_u0.setProperties(element_u1o,
|
|
123
|
+
template_u0.setProperties(element_u1o, this?.attributes?.[SELECT_OPTION]);
|
|
124
|
+
template_u0.setProperties(element_u1o, attributes[SELECT_OPTION]);
|
|
142
125
|
template_u0.setProperty(element_u1o, 'data-key', key);
|
|
143
126
|
template_u0.slot(element_u1o, content, 1);
|
|
144
127
|
return root_u1m;
|
|
@@ -149,4 +132,4 @@ export default component(function (attributes, content) {
|
|
|
149
132
|
}, 2);
|
|
150
133
|
return root_u1s;
|
|
151
134
|
})();
|
|
152
|
-
});
|
|
135
|
+
}), { arrow: SELECT_ARROW, option: SELECT_OPTION, tooltipContent: SELECT_TOOLTIP_CONTENT });
|