@frontile/forms 0.17.0-beta.8 → 0.17.0-beta.9
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/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/dist/_app_/components/switch.js +1 -0
- package/dist/components/switch.js +60 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { type FormControlSharedArgs } from './form-control';
|
|
3
|
+
import { type SwitchVariants, type SwitchSlots, type SlotsToClasses } from '@frontile/theme';
|
|
4
|
+
import type Owner from '@ember/owner';
|
|
5
|
+
interface Args extends FormControlSharedArgs {
|
|
6
|
+
/**
|
|
7
|
+
* Controls the current selected state of the Switch.
|
|
8
|
+
* When provided a boolean value, the component operates in a controlled mode.
|
|
9
|
+
*/
|
|
10
|
+
isSelected?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the initial selected state of the Switch when used in uncontrolled mode.
|
|
13
|
+
* @defaultValue false
|
|
14
|
+
*/
|
|
15
|
+
defaultSelected?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The name attribute for the input element.
|
|
18
|
+
* Useful for form submissions.
|
|
19
|
+
*/
|
|
20
|
+
name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The size of the Switch.
|
|
23
|
+
*/
|
|
24
|
+
size?: SwitchVariants['size'];
|
|
25
|
+
/**
|
|
26
|
+
* The visual intent (e.g., color or style) of the Switch.
|
|
27
|
+
* @defaultValue 'primary'
|
|
28
|
+
*/
|
|
29
|
+
intent?: SwitchVariants['intent'];
|
|
30
|
+
/**
|
|
31
|
+
* Custom classes to style different slots of the Switch component.
|
|
32
|
+
*/
|
|
33
|
+
classes?: SlotsToClasses<SwitchSlots>;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the Switch is disabled.
|
|
36
|
+
* When true, user interaction is prevented.
|
|
37
|
+
*/
|
|
38
|
+
isDisabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Callback triggered when the Switch value changes.
|
|
41
|
+
* Receives the new boolean value and, optionally, the triggering Event.
|
|
42
|
+
*/
|
|
43
|
+
onChange?: ((value: boolean, event: Event) => void) | ((value: boolean) => void);
|
|
44
|
+
}
|
|
45
|
+
interface SwitchSignature {
|
|
46
|
+
Args: Args;
|
|
47
|
+
Blocks: {
|
|
48
|
+
startContent: [];
|
|
49
|
+
thumbContent: [{
|
|
50
|
+
isSelected: boolean;
|
|
51
|
+
}];
|
|
52
|
+
endContent: [];
|
|
53
|
+
};
|
|
54
|
+
Element: HTMLInputElement;
|
|
55
|
+
}
|
|
56
|
+
declare class Switch extends Component<SwitchSignature> {
|
|
57
|
+
_isSelected: boolean;
|
|
58
|
+
constructor(owner: Owner, args: Args);
|
|
59
|
+
get isControlled(): boolean;
|
|
60
|
+
get isSelected(): boolean;
|
|
61
|
+
handleChange: (event: Event) => void;
|
|
62
|
+
get classes(): {
|
|
63
|
+
base: (slotProps?: ({
|
|
64
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
65
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
66
|
+
isDisabled?: boolean | undefined;
|
|
67
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
68
|
+
labelContainer: (slotProps?: ({
|
|
69
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
70
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
71
|
+
isDisabled?: boolean | undefined;
|
|
72
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
73
|
+
label: (slotProps?: ({
|
|
74
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
75
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
76
|
+
isDisabled?: boolean | undefined;
|
|
77
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
78
|
+
wrapper: (slotProps?: ({
|
|
79
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
80
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
81
|
+
isDisabled?: boolean | undefined;
|
|
82
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
83
|
+
hiddenInput: (slotProps?: ({
|
|
84
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
85
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
86
|
+
isDisabled?: boolean | undefined;
|
|
87
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
88
|
+
thumb: (slotProps?: ({
|
|
89
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
90
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
91
|
+
isDisabled?: boolean | undefined;
|
|
92
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
93
|
+
startContent: (slotProps?: ({
|
|
94
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
95
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
96
|
+
isDisabled?: boolean | undefined;
|
|
97
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
98
|
+
endContent: (slotProps?: ({
|
|
99
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
100
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
101
|
+
isDisabled?: boolean | undefined;
|
|
102
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
103
|
+
} & {
|
|
104
|
+
base: (slotProps?: ({
|
|
105
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
106
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
107
|
+
isDisabled?: boolean | undefined;
|
|
108
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
109
|
+
labelContainer: (slotProps?: ({
|
|
110
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
111
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
112
|
+
isDisabled?: boolean | undefined;
|
|
113
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
114
|
+
label: (slotProps?: ({
|
|
115
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
116
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
117
|
+
isDisabled?: boolean | undefined;
|
|
118
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
119
|
+
wrapper: (slotProps?: ({
|
|
120
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
121
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
122
|
+
isDisabled?: boolean | undefined;
|
|
123
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
124
|
+
hiddenInput: (slotProps?: ({
|
|
125
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
126
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
127
|
+
isDisabled?: boolean | undefined;
|
|
128
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
129
|
+
thumb: (slotProps?: ({
|
|
130
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
131
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
132
|
+
isDisabled?: boolean | undefined;
|
|
133
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
134
|
+
startContent: (slotProps?: ({
|
|
135
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
136
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
137
|
+
isDisabled?: boolean | undefined;
|
|
138
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
139
|
+
endContent: (slotProps?: ({
|
|
140
|
+
intent?: "default" | "primary" | "success" | "danger" | "warning" | undefined;
|
|
141
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
142
|
+
isDisabled?: boolean | undefined;
|
|
143
|
+
} & import("tailwind-variants").ClassProp<import("tailwind-merge").ClassNameValue>) | undefined) => string;
|
|
144
|
+
} & {};
|
|
145
|
+
}
|
|
146
|
+
export { Switch, type SwitchSignature };
|
|
147
|
+
export default Switch;
|
|
148
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/components/switch.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAe,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,UAAU,IAAK,SAAQ,qBAAqB;IAC1C;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAE9B;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cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@frontile/forms/components/switch";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { on } from '@ember/modifier';
|
|
3
|
+
import { FormControl } from './form-control.js';
|
|
4
|
+
import { useStyles } from '@frontile/theme';
|
|
5
|
+
import { tracked } from '@ember/-internals/metal';
|
|
6
|
+
import { hash } from '@ember/helper';
|
|
7
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
8
|
+
import { setComponentTemplate } from '@ember/component';
|
|
9
|
+
import { a as decorateFieldV2, i as initializeDeferredDecorator } from '../runtime-BPCpkOf1-BKOwiRJp.js';
|
|
10
|
+
|
|
11
|
+
class Switch extends Component {
|
|
12
|
+
static {
|
|
13
|
+
decorateFieldV2(this.prototype, "_isSelected", [tracked]);
|
|
14
|
+
}
|
|
15
|
+
#_isSelected = (initializeDeferredDecorator(this, "_isSelected"), void 0);
|
|
16
|
+
constructor(owner, args) {
|
|
17
|
+
super(owner, args);
|
|
18
|
+
this._isSelected = this.args.defaultSelected ? true : false;
|
|
19
|
+
}
|
|
20
|
+
get isControlled() {
|
|
21
|
+
return typeof this.args.isSelected === 'boolean';
|
|
22
|
+
}
|
|
23
|
+
get isSelected() {
|
|
24
|
+
if (this.isControlled) {
|
|
25
|
+
return !!this.args.isSelected;
|
|
26
|
+
}
|
|
27
|
+
return this._isSelected;
|
|
28
|
+
}
|
|
29
|
+
handleChange = event => {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
const value = !this.isSelected;
|
|
32
|
+
this._isSelected = value;
|
|
33
|
+
if (typeof this.args.onChange === 'function') {
|
|
34
|
+
this.args.onChange(value, event);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
get classes() {
|
|
38
|
+
const {
|
|
39
|
+
switchInput
|
|
40
|
+
} = useStyles();
|
|
41
|
+
return switchInput({
|
|
42
|
+
size: this.args.size,
|
|
43
|
+
intent: this.args.intent,
|
|
44
|
+
isDisabled: this.args.isDisabled
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
static {
|
|
48
|
+
setComponentTemplate(precompileTemplate("\n <FormControl @isInvalid={{@isInvalid}} @errors={{@errors}} @size={{@size}} @isRequired={{@isRequired}} @class={{this.classes.base class=@classes.base}} @preventErrorFeedback={{true}} data-component=\"switch\" data-selected=\"{{this.isSelected}}\" data-disabled=\"{{@isDisabled}}\" as |c|>\n <span class={{this.classes.wrapper class=@classes.wrapper}}>\n <input {{on \"change\" this.handleChange}} id={{c.id}} name={{@name}} checked={{this.isSelected}} class={{this.classes.hiddenInput class=@classes.hiddenInput}} type=\"checkbox\" disabled={{@isDisabled}} aria-invalid={{if c.isInvalid \"true\"}} aria-describedby={{c.describedBy @description c.isInvalid}} ...attributes />\n {{#if (has-block \"startContent\")}}\n <div data-test-id=\"switch-start-content\" class={{this.classes.startContent class=@classes.startContent}}>\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n\n <span class={{this.classes.thumb class=@classes.thumb}} data-test-id=\"switch-thumb-content\">\n {{#if (has-block \"thumbContent\")}}\n {{yield (hash isSelected=this.isSelected) to=\"thumbContent\"}}\n {{/if}}\n\n </span>\n {{#if (has-block \"endContent\")}}\n <div data-test-id=\"switch-end-content\" class={{this.classes.endContent class=@classes.endContent}}>\n {{yield to=\"endContent\"}}\n </div>\n {{/if}}\n </span>\n\n <div class={{this.classes.labelContainer class=@classes.labelContainer}}>\n {{#if @label}}\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n ", {
|
|
49
|
+
strictMode: true,
|
|
50
|
+
scope: () => ({
|
|
51
|
+
FormControl,
|
|
52
|
+
on,
|
|
53
|
+
hash
|
|
54
|
+
})
|
|
55
|
+
}), this);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { Switch, Switch as default };
|
|
60
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.js","sources":["../../src/components/switch.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type SwitchVariants,\n type SwitchSlots,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { tracked } from '@ember/-internals/metal';\nimport type Owner from '@ember/owner';\nimport { hash } from '@ember/helper';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * Controls the current selected state of the Switch.\n * When provided a boolean value, the component operates in a controlled mode.\n */\n isSelected?: boolean;\n\n /**\n * Sets the initial selected state of the Switch when used in uncontrolled mode.\n * @defaultValue false\n */\n defaultSelected?: boolean;\n\n /**\n * The name attribute for the input element.\n * Useful for form submissions.\n */\n name?: string;\n\n /**\n * The size of the Switch.\n */\n size?: SwitchVariants['size'];\n\n /**\n * The visual intent (e.g., color or style) of the Switch.\n * @defaultValue 'primary'\n */\n intent?: SwitchVariants['intent'];\n\n /**\n * Custom classes to style different slots of the Switch component.\n */\n classes?: SlotsToClasses<SwitchSlots>;\n\n /**\n * Whether the Switch is disabled.\n * When true, user interaction is prevented.\n */\n isDisabled?: boolean;\n\n /**\n * Callback triggered when the Switch value changes.\n * Receives the new boolean value and, optionally, the triggering Event.\n */\n onChange?:\n | ((value: boolean, event: Event) => void)\n | ((value: boolean) => void);\n}\n\ninterface SwitchSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n thumbContent: [{ isSelected: boolean }];\n endContent: [];\n };\n\n Element: HTMLInputElement;\n}\n\nclass Switch extends Component<SwitchSignature> {\n @tracked _isSelected;\n\n constructor(owner: Owner, args: Args) {\n super(owner, args);\n\n this._isSelected = this.args.defaultSelected ? true : false;\n }\n\n get isControlled(): boolean {\n return typeof this.args.isSelected === 'boolean';\n }\n\n get isSelected(): boolean {\n if (this.isControlled) {\n return !!this.args.isSelected;\n }\n return this._isSelected;\n }\n\n handleChange = (event: Event) => {\n event.preventDefault();\n\n const value = !this.isSelected;\n this._isSelected = value;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n };\n\n get classes() {\n const { switchInput } = useStyles();\n return switchInput({\n size: this.args.size,\n intent: this.args.intent,\n isDisabled: this.args.isDisabled\n });\n }\n\n <template>\n <FormControl\n @isInvalid={{@isInvalid}}\n @errors={{@errors}}\n @size={{@size}}\n @isRequired={{@isRequired}}\n @class={{this.classes.base class=@classes.base}}\n @preventErrorFeedback={{true}}\n data-component=\"switch\"\n data-selected=\"{{this.isSelected}}\"\n data-disabled=\"{{@isDisabled}}\"\n as |c|\n >\n <span class={{this.classes.wrapper class=@classes.wrapper}}>\n <input\n {{on \"change\" this.handleChange}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isSelected}}\n class={{this.classes.hiddenInput class=@classes.hiddenInput}}\n type=\"checkbox\"\n disabled={{@isDisabled}}\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (has-block \"startContent\")}}\n <div\n data-test-id=\"switch-start-content\"\n class={{this.classes.startContent class=@classes.startContent}}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n\n <span\n class={{this.classes.thumb class=@classes.thumb}}\n data-test-id=\"switch-thumb-content\"\n >\n {{#if (has-block \"thumbContent\")}}\n {{yield (hash isSelected=this.isSelected) to=\"thumbContent\"}}\n {{/if}}\n\n </span>\n {{#if (has-block \"endContent\")}}\n <div\n data-test-id=\"switch-end-content\"\n class={{this.classes.endContent class=@classes.endContent}}\n >\n {{yield to=\"endContent\"}}\n </div>\n {{/if}}\n </span>\n\n <div class={{this.classes.labelContainer class=@classes.labelContainer}}>\n {{#if @label}}\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Switch, type SwitchSignature };\nexport default Switch;\n"],"names":["Switch","Component","g","prototype","tracked","i","void 0","constructor","owner","args","_isSelected","defaultSelected","isControlled","isSelected","handleChange","event","preventDefault","value","onChange","classes","switchInput","useStyles","size","intent","isDisabled","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","hash"],"mappings":";;;;;;;;;;AA0EA,MAAMA,eAAeC,SAAU,CAAA;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAC5BC,OAAA,CAAA,CAAA;AAAA;AAAA,EAAA,YAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,aAAA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QAAAC,EAAA;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":";;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontile/forms",
|
|
3
|
-
"version": "0.17.0-beta.
|
|
3
|
+
"version": "0.17.0-beta.9",
|
|
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.17.0-beta.
|
|
58
|
-
"@frontile/collections": "0.17.0-beta.
|
|
59
|
-
"@frontile/overlays": "0.17.0-beta.
|
|
60
|
-
"@frontile/theme": "0.17.0-beta.
|
|
61
|
-
"@frontile/utilities": "0.17.0-beta.
|
|
57
|
+
"@frontile/buttons": "0.17.0-beta.9",
|
|
58
|
+
"@frontile/collections": "0.17.0-beta.9",
|
|
59
|
+
"@frontile/overlays": "0.17.0-beta.9",
|
|
60
|
+
"@frontile/theme": "0.17.0-beta.9",
|
|
61
|
+
"@frontile/utilities": "0.17.0-beta.9",
|
|
62
62
|
"@glint/template": "1.5.2",
|
|
63
63
|
"ember-modifier": "^4.1.0"
|
|
64
64
|
},
|
|
@@ -115,8 +115,9 @@
|
|
|
115
115
|
"./components/radio-group.js": "./dist/_app_/components/radio-group.js",
|
|
116
116
|
"./components/radio.js": "./dist/_app_/components/radio.js",
|
|
117
117
|
"./components/select.js": "./dist/_app_/components/select.js",
|
|
118
|
+
"./components/switch.js": "./dist/_app_/components/switch.js",
|
|
118
119
|
"./components/textarea.js": "./dist/_app_/components/textarea.js"
|
|
119
120
|
}
|
|
120
121
|
},
|
|
121
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "374df62369fbace3fa5a8cc29611e384ccb48ab0"
|
|
122
123
|
}
|