@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.
Files changed (47) hide show
  1. package/declarations/components/input.d.ts.map +1 -1
  2. package/declarations/components/select.d.ts +116 -4
  3. package/declarations/components/select.d.ts.map +1 -1
  4. package/declarations/components/switch.d.ts +148 -0
  5. package/declarations/components/switch.d.ts.map +1 -0
  6. package/declarations/index.d.ts +1 -0
  7. package/declarations/index.d.ts.map +1 -1
  8. package/declarations/test-support.d.ts +3 -0
  9. package/declarations/test-support.d.ts.map +1 -0
  10. package/dist/_app_/components/switch.js +1 -0
  11. package/dist/components/checkbox-group.js +9 -9
  12. package/dist/components/checkbox-group.js.map +1 -1
  13. package/dist/components/checkbox.js +15 -10
  14. package/dist/components/checkbox.js.map +1 -1
  15. package/dist/components/form-control.js +25 -29
  16. package/dist/components/form-control.js.map +1 -1
  17. package/dist/components/form-description.js +5 -5
  18. package/dist/components/form-description.js.map +1 -1
  19. package/dist/components/form-feedback.js +5 -5
  20. package/dist/components/form-feedback.js.map +1 -1
  21. package/dist/components/form.js +28 -32
  22. package/dist/components/form.js.map +1 -1
  23. package/dist/components/input.js +28 -25
  24. package/dist/components/input.js.map +1 -1
  25. package/dist/components/label.js +5 -5
  26. package/dist/components/label.js.map +1 -1
  27. package/dist/components/native-select.js +42 -42
  28. package/dist/components/native-select.js.map +1 -1
  29. package/dist/components/radio-group.js +9 -9
  30. package/dist/components/radio-group.js.map +1 -1
  31. package/dist/components/radio.js +15 -10
  32. package/dist/components/radio.js.map +1 -1
  33. package/dist/components/select.js +106 -72
  34. package/dist/components/select.js.map +1 -1
  35. package/dist/components/switch.js +60 -0
  36. package/dist/components/switch.js.map +1 -0
  37. package/dist/components/textarea.js +18 -10
  38. package/dist/components/textarea.js.map +1 -1
  39. package/dist/index.js +1 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/runtime-BPCpkOf1-YDR_IEBR.js +67 -0
  42. package/dist/runtime-BPCpkOf1-YDR_IEBR.js.map +1 -0
  43. package/dist/test-support.js +1337 -0
  44. package/dist/test-support.js.map +1 -0
  45. package/package.json +53 -54
  46. package/declarations/index-CeaQc-U7.d.ts +0 -3
  47. package/declarations/index-CeaQc-U7.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/components/input.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAI3C,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAKzE,UAAU,IAAK,SAAQ,qBAAqB;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAErC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5C;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1C;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAEtD;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CACxD;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE;QACN,YAAY,EAAE,EAAE,CAAC;QACjB,UA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AyB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5C;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1C;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAEtD;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CACxD;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE;QACN,YAAY,EAAE,EAAE,CAAC;QACjB,UAAU,EAAE,EAAE,CAAC;KAChB,CAAC;IACF,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAMD,cAAM,KAAM,SAAQ,SAAS,CAAC,cAAc,CAAC;IAClC,iBAAiB,EAAE,MAAM,CAAM;IAExC,QAAQ;;;;;8BA9DR,mCACU;;;;MA6DyB;IAEnC,IAAI,YAAY,YAKf;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,IAAI,IAAI,IAAI,MAAM,CAKjB;IAEO,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAUjC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAUlC,UAAU,IAAI,IAAI;IAY1B,IAAI,WAAW,IAAI,OAAO,CASzB;IAED,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAKV;CAgEF;AAED,OAAO,EAAE,KAAK,EAAE,KAAK,cAAc,EAAE,CAAC;AACtC,eAAe,KAAK,CAAC"}
@@ -5,10 +5,33 @@ import { type SelectSlots, type SelectVariants, type SlotsToClasses } from '@fro
5
5
  import { type PopoverSignature, type ContentSignature } from '@frontile/overlays';
6
6
  import { type FormControlSharedArgs } from './form-control';
