@esportsplus/ui 0.0.4 → 0.0.7

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 (120) hide show
  1. package/index.scss +1 -1
  2. package/package.json +15 -1
  3. package/{components → src/components}/accordion/scss/accordion.scss +0 -0
  4. package/{components → src/components}/accordion/scss/variables.scss +0 -0
  5. package/src/components/alert/index.ts +186 -0
  6. package/{components → src/components}/alert/scss/alert.scss +0 -0
  7. package/{components → src/components}/alert/scss/variables.scss +0 -0
  8. package/{components → src/components}/anchor/scss/anchor.scss +0 -0
  9. package/{components → src/components}/anchor/scss/anchors.scss +0 -0
  10. package/{components → src/components}/anchor/scss/variables.scss +0 -0
  11. package/{components → src/components}/banner/scss/banner.scss +0 -0
  12. package/{components → src/components}/border/scss/border.scss +0 -0
  13. package/{components → src/components}/border/scss/variables.scss +0 -0
  14. package/{components → src/components}/bubble/scss/bubble.scss +0 -0
  15. package/{components → src/components}/bubble/scss/variables.scss +0 -0
  16. package/{components → src/components}/button/scss/button.scss +0 -0
  17. package/{components → src/components}/button/scss/variables.scss +0 -0
  18. package/{components → src/components}/card/scss/card.scss +0 -0
  19. package/{components → src/components}/card/scss/variables.scss +0 -0
  20. package/{components → src/components}/container/scss/container.scss +0 -0
  21. package/{components → src/components}/container/scss/variables.scss +0 -0
  22. package/{components → src/components}/ellipsis/scss/ellipsis.scss +0 -0
  23. package/{components → src/components}/ellipsis/scss/variables.scss +0 -0
  24. package/{components → src/components}/field/scss/_check.scss +0 -0
  25. package/{components → src/components}/field/scss/_normalize.scss +0 -0
  26. package/{components → src/components}/field/scss/_text.scss +0 -0
  27. package/{components → src/components}/field/scss/field.scss +25 -0
  28. package/{components → src/components}/field/scss/variables.scss +0 -0
  29. package/src/components/form/action.ts +76 -0
  30. package/src/components/form/index.ts +4 -0
  31. package/src/components/form/layout.ts +32 -0
  32. package/src/components/form/types.ts +24 -0
  33. package/{components → src/components}/group/scss/group.scss +0 -0
  34. package/{components → src/components}/group/scss/variables.scss +0 -0
  35. package/{components → src/components}/icon/scss/icon.scss +0 -0
  36. package/{components → src/components}/icon/scss/variables.scss +0 -0
  37. package/src/components/index.ts +4 -0
  38. package/{components → src/components}/link/scss/link.scss +0 -0
  39. package/{components → src/components}/link/scss/variables.scss +0 -0
  40. package/{components → src/components}/loading/scss/loading.scss +0 -0
  41. package/{components → src/components}/loading/scss/variables.scss +0 -0
  42. package/src/components/page/index.ts +5 -0
  43. package/src/components/page/layout.ts +35 -0
  44. package/{components → src/components}/page/scss/page.scss +0 -0
  45. package/{components → src/components}/page/scss/variables.scss +0 -0
  46. package/{components → src/components}/processing/scss/processing.scss +0 -0
  47. package/{components → src/components}/processing/scss/variables.scss +0 -0
  48. package/{components → src/components}/root/scss/root.scss +0 -0
  49. package/{components → src/components}/root/scss/variables.scss +0 -0
  50. package/{components → src/components}/row/scss/row.scss +0 -0
  51. package/{components → src/components}/row/scss/variables.scss +0 -0
  52. package/src/components/scrollbar/index.ts +44 -0
  53. package/{components → src/components}/scrollbar/scss/scrollbar.scss +0 -0
  54. package/{components → src/components}/scrollbar/scss/variables.scss +0 -0
  55. package/{components → src/components}/sidebar/scss/sidebar.scss +0 -0
  56. package/{components → src/components}/sidebar/scss/sidebars.scss +0 -0
  57. package/{components → src/components}/sidebar/scss/variables.scss +0 -0
  58. package/{components → src/components}/site/scss/site.scss +0 -0
  59. package/src/components/state/index.ts +22 -0
  60. package/{components → src/components}/text/scss/text.scss +0 -0
  61. package/{components → src/components}/text/scss/variables.scss +0 -0
  62. package/{components → src/components}/thumbnail/scss/thumbnail.scss +0 -0
  63. package/{components → src/components}/thumbnail/scss/variables.scss +0 -0
  64. package/{components → src/components}/tooltip/scss/_center.scss +0 -0
  65. package/{components → src/components}/tooltip/scss/_east.scss +0 -0
  66. package/{components → src/components}/tooltip/scss/_north.scss +0 -0
  67. package/{components → src/components}/tooltip/scss/_south.scss +0 -0
  68. package/{components → src/components}/tooltip/scss/_west.scss +0 -0
  69. package/{components → src/components}/tooltip/scss/tooltip.scss +0 -0
  70. package/{components → src/components}/tooltip/scss/variables.scss +0 -0
  71. package/{css-utilities → src/css-utilities}/[margin,padding]/scss/styles.scss +0 -0
  72. package/{css-utilities → src/css-utilities}/[margin,padding]/scss/variables.scss +0 -0
  73. package/{css-utilities → src/css-utilities}/[max,min]/scss/styles.scss +0 -0
  74. package/{css-utilities → src/css-utilities}/[max,min]/scss/variables.scss +0 -0
  75. package/{css-utilities → src/css-utilities}/absolute/scss/absolute.scss +0 -0
  76. package/{css-utilities → src/css-utilities}/background/scss/variables.scss +0 -0
  77. package/{css-utilities → src/css-utilities}/border/scss/border.scss +0 -0
  78. package/{css-utilities → src/css-utilities}/border/scss/variables.scss +0 -0
  79. package/{css-utilities → src/css-utilities}/color/scss/variables.scss +0 -0
  80. package/{css-utilities → src/css-utilities}/disabled/scss/disabled.scss +0 -0
  81. package/{css-utilities → src/css-utilities}/disabled/scss/variables.scss +0 -0
  82. package/{css-utilities → src/css-utilities}/flex/scss/flex.scss +0 -0
  83. package/{css-utilities → src/css-utilities}/hidden/scss/hidden.scss +0 -0
  84. package/{css-utilities → src/css-utilities}/index.scss +0 -0
  85. package/{css-utilities → src/css-utilities}/inline/scss/inline.scss +0 -0
  86. package/{css-utilities → src/css-utilities}/line-height/scss/variables.scss +0 -0
  87. package/{css-utilities → src/css-utilities}/not-allowed/scss/not-allowed.scss +0 -0
  88. package/{css-utilities → src/css-utilities}/overflow/scss/overflow.scss +0 -0
  89. package/{css-utilities → src/css-utilities}/pointer/scss/pointer.scss +0 -0
  90. package/{css-utilities → src/css-utilities}/size/scss/variables.scss +0 -0
  91. package/{css-utilities → src/css-utilities}/slide/scss/slide.scss +0 -0
  92. package/{css-utilities → src/css-utilities}/slide/scss/variables.scss +0 -0
  93. package/{css-utilities → src/css-utilities}/text/scss/text.scss +0 -0
  94. package/{css-utilities → src/css-utilities}/text/scss/variables.scss +0 -0
  95. package/{css-utilities → src/css-utilities}/width/scss/variables.scss +0 -0
  96. package/{css-utilities → src/css-utilities}/width/scss/width.scss +0 -0
  97. package/src/index.ts +1 -0
  98. package/{lib → src/lib}/index.scss +0 -0
  99. package/{lib → src/lib}/scss/breakpoint.scss +0 -0
  100. package/{lib → src/lib}/scss/color.scss +0 -0
  101. package/{lib → src/lib}/scss/css-variables.scss +0 -0
  102. package/{lib → src/lib}/scss/list.scss +0 -0
  103. package/{lib → src/lib}/scss/map.scss +0 -0
  104. package/{lib → src/lib}/scss/position.scss +0 -0
  105. package/{lib → src/lib}/scss/string.scss +0 -0
  106. package/src/svg.d.ts +4 -0
  107. package/{tokens → src/tokens}/index.scss +0 -0
  108. package/{tokens → src/tokens}/scss/border-radius.scss +0 -0
  109. package/{tokens → src/tokens}/scss/border-width.scss +0 -0
  110. package/{tokens → src/tokens}/scss/box-shadow.scss +0 -0
  111. package/{tokens → src/tokens}/scss/breakpoints.scss +0 -0
  112. package/{tokens → src/tokens}/scss/color.scss +0 -0
  113. package/{tokens → src/tokens}/scss/font-size.scss +0 -0
  114. package/{tokens → src/tokens}/scss/font-weight.scss +0 -0
  115. package/{tokens → src/tokens}/scss/line-height.scss +0 -0
  116. package/{tokens → src/tokens}/scss/size.scss +0 -0
  117. package/{tokens → src/tokens}/scss/state.scss +0 -0
  118. package/{tokens → src/tokens}/scss/transition-duration.scss +0 -0
  119. package/tokens.scss +1 -0
  120. package/tsconfig.json +24 -0
