@frontile/forms 0.17.0-beta.1 → 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/declarations/components/input.d.ts.map +1 -1
- package/declarations/components/select.d.ts +116 -4
- 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/index.d.ts +1 -0
- package/declarations/index.d.ts.map +1 -1
- package/declarations/test-support.d.ts +3 -0
- package/declarations/test-support.d.ts.map +1 -0
- package/dist/_app_/components/switch.js +1 -0
- package/dist/components/checkbox-group.js +9 -9
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.js +15 -10
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/form-control.js +25 -29
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form-description.js +5 -5
- package/dist/components/form-description.js.map +1 -1
- package/dist/components/form-feedback.js +5 -5
- package/dist/components/form-feedback.js.map +1 -1
- package/dist/components/form.js +28 -32
- package/dist/components/form.js.map +1 -1
- package/dist/components/input.js +28 -25
- package/dist/components/input.js.map +1 -1
- package/dist/components/label.js +5 -5
- package/dist/components/label.js.map +1 -1
- package/dist/components/native-select.js +42 -42
- package/dist/components/native-select.js.map +1 -1
- package/dist/components/radio-group.js +9 -9
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/radio.js +15 -10
- package/dist/components/radio.js.map +1 -1
- package/dist/components/select.js +106 -72
- 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 +18 -10
- package/dist/components/textarea.js.map +1 -1
- package/dist/index.js +1 -0
- 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 +53 -54
- package/declarations/index-CeaQc-U7.d.ts +0 -3
- package/declarations/index-CeaQc-U7.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","sources":["../../src/components/textarea.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 TextareaSlots,\n type TextareaVariants,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface Args extends FormControlSharedArgs {\n id?: string;\n value?: string | number | boolean;\n name?: string;\n\n size?: TextareaVariants['size'];\n classes?: SlotsToClasses<TextareaSlots>;\n\n // Callback when oninput is triggered\n onInput?: (value: string, event: InputEvent) => void;\n\n // Callback when onchange is triggered\n onChange?: (value: string, event: InputEvent) => void;\n}\n\ninterface TextareaSignature {\n Args: Args;\n Element: HTMLTextAreaElement;\n}\n\nclass Textarea extends Component<TextareaSignature> {\n @action handleOnInput(event: Event): void {\n if (typeof this.args.onInput === 'function') {\n this.args.onInput(\n (event.target as HTMLInputElement).value,\n event as InputEvent\n );\n }\n }\n\n @action handleOnChange(event: Event): void {\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(\n (event.target as HTMLInputElement).value,\n event as InputEvent\n );\n }\n }\n\n get classes() {\n const { textarea } = useStyles();\n return textarea({\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 <textarea\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n id={{c.id}}\n name={{@name}}\n value={{@value}}\n class={{this.classes.input class=@classes.input}}\n data-component=\"textarea\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n </FormControl>\n </template>\n}\nexport { Textarea, type TextareaSignature };\nexport default Textarea;\n"],"names":["Textarea","Component","handleOnInput","event","args","onInput","target","value","handleOnChange","onChange","classes","textarea","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"
|
|
1
|
+
{"version":3,"file":"textarea.js","sources":["../../src/components/textarea.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 TextareaSlots,\n type TextareaVariants,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface Args extends FormControlSharedArgs {\n id?: string;\n value?: string | number | boolean;\n name?: string;\n\n size?: TextareaVariants['size'];\n classes?: SlotsToClasses<TextareaSlots>;\n\n // Callback when oninput is triggered\n onInput?: (value: string, event: InputEvent) => void;\n\n // Callback when onchange is triggered\n onChange?: (value: string, event: InputEvent) => void;\n}\n\ninterface TextareaSignature {\n Args: Args;\n Element: HTMLTextAreaElement;\n}\n\nclass Textarea extends Component<TextareaSignature> {\n @action handleOnInput(event: Event): void {\n if (typeof this.args.onInput === 'function') {\n this.args.onInput(\n (event.target as HTMLInputElement).value,\n event as InputEvent\n );\n }\n }\n\n @action handleOnChange(event: Event): void {\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(\n (event.target as HTMLInputElement).value,\n event as InputEvent\n );\n }\n }\n\n get classes() {\n const { textarea } = useStyles();\n return textarea({\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 <textarea\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n id={{c.id}}\n name={{@name}}\n value={{@value}}\n class={{this.classes.input class=@classes.input}}\n data-component=\"textarea\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n </FormControl>\n </template>\n}\nexport { Textarea, type TextareaSignature };\nexport default Textarea;\n"],"names":["Textarea","Component","handleOnInput","event","args","onInput","target","value","n","prototype","action","handleOnChange","onChange","classes","textarea","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;;;AA+BA,MAAMA,iBAAiBC,SAAU,CAAA;EACvBC,aAAAA,CAAcC,KAAY,EAAQ;IACxC,IAAI,OAAO,IAAI,CAACC,IAAI,CAACC,OAAO,KAAK,UAAY,EAAA;AAC3C,MAAA,IAAI,CAACD,IAAI,CAACC,OAAO,CACdF,KAAM,CAAAG,MAAM,CAAsBC,KAAK,EACxCJ,KAAS,CAAA;AAEb;AACF;AAAA,EAAA;IAAAK,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CAPCC,MAAA,CAAA,CAAA;AAAA;EASOC,cAAAA,CAAeR,KAAY,EAAQ;IACzC,IAAI,OAAO,IAAI,CAACC,IAAI,CAACQ,QAAQ,KAAK,UAAY,EAAA;AAC5C,MAAA,IAAI,CAACR,IAAI,CAACQ,QAAQ,CACfT,KAAM,CAAAG,MAAM,CAAsBC,KAAK,EACxCJ,KAAS,CAAA;AAEb;AACF;AAAA,EAAA;IAAAK,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,gBAAA,EAAA,CAPCC,MAAA,CAAA,CAAA;AAAA;EASD,IAAIG,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAU,GAAGC,SAAA,EAAA;AACrB,IAAA,OAAOD,QAAS,CAAA;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACZ,IAAI,CAACY;AAClB,KAAA,CAAA;AACF;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAwBA,0jBAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -11,4 +11,5 @@ export { Textarea } from './components/textarea.js';
|
|
|
11
11
|
export { Radio } from './components/radio.js';
|
|
12
12
|
export { RadioGroup } from './components/radio-group.js';
|
|
13
13
|
export { FormControl } from './components/form-control.js';
|
|
14
|
+
export { Switch } from './components/switch.js';
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const deferred = /* @__PURE__ */new WeakMap();
|
|
2
|
+
function deferDecorator(proto, prop, desc) {
|
|
3
|
+
let map = deferred.get(proto);
|
|
4
|
+
if (!map) {
|
|
5
|
+
map = /* @__PURE__ */new Map();
|
|
6
|
+
deferred.set(proto, map);
|
|
7
|
+
}
|
|
8
|
+
map.set(prop, desc);
|
|
9
|
+
}
|
|
10
|
+
function findDeferredDecorator(target, prop) {
|
|
11
|
+
var _a;
|
|
12
|
+
let cursor = target.prototype;
|
|
13
|
+
while (cursor) {
|
|
14
|
+
let desc = (_a = deferred.get(cursor)) == null ? undefined : _a.get(prop);
|
|
15
|
+
if (desc) {
|
|
16
|
+
return desc;
|
|
17
|
+
}
|
|
18
|
+
cursor = cursor.prototype;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function decorateFieldV2(prototype, prop, decorators, initializer) {
|
|
22
|
+
let desc = {
|
|
23
|
+
configurable: true,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
initializer: null
|
|
27
|
+
};
|
|
28
|
+
if (initializer) {
|
|
29
|
+
desc.initializer = initializer;
|
|
30
|
+
}
|
|
31
|
+
for (let decorator of decorators) {
|
|
32
|
+
desc = decorator(prototype, prop, desc) || desc;
|
|
33
|
+
}
|
|
34
|
+
if (desc.initializer === undefined) {
|
|
35
|
+
Object.defineProperty(prototype, prop, desc);
|
|
36
|
+
} else {
|
|
37
|
+
deferDecorator(prototype, prop, desc);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function decorateMethodV2(prototype, prop, decorators) {
|
|
41
|
+
const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);
|
|
42
|
+
let desc = {
|
|
43
|
+
...origDesc
|
|
44
|
+
};
|
|
45
|
+
for (let decorator of decorators) {
|
|
46
|
+
desc = decorator(prototype, prop, desc) || desc;
|
|
47
|
+
}
|
|
48
|
+
if (desc.initializer !== undefined) {
|
|
49
|
+
desc.value = desc.initializer ? desc.initializer.call(prototype) : undefined;
|
|
50
|
+
desc.initializer = undefined;
|
|
51
|
+
}
|
|
52
|
+
Object.defineProperty(prototype, prop, desc);
|
|
53
|
+
}
|
|
54
|
+
function initializeDeferredDecorator(target, prop) {
|
|
55
|
+
let desc = findDeferredDecorator(target.constructor, prop);
|
|
56
|
+
if (desc) {
|
|
57
|
+
Object.defineProperty(target, prop, {
|
|
58
|
+
enumerable: desc.enumerable,
|
|
59
|
+
configurable: desc.configurable,
|
|
60
|
+
writable: desc.writable,
|
|
61
|
+
value: desc.initializer ? desc.initializer.call(target) : undefined
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { decorateFieldV2 as a, decorateMethodV2 as d, initializeDeferredDecorator as i };
|
|
67
|
+
//# sourceMappingURL=runtime-BPCpkOf1-YDR_IEBR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-BPCpkOf1-YDR_IEBR.js","sources":["../../../node_modules/.pnpm/decorator-transforms@2.3.0_@babel+core@7.26.7/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js"],"sourcesContent":["const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\n"],"names":["deferred","WeakMap","deferDecorator","proto","prop","desc","map","get","Map","set","findDeferredDecorator","target","_a","cursor","prototype","decorateFieldV2","decorators","initializer","configurable","enumerable","writable","decorator","Object","defineProperty","decorateMethodV2","origDesc","getOwnPropertyDescriptor","value","call","initializeDeferredDecorator","constructor"],"mappings":"AAuBA,MAAMA,QAAA,sBAGEC,OAAA,EAAA;AAER,SAASC,eACPC,KAAA,EACAC,IAAA,EACAC,IAAA,EACM;AACF,EAAA,IAAAC,GAAA,GAAMN,QAAA,CAASO,GAAA,CAAIJ,KAAK,CAAA;EAC5B,IAAI,CAACG,GAAA,EAAK;AACRA,IAAAA,GAAA,sBAAUE,GAAA,EAAA;AACDR,IAAAA,QAAA,CAAAS,GAAA,CAAIN,KAAA,EAAOG,GAAG,CAAA;AACzB;AACIA,EAAAA,GAAA,CAAAG,GA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