@frontile/forms 0.17.0-alpha.1 → 0.17.0-alpha.12
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/addon-main.js +0 -33
- package/declarations/components/form-field/select.d.ts +38 -0
- package/declarations/components/form-field/select.d.ts.map +1 -0
- package/declarations/components/native-select.d.ts +65 -0
- package/declarations/components/native-select.d.ts.map +1 -0
- package/declarations/components/select.d.ts +51 -0
- package/declarations/components/select.d.ts.map +1 -0
- package/declarations/index.d.ts +3 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +3 -30
- package/declarations/template-registry.d.ts.map +1 -1
- package/dist/_app_/components/native-select.js +1 -0
- package/dist/_app_/components/select.js +1 -0
- package/dist/components/native-select.js +95 -0
- package/dist/components/native-select.js.map +1 -0
- package/dist/components/select.js +117 -0
- package/dist/components/select.js.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -29
- package/dist/_app_/components/form-checkbox-group.js +0 -1
- package/dist/_app_/components/form-checkbox.js +0 -1
- package/dist/_app_/components/form-field/checkbox.js +0 -1
- package/dist/_app_/components/form-field/feedback.js +0 -1
- package/dist/_app_/components/form-field/hint.js +0 -1
- package/dist/_app_/components/form-field/input.js +0 -1
- package/dist/_app_/components/form-field/label.js +0 -1
- package/dist/_app_/components/form-field/radio.js +0 -1
- package/dist/_app_/components/form-field/textarea.js +0 -1
- package/dist/_app_/components/form-field.js +0 -1
- package/dist/_app_/components/form-input.js +0 -1
- package/dist/_app_/components/form-radio-group.js +0 -1
- package/dist/_app_/components/form-radio.js +0 -1
- package/dist/_app_/components/form-select.js +0 -1
- package/dist/_app_/components/form-textarea.js +0 -1
- package/dist/components/form-checkbox-group.js +0 -77
- package/dist/components/form-checkbox-group.js.map +0 -1
- package/dist/components/form-checkbox.js +0 -59
- package/dist/components/form-checkbox.js.map +0 -1
- package/dist/components/form-field/checkbox.js +0 -38
- package/dist/components/form-field/checkbox.js.map +0 -1
- package/dist/components/form-field/feedback.js +0 -36
- package/dist/components/form-field/feedback.js.map +0 -1
- package/dist/components/form-field/hint.js +0 -24
- package/dist/components/form-field/hint.js.map +0 -1
- package/dist/components/form-field/input.js +0 -44
- package/dist/components/form-field/input.js.map +0 -1
- package/dist/components/form-field/label.js +0 -24
- package/dist/components/form-field/label.js.map +0 -1
- package/dist/components/form-field/radio.js +0 -37
- package/dist/components/form-field/radio.js.map +0 -1
- package/dist/components/form-field/textarea.js +0 -38
- package/dist/components/form-field/textarea.js.map +0 -1
- package/dist/components/form-field.js +0 -44
- package/dist/components/form-field.js.map +0 -1
- package/dist/components/form-input.js +0 -89
- package/dist/components/form-input.js.map +0 -1
- package/dist/components/form-radio-group.js +0 -77
- package/dist/components/form-radio-group.js.map +0 -1
- package/dist/components/form-radio.js +0 -63
- package/dist/components/form-radio.js.map +0 -1
- package/dist/components/form-select.js +0 -124
- package/dist/components/form-select.js.map +0 -1
- package/dist/components/form-textarea.js +0 -48
- package/dist/components/form-textarea.js.map +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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' | 'md' | '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;;;;"}
|
|
@@ -1,89 +0,0 @@
|
|
|
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 { useStyles } from '@frontile/theme';
|
|
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
|
-
get classes() {
|
|
53
|
-
const {
|
|
54
|
-
formInput: formInput1
|
|
55
|
-
} = useStyles();
|
|
56
|
-
const {
|
|
57
|
-
base: base1,
|
|
58
|
-
label: label1,
|
|
59
|
-
input: input1,
|
|
60
|
-
hint: hint1,
|
|
61
|
-
feedback: feedback1
|
|
62
|
-
} = formInput1({
|
|
63
|
-
size: this.args.size
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
base: base1({
|
|
67
|
-
class: this.args.containerClass
|
|
68
|
-
}),
|
|
69
|
-
label: label1(),
|
|
70
|
-
input: input1({
|
|
71
|
-
class: this.args.inputClass
|
|
72
|
-
}),
|
|
73
|
-
hint: hint1(),
|
|
74
|
-
feedback: feedback1()
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
_class3 = 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
|
-
scope: () => ({
|
|
81
|
-
FormField,
|
|
82
|
-
concat,
|
|
83
|
-
on
|
|
84
|
-
}),
|
|
85
|
-
strictMode: true
|
|
86
|
-
}), _class3);
|
|
87
|
-
|
|
88
|
-
export { FormInputBase, FormInput as default };
|
|
89
|
-
//# sourceMappingURL=form-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 { useStyles } from '@frontile/theme';\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' | 'md' | 'lg';\n /** CSS classes to be added in the input element */ inputClass?: string;\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 get classes() {\n const { formInput: formInput1 } = useStyles();\n const { base: base1, label: label1, input: input1, hint: hint1, feedback: feedback1 } = formInput1({\n size: this.args.size\n });\n return {\n base: base1({\n class: this.args.containerClass\n }),\n label: label1(),\n input: input1({\n class: this.args.inputClass\n }),\n hint: hint1(),\n feedback: feedback1()\n };\n }\n static{\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 `, {\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","classes","formInput","formInput1","useStyles","base","base1","label","label1","input","input1","hint","hint1","feedback","feedback1","size","class","containerClass","inputClass","_class3","setComponentTemplate","precompileTemplate","scope","FormField","concat","on","strictMode"],"mappings":";;;;;;;;;;;;;;;AAwCaA,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;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AW,GAAGX,UAAU,CAAC;AAC/FY,MAAAA,IAAI,EAAE,IAAI,CAACxC,IAAI,CAACwC,IAAAA;AACpB,KAAC,CAAC,CAAA;IACF,OAAO;MACHV,IAAI,EAAEC,KAAK,CAAC;AACRU,QAAAA,KAAK,EAAE,IAAI,CAACzC,IAAI,CAAC0C,cAAAA;AACrB,OAAC,CAAC;MACFV,KAAK,EAAEC,MAAM,EAAE;MACfC,KAAK,EAAEC,MAAM,CAAC;AACVM,QAAAA,KAAK,EAAE,IAAI,CAACzC,IAAI,CAAC2C,UAAAA;AACrB,OAAC,CAAC;MACFP,IAAI,EAAEC,KAAK,EAAE;MACbC,QAAQ,EAAEC,SAAS,EAAC;KACvB,CAAA;AACL,GAAA;AA6CJ,CAAA;AAACK,OAAA,GA9DoBnB,SAAS,CAAA;AAmBtBoB,oBAAA,CAAAC,kBAAA,CAoCH,i2BAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;IAAAC,MAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAP,OAAA,CAAA;;;;"}
|
|
@@ -1,77 +0,0 @@
|
|
|
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 { useStyles } from '@frontile/theme';
|
|
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
|
-
get classes() {
|
|
38
|
-
const {
|
|
39
|
-
formRadioGroup: formRadioGroup1
|
|
40
|
-
} = useStyles();
|
|
41
|
-
const {
|
|
42
|
-
base: base1,
|
|
43
|
-
label: label1,
|
|
44
|
-
formRadio: formRadio1,
|
|
45
|
-
hint: hint1,
|
|
46
|
-
feedback: feedback1
|
|
47
|
-
} = formRadioGroup1({
|
|
48
|
-
isInline: this.args.isInline
|
|
49
|
-
});
|
|
50
|
-
return {
|
|
51
|
-
base: base1({
|
|
52
|
-
class: this.args.containerClass
|
|
53
|
-
}),
|
|
54
|
-
label: label1(),
|
|
55
|
-
hint: hint1(),
|
|
56
|
-
feedback: feedback1(),
|
|
57
|
-
formRadio: formRadio1()
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}, 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 ", {
|
|
61
|
-
scope: () => ({
|
|
62
|
-
FormField,
|
|
63
|
-
FormRadio,
|
|
64
|
-
concat
|
|
65
|
-
}),
|
|
66
|
-
strictMode: true
|
|
67
|
-
}), _class2), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "shouldShowErrorFeedback", [tracked], {
|
|
68
|
-
configurable: true,
|
|
69
|
-
enumerable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
initializer: function () {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
}), _applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
|
|
75
|
-
|
|
76
|
-
export { FormRadioGroup as default };
|
|
77
|
-
//# sourceMappingURL=form-radio-group.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 { useStyles } from '@frontile/theme';\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' | 'md' | '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 get classes() {\n const { formRadioGroup: formRadioGroup1 } = useStyles();\n const { base: base1, label: label1, formRadio: formRadio1, hint: hint1, feedback: feedback1 } = formRadioGroup1({\n isInline: this.args.isInline\n });\n return {\n base: base1({\n class: this.args.containerClass\n }),\n label: label1(),\n hint: hint1(),\n feedback: feedback1(),\n formRadio: formRadio1()\n };\n }\n static{\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 `, {\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","classes","formRadioGroup","formRadioGroup1","useStyles","base","base1","label","label1","formRadio","formRadio1","hint","hint1","feedback","feedback1","isInline","class","containerClass","setComponentTemplate","precompileTemplate","scope","FormField","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;A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AAA,EAAAA,OAAA,CAAAK,GAAAA,WAAA,GAAAoC,yBAAA,CAAA1C,MAAA,CAAA2C,SAAA,8BA5ELC,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,CAAA1C,MAAA,CAAA2C,SAAA,EAW9BM,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAnD,MAAA,CAAA2C,SAAA,EAAA,cAAA,CAAA,EAAA3C,MAAA,CAAA2C,SAAA,IAAA3C,MAAA;;;;"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
|
|
2
|
-
import Component from '@glimmer/component';
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
|
-
import FormField from './form-field.js';
|
|
5
|
-
import { useStyles } from '@frontile/theme';
|
|
6
|
-
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
|
-
import { setComponentTemplate } from '@ember/component';
|
|
8
|
-
|
|
9
|
-
var _class, _class2;
|
|
10
|
-
let FormRadio = (_class = (_class2 = class FormRadio extends Component {
|
|
11
|
-
handleChange(value1, event1) {
|
|
12
|
-
event1.preventDefault();
|
|
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
|
-
get isChecked() {
|
|
21
|
-
return this.args.checked == this.args.value;
|
|
22
|
-
}
|
|
23
|
-
get classes() {
|
|
24
|
-
const {
|
|
25
|
-
formRadio: formRadio1
|
|
26
|
-
} = useStyles();
|
|
27
|
-
const {
|
|
28
|
-
base: base1,
|
|
29
|
-
label: label1,
|
|
30
|
-
radio: radio1,
|
|
31
|
-
hint: hint1,
|
|
32
|
-
labelContainer: labelContainer1,
|
|
33
|
-
inputContainer: inputContainer1
|
|
34
|
-
} = formRadio1({
|
|
35
|
-
size: this.args.size
|
|
36
|
-
});
|
|
37
|
-
let containerClasses1 = '';
|
|
38
|
-
if (this.args.containerClass) {
|
|
39
|
-
containerClasses1 = this.args.containerClass;
|
|
40
|
-
}
|
|
41
|
-
if (this.args.privateContainerClass) {
|
|
42
|
-
containerClasses1 += ' ' + this.args.privateContainerClass;
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
base: base1({
|
|
46
|
-
class: containerClasses1
|
|
47
|
-
}),
|
|
48
|
-
label: label1(),
|
|
49
|
-
inputContainer: inputContainer1(),
|
|
50
|
-
labelContainer: labelContainer1(),
|
|
51
|
-
hint: hint1(),
|
|
52
|
-
radio: radio1()
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}, 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 ", {
|
|
56
|
-
scope: () => ({
|
|
57
|
-
FormField
|
|
58
|
-
}),
|
|
59
|
-
strictMode: true
|
|
60
|
-
}), _class2), _class2), (_applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
|
|
61
|
-
|
|
62
|
-
export { FormRadio as default };
|
|
63
|
-
//# sourceMappingURL=form-radio.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 FormField from './form-field';\nimport { useStyles } from '@frontile/theme';\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' | 'md' | '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 get classes() {\n const { formRadio: formRadio1 } = useStyles();\n const { base: base1, label: label1, radio: radio1, hint: hint1, labelContainer: labelContainer1, inputContainer: inputContainer1 } = formRadio1({\n size: this.args.size\n });\n let containerClasses1 = '';\n if (this.args.containerClass) {\n containerClasses1 = this.args.containerClass;\n }\n if (this.args.privateContainerClass) {\n containerClasses1 += ' ' + this.args.privateContainerClass;\n }\n return {\n base: base1({\n class: containerClasses1\n }),\n label: label1(),\n inputContainer: inputContainer1(),\n labelContainer: labelContainer1(),\n hint: hint1(),\n radio: radio1()\n };\n }\n static{\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 `, {\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","classes","formRadio","formRadio1","useStyles","base","base1","label","label1","radio","radio1","hint","hint1","labelContainer","labelContainer1","inputContainer","inputContainer1","size","containerClasses1","containerClass","privateContainerClass","class","setComponentTemplate","precompileTemplate","scope","FormField","strictMode","_applyDecoratedDescriptor","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;AAmCqBA,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,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AAC;MACFX,KAAK,EAAEC,MAAM,EAAE;MACfO,cAAc,EAAEC,eAAe,EAAE;MACjCH,cAAc,EAAEC,eAAe,EAAE;MACjCH,IAAI,EAAEC,KAAK,EAAE;MACbH,KAAK,EAAEC,MAAM,EAAC;KACjB,CAAA;AACL,GAAA;AA0CJ,CAAC,EAAAY,oBAAA,CAxCOC,kBAAA,CAiCH,83BAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA,SAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAArC,OAAA,CAAAA,EAAAA,OAAA,CAAAsC,GAAAA,yBAAA,CAAAvC,MAAA,CAAAwC,SAAA,EA3ELC,cAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAA3C,MAAA,CAAAwC,SAAA,EAAA,cAAA,CAAA,EAAAxC,MAAA,CAAAwC,SAAA,CAAA,GAAAxC,MAAA;;;;"}
|
|
@@ -1,124 +0,0 @@
|
|
|
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 { tracked } from '@glimmer/tracking';
|
|
7
|
-
import { action } from '@ember/object';
|
|
8
|
-
import { assert } from '@ember/debug';
|
|
9
|
-
import PowerSelect from 'ember-power-select/components/power-select';
|
|
10
|
-
export { Select } from 'ember-power-select/components/power-select';
|
|
11
|
-
import PowerSelectMultiple from 'ember-power-select/components/power-select-multiple';
|
|
12
|
-
import FormField from './form-field.js';
|
|
13
|
-
import { concat } from '@ember/helper';
|
|
14
|
-
import { useStyles } from '@frontile/theme';
|
|
15
|
-
import { precompileTemplate } from '@ember/template-compilation';
|
|
16
|
-
import { setComponentTemplate } from '@ember/component';
|
|
17
|
-
|
|
18
|
-
var _class, _descriptor, _descriptor2, _class2;
|
|
19
|
-
let FormSelect = (_class = (_class2 = class FormSelect extends Component {
|
|
20
|
-
constructor(owner1, args1) {
|
|
21
|
-
super(owner1, args1);
|
|
22
|
-
_initializerDefineProperty(this, "shouldShowErrorFeedback", _descriptor, this);
|
|
23
|
-
_initializerDefineProperty(this, "isOpen", _descriptor2, this);
|
|
24
|
-
assert('<FormSelect> requires an `@onChange` function', this.args.onChange && typeof this.args.onChange === 'function');
|
|
25
|
-
}
|
|
26
|
-
get showErrorFeedback() {
|
|
27
|
-
if (this.args.hasError === false) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
if ((this.args.showError || this.args.hasSubmitted || this.shouldShowErrorFeedback) && this.args.errors && this.args.errors.length > 0) {
|
|
31
|
-
return true;
|
|
32
|
-
} else {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
handleOpen(select1, event1) {
|
|
37
|
-
this.isOpen = true;
|
|
38
|
-
this.shouldShowErrorFeedback = false;
|
|
39
|
-
if (typeof this.args.onOpen === 'function') {
|
|
40
|
-
this.args.onOpen(select1, event1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
handleClose(select1, event1) {
|
|
44
|
-
this.isOpen = false;
|
|
45
|
-
this.shouldShowErrorFeedback = true;
|
|
46
|
-
if (typeof this.args.onClose === 'function') {
|
|
47
|
-
this.args.onClose(select1, event1);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
handleFocusIn(select1, event1) {
|
|
51
|
-
this.shouldShowErrorFeedback = false;
|
|
52
|
-
if (typeof this.args.onFocusIn === 'function') {
|
|
53
|
-
this.args.onFocusIn(select1, event1);
|
|
54
|
-
}
|
|
55
|
-
// ember-power-select argument
|
|
56
|
-
if (typeof this.args.onFocus === 'function') {
|
|
57
|
-
this.args.onFocus(select1, event1);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
handleFocusOut(select1, event1) {
|
|
61
|
-
if (!this.isOpen) {
|
|
62
|
-
this.shouldShowErrorFeedback = true;
|
|
63
|
-
}
|
|
64
|
-
if (typeof this.args.onFocusOut === 'function') {
|
|
65
|
-
this.args.onFocusOut(select1, event1);
|
|
66
|
-
}
|
|
67
|
-
// ember-power-select argument
|
|
68
|
-
if (typeof this.args.onBlur === 'function') {
|
|
69
|
-
this.args.onBlur(select1, event1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
handleChange(selection1, select1, event1) {
|
|
73
|
-
this.shouldShowErrorFeedback = true;
|
|
74
|
-
this.args.onChange(selection1, select1, event1);
|
|
75
|
-
}
|
|
76
|
-
get classes() {
|
|
77
|
-
const {
|
|
78
|
-
formSelect: formSelect1
|
|
79
|
-
} = useStyles();
|
|
80
|
-
const {
|
|
81
|
-
base: base1,
|
|
82
|
-
label: label1,
|
|
83
|
-
select: select1,
|
|
84
|
-
hint: hint1,
|
|
85
|
-
feedback: feedback1
|
|
86
|
-
} = formSelect1({
|
|
87
|
-
size: this.args.size
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
base: base1({
|
|
91
|
-
class: this.args.containerClass
|
|
92
|
-
}),
|
|
93
|
-
label: label1(),
|
|
94
|
-
select: select1(),
|
|
95
|
-
hint: hint1(),
|
|
96
|
-
feedback: feedback1()
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}, setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n\n {{#if @label}}\n <f.Label @for id={{f.id}} @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 {{!-- @glint-nocheck: need to fix powerselect types--}}\n {{#let (if @isMultiple PowerSelectMultiple PowerSelect) as |Component|}}\n <Component ...attributes @onChange={{this.handleChange}} @onFocus={{this.handleFocusIn}} @onBlur={{this.handleFocusOut}} @onOpen={{this.handleOpen}} @onClose={{this.handleClose}} @ariaDescribedBy=\"{{if @hint f.hintId}} {{if this.showErrorFeedback (concat \" \" f.feedbackId)}}{{if @ariaDescribedBy (concat \" \" @ariaDescribedBy)}}\" @ariaLabelledBy=\"{{if @label f.id}} {{if @ariaLabelledBy (concat \" \" @ariaLabelledBy)}}\" @ariaInvalid={{if this.showErrorFeedback \"true\"}} @triggerClass=\"{{@triggerClass}} {{if @size (concat \"ember-power-select-trigger-\" @size)}} {{this.classes.select}}\" @highlightOnHover={{@highlightOnHover}} @placeholderComponent={{@placeholderComponent}} @searchMessage={{@searchMessage}} @noMatchesMessage={{@noMatchesMessage}} @matchTriggerWidth={{@matchTriggerWidth}} @options={{@options}} @selected={{@selected}} @closeOnSelect={{@closeOnSelect}} @defaultHighlighted={{@defaultHighlighted}} @searchField={{@searchField}} @searchEnabled={{@searchEnabled}} @tabindex={{@tabindex}} @triggerComponent={{@triggerComponent}} @matcher={{@matcher}} @initiallyOpened={{@initiallyOpened}} @typeAheadOptionMatcher={{@typeAheadOptionMatcher}} @buildSelection={{@buildSelection}} @search={{@search}} @onInput={{@onInput}} @onKeydown={{@onKeydown}} @scrollTo={{@scrollTo}} @registerAPI={{@registerAPI}} @horizontalPosition={{@horizontalPosition}} @destination={{@destination}} @preventScroll={{@preventScroll}} @renderInPlace={{@renderInPlace}} @verticalPosition={{@verticalPosition}} @disabled={{@disabled}} @calculatePosition={{@calculatePosition}} @eventType={{@eventType}} @ariaLabel={{@ariaLabel}} @required={{@required}} @triggerRole={{@triggerRole}} @title={{@title}} @triggerId={{@triggerId}} @allowClear={{@allowClear}} @loadingMessage={{@loadingMessage}} @selectedItemComponent={{@selectedItemComponent}} @dropdownClass={{@dropdownClass}} @beforeOptionsComponent={{@beforeOptionsComponent}} @placeholder={{@placeholder}} @searchPlaceholder={{@searchPlaceholder}} @searchMessageComponent={{@searchMessageComponent}} @optionsComponent={{@optionsComponent}} @extra={{@extra}} @groupComponent={{@groupComponent}} @afterOptionsComponent={{@afterOptionsComponent}} as |option term|>\n {{yield option term}}\n </Component>\n {{/let}}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback @class={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n ", {
|
|
100
|
-
scope: () => ({
|
|
101
|
-
FormField,
|
|
102
|
-
PowerSelectMultiple,
|
|
103
|
-
PowerSelect,
|
|
104
|
-
concat
|
|
105
|
-
}),
|
|
106
|
-
strictMode: true
|
|
107
|
-
}), _class2), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "shouldShowErrorFeedback", [tracked], {
|
|
108
|
-
configurable: true,
|
|
109
|
-
enumerable: true,
|
|
110
|
-
writable: true,
|
|
111
|
-
initializer: function () {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "isOpen", [tracked], {
|
|
115
|
-
configurable: true,
|
|
116
|
-
enumerable: true,
|
|
117
|
-
writable: true,
|
|
118
|
-
initializer: function () {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
}), _applyDecoratedDescriptor(_class.prototype, "handleOpen", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleOpen"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleClose", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleClose"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleFocusIn", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleFocusIn"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleFocusOut", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleFocusOut"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype)), _class);
|
|
122
|
-
|
|
123
|
-
export { FormSelect as default };
|
|
124
|
-
//# sourceMappingURL=form-select.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form-select.js","sources":["../../src/components/form-select.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport PowerSelect, { type PowerSelectArgs, type Select } from 'ember-power-select/components/power-select';\nimport PowerSelectMultiple from 'ember-power-select/components/power-select-multiple';\nimport FormField from './form-field';\nimport { concat } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nexport { Select } from 'ember-power-select/components/power-select';\nexport interface FormSelectArgs extends PowerSelectArgs {\n /** The input field 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' | 'md' | 'lg';\n /** If is multiple select instead of single */ isMultiple?: boolean;\n // Same as onFocus from ember-power-select\n onFocusIn?: (select: Select, event: FocusEvent) => void;\n // Same as onBlur from ember-power-select\n onFocusOut?: (select: Select, event: FocusEvent) => void;\n}\nexport interface FormSelectSignature {\n Args: FormSelectArgs;\n Blocks: {\n default: [unknown, Select];\n };\n Element: HTMLDivElement;\n}\nexport default class FormSelect extends Component<FormSelectSignature> {\n @tracked\n shouldShowErrorFeedback = false;\n @tracked\n isOpen = false;\n constructor(owner1: unknown, args1: FormSelectArgs){\n super(owner1, args1);\n assert('<FormSelect> requires an `@onChange` function', this.args.onChange && typeof this.args.onChange === 'function');\n }\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 handleOpen(select1: Select, event1: Event): void {\n this.isOpen = true;\n this.shouldShowErrorFeedback = false;\n if (typeof this.args.onOpen === 'function') {\n this.args.onOpen(select1, event1);\n }\n }\n @action\n handleClose(select1: Select, event1: Event): void {\n this.isOpen = false;\n this.shouldShowErrorFeedback = true;\n if (typeof this.args.onClose === 'function') {\n this.args.onClose(select1, event1);\n }\n }\n @action\n handleFocusIn(select1: Select, event1: FocusEvent): void {\n this.shouldShowErrorFeedback = false;\n if (typeof this.args.onFocusIn === 'function') {\n this.args.onFocusIn(select1, event1);\n }\n // ember-power-select argument\n if (typeof this.args.onFocus === 'function') {\n this.args.onFocus(select1, event1);\n }\n }\n @action\n handleFocusOut(select1: Select, event1: FocusEvent): void {\n if (!this.isOpen) {\n this.shouldShowErrorFeedback = true;\n }\n if (typeof this.args.onFocusOut === 'function') {\n this.args.onFocusOut(select1, event1);\n }\n // ember-power-select argument\n if (typeof this.args.onBlur === 'function') {\n this.args.onBlur(select1, event1);\n }\n }\n @action\n handleChange(selection1: unknown, select1: Select, event1?: Event): void {\n this.shouldShowErrorFeedback = true;\n this.args.onChange(selection1, select1, event1);\n }\n get classes() {\n const { formSelect: formSelect1 } = useStyles();\n const { base: base1, label: label1, select: select1, hint: hint1, feedback: feedback1 } = formSelect1({\n size: this.args.size\n });\n return {\n base: base1({\n class: this.args.containerClass\n }),\n label: label1(),\n select: select1(),\n hint: hint1(),\n feedback: feedback1()\n };\n }\n static{\n template(`\n <FormField @size={{@size}} class={{this.classes.base}} as |f|>\n\n {{#if @label}}\n <f.Label @for=\"\" id={{f.id}} @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 {{! @glint-nocheck: need to fix powerselect types}}\n {{#let (if @isMultiple PowerSelectMultiple PowerSelect) as |Component|}}\n <Component\n ...attributes\n @onChange={{this.handleChange}}\n @onFocus={{this.handleFocusIn}}\n @onBlur={{this.handleFocusOut}}\n @onOpen={{this.handleOpen}}\n @onClose={{this.handleClose}}\n @ariaDescribedBy=\"{{if @hint f.hintId}} {{if\n this.showErrorFeedback\n (concat ' ' f.feedbackId)\n }}{{if @ariaDescribedBy (concat ' ' @ariaDescribedBy)}}\"\n @ariaLabelledBy=\"{{if @label f.id}} {{if\n @ariaLabelledBy\n (concat ' ' @ariaLabelledBy)\n }}\"\n @ariaInvalid={{if this.showErrorFeedback \"true\"}}\n @triggerClass=\"{{@triggerClass}} {{if\n @size\n (concat 'ember-power-select-trigger-' @size)\n }} {{this.classes.select}}\"\n @highlightOnHover={{@highlightOnHover}}\n @placeholderComponent={{@placeholderComponent}}\n @searchMessage={{@searchMessage}}\n @noMatchesMessage={{@noMatchesMessage}}\n @matchTriggerWidth={{@matchTriggerWidth}}\n @options={{@options}}\n @selected={{@selected}}\n @closeOnSelect={{@closeOnSelect}}\n @defaultHighlighted={{@defaultHighlighted}}\n @searchField={{@searchField}}\n @searchEnabled={{@searchEnabled}}\n @tabindex={{@tabindex}}\n @triggerComponent={{@triggerComponent}}\n @matcher={{@matcher}}\n @initiallyOpened={{@initiallyOpened}}\n @typeAheadOptionMatcher={{@typeAheadOptionMatcher}}\n @buildSelection={{@buildSelection}}\n @search={{@search}}\n @onInput={{@onInput}}\n @onKeydown={{@onKeydown}}\n @scrollTo={{@scrollTo}}\n @registerAPI={{@registerAPI}}\n @horizontalPosition={{@horizontalPosition}}\n @destination={{@destination}}\n @preventScroll={{@preventScroll}}\n @renderInPlace={{@renderInPlace}}\n @verticalPosition={{@verticalPosition}}\n @disabled={{@disabled}}\n @calculatePosition={{@calculatePosition}}\n @eventType={{@eventType}}\n @ariaLabel={{@ariaLabel}}\n @required={{@required}}\n @triggerRole={{@triggerRole}}\n @title={{@title}}\n @triggerId={{@triggerId}}\n @allowClear={{@allowClear}}\n @loadingMessage={{@loadingMessage}}\n @selectedItemComponent={{@selectedItemComponent}}\n @dropdownClass={{@dropdownClass}}\n @beforeOptionsComponent={{@beforeOptionsComponent}}\n @placeholder={{@placeholder}}\n @searchPlaceholder={{@searchPlaceholder}}\n @searchMessageComponent={{@searchMessageComponent}}\n @optionsComponent={{@optionsComponent}}\n @extra={{@extra}}\n @groupComponent={{@groupComponent}}\n @afterOptionsComponent={{@afterOptionsComponent}}\n as |option term|\n >\n {{yield option term}}\n </Component>\n {{/let}}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback @class={{this.classes.feedback}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormSelect","_class","_class2","Component","constructor","owner1","args1","_initializerDefineProperty","_descriptor","_descriptor2","assert","args","onChange","showErrorFeedback","hasError","showError","hasSubmitted","shouldShowErrorFeedback","errors","length","handleOpen","select1","event1","isOpen","onOpen","handleClose","onClose","handleFocusIn","onFocusIn","onFocus","handleFocusOut","onFocusOut","onBlur","handleChange","selection1","classes","formSelect","formSelect1","useStyles","base","base1","label","label1","select","hint","hint1","feedback","feedback1","size","class","containerClass","setComponentTemplate","precompileTemplate","scope","FormField","PowerSelectMultiple","PowerSelect","concat","strictMode","_applyDecoratedDescriptor","prototype","tracked","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;;;;AAiCqBA,IAAAA,UAAU,IAAAC,MAAA,IAAAC,OAAA,GAAhB,MAAMF,UAAU,SAASG,SAAS,CAAsB;AAKnEC,EAAAA,WAAWA,CAACC,MAAe,EAAEC,KAAqB,EAAC;AAC/C,IAAA,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC,CAAA;AAACC,IAAAA,0BAAA,kCAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,iBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AACrBC,IAAAA,MAAM,CAAC,+CAA+C,EAAE,IAAI,CAACC,IAAI,CAACC,QAAQ,IAAI,OAAO,IAAI,CAACD,IAAI,CAAC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A1D,MAAA,CAAA2D,SAAA,EAebM,YAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAnE,MAAA,CAAA2D,SAAA,EAAA3D,YAAAA,CAAAA,EAAAA,MAAA,CAAA2D,SAAA,CAAA,EAAAD,yBAAA,CAAA1D,MAAA,CAAA2D,SAAA,EAQNM,aAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAnE,MAAA,CAAA2D,SAAA,EAAA3D,aAAAA,CAAAA,EAAAA,MAAA,CAAA2D,SAAA,CAAA,EAAAD,yBAAA,CAAA1D,MAAA,CAAA2D,SAAA,EAAA,eAAA,EAAA,CAQNM,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAnE,MAAA,CAAA2D,SAAA,EAAA,eAAA,CAAA,EAAA3D,MAAA,CAAA2D,SAAA,CAAAD,EAAAA,yBAAA,CAAA1D,MAAA,CAAA2D,SAAA,EAAA,gBAAA,EAAA,CAWNM,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAnE,MAAA,CAAA2D,SAAA,EAAA,gBAAA,CAAA,EAAA3D,MAAA,CAAA2D,SAAA,GAAAD,yBAAA,CAAA1D,MAAA,CAAA2D,SAAA,EAaNM,cAAAA,EAAAA,CAAAA,MAAM,CAAAC,EAAAA,MAAA,CAAAC,wBAAA,CAAAnE,MAAA,CAAA2D,SAAA,mBAAA3D,MAAA,CAAA2D,SAAA,CAAA,GAAA3D,MAAA;;;;"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { FormInputBase } from './form-input.js';
|
|
2
|
-
import { on } from '@ember/modifier';
|
|
3
|
-
import { concat } from '@ember/helper';
|
|
4
|
-
import { useStyles } from '@frontile/theme';
|
|
5
|
-
import FormField from './form-field.js';
|
|
6
|
-
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
|
-
import { setComponentTemplate } from '@ember/component';
|
|
8
|
-
|
|
9
|
-
var _class;
|
|
10
|
-
class FormTextarea extends FormInputBase {
|
|
11
|
-
get classes() {
|
|
12
|
-
const {
|
|
13
|
-
formInput: formInput1
|
|
14
|
-
} = useStyles();
|
|
15
|
-
const {
|
|
16
|
-
base: base1,
|
|
17
|
-
label: label1,
|
|
18
|
-
input: input1,
|
|
19
|
-
hint: hint1,
|
|
20
|
-
feedback: feedback1
|
|
21
|
-
} = formInput1({
|
|
22
|
-
size: this.args.size
|
|
23
|
-
});
|
|
24
|
-
return {
|
|
25
|
-
base: base1({
|
|
26
|
-
class: this.args.containerClass
|
|
27
|
-
}),
|
|
28
|
-
label: label1(),
|
|
29
|
-
input: input1({
|
|
30
|
-
class: this.args.inputClass
|
|
31
|
-
}),
|
|
32
|
-
hint: hint1(),
|
|
33
|
-
feedback: feedback1()
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
_class = FormTextarea;
|
|
38
|
-
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.Textarea {{on \"focus\" this.handleFocusIn}} {{on \"blur\" this.handleFocusOut}} @onInput={{@onInput}} @onChange={{@onChange}} @value={{@value}} @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 ", {
|
|
39
|
-
scope: () => ({
|
|
40
|
-
FormField,
|
|
41
|
-
concat,
|
|
42
|
-
on
|
|
43
|
-
}),
|
|
44
|
-
strictMode: true
|
|
45
|
-
}), _class);
|
|
46
|
-
|
|
47
|
-
export { FormTextarea as default };
|
|
48
|
-
//# sourceMappingURL=form-textarea.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form-textarea.js","sources":["../../src/components/form-textarea.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport { FormInputBase, type FormInputBaseSignature } from './form-input';\nimport { on } from '@ember/modifier';\nimport { concat } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nimport FormField from './form-field';\nexport interface FormTextareaSignature extends FormInputBaseSignature {\n Element: HTMLTextAreaElement;\n Blocks: {\n default: [];\n };\n}\nexport default class FormTextarea extends FormInputBase<FormTextareaSignature> {\n get classes() {\n const { formInput: formInput1 } = useStyles();\n const { base: base1, label: label1, input: input1, hint: hint1, feedback: feedback1 } = formInput1({\n size: this.args.size\n });\n return {\n base: base1({\n class: this.args.containerClass\n }),\n label: label1(),\n input: input1({\n class: this.args.inputClass\n }),\n hint: hint1(),\n feedback: feedback1()\n };\n }\n static{\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.Textarea\n {{on \"focus\" this.handleFocusIn}}\n {{on \"blur\" this.handleFocusOut}}\n @onInput={{@onInput}}\n @onChange={{@onChange}}\n @value={{@value}}\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 `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormTextarea","FormInputBase","classes","formInput","formInput1","useStyles","base","base1","label","label1","input","input1","hint","hint1","feedback","feedback1","size","args","class","containerClass","inputClass","_class","setComponentTemplate","precompileTemplate","scope","FormField","concat","on","strictMode"],"mappings":";;;;;;;;;AAYe,MAAMA,YAAY,SAASC,aAAa,CAAwB;EAC3E,IAAIC,OAAOA,GAAG;IACV,MAAM;AAAEC,MAAAA,SAAS,EAAEC,UAAAA;KAAY,GAAGC,SAAS,EAAE,CAAA;IAC7C,MAAM;AAAEC,MAAAA,IAAI,EAAEC,KAAK;AAAEC,MAAAA,KAAK,EAAEC,MAAM;AAAEC,MAAAA,KAAK,EAAEC,MAAM;AAAEC,MAAAA,IAAI,EAAEC,KAAK;AAAEC,MAAAA,QAAQ,EAAEC,SAAAA;KAAW,GAAGX,UAAU,CAAC;AAC/FY,MAAAA,IAAI,EAAE,IAAI,CAACC,IAAI,CAACD,IAAAA;AACpB,KAAC,CAAC,CAAA;IACF,OAAO;MACHV,IAAI,EAAEC,KAAK,CAAC;AACRW,QAAAA,KAAK,EAAE,IAAI,CAACD,IAAI,CAACE,cAAAA;AACrB,OAAC,CAAC;MACFX,KAAK,EAAEC,MAAM,EAAE;MACfC,KAAK,EAAEC,MAAM,CAAC;AACVO,QAAAA,KAAK,EAAE,IAAI,CAACD,IAAI,CAACG,UAAAA;AACrB,OAAC,CAAC;MACFR,IAAI,EAAEC,KAAK,EAAE;MACbC,QAAQ,EAAEC,SAAS,EAAC;KACvB,CAAA;AACL,GAAA;AA4CJ,CAAA;AAACM,MAAA,GA7DoBrB,YAAY,CAAA;AAmBzBsB,oBAAA,CAAAC,kBAAA,CAmCH,o1BAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;IAAAC,MAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAP,MAAA,CAAA;;;;"}
|