@frontile/forms 0.17.0-alpha.9 → 0.17.0-beta.10
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/checkbox-group.d.ts +41 -0
- package/declarations/components/checkbox-group.d.ts.map +1 -0
- package/declarations/components/checkbox.d.ts +39 -0
- package/declarations/components/checkbox.d.ts.map +1 -0
- package/declarations/components/form-control.d.ts +47 -0
- package/declarations/components/form-control.d.ts.map +1 -0
- package/declarations/components/form-description.d.ts +19 -0
- package/declarations/components/form-description.d.ts.map +1 -0
- package/declarations/components/form-feedback.d.ts +23 -0
- package/declarations/components/form-feedback.d.ts.map +1 -0
- package/declarations/components/form.d.ts +19 -0
- package/declarations/components/form.d.ts.map +1 -0
- package/declarations/components/icons.d.ts +8 -0
- package/declarations/components/icons.d.ts.map +1 -0
- package/declarations/components/input.d.ts +140 -0
- package/declarations/components/input.d.ts.map +1 -0
- package/declarations/components/label.d.ts +41 -0
- package/declarations/components/label.d.ts.map +1 -0
- package/declarations/components/native-select.d.ts +96 -21
- package/declarations/components/native-select.d.ts.map +1 -1
- package/declarations/components/radio-group.d.ts +44 -0
- package/declarations/components/radio-group.d.ts.map +1 -0
- package/declarations/components/radio.d.ts +40 -0
- package/declarations/components/radio.d.ts.map +1 -0
- package/declarations/components/select.d.ts +240 -16
- package/declarations/components/select.d.ts.map +1 -1
- package/declarations/components/switch.d.ts +148 -0
- package/declarations/components/switch.d.ts.map +1 -0
- package/declarations/components/textarea.d.ts +68 -0
- package/declarations/components/textarea.d.ts.map +1 -0
- package/declarations/index.d.ts +13 -2
- package/declarations/index.d.ts.map +1 -1
- package/declarations/template-registry.d.ts +13 -30
- package/declarations/template-registry.d.ts.map +1 -1
- package/declarations/test-support.d.ts +3 -0
- package/declarations/test-support.d.ts.map +1 -0
- package/declarations/utils/index.d.ts +3 -0
- package/declarations/utils/index.d.ts.map +1 -0
- package/dist/_app_/components/checkbox-group.js +1 -0
- package/dist/_app_/components/checkbox.js +1 -0
- package/dist/_app_/components/form-control.js +1 -0
- package/dist/_app_/components/form-description.js +1 -0
- package/dist/_app_/components/form-feedback.js +1 -0
- package/dist/_app_/components/form.js +1 -0
- package/dist/_app_/components/icons.js +1 -0
- package/dist/_app_/components/input.js +1 -0
- package/dist/_app_/components/label.js +1 -0
- package/dist/_app_/components/radio-group.js +1 -0
- package/dist/_app_/components/radio.js +1 -0
- package/dist/_app_/components/switch.js +1 -0
- package/dist/_app_/components/textarea.js +1 -0
- package/dist/components/checkbox-group.js +29 -0
- package/dist/components/checkbox-group.js.map +1 -0
- package/dist/components/checkbox.js +44 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/form-control.js +61 -0
- package/dist/components/form-control.js.map +1 -0
- package/dist/components/form-description.js +24 -0
- package/dist/components/form-description.js.map +1 -0
- package/dist/components/form-feedback.js +36 -0
- package/dist/components/form-feedback.js.map +1 -0
- package/dist/components/form.js +43 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/icons.js +13 -0
- package/dist/components/icons.js.map +1 -0
- package/dist/components/input.js +100 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.js +23 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/native-select.js +60 -56
- package/dist/components/native-select.js.map +1 -1
- package/dist/components/radio-group.js +29 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/radio.js +43 -0
- package/dist/components/radio.js.map +1 -0
- package/dist/components/select.js +131 -78
- package/dist/components/select.js.map +1 -1
- package/dist/components/switch.js +60 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/textarea.js +47 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/index-CeaQc-U7.js +23 -0
- package/dist/index-CeaQc-U7.js.map +1 -0
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime-BPCpkOf1-YDR_IEBR.js +67 -0
- package/dist/runtime-BPCpkOf1-YDR_IEBR.js.map +1 -0
- package/dist/test-support.js +1337 -0
- package/dist/test-support.js.map +1 -0
- package/package.json +69 -72
- package/declarations/components/form-checkbox-group.d.ts +0 -50
- package/declarations/components/form-checkbox-group.d.ts.map +0 -1
- package/declarations/components/form-checkbox.d.ts +0 -49
- package/declarations/components/form-checkbox.d.ts.map +0 -1
- package/declarations/components/form-field/checkbox.d.ts +0 -19
- package/declarations/components/form-field/checkbox.d.ts.map +0 -1
- package/declarations/components/form-field/feedback.d.ts +0 -21
- package/declarations/components/form-field/feedback.d.ts.map +0 -1
- package/declarations/components/form-field/hint.d.ts +0 -17
- package/declarations/components/form-field/hint.d.ts.map +0 -1
- package/declarations/components/form-field/input.d.ts +0 -21
- package/declarations/components/form-field/input.d.ts.map +0 -1
- package/declarations/components/form-field/label.d.ts +0 -17
- package/declarations/components/form-field/label.d.ts.map +0 -1
- package/declarations/components/form-field/radio.d.ts +0 -20
- package/declarations/components/form-field/radio.d.ts.map +0 -1
- package/declarations/components/form-field/select.d.ts +0 -38
- package/declarations/components/form-field/select.d.ts.map +0 -1
- package/declarations/components/form-field/textarea.d.ts +0 -19
- package/declarations/components/form-field/textarea.d.ts.map +0 -1
- package/declarations/components/form-field.d.ts +0 -38
- package/declarations/components/form-field.d.ts.map +0 -1
- package/declarations/components/form-input.d.ts +0 -64
- package/declarations/components/form-input.d.ts.map +0 -1
- package/declarations/components/form-radio-group.d.ts +0 -48
- package/declarations/components/form-radio-group.d.ts.map +0 -1
- package/declarations/components/form-radio.d.ts +0 -54
- package/declarations/components/form-radio.d.ts.map +0 -1
- package/declarations/components/form-select.d.ts +0 -51
- package/declarations/components/form-select.d.ts.map +0 -1
- package/declarations/components/form-textarea.d.ts +0 -17
- package/declarations/components/form-textarea.d.ts.map +0 -1
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type FormFieldFeedback from './components/form-field/feedback';
|
|
3
|
-
import type FormFieldHint from './components/form-field/hint';
|
|
4
|
-
import type FormFieldInput from './components/form-field/input';
|
|
5
|
-
import type FormFieldLabel from './components/form-field/label';
|
|
6
|
-
import type FormFieldRadio from './components/form-field/radio';
|
|
7
|
-
import type FormFieldTextarea from './components/form-field/textarea';
|
|
8
|
-
import type FormCheckboxGroup from './components/form-checkbox-group';
|
|
9
|
-
import type FormCheckbox from './components/form-checkbox';
|
|
10
|
-
import type FormField from './components/form-field';
|
|
11
|
-
import type FormInput from './components/form-input';
|
|
12
|
-
import type FormRadioGroup from './components/form-radio-group';
|
|
13
|
-
import type FormRadio from './components/form-radio';
|
|
14
|
-
import type FormSelect from './components/form-select';
|
|
15
|
-
import type FormTextarea from './components/form-textarea';
|
|
1
|
+
import type { Form, Checkbox, FormDescription, FormFeedback, Input, Label, NativeSelect, Select, Textarea, FormControl, RadioGroup, CheckboxGroup } from './index';
|
|
16
2
|
export default interface Registry {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
FormRadio: typeof FormRadio;
|
|
30
|
-
FormSelect: typeof FormSelect;
|
|
31
|
-
FormTextarea: typeof FormTextarea;
|
|
3
|
+
Form: typeof Form;
|
|
4
|
+
Checkbox: typeof Checkbox;
|
|
5
|
+
FormDescription: typeof FormDescription;
|
|
6
|
+
FormFeedback: typeof FormFeedback;
|
|
7
|
+
Input: typeof Input;
|
|
8
|
+
Label: typeof Label;
|
|
9
|
+
NativeSelect: typeof NativeSelect;
|
|
10
|
+
Select: typeof Select;
|
|
11
|
+
Textarea: typeof Textarea;
|
|
12
|
+
FormControl: typeof FormControl;
|
|
13
|
+
CheckboxGroup: typeof CheckboxGroup;
|
|
14
|
+
RadioGroup: typeof RadioGroup;
|
|
32
15
|
}
|
|
33
16
|
//# sourceMappingURL=template-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,WAAW,QAAQ;IAC/B,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,eAAe,EAAE,OAAO,eAAe,CAAC;IACxC,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,YAAY,EAAE,OAAO,YAAY,CAAC;IAClC,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,UAAU,EAAE,OAAO,UAAU,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../src/test-support.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAGA,iBAAS,qBAAqB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAkBjE;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/checkbox-group";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/checkbox";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/form-control";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/form-description";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/form-feedback";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/form";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/icons";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/input";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/label";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/radio-group";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/radio";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/switch";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/textarea";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { Checkbox } from './checkbox.js';
|
|
3
|
+
import { FormControl } from './form-control.js';
|
|
4
|
+
import { useStyles } from '@frontile/theme';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
|
|
8
|
+
class CheckboxGroup extends Component {
|
|
9
|
+
get classes() {
|
|
10
|
+
const {
|
|
11
|
+
checkboxGroup
|
|
12
|
+
} = useStyles();
|
|
13
|
+
return checkboxGroup({
|
|
14
|
+
size: this.args.size
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
setComponentTemplate(precompileTemplate("\n <FormControl @size={{@size}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @class={{this.classes.base class=@classes.base}} ...attributes as |c|>\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n <div class={{this.classes.optionsContainer class=@classes.optionsContainer}} data-orientation={{if @orientation @orientation \"vertical\"}}>\n {{yield (component Checkbox name=@name onChange=@onChange size=@size) to=\"default\"}}\n </div>\n </FormControl>\n ", {
|
|
19
|
+
strictMode: true,
|
|
20
|
+
scope: () => ({
|
|
21
|
+
FormControl,
|
|
22
|
+
Checkbox
|
|
23
|
+
})
|
|
24
|
+
}), this);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { CheckboxGroup, CheckboxGroup as default };
|
|
29
|
+
//# sourceMappingURL=checkbox-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-group.js","sources":["../../src/components/checkbox-group.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { Checkbox, type CheckboxSignature } from './checkbox';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type CheckboxGroupVariants,\n type CheckboxGroupSlots,\n type SlotsToClasses\n} from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface Args extends FormControlSharedArgs {\n name?: string;\n onChange?: CheckboxSignature['Args']['onChange'];\n size?: CheckboxGroupVariants['size'];\n classes?: SlotsToClasses<CheckboxGroupSlots>;\n\n /*\n *\n * @defaultValue 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n}\n\ninterface CheckboxGroupSignature {\n Args: Args;\n Blocks: {\n default: [Checkbox: WithBoundArgs<typeof Checkbox, 'name' | 'onChange'>];\n };\n Element: HTMLDivElement;\n}\n\nclass CheckboxGroup extends Component<CheckboxGroupSignature> {\n get classes() {\n const { checkboxGroup } = useStyles();\n return checkboxGroup({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n ...attributes\n as |c|\n >\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n <div\n class={{this.classes.optionsContainer class=@classes.optionsContainer}}\n data-orientation={{if @orientation @orientation \"vertical\"}}\n >\n {{yield\n (component Checkbox name=@name onChange=@onChange size=@size)\n to=\"default\"\n }}\n </div>\n </FormControl>\n </template>\n}\n\nexport { CheckboxGroup, type CheckboxGroupSignature };\nexport default CheckboxGroup;\n"],"names":["CheckboxGroup","Component","classes","checkboxGroup","useStyles","size","args","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Checkbox"],"mappings":";;;;;;;AAgCA,MAAMA,sBAAsBC,SAAU,CAAA;EACpC,IAAIC,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAe,GAAGC,SAAA,EAAA;AAC1B,IAAA,OAAOD,aAAc,CAAA;AACnBE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD;AAClB,KAAA,CAAA;AACF;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAwBA,ulBAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import { on } from '@ember/modifier';
|
|
4
|
+
import { FormControl } from './form-control.js';
|
|
5
|
+
import { useStyles } from '@frontile/theme';
|
|
6
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
|
+
import { setComponentTemplate } from '@ember/component';
|
|
8
|
+
import { d as decorateMethodV2 } from '../runtime-BPCpkOf1-YDR_IEBR.js';
|
|
9
|
+
|
|
10
|
+
class Checkbox extends Component {
|
|
11
|
+
get isChecked() {
|
|
12
|
+
return !!this.args.checked;
|
|
13
|
+
}
|
|
14
|
+
handleChange(event) {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
const value = !this.args.checked;
|
|
17
|
+
if (typeof this.args.onChange === 'function') {
|
|
18
|
+
this.args.onChange(value, event);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
decorateMethodV2(this.prototype, "handleChange", [action]);
|
|
23
|
+
}
|
|
24
|
+
get classes() {
|
|
25
|
+
const {
|
|
26
|
+
checkbox
|
|
27
|
+
} = useStyles();
|
|
28
|
+
return checkbox({
|
|
29
|
+
size: this.args.size
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static {
|
|
33
|
+
setComponentTemplate(precompileTemplate("\n <FormControl @isInvalid={{@isInvalid}} @errors={{@errors}} @size={{@size}} @isRequired={{@isRequired}} @class={{this.classes.base class=@classes.base}} @preventErrorFeedback={{true}} as |c|>\n <input {{on \"change\" this.handleChange}} id={{c.id}} name={{@name}} checked={{this.isChecked}} type=\"checkbox\" class={{this.classes.input class=@classes.input}} data-component=\"checkbox\" aria-invalid={{if c.isInvalid \"true\"}} aria-describedby={{c.describedBy @description c.isInvalid}} ...attributes />\n <div class={{this.classes.labelContainer class=@classes.labelContainer}}>\n {{#if @label}}\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n ", {
|
|
34
|
+
strictMode: true,
|
|
35
|
+
scope: () => ({
|
|
36
|
+
FormControl,
|
|
37
|
+
on
|
|
38
|
+
})
|
|
39
|
+
}), this);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { Checkbox, Checkbox as default };
|
|
44
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","sources":["../../src/components/checkbox.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type CheckboxVariants,\n type CheckboxSlots,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface Args extends FormControlSharedArgs {\n checked?: boolean;\n name?: string;\n size?: CheckboxVariants['size'];\n classes?: SlotsToClasses<CheckboxSlots>;\n\n /*\n * Callback when onchange is triggered\n */\n onChange?: (value: boolean, event: Event) => void;\n}\n\ninterface CheckboxSignature {\n Args: Args;\n Element: HTMLInputElement;\n}\n\nclass Checkbox extends Component<CheckboxSignature> {\n get isChecked(): boolean {\n return !!this.args.checked;\n }\n\n @action handleChange(event: Event): void {\n event.preventDefault();\n\n const value = !this.args.checked;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n }\n\n get classes() {\n const { checkbox } = useStyles();\n return checkbox({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @isInvalid={{@isInvalid}}\n @errors={{@errors}}\n @size={{@size}}\n @isRequired={{@isRequired}}\n @class={{this.classes.base class=@classes.base}}\n @preventErrorFeedback={{true}}\n as |c|\n >\n <input\n {{on \"change\" this.handleChange}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isChecked}}\n type=\"checkbox\"\n class={{this.classes.input class=@classes.input}}\n data-component=\"checkbox\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n <div class={{this.classes.labelContainer class=@classes.labelContainer}}>\n {{#if @label}}\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Checkbox, type CheckboxSignature };\nexport default Checkbox;\n"],"names":["Checkbox","Component","isChecked","args","checked","handleChange","event","preventDefault","value","onChange","n","prototype","action","classes","checkbox","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;;;AA4BA,MAAMA,iBAAiBC,SAAU,CAAA;EAC/B,IAAIC,SAAAA,GAAqB;AACvB,IAAA,OAAO,CAAC,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO;AAC5B;EAEQC,YAAAA,CAAaC,KAAY,EAAQ;IACvCA,KAAA,CAAMC,cAAc,EAAA;AAEpB,IAAA,MAAMC,QAAQ,CAAC,IAAI,CAACL,IAAI,CAACC,OAAO;IAEhC,IAAI,OAAO,IAAI,CAACD,IAAI,CAACM,QAAQ,KAAK,UAAY,EAAA;MAC5C,IAAI,CAACN,IAAI,CAACM,QAAQ,CAACD,KAAO,EAAAF,KAAA,CAAA;AAC5B;AACF;AAAA,EAAA;IAAAI,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CARCC,MAAA,CAAA,CAAA;AAAA;EAUD,IAAIC,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAU,GAAGC,SAAA,EAAA;AACrB,IAAA,OAAOD,QAAS,CAAA;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACb,IAAI,CAACa;AAClB,KAAA,CAAA;AACF;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAoCA,48BAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { guidFor } from '@ember/object/internals';
|
|
3
|
+
import { hash } from '@ember/helper';
|
|
4
|
+
import { FormFeedback } from './form-feedback.js';
|
|
5
|
+
import { FormDescription } from './form-description.js';
|
|
6
|
+
import { Label } from './label.js';
|
|
7
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
|
+
import { setComponentTemplate } from '@ember/component';
|
|
9
|
+
|
|
10
|
+
function or(arg1, arg2) {
|
|
11
|
+
return !!(arg1 || arg2);
|
|
12
|
+
}
|
|
13
|
+
class FormControl extends Component {
|
|
14
|
+
id = this.args.id || guidFor(this);
|
|
15
|
+
get descriptionId() {
|
|
16
|
+
return this.id + '-description';
|
|
17
|
+
}
|
|
18
|
+
get feedbackId() {
|
|
19
|
+
return this.id + '-feedback';
|
|
20
|
+
}
|
|
21
|
+
describedBy = (hasDescription, hasFeedback) => {
|
|
22
|
+
const ids = [];
|
|
23
|
+
if (hasDescription) {
|
|
24
|
+
ids.push(this.descriptionId);
|
|
25
|
+
}
|
|
26
|
+
if (hasFeedback) {
|
|
27
|
+
ids.push(this.feedbackId);
|
|
28
|
+
}
|
|
29
|
+
if (ids.length > 0) {
|
|
30
|
+
return ids.join(' ');
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
get isInvalid() {
|
|
34
|
+
if (this.args.isInvalid || this.args.errors && this.args.errors.length > 0) {
|
|
35
|
+
return true;
|
|
36
|
+
} else {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
get showErrorFeedback() {
|
|
41
|
+
if (!(this.args.preventErrorFeedback === true) && this.isInvalid) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
static {
|
|
47
|
+
setComponentTemplate(precompileTemplate("\n <div class={{@class}} ...attributes>\n {{#if (or @label (has-block \"label\"))}}\n <Label @for={{this.id}} @isRequired={{@isRequired}} @size={{@size}}>\n {{@label}}\n {{yield to=\"label\"}}\n </Label>\n {{/if}}\n\n {{#if (or @description (has-block \"Description\"))}}\n <Description @id={{this.descriptionId}} @size={{@size}}>\n {{@description}}\n {{yield to=\"description\"}}\n </Description>\n {{/if}}\n\n {{yield (hash id=this.id isInvalid=this.isInvalid describedBy=this.describedBy Label=(component Label for=this.id size=@size isRequired=@isRequired) Description=(component Description id=this.descriptionId size=@size) Feedback=(component Feedback id=this.feedbackId size=@size messages=@errors intent=\"danger\")) to=\"default\"}}\n\n {{#if this.showErrorFeedback}}\n <Feedback @id={{this.feedbackId}} @size={{@size}} @messages={{@errors}} @intent=\"danger\" />\n {{/if}}\n </div>\n ", {
|
|
48
|
+
strictMode: true,
|
|
49
|
+
scope: () => ({
|
|
50
|
+
or,
|
|
51
|
+
Label,
|
|
52
|
+
Description: FormDescription,
|
|
53
|
+
hash,
|
|
54
|
+
Feedback: FormFeedback
|
|
55
|
+
})
|
|
56
|
+
}), this);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { FormControl, FormControl as default };
|
|
61
|
+
//# sourceMappingURL=form-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control.js","sources":["../../src/components/form-control.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport Feedback from './form-feedback';\nimport Description from './form-description';\nimport Label from './label';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface FormControlSharedArgs {\n label?: string;\n isRequired?: boolean;\n description?: string;\n errors?: string[] | string;\n isInvalid?: boolean;\n}\n\ninterface Args extends FormControlSharedArgs {\n id?: string;\n size?: 'sm' | 'md' | 'lg';\n preventErrorFeedback?: boolean;\n class?: string;\n}\n\ninterface FormControlSignature {\n Args: Args;\n Blocks: {\n default: [\n {\n id: string;\n isInvalid: boolean;\n describedBy: (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ) => string | undefined;\n Label: WithBoundArgs<typeof Label, 'for' | 'size' | 'isRequired'>;\n Description: WithBoundArgs<typeof Description, 'id' | 'size'>;\n Feedback: WithBoundArgs<\n typeof Feedback,\n 'id' | 'size' | 'messages' | 'intent'\n >;\n }\n ];\n label: [];\n description: [];\n };\n Element: HTMLDivElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass FormControl extends Component<FormControlSignature> {\n id = this.args.id || guidFor(this);\n\n get descriptionId(): string {\n return this.id + '-description';\n }\n\n get feedbackId(): string {\n return this.id + '-feedback';\n }\n\n describedBy = (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ): string | undefined => {\n const ids = [];\n\n if (hasDescription) {\n ids.push(this.descriptionId);\n }\n\n if (hasFeedback) {\n ids.push(this.feedbackId);\n }\n\n if (ids.length > 0) {\n return ids.join(' ');\n }\n };\n\n get isInvalid(): boolean {\n if (\n this.args.isInvalid ||\n (this.args.errors && this.args.errors.length > 0)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n get showErrorFeedback(): boolean {\n if (!(this.args.preventErrorFeedback === true) && this.isInvalid) {\n return true;\n }\n return false;\n }\n\n <template>\n <div class={{@class}} ...attributes>\n {{#if (or @label (has-block \"label\"))}}\n <Label @for={{this.id}} @isRequired={{@isRequired}} @size={{@size}}>\n {{@label}}\n {{yield to=\"label\"}}\n </Label>\n {{/if}}\n\n {{#if (or @description (has-block \"Description\"))}}\n <Description @id={{this.descriptionId}} @size={{@size}}>\n {{@description}}\n {{yield to=\"description\"}}\n </Description>\n {{/if}}\n\n {{yield\n (hash\n id=this.id\n isInvalid=this.isInvalid\n describedBy=this.describedBy\n Label=(component Label for=this.id size=@size isRequired=@isRequired)\n Description=(component Description id=this.descriptionId size=@size)\n Feedback=(component\n Feedback\n id=this.feedbackId\n size=@size\n messages=@errors\n intent=\"danger\"\n )\n )\n to=\"default\"\n }}\n\n {{#if this.showErrorFeedback}}\n <Feedback\n @id={{this.feedbackId}}\n @size={{@size}}\n @messages={{@errors}}\n @intent=\"danger\"\n />\n {{/if}}\n </div>\n </template>\n}\n\nexport { FormControl, type FormControlSignature, type FormControlSharedArgs };\nexport default FormControl;\n"],"names":["or","arg1","arg2","FormControl","Component","id","args","guidFor","descriptionId","feedbackId","describedBy","hasDescription","hasFeedback","ids","push","length","join","isInvalid","errors","showErrorFeedback","preventErrorFeedback","setComponentTemplate","precompileTemplate","strictMode","scope","Label","Description","hash","Feedback"],"mappings":";;;;;;;;;AAgDA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,MAAMC,oBAAoBC,SAAU,CAAA;EAClCC,EAAK,GAAA,IAAI,CAACC,IAAI,CAACD,EAAE,IAAIE,OAAA,CAAQ,IAAI,CAAE;EAEnC,IAAIC,aAAAA,GAAwB;AAC1B,IAAA,OAAO,IAAI,CAACH,EAAE,GAAG,cAAA;AACnB;EAEA,IAAII,UAAAA,GAAqB;AACvB,IAAA,OAAO,IAAI,CAACJ,EAAE,GAAG,WAAA;AACnB;AAEAK,EAAAA,WAAA,GAAcA,CACZC,cAAiC,EACjCC,WAA8B,KACX;IACnB,MAAMC,MAAM,EAAE;AAEd,IAAA,IAAIF,cAAgB,EAAA;AAClBE,MAAAA,GAAA,CAAIC,IAAI,CAAC,IAAI,CAACN,aAAa,CAAA;AAC7B;AAEA,IAAA,IAAII,WAAa,EAAA;AACfC,MAAAA,GAAA,CAAIC,IAAI,CAAC,IAAI,CAACL,UAAU,CAAA;AAC1B;AAEA,IAAA,IAAII,GAAA,CAAIE,MAAM,GAAG,CAAG,EAAA;AAClB,MAAA,OAAOF,GAAA,CAAIG,IAAI,CAAC,GAAA,CAAA;AAClB;GACA;EAEF,IAAIC,SAAAA,GAAqB;IACvB,IACE,IAAI,CAACX,IAAI,CAACW,SAAS,IAClB,IAAI,CAACX,IAAI,CAACY,MAAM,IAAI,IAAI,CAACZ,IAAI,CAACY,MAAM,CAACH,MAAM,GAAG,CAC/C,EAAA;AACA,MAAA,OAAO,IAAA;AACT,KAAO,MAAA;AACL,MAAA,OAAO,KAAA;AACT;AACF;EAEA,IAAII,iBAAAA,GAA6B;AAC/B,IAAA,IAAI,EAAE,IAAI,CAACb,IAAI,CAACc,oBAAoB,KAAK,IAAI,CAAA,IAAK,IAAI,CAACH,SAAS,EAAE;AAChE,MAAA,OAAO,IAAA;AACT;AACA,IAAA,OAAO,KAAA;AACT;AAEA,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CA2CA,k/BAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAxB,EAAA;QAAAyB,KAAA;qBAAAC,eAAA;QAAAC,IAAA;AAAAC,kBAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { useStyles } from '@frontile/theme';
|
|
3
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
|
+
import { setComponentTemplate } from '@ember/component';
|
|
5
|
+
|
|
6
|
+
class FormDescription extends Component {
|
|
7
|
+
get classes() {
|
|
8
|
+
const {
|
|
9
|
+
formDescription
|
|
10
|
+
} = useStyles();
|
|
11
|
+
return formDescription({
|
|
12
|
+
size: this.args.size || 'md',
|
|
13
|
+
class: this.args.class
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
static {
|
|
17
|
+
setComponentTemplate(precompileTemplate("\n <div id={{@id}} class={{this.classes}} data-component=\"form-description\" ...attributes>\n {{yield}}\n </div>\n ", {
|
|
18
|
+
strictMode: true
|
|
19
|
+
}), this);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { FormDescription, FormDescription as default };
|
|
24
|
+
//# sourceMappingURL=form-description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-description.js","sources":["../../src/components/form-description.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles, type FormDescriptionVariants } from '@frontile/theme';\n\ninterface FormDescriptionSignature {\n Args: {\n id?: string;\n /*\n * @defaultValue 'md'\n */\n size?: FormDescriptionVariants['size'];\n\n class?: string;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\nclass FormDescription extends Component<FormDescriptionSignature> {\n get classes() {\n const { formDescription } = useStyles();\n\n return formDescription({\n size: this.args.size || 'md',\n class: this.args.class\n });\n }\n\n <template>\n <div\n id={{@id}}\n class={{this.classes}}\n data-component=\"form-description\"\n ...attributes\n >\n {{yield}}\n </div>\n </template>\n}\n\nexport { FormDescription, type FormDescriptionSignature };\nexport default FormDescription;\n"],"names":["FormDescription","Component","classes","formDescription","useStyles","size","args","class","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AAmBA,MAAMA,wBAAwBC,SAAU,CAAA;EACtC,IAAIC,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAiB,GAAGC,SAAA,EAAA;AAE5B,IAAA,OAAOD,eAAgB,CAAA;AACrBE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI,IAAA;AACxBE,MAAAA,KAAA,EAAO,IAAI,CAACD,IAAI,CAACC;AACnB,KAAA,CAAA;AACF;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CASA,kIAAA,EAAA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { useStyles } from '@frontile/theme';
|
|
3
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
|
+
import { setComponentTemplate } from '@ember/component';
|
|
5
|
+
|
|
6
|
+
class FormFeedback extends Component {
|
|
7
|
+
get isError() {
|
|
8
|
+
return typeof this.args.messages !== 'undefined' && (this.args.intent === 'danger' || typeof this.args.intent === 'undefined');
|
|
9
|
+
}
|
|
10
|
+
get classes() {
|
|
11
|
+
const {
|
|
12
|
+
formFeedback
|
|
13
|
+
} = useStyles();
|
|
14
|
+
return formFeedback({
|
|
15
|
+
size: this.args.size || 'md',
|
|
16
|
+
intent: this.args.intent || 'danger',
|
|
17
|
+
class: this.args.class
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
get messageText() {
|
|
21
|
+
if (!this.args.messages) return '';
|
|
22
|
+
if (typeof this.args.messages === 'string') {
|
|
23
|
+
return this.args.messages;
|
|
24
|
+
} else {
|
|
25
|
+
return this.args.messages.join('; ');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
static {
|
|
29
|
+
setComponentTemplate(precompileTemplate("\n <div id={{@id}} class={{this.classes}} data-component=\"form-feedback\" aria-live={{if this.isError \"assertive\" \"polite\"}} ...attributes>\n {{this.messageText}}\n {{yield}}\n </div>\n ", {
|
|
30
|
+
strictMode: true
|
|
31
|
+
}), this);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { FormFeedback, FormFeedback as default };
|
|
36
|
+
//# sourceMappingURL=form-feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-feedback.js","sources":["../../src/components/form-feedback.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles, type FormFeedbackVariants } from '@frontile/theme';\n\ninterface FormFeedbackSignature {\n Args: {\n id?: string;\n /*\n * A list of messages or a single message string\n */\n messages?: string[] | string;\n\n /*\n * The intent of the feedback\n * @defaultValue 'danger'\n */\n intent?: FormFeedbackVariants['intent'];\n\n /*\n * @defaultValue 'md'\n */\n size?: FormFeedbackVariants['size'];\n class?: string;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\nclass FormFeedback extends Component<FormFeedbackSignature> {\n get isError(): boolean {\n return (\n typeof this.args.messages !== 'undefined' &&\n (this.args.intent === 'danger' || typeof this.args.intent === 'undefined')\n );\n }\n\n get classes() {\n const { formFeedback } = useStyles();\n\n return formFeedback({\n size: this.args.size || 'md',\n intent: this.args.intent || 'danger',\n class: this.args.class\n });\n }\n\n get messageText(): string {\n if (!this.args.messages) return '';\n\n if (typeof this.args.messages === 'string') {\n return this.args.messages;\n } else {\n return this.args.messages.join('; ');\n }\n }\n\n <template>\n <div\n id={{@id}}\n class={{this.classes}}\n data-component=\"form-feedback\"\n aria-live={{if this.isError \"assertive\" \"polite\"}}\n ...attributes\n >\n {{this.messageText}}\n {{yield}}\n </div>\n </template>\n}\n\nexport { FormFeedback, type FormFeedbackSignature };\nexport default FormFeedback;\n"],"names":["FormFeedback","Component","isError","args","messages","intent","classes","formFeedback","useStyles","size","class","messageText","join","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA6BA,MAAMA,qBAAqBC,SAAU,CAAA;EACnC,IAAIC,OAAAA,GAAmB;IACrB,OACE,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,KAAK,WAC9B,KAAC,IAAI,CAACD,IAAI,CAACE,MAAM,KAAK,QAAA,IAAY,OAAO,IAAI,CAACF,IAAI,CAACE,MAAM,KAAK,WAAW,CAC3E;AACF;EAEA,IAAIC,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAc,GAAGC,SAAA,EAAA;AAEzB,IAAA,OAAOD,YAAa,CAAA;AAClBE,MAAAA,IAAA,EAAM,IAAI,CAACN,IAAI,CAACM,IAAI,IAAI,IAAA;AACxBJ,MAAAA,MAAA,EAAQ,IAAI,CAACF,IAAI,CAACE,MAAM,IAAI,QAAA;AAC5BK,MAAAA,KAAA,EAAO,IAAI,CAACP,IAAI,CAACO;AACnB,KAAA,CAAA;AACF;EAEA,IAAIC,WAAAA,GAAsB;IACxB,IAAI,CAAC,IAAI,CAACR,IAAI,CAACC,QAAQ,EAAE,OAAO,EAAA;IAEhC,IAAI,OAAO,IAAI,CAACD,IAAI,CAACC,QAAQ,KAAK,QAAU,EAAA;AAC1C,MAAA,OAAO,IAAI,CAACD,IAAI,CAACC,QAAQ;AAC3B,KAAO,MAAA;MACL,OAAO,IAAI,CAACD,IAAI,CAACC,QAAQ,CAACQ,IAAI,CAAC,IAAA,CAAA;AACjC;AACF;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAWA,kNAAA,EAAA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { on } from '@ember/modifier';
|
|
3
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
|
+
import { setComponentTemplate } from '@ember/component';
|
|
5
|
+
|
|
6
|
+
class Form extends Component {
|
|
7
|
+
handleInput = (event, eventType = 'input') => {
|
|
8
|
+
const form = event.currentTarget;
|
|
9
|
+
if (form instanceof HTMLFormElement) {
|
|
10
|
+
let formData = new FormData(form);
|
|
11
|
+
for (let i = 0; i < form.elements.length; i++) {
|
|
12
|
+
const element = form.elements[i];
|
|
13
|
+
if (element.type === 'select-multiple') {
|
|
14
|
+
const selectedValues = [];
|
|
15
|
+
for (let j = 0; j < element.options.length; j++) {
|
|
16
|
+
const option = element.options[j];
|
|
17
|
+
if (option && option.selected) {
|
|
18
|
+
selectedValues.push(option.value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
formData.append(element.name, selectedValues.join(','));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
let data = Object.fromEntries(formData.entries());
|
|
25
|
+
this.args.onChange(data, eventType, event);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
handleSubmit = event => {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
this.handleInput(event, 'submit');
|
|
31
|
+
};
|
|
32
|
+
static {
|
|
33
|
+
setComponentTemplate(precompileTemplate("\n <form {{on \"input\" this.handleInput}} {{on \"submit\" this.handleSubmit}} ...attributes>\n {{yield}}\n </form>\n ", {
|
|
34
|
+
strictMode: true,
|
|
35
|
+
scope: () => ({
|
|
36
|
+
on
|
|
37
|
+
})
|
|
38
|
+
}), this);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { Form, Form as default };
|
|
43
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sources":["../../src/components/form.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\n\ntype FormDataEntryValue = NonNullable<ReturnType<FormData['get']>>;\ntype FormResultData = Record<string, FormDataEntryValue>;\n\ninterface FormSignature {\n Element: HTMLFormElement;\n Args: {\n onChange: (\n data: FormResultData,\n eventType: 'input' | 'submit',\n event: Event | SubmitEvent\n ) => void;\n };\n Blocks: {\n default: [];\n };\n}\n\nclass Form extends Component<FormSignature> {\n handleInput = (\n event: Event | SubmitEvent,\n eventType: 'input' | 'submit' = 'input'\n ) => {\n const form = event.currentTarget;\n if (form instanceof HTMLFormElement) {\n let formData = new FormData(form);\n\n for (let i = 0; i < form.elements.length; i++) {\n const element = form.elements[i] as HTMLSelectElement;\n if (element.type === 'select-multiple') {\n const selectedValues = [];\n for (let j = 0; j < element.options.length; j++) {\n const option = element.options[j];\n if (option && option.selected) {\n selectedValues.push(option.value);\n }\n }\n formData.append(element.name, selectedValues.join(','));\n }\n }\n\n let data = Object.fromEntries(formData.entries());\n\n this.args.onChange(data, eventType, event);\n }\n };\n\n handleSubmit = (event: SubmitEvent) => {\n event.preventDefault();\n this.handleInput(event, 'submit');\n };\n\n <template>\n <form\n {{on \"input\" this.handleInput}}\n {{on \"submit\" this.handleSubmit}}\n ...attributes\n >\n {{yield}}\n </form>\n </template>\n}\n\nexport { Form, type FormSignature, type FormResultData };\nexport default Form;\n"],"names":["Form","Component","handleInput","event","eventType","form","currentTarget","HTMLFormElement","formData","FormData","i","elements","length","element","type","selectedValues","j","options","option","selected","push","value","append","name","join","data","Object","fromEntries","entries","args","onChange","handleSubmit","preventDefault","setComponentTemplate","precompileTemplate","strictMode","scope","on"],"mappings":";;;;;AAoBA,MAAMA,aAAaC,SAAU,CAAA;AAC3BC,EAAAA,WAAA,GAAcA,CACZC,OACAC,YAAgC,OAAO,KAAA;AAEvC,IAAA,MAAMC,IAAA,GAAOF,MAAMG,aAAa;IAChC,IAAID,gBAAgBE,eAAiB,EAAA;AACnC,MAAA,IAAIC,QAAA,GAAW,IAAIC,QAAS,CAAAJ,IAAA,CAAA;AAE5B,MAAA,KAAK,IAAIK,IAAI,CAAG,EAAAA,CAAA,GAAIL,KAAKM,QAAQ,CAACC,MAAM,EAAEF,CAAK,EAAA,EAAA;AAC7C,QAAA,MAAMG,OAAU,GAAAR,IAAA,CAAKM,QAAQ,CAACD,EAAM;AACpC,QAAA,IAAIG,OAAA,CAAQC,IAAI,KAAK,iBAAmB,EAAA;UACtC,MAAMC,iBAAiB,EAAE;AACzB,UAAA,KAAK,IAAIC,IAAI,CAAG,EAAAA,CAAA,GAAIH,QAAQI,OAAO,CAACL,MAAM,EAAEI,CAAK,EAAA,EAAA;AAC/C,YAAA,MAAME,MAAS,GAAAL,OAAA,CAAQI,OAAO,CAACD,CAAE,CAAA;AACjC,YAAA,IAAIE,MAAA,IAAUA,MAAO,CAAAC,QAAQ,EAAE;AAC7BJ,cAAAA,cAAe,CAAAK,IAAI,CAACF,MAAA,CAAOG,KAAK,CAAA;AAClC;AACF;AACAb,UAAAA,QAAA,CAASc,MAAM,CAACT,OAAA,CAAQU,IAAI,EAAER,cAAA,CAAeS,IAAI,CAAC,GAAA,CAAA,CAAA;AACpD;AACF;MAEA,IAAIC,IAAO,GAAAC,MAAA,CAAOC,WAAW,CAACnB,SAASoB,OAAO,EAAA,CAAA;MAE9C,IAAI,CAACC,IAAI,CAACC,QAAQ,CAACL,MAAMrB,SAAW,EAAAD,KAAA,CAAA;AACtC;GACA;EAEF4B,YAAA,GAAgB5B,KAAO,IAAA;IACrBA,KAAA,CAAM6B,cAAc,EAAA;AACpB,IAAA,IAAI,CAAC9B,WAAW,CAACC,KAAO,EAAA,QAAA,CAAA;GACxB;AAEF,EAAA;IAAA8B,oBAAA,CAAAC,kBAAA,CAQA,oIAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import templateOnly from '@ember/component/template-only';
|
|
4
|
+
|
|
5
|
+
const IconChevronUpDown = setComponentTemplate(precompileTemplate("\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\" ...attributes>\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9\" />\n </svg>\n", {
|
|
6
|
+
strictMode: true
|
|
7
|
+
}), templateOnly());
|
|
8
|
+
var icons = setComponentTemplate(precompileTemplate("\n @frontile/froms Icons component is empty, use template imports.\n", {
|
|
9
|
+
strictMode: true
|
|
10
|
+
}), templateOnly());
|
|
11
|
+
|
|
12
|
+
export { IconChevronUpDown, icons as default };
|
|
13
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sources":["../../src/components/icons.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\n\nconst IconChevronUpDown: TOC<{\n Element: SVGElement;\n}> = <template>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n ...attributes\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9\"\n />\n </svg>\n</template>;\n\nexport { IconChevronUpDown };\n\n<template>\n @frontile/froms Icons component is empty, use template imports.\n</template>\n"],"names":["IconChevronUpDown","setComponentTemplate","precompileTemplate","strictMode","templateOnly"],"mappings":";;;;AAEA,MAAMA,iBAED,GAAAC,oBAAA,CAAAC,kBAAA,CAgBL,ySAAA,EAAA;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;AAIV,YAAAH,oBAAA,CAAAC,kBAAA,CAEA,uEAAA,EAAA;EAAAC,UAAA,EAAA;AAAU,CAAC,CAAA,EAAAC,YAAA,EAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { action } from '@ember/object';
|
|
4
|
+
import { on } from '@ember/modifier';
|
|
5
|
+
import { useStyles } from '@frontile/theme';
|
|
6
|
+
import { FormControl } from './form-control.js';
|
|
7
|
+
import { t as triggerFormInputEvent } from '../index-CeaQc-U7.js';
|
|
8
|
+
import { ref } from '@frontile/utilities';
|
|
9
|
+
import { CloseButton } from '@frontile/buttons';
|
|
10
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
11
|
+
import { setComponentTemplate } from '@ember/component';
|
|
12
|
+
import { a as decorateFieldV2, i as initializeDeferredDecorator, d as decorateMethodV2 } from '../runtime-BPCpkOf1-YDR_IEBR.js';
|
|
13
|
+
|
|
14
|
+
function or(arg1, arg2) {
|
|
15
|
+
return !!(arg1 || arg2);
|
|
16
|
+
}
|
|
17
|
+
class Input extends Component {
|
|
18
|
+
static {
|
|
19
|
+
decorateFieldV2(this.prototype, "uncontrolledValue", [tracked], function () {
|
|
20
|
+
return '';
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
#uncontrolledValue = (initializeDeferredDecorator(this, "uncontrolledValue"), undefined);
|
|
24
|
+
inputRef = ref();
|
|
25
|
+
get isControlled() {
|
|
26
|
+
return typeof this.args.onChange === 'function' || typeof this.args.onInput === 'function';
|
|
27
|
+
}
|
|
28
|
+
get value() {
|
|
29
|
+
return this.isControlled ? this.args.value : this.uncontrolledValue;
|
|
30
|
+
}
|
|
31
|
+
get type() {
|
|
32
|
+
if (typeof this.args.type === 'string') {
|
|
33
|
+
return this.args.type;
|
|
34
|
+
}
|
|
35
|
+
return 'text';
|
|
36
|
+
}
|
|
37
|
+
handleOnInput(event) {
|
|
38
|
+
const value = event.target.value;
|
|
39
|
+
if (this.isControlled) {
|
|
40
|
+
this.args.onInput?.(value, event);
|
|
41
|
+
} else {
|
|
42
|
+
this.uncontrolledValue = value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static {
|
|
46
|
+
decorateMethodV2(this.prototype, "handleOnInput", [action]);
|
|
47
|
+
}
|
|
48
|
+
handleOnChange(event) {
|
|
49
|
+
const value = event.target.value;
|
|
50
|
+
if (this.isControlled) {
|
|
51
|
+
this.args.onChange?.(value, event);
|
|
52
|
+
} else {
|
|
53
|
+
this.uncontrolledValue = value;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static {
|
|
57
|
+
decorateMethodV2(this.prototype, "handleOnChange", [action]);
|
|
58
|
+
}
|
|
59
|
+
clearValue() {
|
|
60
|
+
if (this.isControlled) {
|
|
61
|
+
this.args.onChange?.('');
|
|
62
|
+
this.args.onInput?.('');
|
|
63
|
+
} else {
|
|
64
|
+
this.uncontrolledValue = '';
|
|
65
|
+
}
|
|
66
|
+
this.inputRef.element?.focus();
|
|
67
|
+
triggerFormInputEvent(this.inputRef.element);
|
|
68
|
+
}
|
|
69
|
+
static {
|
|
70
|
+
decorateMethodV2(this.prototype, "clearValue", [action]);
|
|
71
|
+
}
|
|
72
|
+
get isClearable() {
|
|
73
|
+
if (this.args.isClearable === true && this.value !== '' && typeof this.value !== 'undefined') {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
get classes() {
|
|
79
|
+
const {
|
|
80
|
+
input
|
|
81
|
+
} = useStyles();
|
|
82
|
+
return input({
|
|
83
|
+
size: this.args.size
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
static {
|
|
87
|
+
setComponentTemplate(precompileTemplate("\n <FormControl @size={{@size}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @class={{this.classes.base class=@classes.base}} as |c|>\n <div class={{this.classes.innerContainer class=@classes.innerContainer}}>\n {{#if (has-block \"startContent\")}}\n <div data-test-id=\"input-start-content\" class={{this.classes.startContent class=@classes.startContent startContentPointerEvents=(if @startContentPointerEvents @startContentPointerEvents \"auto\")}}>\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <input {{this.inputRef.setup}} {{on \"input\" this.handleOnInput}} {{on \"change\" this.handleOnChange}} id={{c.id}} name={{@name}} value={{this.value}} type={{this.type}} class={{this.classes.input class=@classes.input hasStartContent=(has-block \"startContent\") hasEndContent=(or (has-block \"endContent\") this.isClearable)}} data-component=\"input\" aria-invalid={{if c.isInvalid \"true\"}} aria-describedby={{c.describedBy @description c.isInvalid}} ...attributes />\n {{#if (or (has-block \"endContent\") this.isClearable)}}\n <div data-test-id=\"input-end-content\" class={{this.classes.endContent class=@classes.endContent endContentPointerEvents=(if @endContentPointerEvents @endContentPointerEvents \"auto\")}}>\n {{yield to=\"endContent\"}}\n\n {{#if this.isClearable}}\n <CloseButton @title=\"Clear\" @variant=\"subtle\" @size=\"xs\" data-test-id=\"input-clear-button\" @onClick={{this.clearValue}} />\n {{/if}}\n </div>\n {{/if}}\n </div>\n </FormControl>\n ", {
|
|
88
|
+
strictMode: true,
|
|
89
|
+
scope: () => ({
|
|
90
|
+
FormControl,
|
|
91
|
+
or,
|
|
92
|
+
on,
|
|
93
|
+
CloseButton
|
|
94
|
+
})
|
|
95
|
+
}), this);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { Input, Input as default };
|
|
100
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../src/components/input.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport {\n useStyles,\n type InputSlots,\n type InputVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport { triggerFormInputEvent } from '../utils';\nimport { ref } from '@frontile/utilities';\nimport { CloseButton } from '@frontile/buttons';\n\ninterface Args extends FormControlSharedArgs {\n type?: string;\n value?: string;\n name?: string;\n size?: InputVariants['size'];\n classes?: SlotsToClasses<InputSlots>;\n\n /**\n * Whether to include a clear button\n */\n isClearable?: boolean;\n\n /**\n * Controls pointer-events property of startContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n startContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Controls pointer-events property of endContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n endContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Callback when oninput is triggered\n */\n onInput?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: string, event?: InputEvent) => void;\n}\n\ninterface InputSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n endContent: [];\n };\n Element: HTMLInputElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass Input extends Component<InputSignature> {\n @tracked uncontrolledValue: string = '';\n\n inputRef = ref<HTMLInputElement>();\n\n get isControlled() {\n return (\n typeof this.args.onChange === 'function' ||\n typeof this.args.onInput === 'function'\n );\n }\n\n get value(): string | undefined {\n return this.isControlled ? this.args.value : this.uncontrolledValue;\n }\n\n get type(): string {\n if (typeof this.args.type === 'string') {\n return this.args.type;\n }\n return 'text';\n }\n\n @action handleOnInput(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n\n if (this.isControlled) {\n this.args.onInput?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnChange(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n\n if (this.isControlled) {\n this.args.onChange?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action clearValue(): void {\n if (this.isControlled) {\n this.args.onChange?.('');\n this.args.onInput?.('');\n } else {\n this.uncontrolledValue = '';\n }\n\n this.inputRef.element?.focus();\n triggerFormInputEvent(this.inputRef.element);\n }\n\n get isClearable(): boolean {\n if (\n this.args.isClearable === true &&\n this.value !== '' &&\n typeof this.value !== 'undefined'\n ) {\n return true;\n }\n return false;\n }\n\n get classes() {\n const { input } = useStyles();\n return input({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n as |c|\n >\n <div class={{this.classes.innerContainer class=@classes.innerContainer}}>\n {{#if (has-block \"startContent\")}}\n <div\n data-test-id=\"input-start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <input\n {{this.inputRef.setup}}\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n id={{c.id}}\n name={{@name}}\n value={{this.value}}\n type={{this.type}}\n class={{this.classes.input\n class=@classes.input\n hasStartContent=(has-block \"startContent\")\n hasEndContent=(or (has-block \"endContent\") this.isClearable)\n }}\n data-component=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (or (has-block \"endContent\") this.isClearable)}}\n <div\n data-test-id=\"input-end-content\"\n class={{this.classes.endContent\n class=@classes.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"endContent\"}}\n\n {{#if this.isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"subtle\"\n @size=\"xs\"\n data-test-id=\"input-clear-button\"\n @onClick={{this.clearValue}}\n />\n {{/if}}\n </div>\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Input, type InputSignature };\nexport default Input;\n"],"names":["or","arg1","arg2","Input","Component","g","prototype","tracked","i","void 0","inputRef","ref","isControlled","args","onChange","onInput","value","uncontrolledValue","type","handleOnInput","event","target","n","action","handleOnChange","clearValue","element","focus","triggerFormInputEvent","isClearable","classes","input","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","CloseButton"],"mappings":";;;;;;;;;;;;;AA+DA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,MAAMC,cAAcC,SAAU,CAAA;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,mBAAA,EAAA,CAC3BC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoC,EAAG;AAAA,KAAA,CAAA;AAAA;AAAA,EAAA,kBAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,mBAAA,CAAA,EAAAC,SAAA;EAExCC,QAAA,GAAWC,KAAwB;EAEnC,IAAIC,YAAeA,GAAA;AACjB,IAAA,OACE,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,KAAK,UAC9B,IAAA,OAAO,IAAI,CAACD,IAAI,CAACE,OAAO,KAAK,UAC/B;AACF;EAEA,IAAIC,KAASA,GAAmB;AAC9B,IAAA,OAAO,IAAI,CAACJ,YAAY,GAAG,IAAI,CAACC,IAAI,CAACG,KAAK,GAAG,IAAI,CAACC,iBAAiB;AACrE;EAEA,IAAIC,IAAAA,GAAe;IACjB,IAAI,OAAO,IAAI,CAACL,IAAI,CAACK,IAAI,KAAK,QAAU,EAAA;AACtC,MAAA,OAAO,IAAI,CAACL,IAAI,CAACK,IAAI;AACvB;AACA,IAAA,OAAO,MAAA;AACT;EAEQC,aAAAA,CAAcC,KAAY,EAAQ;AACxC,IAAA,MAAMJ,QAASI,KAAA,CAAMC,MAAM,CAAsBL,KAAK;IAEtD,IAAI,IAAI,CAACJ,YAAY,EAAE;MACrB,IAAI,CAACC,IAAI,CAACE,OAAO,GAAGC,OAAOI,KAAS,CAAA;AACtC,KAAO,MAAA;MACL,IAAI,CAACH,iBAAiB,GAAGD,KAAA;AAC3B;AACF;AAAA,EAAA;IAAAM,gBAAA,CAAA,IAAA,CAAAhB,SAAA,EAAA,eAAA,EAAA,CARCiB,MAAA,CAAA,CAAA;AAAA;EAUOC,cAAAA,CAAeJ,KAAY,EAAQ;AACzC,IAAA,MAAMJ,QAASI,KAAA,CAAMC,MAAM,CAAsBL,KAAK;IAEtD,IAAI,IAAI,CAACJ,YAAY,EAAE;MACrB,IAAI,CAACC,IAAI,CAACC,QAAQ,GAAGE,OAAOI,KAAS,CAAA;AACvC,KAAO,MAAA;MACL,IAAI,CAACH,iBAAiB,GAAGD,KAAA;AAC3B;AACF;AAAA,EAAA;IAAAM,gBAAA,CAAA,IAAA,CAAAhB,SAAA,EAAA,gBAAA,EAAA,CARCiB,MAAA,CAAA,CAAA;AAAA;AAUOE,EAAAA,UAAAA,GAAmB;IACzB,IAAI,IAAI,CAACb,YAAY,EAAE;AACrB,MAAA,IAAI,CAACC,IAAI,CAACC,QAAQ,GAAG,EAAA,CAAA;AACrB,MAAA,IAAI,CAACD,IAAI,CAACE,OAAO,GAAG,EAAA,CAAA;AACtB,KAAO,MAAA;MACL,IAAI,CAACE,iBAAiB,GAAG,EAAA;AAC3B;AAEA,IAAA,IAAI,CAACP,QAAQ,CAACgB,OAAO,EAAEC,KAAA,EAAA;AACvBC,IAAAA,qBAAA,CAAsB,IAAI,CAAClB,QAAQ,CAACgB,OAAO,CAAA;AAC7C;AAAA,EAAA;IAAAJ,gBAAA,CAAA,IAAA,CAAAhB,SAAA,EAAA,YAAA,EAAA,CAVCiB,MAAA,CAAA,CAAA;AAAA;EAYD,IAAIM,WAAAA,GAAuB;IACzB,IACE,IAAI,CAAChB,IAAI,CAACgB,WAAW,KAAK,IAC1B,IAAA,IAAI,CAACb,KAAK,KAAK,EACf,IAAA,OAAO,IAAI,CAACA,KAAK,KAAK,WACtB,EAAA;AACA,MAAA,OAAO,IAAA;AACT;AACA,IAAA,OAAO,KAAA;AACT;EAEA,IAAIc,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAM,CAAA;AACXE,MAAAA,IAAA,EAAM,IAAI,CAACpB,IAAI,CAACoB;AAClB,KAAA,CAAA;AACF;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAoEA,qqDAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAtC,EAAA;QAAAuC,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { useStyles } from '@frontile/theme';
|
|
3
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
4
|
+
import { setComponentTemplate } from '@ember/component';
|
|
5
|
+
|
|
6
|
+
class Label extends Component {
|
|
7
|
+
get classes() {
|
|
8
|
+
const {
|
|
9
|
+
label
|
|
10
|
+
} = useStyles();
|
|
11
|
+
return label({
|
|
12
|
+
size: this.args.size || 'md'
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
setComponentTemplate(precompileTemplate("\n <label for={{@for}} class={{this.classes.base class=@class}} data-component=\"label\" ...attributes>\n {{yield}}\n {{#if @isRequired}}\n <span class={{this.classes.asterisk class=@classes.asterisk}}>*</span>\n {{/if}}\n </label>\n ", {
|
|
17
|
+
strictMode: true
|
|
18
|
+
}), this);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { Label, Label as default };
|
|
23
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.js","sources":["../../src/components/label.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport {\n useStyles,\n type LabelSlots,\n type LabelVariants,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface LabelSignature {\n Args: {\n /**\n * The 'for' attribute of a <label>.\n */\n for?: string;\n\n /*\n * @defaultValue 'md'\n */\n size?: LabelVariants['size'];\n classes?: SlotsToClasses<LabelSlots>;\n\n /**\n * The class name to be passed to the label base slot.\n */\n class?: string;\n\n /*\n * Whether the field is required or not, if true, an asterisk will be added to the label.\n * @defaultValue false\n */\n isRequired?: boolean;\n };\n Element: HTMLLabelElement;\n Blocks: {\n default: [];\n };\n}\n\nclass Label extends Component<LabelSignature> {\n get classes() {\n const { label } = useStyles();\n return label({\n size: this.args.size || 'md'\n });\n }\n\n <template>\n <label\n for={{@for}}\n class={{this.classes.base class=@class}}\n data-component=\"label\"\n ...attributes\n >\n {{yield}}\n {{#if @isRequired}}\n <span class={{this.classes.asterisk class=@classes.asterisk}}>*</span>\n {{/if}}\n </label>\n </template>\n}\n\nexport { Label, type LabelSignature };\nexport default Label;\n"],"names":["Label","Component","classes","label","useStyles","size","args","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AAsCA,MAAMA,cAAcC,SAAU,CAAA;EAC5B,IAAIC,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAM,CAAA;AACXE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI;AAC1B,KAAA,CAAA;AACF;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAYA,yQAAA,EAAA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|