@frontile/forms 0.15.0 → 0.16.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 (153) hide show
  1. package/addon-main.js +37 -0
  2. package/{components → declarations/components}/form-checkbox-group.d.ts +3 -1
  3. package/declarations/components/form-checkbox-group.d.ts.map +1 -0
  4. package/{components → declarations/components}/form-checkbox.d.ts +9 -0
  5. package/declarations/components/form-checkbox.d.ts.map +1 -0
  6. package/{components → declarations/components}/form-field/checkbox.d.ts +2 -0
  7. package/declarations/components/form-field/checkbox.d.ts.map +1 -0
  8. package/{components → declarations/components}/form-field/feedback.d.ts +5 -0
  9. package/declarations/components/form-field/feedback.d.ts.map +1 -0
  10. package/{components → declarations/components}/form-field/hint.d.ts +4 -0
  11. package/declarations/components/form-field/hint.d.ts.map +1 -0
  12. package/{components → declarations/components}/form-field/input.d.ts +4 -2
  13. package/declarations/components/form-field/input.d.ts.map +1 -0
  14. package/{components → declarations/components}/form-field/label.d.ts +4 -0
  15. package/declarations/components/form-field/label.d.ts.map +1 -0
  16. package/{components → declarations/components}/form-field/radio.d.ts +3 -1
  17. package/declarations/components/form-field/radio.d.ts.map +1 -0
  18. package/{components → declarations/components}/form-field/textarea.d.ts +4 -2
  19. package/declarations/components/form-field/textarea.d.ts.map +1 -0
  20. package/declarations/components/form-field.d.ts +38 -0
  21. package/declarations/components/form-field.d.ts.map +1 -0
  22. package/{components → declarations/components}/form-input.d.ts +5 -1
  23. package/declarations/components/form-input.d.ts.map +1 -0
  24. package/{components → declarations/components}/form-radio-group.d.ts +6 -2
  25. package/declarations/components/form-radio-group.d.ts.map +1 -0
  26. package/{components → declarations/components}/form-radio.d.ts +9 -1
  27. package/declarations/components/form-radio.d.ts.map +1 -0
  28. package/{components → declarations/components}/form-select.d.ts +6 -2
  29. package/declarations/components/form-select.d.ts.map +1 -0
  30. package/{components → declarations/components}/form-textarea.d.ts +5 -1
  31. package/declarations/components/form-textarea.d.ts.map +1 -0
  32. package/declarations/template-registry.d.ts +33 -0
  33. package/declarations/template-registry.d.ts.map +1 -0
  34. package/dist/_app_/components/form-checkbox-group.js +1 -0
  35. package/dist/_app_/components/form-checkbox.js +1 -0
  36. package/dist/_app_/components/form-field/checkbox.js +1 -0
  37. package/dist/_app_/components/form-field/feedback.js +1 -0
  38. package/dist/_app_/components/form-field/hint.js +1 -0
  39. package/dist/_app_/components/form-field/input.js +1 -0
  40. package/dist/_app_/components/form-field/label.js +1 -0
  41. package/dist/_app_/components/form-field/radio.js +1 -0
  42. package/dist/_app_/components/form-field/textarea.js +1 -0
  43. package/dist/_app_/components/form-field.js +1 -0
  44. package/dist/_app_/components/form-input.js +1 -0
  45. package/dist/_app_/components/form-radio-group.js +1 -0
  46. package/dist/_app_/components/form-radio.js +1 -0
  47. package/dist/_app_/components/form-select.js +1 -0
  48. package/dist/_app_/components/form-textarea.js +1 -0
  49. package/dist/components/form-checkbox-group.js +55 -0
  50. package/dist/components/form-checkbox-group.js.map +1 -0
  51. package/dist/components/form-checkbox.js +30 -0
  52. package/dist/components/form-checkbox.js.map +1 -0
  53. package/dist/components/form-field/checkbox.js +30 -0
  54. package/dist/components/form-field/checkbox.js.map +1 -0
  55. package/dist/components/form-field/feedback.js +29 -0
  56. package/dist/components/form-field/feedback.js.map +1 -0
  57. package/dist/components/form-field/hint.js +17 -0
  58. package/dist/components/form-field/hint.js.map +1 -0
  59. package/dist/components/form-field/input.js +36 -0
  60. package/dist/components/form-field/input.js.map +1 -0
  61. package/dist/components/form-field/label.js +17 -0
  62. package/dist/components/form-field/label.js.map +1 -0
  63. package/dist/components/form-field/radio.js +29 -0
  64. package/dist/components/form-field/radio.js.map +1 -0
  65. package/dist/components/form-field/textarea.js +30 -0
  66. package/dist/components/form-field/textarea.js.map +1 -0
  67. package/dist/components/form-field.js +44 -0
  68. package/dist/components/form-field.js.map +1 -0
  69. package/dist/components/form-input.js +64 -0
  70. package/dist/components/form-input.js.map +1 -0
  71. package/dist/components/form-radio-group.js +55 -0
  72. package/dist/components/form-radio-group.js.map +1 -0
  73. package/dist/components/form-radio.js +34 -0
  74. package/dist/components/form-radio.js.map +1 -0
  75. package/dist/components/form-select.js +102 -0
  76. package/dist/components/form-select.js.map +1 -0
  77. package/dist/components/form-textarea.js +23 -0
  78. package/dist/components/form-textarea.js.map +1 -0
  79. package/dist/template-registry.js +2 -0
  80. package/dist/template-registry.js.map +1 -0
  81. package/package.json +91 -49
  82. package/addon/components/form-checkbox-demo/usage.md +0 -30
  83. package/addon/components/form-checkbox-group-demo/usage.md +0 -54
  84. package/addon/components/form-checkbox-group.hbs +0 -38
  85. package/addon/components/form-checkbox-group.md +0 -5
  86. package/addon/components/form-checkbox-group.ts +0 -68
  87. package/addon/components/form-checkbox.hbs +0 -43
  88. package/addon/components/form-checkbox.md +0 -5
  89. package/addon/components/form-checkbox.ts +0 -45
  90. package/addon/components/form-field/checkbox.hbs +0 -10
  91. package/addon/components/form-field/checkbox.ts +0 -32
  92. package/addon/components/form-field/feedback.hbs +0 -10
  93. package/addon/components/form-field/feedback.ts +0 -30
  94. package/addon/components/form-field/hint.hbs +0 -8
  95. package/addon/components/form-field/hint.ts +0 -13
  96. package/addon/components/form-field/index.hbs +0 -20
  97. package/addon/components/form-field/index.ts +0 -46
  98. package/addon/components/form-field/input.hbs +0 -10
  99. package/addon/components/form-field/input.ts +0 -40
  100. package/addon/components/form-field/label.hbs +0 -8
  101. package/addon/components/form-field/label.ts +0 -13
  102. package/addon/components/form-field/radio.hbs +0 -11
  103. package/addon/components/form-field/radio.ts +0 -31
  104. package/addon/components/form-field/textarea.hbs +0 -10
  105. package/addon/components/form-field/textarea.ts +0 -32
  106. package/addon/components/form-input-demo/hint.md +0 -34
  107. package/addon/components/form-input-demo/no-label.md +0 -33
  108. package/addon/components/form-input-demo/simple.md +0 -42
  109. package/addon/components/form-input-demo/with-button.md +0 -60
  110. package/addon/components/form-input.hbs +0 -45
  111. package/addon/components/form-input.md +0 -5
  112. package/addon/components/form-input.ts +0 -96
  113. package/addon/components/form-radio-demo/usage.md +0 -39
  114. package/addon/components/form-radio-group-demo/usage.md +0 -43
  115. package/addon/components/form-radio-group.hbs +0 -39
  116. package/addon/components/form-radio-group.md +0 -5
  117. package/addon/components/form-radio-group.ts +0 -67
  118. package/addon/components/form-radio.hbs +0 -40
  119. package/addon/components/form-radio.md +0 -5
  120. package/addon/components/form-radio.ts +0 -53
  121. package/addon/components/form-select-demo/multiple.md +0 -60
  122. package/addon/components/form-select-demo/usage.md +0 -60
  123. package/addon/components/form-select.hbs +0 -101
  124. package/addon/components/form-select.md +0 -11
  125. package/addon/components/form-select.ts +0 -126
  126. package/addon/components/form-textarea-demo/usage.md +0 -40
  127. package/addon/components/form-textarea.hbs +0 -44
  128. package/addon/components/form-textarea.md +0 -5
  129. package/addon/components/form-textarea.ts +0 -7
  130. package/app/components/form-checkbox-group.js +0 -1
  131. package/app/components/form-checkbox.js +0 -1
  132. package/app/components/form-field/checkbox.js +0 -1
  133. package/app/components/form-field/feedback.js +0 -1
  134. package/app/components/form-field/hint.js +0 -1
  135. package/app/components/form-field/index.js +0 -1
  136. package/app/components/form-field/input.js +0 -1
  137. package/app/components/form-field/label.js +0 -1
  138. package/app/components/form-field/radio.js +0 -1
  139. package/app/components/form-field/textarea.js +0 -1
  140. package/app/components/form-input.js +0 -1
  141. package/app/components/form-radio-group.js +0 -1
  142. package/app/components/form-radio.js +0 -1
  143. package/app/components/form-select.js +0 -1
  144. package/app/components/form-textarea.js +0 -1
  145. package/components/form-field/index.d.ts +0 -36
  146. package/config/environment.js +0 -5
  147. package/index.js +0 -34
  148. package/tsconfig.json +0 -23
  149. package/types/dummy/index.d.ts +0 -0
  150. package/types/ember-get-config.d.ts +0 -3
  151. package/types/ember-power-select/test-support.d.ts +0 -29
  152. package/types/global.d.ts +0 -6
  153. package/types/index.d.ts +0 -1
