@esportsplus/ui 0.8.4 → 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 -23
  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
@@ -0,0 +1,182 @@
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { omit } from '@esportsplus/utilities';
4
+ import form from '../form';
5
+ import scrollbar from '../scrollbar';
6
+ import root from '../root';
7
+ import description from './description';
8
+ import error from './error';
9
+ import title from './title';
10
+
11
+
12
+ type Data<T extends Record<number | string, number | string>> = {
13
+ class?: string;
14
+ content?: unknown;
15
+ description?: unknown;
16
+ effect?: (selected: number | string) => void;
17
+ mask?: Record<string, unknown>;
18
+ name?: string;
19
+ options: T;
20
+ option?: Record<string, unknown>;
21
+ required?: boolean;
22
+ selected: T[keyof T];
23
+ scrollbar?: Record<string, unknown>;
24
+ style?: string;
25
+ tag?: Record<string, unknown>;
26
+ text?: Record<string, unknown>;
27
+ title?: unknown;
28
+ tooltip?: {
29
+ direction?: unknown;
30
+ } & Record<string, unknown>;
31
+ } & Record<string, unknown>;
32
+
33
+
34
+ const FIELD_OMIT: (keyof Data<any>)[] = [
35
+ 'content',
36
+ 'description',
37
+ 'effect',
38
+ 'mask',
39
+ 'name',
40
+ 'options', 'option',
41
+ 'required',
42
+ 'selected', 'scrollbar',
43
+ 'tag', 'text', 'title', 'tooltip'
44
+ ];
45
+
46
+ const TOOLTIP_OMIT: (keyof NonNullable<Data<any>['tooltip']>)[] = ['direction'];
47
+
48
+
49
+ function parse(keys: (number | string)[], selected: number | string) {
50
+ let options: Record<string, boolean> = {};
51
+
52
+ for (let key of keys) {
53
+ options[key] = false;
54
+ }
55
+
56
+ options[selected] = true;
57
+
58
+ return {
59
+ options,
60
+ selected: selected || keys[0]
61
+ };
62
+ }
63
+
64
+ function template<T extends Record<number | string, number | string>>(data: Data<T>, state: { active: boolean, options: Record<number | string, boolean>, selected: number | string }) {
65
+ data.scrollbar ??= {};
66
+ data.scrollbar.style = data.scrollbar.style || '--background-default: var(--color-black-400);';
67
+
68
+ data.tooltip ??= {};
69
+ data.tooltip.class = `tooltip-content--${data.tooltip?.direction || 's'} ${data.tooltip?.class || ''}`;
70
+ data.tooltip.direction ??= 's';
71
+
72
+ let { html: h, parent: { attributes: a } } = scrollbar({
73
+ attributes: data.scrollbar,
74
+ fixed: true
75
+ });
76
+
77
+ return html`
78
+ <div
79
+ class='tooltip-content --flex-column --width-full'
80
+ ${omit(data.tooltip, TOOLTIP_OMIT)}
81
+ >
82
+ <div
83
+ class='row --flex-column'
84
+ onclick='${(e: Event) => {
85
+ let key = (e?.target as HTMLElement)?.dataset?.key;
86
+
87
+ if (key === undefined) {
88
+ return;
89
+ }
90
+
91
+ state.options[key] = true;
92
+ state.options[state.selected] = false;
93
+
94
+ state.active = false;
95
+ state.selected = key;
96
+
97
+ if (data.effect) {
98
+ data.effect(key);
99
+ }
100
+ }}'
101
+ ${a}
102
+ >
103
+ ${Object.keys( data.options || {} ).map((key: number | string) => html`
104
+ <div
105
+ class='
106
+ ${() => state.options[key] && '--active'}
107
+ link
108
+ --flex-vertical
109
+ '
110
+ data-key='${key}'
111
+ ${data.option}
112
+ >
113
+ <span class='--text-truncate'>
114
+ ${data.options[key]}
115
+ </span>
116
+ </div>
117
+ `)}
118
+ </div>
119
+
120
+ ${h}
121
+ </div>
122
+ `;
123
+ }
124
+
125
+
126
+ export default <T extends Record<number | string, number | string>>(data: Data<T>) => {
127
+ let state = reactive(
128
+ Object.assign({
129
+ active: false,
130
+ error: '',
131
+ render: false,
132
+ },
133
+ parse(Object.keys( data.options || {} ), data.selected))
134
+ );
135
+
136
+ data.mask ??= {};
137
+ data.mask.onclick = () => {
138
+ state.render = true;
139
+ state.active = !state.active;
140
+
141
+ if (state.active) {
142
+ root.onclick.push(() => state.active = false);
143
+ }
144
+ };
145
+
146
+ data.tag ??= {};
147
+ data.tag.name = data.name;
148
+ data.tag.onclick = () => { /* Prevent double click events from firing */ };
149
+ data.tag.onrender = form.input.onrender(state);
150
+ data.tag.value = () => state.selected;
151
+
152
+ return html`
153
+ <div class='
154
+ ${() => state.active ? '--active' : ''}
155
+ field
156
+ tooltip
157
+ --flex-column
158
+ '
159
+ ${omit(data, FIELD_OMIT)}
160
+ >
161
+ ${title(data)}
162
+
163
+ <label
164
+ class='field-mask field-mask--select --flex-row --padding-400'
165
+ ${data.mask}
166
+ >
167
+ <input class='field-tag field-tag--hidden' ${data.tag}>
168
+
169
+ <div class='field-text' style='pointer-events: none' ${data.text}>
170
+ ${() => data.options[ state.selected ] || '-'}
171
+ </div>
172
+
173
+ <div class='field-mask-arrow'></div>
174
+
175
+ ${() => state.render && template(data, state)}
176
+ </label>
177
+
178
+ ${description(data)}
179
+ ${error(state)}
180
+ </div>
181
+ `;
182
+ };
@@ -0,0 +1,9 @@
1
+ import checkbox from './checkbox';
2
+
3
+
4
+ export default (data: Parameters<typeof checkbox>[0]) => {
5
+ data.mask = data.mask || {};
6
+ data.mask.class = `field-mask--switch ${data.mask?.class || ''}`;
7
+
8
+ return checkbox(data);
9
+ };
@@ -0,0 +1,92 @@
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
+ class?: string;
12
+ content?: unknown;
13
+ description?: unknown;
14
+ mask?: Record<string, unknown>;
15
+ name?: string;
16
+ placeholder?: string;
17
+ required?: boolean;
18
+ style?: string;
19
+ tag?: Record<string, unknown>;
20
+ textarea?: boolean;
21
+ title?: unknown;
22
+ type?: string;
23
+ value?: unknown;
24
+ } & Record<string, unknown>;
25
+
26
+
27
+ const FIELD_OMIT: (keyof Data)[] = [
28
+ 'content',
29
+ 'description',
30
+ 'mask',
31
+ 'name',
32
+ 'placeholder',
33
+ 'required',
34
+ 'tag', 'textarea', 'title', 'type',
35
+ 'value'
36
+ ];
37
+
38
+ const INPUT_PICK: (keyof Data)[] = ['name', 'placeholder', 'required', 'type', 'value'];
39
+
40
+ const TEXTAREA_PICK: (keyof Data)[] = ['name', 'placeholder'];
41
+
42
+
43
+ export default (data: Data) => {
44
+ let state = reactive({
45
+ active: false,
46
+ error: ''
47
+ });
48
+
49
+ data.onfocusin = () => {
50
+ state.active = true;
51
+ };
52
+ data.onfocusout = () => {
53
+ state.active = false;
54
+ };
55
+
56
+ data.tag ??= {};
57
+ data.tag.class = `field-tag --padding-400 ${data.tag.class || ''}`;
58
+ data.tag.onrender = form.input.onrender(state);
59
+
60
+ data.type ??= 'string';
61
+ data.value ??= '';
62
+
63
+ return html`
64
+ <div
65
+ class='
66
+ ${() => state.active && '--active'}
67
+ field
68
+ --flex-column
69
+ '
70
+ ${omit(data, FIELD_OMIT)}
71
+ >
72
+ ${title(data)}
73
+
74
+ <label class='field-mask field-mask--input --flex-row' ${data.mask}>
75
+ ${data.textarea
76
+ ? html`
77
+ <textarea ${data.tag} ${pick(data, TEXTAREA_PICK)}>
78
+ ${data.value}
79
+ </textarea>
80
+ `
81
+ : html`
82
+ <input ${data.tag} ${pick(data, INPUT_PICK)}>
83
+ `
84
+ }
85
+ ${data.content || ''}
86
+ </label>
87
+
88
+ ${description(data)}
89
+ ${error(state)}
90
+ </div>
91
+ `;
92
+ };
@@ -0,0 +1,8 @@
1
+ import text from './text';
2
+
3
+
4
+ export default (data: Parameters<typeof text>[0]) => {
5
+ data.textarea = true;
6
+
7
+ return text(data);
8
+ };
@@ -0,0 +1,24 @@
1
+ import { html } from '@esportsplus/template';
2
+ import tooltip from '../tooltip';
3
+
4
+
5
+ export default (data: { required?: boolean, title?: unknown }) => {
6
+ if (!data?.title) {
7
+ return '';
8
+ }
9
+
10
+ return html`
11
+ <div class='field-title --flex-horizontal-space-between --flex-vertical'>
12
+ ${data.title}
13
+
14
+ ${data?.required && html`
15
+ <div
16
+ class='bubble --background-primary --margin-left'
17
+ ${tooltip.onhover().attributes}
18
+ >
19
+ <span class='tooltip-message tooltip-message--w'>Required</span>
20
+ </div>
21
+ `}
22
+ </div>
23
+ `;
24
+ }
@@ -1,79 +1,84 @@
1
- import { html, svg } from '@esportsplus/template';
2
-
3
-
4
- type Data = {
5
- copyright: {
6
- attributes?: Record<string, unknown>;
7
- brand: string;
8
- };
9
- footer?: {
10
- attributes: Record<string, unknown>;
11
- };
12
- nav?: {
13
- attributes?: Record<string, unknown>;
14
- links: { text: string, url: string }[];
15
- };
16
- social?: {
17
- attributes?: Record<string, unknown>;
18
- links: { icon: string, url: string }[]
19
- };
20
- };
21
-
22
-
23
- function copy({ attributes, brand }: Data['copyright']) {
24
- return html`
25
- <div class='footer-copyright group-item --flex-center'>
26
- <div class='text --padding-vertical --padding-300 --text-300' style='--color-default: var(--color-grey-500);' ${attributes}>
27
- &copy; ${`${new Date().getFullYear()} ${brand}, All rights reserved`}
28
- </div>
29
- </div>
30
- `;
31
- }
32
-
33
-
34
- export default ({ copyright, footer, nav, social }: Data) => {
35
- return html`
36
- <footer class='footer' ${footer?.attributes}>
37
- <div class='container'>
38
- <div class='group group--offset-top --flex-center --margin-400'>
39
-
40
- ${nav
41
- ? nav.links.map(({ text, url }) => html`
42
- <div class='group-item'>
43
- <a
44
- class='link --color-white --padding-vertical-300 --text-300'
45
- href='${url}'
46
- style='--color-default: var(--color-grey-500);'
47
- ${nav.attributes}
48
- >
49
- ${text}
50
- </a>
51
- </div>
52
- `)
53
- : copy(copyright)
54
- }
55
-
56
- <div class='footer-break'></div>
57
-
58
- ${social?.links && social.links.map(({ icon, url }) => html`
59
- <div class='group-item'>
60
- <a
61
- class='link --color-white --padding-0px'
62
- href='${url}'
63
- style='--color-default: var(--color-grey-500);'
64
- ${social.attributes}
65
- >
66
- <div class='icon --size-500'>
67
- ${svg.sprite(icon)}
68
- </div>
69
- </a>
70
- </div>
71
- `)}
72
-
73
- ${nav && copy(copyright)}
74
-
75
- </div>
76
- </div>
77
- </footer>
78
- `;
1
+ import { html, svg } from '@esportsplus/template';
2
+ import './scss/index.scss';
3
+
4
+
5
+ type Data = {
6
+ copyright: {
7
+ attributes?: Record<string, unknown>;
8
+ brand: string;
9
+ };
10
+ footer?: {
11
+ attributes: Record<string, unknown>;
12
+ };
13
+ nav?: {
14
+ attributes?: Record<string, unknown>;
15
+ links: { text: string, url: string }[];
16
+ };
17
+ social?: {
18
+ attributes?: Record<string, unknown>;
19
+ links: { icon: string, url: string }[]
20
+ };
21
+ };
22
+
23
+
24
+ function copy({ attributes, brand }: Data['copyright']) {
25
+ return html`
26
+ <div class='footer-copyright group-item --flex-center'>
27
+ <div
28
+ class='text --padding-vertical --padding-300 --text-300'
29
+ style='--color-default: var(--color-grey-500);'
30
+ ${attributes}
31
+ >
32
+ &copy; ${`${new Date().getFullYear()} ${brand}, All rights reserved`}
33
+ </div>
34
+ </div>
35
+ `;
36
+ }
37
+
38
+
39
+ export default ({ copyright, footer, nav, social }: Data) => {
40
+ return html`
41
+ <footer class='footer' ${footer?.attributes}>
42
+ <div class='container'>
43
+ <div class='group group--offset-top --flex-center --margin-400'>
44
+
45
+ ${nav
46
+ ? nav.links.map(({ text, url }) => html`
47
+ <div class='group-item'>
48
+ <a
49
+ class='link --color-white --padding-vertical-300 --text-300'
50
+ href='${url}'
51
+ style='--color-default: var(--color-grey-500);'
52
+ ${nav.attributes}
53
+ >
54
+ ${text}
55
+ </a>
56
+ </div>
57
+ `)
58
+ : copy(copyright)
59
+ }
60
+
61
+ <div class='footer-break'></div>
62
+
63
+ ${social?.links && social.links.map(({ icon, url }) => html`
64
+ <div class='group-item'>
65
+ <a
66
+ class='link --color-white --padding-0px'
67
+ href='${url}'
68
+ style='--color-default: var(--color-grey-500);'
69
+ ${social.attributes}
70
+ >
71
+ <div class='icon --size-500'>
72
+ ${svg.sprite(icon)}
73
+ </div>
74
+ </a>
75
+ </div>
76
+ `)}
77
+
78
+ ${nav && copy(copyright)}
79
+
80
+ </div>
81
+ </div>
82
+ </footer>
83
+ `;
79
84
  };
@@ -1,26 +1,26 @@
1
- .footer {
2
- &,
3
- &-break {
4
- width: 100%;
5
- }
6
-
7
- &-copyright {
8
- &:first-child {
9
- @media (max-width: 640px) {
10
- --width: 100%;
11
- }
12
-
13
- @media (min-width: 640px) {
14
- margin-right: auto;
15
- }
16
-
17
- + .footer-break {
18
- display: none;
19
- }
20
- }
21
-
22
- &:last-child {
23
- --width: 100%;
24
- }
25
- }
1
+ .footer {
2
+ &,
3
+ &-break {
4
+ width: 100%;
5
+ }
6
+
7
+ &-copyright {
8
+ &:first-child {
9
+ @media (max-width: 640px) {
10
+ --width: 100%;
11
+ }
12
+
13
+ @media (min-width: 640px) {
14
+ margin-right: auto;
15
+ }
16
+
17
+ + .footer-break {
18
+ display: none;
19
+ }
20
+ }
21
+
22
+ &:last-child {
23
+ --width: 100%;
24
+ }
25
+ }
26
26
  }