@esportsplus/ui 0.53.0 → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/README.md +51 -6
  2. package/build/components/accordion/index.d.ts +714 -23
  3. package/build/components/accordion/index.js +22 -11
  4. package/build/components/accordion/scss/index.scss +1 -1
  5. package/build/components/anchor/scss/index.scss +1 -1
  6. package/build/components/button/scss/index.scss +1 -1
  7. package/build/components/card/scss/index.scss +1 -1
  8. package/build/components/checkbox/constants.d.ts +2 -0
  9. package/build/components/checkbox/constants.js +2 -0
  10. package/build/components/checkbox/index.d.ts +16 -10
  11. package/build/components/checkbox/index.js +53 -39
  12. package/build/components/checkbox/scss/index.scss +1 -1
  13. package/build/components/checkbox/svg/check.svg +1 -0
  14. package/build/components/clipboard/copy.d.ts +11 -0
  15. package/build/components/clipboard/copy.js +54 -0
  16. package/build/components/clipboard/index.d.ts +1435 -1229
  17. package/build/components/clipboard/index.js +3 -2
  18. package/build/components/clipboard/onclick.d.ts +4 -38
  19. package/build/components/clipboard/onclick.js +10 -12
  20. package/build/components/counter/index.d.ts +1 -1
  21. package/build/components/counter/index.js +59 -71
  22. package/build/components/counter/scss/index.scss +1 -1
  23. package/build/components/form/action.d.ts +1 -1
  24. package/build/components/form/action.js +9 -12
  25. package/build/components/form/index.d.ts +5 -5
  26. package/build/components/form/input.d.ts +4 -4
  27. package/build/components/grid/scss/index.scss +1 -1
  28. package/build/components/icon/index.d.ts +2 -19
  29. package/build/components/icon/index.js +6 -6
  30. package/build/components/icon/scss/index.scss +1 -1
  31. package/build/components/index.d.ts +0 -7
  32. package/build/components/index.js +0 -7
  33. package/build/components/input/index.d.ts +1 -1
  34. package/build/components/input/index.js +12 -13
  35. package/build/components/input/scss/index.scss +1 -1
  36. package/build/components/link/scss/index.scss +1 -1
  37. package/build/components/loading/index.js +5 -5
  38. package/build/components/modal/scss/index.scss +1 -1
  39. package/build/components/normalize/scss/index.scss +1 -1
  40. package/build/components/overlay/index.d.ts +2 -19
  41. package/build/components/overlay/index.js +7 -7
  42. package/build/components/page/scss/index.scss +1 -1
  43. package/build/components/radio/index.d.ts +3 -10
  44. package/build/components/radio/index.js +2 -2
  45. package/build/components/range/index.d.ts +1 -1
  46. package/build/components/range/index.js +13 -13
  47. package/build/components/range/scss/index.scss +1 -1
  48. package/build/components/root/scss/index.scss +1 -1
  49. package/build/components/select/constants.d.ts +4 -0
  50. package/build/components/select/constants.js +4 -0
  51. package/build/components/select/index.d.ts +15 -52
  52. package/build/components/select/index.js +65 -94
  53. package/build/components/select/scss/index.scss +1 -1
  54. package/build/components/sidebar/index.d.ts +2 -19
  55. package/build/components/sidebar/index.js +7 -7
  56. package/build/components/sidebar/scss/index.scss +1 -1
  57. package/build/components/switch/index.d.ts +3 -10
  58. package/build/components/switch/index.js +2 -2
  59. package/build/components/tabs/scss/index.scss +2 -0
  60. package/build/components/text/scss/index.scss +1 -1
  61. package/build/components/textarea/index.d.ts +719 -6
  62. package/build/components/textarea/index.js +36 -17
  63. package/build/components/textarea/scss/index.scss +1 -1
  64. package/build/components/toast/index.js +43 -43
  65. package/build/components/toast/scss/index.scss +1 -1
  66. package/build/components/tooltip/constants.d.ts +3 -0
  67. package/build/components/tooltip/constants.js +3 -0
  68. package/build/components/tooltip/index.d.ts +8 -2546
  69. package/build/components/tooltip/index.js +2 -1
  70. package/build/components/tooltip/menu.d.ts +9 -21
  71. package/build/components/tooltip/menu.js +26 -29
  72. package/build/components/tooltip/onclick.d.ts +717 -1229
  73. package/build/components/tooltip/onclick.js +18 -60
  74. package/build/components/tooltip/onhover.d.ts +716 -20
  75. package/build/components/tooltip/onhover.js +14 -19
  76. package/build/components/tooltip/scss/index.scss +1 -1
  77. package/build/components/typewriter/index.d.ts +2 -19
  78. package/build/components/typewriter/index.js +8 -8
  79. package/build/css-utilities/background/scss/index.scss +1 -1
  80. package/build/css-utilities/border/scss/index.scss +1 -1
  81. package/build/css-utilities/color/scss/index.scss +1 -1
  82. package/build/css-utilities/font/geist/scss/Geist-Italic-Variable.woff2 +0 -0
  83. package/build/css-utilities/font/geist/scss/Geist-Variable.woff2 +0 -0
  84. package/build/css-utilities/font/geist/scss/GeistMono-Italic-Variable.woff2 +0 -0
  85. package/build/css-utilities/font/geist/scss/GeistMono-Variable.woff2 +0 -0
  86. package/build/css-utilities/font/geist/scss/index.scss +2 -0
  87. package/build/css-utilities/font/montserrat/index.d.ts +1 -0
  88. package/build/css-utilities/font/montserrat/index.js +1 -0
  89. package/build/css-utilities/font/montserrat/scss/index.scss +2 -0
  90. package/build/css-utilities/index.scss +1 -1
  91. package/build/css-utilities/inline/scss/index.scss +1 -1
  92. package/build/css-utilities/scrollbar/scss/index.scss +1 -1
  93. package/build/css-utilities/tabular/scss/index.scss +2 -0
  94. package/build/css-utilities/text/scss/index.scss +1 -1
  95. package/build/themes/dark/index.d.ts +0 -1
  96. package/build/themes/dark/index.js +0 -1
  97. package/build/themes/dark/input.d.ts +709 -115
  98. package/build/themes/dark/select.d.ts +3 -1409
  99. package/build/themes/dark/select.js +12 -9
  100. package/build/themes/dark/textarea.d.ts +716 -119
  101. package/package.json +12 -12
  102. package/pnpm-workspace.yaml +4 -3
  103. package/scripts/css-variables.test.mjs +50 -0
  104. package/scripts/sort-scss.md +57 -0
  105. package/scripts/sort-scss.mjs +233 -0
  106. package/scripts/sort-scss.test.mjs +217 -0
  107. package/src/components/accordion/index.ts +7 -14
  108. package/src/components/accordion/scss/index.scss +3 -1
  109. package/src/components/anchor/scss/index.scss +2 -2
  110. package/src/components/button/scss/index.scss +23 -57
  111. package/src/components/button/scss/variables.scss +1 -19
  112. package/src/components/card/scss/index.scss +11 -46
  113. package/src/components/card/scss/variables.scss +1 -2
  114. package/src/components/checkbox/constants.ts +4 -0
  115. package/src/components/checkbox/index.ts +20 -35
  116. package/src/components/checkbox/scss/index.scss +86 -28
  117. package/src/components/checkbox/scss/variables.scss +71 -30
  118. package/src/components/checkbox/svg/check.svg +1 -0
  119. package/src/components/clipboard/copy.ts +55 -0
  120. package/src/components/clipboard/index.ts +3 -2
  121. package/src/components/clipboard/onclick.ts +4 -9
  122. package/src/components/counter/index.ts +57 -66
  123. package/src/components/counter/scss/index.scss +4 -5
  124. package/src/components/counter/scss/variables.scss +0 -1
  125. package/src/components/form/action.ts +2 -8
  126. package/src/components/form/input.ts +4 -3
  127. package/src/components/grid/scss/index.scss +1 -1
  128. package/src/components/icon/scss/variables.scss +0 -1
  129. package/src/components/index.ts +1 -8
  130. package/src/components/input/index.ts +8 -6
  131. package/src/components/input/scss/index.scss +8 -7
  132. package/src/components/input/scss/variables.scss +0 -1
  133. package/src/components/link/scss/index.scss +9 -34
  134. package/src/components/link/scss/variables.scss +0 -12
  135. package/src/components/modal/scss/index.scss +4 -4
  136. package/src/components/normalize/scss/index.scss +0 -1
  137. package/src/components/page/scss/index.scss +0 -6
  138. package/src/components/page/scss/variables.scss +0 -2
  139. package/src/components/radio/index.ts +5 -3
  140. package/src/components/range/index.ts +1 -1
  141. package/src/components/range/scss/index.scss +5 -5
  142. package/src/components/root/scss/index.scss +37 -63
  143. package/src/components/root/scss/variables.scss +37 -67
  144. package/src/components/select/constants.ts +8 -0
  145. package/src/components/select/index.ts +49 -70
  146. package/src/components/select/scss/index.scss +10 -7
  147. package/src/components/select/scss/variables.scss +0 -1
  148. package/src/components/sidebar/scss/index.scss +3 -3
  149. package/src/components/switch/index.ts +5 -3
  150. package/src/components/tabs/scss/index.scss +62 -0
  151. package/src/components/tabs/scss/variables.scss +4 -0
  152. package/src/components/text/scss/index.scss +8 -1
  153. package/src/components/text/scss/variables.scss +5 -3
  154. package/src/components/textarea/index.ts +45 -13
  155. package/src/components/textarea/scss/index.scss +24 -13
  156. package/src/components/textarea/scss/variables.scss +0 -1
  157. package/src/components/toast/scss/index.scss +1 -1
  158. package/src/components/tooltip/constants.ts +6 -0
  159. package/src/components/tooltip/index.ts +4 -1
  160. package/src/components/tooltip/menu.ts +18 -29
  161. package/src/components/tooltip/onclick.ts +21 -88
  162. package/src/components/tooltip/onhover.ts +18 -29
  163. package/src/components/tooltip/scss/index.scss +2 -3
  164. package/src/css-utilities/background/scss/variables.scss +2 -2
  165. package/src/css-utilities/border/scss/index.scss +1 -27
  166. package/src/css-utilities/border/scss/variables.scss +3 -34
  167. package/src/css-utilities/color/scss/variables.scss +2 -6
  168. package/src/css-utilities/font/geist/scss/Geist-Italic-Variable.woff2 +0 -0
  169. package/src/css-utilities/font/geist/scss/Geist-Variable.woff2 +0 -0
  170. package/src/css-utilities/font/geist/scss/GeistMono-Italic-Variable.woff2 +0 -0
  171. package/src/css-utilities/font/geist/scss/GeistMono-Variable.woff2 +0 -0
  172. package/src/css-utilities/font/geist/scss/index.scss +55 -0
  173. package/src/css-utilities/font/montserrat/index.ts +1 -0
  174. package/src/{fonts → css-utilities/font}/montserrat/scss/index.scss +15 -0
  175. package/src/css-utilities/index.scss +6 -12
  176. package/src/css-utilities/inline/scss/index.scss +0 -1
  177. package/src/css-utilities/scrollbar/scss/index.scss +42 -0
  178. package/src/css-utilities/tabular/scss/index.scss +3 -0
  179. package/src/css-utilities/text/scss/index.scss +30 -71
  180. package/src/lib/scss/css-variables.scss +29 -5
  181. package/src/themes/dark/index.ts +0 -1
  182. package/src/themes/dark/select.ts +14 -9
  183. package/src/tokens/index.scss +1 -3
  184. package/src/tokens/scss/border-radius.scss +1 -6
  185. package/src/tokens/scss/color.scss +3 -3
  186. package/src/tokens/scss/scale.scss +1 -1
  187. package/src/tokens/scss/size.scss +7 -0
  188. package/src/tokens/scss/transition.scss +4 -0
  189. package/storage/svg/arrow-left.svg +1 -0
  190. package/storage/svg/arrow-right.svg +1 -0
  191. package/storage/svg/book.svg +1 -0
  192. package/storage/svg/cube.svg +1 -0
  193. package/storage/svg/github.svg +1 -0
  194. package/storage/svg/info.svg +1 -0
  195. package/storage/svg/palette.svg +1 -0
  196. package/storage/svg/search.svg +2 -0
  197. package/storage/svg/type.svg +1 -0
  198. package/vite.config.ts +8 -3
  199. package/build/components/back/index.d.ts +0 -21
  200. package/build/components/back/index.js +0 -16
  201. package/build/components/back/scss/index.scss +0 -2
  202. package/build/components/back/svg/arrow.svg +0 -15
  203. package/build/components/bubble/scss/index.scss +0 -2
  204. package/build/components/button/index.d.ts +0 -103
  205. package/build/components/button/index.js +0 -60
  206. package/build/components/ellipsis/index.d.ts +0 -4
  207. package/build/components/ellipsis/index.js +0 -8
  208. package/build/components/ellipsis/scss/index.scss +0 -2
  209. package/build/components/frame/index.d.ts +0 -21
  210. package/build/components/frame/index.js +0 -13
  211. package/build/components/frame/scss/index.scss +0 -2
  212. package/build/components/highlight/index.d.ts +0 -22
  213. package/build/components/highlight/index.js +0 -56
  214. package/build/components/highlight/scss/index.scss +0 -2
  215. package/build/components/loader/index.d.ts +0 -22
  216. package/build/components/loader/index.js +0 -78
  217. package/build/components/loader/scss/index.scss +0 -2
  218. package/build/components/radio/scss/index.scss +0 -2
  219. package/build/components/root/index.d.ts +0 -7
  220. package/build/components/root/index.js +0 -4
  221. package/build/components/root/onclick.d.ts +0 -5
  222. package/build/components/root/onclick.js +0 -12
  223. package/build/components/switch/scss/index.scss +0 -2
  224. package/build/css-utilities/[margin,padding]/scss/index.scss +0 -2
  225. package/build/css-utilities/error/scss/index.scss +0 -2
  226. package/build/css-utilities/flicker/scss/index.scss +0 -2
  227. package/build/css-utilities/focus/scss/index.scss +0 -2
  228. package/build/css-utilities/gap/scss/index.scss +0 -2
  229. package/build/css-utilities/line-height/scss/index.scss +0 -2
  230. package/build/css-utilities/pointer/scss/index.scss +0 -2
  231. package/build/css-utilities/scroll-fade/scss/index.scss +0 -2
  232. package/build/css-utilities/size/scss/index.scss +0 -2
  233. package/build/css-utilities/viewport/scss/index.scss +0 -2
  234. package/build/css-utilities/width/scss/index.scss +0 -2
  235. package/build/fonts/index.d.ts +0 -1
  236. package/build/fonts/index.js +0 -1
  237. package/build/fonts/montserrat/scss/index.scss +0 -2
  238. package/build/themes/dark/back.d.ts +0 -19
  239. package/build/themes/dark/back.js +0 -7
  240. package/build/themes/dark/button/scss/index.scss +0 -2
  241. package/build/themes/dark/link/scss/index.scss +0 -2
  242. package/src/components/back/index.ts +0 -20
  243. package/src/components/back/scss/index.scss +0 -17
  244. package/src/components/back/svg/arrow.svg +0 -15
  245. package/src/components/bubble/scss/index.scss +0 -32
  246. package/src/components/bubble/scss/variables.scss +0 -20
  247. package/src/components/button/index.ts +0 -53
  248. package/src/components/ellipsis/index.ts +0 -11
  249. package/src/components/ellipsis/scss/index.scss +0 -30
  250. package/src/components/ellipsis/scss/variables.scss +0 -5
  251. package/src/components/frame/index.ts +0 -13
  252. package/src/components/frame/scss/index.scss +0 -39
  253. package/src/components/frame/scss/variables.scss +0 -4
  254. package/src/components/highlight/index.ts +0 -66
  255. package/src/components/highlight/scss/index.scss +0 -7
  256. package/src/components/highlight/scss/variables.scss +0 -4
  257. package/src/components/loader/index.ts +0 -80
  258. package/src/components/loader/scss/index.scss +0 -71
  259. package/src/components/loader/scss/variables.scss +0 -6
  260. package/src/components/radio/scss/index.scss +0 -50
  261. package/src/components/radio/scss/variables.scss +0 -67
  262. package/src/components/root/index.ts +0 -6
  263. package/src/components/root/onclick.ts +0 -20
  264. package/src/components/switch/scss/index.scss +0 -48
  265. package/src/components/switch/scss/variables.scss +0 -74
  266. package/src/css-utilities/[margin,padding]/scss/index.scss +0 -43
  267. package/src/css-utilities/[margin,padding]/scss/variables.scss +0 -54
  268. package/src/css-utilities/error/scss/index.scss +0 -24
  269. package/src/css-utilities/error/scss/variables.scss +0 -3
  270. package/src/css-utilities/flicker/scss/index.scss +0 -15
  271. package/src/css-utilities/flicker/scss/variables.scss +0 -5
  272. package/src/css-utilities/focus/scss/index.scss +0 -7
  273. package/src/css-utilities/focus/scss/variables.scss +0 -5
  274. package/src/css-utilities/gap/scss/index.scss +0 -13
  275. package/src/css-utilities/gap/scss/variables.scss +0 -39
  276. package/src/css-utilities/line-height/scss/index.scss +0 -1
  277. package/src/css-utilities/line-height/scss/variables.scss +0 -10
  278. package/src/css-utilities/pointer/scss/index.scss +0 -5
  279. package/src/css-utilities/scroll-fade/scss/index.scss +0 -47
  280. package/src/css-utilities/scroll-fade/scss/variables.scss +0 -3
  281. package/src/css-utilities/size/scss/index.scss +0 -1
  282. package/src/css-utilities/size/scss/variables.scss +0 -12
  283. package/src/css-utilities/text/scss/variables.scss +0 -31
  284. package/src/css-utilities/viewport/scss/index.scss +0 -5
  285. package/src/css-utilities/width/scss/index.scss +0 -5
  286. package/src/css-utilities/width/scss/variables.scss +0 -9
  287. package/src/fonts/index.ts +0 -1
  288. package/src/themes/dark/back.ts +0 -9
  289. package/src/themes/dark/button/scss/index.scss +0 -46
  290. package/src/themes/dark/link/scss/index.scss +0 -26
  291. package/src/tokens/scss/font-weight.scss +0 -6
  292. package/src/tokens/scss/line-height.scss +0 -9
  293. package/src/tokens/scss/transition-duration.scss +0 -1
  294. /package/build/{fonts/montserrat → css-utilities/font/geist}/index.d.ts +0 -0
  295. /package/build/{fonts/montserrat → css-utilities/font/geist}/index.js +0 -0
  296. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff +0 -0
  297. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff2 +0 -0
  298. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
  299. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
  300. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff +0 -0
  301. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff2 +0 -0
  302. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff +0 -0
  303. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff2 +0 -0
  304. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
  305. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
  306. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff +0 -0
  307. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff2 +0 -0
  308. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff +0 -0
  309. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
  310. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
  311. /package/build/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
  312. /package/src/{fonts/montserrat → css-utilities/font/geist}/index.ts +0 -0
  313. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff +0 -0
  314. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Bold.woff2 +0 -0
  315. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff +0 -0
  316. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-BoldItalic.woff2 +0 -0
  317. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff +0 -0
  318. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Italic.woff2 +0 -0
  319. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff +0 -0
  320. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Medium.woff2 +0 -0
  321. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff +0 -0
  322. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-MediumItalic.woff2 +0 -0
  323. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff +0 -0
  324. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-Regular.woff2 +0 -0
  325. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff +0 -0
  326. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBold.woff2 +0 -0
  327. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff +0 -0
  328. /package/src/{fonts → css-utilities/font}/montserrat/scss/Montserrat-SemiBoldItalic.woff2 +0 -0
