@esportsplus/ui 0.2.3 → 0.2.9

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 (112) hide show
  1. package/build/components/accordion/index.d.ts +15 -0
  2. package/build/components/accordion/index.js +27 -0
  3. package/build/components/aurora/index.d.ts +8 -0
  4. package/build/components/aurora/index.js +12 -0
  5. package/build/components/clipboard/index.d.ts +4 -0
  6. package/build/components/clipboard/index.js +2 -0
  7. package/build/components/clipboard/write.d.ts +2 -0
  8. package/build/components/clipboard/write.js +9 -0
  9. package/build/components/ellipsis/index.d.ts +2 -0
  10. package/build/components/ellipsis/index.js +8 -0
  11. package/build/components/field/description.d.ts +1 -1
  12. package/build/components/field/error.d.ts +1 -1
  13. package/build/components/field/index.d.ts +65 -180
  14. package/build/components/field/optional.d.ts +7 -87
  15. package/build/components/field/select.js +4 -2
  16. package/build/components/field/title.d.ts +1 -1
  17. package/build/components/form/action.js +1 -2
  18. package/build/components/form/index.d.ts +5 -5
  19. package/build/components/form/input.d.ts +1 -1
  20. package/build/components/form/types.d.ts +0 -1
  21. package/build/components/json/index.d.ts +4 -0
  22. package/build/components/json/index.js +2 -0
  23. package/build/components/scrollbar/index.d.ts +3 -3
  24. package/build/components/scrollbar/index.js +3 -5
  25. package/build/components/site/index.d.ts +2 -3
  26. package/build/components/site/index.js +6 -5
  27. package/build/components/tooltip/index.d.ts +2 -27
  28. package/build/components/tooltip/index.js +2 -13
  29. package/build/index.d.ts +5 -2
  30. package/build/index.js +5 -2
  31. package/components/styles.css +14 -14
  32. package/components/variables.css +18 -19
  33. package/package.json +5 -5
  34. package/src/components/accordion/index.ts +34 -0
  35. package/src/components/accordion/scss/variables.scss +6 -1
  36. package/src/components/anchor/scss/variables.scss +0 -1
  37. package/src/components/aurora/index.ts +22 -0
  38. package/src/components/aurora/scss/index.scss +60 -0
  39. package/src/components/banner/scss/index.scss +1 -1
  40. package/src/components/banner/scss/variables.scss +4 -0
  41. package/src/components/button/scss/index.scss +25 -3
  42. package/src/components/button/scss/variables.scss +3 -6
  43. package/src/components/card/scss/variables.scss +0 -1
  44. package/src/components/clipboard/index.ts +4 -0
  45. package/src/components/clipboard/write.ts +9 -0
  46. package/src/components/container/scss/index.scss +2 -4
  47. package/src/components/container/scss/variables.scss +2 -2
  48. package/src/components/ellipsis/index.ts +10 -0
  49. package/src/components/ellipsis/scss/index.scss +19 -63
  50. package/src/components/ellipsis/scss/variables.scss +3 -1
  51. package/src/components/field/scss/index.scss +2 -2
  52. package/src/components/field/scss/variables.scss +0 -1
  53. package/src/components/field/select.ts +4 -2
  54. package/src/components/form/action.ts +3 -2
  55. package/src/components/form/types.ts +1 -1
  56. package/src/components/grid/scss/index.scss +6 -0
  57. package/src/components/grid/scss/variables.scss +6 -0
  58. package/src/components/group/scss/index.scss +4 -4
  59. package/src/components/icon/scss/index.scss +0 -1
  60. package/src/components/json/index.ts +4 -0
  61. package/src/components/link/scss/variables.scss +0 -1
  62. package/src/components/loading/scss/index.scss +9 -16
  63. package/src/components/loading/scss/variables.scss +3 -28
  64. package/src/components/modal/scss/index.scss +7 -4
  65. package/src/components/modal/scss/variables.scss +3 -7
  66. package/src/components/page/scss/variables.scss +0 -12
  67. package/src/components/root/onclick.ts +1 -1
  68. package/src/components/root/scss/variables.scss +2 -5
  69. package/src/components/scrollbar/index.ts +3 -5
  70. package/src/components/scrollbar/scss/index.scss +2 -1
  71. package/src/components/scrollbar/scss/variables.scss +1 -1
  72. package/src/components/sidebar/scss/index.scss +5 -6
  73. package/src/components/sidebar/scss/variables.scss +4 -5
  74. package/src/components/site/index.ts +9 -8
  75. package/src/components/text/scss/variables.scss +0 -1
  76. package/src/components/tooltip/index.ts +4 -17
  77. package/src/components/tooltip/scss/variables.scss +0 -1
  78. package/src/css-utilities/absolute/scss/index.scss +11 -34
  79. package/src/css-utilities/hidden/scss/index.scss +1 -1
  80. package/src/css-utilities/squircle/scss/index.scss +5 -0
  81. package/src/css-utilities/text/scss/index.scss +2 -6
  82. package/src/css-utilities/text/scss/variables.scss +7 -7
  83. package/src/index.ts +5 -2
  84. package/src/lib/scss/breakpoint.scss +3 -3
  85. package/src/lib/scss/position.scss +25 -49
  86. package/src/tokens/scss/box-shadow.scss +17 -12
  87. package/src/tokens/scss/transition-duration.scss +1 -5
  88. package/tsconfig.json +1 -9
  89. package/utilities/styles.css +4 -4
  90. package/utilities/variables.css +1 -3
  91. package/build/components/alert/index.d.ts +0 -10
  92. package/build/components/alert/index.js +0 -122
  93. package/build/components/export/clipboard.d.ts +0 -2
  94. package/build/components/export/clipboard.js +0 -8
  95. package/build/components/export/index.d.ts +0 -5
  96. package/build/components/export/index.js +0 -3
  97. package/build/components/tooltip/menu.d.ts +0 -25
  98. package/build/components/tooltip/menu.js +0 -44
  99. package/src/components/alert/index.ts +0 -157
  100. package/src/components/alert/scss/index.scss +0 -55
  101. package/src/components/alert/scss/variables.scss +0 -8
  102. package/src/components/export/clipboard.ts +0 -12
  103. package/src/components/export/index.ts +0 -5
  104. package/src/components/processing/scss/index.scss +0 -47
  105. package/src/components/processing/scss/variables.scss +0 -11
  106. package/src/components/tooltip/menu.ts +0 -71
  107. package/src/css-utilities/slide/scss/index.scss +0 -21
  108. package/src/css-utilities/slide/scss/variables.scss +0 -10
  109. package/src/css-utilities/transition/scss/variables.scss +0 -14
  110. /package/build/components/{export/json.d.ts → json/download.d.ts} +0 -0
  111. /package/build/components/{export/json.js → json/download.js} +0 -0
  112. /package/src/components/{export/json.ts → json/download.ts} +0 -0