7
7
  interface SelectArgs<T> extends Pick<PopoverSignature['Args'], 'placement' | 'flipOptions' | 'middleware' | 'shiftOptions' | 'offsetOptions' | 'strategy' | 'didClose'>, Pick<ListboxSignature<T>['Args'], 'appearance' | 'intent' | 'selectedKeys' | 'disabledKeys' | 'allowEmpty' | 'onSelectionChange' | 'items' | 'onAction'>, Pick<ContentSignature['Args'], 'renderInPlace' | 'target' | 'transitionDuration' | 'backdrop' | 'disableTransitions' | 'focusTrapOptions' | 'closeOnOutsideClick' | 'closeOnEscapeKey' | 'backdropTransition' | 'transition'>, FormControlSharedArgs {
8
+ /**
9
+ * Determines the selection mode of the select component.
10
+ * - 'single': Only one item can be selected at a time.
11
+ * - 'multiple': Allows multiple selections.
12
+ * @defaultValue 'single'
13
+ */
8
14
  selectionMode?: 'single' | 'multiple';
15
+ /**
16
+ * The unique identifier for the select component.
17
+ */
9
18
  id?: string;
19
+ /**
20
+ * Defines the input size of the select.
21
+ */
10
22
  inputSize?: SelectVariants['size'];
11
- popoverSize?: 'sm' | 'md' | 'lg';
23
+ /**
24
+ * Defines the size of the popover dropdown.
25
+ * - 'sm': Small
26
+ * - 'md': Medium
27
+ * - 'lg': Large
28
+ * 'trigger': Same size as the trigger
29
+ * @defaultValue 'trigger'
30
+ */
31
+ popoverSize?: 'sm' | 'md' | 'lg' | 'trigger';
32
+ /**
33
+ * Custom classes to style different slots within the select component.
34
+ */
12
35
  classes?: SlotsToClasses<SelectSlots>;
13
36
  /**
14
37
  * Whether the select should close upon selecting an item.
@@ -17,19 +40,54 @@ interface SelectArgs<T> extends Pick<PopoverSignature['Args'], 'placement' | 'fl
17
40
  */
18
41
  closeOnItemSelect?: boolean;
19
42
  /**
43
+ * Whether scrolling should be blocked when the select dropdown is open.
44
+ *
20
45
  * @defaultValue true
21
46
  */
22
47
  blockScroll?: boolean;
23
48
  /**
24
- * @defaultValue false
49
+ * Whether the focus trap should be disabled when the dropdown is open.
50
+ *
51
+ * @defaultValue true
25
52
  */
26
53
  disableFocusTrap?: boolean;
54
+ /**
55
+ * The placeholder text displayed when no option is selected.
56
+ */
27
57
  placeholder?: string;
58
+ /**
59
+ * Whether the select should be disabled, preventing user interaction.
60
+ */
28
61
  isDisabled?: boolean;
62
+ /**
63
+ * Allows filtering of the items in the select dropdown.
64
+ * If true, a search input is displayed for filtering.
65
+ *
66
+ * @defaultValue false
67
+ */
68
+ isFilterable?: boolean;
69
+ /**
70
+ * Function to filter the items in the select.
71
+ * The default implementation performs a case-insensitive search.
72
+ *
73
+ * @param itemValue - The value of an item in the dropdown.
74
+ * @param filterValue - The user's input in the filter/search box.
75
+ * @returns A boolean indicating whether the item should be shown.
76
+ */
77
+ filter?: (itemValue: string, filterValue: string) => boolean;
78
+ /**
79
+ * If true, the select will show a loading spinner instead of the dropdown icon.
80
+ */
81
+ isLoading?: boolean;
82
+ /**
83
+ * The name attribute for the select component, useful for form submissions.
84
+ */
29
85
  name?: string;
30
86
  /**
31
- * Whether to include a clear button.
32
- * It ignores the option allowEmpty.
87
+ * Whether to include a clear button in the select component.
88
+ * If enabled, this allows users to clear the selection.
89
+ * This option ignores the `allowEmpty` setting.
90
+ *
33
91
  * @defaultValue false
34
92
  */
35
93
  isClearable?: boolean;
@@ -49,19 +107,43 @@ interface SelectArgs<T> extends Pick<PopoverSignature['Args'], 'placement' | 'fl
49
107
  * @defaultValue 'none'
50
108
  */
51
109
  endContentPointerEvents?: 'none' | 'auto';
110
+ /**
111
+ * If true, hides the empty content when there are no options available.
112
+ *
113
+ * @defaultValue false
114
+ */
115
+ hideEmptyContent?: boolean;
52
116
  }