@@ -1,7 +1,9 @@
1
1
  .text {
2
+ --border-width: 0px;
2
3
  --color: var(--color-default, inherit);
3
- --font-size: var(--font-size-400);
4
- --font-weight: var(--font-weight-400);
5
- --line-height: var(--line-height-400);
4
+ --color-active: var(--color-default);
5
+ --color-default: var(--color-text-400);
6
+ --color-hover: var(--color-default);
7
+ --color-pressed: var(--color-default);
6
8
  --width: auto;
7
9
  }
@@ -1,27 +1,60 @@
1
- import { html, type Attributes } from '@esportsplus/template';
1
+ import { component, html, type Attributes } from '@esportsplus/template';
2
2
  import { reactive } from '@esportsplus/reactivity';
3
- import { omit } from '@esportsplus/utilities';
4
3
  import form from '~/components/form';
5
4
  import './scss/index.scss';
6
5
 
7
6
 
8
- const OMIT = ['state'];
7
+ type Autoresize = { height: { max: `${number}px`, min: `${number}px` } };
9
8
 
10
9
 
11
- export default function(
10
+ function autoresize({ height }: Autoresize) {
11
+ let attributes = {
12
+ class: 'textarea--autoresize',
13
+ style: `
14
+ --max-height: ${height.max};
15
+ --min-height: ${height.min};
16
+ `
17
+ };
18
+
19
+ if (CSS.supports('field-sizing', 'content')) {
20
+ return attributes;
21
+ }
22
+
23
+ return {
24
+ ...attributes,
25
+ class: `${attributes.class} textarea--autoresize-fallback`,
26
+ oninput: (e: InputEvent) => {
27
+ let element = e.target as HTMLTextAreaElement;
28
+
29
+ element.style.setProperty('--content-height', '0px');
30
+ element.style.setProperty('--content-height', `${element.scrollHeight}px`);
31
+ }
32
+ };
33
+ }
34
+
35
+
36
+ export default component(function(
12
37
  this: { attributes?: Attributes },
13
- attributes: Attributes & { state?: { active: boolean, error: string } }
14
- ) {
15
- let state = attributes.state || reactive({
38
+ {
39
+ autoresize: resize,
40
+ state = reactive({
16
41
  active: false,
17
42
  error: ''
18
- });
43
+ }),
44
+ ...attributes
45
+ }: Attributes & {
46
+ autoresize?: Autoresize,
47
+ state?: { active: boolean, error: string }
48
+ }
49
+ ) {
50
+ attributes.value ??= '';
19
51
 
20
52
  return html`
21
53
  <textarea
22
54
  class='textarea'
23
- ${this?.attributes && omit(this.attributes, OMIT)}
24
- ${omit(attributes, OMIT)}
55
+ ${this?.attributes}
56
+ ${attributes}
57
+ ${resize && autoresize(resize)}
25
58
  ${{
26
59
  class: () => state.active && '--active',
27
60
  onfocusin: () => {
@@ -30,9 +63,8 @@ export default function(
30
63
  onfocusout: () => {
31
64
  state.active = false;
32
65
  },
33
- onrender: form.input.onrender(state),
34
- value: attributes?.value || ''
66
+ onrender: form.input.onrender(state)
35
67
  }}
36
68
  ></textarea>
37
69
  `;
38
- };
70
+ });
@@ -1,32 +1,43 @@
1
1
  @use 'variables';
