@esportsplus/ui 0.24.4 → 0.25.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 (77) hide show
  1. package/build/components/checkbox/index.d.ts +11 -0
  2. package/build/components/checkbox/index.js +33 -0
  3. package/build/components/checkbox/scss/index.scss +2 -0
  4. package/build/components/index.d.ts +7 -1
  5. package/build/components/index.js +7 -1
  6. package/build/components/input/index.d.ts +21 -0
  7. package/build/components/input/index.js +38 -0
  8. package/build/components/input/scss/index.scss +2 -0
  9. package/build/components/radio/index.d.ts +11 -0
  10. package/build/components/radio/index.js +33 -0
  11. package/build/components/radio/scss/index.scss +2 -0
  12. package/build/components/range/index.d.ts +21 -0
  13. package/build/components/range/index.js +46 -0
  14. package/build/components/range/scss/index.scss +2 -0
  15. package/build/components/select/index.d.ts +44 -0
  16. package/build/components/{field/select.js → select/index.js} +43 -70
  17. package/build/components/select/scss/index.scss +2 -0
  18. package/build/components/switch/index.d.ts +11 -0
  19. package/build/components/switch/index.js +33 -0
  20. package/build/components/switch/scss/index.scss +2 -0
  21. package/build/components/text/scss/index.scss +1 -1
  22. package/build/components/textarea/index.d.ts +21 -0
  23. package/build/components/textarea/index.js +37 -0
  24. package/build/components/textarea/scss/index.scss +2 -0
  25. package/build/normalize/scss/index.scss +1 -1
  26. package/package.json +2 -2
  27. package/src/components/checkbox/index.ts +45 -0
  28. package/src/components/checkbox/scss/index.scss +50 -0
  29. package/src/components/checkbox/scss/variables.scss +72 -0
  30. package/src/components/index.ts +7 -1
  31. package/src/components/input/index.ts +52 -0
  32. package/src/components/input/scss/index.scss +37 -0
  33. package/src/components/input/scss/variables.scss +50 -0
  34. package/src/components/radio/index.ts +45 -0
  35. package/src/components/radio/scss/index.scss +50 -0
  36. package/src/components/radio/scss/variables.scss +67 -0
  37. package/src/components/range/index.ts +61 -0
  38. package/src/components/range/scss/index.scss +31 -0
  39. package/src/components/range/scss/variables.scss +8 -0
  40. package/src/components/select/index.ts +166 -0
  41. package/src/components/select/scss/index.scss +36 -0
  42. package/src/components/select/scss/variables.scss +12 -0
  43. package/src/components/switch/index.ts +45 -0
  44. package/src/components/switch/scss/index.scss +48 -0
  45. package/src/components/switch/scss/variables.scss +72 -0
  46. package/src/components/text/scss/index.scss +31 -0
  47. package/src/components/textarea/index.ts +51 -0
  48. package/src/components/textarea/scss/index.scss +26 -0
  49. package/src/components/textarea/scss/variables.scss +49 -0
  50. package/src/normalize/scss/index.scss +36 -1
  51. package/build/components/field/checkbox.d.ts +0 -73
  52. package/build/components/field/checkbox.js +0 -71
  53. package/build/components/field/description.d.ts +0 -19
  54. package/build/components/field/description.js +0 -7
  55. package/build/components/field/error.d.ts +0 -5
  56. package/build/components/field/error.js +0 -13
  57. package/build/components/field/index.d.ts +0 -18331
  58. package/build/components/field/index.js +0 -10
  59. package/build/components/field/input.d.ts +0 -156
  60. package/build/components/field/input.js +0 -97
  61. package/build/components/field/scss/index.scss +0 -2
  62. package/build/components/field/select.d.ts +0 -1321
  63. package/build/components/field/title.d.ts +0 -1169
  64. package/build/components/field/title.js +0 -20
  65. package/src/components/field/checkbox.ts +0 -97
  66. package/src/components/field/description.ts +0 -11
  67. package/src/components/field/error.ts +0 -16
  68. package/src/components/field/index.ts +0 -15
  69. package/src/components/field/input.ts +0 -134
  70. package/src/components/field/scss/check.scss +0 -227
  71. package/src/components/field/scss/index.scss +0 -133
  72. package/src/components/field/scss/normalize.scss +0 -34
  73. package/src/components/field/scss/range.scss +0 -46
  74. package/src/components/field/scss/text.scss +0 -120
  75. package/src/components/field/scss/variables.scss +0 -128
  76. package/src/components/field/select.ts +0 -220
  77. package/src/components/field/title.ts +0 -27
