@esportsplus/ui 0.1.8 → 0.2.2
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/.editorconfig +9 -9
- package/.gitattributes +2 -2
- package/.github/dependabot.yml +23 -0
- package/.github/workflows/bump.yml +7 -0
- package/.github/workflows/publish.yml +14 -0
- package/build/components/alert/index.d.ts +1 -1
- package/build/components/alert/index.js +34 -36
- package/build/components/export/clipboard.js +1 -3
- package/build/components/export/index.js +3 -8
- package/build/components/export/json.js +1 -3
- package/build/components/field/checkbox.d.ts +1 -1
- package/build/components/field/checkbox.js +32 -37
- package/build/components/field/description.d.ts +1 -1
- package/build/components/field/description.js +4 -6
- package/build/components/field/error.d.ts +1 -1
- package/build/components/field/error.js +4 -6
- package/build/components/field/file.d.ts +1 -1
- package/build/components/field/file.js +36 -41
- package/build/components/field/index.d.ts +8 -8
- package/build/components/field/index.js +8 -13
- package/build/components/field/optional.d.ts +2 -2
- package/build/components/field/optional.js +8 -13
- package/build/components/field/select.d.ts +1 -1
- package/build/components/field/select.js +65 -70
- package/build/components/field/switch.d.ts +1 -1
- package/build/components/field/switch.js +3 -8
- package/build/components/field/text.d.ts +1 -1
- package/build/components/field/text.js +37 -42
- package/build/components/field/textarea.d.ts +1 -1
- package/build/components/field/textarea.js +3 -8
- package/build/components/field/title.d.ts +1 -1
- package/build/components/field/title.js +14 -19
- package/build/components/form/action.js +7 -13
- package/build/components/form/index.d.ts +1 -1
- package/build/components/form/index.js +4 -9
- package/build/components/form/input.js +1 -3
- package/build/components/form/layout.d.ts +1 -1
- package/build/components/form/layout.js +11 -13
- package/build/components/form/types.d.ts +1 -1
- package/build/components/form/types.js +1 -2
- package/build/components/number/index.js +2 -6
- package/build/components/page/index.js +2 -7
- package/build/components/root/index.js +3 -9
- package/build/components/root/onclick.js +1 -3
- package/build/components/scrollbar/index.d.ts +3 -3
- package/build/components/scrollbar/index.js +13 -15
- package/build/components/site/index.d.ts +1 -1
- package/build/components/site/index.js +10 -15
- package/build/components/tooltip/index.d.ts +5 -5
- package/build/components/tooltip/index.js +8 -13
- package/build/components/tooltip/menu.d.ts +1 -1
- package/build/components/tooltip/menu.js +34 -36
- package/build/index.js +11 -27
- package/lib.scss +1 -1
- package/package.json +25 -25
- package/src/components/accordion/scss/index.scss +16 -16
- package/src/components/accordion/scss/variables.scss +4 -4
- package/src/components/alert/index.ts +156 -156
- package/src/components/alert/scss/index.scss +54 -54
- package/src/components/alert/scss/variables.scss +8 -8
- package/src/components/anchor/scss/index.scss +41 -41
- package/src/components/anchor/scss/variables.scss +5 -5
- package/src/components/banner/scss/index.scss +40 -40
- package/src/components/banner/scss/variables.scss +5 -5
- package/src/components/border/scss/index.scss +10 -10
- package/src/components/border/scss/variables.scss +6 -6
- package/src/components/bubble/scss/index.scss +30 -30
- package/src/components/bubble/scss/variables.scss +19 -19
- package/src/components/button/scss/index.scss +92 -92
- package/src/components/button/scss/variables.scss +69 -69
- package/src/components/card/scss/index.scss +35 -35
- package/src/components/card/scss/variables.scss +42 -42
- package/src/components/container/scss/index.scss +10 -10
- package/src/components/container/scss/variables.scss +5 -5
- package/src/components/ellipsis/scss/index.scss +71 -71
- package/src/components/ellipsis/scss/variables.scss +2 -2
- package/src/components/export/clipboard.ts +11 -11
- package/src/components/export/index.ts +4 -4
- package/src/components/export/json.ts +14 -14
- package/src/components/field/checkbox.ts +60 -60
- package/src/components/field/description.ts +11 -11
- package/src/components/field/error.ts +13 -13
- package/src/components/field/file.ts +64 -64
- package/src/components/field/index.ts +9 -9
- package/src/components/field/optional.ts +26 -26
- package/src/components/field/scss/_check.scss +225 -225
- package/src/components/field/scss/_normalize.scss +36 -36
- package/src/components/field/scss/_text.scss +106 -106
- package/src/components/field/scss/index.scss +158 -158
- package/src/components/field/scss/variables.scss +138 -138
- package/src/components/field/select.ts +150 -150
- package/src/components/field/switch.ts +8 -8
- package/src/components/field/text.ts +68 -68
- package/src/components/field/textarea.ts +7 -7
- package/src/components/field/title.ts +22 -22
- package/src/components/form/action.ts +67 -67
- package/src/components/form/index.ts +5 -5
- package/src/components/form/input.ts +14 -14
- package/src/components/form/layout.ts +25 -25
- package/src/components/form/types.ts +15 -15
- package/src/components/group/scss/index.scss +36 -36
- package/src/components/group/scss/variables.scss +17 -17
- package/src/components/icon/scss/index.scss +17 -17
- package/src/components/icon/scss/variables.scss +7 -7
- package/src/components/link/scss/index.scss +28 -28
- package/src/components/link/scss/variables.scss +47 -47
- package/src/components/loading/scss/index.scss +24 -24
- package/src/components/loading/scss/variables.scss +31 -31
- package/src/components/modal/scss/index.scss +31 -31
- package/src/components/modal/scss/variables.scss +10 -10
- package/src/components/number/index.ts +23 -23
- package/src/components/page/index.ts +14 -14
- package/src/components/page/scss/index.scss +27 -27
- package/src/components/page/scss/variables.scss +27 -27
- package/src/components/processing/scss/index.scss +46 -46
- package/src/components/processing/scss/variables.scss +11 -11
- package/src/components/root/index.ts +4 -4
- package/src/components/root/onclick.ts +20 -20
- package/src/components/root/scss/index.scss +93 -93
- package/src/components/root/scss/variables.scss +55 -55
- package/src/components/row/scss/index.scss +7 -7
- package/src/components/scrollbar/index.ts +43 -43
- package/src/components/scrollbar/scss/index.scss +59 -59
- package/src/components/scrollbar/scss/variables.scss +6 -6
- package/src/components/sidebar/scss/index.scss +50 -50
- package/src/components/sidebar/scss/variables.scss +21 -21
- package/src/components/site/index.ts +26 -26
- package/src/components/site/scss/index.scss +3 -3
- package/src/components/text/scss/index.scss +12 -12
- package/src/components/text/scss/variables.scss +9 -9
- package/src/components/thumbnail/scss/index.scss +7 -7
- package/src/components/thumbnail/scss/variables.scss +7 -7
- package/src/components/tooltip/index.ts +93 -93
- package/src/components/tooltip/menu.ts +70 -70
- package/src/components/tooltip/scss/_center.scss +13 -13
- package/src/components/tooltip/scss/_east.scss +34 -34
- package/src/components/tooltip/scss/_north.scss +34 -34
- package/src/components/tooltip/scss/_south.scss +35 -35
- package/src/components/tooltip/scss/_west.scss +34 -34
- package/src/components/tooltip/scss/index.scss +93 -93
- package/src/components/tooltip/scss/variables.scss +25 -25
- package/src/css-utilities/[margin,padding]/scss/index.scss +41 -41
- package/src/css-utilities/[margin,padding]/scss/variables.scss +54 -54
- package/src/css-utilities/absolute/scss/index.scss +59 -59
- package/src/css-utilities/background/scss/variables.scss +27 -27
- package/src/css-utilities/border/scss/index.scss +21 -21
- package/src/css-utilities/border/scss/variables.scss +66 -66
- package/src/css-utilities/color/scss/variables.scss +31 -31
- package/src/css-utilities/disabled/scss/index.scss +4 -4
- package/src/css-utilities/flex/scss/index.scss +65 -65
- package/src/css-utilities/glass/scss/index.scss +2 -2
- package/src/css-utilities/glass/scss/variables.scss +2 -2
- package/src/css-utilities/hidden/scss/index.scss +28 -28
- package/src/css-utilities/index.scss +14 -14
- package/src/css-utilities/inline/scss/index.scss +7 -7
- package/src/css-utilities/line-height/scss/variables.scss +10 -10
- package/src/css-utilities/not-allowed/scss/index.scss +7 -7
- package/src/css-utilities/overflow/scss/index.scss +4 -4
- package/src/css-utilities/pointer/scss/index.scss +5 -5
- package/src/css-utilities/size/scss/variables.scss +12 -12
- package/src/css-utilities/slide/scss/index.scss +21 -21
- package/src/css-utilities/slide/scss/variables.scss +10 -10
- package/src/css-utilities/text/scss/index.scss +93 -93
- package/src/css-utilities/text/scss/variables.scss +31 -31
- package/src/css-utilities/transition/scss/variables.scss +14 -14
- package/src/css-utilities/viewport/scss/index.scss +4 -4
- package/src/css-utilities/width/scss/index.scss +3 -3
- package/src/css-utilities/width/scss/variables.scss +9 -9
- package/src/index.ts +11 -11
- package/src/lib/index.scss +7 -7
- package/src/lib/scss/breakpoint.scss +41 -41
- package/src/lib/scss/color.scss +1 -1
- package/src/lib/scss/css-variables.scss +13 -13
- package/src/lib/scss/list.scss +76 -76
- package/src/lib/scss/map.scss +1 -1
- package/src/lib/scss/position.scss +77 -77
- package/src/lib/scss/string.scss +33 -33
- package/src/tokens/index.scss +11 -11
- package/src/tokens/scss/border-radius.scss +12 -12
- package/src/tokens/scss/border-width.scss +6 -6
- package/src/tokens/scss/box-shadow.scss +13 -13
- package/src/tokens/scss/color.scss +64 -64
- package/src/tokens/scss/font-size.scss +12 -12
- package/src/tokens/scss/font-weight.scss +6 -6
- package/src/tokens/scss/line-height.scss +6 -6
- package/src/tokens/scss/size.scss +13 -13
- package/src/tokens/scss/spacer.scss +8 -8
- package/src/tokens/scss/state.scss +86 -86
- package/src/tokens/scss/transition-duration.scss +5 -5
- package/storage/fonts/montserrat/index.css +79 -79
- package/tokens.scss +1 -1
- package/tsconfig.json +10 -10
- package/utilities/styles.css +1 -1
- package/utilities/variables.css +1 -1
- package/webpack.config.ts +25 -25
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
@use '/tokens';
|
|
2
|
-
@use 'check' as check;
|
|
3
|
-
@use 'text' as text;
|
|
4
|
-
|
|
5
|
-
.field {
|
|
6
|
-
--transition-duration: var(--transition-duration-400);
|
|
7
|
-
--width: 100%;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
&--optional {
|
|
11
|
-
--max-height: 0;
|
|
12
|
-
--max-height-active: 0;
|
|
13
|
-
|
|
14
|
-
#{tokens.state(active, '.field')} & {
|
|
15
|
-
--max-height: var(--max-height-active);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
&-description,
|
|
21
|
-
&-error {
|
|
22
|
-
--font-size: var(--font-size-300);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&-error {
|
|
26
|
-
--color: var(--color-red-400);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&-mask {
|
|
30
|
-
--background: var(--background-default);
|
|
31
|
-
--background-active: var(--background-default);
|
|
32
|
-
--background-default: transparent;
|
|
33
|
-
--background-hover: var(--background-default);
|
|
34
|
-
--background-pressed: var(--background-default);
|
|
35
|
-
--border-color: var(--border-color-default);
|
|
36
|
-
--border-color-default: var(--background);
|
|
37
|
-
--border-radius: var(--border-radius-400);
|
|
38
|
-
--border-style: solid;
|
|
39
|
-
--border-width: 0px;
|
|
40
|
-
--box-shadow: var(--box-shadow-default);
|
|
41
|
-
--box-shadow-active: var(--box-shadow-400);
|
|
42
|
-
--box-shadow-default: var(--box-shadow-300);
|
|
43
|
-
--box-shadow-hover: var(--box-shadow-400);
|
|
44
|
-
--box-shadow-pressed: none;
|
|
45
|
-
--color: var(--color-default);
|
|
46
|
-
--color-active: var(--color-default);
|
|
47
|
-
--color-default: var(--color-text-400);
|
|
48
|
-
--color-hover: var(--color-default);
|
|
49
|
-
--color-pressed: var(--color-default);
|
|
50
|
-
--outline-opacity: var(--outline-opacity-default);
|
|
51
|
-
--outline-opacity-active: 0.32;
|
|
52
|
-
--outline-opacity-default: 0;
|
|
53
|
-
--outline-opacity-hover: 0;
|
|
54
|
-
--outline-opacity-pressed: 0;
|
|
55
|
-
--outline-spacing: 0px;
|
|
56
|
-
--outline-width: var(--outline-width-default);
|
|
57
|
-
--outline-width-active: 4px;
|
|
58
|
-
--outline-width-default: 0px;
|
|
59
|
-
--outline-width-hover: 0px;
|
|
60
|
-
--outline-width-pressed: 0px;
|
|
61
|
-
--padding-horizontal: 0px;
|
|
62
|
-
--padding-vertical: var(--size-400);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
#{tokens.state(active, '.field')} > &,
|
|
66
|
-
#{tokens.state(active, '.field')} *:not(.field) & {
|
|
67
|
-
--background: var(--background-active);
|
|
68
|
-
--border-color: var(--border-color-active);
|
|
69
|
-
--box-shadow: var(--box-shadow-active);
|
|
70
|
-
--color: var(--color-active);
|
|
71
|
-
--outline-opacity: var(--outline-opacity-active);
|
|
72
|
-
--outline-width: var(--outline-width-active);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
$inactive: tokens.state(inactive, '.field');
|
|
76
|
-
|
|
77
|
-
#{tokens.state(hover, 'label#{$inactive}')} > &,
|
|
78
|
-
#{tokens.state(hover, '#{$inactive}:not(label) &')} {
|
|
79
|
-
--background: var(--background-hover);
|
|
80
|
-
--border-color: var(--border-color-hover);
|
|
81
|
-
--box-shadow: var(--box-shadow-hover);
|
|
82
|
-
--color: var(--color-hover);
|
|
83
|
-
--outline-opacity: var(--outline-opacity-hover);
|
|
84
|
-
--outline-width: var(--outline-width-hover);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
#{tokens.state(pressed, 'label#{$inactive}')} > &,
|
|
88
|
-
#{tokens.state(pressed, '#{$inactive}:not(label) &')} {
|
|
89
|
-
--background: var(--background-pressed);
|
|
90
|
-
--border-color: var(--border-color-pressed);
|
|
91
|
-
--box-shadow: var(--box-shadow-pressed);
|
|
92
|
-
--color: var(--color-pressed);
|
|
93
|
-
--outline-opacity: var(--outline-opacity-pressed);
|
|
94
|
-
--outline-width: var(--outline-width-pressed);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
&--outline {
|
|
98
|
-
@include tokens.state(pressed) {
|
|
99
|
-
--border-color: var(--border-color-default);
|
|
100
|
-
|
|
101
|
-
&::before {
|
|
102
|
-
--outline-width: 0px;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
&-required {
|
|
109
|
-
--border-radius: var(--border-radius-circle);
|
|
110
|
-
--size: 6px;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&-title {
|
|
114
|
-
--color: var(--color-default);
|
|
115
|
-
--color-active: var(--color-default);
|
|
116
|
-
--color-default: var(--color-text-400);
|
|
117
|
-
--color-hover: var(--color-default);
|
|
118
|
-
--color-pressed: var(--color-default);
|
|
119
|
-
--font-size: var(--font-size-400);
|
|
120
|
-
--font-weight: var(--font-weight-500);
|
|
121
|
-
|
|
122
|
-
#{tokens.state(active, '.field')} & {
|
|
123
|
-
--color: var(--color-active);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
#{tokens.state(hover, '.field')} & {
|
|
127
|
-
--color: var(--color-hover);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
#{tokens.state(pressed, '.field')} & {
|
|
131
|
-
--color: var(--color-pressed);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
@include check.variables();
|
|
137
|
-
@include text.variables();
|
|
138
|
-
}
|
|
1
|
+
@use '/tokens';
|
|
2
|
+
@use 'check' as check;
|
|
3
|
+
@use 'text' as text;
|
|
4
|
+
|
|
5
|
+
.field {
|
|
6
|
+
--transition-duration: var(--transition-duration-400);
|
|
7
|
+
--width: 100%;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
&--optional {
|
|
11
|
+
--max-height: 0;
|
|
12
|
+
--max-height-active: 0;
|
|
13
|
+
|
|
14
|
+
#{tokens.state(active, '.field')} & {
|
|
15
|
+
--max-height: var(--max-height-active);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
&-description,
|
|
21
|
+
&-error {
|
|
22
|
+
--font-size: var(--font-size-300);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-error {
|
|
26
|
+
--color: var(--color-red-400);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-mask {
|
|
30
|
+
--background: var(--background-default);
|
|
31
|
+
--background-active: var(--background-default);
|
|
32
|
+
--background-default: transparent;
|
|
33
|
+
--background-hover: var(--background-default);
|
|
34
|
+
--background-pressed: var(--background-default);
|
|
35
|
+
--border-color: var(--border-color-default);
|
|
36
|
+
--border-color-default: var(--background);
|
|
37
|
+
--border-radius: var(--border-radius-400);
|
|
38
|
+
--border-style: solid;
|
|
39
|
+
--border-width: 0px;
|
|
40
|
+
--box-shadow: var(--box-shadow-default);
|
|
41
|
+
--box-shadow-active: var(--box-shadow-400);
|
|
42
|
+
--box-shadow-default: var(--box-shadow-300);
|
|
43
|
+
--box-shadow-hover: var(--box-shadow-400);
|
|
44
|
+
--box-shadow-pressed: none;
|
|
45
|
+
--color: var(--color-default);
|
|
46
|
+
--color-active: var(--color-default);
|
|
47
|
+
--color-default: var(--color-text-400);
|
|
48
|
+
--color-hover: var(--color-default);
|
|
49
|
+
--color-pressed: var(--color-default);
|
|
50
|
+
--outline-opacity: var(--outline-opacity-default);
|
|
51
|
+
--outline-opacity-active: 0.32;
|
|
52
|
+
--outline-opacity-default: 0;
|
|
53
|
+
--outline-opacity-hover: 0;
|
|
54
|
+
--outline-opacity-pressed: 0;
|
|
55
|
+
--outline-spacing: 0px;
|
|
56
|
+
--outline-width: var(--outline-width-default);
|
|
57
|
+
--outline-width-active: 4px;
|
|
58
|
+
--outline-width-default: 0px;
|
|
59
|
+
--outline-width-hover: 0px;
|
|
60
|
+
--outline-width-pressed: 0px;
|
|
61
|
+
--padding-horizontal: 0px;
|
|
62
|
+
--padding-vertical: var(--size-400);
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
#{tokens.state(active, '.field')} > &,
|
|
66
|
+
#{tokens.state(active, '.field')} *:not(.field) & {
|
|
67
|
+
--background: var(--background-active);
|
|
68
|
+
--border-color: var(--border-color-active);
|
|
69
|
+
--box-shadow: var(--box-shadow-active);
|
|
70
|
+
--color: var(--color-active);
|
|
71
|
+
--outline-opacity: var(--outline-opacity-active);
|
|
72
|
+
--outline-width: var(--outline-width-active);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
$inactive: tokens.state(inactive, '.field');
|
|
76
|
+
|
|
77
|
+
#{tokens.state(hover, 'label#{$inactive}')} > &,
|
|
78
|
+
#{tokens.state(hover, '#{$inactive}:not(label) &')} {
|
|
79
|
+
--background: var(--background-hover);
|
|
80
|
+
--border-color: var(--border-color-hover);
|
|
81
|
+
--box-shadow: var(--box-shadow-hover);
|
|
82
|
+
--color: var(--color-hover);
|
|
83
|
+
--outline-opacity: var(--outline-opacity-hover);
|
|
84
|
+
--outline-width: var(--outline-width-hover);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#{tokens.state(pressed, 'label#{$inactive}')} > &,
|
|
88
|
+
#{tokens.state(pressed, '#{$inactive}:not(label) &')} {
|
|
89
|
+
--background: var(--background-pressed);
|
|
90
|
+
--border-color: var(--border-color-pressed);
|
|
91
|
+
--box-shadow: var(--box-shadow-pressed);
|
|
92
|
+
--color: var(--color-pressed);
|
|
93
|
+
--outline-opacity: var(--outline-opacity-pressed);
|
|
94
|
+
--outline-width: var(--outline-width-pressed);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&--outline {
|
|
98
|
+
@include tokens.state(pressed) {
|
|
99
|
+
--border-color: var(--border-color-default);
|
|
100
|
+
|
|
101
|
+
&::before {
|
|
102
|
+
--outline-width: 0px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-required {
|
|
109
|
+
--border-radius: var(--border-radius-circle);
|
|
110
|
+
--size: 6px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&-title {
|
|
114
|
+
--color: var(--color-default);
|
|
115
|
+
--color-active: var(--color-default);
|
|
116
|
+
--color-default: var(--color-text-400);
|
|
117
|
+
--color-hover: var(--color-default);
|
|
118
|
+
--color-pressed: var(--color-default);
|
|
119
|
+
--font-size: var(--font-size-400);
|
|
120
|
+
--font-weight: var(--font-weight-500);
|
|
121
|
+
|
|
122
|
+
#{tokens.state(active, '.field')} & {
|
|
123
|
+
--color: var(--color-active);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#{tokens.state(hover, '.field')} & {
|
|
127
|
+
--color: var(--color-hover);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
#{tokens.state(pressed, '.field')} & {
|
|
131
|
+
--color: var(--color-pressed);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@include check.variables();
|
|
137
|
+
@include text.variables();
|
|
138
|
+
}
|
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { html } from '@esportsplus/template';
|
|
3
|
-
import form from '~/components/form';
|
|
4
|
-
import scrollbar from '~/components/scrollbar';
|
|
5
|
-
import root from '~/components/root';
|
|
6
|
-
import description from './description';
|
|
7
|
-
import error from './error';
|
|
8
|
-
import title from './title';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type Data = {
|
|
12
|
-
class?: string;
|
|
13
|
-
effect?: (selected: number | string) => void;
|
|
14
|
-
mask?: {
|
|
15
|
-
class?: string;
|
|
16
|
-
content?: any;
|
|
17
|
-
style?: string;
|
|
18
|
-
};
|
|
19
|
-
name?: string;
|
|
20
|
-
options: Record<number | string, number | string>;
|
|
21
|
-
option?: {
|
|
22
|
-
class?: string;
|
|
23
|
-
style?: string;
|
|
24
|
-
};
|
|
25
|
-
selected?: any;
|
|
26
|
-
scrollbar?: {
|
|
27
|
-
style?: string;
|
|
28
|
-
};
|
|
29
|
-
style?: string;
|
|
30
|
-
text?: {
|
|
31
|
-
class?: string;
|
|
32
|
-
};
|
|
33
|
-
tooltip?: {
|
|
34
|
-
class?: string;
|
|
35
|
-
direction?: any;
|
|
36
|
-
style?: string;
|
|
37
|
-
};
|
|
38
|
-
} & Parameters<typeof description>[0] & Parameters<typeof title>[0];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
function parse(keys: (number | string)[], selected: number | string) {
|
|
42
|
-
let options: Record<string, boolean> = {};
|
|
43
|
-
|
|
44
|
-
for (let key of keys) {
|
|
45
|
-
options[key] = false;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
options[selected] = true;
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
options,
|
|
52
|
-
selected: selected || keys[0]
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function template(data: Data, state: { active: boolean, options: Record<number | string, boolean>, selected: number | string }) {
|
|
57
|
-
let { attributes: a, html: h } = scrollbar({
|
|
58
|
-
fixed: true,
|
|
59
|
-
style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
return html`
|
|
63
|
-
<div
|
|
64
|
-
class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'
|
|
65
|
-
style='${data?.tooltip?.style || ''}'
|
|
66
|
-
>
|
|
67
|
-
<div
|
|
68
|
-
class='row --flex-column'
|
|
69
|
-
onclick='${(e: Event) => {
|
|
70
|
-
let key = (e?.target as HTMLElement)?.dataset?.key;
|
|
71
|
-
|
|
72
|
-
if (key === undefined) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Swap active
|
|
77
|
-
state.options[key] = true;
|
|
78
|
-
state.options[state.selected] = false;
|
|
79
|
-
|
|
80
|
-
state.active = false;
|
|
81
|
-
state.selected = key;
|
|
82
|
-
|
|
83
|
-
if (data.effect) {
|
|
84
|
-
data.effect(key);
|
|
85
|
-
}
|
|
86
|
-
}}'
|
|
87
|
-
${a}
|
|
88
|
-
>
|
|
89
|
-
${Object.keys( data.options || {} ).map((key: number | string) => html`
|
|
90
|
-
<div
|
|
91
|
-
class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
|
|
92
|
-
style='${data?.option?.style || ''}'
|
|
93
|
-
>
|
|
94
|
-
<span class="--text-truncate">
|
|
95
|
-
${data.options[key]}
|
|
96
|
-
</span>
|
|
97
|
-
</div>
|
|
98
|
-
`)}
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
${h}
|
|
102
|
-
</div>
|
|
103
|
-
`;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
export default (data: Data) => {
|
|
108
|
-
let state = reactive(Object.assign({
|
|
109
|
-
active: false,
|
|
110
|
-
error: '',
|
|
111
|
-
render: false,
|
|
112
|
-
}, parse(Object.keys( data.options || {} ), data.selected)));
|
|
113
|
-
|
|
114
|
-
return html`
|
|
115
|
-
<div class="field tooltip ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column" style='${data?.style || ''}'>
|
|
116
|
-
${title(data)}
|
|
117
|
-
|
|
118
|
-
<label
|
|
119
|
-
class="field-mask field-mask--select --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300 --padding-400"
|
|
120
|
-
onclick='${() => {
|
|
121
|
-
state.render = true;
|
|
122
|
-
state.active = !state.active;
|
|
123
|
-
|
|
124
|
-
if (state.active) {
|
|
125
|
-
root.onclick.add(() => state.active = false);
|
|
126
|
-
}
|
|
127
|
-
}}'
|
|
128
|
-
style='${data?.mask?.style || ''}'
|
|
129
|
-
>
|
|
130
|
-
<input
|
|
131
|
-
class='field-tag field-tag--hidden'
|
|
132
|
-
name='${data.name}'
|
|
133
|
-
onclick='${() => { /* Prevent double click events from firing */ }}'
|
|
134
|
-
onrender='${form.input.attributes(state)}'
|
|
135
|
-
value='${() => state.selected}'
|
|
136
|
-
>
|
|
137
|
-
|
|
138
|
-
<div class="field-text ${data?.text?.class || ''}" style='pointer-events: none'>
|
|
139
|
-
${() => data.options[ state.selected ] || '-'}
|
|
140
|
-
</div>
|
|
141
|
-
|
|
142
|
-
<div class='field-mask-arrow'></div>
|
|
143
|
-
|
|
144
|
-
${() => state.render ? template(data, state) : ''}
|
|
145
|
-
</label>
|
|
146
|
-
|
|
147
|
-
${description(data)}
|
|
148
|
-
${error(state)}
|
|
149
|
-
</div>
|
|
150
|
-
`;
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import form from '~/components/form';
|
|
4
|
+
import scrollbar from '~/components/scrollbar';
|
|
5
|
+
import root from '~/components/root';
|
|
6
|
+
import description from './description';
|
|
7
|
+
import error from './error';
|
|
8
|
+
import title from './title';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
type Data = {
|
|
12
|
+
class?: string;
|
|
13
|
+
effect?: (selected: number | string) => void;
|
|
14
|
+
mask?: {
|
|
15
|
+
class?: string;
|
|
16
|
+
content?: any;
|
|
17
|
+
style?: string;
|
|
18
|
+
};
|
|
19
|
+
name?: string;
|
|
20
|
+
options: Record<number | string, number | string>;
|
|
21
|
+
option?: {
|
|
22
|
+
class?: string;
|
|
23
|
+
style?: string;
|
|
24
|
+
};
|
|
25
|
+
selected?: any;
|
|
26
|
+
scrollbar?: {
|
|
27
|
+
style?: string;
|
|
28
|
+
};
|
|
29
|
+
style?: string;
|
|
30
|
+
text?: {
|
|
31
|
+
class?: string;
|
|
32
|
+
};
|
|
33
|
+
tooltip?: {
|
|
34
|
+
class?: string;
|
|
35
|
+
direction?: any;
|
|
36
|
+
style?: string;
|
|
37
|
+
};
|
|
38
|
+
} & Parameters<typeof description>[0] & Parameters<typeof title>[0];
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
function parse(keys: (number | string)[], selected: number | string) {
|
|
42
|
+
let options: Record<string, boolean> = {};
|
|
43
|
+
|
|
44
|
+
for (let key of keys) {
|
|
45
|
+
options[key] = false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
options[selected] = true;
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
options,
|
|
52
|
+
selected: selected || keys[0]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function template(data: Data, state: { active: boolean, options: Record<number | string, boolean>, selected: number | string }) {
|
|
57
|
+
let { attributes: a, html: h } = scrollbar({
|
|
58
|
+
fixed: true,
|
|
59
|
+
style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return html`
|
|
63
|
+
<div
|
|
64
|
+
class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'
|
|
65
|
+
style='${data?.tooltip?.style || ''}'
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
class='row --flex-column'
|
|
69
|
+
onclick='${(e: Event) => {
|
|
70
|
+
let key = (e?.target as HTMLElement)?.dataset?.key;
|
|
71
|
+
|
|
72
|
+
if (key === undefined) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Swap active
|
|
77
|
+
state.options[key] = true;
|
|
78
|
+
state.options[state.selected] = false;
|
|
79
|
+
|
|
80
|
+
state.active = false;
|
|
81
|
+
state.selected = key;
|
|
82
|
+
|
|
83
|
+
if (data.effect) {
|
|
84
|
+
data.effect(key);
|
|
85
|
+
}
|
|
86
|
+
}}'
|
|
87
|
+
${a}
|
|
88
|
+
>
|
|
89
|
+
${Object.keys( data.options || {} ).map((key: number | string) => html`
|
|
90
|
+
<div
|
|
91
|
+
class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
|
|
92
|
+
style='${data?.option?.style || ''}'
|
|
93
|
+
>
|
|
94
|
+
<span class="--text-truncate">
|
|
95
|
+
${data.options[key]}
|
|
96
|
+
</span>
|
|
97
|
+
</div>
|
|
98
|
+
`)}
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
${h}
|
|
102
|
+
</div>
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
export default (data: Data) => {
|
|
108
|
+
let state = reactive(Object.assign({
|
|
109
|
+
active: false,
|
|
110
|
+
error: '',
|
|
111
|
+
render: false,
|
|
112
|
+
}, parse(Object.keys( data.options || {} ), data.selected)));
|
|
113
|
+
|
|
114
|
+
return html`
|
|
115
|
+
<div class="field tooltip ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column" style='${data?.style || ''}'>
|
|
116
|
+
${title(data)}
|
|
117
|
+
|
|
118
|
+
<label
|
|
119
|
+
class="field-mask field-mask--select --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300 --padding-400"
|
|
120
|
+
onclick='${() => {
|
|
121
|
+
state.render = true;
|
|
122
|
+
state.active = !state.active;
|
|
123
|
+
|
|
124
|
+
if (state.active) {
|
|
125
|
+
root.onclick.add(() => state.active = false);
|
|
126
|
+
}
|
|
127
|
+
}}'
|
|
128
|
+
style='${data?.mask?.style || ''}'
|
|
129
|
+
>
|
|
130
|
+
<input
|
|
131
|
+
class='field-tag field-tag--hidden'
|
|
132
|
+
name='${data.name}'
|
|
133
|
+
onclick='${() => { /* Prevent double click events from firing */ }}'
|
|
134
|
+
onrender='${form.input.attributes(state)}'
|
|
135
|
+
value='${() => state.selected}'
|
|
136
|
+
>
|
|
137
|
+
|
|
138
|
+
<div class="field-text ${data?.text?.class || ''}" style='pointer-events: none'>
|
|
139
|
+
${() => data.options[ state.selected ] || '-'}
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div class='field-mask-arrow'></div>
|
|
143
|
+
|
|
144
|
+
${() => state.render ? template(data, state) : ''}
|
|
145
|
+
</label>
|
|
146
|
+
|
|
147
|
+
${description(data)}
|
|
148
|
+
${error(state)}
|
|
149
|
+
</div>
|
|
150
|
+
`;
|
|
151
151
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import checkbox from './checkbox';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default (data: Parameters<typeof checkbox>[0]) => {
|
|
5
|
-
data.mask = data.mask || {};
|
|
6
|
-
data.mask.class = `field-mask--switch ${data.mask?.class || ''}`;
|
|
7
|
-
|
|
8
|
-
return checkbox(data);
|
|
1
|
+
import checkbox from './checkbox';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default (data: Parameters<typeof checkbox>[0]) => {
|
|
5
|
+
data.mask = data.mask || {};
|
|
6
|
+
data.mask.class = `field-mask--switch ${data.mask?.class || ''}`;
|
|
7
|
+
|
|
8
|
+
return checkbox(data);
|
|
9
9
|
};
|