ember-validated-form 3.0.3 → 5.0.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 (92) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -1
  2. package/.github/dependabot.yml +11 -0
  3. package/.github/workflows/deploy.yml +5 -3
  4. package/.github/workflows/release.yml +7 -5
  5. package/.github/workflows/test.yml +10 -11
  6. package/CHANGELOG.md +66 -0
  7. package/README.md +3 -3
  8. package/addon/-private/themed-component.js +31 -38
  9. package/addon/components/validated-button/-themes/bootstrap/button.js +7 -9
  10. package/addon/components/validated-button/-themes/uikit/button.js +7 -9
  11. package/addon/components/validated-button/button.hbs +9 -0
  12. package/addon/components/validated-button/button.js +3 -8
  13. package/addon/components/validated-button.hbs +17 -0
  14. package/addon/components/validated-button.js +4 -8
  15. package/addon/components/validated-form.hbs +21 -0
  16. package/addon/components/validated-form.js +32 -46
  17. package/addon/components/validated-input/-themes/bootstrap/error.js +3 -3
  18. package/addon/components/validated-input/-themes/bootstrap/hint.js +3 -3
  19. package/addon/components/validated-input/-themes/bootstrap/label.js +1 -1
  20. package/addon/components/validated-input/-themes/bootstrap/render.js +3 -3
  21. package/addon/components/validated-input/-themes/uikit/error.hbs +4 -0
  22. package/addon/components/validated-input/-themes/uikit/error.js +1 -4
  23. package/addon/components/validated-input/-themes/uikit/hint.js +3 -3
  24. package/addon/components/validated-input/-themes/uikit/label.js +3 -3
  25. package/addon/components/validated-input/-themes/uikit/render.hbs +110 -0
  26. package/addon/components/validated-input/-themes/uikit/render.js +3 -5
  27. package/addon/components/validated-input/error.hbs +1 -0
  28. package/addon/components/validated-input/error.js +6 -7
  29. package/addon/components/validated-input/hint.hbs +1 -0
  30. package/addon/components/validated-input/hint.js +3 -7
  31. package/addon/components/validated-input/label.hbs +3 -0
  32. package/addon/components/validated-input/label.js +3 -8
  33. package/addon/components/validated-input/render.hbs +108 -0
  34. package/addon/components/validated-input/render.js +10 -10
  35. package/addon/components/validated-input/types/-themes/bootstrap/checkbox-group.hbs +19 -0
  36. package/addon/components/validated-input/types/-themes/bootstrap/checkbox-group.js +3 -0
  37. package/addon/components/validated-input/types/-themes/bootstrap/checkbox.hbs +14 -0
  38. package/addon/components/validated-input/types/-themes/bootstrap/checkbox.js +1 -6
  39. package/addon/components/validated-input/types/-themes/bootstrap/input.js +11 -4
  40. package/addon/components/validated-input/types/-themes/bootstrap/radio-group.hbs +20 -0
  41. package/addon/components/validated-input/types/-themes/bootstrap/radio-group.js +1 -4
  42. package/addon/components/validated-input/types/-themes/bootstrap/select.js +11 -4
  43. package/addon/components/validated-input/types/-themes/bootstrap/textarea.js +11 -4
  44. package/addon/components/validated-input/types/-themes/uikit/checkbox-group.hbs +19 -0
  45. package/addon/components/validated-input/types/-themes/uikit/checkbox-group.js +3 -0
  46. package/addon/components/validated-input/types/-themes/uikit/checkbox.hbs +15 -0
  47. package/addon/components/validated-input/types/-themes/uikit/checkbox.js +1 -4
  48. package/addon/components/validated-input/types/-themes/uikit/input.js +11 -4
  49. package/addon/components/validated-input/types/-themes/uikit/radio-group.hbs +20 -0
  50. package/addon/components/validated-input/types/-themes/uikit/radio-group.js +1 -4
  51. package/addon/components/validated-input/types/-themes/uikit/select.js +11 -4
  52. package/addon/components/validated-input/types/-themes/uikit/textarea.js +11 -4
  53. package/addon/components/validated-input/types/checkbox-group.hbs +14 -0
  54. package/addon/components/validated-input/types/checkbox-group.js +21 -0
  55. package/addon/components/validated-input/types/checkbox.hbs +9 -0
  56. package/addon/components/validated-input/types/checkbox.js +10 -6
  57. package/addon/components/validated-input/types/input.hbs +6 -0
  58. package/addon/components/validated-input/types/input.js +9 -17
  59. package/addon/components/validated-input/types/radio-group.hbs +14 -0
  60. package/addon/components/validated-input/types/radio-group.js +10 -6
  61. package/addon/components/validated-input/types/select.hbs +17 -0
  62. package/addon/components/validated-input/types/select.js +3 -7
  63. package/addon/components/validated-input/types/textarea.hbs +7 -0
  64. package/addon/components/validated-input/types/textarea.js +9 -17
  65. package/addon/components/validated-input.hbs +74 -0
  66. package/addon/components/validated-input.js +61 -59
  67. package/app/components/validated-form.js +1 -7
  68. package/app/components/validated-input/types/-themes/bootstrap/checkbox-group.js +1 -0
  69. package/app/components/validated-input/types/-themes/uikit/checkbox-group.js +1 -0
  70. package/app/components/validated-input/types/checkbox-group.js +1 -0
  71. package/config/environment.js +1 -1
  72. package/package.json +50 -36
  73. package/.dependabot/config.yml +0 -14
  74. package/.prettierignore +0 -1
  75. package/addon/templates/components/validated-button/button.hbs +0 -1
  76. package/addon/templates/components/validated-button.hbs +0 -7
  77. package/addon/templates/components/validated-form.hbs +0 -15
  78. package/addon/templates/components/validated-input/-themes/uikit/render.hbs +0 -94
  79. package/addon/templates/components/validated-input/error.hbs +0 -1
  80. package/addon/templates/components/validated-input/hint.hbs +0 -1
  81. package/addon/templates/components/validated-input/label.hbs +0 -1
  82. package/addon/templates/components/validated-input/render.hbs +0 -93
  83. package/addon/templates/components/validated-input/types/-themes/bootstrap/checkbox.hbs +0 -10
  84. package/addon/templates/components/validated-input/types/-themes/bootstrap/radio-group.hbs +0 -15
  85. package/addon/templates/components/validated-input/types/-themes/bootstrap/select.hbs +0 -16
  86. package/addon/templates/components/validated-input/types/-themes/uikit/checkbox.hbs +0 -11
  87. package/addon/templates/components/validated-input/types/-themes/uikit/radio-group.hbs +0 -17
  88. package/addon/templates/components/validated-input/types/-themes/uikit/select.hbs +0 -17
  89. package/addon/templates/components/validated-input/types/checkbox.hbs +0 -9
  90. package/addon/templates/components/validated-input/types/radio-group.hbs +0 -14
  91. package/addon/templates/components/validated-input/types/select.hbs +0 -16
  92. package/addon/templates/components/validated-input.hbs +0 -55
