@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
@@ -7,25 +7,6 @@
7
7
  box-shadow: unset;
8
8
  }
9
9
 
10
- .--scrollbar {
11
- &-container {
12
- display: flex;
13
- flex-flow: column;
14
- overflow: hidden;
15
- position: relative;
16
- }
17
-
18
- &-content {
19
- height: 100%;
20
- margin-right: calc(var(--scrollbar-width) * -1);
21
- overflow-x: hidden;
22
- overflow-y: scroll;
23
- scrollbar-gutter: stable;
24
- scroll-behavior: smooth;
25
- width: calc(100% + var(--scrollbar-width));
26
- }
27
- }
28
-
29
10
  .scrollbar {
30
11
  height: 100%;
31
12
  z-index: 9;
@@ -57,4 +38,33 @@
57
38
  &--hidden {
58
39
  opacity: 0;
59
40
  }
41
+
42
+
43
+ &-container {
44
+ display: flex;
45
+ flex-flow: column;
46
+ overflow: hidden;
47
+ position: relative;
48
+ }
49
+
50
+ &-content {
51
+ height: 100%;
52
+ margin-right: calc(var(--scrollbar-width) * -1);
53
+ overflow-x: hidden;
54
+ overflow-y: scroll;
55
+ scrollbar-gutter: stable;
56
+ scroll-behavior: smooth;
57
+ width: calc(100% + var(--scrollbar-width));
58
+
59
+ &--snap {
60
+ overflow: auto;
61
+ scroll-snap-type: both mandatory;
62
+ overscroll-behavior-x: contain;
63
+
64
+ > * {
65
+ scroll-snap-stop: normal;
66
+ scroll-snap-align: center;
67
+ }
68
+ }
69
+ }
60
70
  }
@@ -4,24 +4,23 @@ import scrollbar from '~/components/scrollbar';
4
4
 
5
5
 
6
6
  type Data = {
7
- class?: string;
7
+ attributes?: Record<string, unknown>;
8
8
  content?: any;
9
9
  scrollbar?: Parameters<typeof scrollbar>[0];
10
10
  };
11
11
 
12
12
 