package/index.scss CHANGED
@@ -1 +1 @@
1
- @forward 'lib';
1
+ @forward 'lib';
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "author": "ICJR",
3
3
  "dependencies": {
4
+ "@esportsplus/action": "^0.0.30",
5
+ "@esportsplus/reactivity": "^0.0.18",
6
+ "@esportsplus/template": "^0.0.11",
4
7
  "autoprefixer": "^10.4.8",
5
8
  "clean-webpack-plugin": "^4.0.0",
6
9
  "css-loader": "^6.7.1",
@@ -19,7 +22,18 @@
19
22
  "webpack-cli": "^4.10.0"
20
23
  },
21
24
  "description": "UI",
25
+ "devDependencies": {
26
+ "tsc-alias": "^1.8.2",
27
+ "typescript": "^4.9.4"
28
+ },
29
+ "main": "./build/index.js",
22
30
  "name": "@esportsplus/ui",
23
31
  "private": false,
24
- "version": "0.0.4"
32
+ "scripts": {
33
+ "build": "tsc && tsc-alias",
34
+ "-": "-",
35
+ "prepare": "npm run build",
36
+ "prepublishOnly": "npm run build"
37
+ },
38
+ "version": "0.0.7"
25
39
  }
@@ -0,0 +1,186 @@
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
+ processing: false,
17
+ seconds: 0,
18
+ state: 'activating',
19
+ type: '' as Type
20
+ }),
21
+ timeout = 250;
22
+
23
+
24
+ function activate(key: Type, messages: string | string[], seconds: number = 0) {
25
+ if (!Array.isArray(messages)) {
26
+ messages = [messages];
27
+ }
28
+
29
+ if (!messages.length) {
30
+ return;
31
+ }
32
+
33
+ state.messages.clear();
34
+
35
+ for (let message of messages) {
36
+ state.messages.add(message);
37
+ }
38
+
39
+ state.state = 'activating';
40
+ state.type = key;
41
+
42
+ // Slide in animation needs time
43
+ if (state.active) {
44
+ state.active = true;
45
+ state.processing = false;
46
+
47
+ if (seconds) {
48
+ if (!state.seconds) {
49
+ state.seconds = seconds;
50
+ }
51
+
52
+ setTimeout(() => {
53
+ if (messages && messages.length < (state?.messages?.size || 0)) {
54
+ for (let message of messages) {
55
+ state.messages.delete(message);
56
+ }
57
+
58
+ state.messages = state.messages;
59
+ }
60
+ else {
61
+ deactivate();
62
+ }
63
+ }, 400 * seconds);
64
+ }
65
+ else {
66
+ state.seconds = 0;
67
+ }
68
+ return;
69
+ }
70
+
71
+ setTimeout(() => {
72
+ state.active = true;
73
+ state.processing = false;
74
+
75
+ if (seconds) {
76
+ if (!state.seconds) {
77
+ state.seconds = seconds;
78
+ }
79
+
80
+ setTimeout(() => {
81
+ if (messages && messages.length < (state?.messages?.size || 0)) {
82
+ for (let message of messages) {
83
+ state.messages.delete(message);
84
+ }
85
+
86
+ state.messages = state.messages;
87
+ }
88
+ else {
89
+ deactivate();
90
+ }
91
+ }, 400 * seconds);
92
+ }
93
+ else {
94
+ state.seconds = 0;
95
+ }
96
+ }, timeout);
97
+ }
98
+
99
+ function deactivate() {
100
+ state.state = 'deactivating';
101
+
102
+ setTimeout(() => {
103
+ state.active = false;
104
+ state.messages.clear();
105
+ state.processing = false;
106
+ }, timeout);
107
+ }
108
+
109
+
110
+ const error = (messages: string | string[], seconds: number = 0) => activate('error', messages, seconds);
111
+
112
+ const info = (messages: string | string[], seconds: number = 0) => activate('info', messages, seconds);
113
+
114
+ const processing = () => {
115
+ state.state = 'activating';
116
+ state.processing = true;
117
+
118
+ // Slide in animation needs time
119
+ setTimeout(() => {
120
+ state.active = true;
121
+ }, timeout);
122
+ };
123
+
124
+ const success = (messages: string | string[], seconds: number = 0) => activate('success', messages, seconds);
125
+
126
+
127
+ const h = () => {
128
+ return () => state.active || state.processing ? html`
129
+ <div class='alert anchor anchor--ne ${() => state.active && '--active'} ${() => `alert--${state.state}`}'>
130
+ ${() => !state.processing ? html`
131
+ <div class="alert-close --flex-start --margin-right --margin-100" onclick='${deactivate}'>
132
+ <div class='button --background-state ${() => `--background-${modifiers[state.type] || 'black'}`} --color-state --color-white --flex-center --padding-300'>
133
+ <div class="icon --size-300">
134
+ <svg width="16" height="16" viewBox="0 0 16 16">
135
+ <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"/>
136
+ <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"/>
137
+ </svg>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ ` : ''}
142
+
143
+ <div class="card --overflow-hidden" style='--background: var(--color-white-400)'>
144
+ <div class="alert-message ${() => !state.processing && '--active'} --flex-row --padding --padding-horizontal-500 --padding-vertical-400">
145
+ <div class='--flex-row --flex-fill --flex-vertical'>
146
+ <div class="--flex-fill --flex-column --padding-right --padding-400">
147
+ <h5 class="page-title">
148
+ ${() => state.type.charAt(0).toUpperCase() + state.type.slice(1)}
149
+ </h5>
150
+ ${() => state.type && [...state.messages].map((message) => html`
151
+ <p class='--margin-top --margin-border-width-500'>${message}</p>
152
+ `)}
153
+ </div>
154
+
155
+ ${() => !state.processing && state.seconds ? html`
156
+ <svg class='alert-timer' style='--animation-duration: ${state.seconds}s;'>
157
+ <circle class="alert-timer-bg" cx="50%" cy="50%" r="40%" style='--border-color: var(--color-grey-500);' />
158
+ <circle class="alert-timer-meter" cx="50%" cy="50%" r="40%" style='--border-color: var(--color-black-300);' />
159
+ </svg>
160
+ ` : ''}
161
+ </div>
162
+ </div>
163
+
164
+ <div class='alert-processing ${() => state.processing && '--active'} --flex-row --flex-vertical --padding --padding-500'>
165
+ <div class="processing">
166
+ <span class='processing-ring'></span>
167
+ </div>
168
+ <div class='text --flex-fill --margin-left --margin-300 --text-bold' style='--color: var(--color-text-500)'>
169
+ Processing
170
+
171
+ <div class='ellipsis'>
172
+ <span class='ellipsis-dot --margin-left --margin-border-width'>.</span>
173
+ <span class='ellipsis-dot --margin-left --margin-border-width'>.</span>
174
+ <span class='ellipsis-dot --margin-left --margin-border-width'>.</span>
175
+ </div>
176
+ </div>
177
+ </div>
178
+ </div>
179
+ </div>
180
+ ` : '';
181
+ };
182
+
183
+ const types = ['error', 'info', 'success'] as const;
184
+
185
+
186
+ export default { deactivate, error, html: h, info, processing, success, types };
@@ -71,6 +71,31 @@
71
71
  }