2
2
 
3
3
  .textarea {
4
- align-items: center;
5
4
  background: var(--background);
6
5
  border: var(--border-width) var(--border-style) var(--border-color);
7
6
  border-radius: var(--border-radius);
8
7
  color: var(--color);
9
8
  cursor: text;
10
- display: flex;
11
- field-sizing: content;
12
9
  flex: 1 1 auto;
13
- flex-wrap: wrap;
14
10
  font-size: var(--font-size);
15
- line-height: var(--line-height);
16
11
  min-width: 0;
17
- padding: var(--padding-vertical) var(--padding-horizontal);
12
+ padding:
13
+ max(0px, calc(var(--padding-vertical) - var(--border-width)))
14
+ max(0px, calc(var(--padding-horizontal) - var(--border-width)));
18
15
  position: relative;
19
16
  transition:
20
- background var(--transition-duration) ease-in-out,
21
- border-color var(--transition-duration) ease-in-out,
22
- box-shadow var(--transition-duration) ease-in-out,
23
- opacity var(--transition-duration) ease-in-out,
24
- transform var(--transition-duration) ease-in-out;
25
- white-space: normal;
17
+ background var(--transition-duration) var(--transition-timing-function),
18
+ border-color var(--transition-duration) var(--transition-timing-function),
19
+ box-shadow var(--transition-duration) var(--transition-timing-function),
20
+ opacity var(--transition-duration) var(--transition-timing-function),
21
+ transform var(--transition-duration) var(--transition-timing-function);
26
22
  width: 100%;
27
23
 
28
24
  &:invalid,
29
25
  &:required {
30
26
  box-shadow: none;
31
27
  }
32
- }
28
+
29
+
30
+ &--autoresize {
31
+ field-sizing: content;
32
+ height: auto;
33
+ max-height: var(--max-height);
34
+ min-height: var(--min-height);
35
+ overflow-y: auto;
36
+ resize: none;
37
+
38
+ &-fallback {
39
+ box-sizing: border-box;
40
+ height: calc(var(--content-height, var(--min-height)) + 2 * var(--border-width));
41
+ }
42
+ }
43
+ }
@@ -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);
@@ -95,7 +95,7 @@
95
95
  align-items: center;