@@ -0,0 +1,11 @@
1
+ import { type Attributes } from '@esportsplus/template';
2
+ import './scss/index.scss';
3
+ type A = Attributes & {
4
+ 'checkbox-tag'?: Attributes;
5
+ state?: {
6
+ active: boolean;
7
+ error: string;
8
+ };
9
+ };
10
+ export default function (attributes?: A): Node;
11
+ export {};
@@ -0,0 +1,33 @@
1
+ import { reactive, root } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { omit } from '@esportsplus/utilities';
4
+ import form from '../../components/form/index.js';
5
+ import './scss/index.scss';
6
+ const OMIT = ['checkbox-tag'];
7
+ export default function (attributes) {
8
+ let a = attributes?.['checkbox-tag'], state = attributes?.state || reactive({
9
+ active: false,
10
+ error: ''
11
+ });
12
+ if (a?.checked) {
13
+ state.active = true;
14
+ }
15
+ return html `
16
+ <div class='checkbox ${() => state.active && '--active'}' ${a ? omit(attributes, OMIT) : attributes}>
17
+ <input
18
+ class='checkbox-tag'
19
+ type='checkbox'
20
+ ${{
21
+ checked: a?.checked || root(() => state.active),
22
+ onchange: (e) => {
23
+ state.active = e.target.checked;
24
+ },
25
+ onrender: form.input.onrender(state),
26
+ value: a?.value || 1
27
+ }}
28
+ ${a}
29
+ >
30
+ </div>
31
+ `;
32
+ }
33
+ ;
@@ -0,0 +1,2 @@
1
+ @layer components {.checkbox{--background:var(--background-default);--background-active:var(--background-default);--background-default:transparent;--background-hover:var(--background-default);--background-pressed:var(--background-default);--border-color:var(--border-color-default);--border-color-default:var(--background);--border-radius:var(--border-radius-300);--border-style:solid;--border-width:0px;--box-shadow:var(--box-shadow-default);--box-shadow-default:none;--height:var(--size);--margin-horizontal:calc(var(--width-switch) - var(--width));--opacity:var(--opacity-default);--opacity-active:var(--opacity-default);--opacity-default:1;--opacity-hover:var(--opacity-default);--opacity-pressed:var(--opacity-default);--rotate:45deg;--scale:var(--scale-default);--scale-active:1;--scale-default:0;--scale-hover:1.08;--scale-pressed:.98;--size:var(--size-600);--width:var(--height);--width-switch:40px}.checkbox:before{--border-width:5px;--box-shadow:1px 1px 0 #00000029;--height:110%;--translateX:108%;--translateY:8%;--width:50%}.field:not(.--active):not(:hover) .checkbox:before{--translateY:100%}.checkbox label:not(.--active):not(.--active):hover,.checkbox:not(.--active):not(.--active):hover{--background:var(--background-hover);--border-color:var(--border-color-hover);--box-shadow:var(--box-shadow-hover);--color:var(--color-hover);--opacity:var(--opacity-hover);--scale:var(--scale-hover)}.checkbox label:not(.--active):not(.--active):active,.checkbox:not(.--active):not(.--active):active{--background:var(--background-pressed);--border-color:var(--border-color-pressed);--box-shadow:var(--box-shadow-pressed);--color:var(--color-pressed);--opacity:var(--opacity-pressed);--scale:var(--scale-pressed)}.checkbox.--active{--opacity:var(--opacity-active);--scale:var(--scale-active)}.checkbox{background:var(--background);border-color:var(--border-color);border-radius:var(--border-radius);border-style:var(--border-style);border-width:var(--border-width);flex:0 0 var(--width);height:var(--height);transition:background var(--transition-duration)ease-in-out,border-color var(--transition-duration)ease-in-out,box-shadow var(--transition-duration)ease-in-out,opacity var(--transition-duration)ease-in-out,transform var(--transition-duration)ease-in-out;width:var(--width);position:relative}.checkbox:invalid,.checkbox:required{box-shadow:none}.checkbox:before{border-bottom:var(--border-width)solid var(--accent);border-right:var(--border-width)solid var(--accent);box-shadow:var(--box-shadow);content:"";height:var(--height);opacity:var(--opacity);transform:translate(var(--translateX),var(--translateY))rotate(var(--rotate))scale(var(--scale));transform-origin:bottom;width:var(--width);position:absolute;bottom:50%;right:92%}.checkbox-tag{opacity:0;pointer-events:none;z-index:0;width:0;height:0;position:absolute;top:0;left:0}}
2
+ /*$vite$:1*/
@@ -5,17 +5,18 @@ export * as border from './border/index.js';
5
5
  export * as bubble from './bubble/index.js';
6
6
  export * as button from './button/index.js';
7
7
  export * as card from './card/index.js';
8
+ export { default as checkbox } from './checkbox/index.js';
8
9
  export { default as clipboard } from './clipboard/index.js';
9
10
  export * as container from './container/index.js';
10
11
  export { default as counter } from './counter/index.js';
11
12
  export { default as ellipsis } from './ellipsis/index.js';
12
- export { default as field } from './field/index.js';
13
13
  export { default as form } from './form/index.js';
14
14
  export * as frame from './frame/index.js';
15
15
  export * as grid from './grid/index.js';
16
16
  export * as group from './group/index.js';
17
17
  export { default as highlight } from './highlight/index.js';
18
18
  export { default as icon } from './icon/index.js';
19
+ export { default as input } from './input/index.js';
19
20
  export { default as json } from './json/index.js';
20
21
  export * as link from './link/index.js';
21
22
  export { default as loader } from './loader/index.js';
@@ -24,13 +25,18 @@ export * as modal from './modal/index.js';
24
25
  export { default as number } from './number/index.js';
25
26
  export { default as overlay } from './overlay/index.js';
26
27
  export * from './page/index.js';
28
+ export { default as radio } from './radio/index.js';
29
+ export { default as range } from './range/index.js';
27
30
  export { default as root } from './root/index.js';
28
31
  export * as row from './row/index.js';
32
+ export { default as select } from './select/index.js';
33
+ export { default as switch } from './switch/index.js';
29
34
  export { default as scrollbar } from './scrollbar/index.js';
30
35
  export { default as sidebar } from './sidebar/index.js';
31
36
  export { default as site } from './site/index.js';
32
37
  export { default as template } from './template/index.js';
33
38
  export * as text from './text/index.js';
39
+ export { default as textarea } from './textarea/index.js';
34
40
  export * as thumbnail from './thumbnail/index.js';
35
41
  export { default as tooltip } from './tooltip/index.js';
36
42
  export { default as truncate } from './truncate/index.js';
@@ -5,17 +5,18 @@ export * as border from './border/index.js';
5
5
  export * as bubble from './bubble/index.js';
6
6
  export * as button from './button/index.js';
7
7
  export * as card from './card/index.js';
8
+ export { default as checkbox } from './checkbox/index.js';
8
9
  export { default as clipboard } from './clipboard/index.js';
9
10
  export * as container from './container/index.js';
10
11
  export { default as counter } from './counter/index.js';
11
12
  export { default as ellipsis } from './ellipsis/index.js';
12
- export { default as field } from './field/index.js';
13
13
  export { default as form } from './form/index.js';
14
14
  export * as frame from './frame/index.js';
15
15
  export * as grid from './grid/index.js';
16
16
  export * as group from './group/index.js';
17
17
  export { default as highlight } from './highlight/index.js';
18
18
  export { default as icon } from './icon/index.js';
19
+ export { default as input } from './input/index.js';
19
20
  export { default as json } from './json/index.js';
20
21
  export * as link from './link/index.js';
21
22
  export { default as loader } from './loader/index.js';
@@ -24,13 +25,18 @@ export * as modal from './modal/index.js';
24
25
  export { default as number } from './number/index.js';
25
26
  export { default as overlay } from './overlay/index.js';
26
27
  export * from './page/index.js';
28
+ export { default as radio } from './radio/index.js';
29
+ export { default as range } from './range/index.js';
27
30
  export { default as root } from './root/index.js';
28
31
  export * as row from './row/index.js';
32
+ export { default as select } from './select/index.js';
33
+ export { default as switch } from './switch/index.js';
29
34
  export { default as scrollbar } from './scrollbar/index.js';
30
35
  export { default as sidebar } from './sidebar/index.js';
31
36
  export { default as site } from './site/index.js';
32
37
  export { default as template } from './template/index.js';
33
38
  export * as text from './text/index.js';
39
+ export { default as textarea } from './textarea/index.js';
34
40
  export * as thumbnail from './thumbnail/index.js';
35
41
  export { default as tooltip } from './tooltip/index.js';
36
42
  export { default as truncate } from './truncate/index.js';
@@ -0,0 +1,21 @@
1
+ import { type Attributes } from '@esportsplus/template';
2
+ import './scss/index.scss';
3
+ declare const _default: {
4
+ (): ReturnType<(this: {
5
+ attributes?: Attributes | undefined;
6
+ content?: import("@esportsplus/template").Renderable<any>;
7
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
8
+ <T extends Attributes>(attributes: T): ReturnType<(this: {
9
+ attributes?: Attributes | undefined;
10
+ content?: import("@esportsplus/template").Renderable<any>;
11
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
12
+ <T extends import("@esportsplus/template").Renderable<any>>(content: T): ReturnType<(this: {
13
+ attributes?: Attributes | undefined;
14
+ content?: import("@esportsplus/template").Renderable<any>;
15
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
16
+ (attributes: Attributes, content: import("@esportsplus/template").Renderable<any>): ReturnType<(this: {
17
+ attributes?: Attributes | undefined;
18
+ content?: import("@esportsplus/template").Renderable<any>;
19
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
20
+ };
21
+ export default _default;
@@ -0,0 +1,38 @@
1
+ import { reactive } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { omit } from '@esportsplus/utilities';
4
+ import form from '../../components/form/index.js';
5
+ import template from '../../components/template/index.js';
6
+ import './scss/index.scss';
7
+ const OMIT = ['input-tag'];
8
+ export default template.factory(function (attributes, content) {
9
+ let a = attributes['input-tag'], state = attributes.state || reactive({
10
+ active: false,
11
+ error: ''
12
+ });
13
+ return html `
14
+ <label
15
+ class='input'
16
+ ${{
17
+ class: () => state.active && '--active',
18
+ onfocusin: () => {
19
+ state.active = true;
20
+ },
21
+ onfocusout: () => {
22
+ state.active = false;
23
+ }
24
+ }}
25
+ ${a ? omit(attributes, OMIT) : attributes}
26
+ >
27
+ <input
28
+ class='input-tag'
29
+ ${{
30
+ onrender: form.input.onrender(state),
31
+ type: (attributes.type || 'text')
32
+ }}
33
+ ${a}
34
+ >
35
+ ${content}
36
+ </label>
37
+ `;
38
+ });
@@ -0,0 +1,2 @@
1
+ @layer components {.input{--background:var(--background-default);--background-active:var(--background-default);--background-default:transparent;--background-hover:var(--background-default);--background-pressed:var(--background-default);--border-color:var(--border-color-default);--border-color-default:var(--background);--border-radius:var(--border-radius-400);--border-style:solid;--border-width:0px;--box-shadow:var(--box-shadow-default);--box-shadow-default:none;--color:var(--color-default);--color-active:var(--color-default);--color-default:var(--color-text-400);--color-hover:var(--color-default);--color-pressed:var(--color-default);--font-size:var(--font-size-400);--line-height:var(--line-height-400);--padding-horizontal:var(--size-400);--padding-vertical:var(--size-400);--size:var(--size-400)}.input:not(.--active):not(.--active):hover{--background:var(--background-hover);--border-color:var(--border-color-hover);--box-shadow:var(--box-shadow-hover);--color:var(--color-hover)}.input:not(.--active):not(.--active):active{--background:var(--background-pressed);--border-color:var(--border-color-pressed);--box-shadow:var(--box-shadow-pressed);--color:var(--color-pressed)}.input.--active{--background:var(--background-active);--border-color:var(--border-color-active);--box-shadow:var(--box-shadow-active);--color:var(--color-active)}.input{background:var(--background);border:var(--border-width)var(--border-style)var(--border-color);border-radius:var(--border-radius);cursor:text;font-size:var(--font-size);line-height:var(--line-height);min-height:calc(var(--padding-vertical)*2 + var(--size));text-overflow:ellipsis;white-space:nowrap;flex-wrap:wrap;align-items:center;width:100%;display:flex;position:relative;overflow:hidden}.input:invalid,.input:required{box-shadow:none}.input-tag{color:var(--color);padding:var(--padding-vertical)var(--padding-horizontal);flex:auto;min-width:0}.input-tag[type=number]{appearance:textfield}}
2
+ /*$vite$:1*/
@@ -0,0 +1,11 @@
1
+ import { type Attributes } from '@esportsplus/template';
2
+ import './scss/index.scss';
3
+ type A = Attributes & {
4
+ 'radio-tag'?: Attributes;
5
+ state?: {
6
+ active: boolean;
7
+ error: string;
8
+ };
9
+ };
10
+ export default function (attributes?: A): Node;
11
+ export {};
@@ -0,0 +1,33 @@
1
+ import { reactive, root } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { omit } from '@esportsplus/utilities';
4
+ import form from '../../components/form/index.js';
5
+ import './scss/index.scss';
6
+ const OMIT = ['radio-tag'];
7
+ export default function (attributes) {
8
+ let a = attributes?.['radio-tag'], state = attributes?.state || reactive({
9
+ active: false,
10
+ error: ''
11
+ });
12
+ if (a?.checked) {
13
+ state.active = true;
14
+ }
15
+ return html `
16
+ <div class='radio ${() => state.active && '--active'}' ${a ? omit(attributes, OMIT) : attributes}>
17
+ <input
18
+ class='radio-tag'
19
+ type='radio'
20
+ ${{
21
+ checked: a?.checked || root(() => state.active),
22
+ onchange: (e) => {
23
+ state.active = e.target.checked;
24
+ },
25
+ onrender: form.input.onrender(state),
26
+ value: a?.value || 1
27
+ }}
28
+ ${a}
29
+ >
30
+ </div>
31
+ `;
32
+ }
33
+ ;
@@ -0,0 +1,2 @@
1
+ @layer components {.radio{--background:var(--background-default);--background-active:var(--background-default);--background-default:transparent;--background-hover:var(--background-default);--background-pressed:var(--background-default);--border-color:var(--border-color-default);--border-color-default:var(--background);--border-radius:100%;--border-style:solid;--border-width:0px;--box-shadow:var(--box-shadow-default);--box-shadow-default:none;--height:var(--size);--margin-horizontal:calc(var(--width-switch) - var(--width));--opacity:var(--opacity-default);--opacity-active:1;--opacity-default:.4;--opacity-hover:var(--opacity-default);--opacity-pressed:var(--opacity-default);--rotate:0deg;--scale:var(--scale-default);--scale-active:.9;--scale-default:0;--scale-hover:.8;--scale-pressed:.7;--size:var(--size-600);--width:var(--height);--width-switch:40px}.radio:before{--height:calc((var(--size)/2) - (var(--border-width)*2));--box-shadow:0 1px 0 #00000029;--translateX:50%;--translateY:50%;--width:var(--height)}.radio label:not(.--active):not(.--active):hover,.radio:not(.--active):not(.--active):hover{--background:var(--background-hover);--border-color:var(--border-color-hover);--box-shadow:var(--box-shadow-hover);--color:var(--color-hover);--opacity:var(--opacity-hover);--scale:var(--scale-hover)}.radio label:not(.--active):not(.--active):active,.radio:not(.--active):not(.--active):active{--background:var(--background-pressed);--border-color:var(--border-color-pressed);--box-shadow:var(--box-shadow-pressed);--color:var(--color-pressed);--opacity:var(--opacity-pressed);--scale:var(--scale-pressed)}.radio.--active{--opacity:var(--opacity-active);--scale:var(--scale-active)}.radio{background:var(--background);border-color:var(--border-color);border-radius:var(--border-radius);border-style:var(--border-style);border-width:var(--border-width);flex:0 0 var(--width);height:var(--height);transition:background var(--transition-duration)ease-in-out,border-color var(--transition-duration)ease-in-out,box-shadow var(--transition-duration)ease-in-out,opacity var(--transition-duration)ease-in-out,transform var(--transition-duration)ease-in-out;width:var(--width);position:relative}.radio:invalid,.radio:required{box-shadow:none}.radio:before{background:var(--accent);border-radius:inherit;box-shadow:var(--box-shadow);content:"";height:var(--height);opacity:var(--opacity);transform:translate(var(--translateX),var(--translateY))rotate(var(--rotate))scale(var(--scale));transform-origin:50%;width:var(--width);position:absolute;bottom:50%;right:50%}.radio-tag{opacity:0;pointer-events:none;z-index:0;width:0;height:0;position:absolute;top:0;left:0}}
2
+ /*$vite$:1*/
@@ -0,0 +1,21 @@
1
+ import { type Attributes } from '@esportsplus/template';
2
+ import './scss/index.scss';
3
+ declare const _default: {
4
+ (): ReturnType<(this: {
5
+ attributes?: Attributes | undefined;
6
+ content?: import("@esportsplus/template").Renderable<any>;
7
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
8
+ <T extends Attributes>(attributes: T): ReturnType<(this: {
9
+ attributes?: Attributes | undefined;
10
+ content?: import("@esportsplus/template").Renderable<any>;
11
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
12
+ <T extends import("@esportsplus/template").Renderable<any>>(content: T): ReturnType<(this: {
13
+ attributes?: Attributes | undefined;
14
+ content?: import("@esportsplus/template").Renderable<any>;
15
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
16
+ (attributes: Attributes, content: import("@esportsplus/template").Renderable<any>): ReturnType<(this: {
17
+ attributes?: Attributes | undefined;
18
+ content?: import("@esportsplus/template").Renderable<any>;
19
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
20
+ };
21
+ export default _default;
@@ -0,0 +1,46 @@
1
+ import { reactive, root } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { omit } from '@esportsplus/utilities';
4
+ import form from '../../components/form/index.js';
5
+ import template from '../../components/template/index.js';
6
+ import './scss/index.scss';
7
+ const OMIT = ['range-tag'];
8
+ export default template.factory(function (attributes, content) {
9
+ let a = attributes['range-tag'], state = attributes.state || reactive({
10
+ active: false,
11
+ error: '',
12
+ value: 0
13
+ });
14
+ if (a?.value) {
15
+ state.value = Number(a.value);
16
+ }
17
+ return html `
18
+ <div
19
+ class='range --border-state --border-black'
20
+ ${{
21
+ class: () => state.active && '--active',
22
+ onfocusin: () => {
23
+ state.active = true;
24
+ },
25
+ onfocusout: () => {
26
+ state.active = false;
27
+ }
28
+ }}
29
+ ${a ? omit(attributes, OMIT) : attributes}
30
+ >
31
+ <input
32
+ class='range-tag'
33
+ type='range'
34
+ ${{
35
+ oninput: (e) => {
36
+ state.value = Number(e.target.value);
37
+ },
38
+ onrender: form.input.onrender(state),
39
+ value: root(() => a?.value || state.value || 0)
40
+ }}
41
+ ${a}
42
+ >
43
+ ${content}
44
+ </div>
45
+ `;
46
+ });
@@ -0,0 +1,2 @@
1
+ @layer components {.range{--background-default:var(--color-black-300);--border-width:var(--border-width-700);--height:var(--size-200);--thumb-background:var(--color-white-400);--thumb-size:var(--size-400);--width:100%;margin:calc((var(--height) - var(--thumb-size))/2)0}.range-tag{background:var(--background);height:var(--height);width:var(--width);border:0;border-radius:240px;transition:opacity .2s}.range-tag::-moz-range-thumb{background:var(--thumb-background);border:var(--border-width)solid var(--border-color);cursor:pointer;height:var(--thumb-size);width:var(--thumb-size);border-radius:100%}.range-tag::-webkit-slider-thumb{background:var(--thumb-background);border:var(--border-width)solid var(--border-color);cursor:pointer;height:var(--thumb-size);width:var(--thumb-size);border-radius:100%}.range-tag{appearance:none;outline:none}.range-tag::-moz-range-thumb{appearance:none;outline:none}.range-tag::-webkit-slider-thumb{appearance:none;outline:none}}
2
+ /*$vite$:1*/
@@ -0,0 +1,44 @@
1
+ import { Renderable, type Attributes } from '@esportsplus/template';
2
+ import { Attributes as Attr } from '../../components/scrollbar/index.js';
3
+ import './scss/index.scss';
4
+ type A = {
5
+ 'select-arrow'?: Attributes;
6
+ 'select-tag'?: Attributes;
7
+ 'select-text'?: Attributes;
8
+ 'scrollbar'?: Attributes;
9
+ 'scrollbar-container-content'?: Attributes;
10
+ 'tooltip-content'?: Attributes & {
11
+ direction?: string;
12
+ };
13
+ options: Record<number | string, Renderable<unknown>>;
14
+ option?: Attributes;
15
+ } & ({
16
+ selected?: number | string;
17
+ state?: never;
18
+ } | {
19
+ state: {
20
+ active: boolean;
21
+ error: string;
22
+ render: boolean;
23
+ selected?: number | string;
24
+ };
25
+ }) & Attributes & Attr;
26
+ declare const _default: {
27
+ (): ReturnType<(this: {
28
+ attributes?: A | undefined;
29
+ content?: Renderable<any>;
30
+ }, attributes: Readonly<A>, content: Renderable<any>) => Renderable<any>>;
31
+ <T extends A>(attributes: T): ReturnType<(this: {
32
+ attributes?: A | undefined;
33
+ content?: Renderable<any>;
34
+ }, attributes: Readonly<A>, content: Renderable<any>) => Renderable<any>>;
35
+ <T extends Renderable<any>>(content: T): ReturnType<(this: {
36
+ attributes?: A | undefined;
37
+ content?: Renderable<any>;
38
+ }, attributes: Readonly<A>, content: Renderable<any>) => Renderable<any>>;
39
+ (attributes: A, content: Renderable<any>): ReturnType<(this: {
40
+ attributes?: A | undefined;
41
+ content?: Renderable<any>;
42
+ }, attributes: Readonly<A>, content: Renderable<any>) => Renderable<any>>;
43
+ };
44
+ export default _default;
@@ -1,21 +1,20 @@
1
1
  import { reactive } from '@esportsplus/reactivity';
2
2
  import { html } from '@esportsplus/template';
3
- import { isObject, omit, toArray } from '@esportsplus/utilities';
3
+ import { omit, toArray } from '@esportsplus/utilities';
4
4
  import form from '../../components/form/index.js';
5
5
  import root from '../../components/root/index.js';
6
6
  import scrollbar from '../../components/scrollbar/index.js';
7
7
  import template from '../../components/template/index.js';
8
- import error from './error.js';
9
- const OMIT_FIELD = ['options', 'state'];
10
- const OMIT_MASK = [
11
- 'field-mask-arrow',
12
- 'field-mask-text',
13
- 'field-mask-tag',
8
+ import './scss/index.scss';
9
+ const OMIT = [
10
+ 'options',
11
+ 'select-arrow',
12
+ 'select-tag',
13
+ 'select-text',
14
14
  'scrollbar',
15
15
  'scrollbar-container-content',
16
16
  'tooltip-content',
17
17
  ];
18
- const OMIT_OPTION = ['content'];
19
18
  let field = null;
20
19
  function set(state, value) {
21
20
  state.active = value;
@@ -30,13 +29,18 @@ function set(state, value) {
30
29
  field = null;
31
30
  }
32
31
  }
33
- const select = function (attributes, content) {
34
- let { option, options, state } = this;
32
+ export default template.factory(function (attributes, content) {
33
+ let { options, option } = attributes, state = attributes.state || reactive({
34
+ active: false,
35
+ error: '',
36
+ render: false,
37
+ selected: attributes.selected || Object.keys(options)[0]
38
+ });
35
39
  return html `
36
- <label
37
- class='field-mask field-mask--select'
38
- ${omit(attributes, OMIT_MASK)}
39
- ${{
40
+ <label
41
+ class='select'
42
+ ${omit(attributes, OMIT)}
43
+ ${{
40
44
  onclick: () => {
41
45
  if (state.render) {
42
46
  set(state, !state.active);
@@ -44,28 +48,26 @@ const select = function (attributes, content) {
44
48
  state.render = true;
45
49
  }
46
50
  }}
47
- >
48
- <input class='field-mask-tag field-mask-tag--hidden'
49
- ${{
51
+ >
52
+ <input class='select-tag'
53
+ ${{
50
54
  name: attributes.name,
51
55
  onclick: () => { },
52
56
  onrender: form.input.onrender(state),
53
57
  value: () => state.selected
54
58
  }}
55
- ${attributes['field-mask-tag']}
56
- >
59
+ ${attributes['select-tag']}
60
+ >
57
61
 
58
- ${content || html `
59
- <div class='field-mask-text' ${attributes['field-mask-text']}>
60
- ${() => {
61
- return (options[state.selected]?.content || '-');
62
- }}
63
- </div>
64
- `}
62
+ ${content || html `
63
+ <div class='select-text' ${attributes['select-text']}>
64
+ ${() => options[state.selected] || '-'}
65
+ </div>
66
+ `}
65
67
 
66
- <div class='field-mask-arrow' ${attributes['field-mask-arrow']}></div>
68
+ <div class='select-arrow' ${attributes['select-arrow']}></div>
67
69
 
68
- ${() => {
70
+ ${() => {
69
71
  if (!state.render) {
70
72
  return;
71
73
  }
@@ -93,49 +95,20 @@ const select = function (attributes, content) {
93
95
  scrollbar: attributes['scrollbar'],
94
96
  'scrollbar-container-content': attributes['scrollbar-container-content']
95
97
  }, keys.map((key) => html `
96
- <div class='link'
97
- ${omit(options[key], OMIT_OPTION)}
98
- ${option}
99
- ${{
98
+ <div
99
+ class='link'
100
+ ${option}
101
+ ${{
102
+ 'data-key': key,
100
103
  class: () => selected[key] && '--active',
101
- 'data-key': key
102
104
  }}
103
- >
104
- <span class='--text-truncate --pointer-none'>
105
- ${options[key].content}
106
- </span>
107
- </div>
108
- `));
109
- }}
110
- </label>
111
- `;
112
- };
113
- export default template.factory((attributes, content) => {
114
- let options = attributes.options, state = attributes.state || reactive({
115
- active: false,
116
- error: '',
117
- render: false,
118
- selected: attributes.selected || Object.keys(options)[0]
119
- });
120
- for (let key in options) {
121
- if (isObject(options[key])) {
122
- continue;
123
- }
124
- options[key] = { content: options[key] };
125
- }
126
- return html `
127
- <div class='field tooltip'
128
- ${omit(attributes, OMIT_FIELD)}
129
- ${{
130
- class: () => state.active && '--active'
105
+ >
106
+ <span class='--text-truncate --pointer-none'>
107
+ ${options[key]}
108
+ </span>
109
+ </div>
110
+ `));
131
111
  }}
132
- >
133
- ${content((...args) => select.call({
134
- option: attributes.option,
135
- options: attributes.options,
136
- state
137
- }, ...args))}
138
- ${error(state)}
139
- </div>
140
- `;
112
+ </label>
113
+ `;
141
114
  });
@@ -0,0 +1,2 @@
1
+ @layer components {.select{background:var(--background);border:var(--border-width)var(--border-style)var(--border-color);border-radius:var(--border-radius);cursor:pointer;font-size:var(--font-size);line-height:var(--line-height);padding:var(--padding-vertical)calc(var(--padding-horizontal)/1.5 + var(--arrow-size))var(--padding-vertical)var(--padding-horizontal);flex-wrap:wrap;align-items:center;width:100%;display:flex;position:relative}.select:invalid,.select:required{box-shadow:none}.select-arrow{right:calc(var(--padding-horizontal) + var(--arrow-spacer));bottom:calc(50% + var(--arrow-spacer));border-color:var(--border-color);border-style:var(--border-style);border-width:0 var(--border-width)var(--border-width)0;content:"";height:var(--arrow-size);width:var(--arrow-size);position:absolute;transform:translateY(50%)rotate(45deg)}.select-tag{color:var(--color)}}
2
+ /*$vite$:1*/
@@ -0,0 +1,11 @@
1
+ import { type Attributes } from '@esportsplus/template';
2
+ import './scss/index.scss';
3
+ type A = Attributes & {
4
+ 'switch-tag'?: Attributes;
5
+ state?: {
6
+ active: boolean;
7
+ error: string;
8
+ };
9
+ };
10
+ export default function (attributes?: A): Node;
11
+ export {};
@@ -0,0 +1,33 @@
1
+ import { reactive, root } from '@esportsplus/reactivity';
2
+ import { html } from '@esportsplus/template';
3
+ import { omit } from '@esportsplus/utilities';
4
+ import form from '../../components/form/index.js';
5
+ import './scss/index.scss';
6
+ const OMIT = ['switch-tag'];
7
+ export default function (attributes) {
8
+ let a = attributes?.['switch-tag'], state = attributes?.state || reactive({
9
+ active: false,
10
+ error: ''
11
+ });
12
+ if (a?.checked) {
13
+ state.active = true;
14
+ }
15
+ return html `
16
+ <div class='switch' ${a ? omit(attributes, OMIT) : attributes}>
17
+ <input
18
+ class='switch-tag'
19
+ type='checkbox'
20
+ ${{
21
+ checked: a?.checked || root(() => state.active),
22
+ onchange: (e) => {
23
+ state.active = e.target.checked;
24
+ },
25
+ onrender: form.input.onrender(state),
26
+ value: a?.value || 1
27
+ }}
28
+ ${a}
29
+ >
30
+ </div>
31
+ `;
32
+ }
33
+ ;
@@ -0,0 +1,2 @@
1
+ @layer components {.switch{--background:var(--background-default);--background-active:var(--background-default);--background-default:transparent;--background-hover:var(--background-default);--background-pressed:var(--background-default);--border-color:var(--border-color-default);--border-color-default:var(--background);--border-radius:240px;--border-style:solid;--border-width:0px;--box-shadow:var(--box-shadow-default);--box-shadow-default:none;--height:var(--size);--opacity:var(--opacity-default);--opacity-active:var(--opacity-default);--opacity-default:1;--opacity-hover:var(--opacity-default);--opacity-pressed:var(--opacity-default);--padding-horizontal:var(--border-width-400);--padding-vertical:var(--border-width-400);--rotate:0deg;--scale:var(--scale-default);--scale-active:var(--scale-default);--scale-default:1;--scale-hover:var(--scale-default);--scale-pressed:var(--scale-default);--size:var(--size-600);--width:var(--width-switch);--width-switch:40px}.switch:before{--box-shadow:0 1px 0 #00000029;--height:calc(var(--size) - (var(--border-width)*2) - (var(--padding-vertical)*2));--translateX:0px;--translateY:0px;--width:var(--height)}.field.--active .switch:before{--translateX:calc(var(--width-switch) - (var(--border-width)*2) - var(--height) - (var(--padding-horizontal)*2))}.switch label:not(.--active):not(.--active):hover,.switch:not(.--active):not(.--active):hover{--background:var(--background-hover);--border-color:var(--border-color-hover);--box-shadow:var(--box-shadow-hover);--color:var(--color-hover);--opacity:var(--opacity-hover);--scale:var(--scale-hover)}.switch label:not(.--active):not(.--active):active,.switch:not(.--active):not(.--active):active{--background:var(--background-pressed);--border-color:var(--border-color-pressed);--box-shadow:var(--box-shadow-pressed);--color:var(--color-pressed);--opacity:var(--opacity-pressed);--scale:var(--scale-pressed)}.switch.--active{--opacity:var(--opacity-active);--scale:var(--scale-active)}.switch{background:var(--background);border-color:var(--border-color);border-radius:var(--border-radius);border-style:var(--border-style);border-width:var(--border-width);flex:0 0 var(--width);height:var(--height);transition:background var(--transition-duration)ease-in-out,border-color var(--transition-duration)ease-in-out,box-shadow var(--transition-duration)ease-in-out,opacity var(--transition-duration)ease-in-out,transform var(--transition-duration)ease-in-out;width:var(--width);position:relative}.switch:invalid,.switch:required{box-shadow:none}.switch:before{top:var(--padding-vertical);left:var(--padding-horizontal);background:var(--accent);border-radius:inherit;box-shadow:var(--box-shadow);content:"";height:var(--height);opacity:var(--opacity);transform:translate(var(--translateX),var(--translateY))rotate(var(--rotate))scale(var(--scale));transform-origin:50%;width:var(--width);position:absolute}.switch-tag{opacity:0;pointer-events:none;z-index:0;width:0;height:0;position:absolute;top:0;left:0}}
2
+ /*$vite$:1*/
@@ -1,2 +1,2 @@
1
- @layer components {.text{--color:var(--color-default,inherit);--font-size:var(--font-size-400);--font-weight:var(--font-weight-400);--line-height:var(--line-height-400);--width:auto;color:var(--color);font-size:var(--font-size);font-weight:var(--font-weight);line-height:var(--line-height);transition:color var(--transition-duration)ease-in-out;width:var(--width);position:relative}}
1
+ @layer components {.text{--color:var(--color-default,inherit);--font-size:var(--font-size-400);--font-weight:var(--font-weight-400);--line-height:var(--line-height-400);--width:auto;color:var(--color);font-size:var(--font-size);font-weight:var(--font-weight);line-height:var(--line-height);transition:color var(--transition-duration)ease-in-out;width:var(--width);position:relative}.text--error{animation:.32s linear textError}@keyframes textError{0%{transform:translate(8px)}20%{transform:translate(-8px)}40%{transform:translate(4px)}60%{transform:translate(-4px)}80%{transform:translate(2px)}to{transform:translate(0)}}}
2
2
  /*$vite$:1*/
@@ -0,0 +1,21 @@
1
+ import { type Attributes } from '@esportsplus/template';
2
+ import './scss/index.scss';
3
+ declare const _default: {
4
+ (): ReturnType<(this: {
5
+ attributes?: Attributes | undefined;
6
+ content?: import("@esportsplus/template").Renderable<any>;
7
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
8
+ <T extends Attributes>(attributes: T): ReturnType<(this: {
9
+ attributes?: Attributes | undefined;
10
+ content?: import("@esportsplus/template").Renderable<any>;
11
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
12
+ <T extends import("@esportsplus/template").Renderable<any>>(content: T): ReturnType<(this: {
13
+ attributes?: Attributes | undefined;
14
+ content?: import("@esportsplus/template").Renderable<any>;
15
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
16
+ (attributes: Attributes, content: import("@esportsplus/template").Renderable<any>): ReturnType<(this: {
17
+ attributes?: Attributes | undefined;
18
+ content?: import("@esportsplus/template").Renderable<any>;
19
+ }, attributes: Readonly<Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
20
+ };
21
+ export default _default;