@@ -0,0 +1,30 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import Component from '@glimmer/component';
3
+ import { action } from '@ember/object';
4
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
5
+ import FormField from './form-field.js';
6
+ import { array } from '@ember/helper';
7
+ import { precompileTemplate } from '@ember/template-compilation';
8
+ import { setComponentTemplate } from '@ember/component';
9
+
10
+ var _class, _class2;
11
+ let FormCheckbox = (_class = (_class2 = class FormCheckbox extends Component {
12
+ handleChange(value1, event1) {
13
+ if (typeof this.args.onChange === 'function') {
14
+ this.args.onChange(value1, event1);
15
+ }
16
+ if (typeof this.args._parentOnChange === 'function') {
17
+ this.args._parentOnChange(value1, event1);
18
+ }
19
+ }
20
+ }, setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{useFrontileClass \"form-checkbox\" @size (if @checked \"checked\") class=(array @containerClass @privateContainerClass)}} as |f|>\n <div class={{useFrontileClass \"form-checkbox\" @size part=\"label-container\"}}>\n <div class={{useFrontileClass \"form-checkbox\" @size part=\"input-container\"}}>\n {{!-- Zero-width space character, used to align checkbox properly --}}\n {{!-- eslint-disable no-irregular-whitespace--}}\n \u200B\n <f.Checkbox @onChange={{this.handleChange}} @checked={{@checked}} @name={{@name}} class={{useFrontileClass \"form-checkbox\" @size part=\"checkbox\"}} aria-describedby={{if @hint f.hintId}} ...attributes />\n </div>\n\n <f.Label class={{useFrontileClass \"form-checkbox\" @size part=\"label\"}}>\n {{#if (has-block)}}\n {{yield}}\n {{else}}\n {{@label}}\n {{/if}}\n </f.Label>\n </div>\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-checkbox\" @size part=\"hint\"}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n </FormField>\n ", {
21
+ scope: () => ({
22
+ FormField,
23
+ useFrontileClass,
24
+ array
25
+ }),
26
+ strictMode: true
27
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
28
+
29
+ export { FormCheckbox as default };
30
+ //# sourceMappingURL=form-checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-checkbox.js","sources":["../../src/components/form-checkbox.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport FormField from './form-field';\nimport { array } from '@ember/helper';\nexport interface FormCheckboxArgs {\n /** The input field label */ label?: string;\n /** A help text to be displayed */ hint?: string;\n /**\n * If the checkbox is checked.\n * You must also pass `onChange` to update its value.\n */ checked: boolean;\n /** The name of the checkbox */ name?: string;\n /** CSS classes to be added in the container element */ containerClass?: string;\n /** The size */ size?: 'sm' | 'lg';\n /** Callback when onchange is triggered */ onChange: (value: boolean, event: Event) => void;\n /**\n * Internal function for InputCheckboxGroup\n * @ignore\n **/ _parentOnChange?: (value: boolean, event: Event) => void;\n /**\n * CSS classes to be added in the container element\n * @ignore\n * */ privateContainerClass?: string;\n}\nexport interface FormCheckboxSignature {\n Args: FormCheckboxArgs;\n Element: HTMLInputElement;\n Blocks: {\n default: [];\n };\n}\nexport default class FormCheckbox extends Component<FormCheckboxSignature> {\n @action\n handleChange(value1: boolean, event1: Event): void {\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value1, event1);\n }\n if (typeof this.args._parentOnChange === 'function') {\n this.args._parentOnChange(value1, event1);\n }\n }\n static{\n template(`\n <FormField\n @size={{@size}}\n class={{useFrontileClass\n \"form-checkbox\"\n @size\n (if @checked \"checked\")\n class=(array @containerClass @privateContainerClass)\n }}\n as |f|\n >\n <div\n class={{useFrontileClass \"form-checkbox\" @size part=\"label-container\"}}\n >\n <div\n class={{useFrontileClass\n \"form-checkbox\"\n @size\n part=\"input-container\"\n }}\n >\n {{! Zero-width space character, used to align checkbox properly }}\n {{! eslint-disable no-irregular-whitespace}}\n ​\n <f.Checkbox\n @onChange={{this.handleChange}}\n @checked={{@checked}}\n @name={{@name}}\n class={{useFrontileClass \"form-checkbox\" @size part=\"checkbox\"}}\n aria-describedby={{if @hint f.hintId}}\n ...attributes\n />\n </div>\n\n <f.Label class={{useFrontileClass \"form-checkbox\" @size part=\"label\"}}>\n {{#if (has-block)}}\n {{yield}}\n {{else}}\n {{@label}}\n {{/if}}\n </f.Label>\n </div>\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-checkbox\" @size part=\"hint\"}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n </FormField>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormCheckbox","_class","_class2","Component","handleChange","value1","event1","args","onChange","_parentOnChange","setComponentTemplate","precompileTemplate","scope","FormField","useFrontileClass","array","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;AAiCqBA,IAAAA,YAAY,IAAAC,MAAA,IAAAC,OAAA,GAAlB,MAAMF,YAAY,SAASG,SAAS,CAAwB;AAEvEC,EAAAA,YAAYA,CAACC,MAAe,EAAEC,MAAa,EAAQ;IAC/C,IAAI,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,KAAK,UAAU,EAAE;MAC1C,IAAI,CAACD,IAAI,CAACC,QAAQ,CAACH,MAAM,EAAEC,MAAM,CAAC,CAAA;AACtC,KAAA;IACA,IAAI,OAAO,IAAI,CAACC,IAAI,CAACE,eAAe,KAAK,UAAU,EAAE;MACjD,IAAI,CAACF,IAAI,CAACE,eAAe,CAACJ,MAAM,EAAEC,MAAM,CAAC,CAAA;AAC7C,KAAA;AACJ,GAAA;AA0DJ,CAAC,EAAAI,oBAAA,CAxDOC,kBAAA,CAiDH,gpCAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;IAAAC,gBAAA;AAAAC,IAAAA,KAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAd,OAAA,CAAAA,EAAAA,OAAA,CAAAe,GAAAA,yBAAA,CAAAhB,MAAA,CAAAiB,SAAA,EAhELC,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAApB,MAAA,CAAAiB,SAAA,EAAA,cAAA,CAAA,EAAAjB,MAAA,CAAAiB,SAAA,CAAA,GAAAjB,MAAA;;;;"}
@@ -0,0 +1,30 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import Component from '@glimmer/component';
3
+ import { action } from '@ember/object';
4
+ import { on } from '@ember/modifier';
5
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
6
+ import { precompileTemplate } from '@ember/template-compilation';
7
+ import { setComponentTemplate } from '@ember/component';
8
+
9
+ var _class, _class2;
10
+ let FormFieldCheckbox = (_class = (_class2 = class FormFieldCheckbox extends Component {
11
+ get isChecked() {
12
+ return !!this.args.checked;
13
+ }
14
+ handleChange(event1) {
15
+ event1.preventDefault();
16
+ const value1 = !this.args.checked;
17
+ if (typeof this.args.onChange === 'function') {
18
+ this.args.onChange(value1, event1);
19
+ }
20
+ }
21
+ }, setComponentTemplate(precompileTemplate("\n <input {{on \"change\" this.handleChange}} id={{@id}} name={{@name}} checked={{this.isChecked}} type=\"checkbox\" class={{useFrontileClass \"form-field-checkbox\" @size}} data-test-id=\"form-field-checkbox\" ...attributes />\n ", {
22
+ scope: () => ({
23
+ useFrontileClass,
24
+ on
25
+ }),
26
+ strictMode: true
27
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
28
+
29
+ export { FormFieldCheckbox as default };
30
+ //# sourceMappingURL=checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.js","sources":["../../../src/components/form-field/checkbox.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nexport interface FormFieldCheckboxArgs {\n id?: string;\n checked?: boolean;\n name?: string;\n size?: 'sm' | 'lg';\n // Callback when onchange is triggered\n onChange?: (value: boolean, event: Event) => void;\n}\nexport interface FormFieldCheckboxSignature {\n Args: FormFieldCheckboxArgs;\n Element: HTMLInputElement;\n}\nexport default class FormFieldCheckbox extends Component<FormFieldCheckboxSignature> {\n get isChecked(): boolean {\n return !!this.args.checked;\n }\n @action\n handleChange(event1: Event): void {\n event1.preventDefault();\n const value1 = !this.args.checked;\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value1, event1);\n }\n }\n static{\n template(`\n <input\n {{on \"change\" this.handleChange}}\n id={{@id}}\n name={{@name}}\n checked={{this.isChecked}}\n type=\"checkbox\"\n class={{useFrontileClass \"form-field-checkbox\" @size}}\n data-test-id=\"form-field-checkbox\"\n ...attributes\n />\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormFieldCheckbox","_class","_class2","Component","isChecked","args","checked","handleChange","event1","preventDefault","value1","onChange","setComponentTemplate","precompileTemplate","scope","useFrontileClass","on","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;AAiBqBA,IAAAA,iBAAiB,IAAAC,MAAA,IAAAC,OAAA,GAAvB,MAAMF,iBAAiB,SAASG,SAAS,CAA6B;EACjF,IAAIC,SAASA,GAAY;AACrB,IAAA,OAAO,CAAC,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO,CAAA;AAC9B,GAAA;EAEAC,YAAYA,CAACC,MAAa,EAAQ;IAC9BA,MAAM,CAACC,cAAc,EAAE,CAAA;AACvB,IAAA,MAAMC,MAAM,GAAG,CAAC,IAAI,CAACL,IAAI,CAACC,OAAO,CAAA;IACjC,IAAI,OAAO,IAAI,CAACD,IAAI,CAACM,QAAQ,KAAK,UAAU,EAAE;MAC1C,IAAI,CAACN,IAAI,CAACM,QAAQ,CAACD,MAAM,EAAEF,MAAM,CAAC,CAAA;AACtC,KAAA;AACJ,GAAA;AAoBJ,CAAC,EAAAI,oBAAA,CAlBOC,kBAAA,CAWH,4OAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,gBAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAf,OAAA,CAAAA,EAAAA,OAAA,CAAAgB,GAAAA,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAzBLC,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAArB,MAAA,CAAAkB,SAAA,EAAA,cAAA,CAAA,EAAAlB,MAAA,CAAAkB,SAAA,CAAA,GAAAlB,MAAA;;;;"}
@@ -0,0 +1,29 @@
1
+ import Component from '@glimmer/component';
2
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
3
+ import { precompileTemplate } from '@ember/template-compilation';
4
+ import { setComponentTemplate } from '@ember/component';
5
+
6
+ var _class;
7
+ class FormFieldFeedback extends Component {
8
+ get isError() {
9
+ return typeof this.args.errors !== 'undefined' || this.args.isError === true;
10
+ }
11
+ get errorMessage() {
12
+ if (!this.args.errors) return '';
13
+ if (typeof this.args.errors === 'string') {
14
+ return this.args.errors;
15
+ } else {
16
+ return this.args.errors.join('; ');
17
+ }
18
+ }
19
+ }
20
+ _class = FormFieldFeedback;
21
+ setComponentTemplate(precompileTemplate("\n <div id={{@id}} class={{useFrontileClass \"form-field-feedback\" @size (if this.isError \"error\")}} data-test-id=\"form-field-feedback\" aria-live={{if this.isError \"assertive\" \"polite\"}} ...attributes>\n {{this.errorMessage}}\n {{yield}}\n </div>\n ", {
22
+ scope: () => ({
23
+ useFrontileClass
24
+ }),
25
+ strictMode: true
26
+ }), _class);
27
+
28
+ export { FormFieldFeedback as default };
29
+ //# sourceMappingURL=feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.js","sources":["../../../src/components/form-field/feedback.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nexport interface FormFieldFeedbackArgs {\n id?: string;\n isError?: boolean;\n errors?: string[] | string;\n size?: 'sm' | 'lg';\n}\nexport interface FormFieldFeedbackSignature {\n Args: FormFieldFeedbackArgs;\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\nexport default class FormFieldFeedback extends Component<FormFieldFeedbackSignature> {\n get isError(): boolean {\n return (typeof this.args.errors !== 'undefined' || this.args.isError === true);\n }\n get errorMessage(): string {\n if (!this.args.errors) return '';\n if (typeof this.args.errors === 'string') {\n return this.args.errors;\n } else {\n return this.args.errors.join('; ');\n }\n }\n static{\n template(`\n <div\n id={{@id}}\n class={{useFrontileClass\n \"form-field-feedback\"\n @size\n (if this.isError \"error\")\n }}\n data-test-id=\"form-field-feedback\"\n aria-live={{if this.isError \"assertive\" \"polite\"}}\n ...attributes\n >\n {{this.errorMessage}}\n {{yield}}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormFieldFeedback","Component","isError","args","errors","errorMessage","join","_class","setComponentTemplate","precompileTemplate","scope","useFrontileClass","strictMode"],"mappings":";;;;;;AAgBe,MAAMA,iBAAiB,SAASC,SAAS,CAA6B;EACjF,IAAIC,OAAOA,GAAY;AACnB,IAAA,OAAQ,OAAO,IAAI,CAACC,IAAI,CAACC,MAAM,KAAK,WAAW,IAAI,IAAI,CAACD,IAAI,CAACD,OAAO,KAAK,IAAI,CAAA;AACjF,GAAA;EACA,IAAIG,YAAYA,GAAW;IACvB,IAAI,CAAC,IAAI,CAACF,IAAI,CAACC,MAAM,EAAE,OAAO,EAAE,CAAA;IAChC,IAAI,OAAO,IAAI,CAACD,IAAI,CAACC,MAAM,KAAK,QAAQ,EAAE;AACtC,MAAA,OAAO,IAAI,CAACD,IAAI,CAACC,MAAM,CAAA;AAC3B,KAAC,MAAM;MACH,OAAO,IAAI,CAACD,IAAI,CAACC,MAAM,CAACE,IAAI,CAAC,IAAI,CAAC,CAAA;AACtC,KAAA;AACJ,GAAA;AAwBJ,CAAA;AAACC,MAAA,GAnCoBP,iBAAiB,CAAA;AAa9BQ,oBAAA,CAAAC,kBAAA,CAeH,qRAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,gBAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAL,MAAA,CAAA;;;;"}
@@ -0,0 +1,17 @@
1
+ import Component from '@glimmer/component';
2
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
3
+ import { precompileTemplate } from '@ember/template-compilation';
4
+ import { setComponentTemplate } from '@ember/component';
5
+
6
+ var _class;
7
+ class FormFieldHint extends Component {}
8
+ _class = FormFieldHint;
9
+ setComponentTemplate(precompileTemplate("\n <div id={{@id}} class={{useFrontileClass \"form-field-hint\" @size}} data-test-id=\"form-field-hint\" ...attributes>\n {{yield}}\n </div>\n ", {
10
+ scope: () => ({
11
+ useFrontileClass
12
+ }),
13
+ strictMode: true
14
+ }), _class);
15
+
16
+ export { FormFieldHint as default };
17
+ //# sourceMappingURL=hint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hint.js","sources":["../../../src/components/form-field/hint.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nexport interface FormFieldHintArgs {\n id?: string;\n size?: 'sm' | 'lg';\n}\nexport interface FormFieldHintSignature {\n Args: FormFieldHintArgs;\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\nexport default class FormFieldHint extends Component<FormFieldHintSignature> {\n static{\n template(`\n <div\n id={{@id}}\n class={{useFrontileClass \"form-field-hint\" @size}}\n data-test-id=\"form-field-hint\"\n ...attributes\n >\n {{yield}}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormFieldHint","Component","_class","setComponentTemplate","precompileTemplate","scope","useFrontileClass","strictMode"],"mappings":";;;;;;AAce,MAAMA,aAAa,SAASC,SAAS,CAAyB,EAAA;AAkB5EC,MAAA,GAlBoBF,aAAa,CAAA;AAE1BG,oBAAA,CAAAC,kBAAA,CASH,6JAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,gBAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAL,MAAA,CAAA;;;;"}
@@ -0,0 +1,36 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import Component from '@glimmer/component';
3
+ import { action } from '@ember/object';
4
+ import { on } from '@ember/modifier';
5
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
6
+ import { precompileTemplate } from '@ember/template-compilation';
7
+ import { setComponentTemplate } from '@ember/component';
8
+
9
+ var _class, _class2;
10
+ let FormFieldInput = (_class = (_class2 = class FormFieldInput extends Component {
11
+ get type() {
12
+ if (typeof this.args.type === 'string') {
13
+ return this.args.type;
14
+ }
15
+ return 'text';
16
+ }
17
+ handleOnInput(event1) {
18
+ if (typeof this.args.onInput === 'function') {
19
+ this.args.onInput(event1.target.value, event1);
20
+ }
21
+ }
22
+ handleOnChange(event1) {
23
+ if (typeof this.args.onChange === 'function') {
24
+ this.args.onChange(event1.target.value, event1);
25
+ }
26
+ }
27
+ }, setComponentTemplate(precompileTemplate("\n <input {{on \"input\" this.handleOnInput}} {{on \"change\" this.handleOnChange}} id={{@id}} value={{@value}} type={{this.type}} class={{useFrontileClass \"form-field-input\" @size}} data-test-id=\"form-field-input\" ...attributes />\n ", {
28
+ scope: () => ({
29
+ useFrontileClass,
30
+ on
31
+ }),
32
+ strictMode: true
33
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleOnInput", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleOnInput"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleOnChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleOnChange"), _class.prototype)), _class);
34
+
35
+ export { FormFieldInput as default };
36
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sources":["../../../src/components/form-field/input.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nexport interface FormFieldInputArgs {\n id?: string;\n type?: string;\n size?: 'sm' | 'lg';\n value?: string;\n // Callback when oninput is triggered\n onInput?: (value: string, event: InputEvent) => void;\n // Callback when onchange is triggered\n onChange?: (value: string, event: InputEvent) => void;\n}\nexport interface FormFieldInputSignature {\n Args: FormFieldInputArgs;\n Element: HTMLInputElement;\n}\nexport default class FormFieldInput extends Component<FormFieldInputSignature> {\n get type(): string {\n if (typeof this.args.type === 'string') {\n return this.args.type;\n }\n return 'text';\n }\n @action\n handleOnInput(event1: Event): void {\n if (typeof this.args.onInput === 'function') {\n this.args.onInput((event1.target as HTMLInputElement).value, event1 as InputEvent);\n }\n }\n @action\n handleOnChange(event1: Event): void {\n if (typeof this.args.onChange === 'function') {\n this.args.onChange((event1.target as HTMLInputElement).value, event1 as InputEvent);\n }\n }\n static{\n template(`\n <input\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n id={{@id}}\n value={{@value}}\n type={{this.type}}\n class={{useFrontileClass \"form-field-input\" @size}}\n data-test-id=\"form-field-input\"\n ...attributes\n />\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormFieldInput","_class","_class2","Component","type","args","handleOnInput","event1","onInput","target","value","handleOnChange","onChange","setComponentTemplate","precompileTemplate","scope","useFrontileClass","on","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;AAmBqBA,IAAAA,cAAc,IAAAC,MAAA,IAAAC,OAAA,GAApB,MAAMF,cAAc,SAASG,SAAS,CAA0B;EAC3E,IAAIC,IAAIA,GAAW;IACf,IAAI,OAAO,IAAI,CAACC,IAAI,CAACD,IAAI,KAAK,QAAQ,EAAE;AACpC,MAAA,OAAO,IAAI,CAACC,IAAI,CAACD,IAAI,CAAA;AACzB,KAAA;AACA,IAAA,OAAO,MAAM,CAAA;AACjB,GAAA;EAEAE,aAAaA,CAACC,MAAa,EAAQ;IAC/B,IAAI,OAAO,IAAI,CAACF,IAAI,CAACG,OAAO,KAAK,UAAU,EAAE;AACzC,MAAA,IAAI,CAACH,IAAI,CAACG,OAAO,CAAED,MAAM,CAACE,MAAM,CAAsBC,KAAK,EAAEH,MAAoB,CAAC,CAAA;AACtF,KAAA;AACJ,GAAA;EAEAI,cAAcA,CAACJ,MAAa,EAAQ;IAChC,IAAI,OAAO,IAAI,CAACF,IAAI,CAACO,QAAQ,KAAK,UAAU,EAAE;AAC1C,MAAA,IAAI,CAACP,IAAI,CAACO,QAAQ,CAAEL,MAAM,CAACE,MAAM,CAAsBC,KAAK,EAAEH,MAAoB,CAAC,CAAA;AACvF,KAAA;AACJ,GAAA;AAoBJ,CAAC,EAAAM,oBAAA,CAlBOC,kBAAA,CAWH,oPAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,gBAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAhB,OAAA,CAAA,EAAAA,OAAA,CAAAiB,GAAAA,yBAAA,CAAAlB,MAAA,CAAAmB,SAAA,EA7BLC,eAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAtB,MAAA,CAAAmB,SAAA,EAAAnB,eAAAA,CAAAA,EAAAA,MAAA,CAAAmB,SAAA,CAAA,EAAAD,yBAAA,CAAAlB,MAAA,CAAAmB,SAAA,EAAA,gBAAA,EAAA,CAMNC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAtB,MAAA,CAAAmB,SAAA,qBAAAnB,MAAA,CAAAmB,SAAA,CAAA,GAAAnB,MAAA;;;;"}
@@ -0,0 +1,17 @@
1
+ import Component from '@glimmer/component';
2
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
3
+ import { precompileTemplate } from '@ember/template-compilation';
4
+ import { setComponentTemplate } from '@ember/component';
5
+
6
+ var _class;
7
+ class FormFieldLabel extends Component {}
8
+ _class = FormFieldLabel;
9
+ setComponentTemplate(precompileTemplate("\n <label for={{@for}} class={{useFrontileClass \"form-field-label\" @size}} data-test-id=\"form-field-label\" ...attributes>\n {{yield}}\n </label>\n ", {
10
+ scope: () => ({
11
+ useFrontileClass
12
+ }),
13
+ strictMode: true
14
+ }), _class);
15
+
16
+ export { FormFieldLabel as default };
17
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sources":["../../../src/components/form-field/label.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nexport interface FormFieldLabelArgs {\n for?: string;\n size?: 'sm' | 'lg';\n}\nexport interface FormFieldLabelSignature {\n Args: FormFieldLabelArgs;\n Element: HTMLLabelElement;\n Blocks: {\n default: [];\n };\n}\nexport default class FormFieldLabel extends Component<FormFieldLabelSignature> {\n static{\n template(`\n <label\n for={{@for}}\n class={{useFrontileClass \"form-field-label\" @size}}\n data-test-id=\"form-field-label\"\n ...attributes\n >\n {{yield}}\n </label>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormFieldLabel","Component","_class","setComponentTemplate","precompileTemplate","scope","useFrontileClass","strictMode"],"mappings":";;;;;;AAce,MAAMA,cAAc,SAASC,SAAS,CAA0B,EAAA;AAkB9EC,MAAA,GAlBoBF,cAAc,CAAA;AAE3BG,oBAAA,CAAAC,kBAAA,CASH,qKAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,gBAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAL,MAAA,CAAA;;;;"}
@@ -0,0 +1,29 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import Component from '@glimmer/component';
3
+ import { action } from '@ember/object';
4
+ import { on } from '@ember/modifier';
5
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
6
+ import { precompileTemplate } from '@ember/template-compilation';
7
+ import { setComponentTemplate } from '@ember/component';
8
+
9
+ var _class, _class2;
10
+ let FormFieldRadio = (_class = (_class2 = class FormFieldRadio extends Component {
11
+ get isChecked() {
12
+ return this.args.checked === this.args.value;
13
+ }
14
+ handleChange(event1) {
15
+ event1.preventDefault();
16
+ if (typeof this.args.onChange === 'function') {
17
+ this.args.onChange(this.args.value, event1);
18
+ }
19
+ }
20
+ }, setComponentTemplate(precompileTemplate("\n <input {{on \"change\" this.handleChange}} id={{@id}} name={{@name}} value={{@value}} checked={{this.isChecked}} type=\"radio\" class={{useFrontileClass \"form-field-radio\" @size}} data-test-id=\"form-field-radio\" ...attributes />\n ", {
21
+ scope: () => ({
22
+ useFrontileClass,
23
+ on
24
+ }),
25
+ strictMode: true
26
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
27
+
28
+ export { FormFieldRadio as default };
29
+ //# sourceMappingURL=radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio.js","sources":["../../../src/components/form-field/radio.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nexport interface FormFieldRadioArgs {\n id?: string;\n value?: string | number | boolean;\n checked?: unknown;\n name?: string;\n size?: 'sm' | 'lg';\n // Callback when onchange is triggered\n onChange?: (value: unknown, event: Event) => void;\n}\nexport interface FormFieldRadioSignature {\n Args: FormFieldRadioArgs;\n Element: HTMLInputElement;\n}\nexport default class FormFieldRadio extends Component<FormFieldRadioSignature> {\n get isChecked(): boolean {\n return this.args.checked === this.args.value;\n }\n @action\n handleChange(event1: Event): void {\n event1.preventDefault();\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(this.args.value, event1);\n }\n }\n static{\n template(`\n <input\n {{on \"change\" this.handleChange}}\n id={{@id}}\n name={{@name}}\n value={{@value}}\n checked={{this.isChecked}}\n type=\"radio\"\n class={{useFrontileClass \"form-field-radio\" @size}}\n data-test-id=\"form-field-radio\"\n ...attributes\n />\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormFieldRadio","_class","_class2","Component","isChecked","args","checked","value","handleChange","event1","preventDefault","onChange","setComponentTemplate","precompileTemplate","scope","useFrontileClass","on","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;AAkBqBA,IAAAA,cAAc,IAAAC,MAAA,IAAAC,OAAA,GAApB,MAAMF,cAAc,SAASG,SAAS,CAA0B;EAC3E,IAAIC,SAASA,GAAY;IACrB,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK,CAAA;AAChD,GAAA;EAEAC,YAAYA,CAACC,MAAa,EAAQ;IAC9BA,MAAM,CAACC,cAAc,EAAE,CAAA;IACvB,IAAI,OAAO,IAAI,CAACL,IAAI,CAACM,QAAQ,KAAK,UAAU,EAAE;AAC1C,MAAA,IAAI,CAACN,IAAI,CAACM,QAAQ,CAAC,IAAI,CAACN,IAAI,CAACE,KAAK,EAAEE,MAAM,CAAC,CAAA;AAC/C,KAAA;AACJ,GAAA;AAqBJ,CAAC,EAAAG,oBAAA,CAnBOC,kBAAA,CAYH,oPAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,gBAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAf,OAAA,CAAAA,EAAAA,OAAA,CAAAgB,GAAAA,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAzBLC,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAArB,MAAA,CAAAkB,SAAA,EAAA,cAAA,CAAA,EAAAlB,MAAA,CAAAkB,SAAA,CAAA,GAAAlB,MAAA;;;;"}
@@ -0,0 +1,30 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import Component from '@glimmer/component';
3
+ import { action } from '@ember/object';
4
+ import { on } from '@ember/modifier';
5
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
6
+ import { precompileTemplate } from '@ember/template-compilation';
7
+ import { setComponentTemplate } from '@ember/component';
8
+
9
+ var _class, _class2;
10
+ let FormFieldTextarea = (_class = (_class2 = class FormFieldTextarea extends Component {
11
+ handleOnInput(event1) {
12
+ if (typeof this.args.onInput === 'function') {
13
+ this.args.onInput(event1.target.value, event1);
14
+ }
15
+ }
16
+ handleOnChange(event1) {
17
+ if (typeof this.args.onChange === 'function') {
18
+ this.args.onChange(event1.target.value, event1);
19
+ }
20
+ }
21
+ }, setComponentTemplate(precompileTemplate("\n <textarea {{on \"input\" this.handleOnInput}} {{on \"change\" this.handleOnChange}} id={{@id}} value={{@value}} class={{useFrontileClass \"form-field-textarea\" @size}} data-test-id=\"form-field-textarea\" ...attributes>\n </textarea>\n ", {
22
+ scope: () => ({
23
+ useFrontileClass,
24
+ on
25
+ }),
26
+ strictMode: true
27
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleOnInput", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleOnInput"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleOnChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleOnChange"), _class.prototype)), _class);
28
+
29
+ export { FormFieldTextarea as default };
30
+ //# sourceMappingURL=textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.js","sources":["../../../src/components/form-field/textarea.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nexport interface FormFieldTextareaArgs {\n id?: string;\n value?: string | number | boolean;\n size?: 'sm' | 'lg';\n // Callback when oninput is triggered\n onInput?: (value: string, event: InputEvent) => void;\n // Callback when onchange is triggered\n onChange?: (value: string, event: InputEvent) => void;\n}\nexport interface FormFieldTextareaSignature {\n Args: FormFieldTextareaArgs;\n Element: HTMLTextAreaElement;\n}\nexport default class FormFieldTextarea extends Component<FormFieldTextareaSignature> {\n @action\n handleOnInput(event1: Event): void {\n if (typeof this.args.onInput === 'function') {\n this.args.onInput((event1.target as HTMLInputElement).value, event1 as InputEvent);\n }\n }\n @action\n handleOnChange(event1: Event): void {\n if (typeof this.args.onChange === 'function') {\n this.args.onChange((event1.target as HTMLInputElement).value, event1 as InputEvent);\n }\n }\n static{\n template(`\n <textarea\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n id={{@id}}\n value={{@value}}\n class={{useFrontileClass \"form-field-textarea\" @size}}\n data-test-id=\"form-field-textarea\"\n ...attributes\n >\n </textarea>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormFieldTextarea","_class","_class2","Component","handleOnInput","event1","args","onInput","target","value","handleOnChange","onChange","setComponentTemplate","precompileTemplate","scope","useFrontileClass","on","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;AAkBqBA,IAAAA,iBAAiB,IAAAC,MAAA,IAAAC,OAAA,GAAvB,MAAMF,iBAAiB,SAASG,SAAS,CAA6B;EAEjFC,aAAaA,CAACC,MAAa,EAAQ;IAC/B,IAAI,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,KAAK,UAAU,EAAE;AACzC,MAAA,IAAI,CAACD,IAAI,CAACC,OAAO,CAAEF,MAAM,CAACG,MAAM,CAAsBC,KAAK,EAAEJ,MAAoB,CAAC,CAAA;AACtF,KAAA;AACJ,GAAA;EAEAK,cAAcA,CAACL,MAAa,EAAQ;IAChC,IAAI,OAAO,IAAI,CAACC,IAAI,CAACK,QAAQ,KAAK,UAAU,EAAE;AAC1C,MAAA,IAAI,CAACL,IAAI,CAACK,QAAQ,CAAEN,MAAM,CAACG,MAAM,CAAsBC,KAAK,EAAEJ,MAAoB,CAAC,CAAA;AACvF,KAAA;AACJ,GAAA;AAoBJ,CAAC,EAAAO,oBAAA,CAlBOC,kBAAA,CAWH,yPAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,gBAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAf,OAAA,CAAA,EAAAA,OAAA,CAAAgB,GAAAA,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EA7BLC,eAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAArB,MAAA,CAAAkB,SAAA,EAAAlB,eAAAA,CAAAA,EAAAA,MAAA,CAAAkB,SAAA,CAAA,EAAAD,yBAAA,CAAAjB,MAAA,CAAAkB,SAAA,EAAA,gBAAA,EAAA,CAMNC,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAArB,MAAA,CAAAkB,SAAA,qBAAAlB,MAAA,CAAAkB,SAAA,CAAA,GAAAlB,MAAA;;;;"}
@@ -0,0 +1,44 @@
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import Component from '@glimmer/component';
3
+ import { guidFor } from '@ember/object/internals';
4
+ import { hash } from '@ember/helper';
5
+ import FormFieldCheckbox from './form-field/checkbox.js';
6
+ import FormFieldFeedback from './form-field/feedback.js';
7
+ import FormFieldHint from './form-field/hint.js';
8
+ import FormFieldInput from './form-field/input.js';
9
+ import FormFieldLabel from './form-field/label.js';
10
+ import FormFieldRadio from './form-field/radio.js';
11
+ import FormFieldTextarea from './form-field/textarea.js';
12
+ import { precompileTemplate } from '@ember/template-compilation';
13
+ import { setComponentTemplate } from '@ember/component';
14
+
15
+ var _class;
16
+ class FormField extends Component {
17
+ constructor(...args) {
18
+ super(...args);
19
+ _defineProperty(this, "id", guidFor(this));
20
+ }
21
+ get hintId() {
22
+ return this.id + '-hint';
23
+ }
24
+ get feedbackId() {
25
+ return this.id + '-feedback';
26
+ }
27
+ }
28
+ _class = FormField;
29
+ setComponentTemplate(precompileTemplate("\n <div ...attributes>\n {{yield (hash id=this.id hintId=this.hintId feedbackId=this.feedbackId Label=(component FormFieldLabel for=this.id size=@size) Hint=(component FormFieldHint id=this.hintId size=@size) Feedback=(component FormFieldFeedback id=this.feedbackId size=@size) Input=(component FormFieldInput id=this.id size=@size) Textarea=(component FormFieldTextarea id=this.id size=@size) Checkbox=(component FormFieldCheckbox id=this.id size=@size) Radio=(component FormFieldRadio id=this.id size=@size))}}\n </div>\n ", {
30
+ scope: () => ({
31
+ hash,
32
+ FormFieldLabel,
33
+ FormFieldHint,
34
+ FormFieldFeedback,
35
+ FormFieldInput,
36
+ FormFieldTextarea,
37
+ FormFieldCheckbox,
38
+ FormFieldRadio
39
+ }),
40
+ strictMode: true
41
+ }), _class);
42
+
43
+ export { FormField as default };
44
+ //# sourceMappingURL=form-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field.js","sources":["../../src/components/form-field.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport FormFieldCheckbox from './form-field/checkbox';\nimport FormFieldFeedback from './form-field/feedback';\nimport FormFieldHint from './form-field/hint';\nimport FormFieldInput from './form-field/input';\nimport FormFieldLabel from './form-field/label';\nimport FormFieldRadio from './form-field/radio';\nimport FormFieldTextarea from './form-field/textarea';\nimport type { WithBoundArgs } from '@glint/template';\nexport interface FormFieldArgs {\n size?: 'sm' | 'lg';\n}\nexport interface FormFieldSignature {\n Args: FormFieldArgs;\n Blocks: {\n default: [{\n id: string;\n hintId: string;\n feedbackId: string;\n Label: WithBoundArgs<typeof FormFieldLabel, 'for'> & WithBoundArgs<typeof FormFieldLabel, 'size'>;\n Hint: WithBoundArgs<typeof FormFieldHint, 'id'> & WithBoundArgs<typeof FormFieldHint, 'size'>;\n Feedback: WithBoundArgs<typeof FormFieldFeedback, 'id'> & WithBoundArgs<typeof FormFieldFeedback, 'size'>;\n Input: WithBoundArgs<typeof FormFieldInput, 'id'> & WithBoundArgs<typeof FormFieldInput, 'size'>;\n Textarea: WithBoundArgs<typeof FormFieldTextarea, 'id'> & WithBoundArgs<typeof FormFieldTextarea, 'size'>;\n Checkbox: WithBoundArgs<typeof FormFieldCheckbox, 'id'> & WithBoundArgs<typeof FormFieldCheckbox, 'size'>;\n Radio: WithBoundArgs<typeof FormFieldRadio, 'id'> & WithBoundArgs<typeof FormFieldRadio, 'size'>;\n }];\n };\n Element: HTMLDivElement;\n}\nexport default class FormField extends Component<FormFieldSignature> {\n id = guidFor(this);\n get hintId(): string {\n return this.id + '-hint';\n }\n get feedbackId(): string {\n return this.id + '-feedback';\n }\n static{\n template(`\n <div ...attributes>\n {{yield\n (hash\n id=this.id\n hintId=this.hintId\n feedbackId=this.feedbackId\n Label=(component FormFieldLabel for=this.id size=@size)\n Hint=(component FormFieldHint id=this.hintId size=@size)\n Feedback=(component FormFieldFeedback id=this.feedbackId size=@size)\n Input=(component FormFieldInput id=this.id size=@size)\n Textarea=(component FormFieldTextarea id=this.id size=@size)\n Checkbox=(component FormFieldCheckbox id=this.id size=@size)\n Radio=(component FormFieldRadio id=this.id size=@size)\n )\n }}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormField","Component","constructor","args","_defineProperty","guidFor","hintId","id","feedbackId","_class","setComponentTemplate","precompileTemplate","scope","hash","FormFieldLabel","FormFieldHint","FormFieldFeedback","FormFieldInput","FormFieldTextarea","FormFieldCheckbox","FormFieldRadio","strictMode"],"mappings":";;;;;;;;;;;;;;;AAiCe,MAAMA,SAAS,SAASC,SAAS,CAAqB;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,eAAA,CAC5DC,IAAAA,EAAAA,IAAAA,EAAAA,OAAO,CAAC,IAAI,CAAC,CAAA,CAAA;AAAA,GAAA;EAClB,IAAIC,MAAMA,GAAW;AACjB,IAAA,OAAO,IAAI,CAACC,EAAE,GAAG,OAAO,CAAA;AAC5B,GAAA;EACA,IAAIC,UAAUA,GAAW;AACrB,IAAA,OAAO,IAAI,CAACD,EAAE,GAAG,WAAW,CAAA;AAChC,GAAA;AA0BJ,CAAA;AAACE,MAAA,GAjCoBT,SAAS,CAAA;AAStBU,oBAAA,CAAAC,kBAAA,CAiBH,0hBAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;IAAAC,cAAA;IAAAC,aAAA;IAAAC,iBAAA;IAAAC,cAAA;IAAAC,iBAAA;IAAAC,iBAAA;AAAAC,IAAAA,cAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAZ,MAAA,CAAA;;;;"}
@@ -0,0 +1,64 @@
1
+ import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
2
+ import '@babel/runtime/helpers/esm/defineProperty';
3
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
4
+ import '@babel/runtime/helpers/esm/initializerWarningHelper';
5
+ import Component from '@glimmer/component';
6
+ import { action } from '@ember/object';
7
+ import { tracked } from '@glimmer/tracking';
8
+ import { concat } from '@ember/helper';
9
+ import { on } from '@ember/modifier';
10
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
11
+ import FormField from './form-field.js';
12
+ import { precompileTemplate } from '@ember/template-compilation';
13
+ import { setComponentTemplate } from '@ember/component';
14
+
15
+ var _class, _descriptor, _class3;
16
+ let FormInputBase = (_class = class FormInputBase extends Component {
17
+ constructor(...args) {
18
+ super(...args);
19
+ _initializerDefineProperty(this, "shouldShowErrorFeedback", _descriptor, this);
20
+ }
21
+ get showErrorFeedback() {
22
+ if (this.args.hasError === false) {
23
+ return false;
24
+ }
25
+ if ((this.args.showError || this.args.hasSubmitted || this.shouldShowErrorFeedback) && this.args.errors && this.args.errors.length > 0) {
26
+ return true;
27
+ } else {
28
+ return false;
29
+ }
30
+ }
31
+ handleFocusIn(event1) {
32
+ this.shouldShowErrorFeedback = false;
33
+ if (typeof this.args.onFocusIn === 'function') {
34
+ this.args.onFocusIn(event1);
35
+ }
36
+ }
37
+ handleFocusOut(event1) {
38
+ this.shouldShowErrorFeedback = true;
39
+ if (typeof this.args.onFocusOut === 'function') {
40
+ this.args.onFocusOut(event1);
41
+ }
42
+ }
43
+ }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "shouldShowErrorFeedback", [tracked], {
44
+ configurable: true,
45
+ enumerable: true,
46
+ writable: true,
47
+ initializer: function () {
48
+ return false;
49
+ }
50
+ }), _applyDecoratedDescriptor(_class.prototype, "handleFocusIn", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleFocusIn"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleFocusOut", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleFocusOut"), _class.prototype)), _class);
51
+ class FormInput extends FormInputBase {}
52
+ _class3 = FormInput;
53
+ setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{useFrontileClass \"form-input\" @size class=@containerClass}} as |f|>\n {{#if @label}}\n <f.Label class={{useFrontileClass \"form-input\" @size part=\"label\"}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-input\" @size part=\"hint\"}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n\n <f.Input {{on \"focus\" this.handleFocusIn}} {{on \"blur\" this.handleFocusOut}} @onInput={{@onInput}} @onChange={{@onChange}} @value={{@value}} @type={{@type}} class={{useFrontileClass \"form-input\" @size part=\"input\"}} aria-invalid={{if this.showErrorFeedback \"true\"}} aria-describedby=\"{{if @hint f.hintId}}{{if this.showErrorFeedback (concat \" \" f.feedbackId)}}\" ...attributes />\n\n {{yield}}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback class={{useFrontileClass \"form-input\" @size part=\"feedback\"}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n ", {
54
+ scope: () => ({
55
+ FormField,
56
+ useFrontileClass,
57
+ concat,
58
+ on
59
+ }),
60
+ strictMode: true
61
+ }), _class3);
62
+
63
+ export { FormInputBase, FormInput as default };
64
+ //# sourceMappingURL=form-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-input.js","sources":["../../src/components/form-input.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\nimport { concat } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport FormField from './form-field';\nexport interface FormInputArgs {\n /**\n * The value to be used in the input.\n * You must also pass `onChange` or `onInput` to update its value.\n */ value: string | undefined;\n /**\n * The input type\n * @defaultValue 'text'\n */ type?: string;\n /** The group label */ label?: string;\n /** A help text to be displayed */ hint?: string;\n /** If the form has been submitted, used to force displaying errors */ hasSubmitted?: boolean;\n /** If has errors */ hasError?: boolean;\n /** Force displaying errors */ showError?: boolean;\n /** A list of errors or a single text describing the error */ errors?: string[] | string;\n /** CSS classes to be added in the container element */ containerClass?: string;\n /** The size */ size?: 'sm' | 'lg';\n /** Callback when oninput is triggered */ onInput?: (value: string, event: InputEvent) => void;\n /** Callback when onchange is triggered */ onChange?: (value: string, event: InputEvent) => void;\n /** Callback when onfocus is triggered */ onFocusIn?: (event: FocusEvent) => void;\n /** Callback when onblur is triggered */ onFocusOut?: (event: FocusEvent) => void;\n}\nexport interface FormInputBaseSignature {\n Args: FormInputArgs;\n}\nexport interface FormInputSignature extends FormInputBaseSignature {\n Element: HTMLInputElement;\n Blocks: {\n default: [];\n };\n}\nexport class FormInputBase<T extends FormInputBaseSignature> extends Component<T> {\n @tracked\n shouldShowErrorFeedback = false;\n get showErrorFeedback(): boolean {\n if (this.args.hasError === false) {\n return false;\n }\n if ((this.args.showError || this.args.hasSubmitted || this.shouldShowErrorFeedback) && this.args.errors && this.args.errors.length > 0) {\n return true;\n } else {\n return false;\n }\n }\n @action\n handleFocusIn(event1: FocusEvent): void {\n this.shouldShowErrorFeedback = false;\n if (typeof this.args.onFocusIn === 'function') {\n this.args.onFocusIn(event1);\n }\n }\n @action\n handleFocusOut(event1: FocusEvent): void {\n this.shouldShowErrorFeedback = true;\n if (typeof this.args.onFocusOut === 'function') {\n this.args.onFocusOut(event1);\n }\n }\n}\nexport default class FormInput extends FormInputBase<FormInputSignature> {\n static{\n template(`\n <FormField\n @size={{@size}}\n class={{useFrontileClass \"form-input\" @size class=@containerClass}}\n as |f|\n >\n {{#if @label}}\n <f.Label class={{useFrontileClass \"form-input\" @size part=\"label\"}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-input\" @size part=\"hint\"}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n\n <f.Input\n {{on \"focus\" this.handleFocusIn}}\n {{on \"blur\" this.handleFocusOut}}\n @onInput={{@onInput}}\n @onChange={{@onChange}}\n @value={{@value}}\n @type={{@type}}\n class={{useFrontileClass \"form-input\" @size part=\"input\"}}\n aria-invalid={{if this.showErrorFeedback \"true\"}}\n aria-describedby=\"{{if @hint f.hintId}}{{if\n this.showErrorFeedback\n (concat \" \" f.feedbackId)\n }}\"\n ...attributes\n />\n\n {{yield}}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback\n class={{useFrontileClass \"form-input\" @size part=\"feedback\"}}\n @errors={{@errors}}\n />\n {{/if}}\n </FormField>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormInputBase","_class","Component","constructor","args","_initializerDefineProperty","_descriptor","showErrorFeedback","hasError","showError","hasSubmitted","shouldShowErrorFeedback","errors","length","handleFocusIn","event1","onFocusIn","handleFocusOut","onFocusOut","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor","FormInput","_class3","setComponentTemplate","precompileTemplate","scope","FormField","useFrontileClass","concat","on","strictMode"],"mappings":";;;;;;;;;;;;;;;AAuCaA,IAAAA,aAAa,IAAAC,MAAA,GAAnB,MAAMD,aAAa,SAA2CE,SAAS,CAAI;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,kCAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAG9E,IAAIC,iBAAiBA,GAAY;AAC7B,IAAA,IAAI,IAAI,CAACH,IAAI,CAACI,QAAQ,KAAK,KAAK,EAAE;AAC9B,MAAA,OAAO,KAAK,CAAA;AAChB,KAAA;AACA,IAAA,IAAI,CAAC,IAAI,CAACJ,IAAI,CAACK,SAAS,IAAI,IAAI,CAACL,IAAI,CAACM,YAAY,IAAI,IAAI,CAACC,uBAAuB,KAAK,IAAI,CAACP,IAAI,CAACQ,MAAM,IAAI,IAAI,CAACR,IAAI,CAACQ,MAAM,CAACC,MAAM,GAAG,CAAC,EAAE;AACpI,MAAA,OAAO,IAAI,CAAA;AACf,KAAC,MAAM;AACH,MAAA,OAAO,KAAK,CAAA;AAChB,KAAA;AACJ,GAAA;EAEAC,aAAaA,CAACC,MAAkB,EAAQ;IACpC,IAAI,CAACJ,uBAAuB,GAAG,KAAK,CAAA;IACpC,IAAI,OAAO,IAAI,CAACP,IAAI,CAACY,SAAS,KAAK,UAAU,EAAE;AAC3C,MAAA,IAAI,CAACZ,IAAI,CAACY,SAAS,CAACD,MAAM,CAAC,CAAA;AAC/B,KAAA;AACJ,GAAA;EAEAE,cAAcA,CAACF,MAAkB,EAAQ;IACrC,IAAI,CAACJ,uBAAuB,GAAG,IAAI,CAAA;IACnC,IAAI,OAAO,IAAI,CAACP,IAAI,CAACc,UAAU,KAAK,UAAU,EAAE;AAC5C,MAAA,IAAI,CAACd,IAAI,CAACc,UAAU,CAACH,MAAM,CAAC,CAAA;AAChC,KAAA;AACJ,GAAA;AACJ,CAAC,GAAAT,WAAA,GAAAa,yBAAA,CAAAlB,MAAA,CAAAmB,SAAA,EAAA,yBAAA,EAAA,CA1BIC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OACkB,KAAK,CAAA;AAAA,GAAA;AAAA,CAAA,CAAA,EAAAN,yBAAA,CAAAlB,MAAA,CAAAmB,SAAA,EAAA,eAAA,EAAA,CAW9BM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAA3B,MAAA,CAAAmB,SAAA,EAAAnB,eAAAA,CAAAA,EAAAA,MAAA,CAAAmB,SAAA,CAAA,EAAAD,yBAAA,CAAAlB,MAAA,CAAAmB,SAAA,qBAONM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAA3B,MAAA,CAAAmB,SAAA,EAAA,gBAAA,CAAA,EAAAnB,MAAA,CAAAmB,SAAA,IAAAnB,MAAA,EAAA;AAQI,MAAM4B,SAAS,SAAS7B,aAAa,CAAqB,EAAA;AAoDxE8B,OAAA,GApDoBD,SAAS,CAAA;AAEtBE,oBAAA,CAAAC,kBAAA,CA2CH,+gCAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;IAAAC,gBAAA;IAAAC,MAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAR,OAAA,CAAA;;;;"}
@@ -0,0 +1,55 @@
1
+ import _initializerDefineProperty from '@babel/runtime/helpers/esm/initializerDefineProperty';
2
+ import '@babel/runtime/helpers/esm/defineProperty';
3
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
4
+ import '@babel/runtime/helpers/esm/initializerWarningHelper';
5
+ import Component from '@glimmer/component';
6
+ import { action } from '@ember/object';
7
+ import { tracked } from '@glimmer/tracking';
8
+ import { concat } from '@ember/helper';
9
+ import FormRadio from './form-radio.js';
10
+ import FormField from './form-field.js';
11
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
12
+ import { precompileTemplate } from '@ember/template-compilation';
13
+ import { setComponentTemplate } from '@ember/component';
14
+
15
+ var _class, _descriptor, _class2;
16
+ let FormRadioGroup = (_class = (_class2 = class FormRadioGroup extends Component {
17
+ constructor(...args) {
18
+ super(...args);
19
+ _initializerDefineProperty(this, "shouldShowErrorFeedback", _descriptor, this);
20
+ }
21
+ get showErrorFeedback() {
22
+ if (this.args.hasError === false) {
23
+ return false;
24
+ }
25
+ if ((this.args.showError || this.args.hasSubmitted || this.shouldShowErrorFeedback) && this.args.errors && this.args.errors.length > 0) {
26
+ return true;
27
+ } else {
28
+ return false;
29
+ }
30
+ }
31
+ handleChange(value1, event1) {
32
+ this.shouldShowErrorFeedback = true;
33
+ if (typeof this.args.onChange === 'function') {
34
+ this.args.onChange(value1, event1);
35
+ }
36
+ }
37
+ }, setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{useFrontileClass \"form-radio-group\" @size (if @isInline \"inline\") class=@containerClass}} role=\"radiogroup\" ...attributes as |f|>\n {{#if @label}}\n <f.Label class={{useFrontileClass \"form-radio-group\" @size (if @isInline \"inline\") part=\"label\"}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-radio-group\" @size (if @isInline \"inline\") part=\"hint\"}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n\n {{yield (component FormRadio checked=@value privateContainerClass=(useFrontileClass \"form-radio-group\" @size (if @isInline \"inline\") part=\"form-radio\") _parentOnChange=this.handleChange size=@size name=(concat f.id \"-radio-group\"))}}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback class={{useFrontileClass \"form-radio-group\" @size (if @isInline \"inline\") part=\"feedback\"}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n ", {
38
+ scope: () => ({
39
+ FormField,
40
+ useFrontileClass,
41
+ FormRadio,
42
+ concat
43
+ }),
44
+ strictMode: true
45
+ }), _class2), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "shouldShowErrorFeedback", [tracked], {
46
+ configurable: true,
47
+ enumerable: true,
48
+ writable: true,
49
+ initializer: function () {
50
+ return false;
51
+ }
52
+ }), _applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
53
+
54
+ export { FormRadioGroup as default };
55
+ //# sourceMappingURL=form-radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-radio-group.js","sources":["../../src/components/form-radio-group.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\nimport { concat } from '@ember/helper';\nimport FormRadio from './form-radio';\nimport FormField from './form-field';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport type { WithBoundArgs } from '@glint/template';\nexport interface FormRadioGroupArgs {\n value: string | number | boolean | undefined;\n /** The group label */ label?: string;\n /** A help text to be displayed */ hint?: string;\n /** If the form has been submitted, used to force displaying errors */ hasSubmitted?: boolean;\n /** If has errors */ hasError?: boolean;\n /** Force displaying errors */ showError?: boolean;\n /** A list of errors or a single text describing the error */ errors?: string[] | string;\n /** CSS classes to be added in the container element */ containerClass?: string;\n /** The size */ size?: 'sm' | 'lg';\n /** If the Checkbox should be in one line */ isInline?: boolean;\n /** Default callback added to the yielded FormRadio component, called when onchange is triggered */ onChange?: (value: unknown, event: Event) => void;\n}\nexport interface FormRadioGroupSignature {\n Args: FormRadioGroupArgs;\n Blocks: {\n default: [radio: WithBoundArgs<typeof FormRadio, 'checked'> & WithBoundArgs<typeof FormRadio, 'privateContainerClass'> & WithBoundArgs<typeof FormRadio, '_parentOnChange'> & WithBoundArgs<typeof FormRadio, 'size'> & WithBoundArgs<typeof FormRadio, 'name'>];\n };\n Element: HTMLDivElement;\n}\nexport default class FormRadioGroup extends Component<FormRadioGroupSignature> {\n @tracked\n shouldShowErrorFeedback = false;\n get showErrorFeedback(): boolean {\n if (this.args.hasError === false) {\n return false;\n }\n if ((this.args.showError || this.args.hasSubmitted || this.shouldShowErrorFeedback) && this.args.errors && this.args.errors.length > 0) {\n return true;\n } else {\n return false;\n }\n }\n @action\n handleChange(value1: unknown, event1: Event): void {\n this.shouldShowErrorFeedback = true;\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value1, event1);\n }\n }\n static{\n template(`\n <FormField\n @size={{@size}}\n class={{useFrontileClass\n \"form-radio-group\"\n @size\n (if @isInline \"inline\")\n class=@containerClass\n }}\n role=\"radiogroup\"\n ...attributes\n as |f|\n >\n {{#if @label}}\n <f.Label\n class={{useFrontileClass\n \"form-radio-group\"\n @size\n (if @isInline \"inline\")\n part=\"label\"\n }}\n >\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint\n class={{useFrontileClass\n \"form-radio-group\"\n @size\n (if @isInline \"inline\")\n part=\"hint\"\n }}\n >\n {{@hint}}\n </f.Hint>\n {{/if}}\n\n {{yield\n (component\n FormRadio\n checked=@value\n privateContainerClass=(useFrontileClass\n \"form-radio-group\" @size (if @isInline \"inline\") part=\"form-radio\"\n )\n _parentOnChange=this.handleChange\n size=@size\n name=(concat f.id \"-radio-group\")\n )\n }}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback\n class={{useFrontileClass\n \"form-radio-group\"\n @size\n (if @isInline \"inline\")\n part=\"feedback\"\n }}\n @errors={{@errors}}\n />\n {{/if}}\n </FormField>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormRadioGroup","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","showErrorFeedback","hasError","showError","hasSubmitted","shouldShowErrorFeedback","errors","length","handleChange","value1","event1","onChange","setComponentTemplate","precompileTemplate","scope","FormField","useFrontileClass","FormRadio","concat","strictMode","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;AA6BqBA,IAAAA,cAAc,IAAAC,MAAA,IAAAC,OAAA,GAApB,MAAMF,cAAc,SAASG,SAAS,CAA0B;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,kCAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAG3E,IAAIC,iBAAiBA,GAAY;AAC7B,IAAA,IAAI,IAAI,CAACH,IAAI,CAACI,QAAQ,KAAK,KAAK,EAAE;AAC9B,MAAA,OAAO,KAAK,CAAA;AAChB,KAAA;AACA,IAAA,IAAI,CAAC,IAAI,CAACJ,IAAI,CAACK,SAAS,IAAI,IAAI,CAACL,IAAI,CAACM,YAAY,IAAI,IAAI,CAACC,uBAAuB,KAAK,IAAI,CAACP,IAAI,CAACQ,MAAM,IAAI,IAAI,CAACR,IAAI,CAACQ,MAAM,CAACC,MAAM,GAAG,CAAC,EAAE;AACpI,MAAA,OAAO,IAAI,CAAA;AACf,KAAC,MAAM;AACH,MAAA,OAAO,KAAK,CAAA;AAChB,KAAA;AACJ,GAAA;AAEAC,EAAAA,YAAYA,CAACC,MAAe,EAAEC,MAAa,EAAQ;IAC/C,IAAI,CAACL,uBAAuB,GAAG,IAAI,CAAA;IACnC,IAAI,OAAO,IAAI,CAACP,IAAI,CAACa,QAAQ,KAAK,UAAU,EAAE;MAC1C,IAAI,CAACb,IAAI,CAACa,QAAQ,CAACF,MAAM,EAAEC,MAAM,CAAC,CAAA;AACtC,KAAA;AACJ,GAAA;AAyEJ,CAAC,EAAAE,oBAAA,CAvEOC,kBAAA,CAgEH,ugCAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;IAAAC,gBAAA;IAAAC,SAAA;AAAAC,IAAAA,MAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAxB,OAAA,CAAA,EAAAA,OAAA,CAAAK,GAAAA,WAAA,GAAAoB,yBAAA,CAAA1B,MAAA,CAAA2B,SAAA,8BAzFLC,OAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;AAAAC,EAAAA,WAAA,cAAA;AAAA,IAAA,OACkB,KAAK,CAAA;AAAA,GAAA;AAAA,CAAAN,CAAAA,EAAAA,yBAAA,CAAA1B,MAAA,CAAA2B,SAAA,EAW9BM,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAnC,MAAA,CAAA2B,SAAA,EAAA,cAAA,CAAA,EAAA3B,MAAA,CAAA2B,SAAA,IAAA3B,MAAA;;;;"}
@@ -0,0 +1,34 @@
1
+ import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
+ import Component from '@glimmer/component';
3
+ import { action } from '@ember/object';
4
+ import { array } from '@ember/helper';
5
+ import FormField from './form-field.js';
6
+ import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
7
+ import { precompileTemplate } from '@ember/template-compilation';
8
+ import { setComponentTemplate } from '@ember/component';
9
+
10
+ var _class, _class2;
11
+ let FormRadio = (_class = (_class2 = class FormRadio extends Component {
12
+ handleChange(value1, event1) {
13
+ event1.preventDefault();
14
+ if (typeof this.args.onChange === 'function') {
15
+ this.args.onChange(value1, event1);
16
+ }
17
+ if (typeof this.args._parentOnChange === 'function') {
18
+ this.args._parentOnChange(value1, event1);
19
+ }
20
+ }
21
+ get isChecked() {
22
+ return this.args.checked == this.args.value;
23
+ }
24
+ }, setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{useFrontileClass \"form-radio\" @size (if this.isChecked \"checked\") class=(array @containerClass @privateContainerClass)}} as |f|>\n <div class={{useFrontileClass \"form-radio\" @size part=\"label-container\"}}>\n <div class={{useFrontileClass \"form-radio\" @size part=\"input-container\"}}>\n {{!-- Zero-width space character, used to align checkbox properly --}}\n {{!-- eslint-disable no-irregular-whitespace--}}\n \u200B\n <f.Radio @onChange={{this.handleChange}} @value={{@value}} @checked={{@checked}} @name={{@name}} class={{useFrontileClass \"form-radio\" @size part=\"radio\"}} aria-describedby={{if @hint f.hintId}} ...attributes />\n </div>\n\n <f.Label class={{useFrontileClass \"form-radio\" @size part=\"label\"}}>\n {{#if (has-block)}}\n {{yield}}\n {{else}}\n {{@label}}\n {{/if}}\n </f.Label>\n </div>\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-radio\" @size part=\"hint\"}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n </FormField>\n ", {
25
+ scope: () => ({
26
+ FormField,
27
+ useFrontileClass,
28
+ array
29
+ }),
30
+ strictMode: true
31
+ }), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
32
+
33
+ export { FormRadio as default };
34
+ //# sourceMappingURL=form-radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-radio.js","sources":["../../src/components/form-radio.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { array } from '@ember/helper';\nimport FormField from './form-field';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nexport interface FormRadioArgs {\n /** The input field label */ label?: string;\n /** A help text to be displayed */ hint?: string;\n /**\n * The value to be used in the radio button.\n * You must also pass `onChange` to update its value.\n */ value: string | number | boolean | undefined;\n /**\n * The current checked value.\n * This will be used to compare against the `value` argument,\n * if equal, the radio will me marked as checked.\n */ checked: unknown;\n /** The name of the checkbox */ name?: string;\n /** CSS classes to be added in the container element */ containerClass?: string;\n /** The size */ size?: 'sm' | 'lg';\n /** Callback when onchange is triggered */ onChange: (value: unknown, event: Event) => void;\n /**\n * Internal function for InputRadioGroup\n * @ignore\n **/ _parentOnChange?: (value: unknown, event: Event) => void;\n /** CSS classes to be added in the container element, in be used in for group\n * @ignore*/ privateContainerClass?: string;\n}\nexport interface FormRadioSignature {\n Args: FormRadioArgs;\n Element: HTMLInputElement;\n Blocks: {\n default: [];\n };\n}\nexport default class FormRadio extends Component<FormRadioSignature> {\n @action\n handleChange(value1: unknown, event1: Event): void {\n event1.preventDefault();\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value1, event1);\n }\n if (typeof this.args._parentOnChange === 'function') {\n this.args._parentOnChange(value1, event1);\n }\n }\n get isChecked(): boolean {\n return this.args.checked == this.args.value;\n }\n static{\n template(`\n <FormField\n @size={{@size}}\n class={{useFrontileClass\n \"form-radio\"\n @size\n (if this.isChecked \"checked\")\n class=(array @containerClass @privateContainerClass)\n }}\n as |f|\n >\n <div class={{useFrontileClass \"form-radio\" @size part=\"label-container\"}}>\n <div\n class={{useFrontileClass \"form-radio\" @size part=\"input-container\"}}\n >\n {{! Zero-width space character, used to align checkbox properly }}\n {{! eslint-disable no-irregular-whitespace}}\n ​\n <f.Radio\n @onChange={{this.handleChange}}\n @value={{@value}}\n @checked={{@checked}}\n @name={{@name}}\n class={{useFrontileClass \"form-radio\" @size part=\"radio\"}}\n aria-describedby={{if @hint f.hintId}}\n ...attributes\n />\n </div>\n\n <f.Label class={{useFrontileClass \"form-radio\" @size part=\"label\"}}>\n {{#if (has-block)}}\n {{yield}}\n {{else}}\n {{@label}}\n {{/if}}\n </f.Label>\n </div>\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-radio\" @size part=\"hint\"}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n </FormField>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormRadio","_class","_class2","Component","handleChange","value1","event1","preventDefault","args","onChange","_parentOnChange","isChecked","checked","value","setComponentTemplate","precompileTemplate","scope","FormField","useFrontileClass","array","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;AAoCqBA,IAAAA,SAAS,IAAAC,MAAA,IAAAC,OAAA,GAAf,MAAMF,SAAS,SAASG,SAAS,CAAqB;AAEjEC,EAAAA,YAAYA,CAACC,MAAe,EAAEC,MAAa,EAAQ;IAC/CA,MAAM,CAACC,cAAc,EAAE,CAAA;IACvB,IAAI,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,KAAK,UAAU,EAAE;MAC1C,IAAI,CAACD,IAAI,CAACC,QAAQ,CAACJ,MAAM,EAAEC,MAAM,CAAC,CAAA;AACtC,KAAA;IACA,IAAI,OAAO,IAAI,CAACE,IAAI,CAACE,eAAe,KAAK,UAAU,EAAE;MACjD,IAAI,CAACF,IAAI,CAACE,eAAe,CAACL,MAAM,EAAEC,MAAM,CAAC,CAAA;AAC7C,KAAA;AACJ,GAAA;EACA,IAAIK,SAASA,GAAY;IACrB,OAAO,IAAI,CAACH,IAAI,CAACI,OAAO,IAAI,IAAI,CAACJ,IAAI,CAACK,KAAK,CAAA;AAC/C,GAAA;AAqDJ,CAAC,EAAAC,oBAAA,CAnDOC,kBAAA,CA4CH,gpCAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;IAAAC,gBAAA;AAAAC,IAAAA,KAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAlB,OAAA,CAAAA,EAAAA,OAAA,CAAAmB,GAAAA,yBAAA,CAAApB,MAAA,CAAAqB,SAAA,EA/DLC,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAxB,MAAA,CAAAqB,SAAA,EAAA,cAAA,CAAA,EAAArB,MAAA,CAAAqB,SAAA,CAAA,GAAArB,MAAA;;;;"}