@esportsplus/ui 0.53.0 → 0.54.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 (308) hide show
  1. package/README.md +51 -6
  2. package/build/components/accordion/index.d.ts +2 -19
  3. package/build/components/accordion/index.js +7 -7
  4. package/build/components/anchor/scss/index.scss +1 -1
  5. package/build/components/button/scss/index.scss +1 -1
  6. package/build/components/card/scss/index.scss +1 -1
  7. package/build/components/checkbox/index.d.ts +12 -12
  8. package/build/components/checkbox/index.js +64 -36
  9. package/build/components/checkbox/scss/index.scss +1 -1
  10. package/build/components/checkbox/svg/check.svg +1 -0
  11. package/build/components/clipboard/copy.d.ts +11 -0
  12. package/build/components/clipboard/copy.js +49 -0
  13. package/build/components/clipboard/index.d.ts +1435 -1229
  14. package/build/components/clipboard/index.js +3 -2
  15. package/build/components/clipboard/onclick.d.ts +4 -38
  16. package/build/components/clipboard/onclick.js +7 -7
  17. package/build/components/counter/index.js +58 -66
  18. package/build/components/counter/scss/index.scss +1 -1
  19. package/build/components/form/action.js +8 -8
  20. package/build/components/form/index.d.ts +4 -4
  21. package/build/components/form/input.d.ts +4 -4
  22. package/build/components/grid/scss/index.scss +1 -1
  23. package/build/components/icon/index.d.ts +2 -19
  24. package/build/components/icon/index.js +6 -6
  25. package/build/components/icon/scss/index.scss +1 -1
  26. package/build/components/index.d.ts +0 -7
  27. package/build/components/index.js +0 -7
  28. package/build/components/input/index.d.ts +1 -1
  29. package/build/components/input/index.js +11 -11
  30. package/build/components/input/scss/index.scss +1 -1
  31. package/build/components/link/scss/index.scss +1 -1
  32. package/build/components/loading/index.js +5 -5
  33. package/build/components/modal/scss/index.scss +1 -1
  34. package/build/components/normalize/scss/index.scss +1 -1
  35. package/build/components/overlay/index.d.ts +2 -19
  36. package/build/components/overlay/index.js +7 -7
  37. package/build/components/page/scss/index.scss +1 -1
  38. package/build/components/radio/index.d.ts +1436 -4
  39. package/build/components/radio/index.js +0 -1
  40. package/build/components/range/index.d.ts +1 -1
  41. package/build/components/range/index.js +13 -13
  42. package/build/components/range/scss/index.scss +1 -1
  43. package/build/components/root/scss/index.scss +1 -1
  44. package/build/components/select/index.d.ts +5 -48
  45. package/build/components/select/index.js +41 -53
  46. package/build/components/select/scss/index.scss +1 -1
  47. package/build/components/sidebar/index.d.ts +2 -19
  48. package/build/components/sidebar/index.js +7 -7
  49. package/build/components/sidebar/scss/index.scss +1 -1
  50. package/build/components/switch/index.d.ts +1436 -4
  51. package/build/components/switch/index.js +0 -1
  52. package/build/components/tabs/scss/index.scss +2 -0
  53. package/build/components/text/scss/index.scss +1 -1
  54. package/build/components/textarea/index.d.ts +719 -6
  55. package/build/components/textarea/index.js +37 -15
  56. package/build/components/textarea/scss/index.scss +1 -1
  57. package/build/components/toast/index.js +43 -43
  58. package/build/components/toast/scss/index.scss +1 -1
  59. package/build/components/tooltip/index.d.ts +2151 -2544
  60. package/build/components/tooltip/menu.d.ts +2 -18
  61. package/build/components/tooltip/menu.js +21 -21
  62. package/build/components/tooltip/onclick.d.ts +717 -1229
  63. package/build/components/tooltip/onclick.js +16 -52
  64. package/build/components/tooltip/onhover.d.ts +713 -20
  65. package/build/components/tooltip/onhover.js +9 -9
  66. package/build/components/tooltip/scss/index.scss +1 -1
  67. package/build/components/typewriter/index.d.ts +2 -19
  68. package/build/components/typewriter/index.js +8 -8
  69. package/build/css-utilities/background/scss/index.scss +1 -1
  70. package/build/css-utilities/border/scss/index.scss +1 -1
  71. package/build/css-utilities/color/scss/index.scss +1 -1
  72. package/build/css-utilities/font/geist/scss/Geist-Italic-Variable.woff2 +0 -0
  73. package/build/css-utilities/font/geist/scss/Geist-Variable.woff2 +0 -0
  74. package/build/css-utilities/font/geist/scss/GeistMono-Italic-Variable.woff2 +0 -0
  75. package/build/css-utilities/font/geist/scss/GeistMono-Variable.woff2 +0 -0
  76. package/build/css-utilities/font/geist/scss/index.scss +2 -0
  77. package/build/css-utilities/font/montserrat/index.d.ts +1 -0
  78. package/build/css-utilities/font/montserrat/index.js +1 -0
  79. package/build/css-utilities/font/montserrat/scss/index.scss +2 -0
  80. package/build/css-utilities/index.scss +1 -1
  81. package/build/css-utilities/inline/scss/index.scss +1 -1
  82. package/build/css-utilities/scrollbar/scss/index.scss +1 -1
  83. package/build/css-utilities/tabular/scss/index.scss +2 -0
  84. package/build/css-utilities/text/scss/index.scss +1 -1
  85. package/build/themes/dark/index.d.ts +0 -1
  86. package/build/themes/dark/index.js +0 -1
  87. package/build/themes/dark/input.d.ts +708 -114
  88. package/build/themes/dark/select.d.ts +732 -1406
  89. package/build/themes/dark/select.js +7 -5
  90. package/build/themes/dark/textarea.d.ts +716 -119
  91. package/package.json +12 -12
  92. package/pnpm-workspace.yaml +4 -3
  93. package/scripts/css-variables.test.mjs +50 -0
  94. package/scripts/sort-scss.md +57 -0
  95. package/scripts/sort-scss.mjs +233 -0
  96. package/scripts/sort-scss.test.mjs +217 -0
  97. package/src/components/anchor/scss/index.scss +2 -2
  98. package/src/components/button/scss/index.scss +23 -57
  99. package/src/components/button/scss/variables.scss +1 -19
  100. package/src/components/card/scss/index.scss +11 -46
  101. package/src/components/card/scss/variables.scss +1 -2
  102. package/src/components/checkbox/index.ts +27 -31
  103. package/src/components/checkbox/scss/index.scss +86 -28
  104. package/src/components/checkbox/scss/variables.scss +71 -30
  105. package/src/components/checkbox/svg/check.svg +1 -0
  106. package/src/components/clipboard/copy.ts +60 -0
  107. package/src/components/clipboard/index.ts +3 -2
  108. package/src/components/counter/index.ts +57 -57
  109. package/src/components/counter/scss/index.scss +4 -5
  110. package/src/components/counter/scss/variables.scss +0 -1
  111. package/src/components/form/input.ts +4 -3
  112. package/src/components/grid/scss/index.scss +1 -1
  113. package/src/components/icon/scss/variables.scss +0 -1
  114. package/src/components/index.ts +1 -8
  115. package/src/components/input/index.ts +1 -1
  116. package/src/components/input/scss/index.scss +8 -7
  117. package/src/components/input/scss/variables.scss +0 -1
  118. package/src/components/link/scss/index.scss +9 -34
  119. package/src/components/link/scss/variables.scss +0 -12
  120. package/src/components/modal/scss/index.scss +4 -4
  121. package/src/components/normalize/scss/index.scss +0 -1
  122. package/src/components/page/scss/index.scss +0 -6
  123. package/src/components/page/scss/variables.scss +0 -2
  124. package/src/components/radio/index.ts +0 -1
  125. package/src/components/range/index.ts +1 -1
  126. package/src/components/range/scss/index.scss +5 -5
  127. package/src/components/root/scss/index.scss +37 -63
  128. package/src/components/root/scss/variables.scss +37 -67
  129. package/src/components/select/index.ts +16 -33
  130. package/src/components/select/scss/index.scss +10 -7
  131. package/src/components/select/scss/variables.scss +0 -1
  132. package/src/components/sidebar/scss/index.scss +3 -3
  133. package/src/components/switch/index.ts +1 -2
  134. package/src/components/tabs/scss/index.scss +62 -0
  135. package/src/components/tabs/scss/variables.scss +4 -0
  136. package/src/components/text/scss/index.scss +8 -1
  137. package/src/components/text/scss/variables.scss +5 -3
  138. package/src/components/textarea/index.ts +38 -5
  139. package/src/components/textarea/scss/index.scss +24 -13
  140. package/src/components/textarea/scss/variables.scss +0 -1
  141. package/src/components/toast/scss/index.scss +1 -1
  142. package/src/components/tooltip/onclick.ts +11 -67
  143. package/src/components/tooltip/scss/index.scss +2 -3
  144. package/src/css-utilities/background/scss/variables.scss +2 -2
  145. package/src/css-utilities/border/scss/index.scss +1 -27
  146. package/src/css-utilities/border/scss/variables.scss +3 -34
  147. package/src/css-utilities/color/scss/variables.scss +2 -6
  148. package/src/css-utilities/font/geist/scss/Geist-Italic-Variable.woff2 +0 -0
  149. package/src/css-utilities/font/geist/scss/Geist-Variable.woff2 +0 -0
  150. package/src/css-utilities/font/geist/scss/GeistMono-Italic-Variable.woff2 +0 -0
  151. package/src/css-utilities/font/geist/scss/GeistMono-Variable.woff2 +0 -0
  152. package/src/css-utilities/font/geist/scss/index.scss +55 -0
  153. package/src/css-utilities/font/montserrat/index.ts +1 -0
  154. package/src/{fonts → css-utilities/font}/montserrat/scss/index.scss +15 -0
  155. package/src/css-utilities/index.scss +6 -12
  156. package/src/css-utilities/inline/scss/index.scss +0 -1
  157. package/src/css-utilities/scrollbar/scss/index.scss +42 -0
  158. package/src/css-utilities/tabular/scss/index.scss +3 -0
  159. package/src/css-utilities/text/scss/index.scss +30 -71
  160. package/src/lib/scss/css-variables.scss +29 -5
  161. package/src/themes/dark/index.ts +0 -1
  162. package/src/themes/dark/select.ts +7 -5
  163. package/src/tokens/index.scss +1 -3
  164. package/src/tokens/scss/border-radius.scss +1 -6
  165. package/src/tokens/scss/color.scss +3 -3
  166. package/src/tokens/scss/scale.scss +1 -1
  167. package/src/tokens/scss/size.scss +7 -0
  168. package/src/tokens/scss/transition.scss +4 -0
  169. package/storage/svg/arrow-left.svg +1 -0
  170. package/storage/svg/arrow-right.svg +1 -0
  171. package/storage/svg/book.svg +1 -0
  172. package/storage/svg/cube.svg +1 -0
  173. package/storage/svg/github.svg +1 -0
  174. package/storage/svg/info.svg +1 -0
  175. package/storage/svg/palette.svg +1 -0
  176. package/storage/svg/search.svg +2 -0
  177. package/storage/svg/type.svg +1 -0
  178. package/vite.config.ts +8 -3
  179. package/build/components/back/index.d.ts +0 -21
  180. package/build/components/back/index.js +0 -16
  181. package/build/components/back/scss/index.scss +0 -2
  182. package/build/components/back/svg/arrow.svg +0 -15
  183. package/build/components/bubble/scss/index.scss +0 -2
  184. package/build/components/button/index.d.ts +0 -103
  185. package/build/components/button/index.js +0 -60
  186. package/build/components/ellipsis/index.d.ts +0 -4
  187. package/build/components/ellipsis/index.js +0 -8
  188. package/build/components/ellipsis/scss/index.scss +0 -2
  189. package/build/components/frame/index.d.ts +0 -21
  190. package/build/components/frame/index.js +0 -13
  191. package/build/components/frame/scss/index.scss +0 -2
  192. package/build/components/highlight/index.d.ts +0 -22
  193. package/build/components/highlight/index.js +0 -56
  194. package/build/components/highlight/scss/index.scss +0 -2
  195. package/build/components/loader/index.d.ts +0 -22
  196. package/build/components/loader/index.js +0 -78
  197. package/build/components/loader/scss/index.scss +0 -2
  198. package/build/components/radio/scss/index.scss +0 -2
  199. package/build/components/root/index.d.ts +0 -7
  200. package/build/components/root/index.js +0 -4
  201. package/build/components/root/onclick.d.ts +0 -5
  202. package/build/components/root/onclick.js +0 -12
  203. package/build/components/switch/scss/index.scss +0 -2
  204. package/build/css-utilities/[margin,padding]/scss/index.scss +0 -2
  205. package/build/css-utilities/error/scss/index.scss +0 -2
  206. package/build/css-utilities/flicker/scss/index.scss +0 -2
  207. package/build/css-utilities/focus/scss/index.scss +0 -2
  208. package/build/css-utilities/gap/scss/index.scss +0 -2
  209. package/build/css-utilities/line-height/scss/index.scss +0 -2
  210. package/build/css-utilities/pointer/scss/index.scss +0 -2
  211. package/build/css-utilities/scroll-fade/scss/index.scss +0 -2
  212. package/build/css-utilities/size/scss/index.scss +0 -2
  213. package/build/css-utilities/viewport/scss/index.scss +0 -2
  214. package/build/css-utilities/width/scss/index.scss +0 -2
  215. package/build/fonts/index.d.ts +0 -1
  216. package/build/fonts/index.js +0 -1
  217. package/build/fonts/montserrat/scss/index.scss +0 -2
  218. package/build/themes/dark/back.d.ts +0 -19
  219. package/build/themes/dark/back.js +0 -7
  220. package/build/themes/dark/button/scss/index.scss +0 -2
  221. package/build/themes/dark/link/scss/index.scss +0 -2
  222. package/src/components/back/index.ts +0 -20
  223. package/src/components/back/scss/index.scss +0 -17
  224. package/src/components/back/svg/arrow.svg +0 -15
  225. package/src/components/bubble/scss/index.scss +0 -32
  226. package/src/components/bubble/scss/variables.scss +0 -20
  227. package/src/components/button/index.ts +0 -53
  228. package/src/components/ellipsis/index.ts +0 -11
  229. package/src/components/ellipsis/scss/index.scss +0 -30
  230. package/src/components/ellipsis/scss/variables.scss +0 -5
  231. package/src/components/frame/index.ts +0 -13
  232. package/src/components/frame/scss/index.scss +0 -39
  233. package/src/components/frame/scss/variables.scss +0 -4
  234. package/src/components/highlight/index.ts +0 -66
  235. package/src/components/highlight/scss/index.scss +0 -7
  236. package/src/components/highlight/scss/variables.scss +0 -4
  237. package/src/components/loader/index.ts +0 -80
  238. package/src/components/loader/scss/index.scss +0 -71
  239. package/src/components/loader/scss/variables.scss +0 -6
  240. package/src/components/radio/scss/index.scss +0 -50
  241. package/src/components/radio/scss/variables.scss +0 -67
  242. package/src/components/root/index.ts +0 -6
  243. package/src/components/root/onclick.ts +0 -20
  244. package/src/components/switch/scss/index.scss +0 -48
  245. package/src/components/switch/scss/variables.scss +0 -74
  246. package/src/css-utilities/[margin,padding]/scss/index.scss +0 -43
  247. package/src/css-utilities/[margin,padding]/scss/variables.scss +0 -54
  248. package/src/css-utilities/error/scss/index.scss +0 -24
  249. package/src/css-utilities/error/scss/variables.scss +0 -3
  250. package/src/css-utilities/flicker/scss/index.scss +0 -15
  251. package/src/css-utilities/flicker/scss/variables.scss +0 -5
  252. package/src/css-utilities/focus/scss/index.scss +0 -7
  253. package/src/css-utilities/focus/scss/variables.scss +0 -5
  254. package/src/css-utilities/gap/scss/index.scss +0 -13
  255. package/src/css-utilities/gap/scss/variables.scss +0 -39
  256. package/src/css-utilities/line-height/scss/index.scss +0 -1
  257. package/src/css-utilities/line-height/scss/variables.scss +0 -10
  258. package/src/css-utilities/pointer/scss/index.scss +0 -5
  259. package/src/css-utilities/scroll-fade/scss/index.scss +0 -47
  260. package/src/css-utilities/scroll-fade/scss/variables.scss +0 -3
  261. package/src/css-utilities/size/scss/index.scss +0 -1
  262. package/src/css-utilities/size/scss/variables.scss +0 -12
  263. package/src/css-utilities/text/scss/variables.scss +0 -31
  264. package/src/css-utilities/viewport/scss/index.scss +0 -5
  265. package/src/css-utilities/width/scss/index.scss +0 -5
  266. package/src/css-utilities/width/scss/variables.scss +0 -9
  267. package/src/fonts/index.ts +0 -1
  268. package/src/themes/dark/back.ts +0 -9
  269. package/src/themes/dark/button/scss/index.scss +0 -46
  270. package/src/themes/dark/link/scss/index.scss +0 -26
  271. package/src/tokens/scss/font-weight.scss +0 -6
  272. package/src/tokens/scss/line-height.scss +0 -9
  273. package/src/tokens/scss/transition-duration.scss +0 -1
  274. /package/build/{fonts/montserrat → css-utilities/font/geist}/index.d.ts +0 -0
  275. /package/build/{fonts/montserrat → css-utilities/font/geist}/index.js +0 -0
  276. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff +0 -0
  277. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff2 +0 -0
  278. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
  279. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
  280. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff +0 -0
  281. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff2 +0 -0
  282. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff +0 -0
  283. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff2 +0 -0
  284. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
  285. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
  286. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff +0 -0
  287. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff2 +0 -0
  288. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff +0 -0
  289. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
  290. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
  291. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
  292. /package/src/{fonts/montserrat → css-utilities/font/geist}/index.ts +0 -0
  293. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff +0 -0
  294. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff2 +0 -0
  295. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
  296. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
  297. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff +0 -0
  298. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff2 +0 -0
  299. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff +0 -0
  300. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff2 +0 -0
  301. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
  302. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
  303. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff +0 -0
  304. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff2 +0 -0
  305. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff +0 -0
  306. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
  307. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
  308. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