96
96
  background: var(--background);
97
97
  border: 1px solid var(--color-border-400);
98
- border-radius: var(--border-radius-circle);
98
+ border-radius: 100%;
99
99
  color: var(--color-text-500);
100
100
  display: flex;
101
101
  height: var(--size-500);
@@ -0,0 +1,6 @@
1
+ const MENU_OPTION = Symbol.for('@esportsplus/ui/tooltip.menu.option');
2
+
3
+ const MENU_TOOLTIP_CONTENT = Symbol.for('@esportsplus/ui/tooltip.menu.tooltip-content');
4
+
5
+
6
+ export { MENU_OPTION, MENU_TOOLTIP_CONTENT };
@@ -4,4 +4,7 @@ import onhover from './onhover';
4
4
  import './scss/index.scss';
5
5
 
6
6
 
7
- export default { menu, onclick, onhover };
7
+ const tooltip: { menu: typeof menu, onclick: typeof onclick, onhover: typeof onhover } = { menu, onclick, onhover };
8
+
9
+
10
+ export default tooltip;
@@ -1,55 +1,44 @@
1
1
  import { component, html, type Attributes, type Renderable } from '@esportsplus/template';
2
2
  import { reactive } from '@esportsplus/reactivity';
3
- import { omit } from '@esportsplus/utilities';
3
+ import { MENU_OPTION, MENU_TOOLTIP_CONTENT } from './constants';
4
4
  import onclick from './onclick';
