@esportsplus/ui 0.17.6 → 0.18.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 (143) hide show
  1. package/build/components/accordion/index.d.ts +2 -2
  2. package/build/components/counter/index.d.ts +7 -10
  3. package/build/components/counter/index.js +34 -36
  4. package/build/components/ellipsis/index.d.ts +2 -1
  5. package/build/components/ellipsis/index.js +1 -1
  6. package/build/components/field/checkbox.d.ts +354 -11
  7. package/build/components/field/checkbox.js +45 -40
  8. package/build/components/field/description.d.ts +5 -6
  9. package/build/components/field/description.js +5 -9
  10. package/build/components/field/error.d.ts +1 -1
  11. package/build/components/field/error.js +3 -3
  12. package/build/components/field/index.d.ts +0 -81
  13. package/build/components/field/index.js +0 -8
  14. package/build/components/field/input.d.ts +364 -0
  15. package/build/components/field/input.js +97 -0
  16. package/build/components/field/scss/index.scss +1 -1
  17. package/build/components/field/select.d.ts +245 -24
  18. package/build/components/field/select.js +99 -109
  19. package/build/components/field/title.d.ts +113 -7
  20. package/build/components/field/title.js +7 -10
  21. package/build/components/footer/index.d.ts +5 -9
  22. package/build/components/footer/index.js +7 -6
  23. package/build/components/form/index.d.ts +4 -2
  24. package/build/components/form/input.d.ts +5 -2
  25. package/build/components/form/input.js +4 -1
  26. package/build/components/frame/index.d.ts +115 -0
  27. package/build/components/frame/index.js +8 -0
  28. package/build/components/frame/scss/index.scss +1 -1
  29. package/build/components/highlight/index.d.ts +2 -1
  30. package/build/components/icon/index.d.ts +5 -2
  31. package/build/components/icon/index.js +7 -6
  32. package/build/components/index.d.ts +1 -2
  33. package/build/components/index.js +1 -2
  34. package/build/components/json/download.d.ts +1 -1
  35. package/build/components/json/index.d.ts +1 -1
  36. package/build/components/link/index.d.ts +0 -12
  37. package/build/components/link/index.js +0 -2
  38. package/build/components/link/scss/index.scss +1 -1
  39. package/build/components/loader/index.d.ts +5 -4
  40. package/build/components/loader/index.js +20 -20
  41. package/build/components/loading/index.d.ts +2 -1
  42. package/build/components/overlay/index.d.ts +114 -2
  43. package/build/components/overlay/index.js +7 -8
  44. package/build/components/root/scss/index.scss +1 -1
  45. package/build/components/scrollbar/index.d.ts +115 -4
  46. package/build/components/scrollbar/index.js +26 -25
  47. package/build/components/scrollbar/scss/index.scss +1 -1
  48. package/build/components/sidebar/index.d.ts +114 -2
  49. package/build/components/sidebar/index.js +7 -8
  50. package/build/components/site/index.d.ts +114 -2
  51. package/build/components/site/index.js +9 -10
  52. package/build/components/template/index.d.ts +8 -0
  53. package/build/components/template/index.js +15 -0
  54. package/build/components/tooltip/index.d.ts +355 -8
  55. package/build/components/tooltip/index.js +54 -37
  56. package/build/components/typewriter/index.d.ts +1 -1
  57. package/build/css-utilities/border/scss/index.scss +1 -1
  58. package/build/css-utilities/flex/scss/index.scss +1 -1
  59. package/package.json +7 -7
  60. package/src/components/accordion/scss/index.scss +1 -1
  61. package/src/components/anchor/scss/index.scss +1 -1
  62. package/src/components/banner/scss/index.scss +1 -1
  63. package/src/components/border/scss/index.scss +1 -1
  64. package/src/components/button/scss/index.scss +1 -1
  65. package/src/components/card/scss/index.scss +1 -1
  66. package/src/components/container/scss/index.scss +1 -1
  67. package/src/components/counter/index.ts +42 -46
  68. package/src/components/counter/scss/index.scss +1 -1
  69. package/src/components/ellipsis/index.ts +3 -3
  70. package/src/components/ellipsis/scss/index.scss +1 -1
  71. package/src/components/field/checkbox.ts +68 -53
  72. package/src/components/field/description.ts +8 -11
  73. package/src/components/field/error.ts +3 -3
  74. package/src/components/field/index.ts +5 -6
  75. package/src/components/field/input.ts +125 -0
  76. package/src/components/field/scss/{_check.scss → check.scss} +1 -4
  77. package/src/components/field/scss/index.scss +15 -36
  78. package/src/components/field/scss/normalize.scss +34 -0
  79. package/src/components/field/scss/{_text.scss → text.scss} +31 -17
  80. package/src/components/field/scss/variables.scss +0 -10
  81. package/src/components/field/select.ts +167 -155
  82. package/src/components/field/title.ts +10 -12
  83. package/src/components/footer/index.ts +12 -22
  84. package/src/components/form/input.ts +10 -5
  85. package/src/components/frame/index.ts +14 -1
  86. package/src/components/frame/scss/index.scss +2 -0
  87. package/src/components/grid/scss/index.scss +1 -1
  88. package/src/components/group/scss/index.scss +1 -1
  89. package/src/components/highlight/index.ts +2 -1
  90. package/src/components/highlight/scss/index.scss +1 -1
  91. package/src/components/icon/index.ts +11 -8
  92. package/src/components/icon/scss/index.scss +1 -1
  93. package/src/components/index.ts +1 -2
  94. package/src/components/json/download.ts +1 -1
  95. package/src/components/link/index.ts +1 -5
  96. package/src/components/link/scss/index.scss +1 -20
  97. package/src/components/loader/index.ts +35 -33
  98. package/src/components/loader/scss/index.scss +1 -1
  99. package/src/components/loading/index.ts +2 -2
  100. package/src/components/loading/scss/index.scss +1 -1
  101. package/src/components/modal/scss/index.scss +1 -1
  102. package/src/components/overlay/index.ts +9 -9
  103. package/src/components/page/scss/index.scss +1 -1
  104. package/src/components/root/scss/index.scss +1 -1
  105. package/src/components/scrollbar/index.ts +44 -42
  106. package/src/components/scrollbar/scss/index.scss +1 -1
  107. package/src/components/scrollbar/scss/variables.scss +1 -1
  108. package/src/components/sidebar/index.ts +9 -9
  109. package/src/components/sidebar/scss/index.scss +1 -1
  110. package/src/components/site/index.ts +11 -11
  111. package/src/components/template/index.ts +26 -0
  112. package/src/components/text/scss/index.scss +1 -1
  113. package/src/components/thumbnail/scss/index.scss +1 -1
  114. package/src/components/tooltip/index.ts +116 -86
  115. package/src/components/tooltip/scss/index.scss +1 -1
  116. package/src/css-utilities/border/scss/variables.scss +0 -8
  117. package/src/css-utilities/flex/scss/index.scss +7 -7
  118. package/src/tokens/scss/border-radius.scss +3 -0
  119. package/build/components/field/file.d.ts +0 -19
  120. package/build/components/field/file.js +0 -51
  121. package/build/components/field/optional.d.ts +0 -12
  122. package/build/components/field/optional.js +0 -16
  123. package/build/components/field/switch.d.ts +0 -3
  124. package/build/components/field/switch.js +0 -6
  125. package/build/components/field/text.d.ts +0 -19
  126. package/build/components/field/text.js +0 -64
  127. package/build/components/field/textarea.d.ts +0 -3
  128. package/build/components/field/textarea.js +0 -5
  129. package/build/components/link/hover.d.ts +0 -10
  130. package/build/components/link/hover.js +0 -17
  131. package/build/components/magnet/index.d.ts +0 -11
  132. package/build/components/magnet/index.js +0 -51
  133. package/build/components/magnet/scss/index.scss +0 -2
  134. package/src/components/field/file.ts +0 -77
  135. package/src/components/field/optional.ts +0 -23
  136. package/src/components/field/scss/_normalize.scss +0 -36
  137. package/src/components/field/switch.ts +0 -9
  138. package/src/components/field/text.ts +0 -92
  139. package/src/components/field/textarea.ts +0 -8
  140. package/src/components/link/hover.ts +0 -19
  141. package/src/components/magnet/index.ts +0 -60
  142. package/src/components/magnet/scss/index.scss +0 -17
  143. package/src/components/magnet/scss/variables.scss +0 -5
