@esportsplus/ui 0.24.5 → 0.25.1

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 (76) 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} +25 -52
  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/{field/select.ts → select/index.ts} +50 -106
  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 -17481
  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 -1350
  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/title.ts +0 -27
@@ -1,73 +0,0 @@
1
- import { type Attributes, type Renderable } from '@esportsplus/template';
2
- type A = Attributes & {
3
- 'field-mask-tag'?: Attributes;
4
- };
5
- declare const _default: {
6
- checkbox: {
7
- (): ReturnType<(this: {
8
- mask: (attributes: A, state: {
9
- active: boolean;
10
- }) => Renderable<unknown>;
11
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
12
- <T extends Attributes>(attributes: T): ReturnType<(this: {
13
- mask: (attributes: A, state: {
14
- active: boolean;
15
- }) => Renderable<unknown>;
16
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
17
- <T extends (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>>(content: T): ReturnType<(this: {
18
- mask: (attributes: A, state: {
19
- active: boolean;
20
- }) => Renderable<unknown>;
21
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
22
- (attributes: Attributes, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>): ReturnType<(this: {
23
- mask: (attributes: A, state: {
24
- active: boolean;
25
- }) => Renderable<unknown>;
26
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
27
- };
28
- radio: {
29
- (): ReturnType<(this: {
30
- mask: (attributes: A, state: {
31
- active: boolean;
32
- }) => Renderable<unknown>;
33
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
34
- <T extends Attributes>(attributes: T): ReturnType<(this: {
35
- mask: (attributes: A, state: {
36
- active: boolean;
37
- }) => Renderable<unknown>;
38
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
39
- <T extends (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>>(content: T): ReturnType<(this: {
40
- mask: (attributes: A, state: {
41
- active: boolean;
42
- }) => Renderable<unknown>;
43
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
44
- (attributes: Attributes, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>): ReturnType<(this: {
45
- mask: (attributes: A, state: {
46
- active: boolean;
47
- }) => Renderable<unknown>;
48
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
49
- };
50
- switch: {
51
- (): ReturnType<(this: {
52
- mask: (attributes: A, state: {
53
- active: boolean;
54
- }) => Renderable<unknown>;
55
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
56
- <T extends Attributes>(attributes: T): ReturnType<(this: {
57
- mask: (attributes: A, state: {
58
- active: boolean;
59
- }) => Renderable<unknown>;
60
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
61
- <T extends (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>>(content: T): ReturnType<(this: {
62
- mask: (attributes: A, state: {
63
- active: boolean;
64
- }) => Renderable<unknown>;
65
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
66
- (attributes: Attributes, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>): ReturnType<(this: {
67
- mask: (attributes: A, state: {
68
- active: boolean;
69
- }) => Renderable<unknown>;
70
- }, attributes: Readonly<Attributes>, content: (mask: ((attributes: A) => Renderable<unknown>)) => Renderable<unknown>) => Renderable<any>>;
71
- };
72
- };
73
- export default _default;
@@ -1,71 +0,0 @@
1
- import { reactive, root } from '@esportsplus/reactivity';
2
- import { html } from '@esportsplus/template';
3
- import { omit } from '@esportsplus/utilities';
4
- import template from '../../components/template/index.js';
5
- const OMIT_FIELD = ['state'];
6
- const OMIT_TAG = ['field-mask-tag'];
7
- function mask(attributes, modifier, state) {
8
- let a = attributes['field-mask-tag'] || {};
9
- if (a.checked) {
10
- state.active = true;
11
- }
12
- return html `
13
- <div
14
- class='field-mask'
15
- ${omit(attributes, OMIT_TAG)}
16
- ${{
17
- class: `field-mask--${modifier}`
18
- }}
19
- >
20
- <input
21
- class='field-mask-tag field-mask-tag--hidden'
22
- ${{
23
- checked: a.checked || root(() => state.active),
24
- type: modifier === 'radio' ? 'radio' : 'checkbox',
25
- value: a.value || 1
26
- }}
27
- ${a}
28
- >
29
- </div>
30
- `;
31
- }
32
- const field = template.factory(function (attributes, content) {
33
- let state = attributes?.state || reactive({
34
- active: false
35
- });
36
- return html `
37
- <label
38
- class='field'
39
- ${omit(attributes, OMIT_FIELD)}
40
- ${{
41
- class: () => state.active && '--active',
42
- onchange: (e) => {
43
- let target = e.target, type = target.type;
44
- if (type !== 'checkbox' && type !== 'radio') {
45
- return;
46
- }
47
- state.active = target.checked;
48
- }
49
- }}
50
- >
51
- ${content((attributes) => this.mask(attributes, state))}
52
- </label>
53
- `;
54
- });
55
- export default {
56
- checkbox: field.bind({
57
- mask: (attributes, state) => {
58
- return mask(attributes, 'checkbox', state);
59
- }
60
- }),
61
- radio: field.bind({
62
- mask: (attributes, state) => {
63
- return mask(attributes, 'radio', state);
64
- }
65
- }),
66
- switch: field.bind({
67
- mask: (attributes, state) => {
68
- return mask(attributes, 'switch', state);
69
- }
70
- }),
71
- };
@@ -1,19 +0,0 @@
1
- declare const _default: {
2
- (): ReturnType<(this: {
3
- attributes?: import("@esportsplus/template").Attributes | undefined;
4
- content?: import("@esportsplus/template").Renderable<any>;
5
- }, attributes: Readonly<import("@esportsplus/template").Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
6
- <T extends import("@esportsplus/template").Attributes>(attributes: T): ReturnType<(this: {
7
- attributes?: import("@esportsplus/template").Attributes | undefined;
8
- content?: import("@esportsplus/template").Renderable<any>;
9
- }, attributes: Readonly<import("@esportsplus/template").Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
10
- <T extends import("@esportsplus/template").Renderable<any>>(content: T): ReturnType<(this: {
11
- attributes?: import("@esportsplus/template").Attributes | undefined;
12
- content?: import("@esportsplus/template").Renderable<any>;
13
- }, attributes: Readonly<import("@esportsplus/template").Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
14
- (attributes: import("@esportsplus/template").Attributes, content: import("@esportsplus/template").Renderable<any>): ReturnType<(this: {
15
- attributes?: import("@esportsplus/template").Attributes | undefined;
16
- content?: import("@esportsplus/template").Renderable<any>;
17
- }, attributes: Readonly<import("@esportsplus/template").Attributes>, content: import("@esportsplus/template").Renderable<any>) => import("@esportsplus/template").Renderable<any>>;
18
- };
19
- export default _default;
@@ -1,7 +0,0 @@
1
- import { html } from '@esportsplus/template';
2
- import template from '../../components/template/index.js';
3
- export default template.factory((attributes, content) => html `
4
- <div class='field-description' ${attributes}>
5
- ${content}
6
- </div>
7
- `);
@@ -1,5 +0,0 @@
1
- import { Renderable } from '@esportsplus/template';
2
- declare const _default: (state: {
3
- error: Renderable<unknown>;
4
- }) => () => Node | "";
5
- export default _default;
@@ -1,13 +0,0 @@
1
- import { html } from '@esportsplus/template';
2
- export default (state) => {
3
- return () => {
4
- if (!state.error) {
5
- return '';
6
- }
7
- return html `
8
- <div class='field-error --text-bold'>
9
- ${state.error}
10
- </div>
11
- `;
12
- };
13
- };