13
- export default (data: Data) => {
14
- let sb = data.scrollbar ??= {};
15
-
13
+ export default ({ attributes, content, scrollbar: sb }: Data) => {
14
+ sb ??= {};
16
15
  sb.attributes ??= {};
17
16
  sb.attributes.style ??= '--background-default: var(--color-black-400);';
18
17
  sb.fixed ??= true;
19
18
 
20
- let { attributes: a, html: h } = scrollbar(sb);
19
+ let { html: h, parent } = scrollbar(sb);
21
20
 
22
21
  return html`
23
- <section class='site ${data?.class || ''}' ${{ onclick }} ${a}>
24
- ${data?.content || ''}
22
+ <section class='site' ${attributes} ${{ onclick }} ${parent.attributes}>
23
+ ${content || ''}
25
24
  ${h}
26
25
  </section>
27
26
  `;
package/src/index.ts CHANGED
@@ -4,7 +4,6 @@ export { default as accordion }from './components/accordion';
4
4
  export { default as aurora }from './components/aurora';
5
5
  export { default as clipboard }from './components/clipboard';
6
6
  export { default as ellipsis }from './components/ellipsis';
7
- export { default as field }from './components/field';
8
7
  export { default as form }from './components/form';
9
8
  export { default as json }from './components/json';
10
9
  export { default as number }from './components/number';
@@ -14,5 +14,9 @@
14
14
  $box-shadow: (
15
15
  300: box-shadow(2),
16
16
  400: box-shadow(4),
17
- 500: box-shadow(6)
17
+ 500: box-shadow(6),
18
+
19
+ glow: #{0px 0px 128px 32px var(--box-shadow-color, #fff),
20
+ 0px 0px 32px 8px var(--box-shadow-color, #fff),
21
+ 0px 0px 8px 0px var(--box-shadow-color, #fff)}
18
22
  );
@@ -1,12 +1,16 @@
1
+ // https://www.fluid-type-scale.com/calculate?minFontSize=12&minWidth=400&minRatio=1.16&maxFontSize=14&maxWidth=1400&maxRatio=1.2&steps=100%2C200%2C300%2C400%2C500%2C600%2C700%2C800%2C900&baseStep=400&prefix=font-size&useContainerWidth=false&includeFallbacks=false&useRems=true&remValue=16&decimals=2&previewFont=Montserrat&previewText=Almost+before+we+knew+it%2C+we+had+left+the+ground&previewWidth=1400
1
2
  $font-size: (
2
- 100: 8px,
3
- 200: 10px,
4
- 300: 12px,
5
- 400: 14px,
3
+ 100: clamp(0.48rem, 0.04vi + 0.47rem, 0.51rem),
4
+ 200: clamp(0.56rem, 0.08vi + 0.54rem, 0.61rem),
5
+ 300: clamp(0.65rem, 0.13vi + 0.61rem, 0.73rem),
6
+ 400: clamp(0.75rem, 0.2vi + 0.7rem, 0.88rem),
7
+ 500: clamp(0.87rem, 0.29vi + 0.8rem, 1.05rem),
6
8
 
7
9
  // Primarily Used For Headers h1 - h4
8
- 500: 16px,
9
- 600: 24px,
10
- 700: 32px,
11
- 800: 40px
10
+ 600: clamp(1.01rem, 0.4vi + 0.91rem, 1.26rem),
11
+ 700: clamp(1.17rem, 0.55vi + 1.03rem, 1.51rem),
12
+ 800: clamp(1.36rem, 0.73vi + 1.18rem, 1.81rem),
13
+ 900: clamp(1.58rem, 0.96vi + 1.33rem, 2.18rem)
12
14
  );
15
+
16
+
@@ -5,5 +5,5 @@
5
5
  .--glass{--blur: 24px}
6
6
  .--line-height-100{--line-height: var(--line-height-100)}.--line-height-200{--line-height: var(--line-height-200)}.--line-height-300{--line-height: var(--line-height-300)}.--line-height-400{--line-height: var(--line-height-400)}
7
7
  .--size{--size: var(--size-400)}.--size-0px{--size: var(--size-0px)}.--size-100{--size: var(--size-100)}.--size-200{--size: var(--size-200)}.--size-300{--size: var(--size-300)}.--size-400{--size: var(--size-400)}.--size-500{--size: var(--size-500)}.--size-600{--size: var(--size-600)}.--size-700{--size: var(--size-700)}.--size-800{--size: var(--size-800)}.--size-900{--size: var(--size-900)}
8
- .--text-100{--font-size: var(--font-size-100)}.--text-200{--font-size: var(--font-size-200)}.--text-300{--font-size: var(--font-size-300)}.--text-400{--font-size: var(--font-size-400)}.--text-500{--font-size: var(--font-size-500)}.--text-600{--font-size: var(--font-size-600)}.--text-700{--font-size: var(--font-size-700)}.--text-800{--font-size: var(--font-size-800)}.--text-line-through{--line-width: var(--border-width-400)}.--text-line-through-400{--line-width: var(--border-width-400)}.--text-line-through-500{--line-width: var(--border-width-500)}.--text-line-through-600{--line-width: var(--border-width-600)}.--text-line-through-700{--line-width: var(--border-width-700)}.--text-outline{--color: inherit;--stroke-width: var(--border-width-400)}.--text-outline-400{--stroke-width: var(--border-width-400)}.--text-outline-500{--stroke-width: var(--border-width-500)}.--text-outline-600{--stroke-width: var(--border-width-600)}.--text-outline-700{--stroke-width: var(--border-width-700)}
8
+ .--text-100{--font-size: var(--font-size-100)}.--text-200{--font-size: var(--font-size-200)}.--text-300{--font-size: var(--font-size-300)}.--text-400{--font-size: var(--font-size-400)}.--text-500{--font-size: var(--font-size-500)}.--text-600{--font-size: var(--font-size-600)}.--text-700{--font-size: var(--font-size-700)}.--text-800{--font-size: var(--font-size-800)}.--text-900{--font-size: var(--font-size-900)}.--text-line-through{--line-width: var(--border-width-400)}.--text-line-through-400{--line-width: var(--border-width-400)}.--text-line-through-500{--line-width: var(--border-width-500)}.--text-line-through-600{--line-width: var(--border-width-600)}.--text-line-through-700{--line-width: var(--border-width-700)}.--text-outline{--color: inherit;--stroke-width: var(--border-width-400)}.--text-outline-400{--stroke-width: var(--border-width-400)}.--text-outline-500{--stroke-width: var(--border-width-500)}.--text-outline-600{--stroke-width: var(--border-width-600)}.--text-outline-700{--stroke-width: var(--border-width-700)}
9
9
  .--width-full{--width: 100%}.--width-half{--width: 50%}
@@ -1,17 +0,0 @@
1
- import description from './description';
2
- type Data = {
3
- class?: string;
4
- field?: {
5
- content?: any;
6
- };
7
- mask?: {
8
- class?: string;
9
- style?: string;
10
- };
11
- name?: string;
12
- style?: string;
13
- title: string;
14
- value?: any;
15
- } & Parameters<typeof description>[0];
16
- declare const _default: (data: Data) => import("@esportsplus/template").Renderable;
17
- export default _default;
@@ -1,41 +0,0 @@
1
- import { reactive } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
3
- import description from './description';
4
- export default (data) => {
5
- let state = reactive({
6
- active: false
7
- });
8
- return html `
9
- <div
10
- class="field --flex-column ${data?.class || ''} ${() => state.active ? '--active' : ''}"
11
- onchange='${(e) => {
12
- if (e.target.type !== 'checkbox') {
13
- return;
14
- }
15
- state.active = e.target?.checked;
16
- }}'
17
- style='${data?.style || ''}'
18
- >
19
- <div class="field-title --flex-horizontal-space-between --flex-vertical">
20
- ${data.title}
21
-
22
- <label
23
- class="field-mask ${(data?.mask?.class || '').indexOf('field-mask--switch') === -1 ? 'field-mask--checkbox' : ''} --margin-left --margin-400 ${data?.mask?.class || ''}"
24
- style='${data?.mask?.style || ''}'
25
- >
26
- <input
27
- class='field-tag field-tag--hidden'
28
- ${data.name ? `name='${data.name}'` : ''}
29
- type='checkbox'
30
- value='1'
31
- ${(data?.class || '').indexOf('--active') !== -1 || data?.value ? 'checked' : ''}
32
- >
33
- </label>
34
- </div>
35
-
36
- ${data?.field?.content || ''}
37
-
38
- ${description(data)}
39
- </div>
40
- `;
41
- };
@@ -1,4 +0,0 @@
1
- declare const _default: (data: {
2
- description?: string;
3
- }) => import("@esportsplus/template").Renderable | "";
4
- export default _default;
@@ -1,9 +0,0 @@
1
- import { html } from '@esportsplus/template';
2
- export default (data) => {
3
- if (!data?.description) {
4
- return '';
5
- }
6
- return html `
7
- <div class='field-description --margin-top --margin-300'>${data.description}</div>
8
- `;
9
- };
@@ -1,4 +0,0 @@
1
- declare const _default: (data: {
2
- error: string;
3
- }) => () => import("@esportsplus/template").Renderable | "";
4
- export default _default;
@@ -1,11 +0,0 @@
1
- import { html } from '@esportsplus/template';
2
- export default (data) => {
3
- return () => {
4
- if (!data.error) {
5
- return '';
6
- }
7
- return html `
8
- <div class='field-error --margin-top --margin-300 --text-bold'>${data.error}</div>
9
- `;
10
- };
11
- };
@@ -1,18 +0,0 @@
1
- import description from './description';
2
- import title from './title';
3
- type Data = {
4
- accept?: string;
5
- class?: string;
6
- mask?: {
7
- class?: string;
8
- content?: any;
9
- style?: string;
10
- };
11
- name?: string;
12
- placeholder?: string;
13
- style?: string;
14
- type?: string;
15
- value?: unknown;
16
- } & Parameters<typeof description>[0] & Parameters<typeof title>[0];
17
- declare const _default: (data: Data) => import("@esportsplus/template").Renderable;
18
- export default _default;
@@ -1,45 +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
- export default (data) => {
8
- let state = reactive({
9
- active: false,
10
- error: ''
11
- });
12
- return html `
13
- <div
14
- class="field ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column"
15
- onfocusin='${() => {
16
- state.active = true;
17
- }}'
18
- onfocusout='${() => {
19
- state.active = false;
20
- }}'
21
- style='${data?.style || ''}'
22
- >
23
- ${title(data)}
24
-
25
- <label
26
- class='field-mask field-mask--input --flex-row ${data?.mask?.class || ''} ${(data?.title || (data?.class || '').indexOf('field--optional') !== -1) && '--margin-top'} --margin-300'
27
- style='${data?.mask?.style || ''} cursor:pointer;'
28
- >
29
- <input
30
- ${data?.accept ? `accept='${data.accept}'` : ''}
31
- class='field-tag field-tag--hidden'
32
- name='${data.name}'
33
- onrender='${form.input.attributes(state)}'
34
- type='file'
35
- ${data?.value !== undefined ? `value='${data.value}'` : ''}
36
- >
37
-
38
- ${data?.mask?.content || ''}
39
- </label>
40
-
41
- ${description(data)}
42
- ${error(state)}
43
- </div>
44
- `;
45
- };
@@ -1,107 +0,0 @@
1
- import checkbox from './checkbox';
2
- import select from './select';
3
- import s from './switch';
4
- import text from './text';
5
- declare const _default: {
6
- checkbox: (data: {
7
- class?: string;
8
- field?: {
9
- content?: any;
10
- };
11
- mask?: {
12
- class?: string;
13
- style?: string;
14
- };
15
- name?: string;
16
- style?: string;
17
- title: string;
18
- value?: any;
19
- } & {
20
- description?: string;
21
- }) => import("@esportsplus/template").Renderable;
22
- file: (data: {
23
- accept?: string;
24
- class?: string;
25
- mask?: {
26
- class?: string;
27
- content?: any;
28
- style?: string;
29
- };
30
- name?: string;
31
- placeholder?: string;
32
- style?: string;
33
- type?: string;
34
- value?: unknown;
35
- } & {
36
- description?: string;
37
- } & {
38
- required?: boolean;
39
- title?: string;
40
- }) => import("@esportsplus/template").Renderable;
41
- optional: {
42
- select: (data: Parameters<typeof s>[0] & {
43
- field: Parameters<typeof select>[0];
44
- }) => import("@esportsplus/template").Renderable;
45
- text: (data: Parameters<typeof s>[0] & {
46
- field: Parameters<typeof text>[0];
47
- }) => import("@esportsplus/template").Renderable;
48
- };
49
- select: (data: {
50
- class?: string;
51
- effect?: (selected: number | string) => void;
52
- mask?: {
53
- class?: string;
54
- content?: any;
55
- style?: string;
56
- };
57
- name?: string;
58
- options: Record<number | string, number | string>;
59
- option?: {
60
- class?: string;
61
- style?: string;
62
- };
63
- selected?: any;
64
- scrollbar?: {
65
- style?: string;
66
- };
67
- style?: string;
68
- text?: {
69
- class?: string;
70
- };
71
- tooltip?: {
72
- class?: string;
73
- direction?: any;
74
- style?: string;
75
- };
76
- } & {
77
- description?: string;
78
- } & {
79
- required?: boolean;
80
- title?: string;
81
- }) => import("@esportsplus/template").Renderable;
82
- switch: (data: Parameters<typeof checkbox>[0]) => import("@esportsplus/template").Renderable;
83
- textarea: (data: Parameters<typeof text>[0]) => import("@esportsplus/template").Renderable;
84
- text: (data: {
85
- class?: string;
86
- mask?: {
87
- class?: string;
88
- content?: any;
89
- style?: string;
90
- };
91
- name?: string;
92
- placeholder?: string;
93
- style?: string;
94
- tag?: {
95
- class?: string;
96
- };
97
- textarea?: boolean;
98
- type?: string;
99
- value?: unknown;
100
- } & {
101
- description?: string;
102
- } & {
103
- required?: boolean;
104
- title?: string;
105
- }) => import("@esportsplus/template").Renderable;
106
- };
107
- export default _default;
@@ -1,8 +0,0 @@
1
- import checkbox from './checkbox';
2
- import file from './file';
3
- import optional from './optional';
4
- import select from './select';
5
- import s from './switch';
6
- import textarea from './textarea';
7
- import text from './text';
8
- export default { checkbox, file, optional, select, switch: s, textarea, text };
@@ -1,12 +0,0 @@
1
- import sel from './select';
2
- import s from './switch';
3
- import tex from './text';
4
- declare const _default: {
5
- select: (data: Parameters<typeof s>[0] & {
6
- field: Parameters<typeof sel>[0];
7
- }) => import("@esportsplus/template").Renderable;
8
- text: (data: Parameters<typeof s>[0] & {
9
- field: Parameters<typeof tex>[0];
10
- }) => import("@esportsplus/template").Renderable;
11
- };
12
- export default _default;
@@ -1,16 +0,0 @@
1
- import sel from './select';
2
- import s from './switch';
3
- import tex from './text';
4
- const select = (data) => {
5
- data.field.content = sel(Object.assign(data.field || {}, {
6
- class: `field--optional ${data?.field?.class || ''}`
7
- }));
8
- return s(data);
9
- };
10
- const text = (data) => {
11
- data.field.content = tex(Object.assign(data.field || {}, {
12
- class: `field--optional ${data?.field?.class || ''}`
13
- }));
14
- return s(data);
15
- };
16
- export default { select, text };
@@ -1,32 +0,0 @@
1
- import description from './description';
2
- import title from './title';
3
- type Data = {
4
- class?: string;
5
- effect?: (selected: number | string) => void;
6
- mask?: {
7
- class?: string;
8
- content?: any;
9
- style?: string;
10
- };
11
- name?: string;
12
- options: Record<number | string, number | string>;
13
- option?: {
14
- class?: string;
15
- style?: string;
16
- };
17
- selected?: any;
18
- scrollbar?: {
19
- style?: string;
20
- };
21
- style?: string;
22
- text?: {
23
- class?: string;
24
- };
25
- tooltip?: {
26
- class?: string;
27
- direction?: any;
28
- style?: string;
29
- };
30
- } & Parameters<typeof description>[0] & Parameters<typeof title>[0];
31
- declare const _default: (data: Data) => import("@esportsplus/template").Renderable;
32
- export default _default;
@@ -1,107 +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
- function parse(keys, selected) {
10
- let options = {};
11
- for (let key of keys) {
12
- options[key] = false;
13
- }
14
- options[selected] = true;
15
- return {
16
- options,
17
- selected: selected || keys[0]
18
- };
19
- }
20
- function template(data, state) {
21
- let { attributes: a, html: h } = scrollbar({
22
- attributes: {
23
- style: data?.scrollbar?.style || '--background-default: var(--color-black-400);'
24
- },
25
- fixed: true
26
- });
27
- return html `
28
- <div
29
- class='tooltip-content tooltip-content--${data?.tooltip?.direction || 's'} ${data?.tooltip?.class || ''} --flex-column --width-full'
30
- style='${data?.tooltip?.style || ''}'
31
- >
32
- <div
33
- class='row --flex-column'
34
- onclick='${(e) => {
35
- let key = e?.target?.dataset?.key;
36
- if (key === undefined) {
37
- return;
38
- }
39
- state.options[key] = true;
40
- state.options[state.selected] = false;
41
- state.active = false;
42
- state.selected = key;
43
- if (data.effect) {
44
- data.effect(key);
45
- }
46
- }}'
47
- ${a}
48
- >
49
- ${Object.keys(data.options || {}).map((key) => html `
50
- <div
51
- class='link ${data?.option?.class || ''} ${() => state.options[key] ? '--active' : ''} --flex-vertical' data-key='${key}'
52
- style='${data?.option?.style || ''}'
53
- >
54
- <span class="--text-truncate">
55
- ${data.options[key]}
56
- </span>
57
- </div>
58
- `)}
59
- </div>
60
-
61
- ${h}
62
- </div>
63
- `;
64
- }
65
- export default (data) => {
66
- let state = reactive(Object.assign({
67
- active: false,
68
- error: '',
69
- render: false,
70
- }, parse(Object.keys(data.options || {}), data.selected)));
71
- return html `
72
- <div class="field tooltip ${data?.class || ''} ${() => state.active ? '--active' : ''} --flex-column" style='${data?.style || ''}'>
73
- ${title(data)}
74
-
75
- <label
76
- 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"
77
- onclick='${() => {
78
- state.render = true;
79
- state.active = !state.active;
80
- if (state.active) {
81
- root.onclick.add(() => state.active = false);
82
- }
83
- }}'
84
- style='${data?.mask?.style || ''}'
85
- >
86
- <input
87
- class='field-tag field-tag--hidden'
88
- name='${data.name}'
89
- onclick='${() => { }}'
90
- onrender='${form.input.attributes(state)}'
91
- value='${() => state.selected}'
92
- >
93
-
94
- <div class="field-text ${data?.text?.class || ''}" style='pointer-events: none'>
95
- ${() => data.options[state.selected] || '-'}
96
- </div>
97
-
98
- <div class='field-mask-arrow'></div>
99
-
100
- ${() => state.render ? template(data, state) : ''}
101
- </label>
102
-
103
- ${description(data)}
104
- ${error(state)}
105
- </div>
106
- `;
107
- };
@@ -1,3 +0,0 @@
1
- import checkbox from './checkbox';
2
- declare const _default: (data: Parameters<typeof checkbox>[0]) => import("@esportsplus/template").Renderable;
3
- export default _default;
@@ -1,6 +0,0 @@
1
- import checkbox from './checkbox';
2
- export default (data) => {
3
- data.mask = data.mask || {};
4
- data.mask.class = `field-mask--switch ${data.mask?.class || ''}`;
5
- return checkbox(data);
6
- };
@@ -1,21 +0,0 @@
1
- import description from './description';
2
- import title from './title';
3
- type Data = {
4
- class?: string;
5
- mask?: {
6
- class?: string;
7
- content?: any;
8
- style?: string;
9
- };
10
- name?: string;
11
- placeholder?: string;
12
- style?: string;
13
- tag?: {
14
- class?: string;
15
- };
16
- textarea?: boolean;
17
- type?: string;
18
- value?: unknown;
19
- } & Parameters<typeof description>[0] & Parameters<typeof title>[0];
20
- declare const _default: (data: Data) => import("@esportsplus/template").Renderable;
21
- export default _default;