@esportsplus/ui 0.8.3 → 0.9.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.
Files changed (285) hide show
  1. package/.editorconfig +9 -9
  2. package/.gitattributes +2 -2
  3. package/.github/dependabot.yml +23 -0
  4. package/.github/workflows/bump.yml +7 -0
  5. package/.github/workflows/publish.yml +14 -0
  6. package/package.json +9 -22
  7. package/src/components/accordion/index.ts +35 -34
  8. package/src/components/accordion/scss/index.scss +17 -16
  9. package/src/components/accordion/scss/variables.scss +9 -9
  10. package/src/components/anchor/index.ts +1 -0
  11. package/src/components/anchor/scss/index.scss +42 -41
  12. package/src/components/anchor/scss/variables.scss +4 -4
  13. package/src/components/banner/index.ts +1 -0
  14. package/src/components/banner/scss/index.scss +41 -40
  15. package/src/components/banner/scss/variables.scss +9 -9
  16. package/src/components/border/index.ts +1 -0
  17. package/src/components/border/scss/index.scss +12 -0
  18. package/src/components/border/scss/variables.scss +6 -0
  19. package/src/components/bubble/index.ts +1 -0
  20. package/src/components/bubble/scss/index.scss +32 -0
  21. package/src/components/bubble/scss/variables.scss +19 -0
  22. package/src/components/button/index.ts +1 -0
  23. package/src/components/button/scss/index.scss +115 -114
  24. package/src/components/button/scss/variables.scss +66 -66
  25. package/src/components/card/index.ts +1 -0
  26. package/src/components/card/scss/index.scss +36 -35
  27. package/src/components/card/scss/variables.scss +41 -41
  28. package/src/components/clipboard/index.ts +3 -4
  29. package/src/components/clipboard/write.ts +8 -8
  30. package/src/components/container/index.ts +1 -0
  31. package/src/components/container/scss/index.scss +10 -8
  32. package/src/components/container/scss/variables.scss +5 -5
  33. package/src/components/counter/index.ts +99 -93
  34. package/src/components/counter/scss/index.scss +63 -61
  35. package/src/components/counter/scss/variables.scss +26 -26
  36. package/src/components/ellipsis/index.ts +10 -9
  37. package/src/components/ellipsis/scss/index.scss +29 -27
  38. package/src/components/ellipsis/scss/variables.scss +4 -4
  39. package/src/components/field/checkbox.ts +71 -0
  40. package/src/components/field/description.ts +14 -0
  41. package/src/components/field/error.ts +16 -0
  42. package/src/components/field/file.ts +77 -0
  43. package/src/components/field/index.ts +11 -0
  44. package/src/components/field/optional.ts +23 -0
  45. package/src/components/field/scss/_check.scss +225 -0
  46. package/src/components/field/scss/_normalize.scss +36 -0
  47. package/src/components/field/scss/_text.scss +106 -0
  48. package/src/components/field/scss/index.scss +161 -0
  49. package/src/components/field/scss/variables.scss +139 -0
  50. package/src/components/field/select.ts +182 -0
  51. package/src/components/field/switch.ts +9 -0
  52. package/src/components/field/text.ts +92 -0
  53. package/src/components/field/textarea.ts +8 -0
  54. package/src/components/field/title.ts +24 -0
  55. package/src/components/footer/index.ts +83 -78
  56. package/src/components/footer/scss/index.scss +25 -25
  57. package/src/components/form/action.ts +79 -80
  58. package/src/components/form/index.ts +5 -6
  59. package/src/components/form/input.ts +17 -15
  60. package/src/components/form/types.ts +13 -15
  61. package/src/components/frame/index.ts +1 -0
  62. package/src/components/frame/scss/index.scss +11 -11
  63. package/src/components/grid/index.ts +1 -0
  64. package/src/components/grid/scss/index.scss +11 -9
  65. package/src/components/grid/scss/variables.scss +5 -5
  66. package/src/components/group/index.ts +1 -0
  67. package/src/components/group/scss/index.scss +38 -36
  68. package/src/components/group/scss/variables.scss +17 -17
  69. package/src/components/highlight/index.ts +51 -47
  70. package/src/components/highlight/scss/index.scss +6 -4
  71. package/src/components/highlight/scss/variables.scss +3 -3
  72. package/src/components/icon/index.ts +1 -0
  73. package/src/components/icon/scss/index.scss +18 -16
  74. package/src/components/icon/scss/variables.scss +7 -7
  75. package/src/components/index.ts +38 -19
  76. package/src/components/json/download.ts +14 -14
  77. package/src/components/json/index.ts +3 -3
  78. package/src/components/link/hover.ts +18 -18
  79. package/src/components/link/index.ts +4 -3
  80. package/src/components/link/scss/index.scss +66 -65
  81. package/src/components/link/scss/variables.scss +46 -46
  82. package/src/components/loader/index.ts +42 -34
  83. package/src/components/loader/scss/index.scss +70 -68
  84. package/src/components/loader/scss/variables.scss +5 -5
  85. package/src/components/loading/index.ts +13 -7
  86. package/src/components/loading/scss/index.scss +18 -16
  87. package/src/components/loading/scss/variables.scss +5 -5
  88. package/src/components/magnet/index.ts +55 -54
  89. package/src/components/magnet/scss/index.scss +17 -16
  90. package/src/components/magnet/scss/variables.scss +4 -4
  91. package/src/components/modal/index.ts +1 -0
  92. package/src/components/modal/scss/index.scss +35 -34
  93. package/src/components/modal/scss/variables.scss +6 -6
  94. package/src/components/normalize/index.ts +1 -0
  95. package/src/components/number/index.ts +4 -24
  96. package/src/components/page/index.ts +17 -15
  97. package/src/components/page/scss/index.scss +33 -31
  98. package/src/components/page/scss/variables.scss +15 -15
  99. package/src/components/root/index.ts +4 -4
  100. package/src/components/root/onclick.ts +20 -20
  101. package/src/components/root/scss/index.scss +94 -94
  102. package/src/components/root/scss/variables.scss +100 -100
  103. package/src/components/row/index.ts +1 -0
  104. package/src/components/row/scss/index.scss +7 -7
  105. package/src/components/scrollbar/index.ts +49 -43
  106. package/src/components/scrollbar/scss/index.scss +72 -70
  107. package/src/components/scrollbar/scss/variables.scss +6 -6
  108. package/src/components/sidebar/index.ts +1 -0
  109. package/src/components/sidebar/scss/index.scss +50 -49
  110. package/src/components/sidebar/scss/variables.scss +20 -20
  111. package/src/components/site/index.ts +27 -26
  112. package/src/components/site/scss/index.scss +3 -3
  113. package/src/components/text/index.ts +1 -0
  114. package/src/components/text/scss/index.scss +11 -9
  115. package/src/components/text/scss/variables.scss +8 -8
  116. package/src/components/thumbnail/index.ts +1 -0
  117. package/src/components/thumbnail/scss/index.scss +9 -7
  118. package/src/components/thumbnail/scss/variables.scss +7 -7
  119. package/src/components/tooltip/index.ts +85 -84
  120. package/src/components/tooltip/scss/_center.scss +13 -13
  121. package/src/components/tooltip/scss/_east.scss +34 -34
  122. package/src/components/tooltip/scss/_north.scss +34 -34
  123. package/src/components/tooltip/scss/_south.scss +35 -35
  124. package/src/components/tooltip/scss/_west.scss +34 -34
  125. package/src/components/tooltip/scss/index.scss +94 -93
  126. package/src/components/tooltip/scss/variables.scss +24 -24
  127. package/src/components/truncate/index.ts +4 -14
  128. package/src/components/typewriter/index.ts +54 -53
  129. package/src/components/typewriter/scss/index.scss +14 -14
  130. package/src/css-utilities/[margin,padding]/scss/index.scss +43 -41
  131. package/src/css-utilities/[margin,padding]/scss/variables.scss +54 -54
  132. package/src/css-utilities/absolute/scss/index.scss +36 -36
  133. package/src/css-utilities/background/scss/index.scss +1 -0
  134. package/src/css-utilities/background/scss/variables.scss +26 -27
  135. package/src/css-utilities/border/scss/index.scss +23 -21
  136. package/src/css-utilities/border/scss/variables.scss +64 -66
  137. package/src/css-utilities/color/scss/index.scss +1 -0
  138. package/src/css-utilities/color/scss/variables.scss +29 -31
  139. package/src/css-utilities/disabled/scss/index.scss +4 -4
  140. package/src/css-utilities/flex/scss/index.scss +65 -65
  141. package/src/css-utilities/glass/scss/index.scss +4 -2
  142. package/src/css-utilities/glass/scss/variables.scss +2 -2
  143. package/src/css-utilities/hidden/scss/index.scss +28 -28
  144. package/src/css-utilities/index.ts +18 -0
  145. package/src/css-utilities/inline/scss/index.scss +7 -7
  146. package/src/css-utilities/line-height/scss/index.scss +1 -0
  147. package/src/css-utilities/line-height/scss/variables.scss +10 -10
  148. package/src/css-utilities/not-allowed/scss/index.scss +7 -7
  149. package/src/css-utilities/pointer/scss/index.scss +5 -5
  150. package/src/css-utilities/size/scss/index.scss +1 -0
  151. package/src/css-utilities/size/scss/variables.scss +12 -12
  152. package/src/css-utilities/squircle/scss/index.scss +4 -4
  153. package/src/css-utilities/text/scss/index.scss +90 -89
  154. package/src/css-utilities/text/scss/variables.scss +31 -31
  155. package/src/css-utilities/viewport/scss/index.scss +4 -4
  156. package/src/css-utilities/width/scss/index.scss +5 -3
  157. package/src/css-utilities/width/scss/variables.scss +9 -9
  158. package/src/lib/index.scss +7 -7
  159. package/src/lib/scss/breakpoint.scss +41 -41
  160. package/src/lib/scss/color.scss +1 -1
  161. package/src/lib/scss/css-variables.scss +16 -16
  162. package/src/lib/scss/list.scss +77 -77
  163. package/src/lib/scss/map.scss +1 -1
  164. package/src/lib/scss/position.scss +55 -55
  165. package/src/lib/scss/string.scss +34 -34
  166. package/src/tokens/index.scss +11 -11
  167. package/src/tokens/scss/border-radius.scss +12 -12
  168. package/src/tokens/scss/border-width.scss +6 -6
  169. package/src/tokens/scss/box-shadow.scss +39 -39
  170. package/src/tokens/scss/color.scss +68 -64
  171. package/src/tokens/scss/font-size.scss +16 -16
  172. package/src/tokens/scss/font-weight.scss +6 -6
  173. package/src/tokens/scss/line-height.scss +6 -6
  174. package/src/tokens/scss/size.scss +13 -13
  175. package/src/tokens/scss/spacer.scss +10 -10
  176. package/src/tokens/scss/state.scss +85 -87
  177. package/src/tokens/scss/transition-duration.scss +1 -1
  178. package/tsconfig.json +5 -2
  179. package/assets/0af89c10df9bc2f8d646.woff2 +0 -0
  180. package/assets/109e3207d9afea8524be.woff2 +0 -0
  181. package/assets/16663c3f6ab1da2d6c86.woff +0 -0
  182. package/assets/16e8721ef5837bc6375e.woff +0 -0
  183. package/assets/2a3e005f58bfca9c117e.woff +0 -0
  184. package/assets/58a8d7ebc386843b62c5.woff2 +0 -0
  185. package/assets/593de7c561e5ffe80c3e.woff2 +0 -0
  186. package/assets/68b7982c2b30b51bf932.woff2 +0 -0
  187. package/assets/a04b5e24af93da353f0e.woff +0 -0
  188. package/assets/bf331673b91821715c08.woff +0 -0
  189. package/assets/c54b0f4340f2914802d1.woff +0 -0
  190. package/assets/dd8646a41e4397b77fc4.woff2 +0 -0
  191. package/assets/e06c107cc50506570954.woff2 +0 -0
  192. package/assets/ecdfe4c05425592708aa.woff2 +0 -0
  193. package/assets/f0032576ac7462ccbd0c.woff +0 -0
  194. package/assets/f872e621917a45943fbc.woff +0 -0
  195. package/build/components/accordion/index.d.ts +0 -17
  196. package/build/components/accordion/index.js +0 -25
  197. package/build/components/clipboard/index.d.ts +0 -5
  198. package/build/components/clipboard/index.js +0 -3
  199. package/build/components/clipboard/write.d.ts +0 -2
  200. package/build/components/clipboard/write.js +0 -9
  201. package/build/components/counter/index.d.ts +0 -13
  202. package/build/components/counter/index.js +0 -72
  203. package/build/components/ellipsis/index.d.ts +0 -2
  204. package/build/components/ellipsis/index.js +0 -8
  205. package/build/components/footer/index.d.ts +0 -25
  206. package/build/components/footer/index.js +0 -55
  207. package/build/components/form/action.d.ts +0 -5
  208. package/build/components/form/action.js +0 -54
  209. package/build/components/form/index.d.ts +0 -23
  210. package/build/components/form/index.js +0 -4
  211. package/build/components/form/input.d.ts +0 -9
  212. package/build/components/form/input.js +0 -10
  213. package/build/components/form/layout.d.ts +0 -12
  214. package/build/components/form/layout.js +0 -12
  215. package/build/components/form/types.d.ts +0 -11
  216. package/build/components/form/types.js +0 -1
  217. package/build/components/highlight/index.d.ts +0 -8
  218. package/build/components/highlight/index.js +0 -36
  219. package/build/components/index.d.ts +0 -19
  220. package/build/components/index.js +0 -19
  221. package/build/components/json/download.d.ts +0 -2
  222. package/build/components/json/download.js +0 -8
  223. package/build/components/json/index.d.ts +0 -4
  224. package/build/components/json/index.js +0 -2
  225. package/build/components/link/hover.d.ts +0 -10
  226. package/build/components/link/hover.js +0 -17
  227. package/build/components/link/index.d.ts +0 -12
  228. package/build/components/link/index.js +0 -2
  229. package/build/components/loader/index.d.ts +0 -5
  230. package/build/components/loader/index.js +0 -31
  231. package/build/components/loading/index.d.ts +0 -2
  232. package/build/components/loading/index.js +0 -6
  233. package/build/components/magnet/index.d.ts +0 -10
  234. package/build/components/magnet/index.js +0 -46
  235. package/build/components/number/index.d.ts +0 -8
  236. package/build/components/number/index.js +0 -16
  237. package/build/components/page/index.d.ts +0 -22
  238. package/build/components/page/index.js +0 -11
  239. package/build/components/root/index.d.ts +0 -9
  240. package/build/components/root/index.js +0 -3
  241. package/build/components/root/onclick.d.ts +0 -5
  242. package/build/components/root/onclick.js +0 -14
  243. package/build/components/scrollbar/index.d.ts +0 -13
  244. package/build/components/scrollbar/index.js +0 -36
  245. package/build/components/site/index.d.ts +0 -8
  246. package/build/components/site/index.js +0 -16
  247. package/build/components/tooltip/index.d.ts +0 -23
  248. package/build/components/tooltip/index.js +0 -63
  249. package/build/components/truncate/index.d.ts +0 -9
  250. package/build/components/truncate/index.js +0 -10
  251. package/build/components/typewriter/index.d.ts +0 -8
  252. package/build/components/typewriter/index.js +0 -41
  253. package/build/index.d.ts +0 -19
  254. package/build/index.js +0 -19
  255. package/components/styles.css +0 -30
  256. package/components/variables.css +0 -24
  257. package/fonts/montserrat.css +0 -1
  258. package/lib.scss +0 -2
  259. package/normalize.css +0 -1
  260. package/src/components/clipboard/scss/index.scss +0 -3
  261. package/src/components/form/layout.ts +0 -26
  262. package/src/css-utilities/index.scss +0 -14
  263. package/src/css-utilities/overflow/scss/index.scss +0 -5
  264. package/src/index.ts +0 -19
  265. package/storage/fonts/montserrat/Montserrat-Bold.woff +0 -0
  266. package/storage/fonts/montserrat/Montserrat-Bold.woff2 +0 -0
  267. package/storage/fonts/montserrat/Montserrat-BoldItalic.woff +0 -0
  268. package/storage/fonts/montserrat/Montserrat-BoldItalic.woff2 +0 -0
  269. package/storage/fonts/montserrat/Montserrat-Italic.woff +0 -0
  270. package/storage/fonts/montserrat/Montserrat-Italic.woff2 +0 -0
  271. package/storage/fonts/montserrat/Montserrat-Medium.woff +0 -0
  272. package/storage/fonts/montserrat/Montserrat-Medium.woff2 +0 -0
  273. package/storage/fonts/montserrat/Montserrat-MediumItalic.woff +0 -0
  274. package/storage/fonts/montserrat/Montserrat-MediumItalic.woff2 +0 -0
  275. package/storage/fonts/montserrat/Montserrat-Regular.woff +0 -0
  276. package/storage/fonts/montserrat/Montserrat-Regular.woff2 +0 -0
  277. package/storage/fonts/montserrat/Montserrat-SemiBold.woff +0 -0
  278. package/storage/fonts/montserrat/Montserrat-SemiBold.woff2 +0 -0
  279. package/storage/fonts/montserrat/Montserrat-SemiBoldItalic.woff +0 -0
  280. package/storage/fonts/montserrat/Montserrat-SemiBoldItalic.woff2 +0 -0
  281. package/storage/fonts/montserrat/index.css +0 -79
  282. package/tokens.scss +0 -2
  283. package/utilities/styles.css +0 -16
  284. package/utilities/variables.css +0 -9
  285. package/webpack.config.ts +0 -26
