@frontile/forms 0.18.0-alpha.0 → 0.18.0-alpha.1

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.
@@ -1,8 +1,8 @@
1
1
  import Component from '@glimmer/component';
2
- import Feedback from './form-feedback';
3
- import Description from './form-description';
4
- import Label from './label';
5
- import type { WithBoundArgs } from '@glint/template';
2
+ import { type FormFeedbackSignature } from './form-feedback';
3
+ import { type FormDescriptionSignature } from './form-description';
4
+ import { type LabelSignature } from './label';
5
+ import type { ComponentLike, WithBoundArgs } from '@glint/template';
6
6
  interface FormControlSharedArgs {
7
7
  label?: string;
8
8
  isRequired?: boolean;
@@ -25,9 +25,9 @@ interface FormControlSignature {
25
25
  id: string;
26
26
  isInvalid: boolean;
27
27
  describedBy: (hasDescription?: string | boolean, hasFeedback?: string | boolean) => string | undefined;
28
- Label: WithBoundArgs<typeof Label, 'for' | 'size' | 'isRequired'>;
29
- Description: WithBoundArgs<typeof Description, 'id' | 'size'>;
30
- Feedback: WithBoundArgs<typeof Feedback, 'id' | 'size' | 'messages' | 'intent'>;
28
+ Label: WithBoundArgs<ComponentLike<LabelSignature>, 'for' | 'size' | 'isRequired'>;
29
+ Description: WithBoundArgs<ComponentLike<FormDescriptionSignature>, 'id' | 'size'>;
30
+ Feedback: WithBoundArgs<ComponentLike<FormFeedbackSignature>, 'id' | 'size' | 'messages' | 'intent'>;
31
31
  }
32
32
  ];
33
33
  label: [];
@@ -1 +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 isDisabled?: 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":";;;;;;;;;AAiDA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,MAAMC,oBAAoBC,SAAA,CAAU;EAClCC,EAAA,GAAK,IAAI,CAACC,IAAI,CAACD,EAAE,IAAIE,OAAA,CAAQ,IAAI,CAAA;EAEjC,IAAIC,aAAAA,GAAwB;AAC1B,IAAA,OAAO,IAAI,CAACH,EAAE,GAAG,cAAA;AACnB,EAAA;EAEA,IAAII,UAAAA,GAAqB;AACvB,IAAA,OAAO,IAAI,CAACJ,EAAE,GAAG,WAAA;AACnB,EAAA;AAEAK,EAAAA,WAAA,GAAcA,CACZC,cAAiC,EACjCC,WAA8B,KACX;IACnB,MAAMC,MAAM,EAAE;AAEd,IAAA,IAAIF,cAAA,EAAgB;AAClBE,MAAAA,GAAA,CAAIC,IAAI,CAAC,IAAI,CAACN,aAAa,CAAA;AAC7B,IAAA;AAEA,IAAA,IAAII,WAAA,EAAa;AACfC,MAAAA,GAAA,CAAIC,IAAI,CAAC,IAAI,CAACL,UAAU,CAAA;AAC1B,IAAA;AAEA,IAAA,IAAII,GAAA,CAAIE,MAAM,GAAG,CAAA,EAAG;AAClB,MAAA,OAAOF,GAAA,CAAIG,IAAI,CAAC,GAAA,CAAA;AAClB,IAAA;EACF,CAAA;EAEA,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,CAAC,EAChD;AACA,MAAA,OAAO,IAAA;AACT,IAAA,CAAA,MAAO;AACL,MAAA,OAAO,KAAA;AACT,IAAA;AACF,EAAA;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,IAAA;AACA,IAAA,OAAO,KAAA;AACT,EAAA;AAEA,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CAAA,k/BAAA,EA2CA;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;;;;"}
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, { type FormFeedbackSignature } from './form-feedback';\nimport Description, { type FormDescriptionSignature } from './form-description';\nimport Label, { type LabelSignature } from './label';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\n\ninterface FormControlSharedArgs {\n label?: string;\n isRequired?: boolean;\n description?: string;\n errors?: string[] | string;\n isInvalid?: boolean;\n isDisabled?: 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<ComponentLike<LabelSignature>, 'for' | 'size' | 'isRequired'>;\n Description: WithBoundArgs<ComponentLike<FormDescriptionSignature>, 'id' | 'size'>;\n Feedback: WithBoundArgs<\n ComponentLike<FormFeedbackSignature>,\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":";;;;;;;;;AAiDA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,MAAMC,oBAAoBC,SAAA,CAAU;EAClCC,EAAA,GAAK,IAAI,CAACC,IAAI,CAACD,EAAE,IAAIE,OAAA,CAAQ,IAAI,CAAA;EAEjC,IAAIC,aAAAA,GAAwB;AAC1B,IAAA,OAAO,IAAI,CAACH,EAAE,GAAG,cAAA;AACnB,EAAA;EAEA,IAAII,UAAAA,GAAqB;AACvB,IAAA,OAAO,IAAI,CAACJ,EAAE,GAAG,WAAA;AACnB,EAAA;AAEAK,EAAAA,WAAA,GAAcA,CACZC,cAAiC,EACjCC,WAA8B,KACX;IACnB,MAAMC,MAAM,EAAE;AAEd,IAAA,IAAIF,cAAA,EAAgB;AAClBE,MAAAA,GAAA,CAAIC,IAAI,CAAC,IAAI,CAACN,aAAa,CAAA;AAC7B,IAAA;AAEA,IAAA,IAAII,WAAA,EAAa;AACfC,MAAAA,GAAA,CAAIC,IAAI,CAAC,IAAI,CAACL,UAAU,CAAA;AAC1B,IAAA;AAEA,IAAA,IAAII,GAAA,CAAIE,MAAM,GAAG,CAAA,EAAG;AAClB,MAAA,OAAOF,GAAA,CAAIG,IAAI,CAAC,GAAA,CAAA;AAClB,IAAA;EACF,CAAA;EAEA,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,CAAC,EAChD;AACA,MAAA,OAAO,IAAA;AACT,IAAA,CAAA,MAAO;AACL,MAAA,OAAO,KAAA;AACT,IAAA;AACF,EAAA;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,IAAA;AACA,IAAA,OAAO,KAAA;AACT,EAAA;AAEA,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CAAA,k/BAAA,EA2CA;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;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontile/forms",
3
- "version": "0.18.0-alpha.0",
3
+ "version": "0.18.0-alpha.1",
4
4
  "description": "Component Library for Ember Octane apps: Forms",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -36,14 +36,29 @@
36
36
  "declarations",
37
37
  "dist"
38
38
  ],
