@esportsplus/ui 0.2.10 → 0.3.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 (85) hide show
  1. package/build/components/aurora/index.d.ts +1 -1
  2. package/build/components/counter/index.d.ts +13 -0
  3. package/build/components/counter/index.js +62 -0
  4. package/build/components/ellipsis/index.d.ts +1 -1
  5. package/build/components/footer/index.d.ts +27 -0
  6. package/build/components/footer/index.js +55 -0
  7. package/build/components/form/index.d.ts +1 -1
  8. package/build/components/form/layout.d.ts +1 -1
  9. package/build/components/highlight/index.d.ts +8 -0
  10. package/build/components/highlight/index.js +36 -0
  11. package/build/components/magnet/index.d.ts +10 -0
  12. package/build/components/magnet/index.js +46 -0
  13. package/build/components/scrollbar/index.d.ts +6 -4
  14. package/build/components/scrollbar/index.js +16 -14
  15. package/build/components/site/index.d.ts +2 -2
  16. package/build/components/site/index.js +5 -5
  17. package/build/components/tooltip/index.d.ts +1 -0
  18. package/build/index.d.ts +0 -1
  19. package/build/index.js +0 -1
  20. package/components/styles.css +9 -6
  21. package/components/variables.css +5 -3
  22. package/normalize.css +1 -1
  23. package/package.json +4 -4
  24. package/src/components/aurora/scss/index.scss +4 -4
  25. package/src/components/counter/index.ts +83 -0
  26. package/src/components/counter/scss/index.scss +62 -0
  27. package/src/components/counter/scss/variables.scss +27 -0
  28. package/src/components/footer/index.ts +79 -0
  29. package/src/components/footer/scss/index.scss +26 -0
  30. package/src/components/group/scss/index.scss +4 -4
  31. package/src/components/highlight/index.ts +48 -0
  32. package/src/components/highlight/scss/index.scss +5 -0
  33. package/src/components/highlight/scss/variables.scss +4 -0
  34. package/src/components/link/scss/variables.scss +1 -1
  35. package/src/components/magnet/index.ts +55 -0
  36. package/src/components/magnet/scss/index.scss +16 -0
  37. package/src/components/magnet/scss/variables.scss +5 -0
  38. package/src/components/page/scss/index.scss +4 -0
  39. package/src/components/root/scss/index.scss +1 -0
  40. package/src/components/root/scss/variables.scss +49 -2
  41. package/src/components/scrollbar/index.ts +18 -16
  42. package/src/components/scrollbar/scss/index.scss +29 -19
  43. package/src/components/site/index.ts +6 -7
  44. package/src/index.ts +0 -1
  45. package/src/tokens/scss/box-shadow.scss +5 -1
  46. package/src/tokens/scss/font-size.scss +12 -8
  47. package/utilities/variables.css +1 -1
  48. package/build/components/field/checkbox.d.ts +0 -17
  49. package/build/components/field/checkbox.js +0 -41
  50. package/build/components/field/description.d.ts +0 -4
  51. package/build/components/field/description.js +0 -9
  52. package/build/components/field/error.d.ts +0 -4
  53. package/build/components/field/error.js +0 -11
  54. package/build/components/field/file.d.ts +0 -18
  55. package/build/components/field/file.js +0 -45
  56. package/build/components/field/index.d.ts +0 -107
  57. package/build/components/field/index.js +0 -8
  58. package/build/components/field/optional.d.ts +0 -12
  59. package/build/components/field/optional.js +0 -16
  60. package/build/components/field/select.d.ts +0 -32
  61. package/build/components/field/select.js +0 -107
  62. package/build/components/field/switch.d.ts +0 -3
  63. package/build/components/field/switch.js +0 -6
  64. package/build/components/field/text.d.ts +0 -21
  65. package/build/components/field/text.js +0 -46
  66. package/build/components/field/textarea.d.ts +0 -3
  67. package/build/components/field/textarea.js +0 -5
  68. package/build/components/field/title.d.ts +0 -5
  69. package/build/components/field/title.js +0 -19
  70. package/src/components/field/checkbox.ts +0 -61
  71. package/src/components/field/description.ts +0 -12
  72. package/src/components/field/error.ts +0 -14
  73. package/src/components/field/file.ts +0 -64
  74. package/src/components/field/index.ts +0 -10
  75. package/src/components/field/optional.ts +0 -27
  76. package/src/components/field/scss/_check.scss +0 -225
  77. package/src/components/field/scss/_normalize.scss +0 -36
  78. package/src/components/field/scss/_text.scss +0 -106
  79. package/src/components/field/scss/index.scss +0 -159
  80. package/src/components/field/scss/variables.scss +0 -137
  81. package/src/components/field/select.ts +0 -153
  82. package/src/components/field/switch.ts +0 -9
  83. package/src/components/field/text.ts +0 -68
  84. package/src/components/field/textarea.ts +0 -8
  85. package/src/components/field/title.ts +0 -23