@@ -1,94 +1,100 @@
1
- import { effect, reactive } from '@esportsplus/reactivity'
2
- import { html } from '@esportsplus/template';
3
-
4
-
5
- let formatters: Record<string, Intl.NumberFormat> = {};
6
-
7
-
8
- export default ({ currency, delay, max, suffix, value }: { currency?: 'IGNORE' | 'EUR' | 'GBP' | 'USD', delay?: number, max?: number, suffix?: string, value: number }) => {
9
- let api = reactive({ value: -1 }),
10
- formatter = currency === 'IGNORE' ? undefined : formatters[currency || 'USD'] ??= new Intl.NumberFormat('en-US', {
11
- style: 'currency',
12
- currency: currency || 'USD'
13
- }),
14
- rendering = true,
15
- state = reactive({
16
- length: 0,
17
- render: [] as string[]
18
- });
19
-
20
- effect(() => {
21
- if (api.value !== -1) {
22
- value = api.value;
23
- }
24
-
25
- let padding = (max || value).toFixed(2).length - value.toFixed(2).length,
26
- values = value.toString().padStart( value.toString().length + padding, '1') as any;
27
-
28
- if (formatter) {
29
- values = formatter.format(values);
30
- }
31
- else {
32
- values = Number(values).toLocaleString();
33
- }
34
-
35
- values = values.split('');
36
-
37
- if (suffix) {
38
- values.push(' ', ...suffix.split(''));
39
- }
40
-
41
- state.length = values.length;
42
-
43
- for (let i = 0, n = values.length; i < n; i++) {
44
- let value = values[i];
45
-
46
- if (!isNaN(parseInt(value, 10)) && (rendering === true || padding > 0)) {
47
- padding--;
48
- value = '0';
49
- }
50
-
51
- state.render[i] = value;
52
- }
53
-
54
- if (rendering === true) {
55
- rendering = false;
56
- setTimeout(() => api.value = value, delay || 1000);
57
- }
58
- });
59
-
60
- return {
61
- html: html`
62
- <div class='counter'>
63
- ${() => {
64
- let n = state.length;
65
-
66
- if (n === 0) {
67
- return '';
68
- }
69
-
70
- return html.reactive(state.render, function (value, i) {
71
- if (isNaN(parseInt(value as string, 10))) {
72
- return html`
73
- <span class='counter-character counter-character--symbol'>
74
- ${value}
75
- </span>
76
- `;
77
- }
78
-
79
- return html`
80
- <div class='counter-character ${i > n - 3 ? 'counter-character--fraction' : ''}'>
81
- <div class='counter-character-track' style='${() => `--value: ${this[i]}`}'>
82
- <span>9</span>
83
- ${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((value) => html`<span>${value}</span>`)}
84
- <span>0</span>
85
- </div>
86
- </div>
87
- `;
88
- })
89
- }}
90
- </div>
91
- `,
92
- state: api
93
- };
1
+ import { effect, reactive } from '@esportsplus/reactivity'
2
+ import { html } from '@esportsplus/template';
3
+ import './scss/index.scss';
4
+
5
+
6
+ let formatters: Record<string, Intl.NumberFormat> = {};
7
+
8
+
9
+ export default ({ currency, delay, max, suffix, value }: { currency?: 'IGNORE' | 'EUR' | 'GBP' | 'USD', delay?: number, max?: number, suffix?: string, value: number }) => {
10
+ let api = reactive({ value: -1 }),
11
+ formatter = currency === 'IGNORE' ? undefined : formatters[currency || 'USD'] ??= new Intl.NumberFormat('en-US', {
12
+ style: 'currency',
13
+ currency: currency || 'USD'
14
+ }),
15
+ rendering = true,
16
+ state = reactive({
17
+ length: 0,
18
+ render: [] as string[]
19
+ });
20
+
21
+ effect(() => {
22
+ if (api.value !== -1) {
23
+ value = api.value;
24
+ }
25
+
26
+ let padding = (max || value).toFixed(2).length - value.toFixed(2).length,
27
+ values = value.toString().padStart( value.toString().length + padding, '1') as any;
28
+
29
+ if (formatter) {
30
+ values = formatter.format(values);
31
+ }
32
+ else {
33
+ values = Number(values).toLocaleString();
34
+ }
35
+
36
+ values = values.split('');
37
+
38
+ if (suffix) {
39
+ values.push(' ', ...suffix.split(''));
40
+ }
41
+
42
+ state.length = values.length;
43
+
44
+ for (let i = 0, n = values.length; i < n; i++) {
45
+ let value = values[i];
46
+
47
+ if (!isNaN(parseInt(value, 10)) && (rendering === true || padding > 0)) {
48
+ padding--;
49
+ value = '0';
50
+ }
51
+
52
+ state.render[i] = value;
53
+ }
54
+
55
+ if (rendering === true) {
56
+ rendering = false;
57
+ setTimeout(() => api.value = value, delay || 1000);
58
+ }
59
+ });
60
+
61
+ return {
62
+ html: html`
63
+ <div class='counter'>
64
+ ${() => {
65
+ let n = state.length;
66
+
67
+ if (n === 0) {
68
+ return '';
69
+ }
70
+
71
+ return html.reactive(state.render, function (value, i) {
72
+ if (isNaN(parseInt(value as string, 10))) {
73
+ return html`
74
+ <span class='counter-character counter-character--symbol'>
75
+ ${value}
76
+ </span>
77
+ `;
78
+ }
79
+
80
+ return html`
81
+ <div
82
+ class='
83
+ ${i > n - 3 && 'counter-character--fraction'}
84
+ counter-character
85
+ '
86
+ >
87
+ <div class='counter-character-track' style='${() => `--value: ${this[i]}`}'>
88
+ <span>9</span>
89
+ ${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((value) => html`<span>${value}</span>`)}
90
+ <span>0</span>
91
+ </div>
92
+ </div>
93
+ `;
94
+ })
95
+ }}
96
+ </div>
97
+ `,
98
+ state: api
99
+ };
94
100
  };
@@ -1,62 +1,64 @@
1
- .counter {
2
- display: flex;
3
- gap: 2px;
4
- place-items: center;
5
- transition: transform 0.5s 2s;
6
- transform-style: flat;
7
-
8
- &-character,
9
- &-character-track span {
10
- background: linear-gradient(hsl(0 0% 98%) 50%, hsl(0 0% 45%));
11
- background-attachment: fixed;
12
- background-clip: text;
13
- color: transparent;
14
- transform-style: flat;
15
- }
16
-
17
- &-character {
18
- display: grid;
19
- font-size: var(--font-size);
20
- font-variant: tabular-nums;
21
- font-weight: var(--font-weight);
22
- height: 1lh;
23
- line-height: var(--line-height);
24
- mask: linear-gradient(transparent, white calc(1lh * var(--mask-size)) calc(100% - (1lh * var(--mask-size))), transparent);
25
- overflow: hidden;
26
- transform-style: flat;
27
-
28
- &--fraction {
29
- font-size: calc(var(--font-size) * var(--scale));
30
- font-weight: var(--font-weight-300);
31
- opacity: var(--opacity);
32
- overflow: visible;
33
- height: var(--line-height);
34
-
35
- .counter-character-track {
36
- span {
37
- display: flex;
38
- flex-direction: column;
39
- align-items: end;
40
- padding: calc((var(--line-height) - var(--font-size)) * 0.2) 0;
41
- }
42
- }
43
- }
44
-
45
- &--symbol {
46
- font-size: calc(var(--font-size) * var(--scale));
47
- margin-right: 0.1ch;
48
- opacity: var(--opacity);
49
- }
50
-
51
- &-track {
52
- display: grid;
53
- translate: 0 calc((var(--value) + 1) * (var(--line-height) * -1));
54
- transition: translate var(--transition-duration) var(--timing-function);
55
-
56
- span {
57
- height: 1lh;
58
- transform-style: flat;
59
- }
60
- }
61
- }
1
+ @use './variables.scss';
2
+
3
+ .counter {
4
+ display: flex;
5
+ gap: 2px;
6
+ place-items: center;
7
+ transition: transform 0.5s 2s;
8
+ transform-style: flat;
9
+
10
+ &-character,
11
+ &-character-track span {
12
+ background: linear-gradient(hsl(0 0% 98%) 50%, hsl(0 0% 45%));
13
+ background-attachment: fixed;
14
+ background-clip: text;
15
+ color: transparent;
16
+ transform-style: flat;
17
+ }
18
+
19
+ &-character {
20
+ display: grid;
21
+ font-size: var(--font-size);
22
+ font-variant: tabular-nums;
23
+ font-weight: var(--font-weight);
24
+ height: 1lh;
25
+ line-height: var(--line-height);
26
+ mask: linear-gradient(transparent, white calc(1lh * var(--mask-size)) calc(100% - (1lh * var(--mask-size))), transparent);
27
+ overflow: hidden;
28
+ transform-style: flat;
29
+
30
+ &--fraction {
31
+ font-size: calc(var(--font-size) * var(--scale));
32
+ font-weight: var(--font-weight-300);
33
+ opacity: var(--opacity);
34
+ overflow: visible;
35
+ height: var(--line-height);
36
+
37
+ .counter-character-track {
38
+ span {
39
+ display: flex;
40
+ flex-direction: column;
41
+ align-items: end;
42
+ padding: calc((var(--line-height) - var(--font-size)) * 0.2) 0;
43
+ }
44
+ }
45
+ }
46
+
47
+ &--symbol {
48
+ font-size: calc(var(--font-size) * var(--scale));
49
+ margin-right: 0.1ch;
50
+ opacity: var(--opacity);
51
+ }
52
+
53
+ &-track {
54
+ display: grid;
55
+ translate: 0 calc((var(--value) + 1) * (var(--line-height) * -1));
56
+ transition: translate var(--transition-duration) var(--timing-function);
57
+
58
+ span {
59
+ height: 1lh;
60
+ transform-style: flat;
61
+ }
62
+ }
63
+ }
62
64
  }
@@ -1,27 +1,27 @@
1
- .counter {
2
- // TODO: Switch to clamped font size css variables
3
- --font-size: clamp(2rem, 4vw + 1rem, 8rem);
4
- --line-height: calc(var(--font-size) * 1.5);
5
- --mask-size: 0.24;
6
- --timing-function: var(--timing-bounce-out);
7
- --transition-duration: 2s;
8
-
9
- &-character {
10
- --font-weight: var(--font-weight-400);
11
- --scale: 1;
12
-
13
- &--fraction,
14
- &--symbol {
15
- --opacity: 0.8;
16
- }
17
-
18
- &--fraction {
19
- --font-weight: var(--font-weight-300);
20
- --scale: 0.75;
21
- }
22
-
23
- &--symbol:first-child {
24
- --scale: 0.8;
25
- }
26
- }
1
+ .counter {
2
+ // TODO: Switch to clamped font size css variables
3
+ --font-size: clamp(2rem, 4vw + 1rem, 8rem);
4
+ --line-height: calc(var(--font-size) * 1.5);
5
+ --mask-size: 0.24;
6
+ --timing-function: var(--timing-bounce-out);
7
+ --transition-duration: 2s;
8
+
9
+ &-character {
10
+ --font-weight: var(--font-weight-400);
11
+ --scale: 1;
12
+
13
+ &--fraction,
14
+ &--symbol {
15
+ --opacity: 0.8;
16
+ }
17
+
18
+ &--fraction {
19
+ --font-weight: var(--font-weight-300);
20
+ --scale: 0.75;
21
+ }
22
+
23
+ &--symbol:first-child {
24
+ --scale: 0.8;
25
+ }
26
+ }
27
27
  }
@@ -1,10 +1,11 @@
1
- import { html } from '@esportsplus/template';
2
-
3
-
4
- export default (attributes?: Record<string, string>) => html`
5
- <div class="ellipsis" ${attributes}>
6
- <span></span>
7
- <span></span>
8
- <span></span>
9
- </div>
1
+ import { html } from '@esportsplus/template';
2
+ import './scss/index.scss';
3
+
4
+
5
+ export default (attributes?: Record<string, string>) => html`
6
+ <div class="ellipsis" ${attributes}>
7
+ <span></span>
8
+ <span></span>
9
+ <span></span>
10
+ </div>
10
11
  `;
@@ -1,28 +1,30 @@
1
- .ellipsis {
2
- span {
3
- animation: Ellipsis var(--animation-duration) infinite linear;
4
- background-color: var(--color);
5
- border-radius: 100%;
6
- display: inline-block;
7
- height: var(--size);
8
- margin: 0 var(--margin-horizontal);
9
- width: var(--size);
10
-
11
- :nth-child(2) {
12
- animation-delay: 0.24s;
13
- }
14
-
15
- :nth-child(3) {
16
- animation-delay: 0.48s;
17
- }
18
- }
19
-
20
- @keyframes Ellipsis {
21
- 0%, 100% {
22
- opacity: 0.16;
23
- }
24
- 20% {
25
- opacity: 1;
26
- }
27
- }
1
+ @use './variables.scss';
2
+
3
+ .ellipsis {
4
+ span {
5
+ animation: ellipsis var(--animation-duration) infinite linear;
6
+ background-color: var(--color);
7
+ border-radius: 100%;
8
+ display: inline-block;
9
+ height: var(--size);
10
+ margin: 0 var(--margin-horizontal);
11
+ width: var(--size);
12
+
13
+ :nth-child(2) {
14
+ animation-delay: 0.24s;
15
+ }
16
+
17
+ :nth-child(3) {
18
+ animation-delay: 0.48s;
19
+ }
20
+ }
21
+
22
+ @keyframes ellipsis {
23
+ 0%, 100% {
24
+ opacity: 0.16;
25
+ }
26
+ 20% {
27
+ opacity: 1;
28
+ }
29
+ }
28
30
  }
@@ -1,5 +1,5 @@
1
- .ellipsis {
2
- --animation-duration: 1.24s;
3
- --marign-horizontal: var(--size-100);
4
- --size: var(--size-200);
1
+ .ellipsis {
2
+ --animation-duration: 1.24s;
3
+ --marign-horizontal: var(--size-100);
4
+ --size: var(--size-200);
5
5
  }
@@ -0,0 +1,71 @@
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { omit } from '@esportsplus/utilities';
4
+ import description from './description';
5
+
6
+
7
+ type Data = {
8
+ class?: string;
9
+ content?: unknown;
10
+ description?: unknown;
11
+ mask?: Record<string, unknown>;
12
+ name?: string;
13
+ style?: string;
14
+ tag?: Record<string, unknown>;
15
+ title: string;
16
+ value?: unknown;
17
+ } & Record<string, unknown>;
18
+
19
+
20
+ const FIELD_OMIT: (keyof Data)[] = ['content', 'description', 'mask', 'name', 'title', 'value'];
21
+
22
+
23
+ export default (data: Data) => {
24
+ let state = reactive({
25
+ active: false
26
+ });
27
+
28
+ return html`
29
+ <div
30
+ class='
31
+ ${() => state.active && '--active'}
32
+ field
33
+ --flex-column
34
+ '
35
+ onchange='${(e: Event) => {
36
+ if ((e.target as HTMLInputElement).type !== 'checkbox') {
37
+ return;
38
+ }
39
+
40
+ state.active = (e.target as HTMLInputElement)?.checked;
41
+ }}'
42
+ ${omit(data, FIELD_OMIT)}
43
+ >
44
+ <div class='field-title --flex-horizontal-space-between --flex-vertical'>
45
+ ${data.title}
46
+
47
+ <label
48
+ class='
49
+ ${data.mask?.class && String(data.mask.class).indexOf('field-mask--switch') !== -1 && 'field-mask--switch'}
50
+ field-mask
51
+ --margin-left --margin-400
52
+ '
53
+ ${data.mask}
54
+ >
55
+ <input
56
+ ${(data.class && data.class.indexOf('--active') !== -1) || data.value ? 'checked' : ''}
57
+ ${data.name && `name='${data.name}'`}
58
+ class='field-tag field-tag--hidden'
59
+ type='checkbox'
60
+ value='1'
61
+ ${data.tag}
62
+ >
63
+ </label>
64
+ </div>
65
+
66
+ ${data.content || ''}
67
+
68
+ ${description(data)}
69
+ </div>
70
+ `
71
+ };
@@ -0,0 +1,14 @@
1
+ import { html } from '@esportsplus/template';
2
+
3
+
4
+ export default (data: { description?: unknown }) => {
5
+ if (!data?.description) {
6
+ return '';
7
+ }
8
+
9
+ return html`
10
+ <div class='field-description'>
11
+ ${data.description}
12
+ </div>
13
+ `;
14
+ }
@@ -0,0 +1,16 @@
1
+ import { html } from '@esportsplus/template';
2
+
3
+
4
+ export default (data: { error: unknown }) => {
5
+ return () => {
6
+ if (!data.error) {
7
+ return '';
8
+ }
9
+
10
+ return html`
11
+ <div class='field-error --text-bold'>
12
+ ${data.error}
13
+ </div>
14
+ `;
15
+ };
16
+ }
@@ -0,0 +1,77 @@
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { omit, pick } from '@esportsplus/utilities';
4
+ import form from '../form';
5
+ import description from './description';
6
+ import error from './error';
7
+ import title from './title';
8
+
9
+
10
+ type Data = {
11
+ accept?: string;
12
+ class?: string;
13
+ description?: unknown;
14
+ mask?: {
15
+ content?: unknown;
16
+ } & Record<string, unknown>;
17
+ name?: string;
18
+ placeholder?: string;
19
+ required?: boolean;
20
+ style?: string;
21
+ tag?: Record<string, unknown>;
22
+ title?: unknown;
23
+ value?: unknown;
24
+ } & Record<string, unknown>;
25
+
26
+
27
+ const FIELD_OMIT: (keyof Data)[] = ['accept', 'mask', 'name', 'placeholder', 'value'];
28
+
29
+ const MASK_OMIT: (keyof NonNullable<Data['mask']>)[] = ['content'];
30
+
31
+ const TAG_PICK: (keyof Data)[] = ['accept', 'name', 'required', 'value'];
32
+
33
+
34
+ export default (data: Data) => {
35
+ let state = reactive({
36
+ active: false,
37
+ error: ''
38
+ });
39
+
40
+ data.mask ??= {};
41
+
42
+ data.tag ??= {};
43
+ data.tag.type = 'file';
44
+ data.tag.onrender = form.input.onrender(state);
45
+
46
+ return html`
47
+ <div
48
+ class='${() => state.active && '--active'} field --flex-column'
49
+ onfocusin='${() => {
50
+ state.active = true;
51
+ }}'
52
+ onfocusout='${() => {
53
+ state.active = false;
54
+ }}'
55
+ ${omit(data, FIELD_OMIT)}
56
+ >
57
+ ${title(data)}
58
+
59
+ <label
60
+ class='field-mask field-mask--input --flex-row'
61
+ style='cursor:pointer;'
62
+ ${omit(data.mask, MASK_OMIT)}
63
+ >
64
+ <input
65
+ class='field-tag field-tag--hidden'
66
+ ${pick(data, TAG_PICK)}
67
+ ${data.tag}
68
+ >
69
+
70
+ ${data.mask?.content || ''}
71
+ </label>
72
+
73
+ ${description(data)}
74
+ ${error(state)}
75
+ </div>
76
+ `;
77
+ };
@@ -0,0 +1,11 @@
1
+ import checkbox from './checkbox';
2
+ import file from './file';
3
+ import optional from './optional';
4
+ import select from './select';
5
+ import s from './switch';
6
+ import textarea from './textarea';
7
+ import text from './text';
8
+ import './scss/index.scss';
9
+
10
+
11
+ export default { checkbox, file, optional, select, switch: s, textarea, text };