@@ -0,0 +1,60 @@
1
+ import { component, html, type Attributes, type Renderable } from '@esportsplus/template';
2
+ import { reactive } from '@esportsplus/reactivity';
3
+ import { omit } from '@esportsplus/utilities';
4
+ import write from './write';
5
+
6
+
7
+ type A = Attributes & {
8
+ onerror?: () => void;
9
+ timeout?: number;
10
+ value: string;
11
+ };
12
+
13
+
14
+ const OMIT = ['onerror', 'timeout', 'value'];
15
+
16
+
17
+ export default component<A, (state: { copied: boolean }) => Renderable<unknown>>(
18
+ (attributes, content) => {
19
+ let state = reactive({ copied: false }),
20
+ timer: ReturnType<typeof setTimeout> | undefined,
21
+ connected = true;
22
+
23
+ return html`
24
+ <button
25
+ type='button'
26
+ ${omit(attributes, OMIT)}
27
+ ${{
28
+ onconnect: () => { connected = true; },
29
+ ondisconnect: () => {
30
+ connected = false;
31
+ clearTimeout(timer);
32
+ state.copied = false;
33
+ },
34
+ onclick: async (event: MouseEvent) => {
35
+ event.preventDefault();
36
+ event.stopPropagation();
37
+
38
+ let copied = await write(attributes.value);
39
+
40
+ if (!connected) {
41
+ return;
42
+ }
43
+
44
+ clearTimeout(timer);
45
+ state.copied = copied;
46
+
47
+ if (!copied) {
48
+ attributes.onerror?.();
49
+ return;
50
+ }
51
+
52
+ timer = setTimeout(() => { state.copied = false; }, attributes.timeout ?? 3000);
53
+ }
54
+ }}
55
+ >
56
+ ${() => content(state)}
57
+ </button>
58
+ `;
59
+ }
60
+ );
@@ -1,6 +1,7 @@
1
+ import copy from './copy';
1
2
  import onclick from './onclick';