72
72
  }
73
73
 
74
+ &-error {
75
+ animation: field-error 0.32s 1 linear;
76
+
77
+ @keyframes field-error {
78
+ 0% {
79
+ transform: translate(8px);
80
+ }
81
+ 20% {
82
+ transform: translate(-8px);
83
+ }
84
+ 40% {
85
+ transform: translate(4px);
86
+ }
87
+ 60% {
88
+ transform: translate(-4px);
89
+ }
90
+ 80% {
91
+ transform: translate(2px);
92
+ }
93
+ 100% {
94
+ transform: translate(0px);
95
+ }
96
+ }
97
+ }
98
+
74
99
  &-mask {
75
100
  // Pseudo Element Box Shadow
76
101
  &::after {
@@ -0,0 +1,76 @@
1
+ import { response } from '@esportsplus/action';
2
+ import { html } from '@esportsplus/template';
3
+ import alert from '~/components/alert';
4
+ import { Action, Reactive } from './types';
5
+
6
+
7
+ function parse(input: Record<string, any>) {
8
+ let data: Record<string, any> = {};
9
+
10
+ for (let path in input) {
11
+ let bucket = data,
12
+ keys = path.indexOf('.') !== -1 ? path.split('.') : [path];
13
+
14
+ for (let i = 0; i < keys.length - 1; i++) {
15
+ bucket = bucket[keys[i]] = bucket[keys[i]] || {};
16
+ }
17
+
18
+ bucket[ keys[keys.length - 1] ] = input[path];
19
+ }
20
+
21
+ return data;
22
+ };
23
+
24
+
25
+ export default function(action: Action, reactive: Reactive = {}) {
26
+ return html({
27
+ onclick: function(this: HTMLFormElement, event: Event) {
28
+ let trigger = event.target as HTMLButtonElement;
29
+
30
+ if (trigger?.type !== 'submit') {
31
+ return;
32
+ }
33
+
34
+ // On initial page load both events will be dispatched without preventDefault
35
+ event.preventDefault();
36
+
37
+ this.dispatchEvent(
38
+ new SubmitEvent('submit', { cancelable: true, bubbles:true, submitter: trigger })
39
+ );
40
+ },
41
+ onsubmit: async function(this: HTMLFormElement, event: SubmitEvent) {
42
+ event.preventDefault();
43
+
44
+ let { errors } = await action({
45
+ alert,
46
+ input: parse( Object.fromEntries( new FormData( this )?.entries() ) ),
47
+ processing: {
48
+ end: (deactivate: boolean = true) => {
49
+ if (deactivate) {
50
+ alert.deactivate();
51
+ }
52
+
53
+ event?.submitter?.classList.remove('button--processing');
54
+ },
55
+ start: () => {
56
+ alert.processing();
57
+ event?.submitter?.classList.add('button--processing');
58
+ }
59
+ },
60
+ response
61
+ });
62
+
63
+ if (errors && 'errors' in reactive) {
64
+ let messages: Record<string, string> = {};
65
+
66
+ for (let i = 0, n = errors.length; i < n; i++) {
67
+ let { message, path } = errors[i];
68
+
69
+ messages[path] = `${message[0].toUpperCase()}${message.substring(1)}`;
70
+ }
71
+
72
+ reactive.errors = messages;
73
+ }
74
+ }
75
+ });
76
+ };
@@ -0,0 +1,4 @@
1
+ import action from './action';
2
+
3
+
4
+ export default { action };
@@ -0,0 +1,32 @@
1
+ import { html } from '@esportsplus/template';
2
+ import { layout } from '~/components/page';
3
+
4
+
5
+ type Data = {
6
+ action?: any;
7
+ button?: {
8
+ class?: string;
9
+ content?: any;
10
+ style?: string;
11
+ };
12
+ content?: any;
13
+ width?: string;
14
+ };
15
+
16
+
17
+ export default (data: Data & Parameters<typeof layout>[0]) => {
18
+ data.content = html`
19
+ <form class='--margin-top --margin-800' ${data?.action || ''}>
20
+ ${data?.content || ''}
21
+
22
+ ${data?.button ? html`
23
+ <button class="button ${data?.button?.class || ''}" style='${data?.button?.style || ''}'>
24
+ ${data?.button?.content || ''}
25
+ </button>
26
+ ` : ''}
27
+ </form>
28
+ `;
29
+ data.width = data?.width || '480px';
30
+
31
+ return layout(data);
32
+ };
@@ -0,0 +1,24 @@
1
+ import { response, Response } from '@esportsplus/action';
2
+ import alert from '~/components/alert';
3
+
4
+
5
+ type Action = (data: Payload) => Promise<Errors> | Errors;
6
+
7
+ type Errors = { errors?: Response<unknown>['errors'] };
8
+
9
+ type Payload = {
10
+ alert: typeof alert;
11
+ input: Record<string, any>;
12
+ response: typeof response;
13
+ processing: {
14
+ end: (deactivate: boolean) => void;
15
+ start: VoidFunction;
16
+ }
17
+ };
18
+
19
+ type Reactive = {
20
+ errors?: Record<string, string>;
21
+ };
22
+
23
+
24
+ export { Action, Errors, Payload, Reactive };
@@ -0,0 +1,4 @@
1
+ export { default as form }from './form';
2
+ export { default as page }from './page';
3
+ export { default as scrollbar }from './scrollbar';
4
+ export { default as state }from './state';
@@ -0,0 +1,5 @@
1
+ import layout from './layout';
2
+
3
+
4
+ export default { layout };
5
+ export { layout };
@@ -0,0 +1,35 @@
1
+ import { html } from '@esportsplus/template';
2
+
3
+
4
+ type Data = {
5
+ content?: any;
6
+ subtitle?: string;
7
+ suptitle?: string;
8
+ title?: string;
9
+ width?: string;
10
+ };
11
+
12
+
13
+ export default ({ content, subtitle, suptitle, title, width }: Data) => html`
14
+ <div class="container --slide-in --margin-vertical --margin-900" style="${width && `--max-width: ${width};`}">
15
+ ${suptitle ? html`
16
+ <span class="page-suptitle --text-bold --text-crop --text-uppercase --text-200" style="--color-default: var(--color-primary-400);letter-spacing: 0.24px;">
17
+ ${suptitle}
18
+ </span>
19
+ ` : ''}
20
+
21
+ ${title ? html`
22
+ <h1 class="page-title --line-height-200 --margin-300 ${!subtitle && '--text-crop-bottom'} ${suptitle ? '--margin-top' : '--text-crop-top'}">
23
+ ${title}
24
+ </h1>
25
+ ` : ''}
26
+
27
+ ${subtitle ? html`
28
+ <span class="page-subtitle --margin-top --margin-300 --text-crop-bottom">
29
+ ${subtitle}
30
+ </span>
31
+ ` : ''}
32
+
33
+ ${content || ''}
34
+ </div>
35
+ `;
File without changes
@@ -0,0 +1,44 @@
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+
4
+
5
+ let root = document.body,
6
+ width: number | undefined;
7
+
8
+
9
+ export default ({ fixed, style }: { fixed?: boolean, style?: string } = {}) => {
10
+ let state = reactive({
11
+ height: 100,
12
+ translate: 0
13
+ });
14
+
15
+ return {
16
+ attributes: html({
17
+ class: () => {
18
+ return '--scrollbar';
19
+ },
20
+ onscroll: function(this: HTMLElement) {
21
+ if (width === undefined) {
22
+ width = this.offsetWidth - this.clientWidth;
23
+
24
+ if (width && width !== 17) {
25
+ root.style.setProperty('--scrollbar-width', `${width}px`);
26
+ }
27
+ }
28
+
29
+ state.height = (this.clientHeight / this.scrollHeight) * 100;
30
+ state.translate = (this.scrollTop / this.clientHeight) * 100;
31
+ }
32
+ }),
33
+ html: html`
34
+ <div
35
+ class='scrollbar ${fixed ? 'scrollbar--fixed' : ''} ${() => state.height >= 100 ? 'scrollbar--hidden' : ''}'
36
+ style='${() => `
37
+ ${style || ''}
38
+ --translate: translate3d(0, ${state.translate}%, 0);
39
+ --height: ${state.height}%;
40
+ `}'
41
+ ></div>
42
+ `
43
+ };
44
+ };
@@ -0,0 +1,22 @@
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+
4
+
5
+ const onfocus = (active: boolean = false) => {
6
+ let state = reactive({ active });
7
+
8
+ return html({
9
+ class: () => {
10
+ return state.active ? '--active' : '';
11
+ },
12
+ onfocusin: () => {
13
+ state.active = true;
14
+ },
15
+ onfocusout: () => {
16
+ state.active = false;
17
+ }
18
+ });
19
+ };
20
+
21
+
22
+ export default { onfocus };
File without changes
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/svg.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ declare module '*.svg' {
2
+ const content: any;
3
+ export default content;
4
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/tokens.scss ADDED
@@ -0,0 +1 @@
1
+ @forward 'src/tokens';
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "alwaysStrict": true,
5
+ "baseUrl": "src",
6
+ "declaration": true,
7
+ "declarationDir": "./build",
8
+ "lib": ["dom", "dom.iterable", "esnext"],
9
+ "module": "esnext",
10
+ "moduleResolution": "nodenext",
11
+ "noUnusedLocals": true,
12
+ "noUnusedParameters": true,
13
+ "outDir": "./build",
14
+ "paths": {
15
+ "~/*": ["*"]
16
+ },
17
+ "removeComments": true,
18
+ "resolveJsonModule": true,
19
+ "strict": true,
20
+ "target": "esnext"
21
+ },
22
+ "exclude": ["node_modules"],
23
+ "include": ["src"]
24
+ }