5
5
 
6
6
 
7
7
  type A = Attributes & {
8
+ [MENU_OPTION]?: Attributes,
9
+ [MENU_TOOLTIP_CONTENT]?: Attributes & { direction?: string },
8
10
  options: (Attributes & { content: Renderable<unknown> })[],
9
- option?: Attributes,
10
11
  state?: { active: boolean },
11
- toggle?: boolean,
12
- 'tooltip-content': Attributes & { direction?: string }
12
+ toggle?: boolean
13
13
  };
14
14
 
15
15
 
16
- const OMIT = ['options', 'option', 'tooltip-content'];
17
-
18
- const OMIT_OPTION = ['content'];
19
-
20
- const OMIT_TOOLTIP_CONTENT = ['direction'];
21
-
22
-
23
- export default component<A>(
24
- (attributes, content) => {
25
- let options = attributes.options,
26
- option = attributes.option,
27
- state = attributes.state || reactive({ active: false }),
28
- tooltipContent = attributes?.['tooltip-content'],
29
- tooltipContentDirection = tooltipContent?.direction || 'nw';
16
+ export default Object.assign(component<A>(
17
+ ({ options, state = reactive({ active: false }), ...attributes }, content) => {
18
+ let { direction = 'nw', ...tooltipContent } = attributes[MENU_TOOLTIP_CONTENT] ?? {};
30
19
 
31
20
  return onclick(
32
- { ...omit(attributes, OMIT), state },
21
+ { ...attributes, state },
33
22
  html`
34
23
  ${content}
35
24
 
36
25
  <div
37
- class='tooltip-content ${`tooltip-content--${tooltipContentDirection}`}'
38
- ${tooltipContent && omit(tooltipContent, OMIT_TOOLTIP_CONTENT)}
26
+ class='tooltip-content ${`tooltip-content--${direction}`}'
27
+ ${tooltipContent}
39
28
  ${{
40
29
  inert: () => !state.active
41
30
  }}
42
31
  >
43
- ${options.map((o) => {
32
+ ${options.map(({ content, ...o }) => {
44
33
  if (o.href) {
45
34
  return html`
46
35
  <a
47
36
  class='link --width-full'
48
37
  target='_blank'
49
- ${omit(o, OMIT_OPTION)}
50
- ${option}
38
+ ${o}
39
+ ${attributes[MENU_OPTION]}
51
40
  >
52
- ${o.content}
41
+ ${content}
53
42
  </a>
54
43
  `;
55
44
  }
@@ -57,10 +46,10 @@ export default component<A>(
57
46
  return html`
58
47
  <div
59
48
  class='link --width-full'
60
- ${omit(o, OMIT_OPTION)}
61
- ${option}
49
+ ${o}
50
+ ${attributes[MENU_OPTION]}
62
51
  >
63
- ${o.content}
52
+ ${content}
64
53
  </div>
65
54
  `;
66
55
  })}
@@ -68,4 +57,4 @@ export default component<A>(
68
57
  `
69
58
  );
70
59
  }
71
- );
60
+ ), { option: MENU_OPTION, tooltipContent: MENU_TOOLTIP_CONTENT } as const);
@@ -1,96 +1,29 @@
1
1
  import { component, html, type Attributes } from '@esportsplus/template';
2
2
  import { reactive } from '@esportsplus/reactivity';
3
- import { omit } from '@esportsplus/utilities';
4
- import root from '~/components/root';
5
-
6
-
7
- const OMIT = ['state', 'toggle'];
8
-
9
-
10
- let parent: HTMLElement | null | undefined = null,
11
- queue: { fn: VoidFunction, tooltip: HTMLElement }[] = [],
12
- running = false,
13
- scheduled = false;
14
-
15
-
16
- function frame() {
17
- if (running) {
18
- return;
19
- }
20
-
21
- running = true;
22
-
23
- let item,
24
- keep;
25
-
26
- while (item = queue.pop()) {
27
- if (parent === item.tooltip) {
28
- keep = item;
29
- continue;
30
- }
31
-
32
- item.fn();
33
- }
34
-
35
- if (keep) {
36
- queue.push(keep);
37
- }
38
-
39
- running = false;
40
- }
41
3
 
42
4
 
43
5
  export default component<Attributes & { state?: { active: boolean }, toggle?: boolean }>(
44
- (attributes, content) => {
45
- let state = attributes.state || reactive({ active: false }),
46
- toggle = attributes.toggle || false;
47
-
48
- return html`
49
- <div
50
- class='tooltip'
51
- ${omit(attributes, OMIT)}
52
- ${{
53
- class: () => state.active && '--active',
54
- onclick: function(e) {
55
- let active = true,
56
- node = e.target as Node | null;
57
-
58
- if (this === node || (toggle && this.contains(node))) {
59
- active = !state.active;
60
- }
61
-
62
- if (parent !== this && !parent?.contains(this)) {
63
- parent = this.parentElement?.closest('.tooltip');
64
- }
65
-
66
- frame();
67
-
68
- if (parent === this) {
69
- parent = null;
70
- return;
71
- }
72
-
73
- state.active = active;
74
-
75
- if (active) {
76
- queue.push({
77
- fn: () => state.active = false,
78
- tooltip: this
79
- });
80
- }
6
+ ({ state = reactive({ active: false }), toggle = false, ...attributes }, content) => html`
7
+ <div
8
+ class='tooltip'
9
+ ${attributes}
10
+ ${{
11
+ class: () => state.active && '--active',
12
+ onclick: function(e) {
13
+ state.active = this === e.target || toggle ? !state.active : true;
14
+ },
15
+ ondocumentclick: function(this, event) {
16
+ if (!this?.isConnected || !state.active) {
17
+ return;
18
+ }
81
19
 
82
- if (!scheduled) {
83
- root.onclick.push(() => {
84
- frame();
85
- scheduled = false;
86
- });
87
- scheduled = true;
88
- }
20
+ if (!this.contains(event.target as Node | null)) {
21
+ state.active = false;
89
22
  }
90
- }}
91
- >
92
- ${content}
93
- </div>
94
- `;
95
- }
23
+ }
24
+ }}
25
+ >
26
+ ${content}
27
+ </div>
28
+ `
96
29
  );
@@ -1,34 +1,23 @@
1
1
  import { component, html, Attributes } from '@esportsplus/template';
2
2
  import { reactive } from '@esportsplus/reactivity';
3
- import { omit } from '@esportsplus/utilities';
4
3
 
5
4
 
6
- type A = Attributes & { state?: { active: boolean } };
7
-
8
-
9
- const OMIT = ['state'];
10
-
11
-
12
- export default component(
13
- (attributes: A, content) => {
14
- let state = attributes.state || reactive({ active: false });
15
-
16
- return html`
17
- <div
18
- class='tooltip'
19
- ${omit(attributes, OMIT)}
20
- ${{
21
- class: () => state.active && '--active',
22
- onmouseover: () => {
23
- state.active = true;
24
- },
25
- onmouseout: () => {
26
- state.active = false;
27
- }
28
- }}
29
- >
30
- ${content}
31
- </div>
32
- `;
33
- }
5
+ export default component<Attributes & { state?: { active: boolean } }>(
6
+ ({ state = reactive({ active: false }), ...attributes }, content) => html`
7
+ <div
8
+ class='tooltip'
9
+ ${attributes}
10
+ ${{
11
+ class: () => state.active && '--active',
12
+ onmouseover: () => {
13
+ state.active = true;
14
+ },
15
+ onmouseout: () => {
16
+ state.active = false;
17
+ }
18
+ }}
19
+ >
20
+ ${content}
21
+ </div>
22
+ `
34
23
  );
@@ -54,8 +54,8 @@
54
54
  opacity: 0;
55
55
  overflow: hidden;
56
56
  transition:
57
- opacity var(--transition-duration) ease-in-out,
58
- transform var(--transition-duration) ease-in-out;
57
+ opacity var(--transition-duration) var(--transition-timing-function),
58
+ transform var(--transition-duration) var(--transition-timing-function);
59
59
  width: var(--width);
60
60
  z-index: 9;
61
61
 
@@ -88,7 +88,6 @@
88
88
  cursor: auto;
89
89
  font-size: var(--font-size);
90
90
  font-weight: var(--font-weight);
91
- line-height: normal;
92
91
  padding: var(--padding-vertical) var(--padding-horizontal);
93
92
  pointer-events: none;
94
93
  white-space: nowrap;
@@ -1,6 +1,8 @@
1
1
  @use '/tokens';
2
2
 
3
3
  .--background {
4
+ @include tokens.state-utility('background', tokens.$colors);
5
+
4
6
  &-default {
5
7
  --background: var(--background-default);
6
8
  --background-active: var(--background-default);
@@ -27,7 +29,5 @@
27
29
  --background: var(--background-pressed);
28
30
  }
29
31
  }
30
-
31
- @include tokens.state-utility('background', tokens.$colors);
32
32
  }
33
33
 
@@ -1,27 +1 @@
1
- @use './variables';
2
-
3
- .--border {
4
- border: var(--border-width) var(--border-style) var(--border-color);
5
-
6
- @each $key in 'bottom' 'left' 'right' 'top' {
7
- &-#{$key} {
8
- border-#{$key}: var(--border-width) var(--border-style) var(--border-color);
9
- }
10
- }
11
-
12
- &-offset {
13
- @each $key in 'bottom' 'left' 'right' 'top' {
14
- &-#{$key} {
15
- margin-#{$key}: calc(var(--border-width) * -1);
16
- }
17
- }
18
- }
19
-
20
- &-radius {
21
- border-radius: var(--border-radius);
22
-
23
- &-circle {
24
- aspect-ratio: 1;
25
- }
26
- }
27
- }
1
+ @use './variables';
@@ -2,30 +2,11 @@
2
2
  @use '/tokens';
3
3
 
4
4
  .--border {
5
- &,
6
- &-bottom,
7
- &-left,
8
- &-right,
9
- &-top {
10
- --border-style: solid;
11
- --border-width: var(--border-width-400);
12
- }
13
-
14
- &-dashed {
15
- --border-style: dashed;
16
- }
17
-
18
- &-dotted {
19
- --border-style: dotted;
20
- }
5
+ @include tokens.state-utility('border-color', tokens.$colors);
21
6
 
22
7
  &-radius {
23
- --border-radius: var(--border-radius-400);
24
-
25
- @each $key in lib.map-keys(tokens.$border-radius) {
26
- &-#{$key} {
27
- --border-radius: var(--border-radius-#{$key});
28
- }
8
+ &-responsive {
9
+ --border-radius: #{"calc( progress((100vi - 100cqi) / 2, 0px, var(--gap-horizontal)) * var(--border-radius) )"};
29
10
  }
30
11
  }
31
12
 
@@ -55,16 +36,4 @@
55
36
  --border-color: var(--border-color-pressed);
56
37
  }
57
38
  }
58
-
59
- &-width {
60
- --border-width: var(--border-width-400);
61
-
62
- @each $key in lib.map-keys(tokens.$border-width) {
63
- &-#{$key} {
64
- --border-width: var(--border-width-#{$key});
65
- }
66
- }
67
- }
68
-
69
- @include tokens.state-utility('border-color', tokens.$colors);
70
39
  }
