@frontile/forms 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon-main.js +37 -0
- package/{components → declarations/components}/form-checkbox-group.d.ts +3 -1
- package/declarations/components/form-checkbox-group.d.ts.map +1 -0
- package/{components → declarations/components}/form-checkbox.d.ts +9 -0
- package/declarations/components/form-checkbox.d.ts.map +1 -0
- package/{components → declarations/components}/form-field/checkbox.d.ts +2 -0
- package/declarations/components/form-field/checkbox.d.ts.map +1 -0
- package/{components → declarations/components}/form-field/feedback.d.ts +5 -0
- package/declarations/components/form-field/feedback.d.ts.map +1 -0
- package/{components → declarations/components}/form-field/hint.d.ts +4 -0
- package/declarations/components/form-field/hint.d.ts.map +1 -0
- package/{components → declarations/components}/form-field/input.d.ts +4 -2
- package/declarations/components/form-field/input.d.ts.map +1 -0
- package/{components → declarations/components}/form-field/label.d.ts +4 -0
- package/declarations/components/form-field/label.d.ts.map +1 -0
- package/{components → declarations/components}/form-field/radio.d.ts +3 -1
- package/declarations/components/form-field/radio.d.ts.map +1 -0
- package/{components → declarations/components}/form-field/textarea.d.ts +4 -2
- package/declarations/components/form-field/textarea.d.ts.map +1 -0
- package/declarations/components/form-field.d.ts +38 -0
- package/declarations/components/form-field.d.ts.map +1 -0
- package/{components → declarations/components}/form-input.d.ts +5 -1
- package/declarations/components/form-input.d.ts.map +1 -0
- package/{components → declarations/components}/form-radio-group.d.ts +6 -2
- package/declarations/components/form-radio-group.d.ts.map +1 -0
- package/{components → declarations/components}/form-radio.d.ts +9 -1
- package/declarations/components/form-radio.d.ts.map +1 -0
- package/{components → declarations/components}/form-select.d.ts +6 -2
- package/declarations/components/form-select.d.ts.map +1 -0
- package/{components → declarations/components}/form-textarea.d.ts +5 -1
- package/declarations/components/form-textarea.d.ts.map +1 -0
- package/declarations/template-registry.d.ts +33 -0
- package/declarations/template-registry.d.ts.map +1 -0
- package/dist/_app_/components/form-checkbox-group.js +1 -0
- package/dist/_app_/components/form-checkbox.js +1 -0
- package/dist/_app_/components/form-field/checkbox.js +1 -0
- package/dist/_app_/components/form-field/feedback.js +1 -0
- package/dist/_app_/components/form-field/hint.js +1 -0
- package/dist/_app_/components/form-field/input.js +1 -0
- package/dist/_app_/components/form-field/label.js +1 -0
- package/dist/_app_/components/form-field/radio.js +1 -0
- package/dist/_app_/components/form-field/textarea.js +1 -0
- package/dist/_app_/components/form-field.js +1 -0
- package/dist/_app_/components/form-input.js +1 -0
- package/dist/_app_/components/form-radio-group.js +1 -0
- package/dist/_app_/components/form-radio.js +1 -0
- package/dist/_app_/components/form-select.js +1 -0
- package/dist/_app_/components/form-textarea.js +1 -0
- package/dist/components/form-checkbox-group.js +55 -0
- package/dist/components/form-checkbox-group.js.map +1 -0
- package/dist/components/form-checkbox.js +30 -0
- package/dist/components/form-checkbox.js.map +1 -0
- package/dist/components/form-field/checkbox.js +30 -0
- package/dist/components/form-field/checkbox.js.map +1 -0
- package/dist/components/form-field/feedback.js +29 -0
- package/dist/components/form-field/feedback.js.map +1 -0
- package/dist/components/form-field/hint.js +17 -0
- package/dist/components/form-field/hint.js.map +1 -0
- package/dist/components/form-field/input.js +36 -0
- package/dist/components/form-field/input.js.map +1 -0
- package/dist/components/form-field/label.js +17 -0
- package/dist/components/form-field/label.js.map +1 -0
- package/dist/components/form-field/radio.js +29 -0
- package/dist/components/form-field/radio.js.map +1 -0
- package/dist/components/form-field/textarea.js +30 -0
- package/dist/components/form-field/textarea.js.map +1 -0
- package/dist/components/form-field.js +44 -0
- package/dist/components/form-field.js.map +1 -0
- package/dist/components/form-input.js +64 -0
- package/dist/components/form-input.js.map +1 -0
- package/dist/components/form-radio-group.js +55 -0
- package/dist/components/form-radio-group.js.map +1 -0
- package/dist/components/form-radio.js +34 -0
- package/dist/components/form-radio.js.map +1 -0
- package/dist/components/form-select.js +102 -0
- package/dist/components/form-select.js.map +1 -0
- package/dist/components/form-textarea.js +23 -0
- package/dist/components/form-textarea.js.map +1 -0
- package/dist/template-registry.js +2 -0
- package/dist/template-registry.js.map +1 -0
- package/package.json +91 -49
- package/addon/components/form-checkbox-demo/usage.md +0 -30
- package/addon/components/form-checkbox-group-demo/usage.md +0 -54
- package/addon/components/form-checkbox-group.hbs +0 -38
- package/addon/components/form-checkbox-group.md +0 -5
- package/addon/components/form-checkbox-group.ts +0 -68
- package/addon/components/form-checkbox.hbs +0 -43
- package/addon/components/form-checkbox.md +0 -5
- package/addon/components/form-checkbox.ts +0 -45
- package/addon/components/form-field/checkbox.hbs +0 -10
- package/addon/components/form-field/checkbox.ts +0 -32
- package/addon/components/form-field/feedback.hbs +0 -10
- package/addon/components/form-field/feedback.ts +0 -30
- package/addon/components/form-field/hint.hbs +0 -8
- package/addon/components/form-field/hint.ts +0 -13
- package/addon/components/form-field/index.hbs +0 -20
- package/addon/components/form-field/index.ts +0 -46
- package/addon/components/form-field/input.hbs +0 -10
- package/addon/components/form-field/input.ts +0 -40
- package/addon/components/form-field/label.hbs +0 -8
- package/addon/components/form-field/label.ts +0 -13
- package/addon/components/form-field/radio.hbs +0 -11
- package/addon/components/form-field/radio.ts +0 -31
- package/addon/components/form-field/textarea.hbs +0 -10
- package/addon/components/form-field/textarea.ts +0 -32
- package/addon/components/form-input-demo/hint.md +0 -34
- package/addon/components/form-input-demo/no-label.md +0 -33
- package/addon/components/form-input-demo/simple.md +0 -42
- package/addon/components/form-input-demo/with-button.md +0 -60
- package/addon/components/form-input.hbs +0 -45
- package/addon/components/form-input.md +0 -5
- package/addon/components/form-input.ts +0 -96
- package/addon/components/form-radio-demo/usage.md +0 -39
- package/addon/components/form-radio-group-demo/usage.md +0 -43
- package/addon/components/form-radio-group.hbs +0 -39
- package/addon/components/form-radio-group.md +0 -5
- package/addon/components/form-radio-group.ts +0 -67
- package/addon/components/form-radio.hbs +0 -40
- package/addon/components/form-radio.md +0 -5
- package/addon/components/form-radio.ts +0 -53
- package/addon/components/form-select-demo/multiple.md +0 -60
- package/addon/components/form-select-demo/usage.md +0 -60
- package/addon/components/form-select.hbs +0 -101
- package/addon/components/form-select.md +0 -11
- package/addon/components/form-select.ts +0 -126
- package/addon/components/form-textarea-demo/usage.md +0 -40
- package/addon/components/form-textarea.hbs +0 -44
- package/addon/components/form-textarea.md +0 -5
- package/addon/components/form-textarea.ts +0 -7
- package/app/components/form-checkbox-group.js +0 -1
- package/app/components/form-checkbox.js +0 -1
- package/app/components/form-field/checkbox.js +0 -1
- package/app/components/form-field/feedback.js +0 -1
- package/app/components/form-field/hint.js +0 -1
- package/app/components/form-field/index.js +0 -1
- package/app/components/form-field/input.js +0 -1
- package/app/components/form-field/label.js +0 -1
- package/app/components/form-field/radio.js +0 -1
- package/app/components/form-field/textarea.js +0 -1
- package/app/components/form-input.js +0 -1
- package/app/components/form-radio-group.js +0 -1
- package/app/components/form-radio.js +0 -1
- package/app/components/form-select.js +0 -1
- package/app/components/form-textarea.js +0 -1
- package/components/form-field/index.d.ts +0 -36
- package/config/environment.js +0 -5
- package/index.js +0 -34
- package/tsconfig.json +0 -23
- package/types/dummy/index.d.ts +0 -0
- package/types/ember-get-config.d.ts +0 -3
- package/types/ember-power-select/test-support.d.ts +0 -29
- package/types/global.d.ts +0 -6
- package/types/index.d.ts +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
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 useFrontileClass from '@frontile/core/helpers/use-frontile-class';
|
|
13
|
+
import FormField from './form-field.js';
|
|
14
|
+
import { concat } from '@ember/helper';
|
|
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
|
+
}, setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{useFrontileClass \"form-select\" @size class=@containerClass}} as |f|>\n\n {{#if @label}}\n <f.Label @for id={{f.id}} class={{useFrontileClass \"form-select\" @size part=\"label\"}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-select\" @size part=\"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)}} {{useFrontileClass \"form-select\" @size part=\"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={{useFrontileClass \"form-select\" @size part=\"feedback\"}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n ", {
|
|
77
|
+
scope: () => ({
|
|
78
|
+
FormField,
|
|
79
|
+
useFrontileClass,
|
|
80
|
+
PowerSelectMultiple,
|
|
81
|
+
PowerSelect,
|
|
82
|
+
concat
|
|
83
|
+
}),
|
|
84
|
+
strictMode: true
|
|
85
|
+
}), _class2), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "shouldShowErrorFeedback", [tracked], {
|
|
86
|
+
configurable: true,
|
|
87
|
+
enumerable: true,
|
|
88
|
+
writable: true,
|
|
89
|
+
initializer: function () {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "isOpen", [tracked], {
|
|
93
|
+
configurable: true,
|
|
94
|
+
enumerable: true,
|
|
95
|
+
writable: true,
|
|
96
|
+
initializer: function () {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}), _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);
|
|
100
|
+
|
|
101
|
+
export { FormSelect as default };
|
|
102
|
+
//# sourceMappingURL=form-select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport FormField from './form-field';\nimport { concat } from '@ember/helper';\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' | '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 static{\n template(`\n <FormField\n @size={{@size}}\n class={{useFrontileClass \"form-select\" @size class=@containerClass}}\n as |f|\n >\n\n {{#if @label}}\n <f.Label\n @for=\"\"\n id={{f.id}}\n class={{useFrontileClass \"form-select\" @size part=\"label\"}}\n >\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-select\" @size part=\"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 }} {{useFrontileClass 'form-select' @size part=\"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\n class={{useFrontileClass \"form-select\" @size part=\"feedback\"}}\n @errors={{@errors}}\n />\n {{/if}}\n </FormField>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["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","setComponentTemplate","precompileTemplate","scope","FormField","useFrontileClass","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,CAACC,QAAQ,KAAK,UAAU,CAAC,CAAA;AAC3H,GAAA;EACA,IAAIC,iBAAiBA,GAAY;AAC7B,IAAA,IAAI,IAAI,CAACF,IAAI,CAACG,QAAQ,KAAK,KAAK,EAAE;AAC9B,MAAA,OAAO,KAAK,CAAA;AAChB,KAAA;AACA,IAAA,IAAI,CAAC,IAAI,CAACH,IAAI,CAACI,SAAS,IAAI,IAAI,CAACJ,IAAI,CAACK,YAA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,MAAA;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FormInputBase } from './form-input.js';
|
|
2
|
+
import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
|
|
3
|
+
import FormField from './form-field.js';
|
|
4
|
+
import { on } from '@ember/modifier';
|
|
5
|
+
import { concat } from '@ember/helper';
|
|
6
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
7
|
+
import { setComponentTemplate } from '@ember/component';
|
|
8
|
+
|
|
9
|
+
var _class;
|
|
10
|
+
class FormTextarea extends FormInputBase {}
|
|
11
|
+
_class = FormTextarea;
|
|
12
|
+
setComponentTemplate(precompileTemplate("\n <FormField @size={{@size}} class={{useFrontileClass \"form-textarea\" @size class=@containerClass}} as |f|>\n {{#if @label}}\n <f.Label class={{useFrontileClass \"form-textarea\" @size part=\"label\"}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-textarea\" @size part=\"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={{useFrontileClass \"form-textarea\" @size part=\"textarea\"}} aria-invalid={{if this.showErrorFeedback \"true\"}} aria-describedby=\"{{if @hint f.hintId}}{{if this.showErrorFeedback (concat \" \" f.feedbackId)}}\" ...attributes />\n\n {{yield}}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback class={{useFrontileClass \"form-textarea\" @size part=\"feedback\"}} @errors={{@errors}} />\n {{/if}}\n </FormField>\n ", {
|
|
13
|
+
scope: () => ({
|
|
14
|
+
FormField,
|
|
15
|
+
useFrontileClass,
|
|
16
|
+
concat,
|
|
17
|
+
on
|
|
18
|
+
}),
|
|
19
|
+
strictMode: true
|
|
20
|
+
}), _class);
|
|
21
|
+
|
|
22
|
+
export { FormTextarea as default };
|
|
23
|
+
//# sourceMappingURL=form-textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport FormField from './form-field';\nimport { on } from '@ember/modifier';\nimport { concat } from '@ember/helper';\nexport interface FormTextareaSignature extends FormInputBaseSignature {\n Element: HTMLTextAreaElement;\n Blocks: {\n default: [];\n };\n}\nexport default class FormTextarea extends FormInputBase<FormTextareaSignature> {\n static{\n template(`\n <FormField\n @size={{@size}}\n class={{useFrontileClass \"form-textarea\" @size class=@containerClass}}\n as |f|\n >\n {{#if @label}}\n <f.Label class={{useFrontileClass \"form-textarea\" @size part=\"label\"}}>\n {{@label}}\n </f.Label>\n {{/if}}\n\n {{#if @hint}}\n <f.Hint class={{useFrontileClass \"form-textarea\" @size part=\"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={{useFrontileClass \"form-textarea\" @size part=\"textarea\"}}\n aria-invalid={{if this.showErrorFeedback \"true\"}}\n aria-describedby=\"{{if @hint f.hintId}}{{if\n this.showErrorFeedback\n (concat \" \" f.feedbackId)\n }}\"\n ...attributes\n />\n\n {{yield}}\n\n {{#if this.showErrorFeedback}}\n <f.Feedback\n class={{useFrontileClass \"form-textarea\" @size part=\"feedback\"}}\n @errors={{@errors}}\n />\n {{/if}}\n </FormField>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["FormTextarea","FormInputBase","_class","setComponentTemplate","precompileTemplate","scope","FormField","useFrontileClass","concat","on","strictMode"],"mappings":";;;;;;;;;AAYe,MAAMA,YAAY,SAASC,aAAa,CAAwB,EAAA;AAmD9EC,MAAA,GAnDoBF,YAAY,CAAA;AAEzBG,oBAAA,CAAAC,kBAAA,CA0CH,ohCAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;IAAAC,gBAAA;IAAAC,MAAA;AAAAC,IAAAA,EAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAAR,MAAA,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-registry.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontile/forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Component Library for Ember Octane apps: Forms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -13,59 +13,61 @@
|
|
|
13
13
|
"doc": "doc",
|
|
14
14
|
"test": "tests"
|
|
15
15
|
},
|
|
16
|
+
"files": [
|
|
17
|
+
"addon-main.js",
|
|
18
|
+
"declarations",
|
|
19
|
+
"dist",
|
|
20
|
+
"tailwind"
|
|
21
|
+
],
|
|
16
22
|
"scripts": {
|
|
17
|
-
"build": "
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
23
|
+
"build": "concurrently -m 1 'npm:build:*'",
|
|
24
|
+
"build:js": "rollup --config",
|
|
25
|
+
"build:types": "glint --declaration",
|
|
26
|
+
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
|
|
27
|
+
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
|
|
28
|
+
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
|
|
29
|
+
"lint:js": "eslint . --cache",
|
|
30
|
+
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
|
|
31
|
+
"lint:js:fix": "eslint . --fix",
|
|
32
|
+
"lint:types": "glint",
|
|
33
|
+
"start": "concurrently 'npm:start:*'",
|
|
34
|
+
"start:js": "rollup --config --watch --no-watch.clearScreen",
|
|
35
|
+
"start:types": "glint -d --watch",
|
|
36
|
+
"test": "echo 'A v2 addon does not have tests, run tests in test-app'",
|
|
37
|
+
"prepack": "concurrently 'npm:build'"
|
|
24
38
|
},
|
|
25
39
|
"peerDependencies": {
|
|
40
|
+
"@babel/runtime": ">= 7",
|
|
26
41
|
"ember-source": "^4.0.0 || ^5.0.0"
|
|
27
42
|
},
|
|
28
43
|
"dependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"@frontile/
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"ember-
|
|
34
|
-
"ember-power-select": "^7.
|
|
35
|
-
"ember-test-selectors": "^6.0.0",
|
|
44
|
+
"@embroider/addon-shim": "^1.8.7",
|
|
45
|
+
"@frontile/core": "^0.16.0",
|
|
46
|
+
"@frontile/tailwindcss-plugin-helpers": "^0.16.0",
|
|
47
|
+
"@glint/template": "1.2.1",
|
|
48
|
+
"ember-basic-dropdown": "^7.3.0",
|
|
49
|
+
"ember-power-select": "^7.2.0",
|
|
36
50
|
"tailwindcss-ember-power-select": "^0.4.1"
|
|
37
51
|
},
|
|
38
52
|
"devDependencies": {
|
|
39
|
-
"@babel/core": "
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"ember-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"ember-cli-typescript-blueprints": "^3.0.0",
|
|
56
|
-
"ember-cli-uglify": "^3.0.0",
|
|
57
|
-
"ember-disable-prototype-extensions": "^1.1.3",
|
|
58
|
-
"ember-load-initializers": "^2.1.2",
|
|
59
|
-
"ember-qunit": "^7.0.0",
|
|
60
|
-
"ember-resolver": "^11.0.0",
|
|
61
|
-
"ember-source": "^5.1.2",
|
|
62
|
-
"ember-try": "^2.0.0",
|
|
63
|
-
"loader.js": "^4.7.0",
|
|
64
|
-
"qunit": "^2.19.4",
|
|
65
|
-
"qunit-dom": "^2.0.0",
|
|
53
|
+
"@babel/core": "7.23.6",
|
|
54
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
55
|
+
"@babel/plugin-proposal-decorators": "7.23.6",
|
|
56
|
+
"@babel/plugin-transform-class-static-block": "^7.23.4",
|
|
57
|
+
"@babel/preset-typescript": "7.23.3",
|
|
58
|
+
"@embroider/addon-dev": "4.1.3",
|
|
59
|
+
"@glint/core": "1.2.1",
|
|
60
|
+
"@glint/environment-ember-loose": "1.2.1",
|
|
61
|
+
"@glint/environment-ember-template-imports": "1.2.1",
|
|
62
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
63
|
+
"@tsconfig/ember": "^3.0.3",
|
|
64
|
+
"babel-plugin-ember-template-compilation": "^2.2.1",
|
|
65
|
+
"concurrently": "^8.2.0",
|
|
66
|
+
"ember-source": "^5.5.0",
|
|
67
|
+
"rollup": "^4.9.1",
|
|
68
|
+
"rollup-plugin-ts": "^3.4.5",
|
|
66
69
|
"tailwindcss": "^3.3.3",
|
|
67
|
-
"typescript": "^5.
|
|
68
|
-
"webpack": "^5.88.2"
|
|
70
|
+
"typescript": "^5.3.3"
|
|
69
71
|
},
|
|
70
72
|
"engines": {
|
|
71
73
|
"node": ">= 10.*"
|
|
@@ -77,10 +79,50 @@
|
|
|
77
79
|
"edition": "octane"
|
|
78
80
|
},
|
|
79
81
|
"ember-addon": {
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
"version": 2,
|
|
83
|
+
"type": "addon",
|
|
84
|
+
"main": "addon-main.js",
|
|
85
|
+
"app-js": {
|
|
86
|
+
"./components/form-checkbox-group.js": "./dist/_app_/components/form-checkbox-group.js",
|
|
87
|
+
"./components/form-checkbox.js": "./dist/_app_/components/form-checkbox.js",
|
|
88
|
+
"./components/form-field.js": "./dist/_app_/components/form-field.js",
|
|
89
|
+
"./components/form-field/checkbox.js": "./dist/_app_/components/form-field/checkbox.js",
|
|
90
|
+
"./components/form-field/feedback.js": "./dist/_app_/components/form-field/feedback.js",
|
|
91
|
+
"./components/form-field/hint.js": "./dist/_app_/components/form-field/hint.js",
|
|
92
|
+
"./components/form-field/input.js": "./dist/_app_/components/form-field/input.js",
|
|
93
|
+
"./components/form-field/label.js": "./dist/_app_/components/form-field/label.js",
|
|
94
|
+
"./components/form-field/radio.js": "./dist/_app_/components/form-field/radio.js",
|
|
95
|
+
"./components/form-field/textarea.js": "./dist/_app_/components/form-field/textarea.js",
|
|
96
|
+
"./components/form-input.js": "./dist/_app_/components/form-input.js",
|
|
97
|
+
"./components/form-radio-group.js": "./dist/_app_/components/form-radio-group.js",
|
|
98
|
+
"./components/form-radio.js": "./dist/_app_/components/form-radio.js",
|
|
99
|
+
"./components/form-select.js": "./dist/_app_/components/form-select.js",
|
|
100
|
+
"./components/form-textarea.js": "./dist/_app_/components/form-textarea.js"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"exports": {
|
|
104
|
+
".": {
|
|
105
|
+
"types": "./declarations/index.d.ts",
|
|
106
|
+
"default": "./dist/index.js"
|
|
107
|
+
},
|
|
108
|
+
"./*": {
|
|
109
|
+
"types": "./declarations/*.d.ts",
|
|
110
|
+
"default": "./dist/*.js"
|
|
111
|
+
},
|
|
112
|
+
"./addon-main.js": "./addon-main.js",
|
|
113
|
+
"./tailwind": {
|
|
114
|
+
"default": "./tailwind/index.js"
|
|
115
|
+
},
|
|
116
|
+
"./tailwind/*": {
|
|
117
|
+
"default": "./tailwind/*.js"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"typesVersions": {
|
|
121
|
+
"*": {
|
|
122
|
+
"*": [
|
|
123
|
+
"declarations/*"
|
|
124
|
+
]
|
|
125
|
+
}
|
|
84
126
|
},
|
|
85
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "d358927f118ad43439620fe1369c57f036d533c0"
|
|
86
128
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 1
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Usage
|
|
6
|
-
|
|
7
|
-
```hbs template
|
|
8
|
-
<FormCheckbox
|
|
9
|
-
name="isChecked"
|
|
10
|
-
@label="Checkbox"
|
|
11
|
-
@checked={{this.value}}
|
|
12
|
-
@onChange={{this.setValue}}
|
|
13
|
-
/>
|
|
14
|
-
|
|
15
|
-
<p class="mt-4">Selected Value: "{{this.value}}"</p>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
```js component
|
|
19
|
-
import Component from '@glimmer/component';
|
|
20
|
-
import { tracked } from '@glimmer/tracking';
|
|
21
|
-
import { action } from '@ember/object';
|
|
22
|
-
|
|
23
|
-
export default class DemoComponent extends Component {
|
|
24
|
-
@tracked value = false;
|
|
25
|
-
|
|
26
|
-
@action setValue(value) {
|
|
27
|
-
this.value = value;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
order: 1
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Usage
|
|
6
|
-
|
|
7
|
-
```hbs template
|
|
8
|
-
<FormCheckboxGroup
|
|
9
|
-
@errors={{this.validationErrors}}
|
|
10
|
-
@label="Checkbox group"
|
|
11
|
-
as |Checkbox|
|
|
12
|
-
>
|
|
13
|
-
<Checkbox
|
|
14
|
-
@name="isChecked"
|
|
15
|
-
@label="Checkbox"
|
|
16
|
-
@checked={{this.isChecked}}
|
|
17
|
-
@onChange={{this.setIsChecked}}
|
|
18
|
-
/>
|
|
19
|
-
|
|
20
|
-
<Checkbox
|
|
21
|
-
@name="isChecked2"
|
|
22
|
-
@label="Checkbox 2"
|
|
23
|
-
@checked={{this.isChecked2}}
|
|
24
|
-
@onChange={{this.setIsChecked2}}
|
|
25
|
-
/>
|
|
26
|
-
</FormCheckboxGroup>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
```js component
|
|
30
|
-
import Component from '@glimmer/component';
|
|
31
|
-
import { tracked } from '@glimmer/tracking';
|
|
32
|
-
import { action } from '@ember/object';
|
|
33
|
-
|
|
34
|
-
export default class DemoComponent extends Component {
|
|
35
|
-
@tracked isChecked = false;
|
|
36
|
-
@tracked isChecked2 = false;
|
|
37
|
-
|
|
38
|
-
get validationErrors() {
|
|
39
|
-
if (!(this.isChecked || this.isChecked2)) {
|
|
40
|
-
return ['You must select at least one option'];
|
|
41
|
-
} else {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@action setIsChecked(value) {
|
|
47
|
-
this.isChecked = value;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@action setIsChecked2(value) {
|
|
51
|
-
this.isChecked2 = value;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<FormField
|
|
2
|
-
@size={{@size}}
|
|
3
|
-
class={{use-frontile-class "form-checkbox-group" @size (if @isInline "inline") class=@containerClass}}
|
|
4
|
-
role="group"
|
|
5
|
-
...attributes
|
|
6
|
-
as |f|
|
|
7
|
-
>
|
|
8
|
-
{{#if @label}}
|
|
9
|
-
<f.Label
|
|
10
|
-
class={{use-frontile-class "form-checkbox-group" @size (if @isInline "inline") part="label"}}
|
|
11
|
-
>
|
|
12
|
-
{{@label}}
|
|
13
|
-
</f.Label>
|
|
14
|
-
{{/if}}
|
|
15
|
-
|
|
16
|
-
{{#if @hint}}
|
|
17
|
-
<f.Hint
|
|
18
|
-
class={{use-frontile-class "form-checkbox-group" @size (if @isInline "inline") part="hint"}}
|
|
19
|
-
>
|
|
20
|
-
{{@hint}}
|
|
21
|
-
</f.Hint>
|
|
22
|
-
{{/if}}
|
|
23
|
-
|
|
24
|
-
{{yield (component "form-checkbox"
|
|
25
|
-
privateContainerClass=(use-frontile-class "form-checkbox-group" @size (if @isInline "inline") part="form-checkbox")
|
|
26
|
-
_parentOnChange=this.handleChange
|
|
27
|
-
size=@size
|
|
28
|
-
)
|
|
29
|
-
(hash onChange=this.handleChange)
|
|
30
|
-
}}
|
|
31
|
-
|
|
32
|
-
{{#if this.showErrorFeedback}}
|
|
33
|
-
<f.Feedback
|
|
34
|
-
class={{use-frontile-class "form-checkbox-group" @size (if @isInline "inline") part="feedback"}}
|
|
35
|
-
@errors={{@errors}}
|
|
36
|
-
/>
|
|
37
|
-
{{/if}}
|
|
38
|
-
</FormField>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { action } from '@ember/object';
|
|
3
|
-
import { tracked } from '@glimmer/tracking';
|
|
4
|
-
import FormCheckbox from './form-checkbox';
|
|
5
|
-
|
|
6
|
-
export interface FormCheckboxGroupArgs {
|
|
7
|
-
/** The group label */
|
|
8
|
-
label?: string;
|
|
9
|
-
/** A help text to be displayed */
|
|
10
|
-
hint?: string;
|
|
11
|
-
/** If the form has been submitted, used to force displaying errors */
|
|
12
|
-
hasSubmitted?: boolean;
|
|
13
|
-
/** If has errors */
|
|
14
|
-
hasError?: boolean;
|
|
15
|
-
/** Force displaying errors */
|
|
16
|
-
showError?: boolean;
|
|
17
|
-
/** A list of errors or a single text describing the error */
|
|
18
|
-
errors?: string[] | string;
|
|
19
|
-
/** CSS classes to be added in the container element */
|
|
20
|
-
containerClass?: string;
|
|
21
|
-
/** The size */
|
|
22
|
-
size?: 'sm' | 'lg';
|
|
23
|
-
/** If the Checkbox should be in one line */
|
|
24
|
-
isInline?: boolean;
|
|
25
|
-
/** Default callback added to the yielded FormCheckbox component, called when onchange is triggered */
|
|
26
|
-
onChange?: (value: unknown, event: Event) => void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface FormCheckboxGroupSignature {
|
|
30
|
-
Args: FormCheckboxGroupArgs;
|
|
31
|
-
Blocks: {
|
|
32
|
-
default: [
|
|
33
|
-
checkbox: FormCheckbox,
|
|
34
|
-
api: { onChange: (value: unknown, event: Event) => void }
|
|
35
|
-
];
|
|
36
|
-
};
|
|
37
|
-
Element: HTMLDivElement;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default class FormCheckboxGroup extends Component<FormCheckboxGroupSignature> {
|
|
41
|
-
@tracked shouldShowErrorFeedback = false;
|
|
42
|
-
|
|
43
|
-
get showErrorFeedback(): boolean {
|
|
44
|
-
if (this.args.hasError === false) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
(this.args.showError ||
|
|
50
|
-
this.args.hasSubmitted ||
|
|
51
|
-
this.shouldShowErrorFeedback) &&
|
|
52
|
-
this.args.errors &&
|
|
53
|
-
this.args.errors.length > 0
|
|
54
|
-
) {
|
|
55
|
-
return true;
|
|
56
|
-
} else {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@action handleChange(value: unknown, event: Event): void {
|
|
62
|
-
this.shouldShowErrorFeedback = true;
|
|
63
|
-
|
|
64
|
-
if (typeof this.args.onChange === 'function') {
|
|
65
|
-
this.args.onChange(value, event);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<FormField
|
|
2
|
-
@size={{@size}}
|
|
3
|
-
class={{use-frontile-class
|
|
4
|
-
"form-checkbox"
|
|
5
|
-
@size
|
|
6
|
-
(if @checked "checked")
|
|
7
|
-
class=(array @containerClass @privateContainerClass)
|
|
8
|
-
}}
|
|
9
|
-
as |f|
|
|
10
|
-
>
|
|
11
|
-
<div
|
|
12
|
-
class={{use-frontile-class "form-checkbox" @size part="label-container"}}
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
class={{use-frontile-class "form-checkbox" @size part="input-container"}}
|
|
16
|
-
>
|
|
17
|
-
{{! Zero-width space character, used to align checkbox properly }}
|
|
18
|
-
|
|
19
|
-
<f.Checkbox
|
|
20
|
-
@onChange={{this.handleChange}}
|
|
21
|
-
@checked={{@checked}}
|
|
22
|
-
@name={{@name}}
|
|
23
|
-
class={{use-frontile-class "form-checkbox" @size part="checkbox"}}
|
|
24
|
-
aria-describedby={{if @hint f.hintId}}
|
|
25
|
-
...attributes
|
|
26
|
-
/>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<f.Label class={{use-frontile-class "form-checkbox" @size part="label"}}>
|
|
30
|
-
{{#if (has-block)}}
|
|
31
|
-
{{yield}}
|
|
32
|
-
{{else}}
|
|
33
|
-
{{@label}}
|
|
34
|
-
{{/if}}
|
|
35
|
-
</f.Label>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
{{#if @hint}}
|
|
39
|
-
<f.Hint class={{use-frontile-class "form-checkbox" @size part="hint"}}>
|
|
40
|
-
{{@hint}}
|
|
41
|
-
</f.Hint>
|
|
42
|
-
{{/if}}
|
|
43
|
-
</FormField>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { action } from '@ember/object';
|
|
3
|
-
|
|
4
|
-
export interface FormCheckboxArgs {
|
|
5
|
-
/** The input field label */
|
|
6
|
-
label?: string;
|
|
7
|
-
/** A help text to be displayed */
|
|
8
|
-
hint?: string;
|
|
9
|
-
/**
|
|
10
|
-
* If the checkbox is checked.
|
|
11
|
-
* You must also pass `onChange` to update its value.
|
|
12
|
-
*/
|
|
13
|
-
checked: boolean;
|
|
14
|
-
/** The name of the checkbox */
|
|
15
|
-
name?: string;
|
|
16
|
-
/** CSS classes to be added in the container element */
|
|
17
|
-
containerClass?: string;
|
|
18
|
-
/** The size */
|
|
19
|
-
size?: 'sm' | 'lg';
|
|
20
|
-
/** Callback when onchange is triggered */
|
|
21
|
-
onChange: (value: boolean, event: Event) => void;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Internal function for InputCheckboxGroup
|
|
25
|
-
* @ignore
|
|
26
|
-
**/
|
|
27
|
-
_parentOnChange?: (value: boolean, event: Event) => void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface FormCheckboxSignature {
|
|
31
|
-
Args: FormCheckboxArgs;
|
|
32
|
-
Element: HTMLInputElement;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default class FormCheckbox extends Component<FormCheckboxSignature> {
|
|
36
|
-
@action handleChange(value: boolean, event: Event): void {
|
|
37
|
-
if (typeof this.args.onChange === 'function') {
|
|
38
|
-
this.args.onChange(value, event);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (typeof this.args._parentOnChange === 'function') {
|
|
42
|
-
this.args._parentOnChange(value, event);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|