@frontile/forms-legacy 0.17.0-beta.2 → 0.17.0-beta.20
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.
- package/declarations/components/form-checkbox-group.d.ts +0 -1
- package/declarations/components/form-checkbox.d.ts +0 -1
- package/declarations/components/form-field/checkbox.d.ts +0 -1
- package/declarations/components/form-field/feedback.d.ts +0 -1
- package/declarations/components/form-field/hint.d.ts +0 -1
- package/declarations/components/form-field/input.d.ts +0 -1
- package/declarations/components/form-field/label.d.ts +0 -1
- package/declarations/components/form-field/radio.d.ts +0 -1
- package/declarations/components/form-field/textarea.d.ts +0 -1
- package/declarations/components/form-field.d.ts +0 -1
- package/declarations/components/form-input.d.ts +0 -1
- package/declarations/components/form-radio-group.d.ts +0 -1
- package/declarations/components/form-radio.d.ts +0 -1
- package/declarations/components/form-select.d.ts +2 -2
- package/declarations/components/form-textarea.d.ts +0 -1
- package/declarations/index.d.ts +0 -1
- package/declarations/template-registry.d.ts +0 -1
- package/dist/components/form-checkbox-group.js +20 -23
- package/dist/components/form-checkbox-group.js.map +1 -1
- package/dist/components/form-checkbox.js +14 -9
- package/dist/components/form-checkbox.js.map +1 -1
- package/dist/components/form-field/checkbox.js +14 -9
- package/dist/components/form-field/checkbox.js.map +1 -1
- package/dist/components/form-field/feedback.js +5 -5
- package/dist/components/form-field/feedback.js.map +1 -1
- package/dist/components/form-field/hint.js +5 -5
- package/dist/components/form-field/hint.js.map +1 -1
- package/dist/components/form-field/input.js +17 -9
- package/dist/components/form-field/input.js.map +1 -1
- package/dist/components/form-field/label.js +5 -5
- package/dist/components/form-field/label.js.map +1 -1
- package/dist/components/form-field/radio.js +14 -9
- package/dist/components/form-field/radio.js.map +1 -1
- package/dist/components/form-field/textarea.js +17 -9
- package/dist/components/form-field/textarea.js.map +1 -1
- package/dist/components/form-field.js +16 -20
- package/dist/components/form-field.js.map +1 -1
- package/dist/components/form-input.js +23 -25
- package/dist/components/form-input.js.map +1 -1
- package/dist/components/form-radio-group.js +20 -23
- package/dist/components/form-radio-group.js.map +1 -1
- package/dist/components/form-radio.js +14 -9
- package/dist/components/form-radio.js.map +1 -1
- package/dist/components/form-select.js +41 -31
- package/dist/components/form-select.js.map +1 -1
- package/dist/components/form-textarea.js +10 -10
- package/dist/components/form-textarea.js.map +1 -1
- package/dist/runtime-BPCpkOf1-B5Lbloj7.js +67 -0
- package/dist/runtime-BPCpkOf1-B5Lbloj7.js.map +1 -0
- package/package.json +47 -50
- package/declarations/components/form-checkbox-group.d.ts.map +0 -1
- package/declarations/components/form-checkbox.d.ts.map +0 -1
- package/declarations/components/form-field/checkbox.d.ts.map +0 -1
- package/declarations/components/form-field/feedback.d.ts.map +0 -1
- package/declarations/components/form-field/hint.d.ts.map +0 -1
- package/declarations/components/form-field/input.d.ts.map +0 -1
- package/declarations/components/form-field/label.d.ts.map +0 -1
- package/declarations/components/form-field/radio.d.ts.map +0 -1
- package/declarations/components/form-field/textarea.d.ts.map +0 -1
- package/declarations/components/form-field.d.ts.map +0 -1
- package/declarations/components/form-input.d.ts.map +0 -1
- package/declarations/components/form-radio-group.d.ts.map +0 -1
- package/declarations/components/form-radio.d.ts.map +0 -1
- package/declarations/components/form-select.d.ts.map +0 -1
- package/declarations/components/form-textarea.d.ts.map +0 -1
- package/declarations/index.d.ts.map +0 -1
- package/declarations/template-registry.d.ts.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
|
|
2
1
|
import Component from '@glimmer/component';
|
|
3
2
|
import { action } from '@ember/object';
|
|
4
3
|
import { on } from '@ember/modifier';
|
|
5
4
|
import { useStyles } from '@frontile/theme';
|
|
6
5
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
6
|
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
import { a as decorateMethodV2 } from '../../runtime-BPCpkOf1-B5Lbloj7.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
let FormFieldRadio = (_class = (_FormFieldRadio = class FormFieldRadio extends Component {
|
|
9
|
+
class FormFieldRadio extends Component {
|
|
11
10
|
get isChecked() {
|
|
12
11
|
return this.args.checked === this.args.value;
|
|
13
12
|
}
|
|
@@ -17,6 +16,9 @@ let FormFieldRadio = (_class = (_FormFieldRadio = class FormFieldRadio extends C
|
|
|
17
16
|
this.args.onChange(this.args.value, event);
|
|
18
17
|
}
|
|
19
18
|
}
|
|
19
|
+
static {
|
|
20
|
+
decorateMethodV2(this.prototype, "handleChange", [action]);
|
|
21
|
+
}
|
|
20
22
|
get classes() {
|
|
21
23
|
const {
|
|
22
24
|
radio
|
|
@@ -27,12 +29,15 @@ let FormFieldRadio = (_class = (_FormFieldRadio = class FormFieldRadio extends C
|
|
|
27
29
|
class: this.args.class
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
})
|
|
32
|
+
static {
|
|
33
|
+
setComponentTemplate(precompileTemplate("\n <input {{on \"change\" this.handleChange}} id={{@id}} name={{@name}} value={{@value}} checked={{this.isChecked}} type=\"radio\" class={{this.classes}} data-test-id=\"form-field-radio\" ...attributes />\n ", {
|
|
34
|
+
strictMode: true,
|
|
35
|
+
scope: () => ({
|
|
36
|
+
on
|
|
37
|
+
})
|
|
38
|
+
}), this);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
36
41
|
|
|
37
42
|
export { FormFieldRadio as default };
|
|
38
43
|
//# sourceMappingURL=radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sources":["../../../src/components/form-field/radio.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { useStyles } from '@frontile/theme';\n\nexport interface FormFieldRadioArgs {\n id?: string;\n value?: string | number | boolean;\n checked?: unknown;\n name?: string;\n size?: 'sm' | 'md' | 'lg';\n class?: string;\n\n // Callback when onchange is triggered\n onChange?: (value: unknown, event: Event) => void;\n}\n\nexport interface FormFieldRadioSignature {\n Args: FormFieldRadioArgs;\n Element: HTMLInputElement;\n}\n\nexport default class FormFieldRadio extends Component<FormFieldRadioSignature> {\n get isChecked(): boolean {\n return this.args.checked === this.args.value;\n }\n\n @action handleChange(event: Event): void {\n event.preventDefault();\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(this.args.value, event);\n }\n }\n\n get classes() {\n const { radio } = useStyles();\n\n return radio({\n size: this.args.size\n }).input({\n class: this.args.class\n });\n }\n\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={{this.classes}}\n data-test-id=\"form-field-radio\"\n ...attributes\n />\n </template>\n}\n"],"names":["FormFieldRadio","Component","isChecked","args","checked","value","handleChange","event","preventDefault","onChange","classes","radio","useStyles","size","input","class","setComponentTemplate","precompileTemplate","strictMode","scope","on"
|
|
1
|
+
{"version":3,"file":"radio.js","sources":["../../../src/components/form-field/radio.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { useStyles } from '@frontile/theme';\n\nexport interface FormFieldRadioArgs {\n id?: string;\n value?: string | number | boolean;\n checked?: unknown;\n name?: string;\n size?: 'sm' | 'md' | 'lg';\n class?: string;\n\n // Callback when onchange is triggered\n onChange?: (value: unknown, event: Event) => void;\n}\n\nexport interface FormFieldRadioSignature {\n Args: FormFieldRadioArgs;\n Element: HTMLInputElement;\n}\n\nexport default class FormFieldRadio extends Component<FormFieldRadioSignature> {\n get isChecked(): boolean {\n return this.args.checked === this.args.value;\n }\n\n @action handleChange(event: Event): void {\n event.preventDefault();\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(this.args.value, event);\n }\n }\n\n get classes() {\n const { radio } = useStyles();\n\n return radio({\n size: this.args.size\n }).input({\n class: this.args.class\n });\n }\n\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={{this.classes}}\n data-test-id=\"form-field-radio\"\n ...attributes\n />\n </template>\n}\n"],"names":["FormFieldRadio","Component","isChecked","args","checked","value","handleChange","event","preventDefault","onChange","n","prototype","action","classes","radio","useStyles","size","input","class","setComponentTemplate","precompileTemplate","strictMode","scope","on"],"mappings":";;;;;;;;AAsBe,MAAMA,uBAAuBC,SAAA,CAAU;EACpD,IAAIC,SAAAA,GAAqB;IACvB,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK;AAC9C,EAAA;EAEQC,YAAAA,CAAaC,KAAY,EAAQ;IACvCA,KAAA,CAAMC,cAAc,EAAA;IAEpB,IAAI,OAAO,IAAI,CAACL,IAAI,CAACM,QAAQ,KAAK,UAAA,EAAY;AAC5C,MAAA,IAAI,CAACN,IAAI,CAACM,QAAQ,CAAC,IAAI,CAACN,IAAI,CAACE,KAAK,EAAEE,KAAA,CAAA;AACtC,IAAA;AACF,EAAA;AAAA,EAAA;IAAAG,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CANCC,MAAA,CAAA,CAAA;AAAA;EAQD,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAElB,IAAA,OAAOD,KAAA,CAAM;AACXE,MAAAA,IAAA,EAAM,IAAI,CAACb,IAAI,CAACa;KAClB,CAAA,CAAGC,KAAK,CAAC;AACPC,MAAAA,KAAA,EAAO,IAAI,CAACf,IAAI,CAACe;AACnB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,qNAAA,EAYA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
|
|
2
1
|
import Component from '@glimmer/component';
|
|
3
2
|
import { action } from '@ember/object';
|
|
4
3
|
import { on } from '@ember/modifier';
|
|
5
4
|
import { useStyles } from '@frontile/theme';
|
|
6
5
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
6
|
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
import { a as decorateMethodV2 } from '../../runtime-BPCpkOf1-B5Lbloj7.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
let FormFieldTextarea = (_class = (_FormFieldTextarea = class FormFieldTextarea extends Component {
|
|
9
|
+
class FormFieldTextarea extends Component {
|
|
11
10
|
handleOnInput(event) {
|
|
12
11
|
if (typeof this.args.onInput === 'function') {
|
|
13
12
|
this.args.onInput(event.target.value, event);
|
|
14
13
|
}
|
|
15
14
|
}
|
|
15
|
+
static {
|
|
16
|
+
decorateMethodV2(this.prototype, "handleOnInput", [action]);
|
|
17
|
+
}
|
|
16
18
|
handleOnChange(event) {
|
|
17
19
|
if (typeof this.args.onChange === 'function') {
|
|
18
20
|
this.args.onChange(event.target.value, event);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
23
|
+
static {
|
|
24
|
+
decorateMethodV2(this.prototype, "handleOnChange", [action]);
|
|
25
|
+
}
|
|
21
26
|
get classes() {
|
|
22
27
|
const {
|
|
23
28
|
textarea
|
|
@@ -28,12 +33,15 @@ let FormFieldTextarea = (_class = (_FormFieldTextarea = class FormFieldTextarea
|
|
|
28
33
|
class: this.args.class
|
|
29
34
|
});
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
36
|
+
static {
|
|
37
|
+
setComponentTemplate(precompileTemplate("\n <textarea {{on \"input\" this.handleOnInput}} {{on \"change\" this.handleOnChange}} id={{@id}} value={{@value}} class={{this.classes}} data-test-id=\"form-field-textarea\" ...attributes>\n </textarea>\n ", {
|
|
38
|
+
strictMode: true,
|
|
39
|
+
scope: () => ({
|
|
40
|
+
on
|
|
41
|
+
})
|
|
42
|
+
}), this);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
37
45
|
|
|
38
46
|
export { FormFieldTextarea as default };
|
|
39
47
|
//# sourceMappingURL=textarea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","sources":["../../../src/components/form-field/textarea.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { useStyles } from '@frontile/theme';\n\nexport interface FormFieldTextareaArgs {\n id?: string;\n value?: string | number | boolean;\n size?: 'sm' | 'md' | 'lg';\n class?: string;\n\n // Callback when oninput is triggered\n onInput?: (value: string, event: InputEvent) => void;\n\n // Callback when onchange is triggered\n onChange?: (value: string, event: InputEvent) => void;\n}\n\nexport interface FormFieldTextareaSignature {\n Args: FormFieldTextareaArgs;\n Element: HTMLTextAreaElement;\n}\n\nexport default class FormFieldTextarea extends Component<FormFieldTextareaSignature> {\n @action handleOnInput(event: Event): void {\n if (typeof this.args.onInput === 'function') {\n this.args.onInput(\n (event.target as HTMLInputElement).value,\n event as InputEvent\n );\n }\n }\n\n @action handleOnChange(event: Event): void {\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(\n (event.target as HTMLInputElement).value,\n event as InputEvent\n );\n }\n }\n\n get classes() {\n const { textarea } = useStyles();\n\n return textarea({\n size: this.args.size\n }).input({\n class: this.args.class\n });\n }\n\n <template>\n <textarea\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n id={{@id}}\n value={{@value}}\n class={{this.classes}}\n data-test-id=\"form-field-textarea\"\n ...attributes\n >\n </textarea>\n </template>\n}\n"],"names":["FormFieldTextarea","Component","handleOnInput","event","args","onInput","target","value","handleOnChange","onChange","classes","textarea","useStyles","size","input","class","setComponentTemplate","precompileTemplate","strictMode","scope","on"
|
|
1
|
+
{"version":3,"file":"textarea.js","sources":["../../../src/components/form-field/textarea.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { useStyles } from '@frontile/theme';\n\nexport interface FormFieldTextareaArgs {\n id?: string;\n value?: string | number | boolean;\n size?: 'sm' | 'md' | 'lg';\n class?: string;\n\n // Callback when oninput is triggered\n onInput?: (value: string, event: InputEvent) => void;\n\n // Callback when onchange is triggered\n onChange?: (value: string, event: InputEvent) => void;\n}\n\nexport interface FormFieldTextareaSignature {\n Args: FormFieldTextareaArgs;\n Element: HTMLTextAreaElement;\n}\n\nexport default class FormFieldTextarea extends Component<FormFieldTextareaSignature> {\n @action handleOnInput(event: Event): void {\n if (typeof this.args.onInput === 'function') {\n this.args.onInput(\n (event.target as HTMLInputElement).value,\n event as InputEvent\n );\n }\n }\n\n @action handleOnChange(event: Event): void {\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(\n (event.target as HTMLInputElement).value,\n event as InputEvent\n );\n }\n }\n\n get classes() {\n const { textarea } = useStyles();\n\n return textarea({\n size: this.args.size\n }).input({\n class: this.args.class\n });\n }\n\n <template>\n <textarea\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n id={{@id}}\n value={{@value}}\n class={{this.classes}}\n data-test-id=\"form-field-textarea\"\n ...attributes\n >\n </textarea>\n </template>\n}\n"],"names":["FormFieldTextarea","Component","handleOnInput","event","args","onInput","target","value","n","prototype","action","handleOnChange","onChange","classes","textarea","useStyles","size","input","class","setComponentTemplate","precompileTemplate","strictMode","scope","on"],"mappings":";;;;;;;;AAuBe,MAAMA,0BAA0BC,SAAA,CAAU;EAC/CC,aAAAA,CAAcC,KAAY,EAAQ;IACxC,IAAI,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,KAAK,UAAA,EAAY;AAC3C,MAAA,IAAI,CAACD,IAAI,CAACC,OAAO,CACdF,KAAA,CAAMG,MAAM,CAAsBC,KAAK,EACxCJ,KAAS,CAAA;AAEb,IAAA;AACF,EAAA;AAAA,EAAA;IAAAK,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CAPCC,MAAA,CAAA,CAAA;AAAA;EASOC,cAAAA,CAAeR,KAAY,EAAQ;IACzC,IAAI,OAAO,IAAI,CAACC,IAAI,CAACQ,QAAQ,KAAK,UAAA,EAAY;AAC5C,MAAA,IAAI,CAACR,IAAI,CAACQ,QAAQ,CACfT,KAAA,CAAMG,MAAM,CAAsBC,KAAK,EACxCJ,KAAS,CAAA;AAEb,IAAA;AACF,EAAA;AAAA,EAAA;IAAAK,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,gBAAA,EAAA,CAPCC,MAAA,CAAA,CAAA;AAAA;EASD,IAAIG,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAU,GAAGC,SAAA,EAAA;AAErB,IAAA,OAAOD,QAAA,CAAS;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACZ,IAAI,CAACY;KAClB,CAAA,CAAGC,KAAK,CAAC;AACPC,MAAAA,KAAA,EAAO,IAAI,CAACd,IAAI,CAACc;AACnB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,uNAAA,EAWA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
1
|
import Component from '@glimmer/component';
|
|
3
2
|
import { guidFor } from '@ember/object/internals';
|
|
4
3
|
import { hash } from '@ember/helper';
|
|
@@ -12,33 +11,30 @@ import FormFieldTextarea from './form-field/textarea.js';
|
|
|
12
11
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
12
|
import { setComponentTemplate } from '@ember/component';
|
|
14
13
|
|
|
15
|
-
var _FormField;
|
|
16
14
|
class FormField extends Component {
|
|
17
|
-
|
|
18
|
-
super(...args);
|
|
19
|
-
_defineProperty(this, "id", guidFor(this));
|
|
20
|
-
}
|
|
15
|
+
id = guidFor(this);
|
|
21
16
|
get hintId() {
|
|
22
17
|
return this.id + '-hint';
|
|
23
18
|
}
|
|
24
19
|
get feedbackId() {
|
|
25
20
|
return this.id + '-feedback';
|
|
26
21
|
}
|
|
22
|
+
static {
|
|
23
|
+
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 ", {
|
|
24
|
+
strictMode: true,
|
|
25
|
+
scope: () => ({
|
|
26
|
+
hash,
|
|
27
|
+
FormFieldLabel,
|
|
28
|
+
FormFieldHint,
|
|
29
|
+
FormFieldFeedback,
|
|
30
|
+
FormFieldInput,
|
|
31
|
+
FormFieldTextarea,
|
|
32
|
+
FormFieldCheckbox,
|
|
33
|
+
FormFieldRadio
|
|
34
|
+
})
|
|
35
|
+
}), this);
|
|
36
|
+
}
|
|
27
37
|
}
|
|
28
|
-
_FormField = 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
|
-
strictMode: true,
|
|
31
|
-
scope: () => ({
|
|
32
|
-
hash,
|
|
33
|
-
FormFieldLabel,
|
|
34
|
-
FormFieldHint,
|
|
35
|
-
FormFieldFeedback,
|
|
36
|
-
FormFieldInput,
|
|
37
|
-
FormFieldTextarea,
|
|
38
|
-
FormFieldCheckbox,
|
|
39
|
-
FormFieldRadio
|
|
40
|
-
})
|
|
41
|
-
}), _FormField);
|
|
42
38
|
|
|
43
39
|
export { FormField as default };
|
|
44
40
|
//# sourceMappingURL=form-field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.js","sources":["../../src/components/form-field.gts"],"sourcesContent":["import 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';\n\nexport interface FormFieldArgs {\n size?: 'sm' | 'md' | 'lg';\n}\n\nexport interface FormFieldSignature {\n Args: FormFieldArgs;\n Blocks: {\n default: [\n {\n id: string;\n hintId: string;\n feedbackId: string;\n Label: WithBoundArgs<typeof FormFieldLabel, 'for'> &\n WithBoundArgs<typeof FormFieldLabel, 'size'>;\n Hint: WithBoundArgs<typeof FormFieldHint, 'id'> &\n WithBoundArgs<typeof FormFieldHint, 'size'>;\n Feedback: WithBoundArgs<typeof FormFieldFeedback, 'id'> &\n WithBoundArgs<typeof FormFieldFeedback, 'size'>;\n Input: WithBoundArgs<typeof FormFieldInput, 'id'> &\n WithBoundArgs<typeof FormFieldInput, 'size'>;\n Textarea: WithBoundArgs<typeof FormFieldTextarea, 'id'> &\n WithBoundArgs<typeof FormFieldTextarea, 'size'>;\n Checkbox: WithBoundArgs<typeof FormFieldCheckbox, 'id'> &\n WithBoundArgs<typeof FormFieldCheckbox, 'size'>;\n Radio: WithBoundArgs<typeof FormFieldRadio, 'id'> &\n WithBoundArgs<typeof FormFieldRadio, 'size'>;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class FormField extends Component<FormFieldSignature> {\n id = guidFor(this);\n\n get hintId(): string {\n return this.id + '-hint';\n }\n\n get feedbackId(): string {\n return this.id + '-feedback';\n }\n\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 </template>\n}\n"],"names":["FormField","Component","
|
|
1
|
+
{"version":3,"file":"form-field.js","sources":["../../src/components/form-field.gts"],"sourcesContent":["import 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';\n\nexport interface FormFieldArgs {\n size?: 'sm' | 'md' | 'lg';\n}\n\nexport interface FormFieldSignature {\n Args: FormFieldArgs;\n Blocks: {\n default: [\n {\n id: string;\n hintId: string;\n feedbackId: string;\n Label: WithBoundArgs<typeof FormFieldLabel, 'for'> &\n WithBoundArgs<typeof FormFieldLabel, 'size'>;\n Hint: WithBoundArgs<typeof FormFieldHint, 'id'> &\n WithBoundArgs<typeof FormFieldHint, 'size'>;\n Feedback: WithBoundArgs<typeof FormFieldFeedback, 'id'> &\n WithBoundArgs<typeof FormFieldFeedback, 'size'>;\n Input: WithBoundArgs<typeof FormFieldInput, 'id'> &\n WithBoundArgs<typeof FormFieldInput, 'size'>;\n Textarea: WithBoundArgs<typeof FormFieldTextarea, 'id'> &\n WithBoundArgs<typeof FormFieldTextarea, 'size'>;\n Checkbox: WithBoundArgs<typeof FormFieldCheckbox, 'id'> &\n WithBoundArgs<typeof FormFieldCheckbox, 'size'>;\n Radio: WithBoundArgs<typeof FormFieldRadio, 'id'> &\n WithBoundArgs<typeof FormFieldRadio, 'size'>;\n }\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class FormField extends Component<FormFieldSignature> {\n id = guidFor(this);\n\n get hintId(): string {\n return this.id + '-hint';\n }\n\n get feedbackId(): string {\n return this.id + '-feedback';\n }\n\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 </template>\n}\n"],"names":["FormField","Component","id","guidFor","hintId","feedbackId","setComponentTemplate","precompileTemplate","strictMode","scope","hash","FormFieldLabel","FormFieldHint","FormFieldFeedback","FormFieldInput","FormFieldTextarea","FormFieldCheckbox","FormFieldRadio"],"mappings":";;;;;;;;;;;;;AA4Ce,MAAMA,kBAAkBC,SAAA,CAAU;AAC/CC,EAAAA,EAAA,GAAKC,OAAA,CAAQ,IAAI,CAAA;EAEjB,IAAIC,MAAAA,GAAiB;AACnB,IAAA,OAAO,IAAI,CAACF,EAAE,GAAG,OAAA;AACnB,EAAA;EAEA,IAAIG,UAAAA,GAAqB;AACvB,IAAA,OAAO,IAAI,CAACH,EAAE,GAAG,WAAA;AACnB,EAAA;AAEA,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CAAA,0hBAAA,EAiBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;QAAAC,cAAA;QAAAC,aAAA;QAAAC,iBAAA;QAAAC,cAAA;QAAAC,iBAAA;QAAAC,iBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1,7 +1,3 @@
|
|
|
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
1
|
import Component from '@glimmer/component';
|
|
6
2
|
import { action } from '@ember/object';
|
|
7
3
|
import { tracked } from '@glimmer/tracking';
|
|
@@ -11,13 +7,15 @@ import { useStyles } from '@frontile/theme';
|
|
|
11
7
|
import FormField from './form-field.js';
|
|
12
8
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
9
|
import { setComponentTemplate } from '@ember/component';
|
|
10
|
+
import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../runtime-BPCpkOf1-B5Lbloj7.js';
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
class FormInputBase extends Component {
|
|
13
|
+
static {
|
|
14
|
+
decorateFieldV2(this.prototype, "shouldShowErrorFeedback", [tracked], function () {
|
|
15
|
+
return false;
|
|
16
|
+
});
|
|
20
17
|
}
|
|
18
|
+
#shouldShowErrorFeedback = (initializeDeferredDecorator(this, "shouldShowErrorFeedback"), void 0);
|
|
21
19
|
get showErrorFeedback() {
|
|
22
20
|
if (this.args.hasError === false) {
|
|
23
21
|
return false;
|
|
@@ -34,20 +32,19 @@ let FormInputBase = (_class = class FormInputBase extends Component {
|
|
|
34
32
|
this.args.onFocusIn(event);
|
|
35
33
|
}
|
|
36
34
|
}
|
|
35
|
+
static {
|
|
36
|
+
decorateMethodV2(this.prototype, "handleFocusIn", [action]);
|
|
37
|
+
}
|
|
37
38
|
handleFocusOut(event) {
|
|
38
39
|
this.shouldShowErrorFeedback = true;
|
|
39
40
|
if (typeof this.args.onFocusOut === 'function') {
|
|
40
41
|
this.args.onFocusOut(event);
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
enumerable: true,
|
|
46
|
-
writable: true,
|
|
47
|
-
initializer: function () {
|
|
48
|
-
return false;
|
|
44
|
+
static {
|
|
45
|
+
decorateMethodV2(this.prototype, "handleFocusOut", [action]);
|
|
49
46
|
}
|
|
50
|
-
}
|
|
47
|
+
}
|
|
51
48
|
class FormInput extends FormInputBase {
|
|
52
49
|
get classes() {
|
|
53
50
|
const {
|
|
@@ -74,16 +71,17 @@ class FormInput extends FormInputBase {
|
|
|
74
71
|
feedback: feedback()
|
|
75
72
|
};
|
|
76
73
|
}
|
|
74
|
+
static {
|
|
75
|
+
setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n {{#if @label}}\n <f.Label @class={{this.classes.label}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint @class={{this.classes.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={{this.classes.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={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n ", {
|
|
76
|
+
strictMode: true,
|
|
77
|
+
scope: () => ({
|
|
78
|
+
FormField,
|
|
79
|
+
concat,
|
|
80
|
+
on
|
|
81
|
+
})
|
|
82
|
+
}), this);
|
|
83
|
+
}
|
|
77
84
|
}
|
|
78
|
-
_FormInput = FormInput;
|
|
79
|
-
setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n {{#if @label}}\n <f.Label @class={{this.classes.label}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint @class={{this.classes.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={{this.classes.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={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n ", {
|
|
80
|
-
strictMode: true,
|
|
81
|
-
scope: () => ({
|
|
82
|
-
FormField,
|
|
83
|
-
concat,
|
|
84
|
-
on
|
|
85
|
-
})
|
|
86
|
-
}), _FormInput);
|
|
87
85
|
|
|
88
86
|
export { FormInputBase, FormInput as default };
|
|
89
87
|
//# sourceMappingURL=form-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-input.js","sources":["../../src/components/form-input.gts"],"sourcesContent":["import 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 { useStyles } from '@frontile/theme';\nimport FormField from './form-field';\n\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 */\n value: string | undefined;\n\n /**\n * The input type\n * @defaultValue 'text'\n */\n type?: string;\n\n /** The group label */\n label?: string;\n /** A help text to be displayed */\n hint?: string;\n /** If the form has been submitted, used to force displaying errors */\n hasSubmitted?: boolean;\n /** If has errors */\n hasError?: boolean;\n /** Force displaying errors */\n showError?: boolean;\n /** A list of errors or a single text describing the error */\n errors?: string[] | string;\n /** CSS classes to be added in the container element */\n containerClass?: string;\n /** The size */\n size?: 'sm' | 'md' | 'lg';\n /** CSS classes to be added in the input element */\n inputClass?: string;\n\n /** Callback when oninput is triggered */\n onInput?: (value: string, event: InputEvent) => void;\n\n /** Callback when onchange is triggered */\n onChange?: (value: string, event: InputEvent) => void;\n\n /** Callback when onfocus is triggered */\n onFocusIn?: (event: FocusEvent) => void;\n\n /** Callback when onblur is triggered */\n onFocusOut?: (event: FocusEvent) => void;\n}\n\nexport interface FormInputBaseSignature {\n Args: FormInputArgs;\n}\n\nexport interface FormInputSignature extends FormInputBaseSignature {\n Element: HTMLInputElement;\n Blocks: {\n default: [];\n };\n}\n\nexport class FormInputBase<\n T extends FormInputBaseSignature\n> extends Component<T> {\n @tracked shouldShowErrorFeedback = false;\n\n get showErrorFeedback(): boolean {\n if (this.args.hasError === false) {\n return false;\n }\n\n if (\n (this.args.showError ||\n this.args.hasSubmitted ||\n this.shouldShowErrorFeedback) &&\n this.args.errors &&\n this.args.errors.length > 0\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n @action handleFocusIn(event: FocusEvent): void {\n this.shouldShowErrorFeedback = false;\n\n if (typeof this.args.onFocusIn === 'function') {\n this.args.onFocusIn(event);\n }\n }\n\n @action handleFocusOut(event: FocusEvent): void {\n this.shouldShowErrorFeedback = true;\n\n if (typeof this.args.onFocusOut === 'function') {\n this.args.onFocusOut(event);\n }\n }\n}\n\nexport default class FormInput extends FormInputBase<FormInputSignature> {\n get classes() {\n const { formInput } = useStyles();\n\n const { base, label, input, hint, feedback } = formInput({\n size: this.args.size\n });\n\n return {\n base: base({\n class: this.args.containerClass\n }),\n label: label(),\n input: input({ class: this.args.inputClass }),\n hint: hint(),\n feedback: feedback()\n };\n }\n\n <template>\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n {{#if @label}}\n <f.Label @class={{this.classes.label}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint @class={{this.classes.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={{this.classes.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 @class={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n </template>\n}\n"],"names":["FormInputBase","
|
|
1
|
+
{"version":3,"file":"form-input.js","sources":["../../src/components/form-input.gts"],"sourcesContent":["import 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 { useStyles } from '@frontile/theme';\nimport FormField from './form-field';\n\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 */\n value: string | undefined;\n\n /**\n * The input type\n * @defaultValue 'text'\n */\n type?: string;\n\n /** The group label */\n label?: string;\n /** A help text to be displayed */\n hint?: string;\n /** If the form has been submitted, used to force displaying errors */\n hasSubmitted?: boolean;\n /** If has errors */\n hasError?: boolean;\n /** Force displaying errors */\n showError?: boolean;\n /** A list of errors or a single text describing the error */\n errors?: string[] | string;\n /** CSS classes to be added in the container element */\n containerClass?: string;\n /** The size */\n size?: 'sm' | 'md' | 'lg';\n /** CSS classes to be added in the input element */\n inputClass?: string;\n\n /** Callback when oninput is triggered */\n onInput?: (value: string, event: InputEvent) => void;\n\n /** Callback when onchange is triggered */\n onChange?: (value: string, event: InputEvent) => void;\n\n /** Callback when onfocus is triggered */\n onFocusIn?: (event: FocusEvent) => void;\n\n /** Callback when onblur is triggered */\n onFocusOut?: (event: FocusEvent) => void;\n}\n\nexport interface FormInputBaseSignature {\n Args: FormInputArgs;\n}\n\nexport interface FormInputSignature extends FormInputBaseSignature {\n Element: HTMLInputElement;\n Blocks: {\n default: [];\n };\n}\n\nexport class FormInputBase<\n T extends FormInputBaseSignature\n> extends Component<T> {\n @tracked shouldShowErrorFeedback = false;\n\n get showErrorFeedback(): boolean {\n if (this.args.hasError === false) {\n return false;\n }\n\n if (\n (this.args.showError ||\n this.args.hasSubmitted ||\n this.shouldShowErrorFeedback) &&\n this.args.errors &&\n this.args.errors.length > 0\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n @action handleFocusIn(event: FocusEvent): void {\n this.shouldShowErrorFeedback = false;\n\n if (typeof this.args.onFocusIn === 'function') {\n this.args.onFocusIn(event);\n }\n }\n\n @action handleFocusOut(event: FocusEvent): void {\n this.shouldShowErrorFeedback = true;\n\n if (typeof this.args.onFocusOut === 'function') {\n this.args.onFocusOut(event);\n }\n }\n}\n\nexport default class FormInput extends FormInputBase<FormInputSignature> {\n get classes() {\n const { formInput } = useStyles();\n\n const { base, label, input, hint, feedback } = formInput({\n size: this.args.size\n });\n\n return {\n base: base({\n class: this.args.containerClass\n }),\n label: label(),\n input: input({ class: this.args.inputClass }),\n hint: hint(),\n feedback: feedback()\n };\n }\n\n <template>\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n {{#if @label}}\n <f.Label @class={{this.classes.label}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint @class={{this.classes.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={{this.classes.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 @class={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n </template>\n}\n"],"names":["FormInputBase","Component","g","prototype","tracked","i","void 0","showErrorFeedback","args","hasError","showError","hasSubmitted","shouldShowErrorFeedback","errors","length","handleFocusIn","event","onFocusIn","n","action","handleFocusOut","onFocusOut","FormInput","classes","formInput","useStyles","base","label","input","hint","feedback","size","class","containerClass","inputClass","setComponentTemplate","precompileTemplate","strictMode","scope","FormField","concat","on"],"mappings":";;;;;;;;;;;AAgEO,MAAMA,aAAA,SAEHC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,yBAAA,EAAA,CACjBC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAkC,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;AAAA,EAAA,wBAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,yBAAA,CAAA,EAAAC,MAAA;EAEnC,IAAIC,iBAAAA,GAA6B;AAC/B,IAAA,IAAI,IAAI,CAACC,IAAI,CAACC,QAAQ,KAAK,KAAA,EAAO;AAChC,MAAA,OAAO,KAAA;AACT,IAAA;AAEA,IAAA,IACE,CAAC,IAAI,CAACD,IAAI,CAACE,SAAS,IAClB,IAAI,CAACF,IAAI,CAACG,YAAY,IACtB,IAAI,CAACC,uBAAuB,KAC9B,IAAI,CAACJ,IAAI,CAACK,MAAM,IAChB,IAAI,CAACL,IAAI,CAACK,MAAM,CAACC,MAAM,GAAG,CAAA,EAC1B;AACA,MAAA,OAAO,IAAA;AACT,IAAA,CAAA,MAAO;AACL,MAAA,OAAO,KAAA;AACT,IAAA;AACF,EAAA;EAEQC,aAAAA,CAAcC,KAAiB,EAAQ;IAC7C,IAAI,CAACJ,uBAAuB,GAAG,KAAA;IAE/B,IAAI,OAAO,IAAI,CAACJ,IAAI,CAACS,SAAS,KAAK,UAAA,EAAY;AAC7C,MAAA,IAAI,CAACT,IAAI,CAACS,SAAS,CAACD,KAAA,CAAA;AACtB,IAAA;AACF,EAAA;AAAA,EAAA;IAAAE,gBAAA,CAAA,IAAA,CAAAf,SAAA,EAAA,eAAA,EAAA,CANCgB,MAAA,CAAA,CAAA;AAAA;EAQOC,cAAAA,CAAeJ,KAAiB,EAAQ;IAC9C,IAAI,CAACJ,uBAAuB,GAAG,IAAA;IAE/B,IAAI,OAAO,IAAI,CAACJ,IAAI,CAACa,UAAU,KAAK,UAAA,EAAY;AAC9C,MAAA,IAAI,CAACb,IAAI,CAACa,UAAU,CAACL,KAAA,CAAA;AACvB,IAAA;AACF,EAAA;AAAA,EAAA;IAAAE,gBAAA,CAAA,IAAA,CAAAf,SAAA,EAAA,gBAAA,EAAA,CANCgB,MAAA,CAAA,CAAA;AAAA;AAOH;AAEe,MAAMG,kBAAkBtB,aAAA,CAAc;EACnD,IAAIuB,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAW,GAAGC,SAAA,EAAA;IAEtB,MAAM;MAAEC,IAAI;MAAEC,KAAK;MAAEC,KAAK;MAAEC,IAAI;AAAEC,MAAAA;KAAU,GAAGN,SAAA,CAAU;AACvDO,MAAAA,IAAA,EAAM,IAAI,CAACvB,IAAI,CAACuB;AAClB,KAAA,CAAA;IAEA,OAAO;MACLL,IAAA,EAAMA,IAAA,CAAK;AACTM,QAAAA,KAAA,EAAO,IAAI,CAACxB,IAAI,CAACyB;AACnB,OAAA,CAAA;MACAN,KAAA,EAAOA,KAAA,EAAA;MACPC,KAAA,EAAOA,KAAA,CAAM;AAAEI,QAAAA,KAAA,EAAO,IAAI,CAACxB,IAAI,CAAC0B;AAAW,OAAA,CAAA;MAC3CL,IAAA,EAAMA,IAAA,EAAA;MACNC,QAAA,EAAUA,QAAA;KACZ;AACF,EAAA;AAEA,EAAA;IAAAK,oBAAA,CAAAC,kBAAA,CAAA,i2BAAA,EAoCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,SAAA;QAAAC,MAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1,7 +1,3 @@
|
|
|
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
1
|
import Component from '@glimmer/component';
|
|
6
2
|
import { action } from '@ember/object';
|
|
7
3
|
import { tracked } from '@glimmer/tracking';
|
|
@@ -11,13 +7,15 @@ import FormField from './form-field.js';
|
|
|
11
7
|
import { useStyles } from '@frontile/theme';
|
|
12
8
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
9
|
import { setComponentTemplate } from '@ember/component';
|
|
10
|
+
import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../runtime-BPCpkOf1-B5Lbloj7.js';
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
class FormRadioGroup extends Component {
|
|
13
|
+
static {
|
|
14
|
+
decorateFieldV2(this.prototype, "shouldShowErrorFeedback", [tracked], function () {
|
|
15
|
+
return false;
|
|
16
|
+
});
|
|
20
17
|
}
|
|
18
|
+
#shouldShowErrorFeedback = (initializeDeferredDecorator(this, "shouldShowErrorFeedback"), void 0);
|
|
21
19
|
get showErrorFeedback() {
|
|
22
20
|
if (this.args.hasError === false) {
|
|
23
21
|
return false;
|
|
@@ -34,6 +32,9 @@ let FormRadioGroup = (_class = (_FormRadioGroup = class FormRadioGroup extends C
|
|
|
34
32
|
this.args.onChange(value, event);
|
|
35
33
|
}
|
|
36
34
|
}
|
|
35
|
+
static {
|
|
36
|
+
decorateMethodV2(this.prototype, "handleChange", [action]);
|
|
37
|
+
}
|
|
37
38
|
get classes() {
|
|
38
39
|
const {
|
|
39
40
|
formRadioGroup
|
|
@@ -57,21 +58,17 @@ let FormRadioGroup = (_class = (_FormRadioGroup = class FormRadioGroup extends C
|
|
|
57
58
|
formRadio: formRadio()
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
enumerable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
initializer: function () {
|
|
72
|
-
return false;
|
|
61
|
+
static {
|
|
62
|
+
setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{this.classes.base}} role=\"radiogroup\" ...attributes as |f|>\n {{#if @label}}\n <f.Label @class={{this.classes.label}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint @class={{this.classes.hint}}>\n\n {{@hint}}\n </f.Hint>\n {{/if}}\n\n {{yield (component FormRadio checked=@value privateContainerClass=this.classes.formRadio _parentOnChange=this.handleChange size=@size name=(concat f.id \"-radio-group\"))}}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback @class={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n ", {
|
|
63
|
+
strictMode: true,
|
|
64
|
+
scope: () => ({
|
|
65
|
+
FormField,
|
|
66
|
+
FormRadio,
|
|
67
|
+
concat
|
|
68
|
+
})
|
|
69
|
+
}), this);
|
|
73
70
|
}
|
|
74
|
-
}
|
|
71
|
+
}
|
|
75
72
|
|
|
76
73
|
export { FormRadioGroup as default };
|
|
77
74
|
//# sourceMappingURL=form-radio-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-radio-group.js","sources":["../../src/components/form-radio-group.gts"],"sourcesContent":["import 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 { useStyles } from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\nexport interface FormRadioGroupArgs {\n value: string | number | boolean | undefined;\n /** The group label */\n label?: string;\n /** A help text to be displayed */\n hint?: string;\n /** If the form has been submitted, used to force displaying errors */\n hasSubmitted?: boolean;\n /** If has errors */\n hasError?: boolean;\n /** Force displaying errors */\n showError?: boolean;\n /** A list of errors or a single text describing the error */\n errors?: string[] | string;\n /** CSS classes to be added in the container element */\n containerClass?: string;\n /** The size */\n size?: 'sm' | 'md' | 'lg';\n /** If the Checkbox should be in one line */\n isInline?: boolean;\n\n /** Default callback added to the yielded FormRadio component, called when onchange is triggered */\n onChange?: (value: unknown, event: Event) => void;\n}\n\nexport interface FormRadioGroupSignature {\n Args: FormRadioGroupArgs;\n Blocks: {\n default: [\n radio: WithBoundArgs<typeof FormRadio, 'checked'> &\n WithBoundArgs<typeof FormRadio, 'privateContainerClass'> &\n WithBoundArgs<typeof FormRadio, '_parentOnChange'> &\n WithBoundArgs<typeof FormRadio, 'size'> &\n WithBoundArgs<typeof FormRadio, 'name'>\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class FormRadioGroup extends Component<FormRadioGroupSignature> {\n @tracked shouldShowErrorFeedback = false;\n\n get showErrorFeedback(): boolean {\n if (this.args.hasError === false) {\n return false;\n }\n\n if (\n (this.args.showError ||\n this.args.hasSubmitted ||\n this.shouldShowErrorFeedback) &&\n this.args.errors &&\n this.args.errors.length > 0\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n @action handleChange(value: unknown, event: Event): void {\n this.shouldShowErrorFeedback = true;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n }\n\n get classes() {\n const { formRadioGroup } = useStyles();\n const { base, label, formRadio, hint, feedback } = formRadioGroup({\n isInline: this.args.isInline\n });\n\n return {\n base: base({\n class: this.args.containerClass\n }),\n label: label(),\n hint: hint(),\n feedback: feedback(),\n formRadio: formRadio()\n };\n }\n\n <template>\n <FormField\n @size={{@size}}\n class={{this.classes.base}}\n role=\"radiogroup\"\n ...attributes\n as |f|\n >\n {{#if @label}}\n <f.Label @class={{this.classes.label}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint @class={{this.classes.hint}}>\n\n {{@hint}}\n </f.Hint>\n {{/if}}\n\n {{yield\n (component\n FormRadio\n checked=@value\n privateContainerClass=this.classes.formRadio\n _parentOnChange=this.handleChange\n size=@size\n name=(concat f.id \"-radio-group\")\n )\n }}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback @class={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n </template>\n}\n"],"names":["FormRadioGroup","Component","
|
|
1
|
+
{"version":3,"file":"form-radio-group.js","sources":["../../src/components/form-radio-group.gts"],"sourcesContent":["import 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 { useStyles } from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\nexport interface FormRadioGroupArgs {\n value: string | number | boolean | undefined;\n /** The group label */\n label?: string;\n /** A help text to be displayed */\n hint?: string;\n /** If the form has been submitted, used to force displaying errors */\n hasSubmitted?: boolean;\n /** If has errors */\n hasError?: boolean;\n /** Force displaying errors */\n showError?: boolean;\n /** A list of errors or a single text describing the error */\n errors?: string[] | string;\n /** CSS classes to be added in the container element */\n containerClass?: string;\n /** The size */\n size?: 'sm' | 'md' | 'lg';\n /** If the Checkbox should be in one line */\n isInline?: boolean;\n\n /** Default callback added to the yielded FormRadio component, called when onchange is triggered */\n onChange?: (value: unknown, event: Event) => void;\n}\n\nexport interface FormRadioGroupSignature {\n Args: FormRadioGroupArgs;\n Blocks: {\n default: [\n radio: WithBoundArgs<typeof FormRadio, 'checked'> &\n WithBoundArgs<typeof FormRadio, 'privateContainerClass'> &\n WithBoundArgs<typeof FormRadio, '_parentOnChange'> &\n WithBoundArgs<typeof FormRadio, 'size'> &\n WithBoundArgs<typeof FormRadio, 'name'>\n ];\n };\n Element: HTMLDivElement;\n}\n\nexport default class FormRadioGroup extends Component<FormRadioGroupSignature> {\n @tracked shouldShowErrorFeedback = false;\n\n get showErrorFeedback(): boolean {\n if (this.args.hasError === false) {\n return false;\n }\n\n if (\n (this.args.showError ||\n this.args.hasSubmitted ||\n this.shouldShowErrorFeedback) &&\n this.args.errors &&\n this.args.errors.length > 0\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n @action handleChange(value: unknown, event: Event): void {\n this.shouldShowErrorFeedback = true;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n }\n\n get classes() {\n const { formRadioGroup } = useStyles();\n const { base, label, formRadio, hint, feedback } = formRadioGroup({\n isInline: this.args.isInline\n });\n\n return {\n base: base({\n class: this.args.containerClass\n }),\n label: label(),\n hint: hint(),\n feedback: feedback(),\n formRadio: formRadio()\n };\n }\n\n <template>\n <FormField\n @size={{@size}}\n class={{this.classes.base}}\n role=\"radiogroup\"\n ...attributes\n as |f|\n >\n {{#if @label}}\n <f.Label @class={{this.classes.label}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint @class={{this.classes.hint}}>\n\n {{@hint}}\n </f.Hint>\n {{/if}}\n\n {{yield\n (component\n FormRadio\n checked=@value\n privateContainerClass=this.classes.formRadio\n _parentOnChange=this.handleChange\n size=@size\n name=(concat f.id \"-radio-group\")\n )\n }}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback @class={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n </template>\n}\n"],"names":["FormRadioGroup","Component","g","prototype","tracked","i","void 0","showErrorFeedback","args","hasError","showError","hasSubmitted","shouldShowErrorFeedback","errors","length","handleChange","value","event","onChange","n","action","classes","formRadioGroup","useStyles","base","label","formRadio","hint","feedback","isInline","class","containerClass","setComponentTemplate","precompileTemplate","strictMode","scope","FormField","FormRadio","concat"],"mappings":";;;;;;;;;;;AAgDe,MAAMA,uBAAuBC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,yBAAA,EAAA,CACnDC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAkC,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;AAAA,EAAA,wBAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,yBAAA,CAAA,EAAAC,MAAA;EAEnC,IAAIC,iBAAAA,GAA6B;AAC/B,IAAA,IAAI,IAAI,CAACC,IAAI,CAACC,QAAQ,KAAK,KAAA,EAAO;AAChC,MAAA,OAAO,KAAA;AACT,IAAA;AAEA,IAAA,IACE,CAAC,IAAI,CAACD,IAAI,CAACE,SAAS,IAClB,IAAI,CAACF,IAAI,CAACG,YAAY,IACtB,IAAI,CAACC,uBAAuB,KAC9B,IAAI,CAACJ,IAAI,CAACK,MAAM,IAChB,IAAI,CAACL,IAAI,CAACK,MAAM,CAACC,MAAM,GAAG,CAAA,EAC1B;AACA,MAAA,OAAO,IAAA;AACT,IAAA,CAAA,MAAO;AACL,MAAA,OAAO,KAAA;AACT,IAAA;AACF,EAAA;AAEQC,EAAAA,YAAAA,CAAaC,KAAc,EAAEC,KAAY,EAAQ;IACvD,IAAI,CAACL,uBAAuB,GAAG,IAAA;IAE/B,IAAI,OAAO,IAAI,CAACJ,IAAI,CAACU,QAAQ,KAAK,UAAA,EAAY;MAC5C,IAAI,CAACV,IAAI,CAACU,QAAQ,CAACF,KAAA,EAAOC,KAAA,CAAA;AAC5B,IAAA;AACF,EAAA;AAAA,EAAA;IAAAE,gBAAA,CAAA,IAAA,CAAAhB,SAAA,EAAA,cAAA,EAAA,CANCiB,MAAA,CAAA,CAAA;AAAA;EAQD,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAgB,GAAGC,SAAA,EAAA;IAC3B,MAAM;MAAEC,IAAI;MAAEC,KAAK;MAAEC,SAAS;MAAEC,IAAI;AAAEC,MAAAA;KAAU,GAAGN,cAAA,CAAe;AAChEO,MAAAA,QAAA,EAAU,IAAI,CAACrB,IAAI,CAACqB;AACtB,KAAA,CAAA;IAEA,OAAO;MACLL,IAAA,EAAMA,IAAA,CAAK;AACTM,QAAAA,KAAA,EAAO,IAAI,CAACtB,IAAI,CAACuB;AACnB,OAAA,CAAA;MACAN,KAAA,EAAOA,KAAA,EAAA;MACPE,IAAA,EAAMA,IAAA,EAAA;MACNC,QAAA,EAAUA,QAAA,EAAA;MACVF,SAAA,EAAWA,SAAA;KACb;AACF,EAAA;AAEA,EAAA;IAAAM,oBAAA,CAAAC,kBAAA,CAAA,urBAAA,EAoCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,SAAA;QAAAC,SAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
|
|
2
1
|
import Component from '@glimmer/component';
|
|
3
2
|
import { action } from '@ember/object';
|
|
4
3
|
import FormField from './form-field.js';
|
|
5
4
|
import { useStyles } from '@frontile/theme';
|
|
6
5
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
6
|
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
import { a as decorateMethodV2 } from '../runtime-BPCpkOf1-B5Lbloj7.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
let FormRadio = (_class = (_FormRadio = class FormRadio extends Component {
|
|
9
|
+
class FormRadio extends Component {
|
|
11
10
|
handleChange(value, event) {
|
|
12
11
|
event.preventDefault();
|
|
13
12
|
if (typeof this.args.onChange === 'function') {
|
|
@@ -17,6 +16,9 @@ let FormRadio = (_class = (_FormRadio = class FormRadio extends Component {
|
|
|
17
16
|
this.args._parentOnChange(value, event);
|
|
18
17
|
}
|
|
19
18
|
}
|
|
19
|
+
static {
|
|
20
|
+
decorateMethodV2(this.prototype, "handleChange", [action]);
|
|
21
|
+
}
|
|
20
22
|
get isChecked() {
|
|
21
23
|
return this.args.checked == this.args.value;
|
|
22
24
|
}
|
|
@@ -52,12 +54,15 @@ let FormRadio = (_class = (_FormRadio = class FormRadio extends Component {
|
|
|
52
54
|
radio: radio()
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
57
|
+
static {
|
|
58
|
+
setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n <div class={{this.classes.labelContainer}}>\n <div class={{this.classes.inputContainer}}>\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={{this.classes.radio}} aria-describedby={{if @hint f.hintId}} ...attributes />\n </div>\n\n <f.Label @class={{this.classes.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={{this.classes.hint}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n </FormField>\n ", {
|
|
59
|
+
strictMode: true,
|
|
60
|
+
scope: () => ({
|
|
61
|
+
FormField
|
|
62
|
+
})
|
|
63
|
+
}), this);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
61
66
|
|
|
62
67
|
export { FormRadio as default };
|
|
63
68
|
//# sourceMappingURL=form-radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-radio.js","sources":["../../src/components/form-radio.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport FormField from './form-field';\nimport { useStyles } from '@frontile/theme';\n\nexport interface FormRadioArgs {\n /** The input field label */\n label?: string;\n /** A help text to be displayed */\n hint?: string;\n /**\n * The value to be used in the radio button.\n * You must also pass `onChange` to update its value.\n */\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 */\n checked: unknown;\n /** The name of the checkbox */\n name?: string;\n /** CSS classes to be added in the container element */\n containerClass?: string;\n /** The size */\n size?: 'sm' | 'md' | 'lg';\n /** Callback when onchange is triggered */\n onChange: (value: unknown, event: Event) => void;\n\n /**\n * Internal function for InputRadioGroup\n * @ignore\n **/\n _parentOnChange?: (value: unknown, event: Event) => void;\n\n /** CSS classes to be added in the container element, in be used in for group\n * @ignore*/\n privateContainerClass?: string;\n}\n\nexport interface FormRadioSignature {\n Args: FormRadioArgs;\n Element: HTMLInputElement;\n Blocks: {\n default: [];\n };\n}\n\nexport default class FormRadio extends Component<FormRadioSignature> {\n @action handleChange(value: unknown, event: Event): void {\n event.preventDefault();\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n\n if (typeof this.args._parentOnChange === 'function') {\n this.args._parentOnChange(value, event);\n }\n }\n\n get isChecked(): boolean {\n return this.args.checked == this.args.value;\n }\n\n get classes() {\n const { formRadio } = useStyles();\n\n const { base, label, radio, hint, labelContainer, inputContainer } =\n formRadio({\n size: this.args.size\n });\n\n let containerClasses = '';\n if (this.args.containerClass) {\n containerClasses = this.args.containerClass;\n }\n if (this.args.privateContainerClass) {\n containerClasses += ' ' + this.args.privateContainerClass;\n }\n\n return {\n base: base({\n class: containerClasses\n }),\n label: label(),\n inputContainer: inputContainer(),\n labelContainer: labelContainer(),\n hint: hint(),\n radio: radio()\n };\n }\n\n <template>\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n <div class={{this.classes.labelContainer}}>\n <div class={{this.classes.inputContainer}}>\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={{this.classes.radio}}\n aria-describedby={{if @hint f.hintId}}\n ...attributes\n />\n </div>\n\n <f.Label @class={{this.classes.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={{this.classes.hint}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n </FormField>\n </template>\n}\n"],"names":["FormRadio","Component","handleChange","value","event","preventDefault","args","onChange","_parentOnChange","isChecked","checked","classes","formRadio","useStyles","base","label","radio","hint","labelContainer","inputContainer","size","containerClasses","containerClass","privateContainerClass","class","setComponentTemplate","precompileTemplate","strictMode","scope","FormField"
|
|
1
|
+
{"version":3,"file":"form-radio.js","sources":["../../src/components/form-radio.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport FormField from './form-field';\nimport { useStyles } from '@frontile/theme';\n\nexport interface FormRadioArgs {\n /** The input field label */\n label?: string;\n /** A help text to be displayed */\n hint?: string;\n /**\n * The value to be used in the radio button.\n * You must also pass `onChange` to update its value.\n */\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 */\n checked: unknown;\n /** The name of the checkbox */\n name?: string;\n /** CSS classes to be added in the container element */\n containerClass?: string;\n /** The size */\n size?: 'sm' | 'md' | 'lg';\n /** Callback when onchange is triggered */\n onChange: (value: unknown, event: Event) => void;\n\n /**\n * Internal function for InputRadioGroup\n * @ignore\n **/\n _parentOnChange?: (value: unknown, event: Event) => void;\n\n /** CSS classes to be added in the container element, in be used in for group\n * @ignore*/\n privateContainerClass?: string;\n}\n\nexport interface FormRadioSignature {\n Args: FormRadioArgs;\n Element: HTMLInputElement;\n Blocks: {\n default: [];\n };\n}\n\nexport default class FormRadio extends Component<FormRadioSignature> {\n @action handleChange(value: unknown, event: Event): void {\n event.preventDefault();\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n\n if (typeof this.args._parentOnChange === 'function') {\n this.args._parentOnChange(value, event);\n }\n }\n\n get isChecked(): boolean {\n return this.args.checked == this.args.value;\n }\n\n get classes() {\n const { formRadio } = useStyles();\n\n const { base, label, radio, hint, labelContainer, inputContainer } =\n formRadio({\n size: this.args.size\n });\n\n let containerClasses = '';\n if (this.args.containerClass) {\n containerClasses = this.args.containerClass;\n }\n if (this.args.privateContainerClass) {\n containerClasses += ' ' + this.args.privateContainerClass;\n }\n\n return {\n base: base({\n class: containerClasses\n }),\n label: label(),\n inputContainer: inputContainer(),\n labelContainer: labelContainer(),\n hint: hint(),\n radio: radio()\n };\n }\n\n <template>\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n <div class={{this.classes.labelContainer}}>\n <div class={{this.classes.inputContainer}}>\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={{this.classes.radio}}\n aria-describedby={{if @hint f.hintId}}\n ...attributes\n />\n </div>\n\n <f.Label @class={{this.classes.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={{this.classes.hint}}>\n {{@hint}}\n </f.Hint>\n {{/if}}\n </FormField>\n </template>\n}\n"],"names":["FormRadio","Component","handleChange","value","event","preventDefault","args","onChange","_parentOnChange","n","prototype","action","isChecked","checked","classes","formRadio","useStyles","base","label","radio","hint","labelContainer","inputContainer","size","containerClasses","containerClass","privateContainerClass","class","setComponentTemplate","precompileTemplate","strictMode","scope","FormField"],"mappings":";;;;;;;;AAiDe,MAAMA,kBAAkBC,SAAA,CAAU;AACvCC,EAAAA,YAAAA,CAAaC,KAAc,EAAEC,KAAY,EAAQ;IACvDA,KAAA,CAAMC,cAAc,EAAA;IAEpB,IAAI,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,KAAK,UAAA,EAAY;MAC5C,IAAI,CAACD,IAAI,CAACC,QAAQ,CAACJ,KAAA,EAAOC,KAAA,CAAA;AAC5B,IAAA;IAEA,IAAI,OAAO,IAAI,CAACE,IAAI,CAACE,eAAe,KAAK,UAAA,EAAY;MACnD,IAAI,CAACF,IAAI,CAACE,eAAe,CAACL,KAAA,EAAOC,KAAA,CAAA;AACnC,IAAA;AACF,EAAA;AAAA,EAAA;IAAAK,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CAVCC,MAAA,CAAA,CAAA;AAAA;EAYD,IAAIC,SAAAA,GAAqB;IACvB,OAAO,IAAI,CAACN,IAAI,CAACO,OAAO,IAAI,IAAI,CAACP,IAAI,CAACH,KAAK;AAC7C,EAAA;EAEA,IAAIW,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAW,GAAGC,SAAA,EAAA;IAEtB,MAAM;MAAEC,IAAI;MAAEC,KAAK;MAAEC,KAAK;MAAEC,IAAI;MAAEC,cAAc;AAAEC,MAAAA;KAAgB,GAChEP,SAAA,CAAU;AACRQ,MAAAA,IAAA,EAAM,IAAI,CAACjB,IAAI,CAACiB;AAClB,KAAA,CAAA;IAEF,IAAIC,gBAAA,GAAmB,EAAA;AACvB,IAAA,IAAI,IAAI,CAAClB,IAAI,CAACmB,cAAc,EAAE;AAC5BD,MAAAA,gBAAA,GAAmB,IAAI,CAAClB,IAAI,CAACmB,cAAc;AAC7C,IAAA;AACA,IAAA,IAAI,IAAI,CAACnB,IAAI,CAACoB,qBAAqB,EAAE;AACnCF,MAAAA,gBAAA,IAAoB,GAAA,GAAM,IAAI,CAAClB,IAAI,CAACoB,qBAAqB;AAC3D,IAAA;IAEA,OAAO;MACLT,IAAA,EAAMA,IAAA,CAAK;AACTU,QAAAA,KAAA,EAAOH;AACT,OAAA,CAAA;MACAN,KAAA,EAAOA,KAAA,EAAA;MACPI,cAAA,EAAgBA,cAAA,EAAA;MAChBD,cAAA,EAAgBA,cAAA,EAAA;MAChBD,IAAA,EAAMA,IAAA,EAAA;MACND,KAAA,EAAOA,KAAA;KACT;AACF,EAAA;AAEA,EAAA;IAAAS,oBAAA,CAAAC,kBAAA,CAAA,83BAAA,EAiCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|