39
+ "scripts": {
40
+ "build": "rollup --config",
41
+ "lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
42
+ "lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
43
+ "lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
44
+ "lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
45
+ "lint:js": "eslint . --cache",
46
+ "lint:js:fix": "eslint . --fix",
47
+ "lint:types": "glint",
48
+ "prepack": "concurrently 'npm:build'",
49
+ "start": "concurrently 'npm:start:*'",
50
+ "start:js": "rollup --config --watch --no-watch.clearScreen",
51
+ "start:types": "glint -d --watch",
52
+ "test": "echo 'A v2 addon does not have tests, run tests in test-app'"
53
+ },
39
54
  "dependencies": {
40
55
  "@ember/test-waiters": "^4.0.0",
41
56
  "@embroider/addon-shim": "^1.9.0",
42
- "@frontile/buttons": "0.18.0-alpha.0",
43
- "@frontile/collections": "0.18.0-alpha.0",
44
- "@frontile/overlays": "0.18.0-alpha.0",
45
- "@frontile/theme": "0.18.0-alpha.0",
46
- "@frontile/utilities": "0.18.0-alpha.0",
57
+ "@frontile/buttons": "0.18.0-alpha.1",
58
+ "@frontile/collections": "0.18.0-alpha.1",
59
+ "@frontile/overlays": "0.18.0-alpha.1",
60
+ "@frontile/theme": "0.18.0-alpha.1",
61
+ "@frontile/utilities": "0.18.0-alpha.1",
47
62
  "@glint/template": "1.5.2",
48
63
  "ember-modifier": "^4.1.0",
49
64
  "form-data-utils": "^0.6.0"
@@ -108,18 +123,5 @@
108
123
  "./components/textarea.js": "./dist/_app_/components/textarea.js"
109
124
  }
110
125
  },
111
- "scripts": {
112
- "build": "rollup --config",
113
- "lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
114
- "lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
115
- "lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
116
- "lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
117
- "lint:js": "eslint . --cache",
118
- "lint:js:fix": "eslint . --fix",
119
- "lint:types": "glint",
120
- "start": "concurrently 'npm:start:*'",
121
- "start:js": "rollup --config --watch --no-watch.clearScreen",
122
- "start:types": "glint -d --watch",
123
- "test": "echo 'A v2 addon does not have tests, run tests in test-app'"
124
- }
125
- }
126
+ "gitHead": "fd97ba4f441882b1dd5cb07e57a8a0314d9990f6"
127
+ }