2
3
  import write from './write';
3
4
 
4
5
 
5
- export default { onclick, write };
6
- export { onclick, write };
6
+ export default { copy, onclick, write };
7
+ export { copy, onclick, write };
@@ -1,5 +1,5 @@
1
1
  import { html, type Attributes } from '@esportsplus/template';
2
- import { effect, reactive } from '@esportsplus/reactivity';
2
+ import { effect, onCleanup, reactive, untrack } from '@esportsplus/reactivity';
3
3
  import { omit } from '@esportsplus/utilities';
4
4
  import './scss/index.scss';
5
5
 
@@ -27,88 +27,88 @@ export default (attributes: Attributes & {
27
27
  style: 'currency',
28
28
  currency: currency || 'USD'
29
29
  }),
30
- rendering = true,
31
- state = reactive({
32
- length: 0,
33
- test: () => 'sds',
34
- render: [] as string[]
35
- }),
36
- render = reactive([] as string[]);
30
+ animation = reactive({ started: false }),
31
+ render = reactive([] as { digit: boolean; value: string }[]);
37
32
 
38
33
  decimals ??= 2;
39
34
 
40
- effect(() => {
41
- if (api.value !== -1) {
42
- value = api.value;
43
- }
44
-
45
- let padding = (max || value).toFixed(decimals).length - value.toFixed(decimals).length,
46
- values = value.toString().padStart( value.toString().length + padding, '1') as any;
47
-
48
- if (formatter) {
49
- values = formatter.format(values);
50
- }
51
- else {
52
- values = Number(values).toLocaleString([], {
53
- minimumFractionDigits: 0,
54
- maximumFractionDigits: decimals
55
- });
56
- }
57
-
58
- values = values.split('');
35
+ let stop = effect(() => {
36
+ let target = api.value === -1 ? value : api.value,
37
+ started = animation.started;
59
38
 
60
- if (suffix) {
61
- values.push(' ', ...suffix.split(''));
62
- }
39
+ let padding = (max || target).toFixed(decimals).length - target.toFixed(decimals).length,
40
+ values = target.toString().padStart(target.toString().length + padding, '1') as any;
63
41
 
64
- state.length = values.length;
42
+ if (formatter) {
43
+ values = formatter.format(values);
44
+ }
45
+ else {
46
+ values = Number(values).toLocaleString([], {
47
+ minimumFractionDigits: 0,
48
+ maximumFractionDigits: decimals
49
+ });
50
+ }
65
51
 
66
- for (let i = 0, n = values.length; i < n; i++) {
67
- let value = values[i];
52
+ values = values.split('');
68
53
 
69
- if (!isNaN(parseInt(value, 10)) && (rendering === true || padding > 0)) {
70
- padding--;
71
- value = '0';
54
+ if (suffix) {
55
+ values.push(' ', ...suffix.split(''));
72
56
  }
73
57
 
74
- render[i] = value;
75
- }
58
+ untrack(() => {
59
+ for (let i = 0, n = values.length; i < n; i++) {
60
+ let value = values[i],
61
+ digit = !isNaN(parseInt(value, 10));
76
62
 
77
- if (rendering === true) {
78
- rendering = false;
79
- setTimeout(() => api.value = value, delay || 1000);
80
- }
81
- });
63
+ if (digit && (!started || padding > 0)) {
64
+ padding--;
65
+ value = '0';
66
+ }
82
67
 
83
- return html`
84
- <div class='counter' ${omit(attributes, OMIT)}>
85
- ${() => {
86
- let n = state.length;
68
+ // Preserve the track so CSS can transition between digit positions.
69
+ if (render[i]?.digit === digit) {
70
+ render[i].value = value;
71
+ }
72
+ else {
73
+ let character = reactive({ digit, value });
87
74
 
88
- if (n === 0) {
89
- return '';
75
+ render[i] = character;
76
+ }
77
+ }
78
+
79
+ if (render.length > values.length) {
80
+ render.splice(values.length);
90
81
  }
82
+ });
83
+ }),
84
+ timer = setTimeout(() => animation.started = true, delay ?? 1000);
91
85
 
92
- return html.reactive(render, function (value) {
93
- if (isNaN(parseInt(value, 10))) {
86
+ onCleanup(() => {
87
+ clearTimeout(timer);
88
+ stop();
89
+ });
90
+
91
+ return html`
92
+ <div class='counter' ${omit(attributes, OMIT)}>
93
+ ${html.reactive(render, function (character) {
94
+ if (!character.digit) {
94
95
  return html`
95
96
  <span class='counter-character counter-character--symbol'>
96
- ${value}
97
+ ${() => character.value}
97
98
  </span>
98
99
  `;
99
100
  }
100
101
 
101
102
  return html`
102
- <div class=' counter-character'>
103
- <div class='counter-character-track' style='${`--value: ${value}`}'>
103
+ <div class='counter-character'>
104
+ <div class='counter-character-track' style='${() => `--value: ${character.value}`}'>
104
105
  <span>9</span>
105
106
  ${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((value) => html`<span>${value}</span>`)}
106
107
  <span>0</span>
107
108
  </div>
108
109
  </div>
109
110
  `;
110
- });
111
- }}
111
+ })}
112
112
  </div>
113
113
  `;
114
- };
114
+ };
@@ -22,7 +22,6 @@
22
22
  font-variant: tabular-nums;
23
23
  font-weight: var(--font-weight);
24
24
  height: 1lh;
25
- line-height: var(--line-height);
26
25
  mask: linear-gradient(transparent, white calc(1lh * var(--mask-size)) calc(100% - (1lh * var(--mask-size))), transparent);
27
26
  overflow: hidden;
28
27
  transform-style: flat;
@@ -32,14 +31,14 @@
32
31
  font-weight: var(--font-weight-300);
33
32
  opacity: var(--opacity);
34
33
  overflow: visible;
35
- height: var(--line-height);
34
+ height: 1lh;
36
35
 
37
36
  .counter-character-track {
38
37
  span {
39
38
  display: flex;
40
39
  flex-direction: column;
41
40
  align-items: end;
42
- padding: calc((var(--line-height) - var(--font-size)) * 0.2) 0;
41
+ padding: calc((1lh - 1em) * 0.2) 0;
43
42
  }
44
43
  }
45
44
  }
@@ -52,7 +51,7 @@
52
51
 
53
52
  &-track {
54
53
  display: grid;
55
- translate: 0 calc((var(--value) + 1) * (var(--line-height) * -1));
54
+ translate: 0 calc((var(--value) + 1) * (1lh * -1));
56
55
  transition: translate var(--transition-duration) var(--timing-function);
57
56
 
58
57
  span {
@@ -61,4 +60,4 @@
61
60
  }
62
61
  }
63
62
  }
64
- }
63
+ }
@@ -2,7 +2,6 @@
2
2
  // TODO: Switch to clamped font size css variables
3
3
  --font-size: clamp(2rem, 4vw + 1rem, 8rem);
4
4
  --font-weight: var(--font-weight-400);
5
- --line-height: calc(var(--font-size) * 1.5);
6
5
  --mask-size: 0.24;
7
6
  --timing-function: var(--timing-bounce-out);
8
7
  --transition-duration: 2s;
@@ -1,18 +1,19 @@
1
1
  import { Element } from '@esportsplus/template';
2
2
 
3
3
 
4
+ // TODO: Needs to be expanded and we need better type for template
4
5
  const KEY = Symbol();
5
6
 
6
7
 
7
- const get = (element?: Element) => {
8
+ const get = <T extends { error: string }>(element?: Element) => {
8
9
  if (element) {
9
- return element[KEY] as { error: string } | undefined;
10
+ return element[KEY] as T | undefined;
10
11
  }
11
12
 
12
13
  return undefined;
13
14
  };
14
15
 
15
- const onrender = (reactive: { error: string }) => {
16
+ const onrender = <T extends { error: string }>(reactive: T) => {
16
17
  return (element: Element) => {
17
18
  element[KEY] = reactive;
18
19
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  .grid {
4
4
  display: grid;
5
- grid-gap: var(--gap-horizontal) var(--gap-vertical);
5
+ grid-gap: var(--gap-vertical) var(--gap-horizontal);
6
6
  grid-template-columns: repeat(auto-fit, minmax(var(--min-width), var(--max-width)));
7
7
  position: relative;
8
8
 
@@ -1,7 +1,6 @@
1
1
  .icon {
2
2
  --color: inherit;
3
3
  --height: var(--size);
4
- --margin-horizontal: var(--size-300);
5
4
  --size: var(--size-400);
6
5
  --width: var(--size);
7
6
  }
@@ -1,23 +1,16 @@
1
1
  export { default as accordion } from './accordion';
2
- export { default as back } from './back';
3
- export { default as button } from './button';
4
2
  export { default as checkbox } from './checkbox';
5
3
  export { default as clipboard } from './clipboard';
6
4
  export { default as counter } from './counter';
7
- export { default as ellipsis } from './ellipsis';
8
5
  export { default as form } from './form';
9
- export { default as frame } from './frame';
10
- export { default as highlight } from './highlight';
11
6
  export { default as icon } from './icon';
12
7
  export { default as input } from './input';
13
8
  export { default as json } from './json';
14
- export { default as loader } from './loader';
15
9
  export { default as loading } from './loading';
16
10
  export { default as number } from './number';
17
11
  export { default as overlay } from './overlay';
18
12
  export { default as radio } from './radio';
19
13
  export { default as range } from './range';
20
- export { default as root } from './root';
21
14
  export { default as select } from './select';
22
15
  export { default as switch } from './switch';
23
16
  export { default as sidebar } from './sidebar';
@@ -25,4 +18,4 @@ export { default as textarea } from './textarea';
25
18
  export { default as toaster, toast } from './toast';
26
19
  export { default as tooltip } from './tooltip';
27
20
  export { default as truncate } from './truncate';
28
- export { default as typewriter } from './typewriter';
21
+ export { default as typewriter } from './typewriter';
@@ -5,7 +5,7 @@ import './scss/index.scss';
5
5
 
6
6
 
7
7
  export default function (
8
- this: { attributes?: Attributes },
8
+ this: { attributes?: Attributes } | void,
9
9
  attributes: Attributes & { state?: { active: boolean, error: string } }
10
10
  ) {
11
11
  let state = attributes.state || reactive({
@@ -11,21 +11,22 @@
11
11
  flex: 1 1 auto;
12
12
  flex-wrap: wrap;
13
13
  font-size: var(--font-size);
14
- line-height: var(--line-height);
15
14
  // Necessary To Maintain Height Of Hidden Password Fields In Floating Modals
16
15
  // - Password Managers Cause Problems When Fields Are Not Using 'display:hidden' On Password Fields
17
16
  min-height: calc((var(--padding-vertical) * 2) + var(--size));
18
17
  min-width: 0;
19
18
  overflow: hidden;
20
- padding: var(--padding-vertical) var(--padding-horizontal);
19
+ padding:
20
+ max(0px, calc(var(--padding-vertical) - var(--border-width)))
21
+ max(0px, calc(var(--padding-horizontal) - var(--border-width)));
21
22
  position: relative;
22
23
  text-overflow: ellipsis;
23
24
  transition:
24
- background var(--transition-duration) ease-in-out,
25
- border-color var(--transition-duration) ease-in-out,
26
- box-shadow var(--transition-duration) ease-in-out,
27
- opacity var(--transition-duration) ease-in-out,
28
- transform var(--transition-duration) ease-in-out;
25
+ background var(--transition-duration) var(--transition-timing-function),
26
+ border-color var(--transition-duration) var(--transition-timing-function),
27
+ box-shadow var(--transition-duration) var(--transition-timing-function),
28
+ opacity var(--transition-duration) var(--transition-timing-function),
29
+ transform var(--transition-duration) var(--transition-timing-function);
29
30
  white-space: nowrap;
30
31
  width: 100%;
31
32
 
@@ -19,7 +19,6 @@
19
19
  --color-hover: var(--color-default);
20
20
  --color-pressed: var(--color-default);
21
21
  --font-size: var(--font-size-400);
22
- --line-height: var(--line-height-400);
23
22
  --padding-horizontal: var(--size-400);
24
23
  --padding-vertical: var(--size-400);
25
24
  --size: var(--size-400);
@@ -1,47 +1,22 @@
1
1
  @use '/lib';
2
2
  @use '/tokens';
3
3
  @use 'variables';
4
+ @use '../../text/scss/index';
4
5
 
5
6
  .link {
7
+ @extend .text;
6
8
  align-content: center;
7
9
  background: var(--background);
8
- color: var(--color);
9
10
  cursor: pointer;
10
- display: flex;
11
11
  flex-wrap: wrap;
12
- font-size: var(--font-size);
13
12
  justify-content: flex-start;
14
- line-height: var(--line-height);
15
- padding: calc(var(--padding-vertical) - var(--border-width)) calc(var(--padding-horizontal) - var(--border-width));
13
+ padding:
14
+ max(0px, calc(var(--padding-vertical) - var(--border-width)))
15
+ max(0px, calc(var(--padding-horizontal) - var(--border-width)));
16
16
  position: relative;
17
17
  transition:
18
- background var(--transition-duration) ease-in-out,
19
- border-color var(--transition-duration) ease-in-out,
20
- color var(--transition-duration) ease-in-out,
21
- opacity var(--transition-duration) ease-in-out;
22
- width: var(--width);
23
-
24
-
25
- &--underline {
26
- @include tokens.state(active hover) {
27
- text-decoration: underline;
28
- }
29
- }
30
-
31
-
32
- &-hover {
33
- transition: opacity 0.3s ease-in-out, 0.3s cubic-bezier(0.23, 0.65, 0.74, 1.09);
34
-
35
- &--one {
36
- transform: translateY(0);
37
- }
38
-
39
- &--two {
40
- @include lib.position(absolute, center);
41
- opacity: 0;
42
- padding: 0 var(--padding-horizontal);
43
- transform: translate(50%, 125%);
44
- white-space: nowrap;
45
- }
46
- }
18
+ background var(--transition-duration) var(--transition-timing-function),
19
+ border-color var(--transition-duration) var(--transition-timing-function),
20
+ color var(--transition-duration) var(--transition-timing-function),
21
+ opacity var(--transition-duration) var(--transition-timing-function);
47
22
  }
@@ -11,19 +11,7 @@
11
11
  --border-color-default: var(--background);
12
12
  --border-color-hover: var(--border-color-default);
13
13
  --border-color-pressed: var(--border-color-default);
14
- --border-radius: var(--border-radius-400);
15
- --border-width: 0px;
16
- --color: var(--color-default);
17
- --color-active: var(--color-default);
18
- --color-default: var(--color-text-400);
19
- --color-hover: var(--color-default);
20
- --color-pressed: var(--color-default);
21
- --font-size: var(--font-size-400);
22
- --font-weight: var(--font-weight-500);
23
- --line-height: var(--line-height-400);
24
14
  --padding-horizontal: 0px;
25
- --padding-vertical: var(--size-400);
26
- --width: auto;
27
15
 
28
16
 
29
17
  @include tokens.state(active) {
@@ -5,8 +5,8 @@
5
5
  .modal {
6
6
  margin: auto;
7
7
  transition:
8
- opacity var(--transition-duration) ease-in-out,
9
- transform var(--transition-duration) ease-in-out;
8
+ opacity var(--transition-duration) var(--transition-timing-function),
9
+ transform var(--transition-duration) var(--transition-timing-function);
10
10
  transform-origin: center;
11
11
  width: min(var(--max-width), calc(100% - (var(--margin-horizontal) * 2)));
12
12
  z-index: 9;
@@ -23,8 +23,8 @@
23
23
 
24
24
  &-frame {
25
25
  transition:
26
- opacity var(--transition-duration) ease-in-out,
27
- transform var(--transition-duration) ease-in-out;
26
+ opacity var(--transition-duration) var(--transition-timing-function),
27
+ transform var(--transition-duration) var(--transition-timing-function);
28
28
  transform-origin: center;
29
29
 
30
30
  @include tokens.state(inactive) {
@@ -9,7 +9,6 @@ textarea {
9
9
  border: 0;
10
10
  font-family: inherit;
11
11
  font-size: inherit;
12
- line-height: inherit;
13
12
  margin: 0;
14
13
  padding: 0;
15
14
 
@@ -14,7 +14,6 @@
14
14
  &-title {
15
15
  color: var(--color);
16
16
  display: block;
17
- line-height: var(--line-height);
18
17
  position: relative;
19
18
  width: 100%;
20
19
  z-index: 1;
@@ -25,11 +24,6 @@
25
24
  font-size: var(--font-size);
26
25
  }
27
26
 
28
- &-suptitle + &-title,
29
- &-title + &-subtitle {
30
- margin-top: var(--margin-vertical);
31
- }
32
-
33
27
  &-title {
34
28
  text-wrap: balance;
35
29
  }
@@ -7,12 +7,10 @@
7
7
  --color: var(--color-default);
8
8
  --color-default: var(--color-text-400);
9
9
  --font-size: var(--font-size-400);
10
- --line-height: var(--line-height-400);
11
10
  }
12
11
 
13
12
  &-title {
14
13
  --color: var(--color-default);
15
14
  --color-default: var(--color-text-500);
16
- --line-height: var(--line-height-400);
17
15
  }
18
16
  }
@@ -1,5 +1,4 @@
1
1
  import { factory } from '~/components/checkbox';
2
- import './scss/index.scss';
3
2
 
4
3
 
5
4
  export default factory('radio');
@@ -5,7 +5,7 @@ import './scss/index.scss';
5
5
 
6
6
 
7
7
  export default function(
8
- this: { attributes?: Attributes } | any,
8
+ this: { attributes?: Attributes } | void,
9
9
  attributes: Attributes & { max: number, min: number, state?: { active: boolean, error: string, value: number } }
10
10
  ) {
11
11
  let { max, min } = attributes,
@@ -7,11 +7,11 @@
7
7
  height: var(--height);
8
8
  margin: calc(var(--margin-vertical) + ((var(--thumb-size) - var(--height)) / 2)) var(--margin-horizontal);
9
9
  transition:
10
- background var(--transition-duration) ease-in-out,
11
- border-color var(--transition-duration) ease-in-out,
12
- box-shadow var(--transition-duration) ease-in-out,
13
- opacity var(--transition-duration) ease-in-out,
14
- transform var(--transition-duration) ease-in-out;
10
+ background var(--transition-duration) var(--transition-timing-function),
11
+ border-color var(--transition-duration) var(--transition-timing-function),
12
+ box-shadow var(--transition-duration) var(--transition-timing-function),
13
+ opacity var(--transition-duration) var(--transition-timing-function),
14
+ transform var(--transition-duration) var(--transition-timing-function);
15
15
  width: var(--width);
16
16
 
17
17
  &::-moz-range-thumb,