53
117
  interface SelectSignature<T> {
54
118
  Args: SelectArgs<T>;
55
119
  Element: HTMLDivElement;
56
120
  Blocks: ListboxSignature<T>['Blocks'] & {
121
+ /**
122
+ * Content to display at the **beginning** of the select component.
123
+ * This can be an icon, a label, or any custom UI element.
124
+ *
125
+ * Example: A search icon or a custom label.
126
+ */
57
127
  startContent: [];
128
+ /**
129
+ * Content to display at the **end** of the select component.
130
+ * This can be an icon, a button, or any custom UI element.
131
+ *
132
+ * Example: A clear button or a dropdown arrow.
133
+ */
58
134
  endContent: [];
135
+ /**
136
+ * The content to display when there are no available options.
137
+ * If `hideEmptyContent` argument is true, this content will not be shown.
138
+ */
139
+ emptyContent: [];
59
140
  };
60
141
  }
61
142
  declare class Select<T = unknown> extends Component<SelectSignature<T>> {
62
143
  nodes: ListItem[];
63
144
  isOpen: boolean;
64
145
  _selectedKeys: string[];
146
+ filterValue?: string;
65
147
  containerRef: {
66
148
  readonly element: HTMLDivElement | undefined;
67
149
  setup: import("ember-modifier").FunctionBasedModifier<{
@@ -72,14 +154,26 @@ declare class Select<T = unknown> extends Component<SelectSignature<T>> {
72
154
  Element: HTMLDivElement;
73
155
  }>;
74
156
  };
157
+ triggerRef: {
158
+ readonly element: HTMLInputElement | HTMLButtonElement | undefined;
159
+ setup: import("ember-modifier").FunctionBasedModifier<{
160
+ Args: {
161
+ Positional: unknown[];
162
+ Named: import("ember-modifier/-private/signature").EmptyObject;
163
+ };
164
+ Element: HTMLInputElement | HTMLButtonElement;
165
+ }>;
166
+ };
75
167
  onSelectionChange: (keys: string[]) => void;
76
168
  onOpenChange: (isOpen: boolean) => void;
169
+ onFilterChange: (event: Event) => void;
77
170
  get selectedKeys(): string[];
78
171
  get blockScroll(): boolean;
79
172
  get disableFocusTrap(): boolean;
80
173
  onAction: (key: string) => void;
81
174
  clearSelectedKeys: (event: Event) => void;
82
175
  onItemsChange: (nodes: ListItem[], _: "add" | "remove") => void;
176
+ didClose: () => void;
83
177
  get selectedText(): string;
84
178
  get selectedTextValue(): string;
85
179
  get backdrop(): "blur" | "none" | "transparent" | "faded";
@@ -155,8 +249,26 @@ declare class Select<T = unknown> extends Component<SelectSignature<T>> {
155
249
  hasStartContent?: boolean | undefined;
156
250
  hasEndContent?: boolean | undefined;
157
251
  } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
252
+ input: (slotProps?: ({
253
+ size?: "sm" | "md" | "lg" | undefined;
254
+ startContentPointerEvents?: "none" | "auto" | undefined;
255
+ endContentPointerEvents?: "none" | "auto" | undefined;
256
+ hasStartContent?: boolean | undefined;
257
+ hasEndContent?: boolean | undefined;
258
+ } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
259
+ emptyContent: (slotProps?: ({
260
+ size?: "sm" | "md" | "lg" | undefined;
261
+ startContentPointerEvents?: "none" | "auto" | undefined;
262
+ endContentPointerEvents?: "none" | "auto" | undefined;
263
+ hasStartContent?: boolean | undefined;
264
+ hasEndContent?: boolean | undefined;
265
+ } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string;
158
266
  } & {};
159
267
  get isClearable(): boolean | undefined;
268
+ get filterFieldValue(): string;
269
+ get filteredItems(): T[] | undefined;
270
+ get showEmptyContent(): boolean;
271
+ get autoActivateMode(): 'first' | 'selected';
160
272
  }
161
273
  export { Select, type SelectSignature };
162
274
  export default Select;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAe,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAKzE,UAAU,UAAU,CAAC,CAAC,CACpB,SAAQ,IAAI,CACR,gBAAgB,CAAC,MAAM,CAAC,EACtB,WAAW,GACX,aAAa,GACb,YAAY,GACZ,cAAc,GACd,eAAe,GACf,UAAU,G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EF,YAAY,WAAY,OAAO,UAE7B;IAEF,cAAc,UAAW,KAAK,UAG5B;IAEF,IAAI,YAAY,IAAI,MAAM,EAAE,CAS3B;IAED,IAAI,WAAW,YAKd;IAED,IAAI,gBAAgB,YAKnB;IAED,QAAQ,QAAS,MAAM,UAWrB;IAEF,iBAAiB,UAAW,KAAK,UAG/B;IAEF,aAAa,UAAW,QAAQ,EAAE,KAAK,KAAK,GAAG,QAAQ,UAErD;IAEF,QAAQ,aAKN;IAEF,IAAI,YAAY,WAEf;IAED,IAAI,iBAAiB,IAAI,MAAM,CAQ9B;IAED,IAAI,QAAQ,8CAKX;IAED,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAKV;IAED,IAAI,WAAW,wBAId;IAED,IAAI,gBAAgB,WAKnB;IAED,IAAI,aAAa,oBAahB;IAED,IAAI,gBAAgB,YAEnB;IAED,IAAI,gBAAgB,IAAI,OAAO,GAAG,UAAU,CAK3C;CAuNF;AAID,OAAO,EAAE,MAAM,EAAE,KAAK,eAAe,EAAE,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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-variants").ClassValue>) | 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":[],"mapp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IAAI,OAAO,CAE1B;IAED,IAAI,UAAU,IAAI,OAAO,CAKxB;IAED,YAAY,UAAW,KAAK,UAS1B;IAEF,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAOV;CAwGF;AAED,OAAO,EAAE,MAAM,EAAE,KAAK,eAAe,EAAE,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -11,4 +11,5 @@ export * from './components/textarea';
11
11
  export * from './components/radio';
12
12
  export * from './components/radio-group';
13
13
  export * from './components/form-control';
14
+ export * from './components/switch';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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,3 @@
1
+ export declare function selectOptionByKey(selectSelector: string, key: string): Promise<void>;
2
+ export declare function toggleOptionByKey(selectSelector: string, key: string): Promise<void>;
3
+ //# sourceMappingURL=test-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../src/test-support.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -0,0 +1 @@
1
+ export { default } from "@frontile/forms/components/switch";
@@ -5,7 +5,6 @@ import { useStyles } from '@frontile/theme';
5
5
  import { precompileTemplate } from '@ember/template-compilation';
6
6
  import { setComponentTemplate } from '@ember/component';
7
7
 
8
- var _CheckboxGroup;
9
8
  class CheckboxGroup extends Component {
10
9
  get classes() {
11
10
  const {
@@ -15,15 +14,16 @@ class CheckboxGroup extends Component {
15
14
  size: this.args.size
16
15
  });
17
16
  }
17
+ static {
18
+ setComponentTemplate(precompileTemplate("\n <FormControl @size={{@size}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @class={{this.classes.base class=@classes.base}} ...attributes as |c|>\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n <div class={{this.classes.optionsContainer class=@classes.optionsContainer}} data-orientation={{if @orientation @orientation \"vertical\"}}>\n {{yield (component Checkbox name=@name onChange=@onChange size=@size) to=\"default\"}}\n </div>\n </FormControl>\n ", {
19
+ strictMode: true,
20
+ scope: () => ({
21
+ FormControl,
22
+ Checkbox
23
+ })
24
+ }), this);
25
+ }
18
26
  }
19
- _CheckboxGroup = CheckboxGroup;
20
- setComponentTemplate(precompileTemplate("\n <FormControl @size={{@size}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @class={{this.classes.base class=@classes.base}} ...attributes as |c|>\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n <div class={{this.classes.optionsContainer class=@classes.optionsContainer}} data-orientation={{if @orientation @orientation \"vertical\"}}>\n {{yield (component Checkbox name=@name onChange=@onChange size=@size) to=\"default\"}}\n </div>\n </FormControl>\n ", {
21
- strictMode: true,
22
- scope: () => ({
23
- FormControl,
24
- Checkbox
25
- })
26
- }), _CheckboxGroup);
27
27
 
28
28
  export { CheckboxGroup, CheckboxGroup as default };
29
29
  //# sourceMappingURL=checkbox-group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox-group.js","sources":["../../src/components/checkbox-group.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { Checkbox, type CheckboxSignature } from './checkbox';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type CheckboxGroupVariants,\n type CheckboxGroupSlots,\n type SlotsToClasses\n} from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface Args extends FormControlSharedArgs {\n name?: string;\n onChange?: CheckboxSignature['Args']['onChange'];\n size?: CheckboxGroupVariants['size'];\n classes?: SlotsToClasses<CheckboxGroupSlots>;\n\n /*\n *\n * @defaultValue 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n}\n\ninterface CheckboxGroupSignature {\n Args: Args;\n Blocks: {\n default: [Checkbox: WithBoundArgs<typeof Checkbox, 'name' | 'onChange'>];\n };\n Element: HTMLDivElement;\n}\n\nclass CheckboxGroup extends Component<CheckboxGroupSignature> {\n get classes() {\n const { checkboxGroup } = useStyles();\n return checkboxGroup({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n ...attributes\n as |c|\n >\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n <div\n class={{this.classes.optionsContainer class=@classes.optionsContainer}}\n data-orientation={{if @orientation @orientation \"vertical\"}}\n >\n {{yield\n (component Checkbox name=@name onChange=@onChange size=@size)\n to=\"default\"\n }}\n </div>\n </FormControl>\n </template>\n}\n\nexport { CheckboxGroup, type CheckboxGroupSignature };\nexport default CheckboxGroup;\n"],"names":["CheckboxGroup","Component","classes","checkboxGroup","useStyles","size","args","_CheckboxGroup","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Checkbox"],"mappings":";;;;;;;;AAgCA,MAAMA,sBAAsBC,SAAU,CAAA;EACpC,IAAIC,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAe,GAAGC,SAAA,EAAA;AAC1B,IAAA,OAAOD,aAAc,CAAA;AACnBE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD;AAClB,KAAA,CAAA;AACF;AA2BF;AAAAE,cAAA,GAjCMP;AAQJQ,oBAAA,CAAAC,kBAAA,CAwBA,ulBAAA,EAAA;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,WAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAN,cAAA,CAAA;;;;"}
1
+ {"version":3,"file":"checkbox-group.js","sources":["../../src/components/checkbox-group.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { Checkbox, type CheckboxSignature } from './checkbox';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type CheckboxGroupVariants,\n type CheckboxGroupSlots,\n type SlotsToClasses\n} from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface Args extends FormControlSharedArgs {\n name?: string;\n onChange?: CheckboxSignature['Args']['onChange'];\n size?: CheckboxGroupVariants['size'];\n classes?: SlotsToClasses<CheckboxGroupSlots>;\n\n /*\n *\n * @defaultValue 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n}\n\ninterface CheckboxGroupSignature {\n Args: Args;\n Blocks: {\n default: [Checkbox: WithBoundArgs<typeof Checkbox, 'name' | 'onChange'>];\n };\n Element: HTMLDivElement;\n}\n\nclass CheckboxGroup extends Component<CheckboxGroupSignature> {\n get classes() {\n const { checkboxGroup } = useStyles();\n return checkboxGroup({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n ...attributes\n as |c|\n >\n <c.Label @class={{this.classes.label class=@classes.label}}>\n {{@label}}\n </c.Label>\n <div\n class={{this.classes.optionsContainer class=@classes.optionsContainer}}\n data-orientation={{if @orientation @orientation \"vertical\"}}\n >\n {{yield\n (component Checkbox name=@name onChange=@onChange size=@size)\n to=\"default\"\n }}\n </div>\n </FormControl>\n </template>\n}\n\nexport { CheckboxGroup, type CheckboxGroupSignature };\nexport default CheckboxGroup;\n"],"names":["CheckboxGroup","Component","classes","checkboxGroup","useStyles","size","args","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Checkbox"],"mappings":";;;;;;;AAgCA,MAAMA,sBAAsBC,SAAU,CAAA;EACpC,IAAIC,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAe,GAAGC,SAAA,EAAA;AAC1B,IAAA,OAAOD,aAAc,CAAA;AACnBE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD;AAClB,KAAA,CAAA;AACF;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAwBA,ulBAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -1,4 +1,3 @@
1
- import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
1
  import Component from '@glimmer/component';
3
2
  import { action } from '@ember/object';
4
3
  import { on } from '@ember/modifier';
@@ -6,9 +5,9 @@ import { FormControl } from './form-control.js';
6
5
  import { useStyles } from '@frontile/theme';
7
6
  import { precompileTemplate } from '@ember/template-compilation';
8
7
  import { setComponentTemplate } from '@ember/component';
8
+ import { d as decorateMethodV2 } from '../runtime-BPCpkOf1-YDR_IEBR.js';
9
9
 
10
- var _class, _Checkbox;
11
- let Checkbox = (_class = (_Checkbox = class Checkbox extends Component {
10
+ class Checkbox extends Component {
12
11
  get isChecked() {
13
12
  return !!this.args.checked;
14
13
  }
@@ -19,6 +18,9 @@ let Checkbox = (_class = (_Checkbox = class Checkbox extends Component {
19
18
  this.args.onChange(value, event);
20
19
  }
21
20
  }
21
+ static {
22
+ decorateMethodV2(this.prototype, "handleChange", [action]);
23
+ }
22
24
  get classes() {
23
25
  const {
24
26
  checkbox
@@ -27,13 +29,16 @@ let Checkbox = (_class = (_Checkbox = class Checkbox extends Component {
27
29
  size: this.args.size
28
30
  });
29
31
  }
30
- }, setComponentTemplate(precompileTemplate("\n <FormControl @isInvalid={{@isInvalid}} @errors={{@errors}} @size={{@size}} @isRequired={{@isRequired}} @class={{this.classes.base class=@classes.base}} @preventErrorFeedback={{true}} as |c|>\n <input {{on \"change\" this.handleChange}} id={{c.id}} name={{@name}} checked={{this.isChecked}} type=\"checkbox\" class={{this.classes.input class=@classes.input}} data-component=\"checkbox\" aria-invalid={{if c.isInvalid \"true\"}} aria-describedby={{c.describedBy @description c.isInvalid}} ...attributes />\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 ", {
31
- strictMode: true,
32
- scope: () => ({
33
- FormControl,
34
- on
35
- })
36
- }), _Checkbox), _Checkbox), _applyDecoratedDescriptor(_class.prototype, "handleChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "handleChange"), _class.prototype), _class);
32
+ static {
33
+ setComponentTemplate(precompileTemplate("\n <FormControl @isInvalid={{@isInvalid}} @errors={{@errors}} @size={{@size}} @isRequired={{@isRequired}} @class={{this.classes.base class=@classes.base}} @preventErrorFeedback={{true}} as |c|>\n <input {{on \"change\" this.handleChange}} id={{c.id}} name={{@name}} checked={{this.isChecked}} type=\"checkbox\" class={{this.classes.input class=@classes.input}} data-component=\"checkbox\" aria-invalid={{if c.isInvalid \"true\"}} aria-describedby={{c.describedBy @description c.isInvalid}} ...attributes />\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 ", {
34
+ strictMode: true,
35
+ scope: () => ({
36
+ FormControl,
37
+ on
38
+ })
39
+ }), this);
40
+ }
41
+ }
37
42
 
38
43
  export { Checkbox, Checkbox as default };
39
44
  //# sourceMappingURL=checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sources":["../../src/components/checkbox.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 CheckboxVariants,\n type CheckboxSlots,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface Args extends FormControlSharedArgs {\n checked?: boolean;\n name?: string;\n size?: CheckboxVariants['size'];\n classes?: SlotsToClasses<CheckboxSlots>;\n\n /*\n * Callback when onchange is triggered\n */\n onChange?: (value: boolean, event: Event) => void;\n}\n\ninterface CheckboxSignature {\n Args: Args;\n Element: HTMLInputElement;\n}\n\nclass Checkbox extends Component<CheckboxSignature> {\n get isChecked(): boolean {\n return !!this.args.checked;\n }\n\n @action handleChange(event: Event): void {\n event.preventDefault();\n\n const value = !this.args.checked;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n }\n\n get classes() {\n const { checkbox } = useStyles();\n return checkbox({\n size: this.args.size\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 as |c|\n >\n <input\n {{on \"change\" this.handleChange}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isChecked}}\n type=\"checkbox\"\n class={{this.classes.input class=@classes.input}}\n data-component=\"checkbox\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\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 { Checkbox, type CheckboxSignature };\nexport default Checkbox;\n"],"names":["Checkbox","Component","isChecked","args","checked","handleChange","event","preventDefault","value","onChange","classes","checkbox","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","_Checkbox","_applyDecoratedDescriptor","_class","prototype","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;AA4BMA,IAAAA,kCAAN,MAAMA,iBAAiBC,SAAU,CAAA;EAC/B,IAAIC,SAAAA,GAAqB;AACvB,IAAA,OAAO,CAAC,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO;AAC5B;EAEQC,YAAAA,CAAaC,KAAY,EAAQ;IACvCA,KAAA,CAAMC,cAAc,EAAA;AAEpB,IAAA,MAAMC,QAAQ,CAAC,IAAI,CAACL,IAAI,CAACC,OAAO;IAEhC,IAAI,OAAO,IAAI,CAACD,IAAI,CAACM,QAAQ,KAAK,UAAY,EAAA;MAC5C,IAAI,CAACN,IAAI,CAACM,QAAQ,CAACD,KAAO,EAAAF,KAAA,CAAA;AAC5B;AACF;EAEA,IAAII,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAU,GAAGC,SAAA,EAAA;AACrB,IAAA,OAAOD,QAAS,CAAA;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACV,IAAI,CAACU;AAClB,KAAA,CAAA;AACF;AAuCF,CAAA,EAAAC,oBAAA,CArCEC,kBAAA,CAoCA,48BAAA,EAAA;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,WAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,SAAA,CAAAA,EAAAA,SAAA,CAAAC,EAAAA,yBAAA,CAAAC,MAAA,CAAAC,SAAA,EArDTC,cAAAA,EAAAA,CAAAA,MAAA,GAAAC,MAAA,CAAAC,wBAAA,CAAAJ,MAAA,CAAAC,SAAA,EAAA,cAAA,CAAA,EAAAD,MAAA,CAAAC,SAAA,CAAA,EAAAD,MAAA;;;;"}
1
+ {"version":3,"file":"checkbox.js","sources":["../../src/components/checkbox.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 CheckboxVariants,\n type CheckboxSlots,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface Args extends FormControlSharedArgs {\n checked?: boolean;\n name?: string;\n size?: CheckboxVariants['size'];\n classes?: SlotsToClasses<CheckboxSlots>;\n\n /*\n * Callback when onchange is triggered\n */\n onChange?: (value: boolean, event: Event) => void;\n}\n\ninterface CheckboxSignature {\n Args: Args;\n Element: HTMLInputElement;\n}\n\nclass Checkbox extends Component<CheckboxSignature> {\n get isChecked(): boolean {\n return !!this.args.checked;\n }\n\n @action handleChange(event: Event): void {\n event.preventDefault();\n\n const value = !this.args.checked;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n }\n\n get classes() {\n const { checkbox } = useStyles();\n return checkbox({\n size: this.args.size\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 as |c|\n >\n <input\n {{on \"change\" this.handleChange}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isChecked}}\n type=\"checkbox\"\n class={{this.classes.input class=@classes.input}}\n data-component=\"checkbox\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\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 { Checkbox, type CheckboxSignature };\nexport default Checkbox;\n"],"names":["Checkbox","Component","isChecked","args","checked","handleChange","event","preventDefault","value","onChange","n","prototype","action","classes","checkbox","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;;;AA4BA,MAAMA,iBAAiBC,SAAU,CAAA;EAC/B,IAAIC,SAAAA,GAAqB;AACvB,IAAA,OAAO,CAAC,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO;AAC5B;EAEQC,YAAAA,CAAaC,KAAY,EAAQ;IACvCA,KAAA,CAAMC,cAAc,EAAA;AAEpB,IAAA,MAAMC,QAAQ,CAAC,IAAI,CAACL,IAAI,CAACC,OAAO;IAEhC,IAAI,OAAO,IAAI,CAACD,IAAI,CAACM,QAAQ,KAAK,UAAY,EAAA;MAC5C,IAAI,CAACN,IAAI,CAACM,QAAQ,CAACD,KAAO,EAAAF,KAAA,CAAA;AAC5B;AACF;AAAA,EAAA;IAAAI,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CARCC,MAAA,CAAA,CAAA;AAAA;EAUD,IAAIC,OAAUA,GAAA;IACZ,MAAM;AAAEC,MAAAA;KAAU,GAAGC,SAAA,EAAA;AACrB,IAAA,OAAOD,QAAS,CAAA;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACb,IAAI,CAACa;AAClB,KAAA,CAAA;AACF;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAoCA,48BAAA,EAAA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -1,4 +1,3 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
1
  import Component from '@glimmer/component';
3
2
  import { guidFor } from '@ember/object/internals';
4
3
  import { hash } from '@ember/helper';
@@ -8,33 +7,29 @@ import { Label } from './label.js';
8
7
  import { precompileTemplate } from '@ember/template-compilation';
9
8
  import { setComponentTemplate } from '@ember/component';
10
9
 
11
- var _FormControl;
12
10
  function or(arg1, arg2) {
13
11
  return !!(arg1 || arg2);
14
12
  }
15
13
  class FormControl extends Component {
16
- constructor(...args) {
17
- super(...args);
18
- _defineProperty(this, "id", this.args.id || guidFor(this));
19
- _defineProperty(this, "describedBy", (hasDescription, hasFeedback) => {
20
- const ids = [];
21
- if (hasDescription) {
22
- ids.push(this.descriptionId);
23
- }
24
- if (hasFeedback) {
25
- ids.push(this.feedbackId);
26
- }
27
- if (ids.length > 0) {
28
- return ids.join(' ');
29
- }
30
- });
31
- }
14
+ id = this.args.id || guidFor(this);
32
15
  get descriptionId() {
33
16
  return this.id + '-description';
34
17
  }
35
18
  get feedbackId() {
36
19
  return this.id + '-feedback';
37
20
  }
21
+ describedBy = (hasDescription, hasFeedback) => {
22
+ const ids = [];
23
+ if (hasDescription) {
24
+ ids.push(this.descriptionId);
25
+ }
26
+ if (hasFeedback) {
27
+ ids.push(this.feedbackId);
28
+ }
29
+ if (ids.length > 0) {
30
+ return ids.join(' ');
31
+ }
32
+ };
38
33
  get isInvalid() {
39
34
  if (this.args.isInvalid || this.args.errors && this.args.errors.length > 0) {
40
35
  return true;
@@ -48,18 +43,19 @@ class FormControl extends Component {
48
43
  }
49
44
  return false;
50
45
  }
46
+ static {
47
+ setComponentTemplate(precompileTemplate("\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 (hash id=this.id isInvalid=this.isInvalid describedBy=this.describedBy Label=(component Label for=this.id size=@size isRequired=@isRequired) Description=(component Description id=this.descriptionId size=@size) Feedback=(component Feedback id=this.feedbackId size=@size messages=@errors intent=\"danger\")) to=\"default\"}}\n\n {{#if this.showErrorFeedback}}\n <Feedback @id={{this.feedbackId}} @size={{@size}} @messages={{@errors}} @intent=\"danger\" />\n {{/if}}\n </div>\n ", {
48
+ strictMode: true,
49
+ scope: () => ({
50
+ or,
51
+ Label,
52
+ Description: FormDescription,
53
+ hash,
54
+ Feedback: FormFeedback
55
+ })
56
+ }), this);
57
+ }
51
58
  }
52
- _FormControl = FormControl;
53
- setComponentTemplate(precompileTemplate("\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 (hash id=this.id isInvalid=this.isInvalid describedBy=this.describedBy Label=(component Label for=this.id size=@size isRequired=@isRequired) Description=(component Description id=this.descriptionId size=@size) Feedback=(component Feedback id=this.feedbackId size=@size messages=@errors intent=\"danger\")) to=\"default\"}}\n\n {{#if this.showErrorFeedback}}\n <Feedback @id={{this.feedbackId}} @size={{@size}} @messages={{@errors}} @intent=\"danger\" />\n {{/if}}\n </div>\n ", {
54
- strictMode: true,
55
- scope: () => ({
56
- or,
57
- Label,
58
- Description: FormDescription,
59
- hash,
60
- Feedback: FormFeedback
61
- })
62
- }), _FormControl);
63
59
 
64
60
  export { FormControl, FormControl as default };
65
61
  //# sourceMappingURL=form-control.js.map