@@ -1,6 +1,8 @@
1
1
  @use '/tokens';
2
2
 
3
3
  .--color {
4
+ @include tokens.state-utility('color', tokens.$colors);
5
+
4
6
  &-default {
5
7
  --color: var(--color-default);
6
8
  --color-active: var(--color-default);
@@ -8,10 +10,6 @@
8
10
  --color-pressed: var(--color-default);
9
11
  }
10
12
 
11
- &-inherit {
12
- --color: inherit;
13
- }
14
-
15
13
  &-state {
16
14
  --color: var(--color-default);
17
15
  --color-active: var(--color-default);
@@ -31,6 +29,4 @@
31
29
  --color: var(--color-pressed);
32
30
  }
33
31
  }
34
-
35
- @include tokens.state-utility('color', tokens.$colors);
36
32
  }
@@ -0,0 +1,55 @@
1
+ @use '/lib';
2
+
3
+
4
+ @font-face {
5
+ font-display: swap;
6
+ font-family: 'Geist';
7
+ font-style: normal;
8
+ font-weight: 100 900;
9
+ src: url('./Geist-Variable.woff2') format('woff2');
10
+ }
11
+
12
+ @font-face {
13
+ font-display: swap;
14
+ font-family: 'Geist';
15
+ font-style: italic;
16
+ font-weight: 100 900;
17
+ src: url('./Geist-Italic-Variable.woff2') format('woff2');
18
+ }
19
+
20
+ @font-face {
21
+ font-display: swap;
22
+ font-family: 'Geist Mono';
23
+ font-style: normal;
24
+ font-weight: 100 900;
25
+ src: url('./GeistMono-Variable.woff2') format('woff2');
26
+ }
27
+
28
+ @font-face {
29
+ font-display: swap;
30
+ font-family: 'Geist Mono';
31
+ font-style: italic;
32
+ font-weight: 100 900;
33
+ src: url('./GeistMono-Italic-Variable.woff2') format('woff2');
34
+ }
35
+
36
+
37
+ .--font-geist {
38
+ --font-family: 'Geist', sans-serif;
39
+
40
+ &,
41
+ &-mono {
42
+ @include lib.css-variables(font-weight, (
43
+ 300: 300,
44
+ 400: 400,
45
+ 500: 500,
46
+ 600: 600
47
+ ));
48
+ }
49
+
50
+ &-mono {
51
+ --font-family: 'Geist Mono', monospace;
52
+ }
53
+ }
54
+
55
+
@@ -0,0 +1 @@
1
+ import './scss/index.scss';