@frontile/forms 0.17.1 → 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
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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<
|
|
29
|
-
Description: WithBoundArgs<
|
|
30
|
-
Feedback: WithBoundArgs<
|
|
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: [];
|
|
@@ -66,83 +66,83 @@ declare class Switch extends Component<SwitchSignature> {
|
|
|
66
66
|
handleBlur: () => void;
|
|
67
67
|
get classes(): {
|
|
68
68
|
base: (slotProps?: ({
|
|
69
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
69
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
70
70
|
size?: "sm" | "md" | "lg" | undefined;
|
|
71
71
|
isDisabled?: boolean | undefined;
|
|
72
72
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
73
73
|
labelContainer: (slotProps?: ({
|
|
74
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
74
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
75
75
|
size?: "sm" | "md" | "lg" | undefined;
|
|
76
76
|
isDisabled?: boolean | undefined;
|
|
77
77
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
78
78
|
label: (slotProps?: ({
|
|
79
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
79
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
80
80
|
size?: "sm" | "md" | "lg" | undefined;
|
|
81
81
|
isDisabled?: boolean | undefined;
|
|
82
82
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
83
83
|
wrapper: (slotProps?: ({
|
|
84
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
84
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
85
85
|
size?: "sm" | "md" | "lg" | undefined;
|
|
86
86
|
isDisabled?: boolean | undefined;
|
|
87
87
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
88
88
|
hiddenInput: (slotProps?: ({
|
|
89
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
89
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
90
90
|
size?: "sm" | "md" | "lg" | undefined;
|
|
91
91
|
isDisabled?: boolean | undefined;
|
|
92
92
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
93
93
|
thumb: (slotProps?: ({
|
|
94
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
94
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
95
95
|
size?: "sm" | "md" | "lg" | undefined;
|
|
96
96
|
isDisabled?: boolean | undefined;
|
|
97
97
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
98
98
|
startContent: (slotProps?: ({
|
|
99
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
99
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
100
100
|
size?: "sm" | "md" | "lg" | undefined;
|
|
101
101
|
isDisabled?: boolean | undefined;
|
|
102
102
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
103
103
|
endContent: (slotProps?: ({
|
|
104
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
104
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
105
105
|
size?: "sm" | "md" | "lg" | undefined;
|
|
106
106
|
isDisabled?: boolean | undefined;
|
|
107
107
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
108
108
|
} & {
|
|
109
109
|
base: (slotProps?: ({
|
|
110
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
110
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
111
111
|
size?: "sm" | "md" | "lg" | undefined;
|
|
112
112
|
isDisabled?: boolean | undefined;
|
|
113
113
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
114
114
|
labelContainer: (slotProps?: ({
|
|
115
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
115
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
116
116
|
size?: "sm" | "md" | "lg" | undefined;
|
|
117
117
|
isDisabled?: boolean | undefined;
|
|
118
118
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
119
119
|
label: (slotProps?: ({
|
|
120
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
120
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
121
121
|
size?: "sm" | "md" | "lg" | undefined;
|
|
122
122
|
isDisabled?: boolean | undefined;
|
|
123
123
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
124
124
|
wrapper: (slotProps?: ({
|
|
125
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
125
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
126
126
|
size?: "sm" | "md" | "lg" | undefined;
|
|
127
127
|
isDisabled?: boolean | undefined;
|
|
128
128
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
129
129
|
hiddenInput: (slotProps?: ({
|
|
130
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
130
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
131
131
|
size?: "sm" | "md" | "lg" | undefined;
|
|
132
132
|
isDisabled?: boolean | undefined;
|
|
133
133
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
134
134
|
thumb: (slotProps?: ({
|
|
135
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
135
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
136
136
|
size?: "sm" | "md" | "lg" | undefined;
|
|
137
137
|
isDisabled?: boolean | undefined;
|
|
138
138
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
139
139
|
startContent: (slotProps?: ({
|
|
140
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
140
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
141
141
|
size?: "sm" | "md" | "lg" | undefined;
|
|
142
142
|
isDisabled?: boolean | undefined;
|
|
143
143
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
144
144
|
endContent: (slotProps?: ({
|
|
145
|
-
intent?: "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
145
|
+
intent?: "accent" | "primary" | "success" | "danger" | "warning" | "default" | undefined;
|
|
146
146
|
size?: "sm" | "md" | "lg" | undefined;
|
|
147
147
|
isDisabled?: boolean | undefined;
|
|
148
148
|
} & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
|
|
@@ -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<
|
|
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.
|
|
3
|
+
"version": "0.18.0-alpha.1",
|
|
4
4
|
"description": "Component Library for Ember Octane apps: Forms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@ember/test-waiters": "^4.0.0",
|
|
56
56
|
"@embroider/addon-shim": "^1.9.0",
|
|
57
|
-
"@frontile/buttons": "0.
|
|
58
|
-
"@frontile/collections": "0.
|
|
59
|
-
"@frontile/overlays": "0.
|
|
60
|
-
"@frontile/theme": "0.
|
|
61
|
-
"@frontile/utilities": "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",
|
|
62
62
|
"@glint/template": "1.5.2",
|
|
63
63
|
"ember-modifier": "^4.1.0",
|
|
64
64
|
"form-data-utils": "^0.6.0"
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"./components/textarea.js": "./dist/_app_/components/textarea.js"
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "fd97ba4f441882b1dd5cb07e57a8a0314d9990f6"
|
|
127
127
|
}
|