@@ -1,44 +0,0 @@
1
- import { effect } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
3
- function template(data) {
4
- return html `
5
- <div class="tooltip-content tooltip-content--${data?.direction || 's'} --flex-column --width-full ${data?.class || ''}" style='${data?.style || ''}'>
6
- ${(data?.items || []).map(item => html `
7
- ${item?.border ? html `
8
- <div
9
- class="border ${item?.border?.class || ''}"
10
- style='
11
- margin-left: calc(var(--margin-horizontal) * -1);
12
- width: calc(100% + var(--margin-horizontal) * 2);
13
- '
14
- ></div>
15
- ` : ''}
16
-
17
- <${item?.url ? 'a' : 'div'}
18
- class='link --flex-vertical ${item?.class}' ${item?.onclick ? html `onclick='${item.onclick}'` : ''}
19
- style='${item?.style || ''}'
20
- ${item?.url ? `href='${item.url}' target='${item.target || '_blank'}'` : ''}
21
- >
22
- ${item?.svg ? html `
23
- <div class="icon --margin-right --margin-300" style='margin-left: var(--size-100)'>
24
- ${item.svg}
25
- </div>
26
- ` : ''}
27
-
28
- <div class="text --color-text --flex-fill">
29
- ${item.text}
30
- </div>
31
- </${item?.url ? 'a' : 'div'}>
32
- `)}
33
- </div>
34
- `;
35
- }
36
- export default (data, state) => {
37
- effect(() => {
38
- if (!state.active || state.render) {
39
- return;
40
- }
41
- state.render = true;
42
- });
43
- return () => state.render ? template(data) : '';
44
- };
@@ -1,157 +0,0 @@
1
- import { reactive } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
3
-
4
-
5
- type Type = 'error' | 'info' | 'success';
6
-
7
-
8
- let modifiers: Record<Type, string> = {
9
- error: 'red',
10
- info: 'black',
11
- success: 'green'
12
- },
13
- state = reactive({
14
- active: false,
15
- messages: new Set as Set<string>,
16
- seconds: 0,
17
- state: 'activating',
18
- type: '' as Type
19
- }),
20
- timeout = 250;
21
-
22
-
23
- function activate(key: Type, messages: string | string[], seconds: number = 0) {
24
- if (!Array.isArray(messages)) {
25
- messages = [messages];
26
- }
27
-
28
- if (!messages.length) {
29
- return;
30
- }
31
-
32
- if (state.type !== key) {
33
- state.messages.clear();
34
- }
35
- else {
36
- // @ts-ignore
37
- state.type = '';
38
- }
39
-
40
- for (let message of messages) {
41
- state.messages.add(message);
42
- }
43
-
44
- state.state = 'activating';
45
- state.type = key;
46
-
47
- // Slide in animation needs time
48
- if (state.active) {
49
- state.active = true;
50
-
51
- if (seconds) {
52
- if (!state.seconds) {
53
- state.seconds = seconds;
54
- }
55
-
56
- setTimeout(() => {
57
- if (messages && messages.length < (state?.messages?.size || 0)) {
58
- for (let message of messages) {
59
- state.messages.delete(message);
60
- }
61
-
62
- state.messages = state.messages;
63
- }
64
- else {
65
- deactivate();
66
- }
67
- }, 400 * seconds);
68
- }
69
- else {
70
- state.seconds = 0;
71
- }
72
- return;
73
- }
74
-
75
- setTimeout(() => {
76
- state.active = true;
77
-
78
- if (seconds) {
79
- if (!state.seconds) {
80
- state.seconds = seconds;
81
- }
82
-
83
- setTimeout(() => {
84
- if (messages && messages.length < (state?.messages?.size || 0)) {
85
- for (let message of messages) {
86
- state.messages.delete(message);
87
- }
88
-
89
- state.messages = state.messages;
90
- }
91
- else {
92
- deactivate();
93
- }
94
- }, 400 * seconds);
95
- }
96
- else {
97
- state.seconds = 0;
98
- }
99
- }, timeout);
100
- }
101
-
102
- function deactivate() {
103
- state.state = 'deactivating';
104
-
105
- setTimeout(() => {
106
- state.active = false;
107
- state.messages.clear();
108
- }, timeout);
109
- }
110
-
111
-
112
- const error = (messages: string | string[], seconds: number = 0) => activate('error', messages, seconds);
113
-
114
- const info = (messages: string | string[], seconds: number = 0) => activate('info', messages, seconds);
115
-
116
- const success = (messages: string | string[], seconds: number = 0) => activate('success', messages, seconds);
117
-
118
-
119
- const h = () => {
120
- // TODO: Fix importing close svg
121
- return () => state.active ? html`
122
- <div class='alert anchor anchor--ne ${() => state.active && '--active'} ${() => `alert--${state.state}`}'>
123
- <div class="alert-close --flex-start --margin-right --margin-100" onclick='${deactivate}'>
124
- <div class='button --background-state ${() => `--background-${modifiers[state.type] || 'black'}`} --color-state --color-white --flex-center --padding-300'>
125
- <div class="icon --size-300">
126
- ${html.inline`
127
- <svg width="16" height="16" viewBox="0 0 16 16">
128
- <path d="M3.527 14.948a.176.176 0 01-.248 0L1.051 12.72a.176.176 0 010-.248l11.42-11.419a.176.176 0 01.248 0l2.229 2.228a.174.174 0 010 .248L3.527 14.948z"/>
129
- <path d="M12.472 14.948c.068.068.18.068.248 0l2.229-2.229a.176.176 0 000-.248L3.528 1.052a.176.176 0 00-.248 0L1.052 3.28a.176.176 0 000 .248l11.42 11.42z"/>
130
- </svg>
131
- `}
132
- </div>
133
- </div>
134
- </div>
135
-
136
- <div class="card --overflow-hidden" style='--background: var(--color-white-400)'>
137
- <div class="alert-message --active --flex-row --padding --padding-horizontal-500 --padding-vertical-400">
138
- <div class='--flex-row --flex-fill --flex-vertical'>
139
- <div class="--flex-fill --flex-column --padding-right --padding-400">
140
- <h5 class="page-title">
141
- ${() => state.type.charAt(0).toUpperCase() + state.type.slice(1)}
142
- </h5>
143
- ${() => state.type && [...state.messages].map((message) => html`
144
- <p class='--margin-top --margin-border-width-500'>${message}</p>
145
- `)}
146
- </div>
147
- </div>
148
- </div>
149
- </div>
150
- </div>
151
- ` : '';
152
- };
153
-
154
- const types = ['error', 'info', 'success'] as const;
155
-
156
-
157
- export default { deactivate, error, html: h, info, success, types };
@@ -1,55 +0,0 @@
1
- @use '/lib';
2
- @use '/tokens';
3
-
4
- .alert {
5
- max-width: var(--max-width);
6
- width: calc(100% - (var(--margin-horizontal) * 2));
7
-
8
-
9
- &--deactivating {
10
- opacity: 0;
11
- transform: translateY(-50%);
12
- }
13
-
14
- &--activating {
15
- @include tokens.state(inactive) {
16
- transform: translateY(50%);
17
- }
18
- }
19
-
20
-
21
- &-close {
22
- @include lib.position(absolute, 0 100% 0 null);
23
- animation: alert-close var(--transition-duration) ease-in-out;
24
- transition: transform var(--transition-duration) ease-in-out;
25
- z-index: 0;
26
- }
27
-
28
- &-message {
29
- opacity: 0;
30
- transition:
31
- opacity var(--transition-duration) ease-in-out,
32
- transform var(--transition-duration) ease-in-out;
33
-
34
- @include tokens.state(inactive) {
35
- pointer-events: none;
36
- position: absolute;
37
- transform: translateX(calc(25% * -1));
38
- left: 0;
39
- top: 0;
40
- }
41
-
42
- @include tokens.state(active) {
43
- opacity: 1;
44
- }
45
- }
46
- }
47
-
48
- @keyframes alert-close {
49
- from {
50
- transform: translateX(150%);
51
- }
52
- to {
53
- transform: translateX(0);
54
- }
55
- }
@@ -1,8 +0,0 @@
1
- .alert {
2
- --max-width: 420px;
3
-
4
- &-close,
5
- &-message {
6
- --transition-duration: var(--transition-duration-400);
7
- }
8
- }
@@ -1,12 +0,0 @@
1
- export default (value: string) => {
2
- let input = document.createElement('INPUT') as HTMLInputElement;
3
-
4
- document.body.appendChild(input);
5
-
6
- input.setAttribute('value', value);
7
- input.select();
8
-
9
- document.execCommand('copy');
10
-
11
- document.body.removeChild(input);
12
- };
@@ -1,5 +0,0 @@
1
- import clipboard from './clipboard';
2
- import json from './json';
3
-
4
-
5
- export default { clipboard, json };
@@ -1,47 +0,0 @@
1
- @use '/lib';
2
-
3
- .processing {
4
- height: var(--size);
5
- position: relative;
6
- width: var(--size);
7
- animation: processing var(--animation-duration) linear infinite;
8
-
9
- &-ring {
10
- clip: rect(calc(var(--size) / 2), var(--size), var(--size), 0);
11
-
12
- &,
13
- &::after,
14
- &::before {
15
- @include lib.position(absolute, full);
16
- }
17
-
18
- &,
19
- &::before {
20
- animation: processing calc(var(--animation-duration) / 2) cubic-bezier(0.770, 0.000, 0.175, 1.000) infinite;
21
- }
22
-
23
- &::after,
24
- &::before {
25
- border-radius: 50%;
26
- content: "";
27
- }
28
-
29
- &::after {
30
- border: var(--border-width) var(--border-style) var(--border-color-secondary);
31
- opacity: var(--opacity);
32
- }
33
-
34
- &::before {
35
- border-top: var(--border-width) var(--border-style) var(--border-color-primary);
36
- }
37
- }
38
- }
39
-
40
- @keyframes processing {
41
- 0% {
42
- transform: rotate(0deg);
43
- }
44
- 100% {
45
- transform: rotate(360deg);
46
- }
47
- }
@@ -1,11 +0,0 @@
1
- .processing {
2
- --animation-duration: 2.64s;
3
- --border-color-primary: var(--color-black-500);
4
- --border-color-secondary: var(--color-border-300);
5
- --border-style: solid;
6
- --border-width: var(--border-width-600);
7
- --height: var(--size);
8
- --opacity: 0.64;
9
- --size: var(--size-600);
10
- --width: var(--size);
11
- }
@@ -1,71 +0,0 @@
1
- import { effect } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
3
-
4
-
5
- type Data = {
6
- class?: string;
7
- direction?: string;
8
- items?: {
9
- border?: {
10
- class?: string;
11
- };
12
- class?: string;
13
- onclick?: (...args: any[]) => void;
14
- style?: string;
15
- svg?: string;
16
- target?: string;
17
- text: string;
18
- url?: string;
19
- }[];
20
- state?: { active?: boolean };
21
- style?: string;
22
- };
23
-
24
-
25
- function template(data: Data) {
26
- return html`
27
- <div class="tooltip-content tooltip-content--${data?.direction || 's'} --flex-column --width-full ${data?.class || ''}" style='${data?.style || ''}'>
28
- ${(data?.items || []).map(item => html`
29
- ${item?.border ? html`
30
- <div
31
- class="border ${item?.border?.class || ''}"
32
- style='
33
- margin-left: calc(var(--margin-horizontal) * -1);
34
- width: calc(100% + var(--margin-horizontal) * 2);
35
- '
36
- ></div>
37
- ` : ''}
38
-
39
- <${item?.url ? 'a' : 'div'}
40
- class='link --flex-vertical ${item?.class}' ${item?.onclick ? html`onclick='${item.onclick}'` : ''}
41
- style='${item?.style || ''}'
42
- ${item?.url ? `href='${item.url}' target='${item.target || '_blank'}'` : ''}
43
- >
44
- ${item?.svg ? html`
45
- <div class="icon --margin-right --margin-300" style='margin-left: var(--size-100)'>
46
- ${item.svg}
47
- </div>
48
- ` : ''}
49
-
50
- <div class="text --color-text --flex-fill">
51
- ${item.text}
52
- </div>
53
- </${item?.url ? 'a' : 'div'}>
54
- `)}
55
- </div>
56
- `;
57
- }
58
-
59
-
60
- // TODO: There's nothing binding activate to tooltip menu ( this is never called outside initial effect run )
61
- export default (data: Data, state: { active?: boolean, render?: boolean }) => {
62
- effect(() => {
63
- if (!state.active || state.render) {
64
- return;
65
- }
66
-
67
- state.render = true;
68
- });
69
-
70
- return () => state.render ? template(data) : '';
71
- };
@@ -1,21 +0,0 @@
1
- .--slide {
2
- &-in,
3
- &-in-reverse {
4
- animation-duration: var(--transition-duration);
5
- animation-name: --slide-in;
6
- animation-timing-function: ease-in-out;
7
- transform-origin: top center;
8
-
9
- @keyframes --slide-in {
10
- from {
11
- opacity: 0;
12
- transform: translateY(var(--translateY));
13
- }
14
-
15
- to {
16
- opacity: 1;
17
- transform: translateY(0);
18
- }
19
- }
20
- }
21
- }
@@ -1,10 +0,0 @@
1
- .--slide {
2
- &-in {
3
- --transition-duration: 0.48s;
4
- --translateY: 32px;
5
-
6
- &-reverse {
7
- --translateY: -32px;
8
- }
9
- }
10
- }
@@ -1,14 +0,0 @@
1
- @use '/lib';
2
- @use '/tokens';
3
-
4
- .--transition {
5
- &-duration {
6
- --transition-duration: var(--transition-duration-400);
7
-
8
- @each $key in lib.map-keys(tokens.$transition-duration) {
9
- &-#{$key} {
10
- --transition-duration: var(--transition-duration-#{$key});
11
- }
12
- }
13
- }
14
- }