@@ -1,11 +1,14 @@
1
- import { html, svg } from '@esportsplus/template';
1
+ import { html, Attributes, svg } from '@esportsplus/template';
2
+ import template from '~/components/template';
2
3
  import './scss/index.scss';
3
4
 
4
5
 
5
- export default (attributes: Record<string, unknown>, icon: Parameters<typeof svg.sprite>[0]) => {
6
- return html`
7
- <div class='icon' ${attributes}>
8
- ${svg.sprite(icon)}
9
- </div>
10
- `;
11
- };
6
+ export default template.factory<Attributes, Parameters<typeof svg.sprite>[0]>(
7
+ (attributes, icon) => {
8
+ return html`
9
+ <div class='icon' ${attributes}>
10
+ ${svg.sprite(icon)}
11
+ </div>
12
+ `;
13
+ }
14
+ );
@@ -1,4 +1,4 @@
1
- @use './variables.scss';
1
+ @use 'variables';
2
2
 
3
3
  .icon {
4
4
  color: var(--color);
@@ -18,10 +18,9 @@ export * as group from './group';
18
18
  export { default as highlight } from './highlight';
19
19
  export { default as icon } from './icon';
20
20
  export { default as json } from './json';
21
- export { default as link } from './link';
21
+ export * as link from './link';
22
22
  export * as loader from './loader';
23
23
  export { default as loading } from './loading';
24
- export { default as magnet } from './magnet';
25
24
  export * as modal from './modal';
26
25
  export { default as number } from './number';
27
26
  export { default as overlay } from './overlay';
@@ -1,4 +1,4 @@
1
- export default (content: any[] | Record<string, any>, name: string) => {
1
+ export default (content: any[] | Record<PropertyKey, any>, name: string) => {
2
2
  let link = document.createElement('a');
3
3
 
4
4
  link.download = name + '.json';
@@ -1,5 +1 @@
1
- import hover from './hover';
2
- import './scss/index.scss';
3
-
4
-
5
- export default { hover };
1
+ import './scss/index.scss';
@@ -1,6 +1,6 @@
1
1
  @use '/lib';
2
2
  @use '/tokens';
3
- @use './variables.scss';
3
+ @use 'variables';
4
4
 
5
5
  .link {
6
6
  align-content: center;
@@ -22,25 +22,6 @@
22
22
  width: var(--width);
23
23
 
24
24
 
25
- &--hover {
26
- &.tooltip,
27
- &:not(.--active) {
28
- &:hover {
29
- .link-hover {
30
- &--one {
31
- opacity: 0;
32
- transform: translateY(-75%);
33
- }
34
-
35
- &--two {
36
- opacity: 1;
37
- transform: translate(50%, 50%);
38
- }
39
- }
40
- }
41
- }
42
- }
43
-
44
25
  &--underline {
45
26
  @include tokens.state(active hover) {
46
27
  text-decoration: underline;
@@ -1,43 +1,45 @@
1
- import { html } from '@esportsplus/template';
1
+ import { html, Attributes } from '@esportsplus/template';
2
2
  import { reactive } from '@esportsplus/reactivity';
3
+ import template from '~/components/template';
3
4
  import './scss/index.scss';
4
5
 
5
6
 
6
- export default ({ attributes, content }: { attributes?: Record<PropertyKey, unknown>, content: any }) => {
7
- let state = reactive({
8
- load: false,
9
- scale: false
10
- });
7
+ export default template.factory<Attributes>(
8
+ (attributes, content) => {
9
+ let state = reactive({
10
+ load: false,
11
+ scale: false
12
+ });
11
13
 
12
- setTimeout(() => {
13
- state.scale = true;
14
- }, 300);
14
+ setTimeout(() => {
15
+ state.scale = true;
16
+ }, 300);
15
17
 
16
- return html`
17
- <div class='loader ${() => state.load && 'loader--load'}'>
18
+ return html`
18
19
  <div class='loader ${() => state.load && 'loader--load'}'>
19
- <div class='loader-content'>
20
- <div
21
- class='
22
- ${() => state.scale && 'loader-logo--scale'}
23
- loader-logo
24
- text
25
- --flex-center
26
- --text-uppercase
27
- --text-600
28
- '
29
- style='color: var(--color-grey-500);'
30
- onanimationend='${({ animationName: name }: AnimationEvent) => {
31
- if (name === 'scale') {
32
- state.load = true;
33
- }
34
- }}'
35
- ${attributes}
36
- >
37
- ${content}
20
+ <div class='loader ${() => state.load && 'loader--load'}'>
21
+ <div class='loader-content'>
22
+ <div
23
+ class='
24
+ ${() => state.scale && 'loader-logo--scale'}
25
+ loader-logo
26
+ text
27
+ --flex-center
28
+ --text-uppercase --text-600
29
+ '
30
+ style='color: var(--color-grey-500);'
31
+ onanimationend='${({ animationName: name }: AnimationEvent) => {
32
+ if (name === 'scale') {
33
+ state.load = true;
34
+ }
35
+ }}'
36
+ ${attributes}
37
+ >
38
+ ${content}
39
+ </div>
38
40
  </div>
39
41
  </div>
40
42
  </div>
41
- </div>
42
- `;
43
- }
43
+ `;
44
+ }
45
+ );
@@ -1,4 +1,4 @@
1
- @use './variables.scss';
1
+ @use 'variables';
2
2
 
3
3
  .loader {
4
4
  background-color: var(--color-black-500);
@@ -1,8 +1,8 @@
1
- import { html } from '@esportsplus/template';
1
+ import { html, Attributes } from '@esportsplus/template';
2
2
  import './scss/index.scss';
3
3
 
4
4
 
5
- export default (attributes?: Record<PropertyKey, unknown>) => {
5
+ export default (attributes?: Attributes) => {
6
6
  return html`
7
7
  <div
8
8
  class='loading --border-width-700 --size-800'
@@ -1,4 +1,4 @@
1
- @use './variables.scss';
1
+ @use 'variables';
2
2
 
3
3
  .loading {
4
4
  animation: loading var(--animation-duration) linear infinite;
@@ -1,6 +1,6 @@
1
1
  @use '/lib';
2
2
  @use '/tokens';
3
- @use './variables.scss';
3
+ @use 'variables';
4
4
 
5
5
  .modal {
6
6
  margin: auto;
@@ -1,14 +1,14 @@
1
- import { isArray } from '@esportsplus/utilities';
1
+ import { toArray } from '@esportsplus/utilities';
2
2
  import scrollbar from '~/components/scrollbar';
3
+ import template from '~/components/template';
3
4
  import './scss/index.scss';
4
5
 
5
6
 
6
- export default (data: Parameters<typeof scrollbar>[0], content: unknown) => {
7
- if (!isArray(data.class)) {
8
- data.class = data.class ? [data.class] : [];
9
- }
10
-
11
- (data.class as unknown[]).push('overlay');
7
+ export default template.factory<Parameters<typeof scrollbar>[0]>(
8
+ (attributes, content) => {
9
+ attributes.class = toArray(attributes.class);
10
+ attributes.class.push('overlay');
12
11
 
13
- return scrollbar(data, content);
14
- };
12
+ return scrollbar(attributes, content);
13
+ }
14
+ );
@@ -1,4 +1,4 @@
1
- @use './variables.scss';
1
+ @use 'variables';
2
2
 
3
3
  .page {
4
4
  min-height: 100svh;
@@ -1,4 +1,4 @@
1
- @use './variables.scss';
1
+ @use 'variables';
2
2
 
3
3
  body,
4
4
  html {
@@ -1,6 +1,7 @@
1
1
  import { reactive } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
2
+ import { html, type Attributes } from '@esportsplus/template';
3
3
  import { omit } from '@esportsplus/utilities';
4
+ import template from '~/components/template';
4
5
  import './scss/index.scss';
5
6
 
6
7
 
@@ -8,49 +9,50 @@ let root = document.body,
8
9
  width: number | undefined;
9
10
 
10
11
 
11
- // TODO: Look into scrollbar customization options
12
- export default (attributes: Record<string, unknown> & { content?: Record<string, unknown>, scrollbar?: Record<string, unknown> }, content: unknown) => {
13
- let state = reactive({
14
- height: 100,
15
- translate: 0
16
- });
12
+ export default template.factory<Attributes & { scrollbar?: Attributes, 'scrollbar-container-content'?: Attributes }>(
13
+ (attributes, content) => {
14
+ let state = reactive({
15
+ height: 100,
16
+ translate: 0
17
+ });
17
18
 
18
- return html`
19
- <div
20
- class='scrollbar-container'
21
- ${omit(attributes, ['content', 'scrollbar'])}
22
- >
19
+ return html`
23
20
  <div
24
- class='scrollbar-container-content'
25
- onscroll='${function(this: HTMLElement) {
26
- if (width === undefined) {
27
- width = this.offsetWidth - this.clientWidth;
28
-
29
- if (width && width !== 17) {
30
- root.style.setProperty('--scrollbar-width', `${width}px`);
31
- }
32
- }
33
-
34
- state.height = (this.clientHeight / this.scrollHeight) * 100;
35
- state.translate = (this.scrollTop / this.clientHeight) * 100;
36
- }}'
37
- ${attributes.content}
21
+ class='scrollbar-container'
22
+ ${omit(attributes, ['scrollbar-container-content', 'scrollbar'])}
38
23
  >
39
- ${content}
40
- </div>
24
+ <div
25
+ class='scrollbar-container-content'
26
+ onscroll='${function(this: HTMLElement) {
27
+ if (width === undefined) {
28
+ width = this.offsetWidth - this.clientWidth;
29
+
30
+ if (width && width !== 17) {
31
+ root.style.setProperty('--scrollbar-width', `${width}px`);
32
+ }
33
+ }
41
34
 
42
- <div
43
- class='
44
- ${() => state.height >= 100 && 'scrollbar--hidden'}
45
- scrollbar
46
- '
47
- style='${() => `
48
- --translate: translate3d(0, ${state.translate}%, 0);
49
- --height: ${state.height}%;
50
- `}'
51
- ${attributes.scrollbar}
52
- >
35
+ state.height = (this.clientHeight / this.scrollHeight) * 100;
36
+ state.translate = (this.scrollTop / this.clientHeight) * 100;
37
+ }}'
38
+ ${attributes['scrollbar-container-content']}
39
+ >
40
+ ${content}
41
+ </div>
42
+
43
+ <div
44
+ class='
45
+ ${() => state.height >= 100 && 'scrollbar--hidden'}
46
+ scrollbar
47
+ '
48
+ style='${() => `
49
+ --translate: translate3d(0, ${state.translate}%, 0);
50
+ --height: ${state.height}%;
51
+ `}'
52
+ ${attributes.scrollbar}
53
+ >
54
+ </div>
53
55
  </div>
54
- </div>
55
- `;
56
- };
56
+ `;
57
+ }
58
+ );
@@ -1,4 +1,4 @@
1
- @use './variables.scss';
1
+ @use 'variables';
2
2
 
3
3
  // Hide Chrome Mobile Scrollbar
4
4
  ::-webkit-scrollbar,
@@ -1,5 +1,5 @@
1
1
  .scrollbar {
2
- --background: transparent;
2
+ --background: var(--color-black-300);
3
3
  --height: 0;
4
4
  --translate: translate3d(0, 0, 0);
5
5
  --width: 4px;
@@ -1,14 +1,14 @@
1
- import { isArray } from '@esportsplus/utilities';
1
+ import { toArray } from '@esportsplus/utilities';
2
2
  import scrollbar from '~/components/scrollbar';
3
+ import template from '~/components/template';
3
4
  import './scss/index.scss';
4
5
 
5
6
 
6
- export default (data: Parameters<typeof scrollbar>[0], content: unknown) => {
7
- if (!isArray(data.class)) {
8
- data.class = data.class ? [data.class] : [];
9
- }
10
-
11
- (data.class as unknown[]).push('sidebar');
7
+ export default template.factory<Parameters<typeof scrollbar>[0]>(
8
+ (attributes, content) => {
9
+ attributes.class = toArray(attributes.class);
10
+ attributes.class.push('sidebar');
12
11
 
13
- return scrollbar(data, content);
14
- };
12
+ return scrollbar(attributes, content);
13
+ }
14
+ );
@@ -1,6 +1,6 @@
1
1
  @use '/lib';
2
2
  @use '/tokens';
3
- @use './variables.scss';
3
+ @use 'variables';
4
4
 
5
5
  .sidebar {
6
6
  @include lib.position(absolute, var(--margin-vertical) null var(--margin-vertical) null);
@@ -1,19 +1,19 @@
1
- import { isArray } from '@esportsplus/utilities';
1
+ import { toArray } from '@esportsplus/utilities';
2
2
  import { onclick } from '~/components/root';
3
3
  import scrollbar from '~/components/scrollbar';
4
+ import template from '~/components/template';
4
5
  import './scss/index.scss';
5
6
 
6
7
 
7
- export default (data: Parameters<typeof scrollbar>[0], content: unknown) => {
8
- data.style ??= '--background-default: var(--color-black-400);';
8
+ export default template.factory<Parameters<typeof scrollbar>[0]>(
9
+ (attributes, content) => {
10
+ attributes.class = toArray(attributes.class);
11
+ attributes.class.push('site');
9
12
 
10
- if (!isArray(data.class)) {
11
- data.class = data.class ? [data.class] : [];
12
- }
13
-
14
- (data.class as unknown[]).push('site');
13
+ attributes.onclick = onclick;
15
14
 
16
- data.onclick = onclick;
15
+ attributes.style ??= '--background-default: var(--color-black-400);';
17
16
 
18
- return scrollbar(data, content);
19
- };
17
+ return scrollbar(attributes, content);
18
+ }
19
+ );
@@ -0,0 +1,26 @@
1
+ import { Renderable } from '@esportsplus/template';
2
+
3
+
4
+ const factory = <A extends Record<string, unknown>, C = unknown>(template: (attributes: A, content: C) => Renderable) => {
5
+ function factory(content: C): Renderable;
6
+ function factory(attributes: A, content: C): Renderable;
7
+ function factory(one: A | C, two?: C): Renderable {
8
+ let content: C,
9
+ attributes: A = {} as A;
10
+
11
+ if (two === undefined) {
12
+ content = one as C;
13
+ }
14
+ else {
15
+ content = two;
16
+ attributes = one as A;
17
+ }
18
+
19
+ return template(attributes, content);
20
+ }
21
+
22
+ return factory;
23
+ };
24
+
25
+
26
+ export default { factory };
@@ -1,4 +1,4 @@
1
- @use './variables.scss';
1
+ @use 'variables';
2
2
 
3
3
  .text {
4
4
  color: var(--color);
@@ -1,4 +1,4 @@
1
- @use './variables.scss';
1
+ @use 'variables';
2
2
 
3
3
  .thumbnail {
4
4
  background: var(--background);