@@ -0,0 +1,110 @@
1
+ <div class={{this.class}}>
2
+ {{#if (not-eq @type "checkbox")}}
3
+ <@labelComponent />
4
+ {{/if}}
5
+
6
+ <div class="uk-form-controls">
7
+ {{#if (eq @type "select")}}
8
+ {{#let (component this.selectComponent) as |Select|}}
9
+ <Select
10
+ @disabled={{@disabled}}
11
+ @includeBlank={{@includeBlank}}
12
+ @inputId={{@inputId}}
13
+ @isInvalid={{@isInvalid}}
14
+ @isValid={{@isValid}}
15
+ @multiple={{@multiple}}
16
+ @name={{or @inputName @name}}
17
+ @optionLabelPath={{@optionLabelPath}}
18
+ @options={{@options}}
19
+ @optionTargetPath={{@optionTargetPath}}
20
+ @optionValuePath={{@optionValuePath}}
21
+ @promptIsSelectable={{@promptIsSelectable}}
22
+ @setDirty={{@setDirty}}
23
+ @update={{@update}}
24
+ @value={{@value}}
25
+ />
26
+ {{/let}}
27
+ {{else if (or (eq @type "radioGroup") (eq @type "radio-group"))}}
28
+ {{#let (component this.radioGroupComponent) as |RadioGroup|}}
29
+ <RadioGroup
30
+ @disabled={{@disabled}}
31
+ @inputId={{@inputId}}
32
+ @isInvalid={{@isInvalid}}
33
+ @isValid={{@isValid}}
34
+ @name={{or @inputName @name}}
35
+ @options={{@options}}
36
+ @setDirty={{@setDirty}}
37
+ @update={{@update}}
38
+ @value={{@value}}
39
+ />
40
+ {{/let}}
41
+ {{else if (or (eq @type "checkboxGroup") (eq @type "checkbox-group"))}}
42
+ {{#let (component this.checkboxGroupComponent) as |CheckboxGroup|}}
43
+ <CheckboxGroup
44
+ @disabled={{@disabled}}
45
+ @inputId={{@inputId}}
46
+ @isInvalid={{@isInvalid}}
47
+ @isValid={{@isValid}}
48
+ @name={{or @inputName @name}}
49
+ @options={{@options}}
50
+ @setDirty={{@setDirty}}
51
+ @update={{@update}}
52
+ @value={{@value}}
53
+ />
54
+ {{/let}}
55
+ {{else if (eq @type "checkbox")}}
56
+ {{#let (component this.checkboxComponent) as |Checkbox|}}
57
+ <Checkbox
58
+ @disabled={{@disabled}}
59
+ @inputId={{@inputId}}
60
+ @isInvalid={{@isInvalid}}
61
+ @isValid={{@isValid}}
62
+ @labelComponent={{@labelComponent}}
63
+ @name={{or @inputName @name}}
64
+ @options={{@options}}
65
+ @setDirty={{@setDirty}}
66
+ @update={{@update}}
67
+ @value={{@value}}
68
+ />
69
+ {{/let}}
70
+ {{else if (eq @type "textarea")}}
71
+ {{#let (component this.textareaComponent) as |DynamicTextarea|}}
72
+ <DynamicTextarea
73
+ autocomplete={{@autocomplete}}
74
+ autofocus={{@autofocus}}
75
+ cols={{@cols}}
76
+ disabled={{@disabled}}
77
+ id={{@inputId}}
78
+ name={{or @inputName @name}}
79
+ placeholder={{@placeholder}}
80
+ rows={{@rows}}
81
+ value={{@value}}
82
+ @isInvalid={{@isInvalid}}
83
+ @isValid={{@isValid}}
84
+ @setDirty={{@setDirty}}
85
+ @update={{@update}}
86
+ />
87
+ {{/let}}
88
+ {{else}}
89
+ {{#let (component this.inputComponent) as |DynamicInput|}}
90
+ <DynamicInput
91
+ autocomplete={{@autocomplete}}
92
+ autofocus={{@autofocus}}
93
+ disabled={{@disabled}}
94
+ id={{@inputId}}
95
+ name={{or @inputName @name}}
96
+ placeholder={{@placeholder}}
97
+ type={{@type}}
98
+ value={{@value}}
99
+ @isInvalid={{@isInvalid}}
100
+ @isValid={{@isValid}}
101
+ @setDirty={{@setDirty}}
102
+ @update={{@update}}
103
+ />
104
+ {{/let}}
105
+ {{/if}}
106
+ </div>
107
+
108
+ <@hintComponent />
109
+ <@errorComponent />
110
+ </div>
@@ -1,7 +1,5 @@
1
- import layout from "../../../../templates/components/validated-input/-themes/uikit/render";
2
1
  import Component from "../../render";
3
2
 
4
- export default Component.extend({
5
- layout,
6
- classNames: ["uk-margin"],
7
- });
3
+ export default class UikitRenderComponent extends Component {
4
+ class = "uk-margin";
5
+ }
@@ -0,0 +1 @@
1
+ <span class={{this.class}} ...attributes>{{yield}}{{this.errorString}}</span>
@@ -1,8 +1,7 @@
1
- import Component from "@ember/component";
1
+ import Component from "@glimmer/component";
2
2
 
3
- import layout from "../../templates/components/validated-input/error";
4
-
5
- export default Component.extend({
6
- layout,
7
- tagName: "span",
8
- });
3
+ export default class ErrorComponent extends Component {
4
+ get errorString() {
5
+ return this.args.errors?.join(", ");
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ <small class={{this.class}} ...attributes>{{yield}}{{@hint}}</small>
@@ -1,8 +1,4 @@
1
- import Component from "@ember/component";
1
+ import Component from "@glimmer/component";
2
2
 
3
- import layout from "../../templates/components/validated-input/hint";
4
-
5
- export default Component.extend({
6
- layout,
7
- tagName: "small",
8
- });
3
+ // eslint-disable-next-line ember/no-empty-glimmer-component-classes
4
+ export default class HintComponent extends Component {}
@@ -0,0 +1,3 @@
1
+ <label class={{this.class}} for={{@inputId}} ...attributes>
2
+ {{yield}}{{@label}}{{if @required " *"}}
3
+ </label>
@@ -1,9 +1,4 @@
1
- import Component from "@ember/component";
1
+ import Component from "@glimmer/component";
2
2
 
3
- import layout from "../../templates/components/validated-input/label";
4
-
5
- export default Component.extend({
6
- layout,
7
- tagName: "label",
8
- attributeBindings: ["inputId:for"],
9
- });
3
+ // eslint-disable-next-line ember/no-empty-glimmer-component-classes
4
+ export default class LabelComponent extends Component {}
@@ -0,0 +1,108 @@
1
+ <div class={{this.class}}>
2
+ {{#if (not-eq @type "checkbox")}}
3
+ <@labelComponent />
4
+ {{/if}}
5
+
6
+ {{#if (eq @type "select")}}
7
+ {{#let (component this.selectComponent) as |Select|}}
8
+ <Select
9
+ @disabled={{@disabled}}
10
+ @includeBlank={{@includeBlank}}
11
+ @inputId={{@inputId}}
12
+ @isInvalid={{@isInvalid}}
13
+ @isValid={{@isValid}}
14
+ @multiple={{@multiple}}
15
+ @name={{or @inputName @name}}
16
+ @optionLabelPath={{@optionLabelPath}}
17
+ @options={{@options}}
18
+ @optionTargetPath={{@optionTargetPath}}
19
+ @optionValuePath={{@optionValuePath}}
20
+ @promptIsSelectable={{@promptIsSelectable}}
21
+ @setDirty={{@setDirty}}
22
+ @update={{@update}}
23
+ @value={{@value}}
24
+ />
25
+ {{/let}}
26
+ {{else if (or (eq @type "radioGroup") (eq @type "radio-group"))}}
27
+ {{#let (component this.radioGroupComponent) as |RadioGroup|}}
28
+ <RadioGroup
29
+ @disabled={{@disabled}}
30
+ @inputId={{@inputId}}
31
+ @isInvalid={{@isInvalid}}
32
+ @isValid={{@isValid}}
33
+ @name={{or @inputName @name}}
34
+ @options={{@options}}
35
+ @setDirty={{@setDirty}}
36
+ @update={{@update}}
37
+ @value={{@value}}
38
+ />
39
+ {{/let}}
40
+ {{else if (or (eq @type "checkboxGroup") (eq @type "checkbox-group"))}}
41
+ {{#let (component this.checkboxGroupComponent) as |CheckboxGroup|}}
42
+ <CheckboxGroup
43
+ @disabled={{@disabled}}
44
+ @inputId={{@inputId}}
45
+ @isInvalid={{@isInvalid}}
46
+ @isValid={{@isValid}}
47
+ @name={{or @inputName @name}}
48
+ @options={{@options}}
49
+ @setDirty={{@setDirty}}
50
+ @update={{@update}}
51
+ @value={{@value}}
52
+ />
53
+ {{/let}}
54
+ {{else if (eq @type "checkbox")}}
55
+ {{#let (component this.checkboxComponent) as |Checkbox|}}
56
+ <Checkbox
57
+ @disabled={{@disabled}}
58
+ @inputId={{@inputId}}
59
+ @isInvalid={{@isInvalid}}
60
+ @isValid={{@isValid}}
61
+ @labelComponent={{@labelComponent}}
62
+ @name={{or @inputName @name}}
63
+ @options={{@options}}
64
+ @setDirty={{@setDirty}}
65
+ @update={{@update}}
66
+ @value={{@value}}
67
+ />
68
+ {{/let}}
69
+ {{else if (eq @type "textarea")}}
70
+ {{#let (component this.textareaComponent) as |DynamicTextarea|}}
71
+ <DynamicTextarea
72
+ autocomplete={{@autocomplete}}
73
+ autofocus={{@autofocus}}
74
+ cols={{@cols}}
75
+ disabled={{@disabled}}
76
+ id={{@inputId}}
77
+ name={{or @inputName @name}}
78
+ placeholder={{@placeholder}}
79
+ rows={{@rows}}
80
+ value={{@value}}
81
+ @isInvalid={{@isInvalid}}
82
+ @isValid={{@isValid}}
83
+ @setDirty={{@setDirty}}
84
+ @update={{@update}}
85
+ />
86
+ {{/let}}
87
+ {{else}}
88
+ {{#let (component this.inputComponent) as |DynamicInput|}}
89
+ <DynamicInput
90
+ autocomplete={{@autocomplete}}
91
+ autofocus={{@autofocus}}
92
+ disabled={{@disabled}}
93
+ id={{@inputId}}
94
+ name={{or @inputName @name}}
95
+ placeholder={{@placeholder}}
96
+ type={{@type}}
97
+ value={{@value}}
98
+ @isInvalid={{@isInvalid}}
99
+ @isValid={{@isValid}}
100
+ @setDirty={{@setDirty}}
101
+ @update={{@update}}
102
+ />
103
+ {{/let}}
104
+ {{/if}}
105
+
106
+ <@hintComponent />
107
+ <@errorComponent />
108
+ </div>
@@ -1,13 +1,13 @@
1
- import Component from "@ember/component";
1
+ import Component from "@glimmer/component";
2
2
 
3
3
  import themedComponent from "../../-private/themed-component";
4
- import layout from "../../templates/components/validated-input/render";
5
4
 
6
- export default Component.extend({
7
- layout,
8
- selectComponent: themedComponent("validated-input/types/select"),
9
- radioGroupComponent: themedComponent("validated-input/types/radio-group"),
10
- checkboxComponent: themedComponent("validated-input/types/checkbox"),
11
- textareaComponent: themedComponent("validated-input/types/textarea"),
12
- inputComponent: themedComponent("validated-input/types/input"),
13
- });
5
+ export default class RenderComponent extends Component {
6
+ @themedComponent("validated-input/types/input") inputComponent;
7
+ @themedComponent("validated-input/types/textarea") textareaComponent;
8
+ @themedComponent("validated-input/types/checkbox") checkboxComponent;
9
+ @themedComponent("validated-input/types/radio-group") radioGroupComponent;
10
+ @themedComponent("validated-input/types/checkbox-group")
11
+ checkboxGroupComponent;
12
+ @themedComponent("validated-input/types/select") selectComponent;
13
+ }
@@ -0,0 +1,19 @@
1
+ {{#each @options as |option i|}}
2
+ <div class="custom-control custom-checkbox">
3
+ <input
4
+ type="checkbox"
5
+ class="custom-control-input
6
+ {{if @isValid "is-valid"}}
7
+ {{if @isInvalid "is-invalid"}}"
8
+ checked={{includes option.key @value}}
9
+ name={{@name}}
10
+ id="{{@inputId}}-{{i}}"
11
+ disabled={{@disabled}}
12
+ {{on "input" (fn this.onUpdate option.key)}}
13
+ />
14
+ <label
15
+ class="custom-control-label"
16
+ for="{{@inputId}}-{{i}}"
17
+ >{{option.label}}</label>
18
+ </div>
19
+ {{/each}}
@@ -0,0 +1,3 @@
1
+ import Component from "../../checkbox-group";
2
+
3
+ export default class BootstrapCheckboxGroupComponent extends Component {}
@@ -0,0 +1,14 @@
1
+ <div class="custom-control custom-checkbox">
2
+ <input
3
+ class="custom-control-input
4
+ {{if @isValid "is-valid"}}
5
+ {{if @isInvalid "is-invalid"}}"
6
+ type="checkbox"
7
+ name={{@name}}
8
+ id={{@inputId}}
9
+ disabled={{@disabled}}
10
+ checked={{@value}}
11
+ {{on "input" this.onUpdate}}
12
+ />
13
+ <@labelComponent class="custom-control-label" />
14
+ </div>
@@ -1,8 +1,3 @@
1
- import layout from "../../../../../templates/components/validated-input/types/-themes/bootstrap/checkbox";
2
1
  import Component from "../../checkbox";
3
2
 
4
- export default Component.extend({
5
- layout,
6
- tagName: "div",
7
- classNames: ["custom-control", "custom-checkbox"],
8
- });
3
+ export default class BootstrapCheckboxComponent extends Component {}
@@ -1,6 +1,13 @@
1
1
  import Component from "../../input";
2
2
 
3
- export default Component.extend({
4
- classNameBindings: ["isValid:is-valid", "isInvalid:is-invalid"],
5
- classNames: ["form-control"],
6
- });
3
+ export default class BootstrapInputComponent extends Component {
4
+ get class() {
5
+ const style = this.args.isValid
6
+ ? "is-valid"
7
+ : this.args.isInvalid
8
+ ? "is-invalid"
9
+ : "";
10
+
11
+ return `form-control ${style}`;
12
+ }
13
+ }
@@ -0,0 +1,20 @@
1
+ {{#each @options as |option i|}}
2
+ <div class="custom-control custom-radio">
3
+ <input
4
+ type="radio"
5
+ class="custom-control-input
6
+ {{if @isValid "is-valid"}}
7
+ {{if @isInvalid "is-invalid"}}"
8
+ checked={{eq @value option.key}}
9
+ value={{option.key}}
10
+ name={{@name}}
11
+ id="{{@inputId}}-{{i}}"
12
+ disabled={{@disabled}}
13
+ {{on "input" (fn this.onUpdate option.key)}}
14
+ />
15
+ <label
16
+ class="custom-control-label"
17
+ for="{{@inputId}}-{{i}}"
18
+ >{{option.label}}</label>
19
+ </div>
20
+ {{/each}}
@@ -1,6 +1,3 @@
1
- import layout from "../../../../../templates/components/validated-input/types/-themes/bootstrap/radio-group";
2
1
  import Component from "../../radio-group";
3
2
 
4
- export default Component.extend({
5
- layout,
6
- });
3
+ export default class BootstrapRadioGroupComponent extends Component {}
@@ -1,6 +1,13 @@
1
- import layout from "../../../../../templates/components/validated-input/types/-themes/bootstrap/select";
2
1
  import Component from "../../select";
3
2
 
4
- export default Component.extend({
5
- layout,
6
- });
3
+ export default class BootstrapSelectComponent extends Component {
4
+ get class() {
5
+ const style = this.args.isValid
6
+ ? "is-valid"
7
+ : this.args.isInvalid
8
+ ? "is-invalid"
9
+ : "";
10
+
11
+ return `form-control ${style}`;
12
+ }
13
+ }
@@ -1,6 +1,13 @@
1
1
  import Component from "../../textarea";
2
2
 
3
- export default Component.extend({
4
- classNameBindings: ["isValid:is-valid", "isInvalid:is-invalid"],
5
- classNames: ["form-control"],
6
- });
3
+ export default class BootstrapTextareaComponent extends Component {
4
+ get class() {
5
+ const style = this.args.isValid
6
+ ? "is-valid"
7
+ : this.args.isInvalid
8
+ ? "is-invalid"
9
+ : "";
10
+
11
+ return `form-control ${style}`;
12
+ }
13
+ }
@@ -0,0 +1,19 @@
1
+ {{#each @options as |option i|}}
2
+ {{#if (not-eq i 0)}}<br />{{/if}}
3
+ <label
4
+ class="uk-form-label
5
+ {{if @isValid "uk-text-success"}}
6
+ {{if @isInvalid "uk-text-danger"}}"
7
+ >
8
+ <input
9
+ type="checkbox"
10
+ class="uk-checkbox uk-margin-small-right"
11
+ checked={{includes option.key @value}}
12
+ name={{@name}}
13
+ id="{{@inputId}}-{{i}}"
14
+ disabled={{@disabled}}
15
+ {{on "input" (fn this.onUpdate option.key)}}
16
+ />
17
+ {{option.label}}
18
+ </label>
19
+ {{/each}}
@@ -0,0 +1,3 @@
1
+ import Component from "../../checkbox-group";
2
+
3
+ export default class UikitCheckboxGroupComponent extends Component {}
@@ -0,0 +1,15 @@
1
+ {{#let (component @labelComponent) as |Label|}}
2
+ <Label
3
+ class="{{if @isValid "uk-text-success"}} {{if @isInvalid "uk-text-danger"}}"
4
+ >
5
+ <input
6
+ class="uk-checkbox uk-margin-small-right"
7
+ type="checkbox"
8
+ name={{@name}}
9
+ id={{@inputId}}
10
+ disabled={{@disabled}}
11
+ checked={{@value}}
12
+ {{on "input" this.onUpdate}}
13
+ />
14
+ </Label>
15
+ {{/let}}
@@ -1,6 +1,3 @@
1
- import layout from "../../../../../templates/components/validated-input/types/-themes/uikit/checkbox";
2
1
  import Component from "../../checkbox";
3
2
 
4
- export default Component.extend({
5
- layout,
6
- });
3
+ export default class UikitCheckboxComponent extends Component {}
@@ -1,6 +1,13 @@
1
1
  import Component from "../../input";
2
2
 
3
- export default Component.extend({
4
- classNames: ["uk-input"],
5
- classNameBindings: ["isValid:uk-form-success", "isInvalid:uk-form-danger"],
6
- });
3
+ export default class UikitInputComponent extends Component {
4
+ get class() {
5
+ const style = this.args.isValid
6
+ ? "uk-form-success"
7
+ : this.args.isInvalid
8
+ ? "uk-form-danger"
9
+ : "";
10
+
11
+ return `uk-input ${style}`;
12
+ }
13
+ }
@@ -0,0 +1,20 @@
1
+ {{#each @options as |option i|}}
2
+ {{#if (not-eq i 0)}}<br />{{/if}}
3
+ <label
4
+ class="uk-form-label
5
+ {{if @isValid "uk-text-success"}}
6
+ {{if @isInvalid "uk-text-danger"}}"
7
+ >
8
+ <input
9
+ type="radio"
10
+ class="uk-radio uk-margin-small-right"
11
+ checked={{eq @value option.key}}
12
+ value={{option.key}}
13
+ name={{@name}}
14
+ id="{{@inputId}}-{{i}}"
15
+ disabled={{@disabled}}
16
+ {{on "input" (fn this.onUpdate option.key)}}
17
+ />
18
+ {{option.label}}
19
+ </label>
20
+ {{/each}}
@@ -1,6 +1,3 @@
1
- import layout from "../../../../../templates/components/validated-input/types/-themes/uikit/radio-group";
2
1
  import Component from "../../radio-group";
3
2
 
4
- export default Component.extend({
5
- layout,
6
- });
3
+ export default class UikitRadioGroupComponent extends Component {}
@@ -1,6 +1,13 @@
1
- import layout from "../../../../../templates/components/validated-input/types/-themes/uikit/select";
2
1
  import Component from "../../select";
3
2
 
4
- export default Component.extend({
5
- layout,
6
- });
3
+ export default class UikitSelectComponent extends Component {
4
+ get class() {
5
+ const style = this.args.isValid
6
+ ? "uk-form-success"
7
+ : this.args.isInvalid
8
+ ? "uk-form-danger"
9
+ : "";
10
+
11
+ return `uk-select ${style}`;
12
+ }
13
+ }
@@ -1,6 +1,13 @@
1
1
  import Component from "../../textarea";
2
2
 
3
- export default Component.extend({
4
- classNames: ["uk-textarea"],
5
- classNameBindings: ["isValid:uk-form-success", "isInvalid:uk-form-danger"],
6
- });
3
+ export default class UikitTextareaComponent extends Component {
4
+ get class() {
5
+ const style = this.args.isValid
6
+ ? "uk-form-success"
7
+ : this.args.isInvalid
8
+ ? "uk-form-danger"
9
+ : "";
10
+
11
+ return `uk-textarea ${style}`;
12
+ }
13
+ }
@@ -0,0 +1,14 @@
1
+ {{#each @options as |option i|}}
2
+ <label>
3
+ <input
4
+ type="checkbox"
5
+ checked={{eq @value option.key}}
6
+ value={{option.key}}
7
+ name={{@name}}
8
+ id="{{@inputId}}-{{i}}"
9
+ disabled={{@disabled}}
10
+ {{on "input" (fn this.onUpdate option.key)}}
11
+ />
12
+ {{option.label}}
13
+ </label>
14
+ {{/each}}
@@ -0,0 +1,21 @@
1
+ import { action } from "@ember/object";
2
+ import Component from "@glimmer/component";
3
+
4
+ export default class CheckboxGroupComponent extends Component {
5
+ @action
6
+ onUpdate(event, key) {
7
+ event.preventDefault();
8
+
9
+ const value = this.value || [];
10
+ const index = value.indexOf(key);
11
+
12
+ if (index > -1) {
13
+ value.splice(index, 1);
14
+ } else {
15
+ value.push(key);
16
+ }
17
+
18
+ this.args.update(value);
19
+ this.args.setDirty();
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ <input
2
+ type="checkbox"
3
+ name={{@name}}
4
+ id={{@inputId}}
5
+ disabled={{@disabled}}
6
+ checked={{@value}}
7
+ {{on "input" this.onUpdate}}
8
+ />
9
+ <@labelComponent />
@@ -1,8 +1,12 @@
1
- import Component from "@ember/component";
1
+ import { action } from "@ember/object";
2
+ import Component from "@glimmer/component";
2
3
 
3
- import layout from "../../../templates/components/validated-input/types/checkbox";
4
+ export default class CheckboxComponent extends Component {
5
+ @action
6
+ onUpdate(event) {
7
+ event.preventDefault();
4
8
 
5
- export default Component.extend({
6
- layout,
7
- tagName: "",
8
- });
9
+ this.args.update(event.target.checked);
10
+ this.args.setDirty();
11
+ }
12
+ }