@@ -1,159 +0,0 @@
1
- @use '/lib';
2
- @use '/tokens';
3
- @use 'check' as check;
4
- @use 'normalize' as *;
5
- @use 'text' as text;
6
-
7
- @include normalize();
8
-
9
- .field {
10
- display: flex;
11
- position: relative;
12
- transition:
13
- background var(--transition-duration) ease-in-out,
14
- border-color var(--transition-duration) ease-in-out,
15
- box-shadow var(--transition-duration) ease-in-out,
16
- color var(--transition-duration) ease-in-out,
17
- opacity var(--transition-duration) ease-in-out;
18
- width: var(--width);
19
- z-index: 1;
20
-
21
- @include tokens.state(hover) {
22
- z-index: 8;
23
- }
24
-
25
- @include tokens.state(active) {
26
- z-index: 9;
27
- }
28
-
29
-
30
- &--optional {
31
- max-height: var(--max-height);
32
- opacity: 0;
33
- pointer-events: none;
34
- transition:
35
- background var(--transition-duration) ease-in-out,
36
- border-color var(--transition-duration) ease-in-out,
37
- box-shadow var(--transition-duration) ease-in-out,
38
- color var(--transition-duration) ease-in-out,
39
- max-height var(--transition-duration) ease-in-out,
40
- opacity var(--transition-duration) ease-in-out;
41
-
42
- #{tokens.state(active, '.field')} & {
43
- opacity: 1;
44
- pointer-events: auto;
45
- }
46
- }
47
-
48
-
49
- &-description,
50
- &-error,
51
- &-title {
52
- color: var(--color);
53
- font-size: var(--font-size);
54
- position: relative;
55
- width: 100%;
56
- word-wrap: break-word;
57
-
58
- &:empty {
59
- height: 0px;
60
- margin: 0;
61
- }
62
- }
63
-
64
- &-error {
65
- animation: FieldError 0.32s 1 linear;
66
-
67
- @keyframes FieldError {
68
- 0% {
69
- transform: translate(8px);
70
- }
71
-
72
- 20% {
73
- transform: translate(-8px);
74
- }
75
-
76
- 40% {
77
- transform: translate(4px);
78
- }
79
-
80
- 60% {
81
- transform: translate(-4px);
82
- }
83
-
84
- 80% {
85
- transform: translate(2px);
86
- }
87
-
88
- 100% {
89
- transform: translate(0px);
90
- }
91
- }
92
- }
93
-
94
- &-mask {
95
-
96
- // Pseudo Element Box Shadow
97
- &::after {
98
- @include lib.position(absolute, full);
99
- border-radius: inherit;
100
- box-shadow: var(--box-shadow);
101
- content: '';
102
- pointer-events: none;
103
- transition:
104
- box-shadow var(--transition-duration) ease-in-out,
105
- opacity var(--transition-duration) ease-in-out,
106
- transform var(--transition-duration) ease-in-out;
107
- z-index: 0;
108
- }
109
-
110
- &--flat {
111
- &::after {
112
- display: none;
113
- }
114
- }
115
-
116
- &--outline {
117
- &::before {
118
- @include lib.position(absolute, full);
119
- box-shadow: 0 0 0 var(--outline-width) var(--border-color);
120
- border-radius: var(--border-radius);
121
- content: '';
122
- opacity: var(--outline-opacity);
123
- pointer-events: none;
124
- transition:
125
- box-shadow var(--transition-duration) ease-in-out,
126
- opacity var(--transition-duration) ease-in-out;
127
- z-index: 0;
128
- }
129
- }
130
- }
131
-
132
- &-required {
133
- background: var(--background);
134
- border-radius: var(--border-radius);
135
- height: var(--size);
136
- width: var(--size);
137
- }
138
-
139
- &-tag {
140
- &--hidden {
141
- @include lib.position(absolute, 0 null null 0);
142
- appearance: none;
143
- height: 0px;
144
- opacity: 0;
145
- pointer-events: none;
146
- width: 0px;
147
- z-index: -1;
148
- }
149
- }
150
-
151
- &-title {
152
- font-weight: var(--font-weight);
153
- z-index: 1;
154
- }
155
-
156
-
157
- @include check.css();
158
- @include text.css();
159
- }
@@ -1,137 +0,0 @@
1
- @use '/tokens';
2
- @use 'check' as check;
3
- @use 'text' as text;
4
-
5
- .field {
6
- --width: 100%;
7
-
8
-
9
- &--optional {
10
- --max-height: 0;
11
- --max-height-active: 0;
12
-
13
- #{tokens.state(active, '.field')} & {
14
- --max-height: var(--max-height-active);
15
- }
16
- }
17
-
18
-
19
- &-description,
20
- &-error {
21
- --font-size: var(--font-size-300);
22
- }
23
-
24
- &-error {
25
- --color: var(--color-red-400);
26
- }
27
-
28
- &-mask {
29
- --background: var(--background-default);
30
- --background-active: var(--background-default);
31
- --background-default: transparent;
32
- --background-hover: var(--background-default);
33
- --background-pressed: var(--background-default);
34
- --border-color: var(--border-color-default);
35
- --border-color-default: var(--background);
36
- --border-radius: var(--border-radius-400);
37
- --border-style: solid;
38
- --border-width: 0px;
39
- --box-shadow: var(--box-shadow-default);
40
- --box-shadow-active: var(--box-shadow-400);
41
- --box-shadow-default: var(--box-shadow-300);
42
- --box-shadow-hover: var(--box-shadow-400);
43
- --box-shadow-pressed: none;
44
- --color: var(--color-default);
45
- --color-active: var(--color-default);
46
- --color-default: var(--color-text-400);
47
- --color-hover: var(--color-default);
48
- --color-pressed: var(--color-default);
49
- --outline-opacity: var(--outline-opacity-default);
50
- --outline-opacity-active: 0.32;
51
- --outline-opacity-default: 0;
52
- --outline-opacity-hover: 0;
53
- --outline-opacity-pressed: 0;
54
- --outline-spacing: 0px;
55
- --outline-width: var(--outline-width-default);
56
- --outline-width-active: 4px;
57
- --outline-width-default: 0px;
58
- --outline-width-hover: 0px;
59
- --outline-width-pressed: 0px;
60
- --padding-horizontal: 0px;
61
- --padding-vertical: var(--size-400);
62
-
63
-
64
- #{tokens.state(active, '.field')} > &,
65
- #{tokens.state(active, '.field')} *:not(.field) & {
66
- --background: var(--background-active);
67
- --border-color: var(--border-color-active);
68
- --box-shadow: var(--box-shadow-active);
69
- --color: var(--color-active);
70
- --outline-opacity: var(--outline-opacity-active);
71
- --outline-width: var(--outline-width-active);
72
- }
73
-
74
- $inactive: tokens.state(inactive, '.field');
75
-
76
- #{tokens.state(hover, 'label#{$inactive}')} > &,
77
- #{tokens.state(hover, '#{$inactive}:not(label) &')} {
78
- --background: var(--background-hover);
79
- --border-color: var(--border-color-hover);
80
- --box-shadow: var(--box-shadow-hover);
81
- --color: var(--color-hover);
82
- --outline-opacity: var(--outline-opacity-hover);
83
- --outline-width: var(--outline-width-hover);
84
- }
85
-
86
- #{tokens.state(pressed, 'label#{$inactive}')} > &,
87
- #{tokens.state(pressed, '#{$inactive}:not(label) &')} {
88
- --background: var(--background-pressed);
89
- --border-color: var(--border-color-pressed);
90
- --box-shadow: var(--box-shadow-pressed);
91
- --color: var(--color-pressed);
92
- --outline-opacity: var(--outline-opacity-pressed);
93
- --outline-width: var(--outline-width-pressed);
94
- }
95
-
96
- &--outline {
97
- @include tokens.state(pressed) {
98
- --border-color: var(--border-color-default);
99
-
100
- &::before {
101
- --outline-width: 0px;
102
- }
103
- }
104
- }
105
- }
106
-
107
- &-required {
108
- --border-radius: var(--border-radius-circle);
109
- --size: 6px;
110
- }
111
-
112
- &-title {
113
- --color: var(--color-default);
114
- --color-active: var(--color-default);
115
- --color-default: var(--color-text-400);
116
- --color-hover: var(--color-default);
117
- --color-pressed: var(--color-default);
118
- --font-size: var(--font-size-400);
119
- --font-weight: var(--font-weight-500);
120
-
121
- #{tokens.state(active, '.field')} & {
122
- --color: var(--color-active);
123
- }
124
-
125
- #{tokens.state(hover, '.field')} & {
126
- --color: var(--color-hover);
127
- }
128
-
129
- #{tokens.state(pressed, '.field')} & {
130
- --color: var(--color-pressed);
131
- }
132
- }
133
-
134
-
135
- @include check.variables();
136
- @include text.variables();
137
- }
@@ -1,153 +0,0 @@
1
- import { reactive } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
3
- import form from '~/components/form';
4
- import scrollbar from '~/components/scrollbar';
5
- import root from '~/components/root';
6
- import description from './description';
7
- import error from './error';
8
- import title from './title';
9
-
10
-
11
- type Data = {
12
- class?: string;
13
- effect?: (selected: number | string) => void;
14
- mask?: {
15
- class?: string;
16
- content?: any;
17
- style?: string;
18
- };
19
- name?: string;
20
- options: Record<number | string, number | string>;
21
- option?: {
22
- class?: string;
23
- style?: string;
24
- };
25
- selected?: any;
26
- scrollbar?: {
27
- style?: string;
28
- };
29
- style?: string;
30
- text?: {
31
- class?: string;
32
- };
33
- tooltip?: {
34
- class?: string;
35
- direction?: any;
36
- style?: string;
37
- };
38
- } & Parameters<typeof description>[0] & Parameters<typeof title>[0];
39
-
40
-
41
- function parse(keys: (number | string)[], selected: number | string) {
42
- let options: Record<string, boolean> = {};
43
-
44
- for (let key of keys) {
45
- options[key] = false;
46
- }
47
-
48
- options[selected] = true;
49
-
50
- return {
51
- options,
52
- selected: selected || keys[0]
53
- };
54
- }
55
-
56
- function template(data: Data, state: { active: boolean, options: Record<number | string, boolean>, selected: number | string }) {
57
- let { attributes: a, html: h } = scrollbar({
58
- attributes: {
59
- style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
60
- },
61
- fixed: true
62
- });
63
-
64
- return html`
65
- <div
66
- class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'
67
- style='${data?.tooltip?.style || ''}'
68
- >
69
- <div
70
- class='row --flex-column'
71
- onclick='${(e: Event) => {
72
- let key = (e?.target as HTMLElement)?.dataset?.key;
73
-
74
- if (key === undefined) {
75
- return;
76
- }
77
-
78
- // Swap active
79
- state.options[key] = true;
80
- state.options[state.selected] = false;
81
-
82
- state.active = false;
83
- state.selected = key;
84
-
85
- if (data.effect) {
86
- data.effect(key);
87
- }
88
- }}'
89
- ${a}
90
- >
91
- ${Object.keys( data.options || {} ).map((key: number | string) => html`
92
- <div
93
- class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
94
- style='${data?.option?.style || ''}'
95
- >
96
- <span class="--text-truncate">
97
- ${data.options[key]}
98
- </span>
99
- </div>
100
- `)}
101
- </div>
102
-
103
- ${h}
104
- </div>
105
- `;
106
- }
107
-
108
-
109
- export default (data: Data) => {
110
- let state = reactive(Object.assign({
111
- active: false,
112
- error: '',
113
- render: false,
114
- }, parse(Object.keys( data.options || {} ), data.selected)));
115
-
116
- return html`
117
- <div class="field tooltip ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column" style='${data?.style || ''}'>
118
- ${title(data)}
119
-
120
- <label
121
- class="field-mask field-mask--select --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300 --padding-400"
122
- onclick='${() => {
123
- state.render = true;
124
- state.active = !state.active;
125
-
126
- if (state.active) {
127
- root.onclick.add(() => state.active = false);
128
- }
129
- }}'
130
- style='${data?.mask?.style || ''}'
131
- >
132
- <input
133
- class='field-tag field-tag--hidden'
134
- name='${data.name}'
135
- onclick='${() => { /* Prevent double click events from firing */ }}'
136
- onrender='${form.input.attributes(state)}'
137
- value='${() => state.selected}'
138
- >
139
-
140
- <div class="field-text ${data?.text?.class || ''}" style='pointer-events: none'>
141
- ${() => data.options[ state.selected ] || '-'}
142
- </div>
143
-
144
- <div class='field-mask-arrow'></div>
145
-
146
- ${() => state.render ? template(data, state) : ''}
147
- </label>
148
-
149
- ${description(data)}
150
- ${error(state)}
151
- </div>
152
- `;
153
- };
@@ -1,9 +0,0 @@
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
- };
@@ -1,68 +0,0 @@
1
- import { reactive } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
3
- import form from '~/components/form';
4
- import description from './description';
5
- import error from './error';
6
- import title from './title';
7
-
8
-
9
- type Data = {
10
- class?: string;
11
- mask?: {
12
- class?: string;
13
- content?: any;
14
- style?: string;
15
- };
16
- name?: string;
17
- placeholder?: string;
18
- style?: string;
19
- tag?: {
20
- class?: string;
21
- };
22
- textarea?: boolean;
23
- type?: string;
24
- value?: unknown;
25
- } & Parameters<typeof description>[0] & Parameters<typeof title>[0];
26
-
27
-
28
- export default (data: Data) => {
29
- let state = reactive({
30
- active: false,
31
- error: ''
32
- });
33
-
34
- return html`
35
- <div
36
- class="field ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column"
37
- onfocusin='${() => {
38
- state.active = true;
39
- }}'
40
- onfocusout='${() => {
41
- state.active = false;
42
- }}'
43
- style='${data?.style || ''}'
44
- >
45
- ${title(data)}
46
-
47
- <label
48
- class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) ? '--margin-top' : ''} --margin-300'
49
- style='${data?.mask?.style || ''}'
50
- >
51
- <${data?.textarea ? 'textarea' : 'input'}
52
- class='field-tag --padding-400 ${data?.tag?.class || ''}'
53
- name='${data?.name || ''}'
54
- placeholder='${data?.placeholder || ''}'
55
- onrender='${form.input.attributes(state)}'
56
- type='${data?.type || 'string'}'
57
- ${!data?.textarea && data?.value !== undefined ? html`value='${data.value}'` : ''}
58
- >
59
- ${data?.textarea ? html`${data?.value || ''}</textarea>` : ''}
60
-
61
- ${data?.mask?.content || ''}
62
- </label>
63
-
64
- ${description(data)}
65
- ${error(state)}
66
- </div>
67
- `;
68
- };
@@ -1,8 +0,0 @@
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
- };
@@ -1,23 +0,0 @@
1
- import { html } from '@esportsplus/template';
2
- import tooltip from '~/components/tooltip';
3
-
4
-
5
- export default (data: { required?: boolean, title?: string }) => {
6
- if (!data?.title) {
7
- return '';
8
- }
9
-
10
- let { attributes } = tooltip.onhover();
11
-
12
- return html`
13
- <div class="field-title --flex-horizontal-space-between --flex-vertical">
14
- ${data.title}
15
-
16
- ${data?.required && html`
17
- <div class="bubble --background-primary --margin-left" ${attributes}>
18
- <span class="tooltip-message tooltip-message--w">Required</span>
19
- </div>
20
- `}
21
- </div>
22
- `;
23
- }